fix #162

Merged
PotapovaA merged 1 commits from fix-numeric-cell into test 2026-09-16 12:59:23 +03:00
4 changed files with 8 additions and 6 deletions
Showing only changes of commit 02ffff6861 - Show all commits

View File

@ -94,7 +94,6 @@ const getColorBrightness = (hexColor) => {
};
const formatNumber = (value, asInteger = false) => {
if (value === null || value === undefined || value === '') return String(value || '');
const num = Number(value);
if (Number.isNaN(num)) return String(value);
if (num === 0) return '-';
@ -146,7 +145,10 @@ const CellComponent = ({ cell, row, column, onClick, globalFilter, columnFilter,
const { rawValue, displayValue, isNumeric } = useMemo(() => {
const value = cell.getValue();
const isNum = value !== null && value !== undefined && value !== '' && !Number.isNaN(Number(value)) && !TEXT_COLUMN_IDS.has(column.id);
const display = String(value || '');
let display = String(value || '');
if (isNum) {
display = formatNumber(display, false);
}
if (isVspDropdown && value != null) {
const vsp = vspOptions?.find((v) => v.id === Number(value));
@ -154,7 +156,7 @@ const CellComponent = ({ cell, row, column, onClick, globalFilter, columnFilter,
return { rawValue: value, displayValue: vsp.registration_number, isNumeric: false };
}
}
return { rawValue: value, displayValue: display, isNumeric: isNum };
}, [cell, column.id, isVspDropdown, vspOptions]);

View File

@ -50,7 +50,7 @@ export const config = {
header: "",
accessorKey: "data.name",
columnLetter: "C",
size: 300,
size: 500,
filterFn: "contains",
},
],

View File

@ -44,7 +44,7 @@ export const config = {
header: "",
accessorKey: "data.name",
columnLetter: "C",
size: 300,
size: 500,
filterFn: "contains",
},
],

View File

@ -52,7 +52,7 @@ export const config = {
header: "",
accessorKey: "data.name",
columnLetter: "C",
size: 300,
size: 500,
filterFn: "contains",
muiTableHeadCellProps: {
sx: {