fix style
This commit is contained in:
parent
69b373045c
commit
e1596e8782
@ -219,9 +219,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleClickRowCell = useCallback((rowId) => {
|
const handleClickRowCell = useCallback((rowId) => {
|
||||||
setRowSelection((prev) => ({
|
setRowSelection((prev) => (prev[rowId] ? {} : { [rowId]: true }));
|
||||||
[rowId]: !prev[rowId],
|
|
||||||
}));
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleColumnSelect = useCallback((columnId) => {
|
const handleColumnSelect = useCallback((columnId) => {
|
||||||
@ -358,7 +356,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
|||||||
enableRowSelection: true,
|
enableRowSelection: true,
|
||||||
onRowSelectionChange: setRowSelection,
|
onRowSelectionChange: setRowSelection,
|
||||||
muiTableBodyRowProps: ({ row }) => ({
|
muiTableBodyRowProps: ({ row }) => ({
|
||||||
onClick: () => setRowSelection({ [row.id]: true }),
|
onClick: () => handleClickRowCell(row.id),
|
||||||
hover: false,
|
hover: false,
|
||||||
sx: {
|
sx: {
|
||||||
'& > td::after': {
|
'& > td::after': {
|
||||||
|
|||||||
@ -248,7 +248,8 @@ export const getTableColumns = ({
|
|||||||
size: 50,
|
size: 50,
|
||||||
enableEditing: false,
|
enableEditing: false,
|
||||||
Cell: ({ cell, row }) => {
|
Cell: ({ cell, row }) => {
|
||||||
const handleClick = useCallback(() => {
|
const handleClick = useCallback((event) => {
|
||||||
|
event.stopPropagation();
|
||||||
onCellNumberClick(row.id);
|
onCellNumberClick(row.id);
|
||||||
}, [row.id, onCellNumberClick]);
|
}, [row.id, onCellNumberClick]);
|
||||||
return <button type='button' onClick={handleClick}>{`${cell.getValue()} `}</button>;
|
return <button type='button' onClick={handleClick}>{`${cell.getValue()} `}</button>;
|
||||||
|
|||||||
@ -34,6 +34,7 @@ const valueAt = (row, path) => path.reduce((value, key) => value?.[key], row.dat
|
|||||||
const formatValue = (value) => {
|
const formatValue = (value) => {
|
||||||
if (value === null || value === undefined || value === '') return '—';
|
if (value === null || value === undefined || value === '') return '—';
|
||||||
const numericValue = typeof value === 'number' ? value : Number(value);
|
const numericValue = typeof value === 'number' ? value : Number(value);
|
||||||
|
if (numericValue === 0) return '-';
|
||||||
return Number.isNaN(numericValue) ? value : numberFormatter.format(numericValue);
|
return Number.isNaN(numericValue) ? value : numberFormatter.format(numericValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,7 @@ const tableSize = (rem) => rem * 16;
|
|||||||
const formatValue = (value) => {
|
const formatValue = (value) => {
|
||||||
if (value === null || value === undefined || value === '') return '—';
|
if (value === null || value === undefined || value === '') return '—';
|
||||||
const numericValue = typeof value === 'number' ? value : Number(value);
|
const numericValue = typeof value === 'number' ? value : Number(value);
|
||||||
|
if (numericValue === 0) return '-';
|
||||||
return Number.isNaN(numericValue) ? value : numberFormatter.format(numericValue);
|
return Number.isNaN(numericValue) ? value : numberFormatter.format(numericValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user