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) => {
|
||||
setRowSelection((prev) => ({
|
||||
[rowId]: !prev[rowId],
|
||||
}));
|
||||
setRowSelection((prev) => (prev[rowId] ? {} : { [rowId]: true }));
|
||||
}, []);
|
||||
|
||||
const handleColumnSelect = useCallback((columnId) => {
|
||||
@ -358,7 +356,7 @@ const RealtimeTable = ({ formType, formId, sheetName, direction, year }) => {
|
||||
enableRowSelection: true,
|
||||
onRowSelectionChange: setRowSelection,
|
||||
muiTableBodyRowProps: ({ row }) => ({
|
||||
onClick: () => setRowSelection({ [row.id]: true }),
|
||||
onClick: () => handleClickRowCell(row.id),
|
||||
hover: false,
|
||||
sx: {
|
||||
'& > td::after': {
|
||||
|
||||
@ -248,7 +248,8 @@ export const getTableColumns = ({
|
||||
size: 50,
|
||||
enableEditing: false,
|
||||
Cell: ({ cell, row }) => {
|
||||
const handleClick = useCallback(() => {
|
||||
const handleClick = useCallback((event) => {
|
||||
event.stopPropagation();
|
||||
onCellNumberClick(row.id);
|
||||
}, [row.id, onCellNumberClick]);
|
||||
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) => {
|
||||
if (value === null || value === undefined || value === '') return '—';
|
||||
const numericValue = typeof value === 'number' ? value : Number(value);
|
||||
if (numericValue === 0) return '-';
|
||||
return Number.isNaN(numericValue) ? value : numberFormatter.format(numericValue);
|
||||
};
|
||||
|
||||
|
||||
@ -41,6 +41,7 @@ const tableSize = (rem) => rem * 16;
|
||||
const formatValue = (value) => {
|
||||
if (value === null || value === undefined || value === '') return '—';
|
||||
const numericValue = typeof value === 'number' ? value : Number(value);
|
||||
if (numericValue === 0) return '-';
|
||||
return Number.isNaN(numericValue) ? value : numberFormatter.format(numericValue);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user