fix style

This commit is contained in:
PotapovaA 2026-09-14 12:51:20 +03:00
parent 69b373045c
commit e1596e8782
4 changed files with 6 additions and 5 deletions

View File

@ -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': {

View File

@ -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>;

View File

@ -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);
};

View File

@ -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);
};