скролл с виртуализацией fix

This commit is contained in:
PotapovaA 2026-06-23 02:47:53 +03:00
parent 0686b3ae8a
commit 57eba099c1
3 changed files with 4031 additions and 4074 deletions

View File

@ -141,10 +141,22 @@ const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
} }
}, },
columnVirtualizerOptions: ({ table }) => ({ columnVirtualizerOptions: ({ table }) => ({
overscan: 5, overscan: 1,
measureElement: (el) => { measureElement: (el) => {
if (!el) return 150;
const index = Number(el?.getAttribute?.('data-index')); const index = Number(el?.getAttribute?.('data-index'));
return table.getVisibleLeafColumns()[index]?.getSize() ?? 0; // const index = indx < 4 ? indx : indx;
// const index = indx;
const isPinned = Boolean(el?.getAttribute?.('data-pinned'));
if (isPinned) {
const colId = table.getState().columnPinning.left[index];
const column = table.getColumn(colId);
return column.columnDef.size;
}
const allCols = [...table.getLeftVisibleLeafColumns(), ...table.getCenterVisibleLeafColumns()]
return allCols[index]?.getSize() ?? 150;
}, },
}), }),
enableRowSelection: true, enableRowSelection: true,
@ -243,11 +255,11 @@ const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
if (columnPinning && Object.keys(columnPinning).length > 0) { if (columnPinning && Object.keys(columnPinning).length > 0) {
const timer = setTimeout(() => { const timer = setTimeout(() => {
setColumnPinning(prev => ({ ...prev })); setColumnPinning(prev => ({ ...prev }));
}, 10); }, 100);
return () => clearTimeout(timer); return () => clearTimeout(timer);
} }
}, [table]); }, []);
const handleAddRow = useCallback(() => { const handleAddRow = useCallback(() => {
const allRows = table.getRowModel().rows; const allRows = table.getRowModel().rows;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff