CB-5213 chore: update react-data-grid (#2716)

This commit is contained in:
Alexey
2024-06-18 09:30:24 +03:00
committed by GitHub
parent 240dab7c0f
commit e779a23f0e
7 changed files with 190 additions and 167 deletions
@@ -59,7 +59,7 @@ function onEditorNavigation({
return false;
}
const measuringCellClassname = "mlln6zg7-0-0-beta-42";
const measuringCellClassname = "mlln6zg7-0-0-beta-44";
function renderMeasuringCells(viewportColumns) {
return viewportColumns.map(({
key,
@@ -264,9 +264,9 @@ function canExitGrid({
return shiftKey ? atFirstCellInRow && atFirstRow : atLastCellInRow && atLastRow;
}
const cell = "cj343x07-0-0-beta-42";
const cell = "cj343x07-0-0-beta-44";
const cellClassname = `rdg-cell ${cell}`;
const cellFrozen = "csofj7r7-0-0-beta-42";
const cellFrozen = "csofj7r7-0-0-beta-44";
const cellFrozenClassname = `rdg-cell-frozen ${cellFrozen}`;
function getRowStyle(rowIdx, height) {
@@ -336,13 +336,13 @@ function getHeaderCellRowSpan(column, rowIdx) {
return column.parent === undefined ? rowIdx : column.level - column.parent.level;
}
const checkboxLabel = "c1bn88vv7-0-0-beta-42";
const checkboxLabel = "c1bn88vv7-0-0-beta-44";
const checkboxLabelClassname = `rdg-checkbox-label ${checkboxLabel}`;
const checkboxInput = "c1qt073l7-0-0-beta-42";
const checkboxInput = "c1qt073l7-0-0-beta-44";
const checkboxInputClassname = `rdg-checkbox-input ${checkboxInput}`;
const checkbox = "cf71kmq7-0-0-beta-42";
const checkbox = "cf71kmq7-0-0-beta-44";
const checkboxClassname = `rdg-checkbox ${checkbox}`;
const checkboxLabelDisabled = "c1lwve4p7-0-0-beta-42";
const checkboxLabelDisabled = "c1lwve4p7-0-0-beta-44";
const checkboxLabelDisabledClassname = `rdg-checkbox-label-disabled ${checkboxLabelDisabled}`;
function renderCheckbox({
onChange,
@@ -364,9 +364,9 @@ function renderCheckbox({
});
}
const groupCellContent = "g1s9ylgp7-0-0-beta-42";
const groupCellContent = "g1s9ylgp7-0-0-beta-44";
const groupCellContentClassname = `rdg-group-cell-content ${groupCellContent}`;
const caret = "cz54e4y7-0-0-beta-42";
const caret = "cz54e4y7-0-0-beta-44";
const caretClassname = `rdg-caret ${caret}`;
function renderToggleGroup(props) {
return /*#__PURE__*/jsxRuntime.jsx(ToggleGroup, {
@@ -810,6 +810,7 @@ function useGridDimensions() {
const gridRef = react.useRef(null);
const [inlineSize, setInlineSize] = react.useState(1);
const [blockSize, setBlockSize] = react.useState(1);
const [horizontalScrollbarHeight, setHorizontalScrollbarHeight] = react.useState(0);
useLayoutEffect(() => {
const {
ResizeObserver
@@ -825,15 +826,22 @@ function useGridDimensions() {
width,
height
} = gridRef.current.getBoundingClientRect();
const initialHorizontalScrollbarHeight = offsetHeight - clientHeight;
const initialWidth = width - offsetWidth + clientWidth;
const initialHeight = height - offsetHeight + clientHeight;
const initialHeight = height - initialHorizontalScrollbarHeight;
setInlineSize(initialWidth);
setBlockSize(initialHeight);
setHorizontalScrollbarHeight(initialHorizontalScrollbarHeight);
const resizeObserver = new ResizeObserver(entries => {
const size = entries[0].contentBoxSize[0];
const {
clientHeight,
offsetHeight
} = gridRef.current;
reactDom.flushSync(() => {
setInlineSize(size.inlineSize);
setBlockSize(size.blockSize);
setHorizontalScrollbarHeight(offsetHeight - clientHeight);
});
});
resizeObserver.observe(gridRef.current);
@@ -841,7 +849,7 @@ function useGridDimensions() {
resizeObserver.disconnect();
};
}, []);
return [gridRef, inlineSize, blockSize];
return [gridRef, inlineSize, blockSize, horizontalScrollbarHeight];
}
function useLatestFunc(fn) {
@@ -1027,9 +1035,9 @@ function useViewportRows({
};
}
const cellCopied = "c6ra8a37-0-0-beta-42";
const cellCopied = "c6ra8a37-0-0-beta-44";
const cellCopiedClassname = `rdg-cell-copied ${cellCopied}`;
const cellDraggedOver = "cq910m07-0-0-beta-42";
const cellDraggedOver = "cq910m07-0-0-beta-44";
const cellDraggedOverClassname = `rdg-cell-dragged-over ${cellDraggedOver}`;
function Cell({
column,
@@ -1135,8 +1143,8 @@ function defaultRenderCell(key, props) {
}, key);
}
const cellDragHandle = "c1w9bbhr7-0-0-beta-42";
const cellDragHandleFrozenClassname = "c1creorc7-0-0-beta-42";
const cellDragHandle = "c1w9bbhr7-0-0-beta-44";
const cellDragHandleFrozenClassname = "c1creorc7-0-0-beta-44";
const cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;
function DragHandle({
gridRowStart,
@@ -1241,7 +1249,7 @@ function DragHandle({
});
}
const cellEditing = "cis5rrm7-0-0-beta-42";
const cellEditing = "cis5rrm7-0-0-beta-44";
function EditCell({
column,
colSpan,
@@ -1379,8 +1387,8 @@ function GroupedColumnHeaderCell({
});
}
const headerSortCellClassname = "h44jtk67-0-0-beta-42";
const headerSortName = "hcgkhxz7-0-0-beta-42";
const headerSortCellClassname = "h44jtk67-0-0-beta-44";
const headerSortName = "hcgkhxz7-0-0-beta-44";
const headerSortNameClassname = `rdg-header-sort-name ${headerSortName}`;
function renderHeaderCell({
column,
@@ -1414,14 +1422,14 @@ function SortableHeaderCell({
});
}
const cellSortableClassname = "c6l2wv17-0-0-beta-42";
const cellResizable = "c1kqdw7y7-0-0-beta-42";
const cellSortableClassname = "c6l2wv17-0-0-beta-44";
const cellResizable = "c1kqdw7y7-0-0-beta-44";
const cellResizableClassname = `rdg-cell-resizable ${cellResizable}`;
const resizeHandleClassname = "r1y6ywlx7-0-0-beta-42";
const resizeHandleClassname = "r1y6ywlx7-0-0-beta-44";
const cellDraggableClassname = 'rdg-cell-draggable';
const cellDragging = "c1bezg5o7-0-0-beta-42";
const cellDragging = "c1bezg5o7-0-0-beta-44";
const cellDraggingClassname = `rdg-cell-dragging ${cellDragging}`;
const cellOver = "c1vc96037-0-0-beta-42";
const cellOver = "c1vc96037-0-0-beta-44";
const cellOverClassname = `rdg-cell-drag-over ${cellOver}`;
function HeaderCell({
column,
@@ -1629,15 +1637,15 @@ function isEventPertinent(event) {
return !event.currentTarget.contains(relatedTarget);
}
const row = "r1upfr807-0-0-beta-42";
const row = "r1upfr807-0-0-beta-44";
const rowClassname = `rdg-row ${row}`;
const rowSelected = "r190mhd37-0-0-beta-42";
const rowSelected = "r190mhd37-0-0-beta-44";
const rowSelectedClassname = 'rdg-row-selected';
const rowSelectedWithFrozenCell = "r139qu9m7-0-0-beta-42";
const rowSelectedWithFrozenCell = "r139qu9m7-0-0-beta-44";
const topSummaryRowClassname = 'rdg-top-summary-row';
const bottomSummaryRowClassname = 'rdg-bottom-summary-row';
const headerRow = "h10tskcx7-0-0-beta-42";
const headerRow = "h10tskcx7-0-0-beta-44";
const headerRowClassname = `rdg-header-row ${headerRow}`;
function HeaderRow({
rowIdx,
@@ -1846,7 +1854,7 @@ function ScrollToCell({
});
}
const arrow = "a3ejtar7-0-0-beta-42";
const arrow = "a3ejtar7-0-0-beta-44";
const arrowClassname = `rdg-sort-arrow ${arrow}`;
function renderSortStatus({
sortDirection,
@@ -1881,14 +1889,14 @@ function renderSortPriority({
return priority;
}
const root = "rnvodz57-0-0-beta-42";
const root = "rnvodz57-0-0-beta-44";
const rootClassname = `rdg ${root}`;
const viewportDragging = "vlqv91k7-0-0-beta-42";
const viewportDragging = "vlqv91k7-0-0-beta-44";
const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`;
const focusSinkClassname = "f1lsfrzw7-0-0-beta-42";
const focusSinkHeaderAndSummaryClassname = "f1cte0lg7-0-0-beta-42";
const focusSinkClassname = "f1lsfrzw7-0-0-beta-44";
const focusSinkHeaderAndSummaryClassname = "f1cte0lg7-0-0-beta-44";
const summaryCellClassname = "s8wc6fl7-0-0-beta-42";
const summaryCellClassname = "s8wc6fl7-0-0-beta-44";
function SummaryCell({
column,
colSpan,
@@ -1931,8 +1939,8 @@ function SummaryCell({
}
const SummaryCell$1 = /*#__PURE__*/react.memo(SummaryCell);
const summaryRow = "skuhp557-0-0-beta-42";
const topSummaryRow = "tf8l5ub7-0-0-beta-42";
const summaryRow = "skuhp557-0-0-beta-44";
const topSummaryRow = "tf8l5ub7-0-0-beta-44";
const summaryRowClassname = `rdg-summary-row ${summaryRow}`;
function SummaryRow({
rowIdx,
@@ -2044,7 +2052,7 @@ function DataGrid(props, ref) {
const getColumnWidth = react.useCallback(column => {
return resizedColumnWidths.get(column.key) ?? measuredColumnWidths.get(column.key) ?? column.width;
}, [measuredColumnWidths, resizedColumnWidths]);
const [gridRef, gridWidth, gridHeight] = useGridDimensions();
const [gridRef, gridWidth, gridHeight, horizontalScrollbarHeight] = useGridDimensions();
const {
columns,
colSpanColumns,
@@ -2083,7 +2091,8 @@ function DataGrid(props, ref) {
const shouldFocusCellRef = react.useRef(false);
const isTreeGrid = role === 'treegrid';
const headerRowsHeight = headerRowsCount * headerRowHeight;
const clientHeight = gridHeight - headerRowsHeight - summaryRowsCount * summaryRowHeight;
const summaryRowsHeight = summaryRowsCount * summaryRowHeight;
const clientHeight = gridHeight - headerRowsHeight - summaryRowsHeight;
const isSelectable = selectedRows != null && onSelectedRowsChange != null;
const isRtl = direction === 'rtl';
const leftKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
@@ -2135,6 +2144,7 @@ function DataGrid(props, ref) {
const maxColIdx = columns.length - 1;
const selectedCellIsWithinSelectionBounds = isCellWithinSelectionBounds(selectedPosition);
const selectedCellIsWithinViewportBounds = isCellWithinViewportBounds(selectedPosition);
const scrollHeight = headerRowHeight + totalRowHeight + summaryRowsHeight + horizontalScrollbarHeight;
const handleColumnResizeLatest = useLatestFunc(handleColumnResize);
const onColumnsReorderLastest = useLatestFunc(onColumnsReorder);
const onSortColumnsChangeLatest = useLatestFunc(onSortColumnsChange);
@@ -2750,6 +2760,7 @@ function DataGrid(props, ref) {
gridTemplateRows: templateRows,
'--rdg-header-row-height': `${headerRowHeight}px`,
'--rdg-summary-row-height': `${summaryRowHeight}px`,
'--rdg-scroll-height': `${scrollHeight}px`,
'--rdg-sign': isRtl ? -1 : 1,
...layoutCssVars
},
@@ -2894,7 +2905,7 @@ function GroupCell({
}
const GroupCell$1 = /*#__PURE__*/react.memo(GroupCell);
const groupRow = "g1yxluv37-0-0-beta-42";
const groupRow = "g1yxluv37-0-0-beta-44";
const groupRowClassname = `rdg-group-row ${groupRow}`;
function GroupedRow({
className,
@@ -3284,7 +3295,7 @@ function isReadonlyArray(arr) {
}
const TreeDataGrid$1 = /*#__PURE__*/react.forwardRef(TreeDataGrid);
const textEditorInternalClassname = "t7vyx3i7-0-0-beta-42";
const textEditorInternalClassname = "t7vyx3i7-0-0-beta-44";
const textEditorClassname = `rdg-text-editor ${textEditorInternalClassname}`;
function autoFocusAndSelect(input) {
input?.focus();
File diff suppressed because one or more lines are too long
@@ -55,7 +55,7 @@ function onEditorNavigation({
return false;
}
const measuringCellClassname = "mlln6zg7-0-0-beta-42";
const measuringCellClassname = "mlln6zg7-0-0-beta-44";
function renderMeasuringCells(viewportColumns) {
return viewportColumns.map(({
key,
@@ -260,9 +260,9 @@ function canExitGrid({
return shiftKey ? atFirstCellInRow && atFirstRow : atLastCellInRow && atLastRow;
}
const cell = "cj343x07-0-0-beta-42";
const cell = "cj343x07-0-0-beta-44";
const cellClassname = `rdg-cell ${cell}`;
const cellFrozen = "csofj7r7-0-0-beta-42";
const cellFrozen = "csofj7r7-0-0-beta-44";
const cellFrozenClassname = `rdg-cell-frozen ${cellFrozen}`;
function getRowStyle(rowIdx, height) {
@@ -332,13 +332,13 @@ function getHeaderCellRowSpan(column, rowIdx) {
return column.parent === undefined ? rowIdx : column.level - column.parent.level;
}
const checkboxLabel = "c1bn88vv7-0-0-beta-42";
const checkboxLabel = "c1bn88vv7-0-0-beta-44";
const checkboxLabelClassname = `rdg-checkbox-label ${checkboxLabel}`;
const checkboxInput = "c1qt073l7-0-0-beta-42";
const checkboxInput = "c1qt073l7-0-0-beta-44";
const checkboxInputClassname = `rdg-checkbox-input ${checkboxInput}`;
const checkbox = "cf71kmq7-0-0-beta-42";
const checkbox = "cf71kmq7-0-0-beta-44";
const checkboxClassname = `rdg-checkbox ${checkbox}`;
const checkboxLabelDisabled = "c1lwve4p7-0-0-beta-42";
const checkboxLabelDisabled = "c1lwve4p7-0-0-beta-44";
const checkboxLabelDisabledClassname = `rdg-checkbox-label-disabled ${checkboxLabelDisabled}`;
function renderCheckbox({
onChange,
@@ -360,9 +360,9 @@ function renderCheckbox({
});
}
const groupCellContent = "g1s9ylgp7-0-0-beta-42";
const groupCellContent = "g1s9ylgp7-0-0-beta-44";
const groupCellContentClassname = `rdg-group-cell-content ${groupCellContent}`;
const caret = "cz54e4y7-0-0-beta-42";
const caret = "cz54e4y7-0-0-beta-44";
const caretClassname = `rdg-caret ${caret}`;
function renderToggleGroup(props) {
return /*#__PURE__*/jsx(ToggleGroup, {
@@ -806,6 +806,7 @@ function useGridDimensions() {
const gridRef = useRef(null);
const [inlineSize, setInlineSize] = useState(1);
const [blockSize, setBlockSize] = useState(1);
const [horizontalScrollbarHeight, setHorizontalScrollbarHeight] = useState(0);
useLayoutEffect(() => {
const {
ResizeObserver
@@ -821,15 +822,22 @@ function useGridDimensions() {
width,
height
} = gridRef.current.getBoundingClientRect();
const initialHorizontalScrollbarHeight = offsetHeight - clientHeight;
const initialWidth = width - offsetWidth + clientWidth;
const initialHeight = height - offsetHeight + clientHeight;
const initialHeight = height - initialHorizontalScrollbarHeight;
setInlineSize(initialWidth);
setBlockSize(initialHeight);
setHorizontalScrollbarHeight(initialHorizontalScrollbarHeight);
const resizeObserver = new ResizeObserver(entries => {
const size = entries[0].contentBoxSize[0];
const {
clientHeight,
offsetHeight
} = gridRef.current;
flushSync(() => {
setInlineSize(size.inlineSize);
setBlockSize(size.blockSize);
setHorizontalScrollbarHeight(offsetHeight - clientHeight);
});
});
resizeObserver.observe(gridRef.current);
@@ -837,7 +845,7 @@ function useGridDimensions() {
resizeObserver.disconnect();
};
}, []);
return [gridRef, inlineSize, blockSize];
return [gridRef, inlineSize, blockSize, horizontalScrollbarHeight];
}
function useLatestFunc(fn) {
@@ -1023,9 +1031,9 @@ function useViewportRows({
};
}
const cellCopied = "c6ra8a37-0-0-beta-42";
const cellCopied = "c6ra8a37-0-0-beta-44";
const cellCopiedClassname = `rdg-cell-copied ${cellCopied}`;
const cellDraggedOver = "cq910m07-0-0-beta-42";
const cellDraggedOver = "cq910m07-0-0-beta-44";
const cellDraggedOverClassname = `rdg-cell-dragged-over ${cellDraggedOver}`;
function Cell({
column,
@@ -1131,8 +1139,8 @@ function defaultRenderCell(key, props) {
}, key);
}
const cellDragHandle = "c1w9bbhr7-0-0-beta-42";
const cellDragHandleFrozenClassname = "c1creorc7-0-0-beta-42";
const cellDragHandle = "c1w9bbhr7-0-0-beta-44";
const cellDragHandleFrozenClassname = "c1creorc7-0-0-beta-44";
const cellDragHandleClassname = `rdg-cell-drag-handle ${cellDragHandle}`;
function DragHandle({
gridRowStart,
@@ -1237,7 +1245,7 @@ function DragHandle({
});
}
const cellEditing = "cis5rrm7-0-0-beta-42";
const cellEditing = "cis5rrm7-0-0-beta-44";
function EditCell({
column,
colSpan,
@@ -1375,8 +1383,8 @@ function GroupedColumnHeaderCell({
});
}
const headerSortCellClassname = "h44jtk67-0-0-beta-42";
const headerSortName = "hcgkhxz7-0-0-beta-42";
const headerSortCellClassname = "h44jtk67-0-0-beta-44";
const headerSortName = "hcgkhxz7-0-0-beta-44";
const headerSortNameClassname = `rdg-header-sort-name ${headerSortName}`;
function renderHeaderCell({
column,
@@ -1410,14 +1418,14 @@ function SortableHeaderCell({
});
}
const cellSortableClassname = "c6l2wv17-0-0-beta-42";
const cellResizable = "c1kqdw7y7-0-0-beta-42";
const cellSortableClassname = "c6l2wv17-0-0-beta-44";
const cellResizable = "c1kqdw7y7-0-0-beta-44";
const cellResizableClassname = `rdg-cell-resizable ${cellResizable}`;
const resizeHandleClassname = "r1y6ywlx7-0-0-beta-42";
const resizeHandleClassname = "r1y6ywlx7-0-0-beta-44";
const cellDraggableClassname = 'rdg-cell-draggable';
const cellDragging = "c1bezg5o7-0-0-beta-42";
const cellDragging = "c1bezg5o7-0-0-beta-44";
const cellDraggingClassname = `rdg-cell-dragging ${cellDragging}`;
const cellOver = "c1vc96037-0-0-beta-42";
const cellOver = "c1vc96037-0-0-beta-44";
const cellOverClassname = `rdg-cell-drag-over ${cellOver}`;
function HeaderCell({
column,
@@ -1625,15 +1633,15 @@ function isEventPertinent(event) {
return !event.currentTarget.contains(relatedTarget);
}
const row = "r1upfr807-0-0-beta-42";
const row = "r1upfr807-0-0-beta-44";
const rowClassname = `rdg-row ${row}`;
const rowSelected = "r190mhd37-0-0-beta-42";
const rowSelected = "r190mhd37-0-0-beta-44";
const rowSelectedClassname = 'rdg-row-selected';
const rowSelectedWithFrozenCell = "r139qu9m7-0-0-beta-42";
const rowSelectedWithFrozenCell = "r139qu9m7-0-0-beta-44";
const topSummaryRowClassname = 'rdg-top-summary-row';
const bottomSummaryRowClassname = 'rdg-bottom-summary-row';
const headerRow = "h10tskcx7-0-0-beta-42";
const headerRow = "h10tskcx7-0-0-beta-44";
const headerRowClassname = `rdg-header-row ${headerRow}`;
function HeaderRow({
rowIdx,
@@ -1842,7 +1850,7 @@ function ScrollToCell({
});
}
const arrow = "a3ejtar7-0-0-beta-42";
const arrow = "a3ejtar7-0-0-beta-44";
const arrowClassname = `rdg-sort-arrow ${arrow}`;
function renderSortStatus({
sortDirection,
@@ -1877,14 +1885,14 @@ function renderSortPriority({
return priority;
}
const root = "rnvodz57-0-0-beta-42";
const root = "rnvodz57-0-0-beta-44";
const rootClassname = `rdg ${root}`;
const viewportDragging = "vlqv91k7-0-0-beta-42";
const viewportDragging = "vlqv91k7-0-0-beta-44";
const viewportDraggingClassname = `rdg-viewport-dragging ${viewportDragging}`;
const focusSinkClassname = "f1lsfrzw7-0-0-beta-42";
const focusSinkHeaderAndSummaryClassname = "f1cte0lg7-0-0-beta-42";
const focusSinkClassname = "f1lsfrzw7-0-0-beta-44";
const focusSinkHeaderAndSummaryClassname = "f1cte0lg7-0-0-beta-44";
const summaryCellClassname = "s8wc6fl7-0-0-beta-42";
const summaryCellClassname = "s8wc6fl7-0-0-beta-44";
function SummaryCell({
column,
colSpan,
@@ -1927,8 +1935,8 @@ function SummaryCell({
}
const SummaryCell$1 = /*#__PURE__*/memo(SummaryCell);
const summaryRow = "skuhp557-0-0-beta-42";
const topSummaryRow = "tf8l5ub7-0-0-beta-42";
const summaryRow = "skuhp557-0-0-beta-44";
const topSummaryRow = "tf8l5ub7-0-0-beta-44";
const summaryRowClassname = `rdg-summary-row ${summaryRow}`;
function SummaryRow({
rowIdx,
@@ -2040,7 +2048,7 @@ function DataGrid(props, ref) {
const getColumnWidth = useCallback(column => {
return resizedColumnWidths.get(column.key) ?? measuredColumnWidths.get(column.key) ?? column.width;
}, [measuredColumnWidths, resizedColumnWidths]);
const [gridRef, gridWidth, gridHeight] = useGridDimensions();
const [gridRef, gridWidth, gridHeight, horizontalScrollbarHeight] = useGridDimensions();
const {
columns,
colSpanColumns,
@@ -2079,7 +2087,8 @@ function DataGrid(props, ref) {
const shouldFocusCellRef = useRef(false);
const isTreeGrid = role === 'treegrid';
const headerRowsHeight = headerRowsCount * headerRowHeight;
const clientHeight = gridHeight - headerRowsHeight - summaryRowsCount * summaryRowHeight;
const summaryRowsHeight = summaryRowsCount * summaryRowHeight;
const clientHeight = gridHeight - headerRowsHeight - summaryRowsHeight;
const isSelectable = selectedRows != null && onSelectedRowsChange != null;
const isRtl = direction === 'rtl';
const leftKey = isRtl ? 'ArrowRight' : 'ArrowLeft';
@@ -2131,6 +2140,7 @@ function DataGrid(props, ref) {
const maxColIdx = columns.length - 1;
const selectedCellIsWithinSelectionBounds = isCellWithinSelectionBounds(selectedPosition);
const selectedCellIsWithinViewportBounds = isCellWithinViewportBounds(selectedPosition);
const scrollHeight = headerRowHeight + totalRowHeight + summaryRowsHeight + horizontalScrollbarHeight;
const handleColumnResizeLatest = useLatestFunc(handleColumnResize);
const onColumnsReorderLastest = useLatestFunc(onColumnsReorder);
const onSortColumnsChangeLatest = useLatestFunc(onSortColumnsChange);
@@ -2746,6 +2756,7 @@ function DataGrid(props, ref) {
gridTemplateRows: templateRows,
'--rdg-header-row-height': `${headerRowHeight}px`,
'--rdg-summary-row-height': `${summaryRowHeight}px`,
'--rdg-scroll-height': `${scrollHeight}px`,
'--rdg-sign': isRtl ? -1 : 1,
...layoutCssVars
},
@@ -2890,7 +2901,7 @@ function GroupCell({
}
const GroupCell$1 = /*#__PURE__*/memo(GroupCell);
const groupRow = "g1yxluv37-0-0-beta-42";
const groupRow = "g1yxluv37-0-0-beta-44";
const groupRowClassname = `rdg-group-row ${groupRow}`;
function GroupedRow({
className,
@@ -3280,7 +3291,7 @@ function isReadonlyArray(arr) {
}
const TreeDataGrid$1 = /*#__PURE__*/forwardRef(TreeDataGrid);
const textEditorInternalClassname = "t7vyx3i7-0-0-beta-42";
const textEditorInternalClassname = "t7vyx3i7-0-0-beta-44";
const textEditorClassname = `rdg-text-editor ${textEditorInternalClassname}`;
function autoFocusAndSelect(input) {
input?.focus();
File diff suppressed because one or more lines are too long
@@ -28,7 +28,6 @@ export declare interface CalculatedColumn<TRow, TSummaryRow = unknown> extends C
readonly sortable: boolean;
readonly draggable: boolean;
readonly frozen: boolean;
readonly isLastFrozenColumn: boolean;
readonly renderCell: (props: RenderCellProps<TRow, TSummaryRow>) => ReactNode;
}
@@ -168,7 +167,7 @@ export declare interface DataGridProps<R, SR = unknown, K extends Key = Key> ext
* Grid and data Props
*/
/** An array of objects representing each column on the grid */
columns: readonly ColumnOrColumnGroup<R, SR>[];
columns: readonly ColumnOrColumnGroup<NoInfer<R>, NoInfer<SR>>[];
/** A function called for each rendered row that should return a plain key/value pair object */
rows: readonly R[];
/**
@@ -180,8 +179,8 @@ export declare interface DataGridProps<R, SR = unknown, K extends Key = Key> ext
*/
bottomSummaryRows?: Maybe<readonly SR[]>;
/** The getter should return a unique key for each row */
rowKeyGetter?: Maybe<(row: R) => K>;
onRowsChange?: Maybe<(rows: R[], data: RowsChangeData<R, SR>) => void>;
rowKeyGetter?: Maybe<(row: NoInfer<R>) => K>;
onRowsChange?: Maybe<(rows: NoInfer<R>[], data: RowsChangeData<NoInfer<R>, NoInfer<SR>>) => void>;
/**
* Dimensions props
*/
@@ -189,7 +188,7 @@ export declare interface DataGridProps<R, SR = unknown, K extends Key = Key> ext
* The height of each row in pixels
* @default 35
*/
rowHeight?: Maybe<number | ((row: R) => number)>;
rowHeight?: Maybe<number | ((row: NoInfer<R>) => number)>;
/**
* The height of the header row in pixels
* @default 35
@@ -206,26 +205,26 @@ export declare interface DataGridProps<R, SR = unknown, K extends Key = Key> ext
/** Set of selected row keys */
selectedRows?: Maybe<ReadonlySet<K>>;
/** Function called whenever row selection is changed */
onSelectedRowsChange?: Maybe<(selectedRows: Set<K>) => void>;
onSelectedRowsChange?: Maybe<(selectedRows: Set<NoInfer<K>>) => void>;
/** Used for multi column sorting */
sortColumns?: Maybe<readonly SortColumn[]>;
onSortColumnsChange?: Maybe<(sortColumns: SortColumn[]) => void>;
defaultColumnOptions?: Maybe<DefaultColumnOptions<R, SR>>;
onFill?: Maybe<(event: FillEvent<R>) => R>;
onCopy?: Maybe<(event: CopyEvent<R>) => void>;
onPaste?: Maybe<(event: PasteEvent<R>) => R>;
defaultColumnOptions?: Maybe<DefaultColumnOptions<NoInfer<R>, NoInfer<SR>>>;
onFill?: Maybe<(event: FillEvent<NoInfer<R>>) => NoInfer<R>>;
onCopy?: Maybe<(event: CopyEvent<NoInfer<R>>) => void>;
onPaste?: Maybe<(event: PasteEvent<NoInfer<R>>) => NoInfer<R>>;
/**
* Event props
*/
/** Function called whenever a cell is clicked */
onCellClick?: Maybe<(args: CellClickArgs<R, SR>, event: CellMouseEvent) => void>;
onCellClick?: Maybe<(args: CellClickArgs<NoInfer<R>, NoInfer<SR>>, event: CellMouseEvent) => void>;
/** Function called whenever a cell is double clicked */
onCellDoubleClick?: Maybe<(args: CellClickArgs<R, SR>, event: CellMouseEvent) => void>;
onCellDoubleClick?: Maybe<(args: CellClickArgs<NoInfer<R>, NoInfer<SR>>, event: CellMouseEvent) => void>;
/** Function called whenever a cell is right clicked */
onCellContextMenu?: Maybe<(args: CellClickArgs<R, SR>, event: CellMouseEvent) => void>;
onCellKeyDown?: Maybe<(args: CellKeyDownArgs<R, SR>, event: CellKeyboardEvent) => void>;
onCellContextMenu?: Maybe<(args: CellClickArgs<NoInfer<R>, NoInfer<SR>>, event: CellMouseEvent) => void>;
onCellKeyDown?: Maybe<(args: CellKeyDownArgs<NoInfer<R>, NoInfer<SR>>, event: CellKeyboardEvent) => void>;
/** Function called whenever cell selection is changed */
onSelectedCellChange?: Maybe<(args: CellSelectArgs<R, SR>) => void>;
onSelectedCellChange?: Maybe<(args: CellSelectArgs<NoInfer<R>, NoInfer<SR>>) => void>;
/** Called when the grid is scrolled */
onScroll?: Maybe<(event: React.UIEvent<HTMLDivElement>) => void>;
/** Called when a column is resized */
@@ -240,8 +239,8 @@ export declare interface DataGridProps<R, SR = unknown, K extends Key = Key> ext
/**
* Miscellaneous
*/
renderers?: Maybe<Renderers<R, SR>>;
rowClass?: Maybe<(row: R, rowIdx: number) => Maybe<string>>;
renderers?: Maybe<Renderers<NoInfer<R>, NoInfer<SR>>>;
rowClass?: Maybe<(row: NoInfer<R>, rowIdx: number) => Maybe<string>>;
/** @default 'ltr' */
direction?: Maybe<Direction>;
'data-testid'?: Maybe<string>;
@@ -449,10 +448,10 @@ export declare function ToggleGroup<R, SR>({ groupKey, isExpanded, tabIndex, tog
export declare const TreeDataGrid: <R, SR = unknown, K extends Key = Key>(props: TreeDataGridProps<R, SR, K> & RefAttributes<DataGridHandle>) => JSX.Element;
export declare interface TreeDataGridProps<R, SR = unknown, K extends Key = Key> extends Omit_2<DataGridProps<R, SR, K>, 'columns' | 'role' | 'aria-rowcount' | 'rowHeight' | 'onFill'> {
columns: readonly Column<R, SR>[];
rowHeight?: Maybe<number | ((args: RowHeightArgs<R>) => number)>;
columns: readonly Column<NoInfer<R>, NoInfer<SR>>[];
rowHeight?: Maybe<number | ((args: RowHeightArgs<NoInfer<R>>) => number)>;
groupBy: readonly string[];
rowGrouper: (rows: readonly R[], columnKey: string) => Record<string, readonly R[]>;
rowGrouper: (rows: readonly NoInfer<R>[], columnKey: string) => Record<string, readonly NoInfer<R>[]>;
expandedGroupIds: ReadonlySet<unknown>;
onExpandedGroupIdsChange: (expandedGroupIds: Set<unknown>) => void;
}
@@ -15,7 +15,7 @@
Root;
}
.mlln6zg7-0-0-beta-42 {
.mlln6zg7-0-0-beta-44 {
@layer rdg.MeasuringCell {
contain: strict;
grid-row: 1;
@@ -24,7 +24,7 @@
}
.cj343x07-0-0-beta-42 {
.cj343x07-0-0-beta-44 {
@layer rdg.Cell {
/* max-content does not work with size containment
* dynamically switching between different containment styles incurs a heavy relayout penalty
@@ -52,7 +52,7 @@
}
}
.csofj7r7-0-0-beta-42 {
.csofj7r7-0-0-beta-44 {
@layer rdg.Cell {
position: sticky;
/* Should have a higher value than 0 to show up above unfrozen cells */
@@ -66,7 +66,7 @@
}
.c1bn88vv7-0-0-beta-42 {
.c1bn88vv7-0-0-beta-44 {
@layer rdg.CheckboxLabel {
cursor: pointer;
display: flex;
@@ -78,13 +78,13 @@
}
}
.c1qt073l7-0-0-beta-42 {
.c1qt073l7-0-0-beta-44 {
@layer rdg.CheckboxInput {
all: unset;
}
}
.cf71kmq7-0-0-beta-42 {
.cf71kmq7-0-0-beta-44 {
@layer rdg.CheckboxIcon {
content: '';
inline-size: 20px;
@@ -92,23 +92,23 @@
border: 2px solid var(--rdg-border-color);
background-color: var(--rdg-background-color);
.c1qt073l7-0-0-beta-42:checked + & {
.c1qt073l7-0-0-beta-44:checked + & {
background-color: var(--rdg-checkbox-color);
outline: 4px solid var(--rdg-background-color);
outline-offset: -6px;
}
.c1qt073l7-0-0-beta-42:focus + & {
.c1qt073l7-0-0-beta-44:focus + & {
border-color: var(--rdg-checkbox-focus-color);
}
}
}
.c1lwve4p7-0-0-beta-42 {
.c1lwve4p7-0-0-beta-44 {
@layer rdg.CheckboxLabel {
cursor: default;
.cf71kmq7-0-0-beta-42 {
.cf71kmq7-0-0-beta-44 {
border-color: var(--rdg-checkbox-disabled-border-color);
background-color: var(--rdg-checkbox-disabled-background-color);
}
@@ -116,13 +116,13 @@
}
.g1s9ylgp7-0-0-beta-42 {
.g1s9ylgp7-0-0-beta-44 {
@layer rdg.GroupCellContent {
outline: none;
}
}
.cz54e4y7-0-0-beta-42 {
.cz54e4y7-0-0-beta-44 {
@layer rdg.GroupCellCaret {
margin-inline-start: 4px;
stroke: currentColor;
@@ -137,24 +137,24 @@
}
.c6ra8a37-0-0-beta-42 {
.c6ra8a37-0-0-beta-44 {
@layer rdg.Cell {
background-color: #ccccff;
}
}
.cq910m07-0-0-beta-42 {
.cq910m07-0-0-beta-44 {
@layer rdg.Cell {
background-color: #ccccff;
&.c6ra8a37-0-0-beta-42 {
&.c6ra8a37-0-0-beta-44 {
background-color: #9999ff;
}
}
}
.c1w9bbhr7-0-0-beta-42 {
.c1w9bbhr7-0-0-beta-44 {
@layer rdg.DragHandle {
--rdg-drag-handle-size: 8px;
z-index: 0;
@@ -172,7 +172,7 @@
}
}
.c1creorc7-0-0-beta-42 {
.c1creorc7-0-0-beta-44 {
@layer rdg.DragHandle {
z-index: 1;
position: sticky;
@@ -180,20 +180,20 @@
}
.cis5rrm7-0-0-beta-42 {
.cis5rrm7-0-0-beta-44 {
@layer rdg.EditCell {
padding: 0;
}
}
.h44jtk67-0-0-beta-42 {
.h44jtk67-0-0-beta-44 {
@layer rdg.SortableHeaderCell {
display: flex;
}
}
.hcgkhxz7-0-0-beta-42 {
.hcgkhxz7-0-0-beta-44 {
@layer rdg.SortableHeaderCellName {
flex-grow: 1;
overflow: clip;
@@ -202,19 +202,19 @@
}
.c6l2wv17-0-0-beta-42 {
.c6l2wv17-0-0-beta-44 {
@layer rdg.HeaderCell {
cursor: pointer;
}
}
.c1kqdw7y7-0-0-beta-42 {
.c1kqdw7y7-0-0-beta-44 {
@layer rdg.HeaderCell {
touch-action: none;
}
}
.r1y6ywlx7-0-0-beta-42 {
.r1y6ywlx7-0-0-beta-44 {
@layer rdg.HeaderCell {
cursor: col-resize;
position: absolute;
@@ -225,16 +225,16 @@
}
}
.c1bezg5o7-0-0-beta-42 {
.c1bezg5o7-0-0-beta-44 {
opacity: 0.5;
}
.c1vc96037-0-0-beta-42 {
.c1vc96037-0-0-beta-44 {
background-color: var(--rdg-header-draggable-background-color);
}
.r1upfr807-0-0-beta-42 {
.r1upfr807-0-0-beta-44 {
@layer rdg.Row {
display: contents;
line-height: var(--rdg-row-height);
@@ -254,14 +254,14 @@
}
}
.r190mhd37-0-0-beta-42 {
.r190mhd37-0-0-beta-44 {
@layer rdg.FocusSink {
outline: 2px solid var(--rdg-selection-color);
outline-offset: -2px;
}
}
.r139qu9m7-0-0-beta-42 {
.r139qu9m7-0-0-beta-44 {
@layer rdg.FocusSink {
&::before {
content: '';
@@ -275,27 +275,27 @@
}
.h10tskcx7-0-0-beta-42 {
.h10tskcx7-0-0-beta-44 {
@layer rdg.HeaderRow {
display: contents;
line-height: var(--rdg-header-row-height);
background-color: var(--rdg-header-background-color);
font-weight: bold;
& > .cj343x07-0-0-beta-42 {
& > .cj343x07-0-0-beta-44 {
/* Should have a higher value than 1 to show up above regular cells and the focus sink */
z-index: 2;
position: sticky;
}
& > .csofj7r7-0-0-beta-42 {
& > .csofj7r7-0-0-beta-44 {
z-index: 3;
}
}
}
.a3ejtar7-0-0-beta-42 {
.a3ejtar7-0-0-beta-44 {
@layer rdg.SortIcon {
fill: currentColor;
@@ -306,7 +306,7 @@
}
.rnvodz57-0-0-beta-42 {
.rnvodz57-0-0-beta-44 {
@layer rdg.Defaults {
*,
*::before,
@@ -361,30 +361,30 @@
}
> :nth-last-child(1 of .rdg-top-summary-row) {
> .cj343x07-0-0-beta-42 {
> .cj343x07-0-0-beta-44 {
border-block-end: 2px solid var(--rdg-summary-border-color);
}
}
> :nth-child(1 of .rdg-bottom-summary-row) {
> .cj343x07-0-0-beta-42 {
> .cj343x07-0-0-beta-44 {
border-block-start: 2px solid var(--rdg-summary-border-color);
}
}
}
}
.vlqv91k7-0-0-beta-42 {
.vlqv91k7-0-0-beta-44 {
@layer rdg.Root {
user-select: none;
& .r1upfr807-0-0-beta-42 {
& .r1upfr807-0-0-beta-44 {
cursor: move;
}
}
}
.f1lsfrzw7-0-0-beta-42 {
.f1lsfrzw7-0-0-beta-44 {
@layer rdg.FocusSink {
grid-column: 1/-1;
pointer-events: none;
@@ -393,7 +393,7 @@
}
}
.f1cte0lg7-0-0-beta-42 {
.f1cte0lg7-0-0-beta-44 {
@layer rdg.FocusSink {
/* Should have a higher value than 3 to show up above header and summary rows */
z-index: 3;
@@ -401,7 +401,7 @@
}
.s8wc6fl7-0-0-beta-42 {
.s8wc6fl7-0-0-beta-44 {
@layer rdg.SummaryCell {
inset-block-start: var(--rdg-summary-row-top);
inset-block-end: var(--rdg-summary-row-bottom);
@@ -409,44 +409,44 @@
}
.skuhp557-0-0-beta-42 {
.skuhp557-0-0-beta-44 {
@layer rdg.SummaryRow {
line-height: var(--rdg-summary-row-height);
> .cj343x07-0-0-beta-42 {
> .cj343x07-0-0-beta-44 {
position: sticky;
}
}
}
.tf8l5ub7-0-0-beta-42 {
.tf8l5ub7-0-0-beta-44 {
@layer rdg.SummaryRow {
> .cj343x07-0-0-beta-42 {
> .cj343x07-0-0-beta-44 {
z-index: 2;
}
> .csofj7r7-0-0-beta-42 {
> .csofj7r7-0-0-beta-44 {
z-index: 3;
}
}
}
.g1yxluv37-0-0-beta-42 {
.g1yxluv37-0-0-beta-44 {
@layer rdg.GroupedRow {
&:not([aria-selected='true']) {
background-color: var(--rdg-header-background-color);
}
> .cj343x07-0-0-beta-42:not(:last-child, .csofj7r7-0-0-beta-42),
> :nth-last-child(n + 2 of .csofj7r7-0-0-beta-42) {
> .cj343x07-0-0-beta-44:not(:last-child, .csofj7r7-0-0-beta-44),
> :nth-last-child(n + 2 of .csofj7r7-0-0-beta-44) {
border-inline-end: none;
}
}
}
.t7vyx3i7-0-0-beta-42 {
.t7vyx3i7-0-0-beta-44 {
@layer rdg.TextEditor {
appearance: none;
@@ -1,6 +1,6 @@
{
"name": "react-data-grid",
"version": "7.0.0-beta.42",
"version": "7.0.0-beta.44",
"license": "MIT",
"description": "Feature-rich and customizable data grid React component",
"keywords": [
@@ -40,15 +40,15 @@
"build:types": "tsc -p tsconfig.lib.json && api-extractor run --local --verbose",
"test": "vitest run",
"test:watch": "vitest watch",
"format": "biome format . --write",
"check": "biome check . --error-on-warnings",
"biome:ci": "biome ci . --error-on-warnings",
"format": "biome format --write",
"check": "biome check --error-on-warnings",
"biome:ci": "biome ci --error-on-warnings",
"eslint": "eslint --ext js,ts,tsx --max-warnings 0 --cache --color src test website vite.config.ts",
"eslint:fix": "npm run eslint -- --fix",
"eslint:fix": "node --run eslint -- --fix",
"prettier:check": "prettier --check .",
"prettier:format": "prettier --write .",
"typecheck": "tsc",
"prepublishOnly": "npm install && npm run build && npm run build:types",
"prepublishOnly": "npm install && node --run build && node --run build:types",
"postpublish": "git push --follow-tags origin HEAD"
},
"dependencies": {
@@ -61,52 +61,54 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.18.6",
"@babel/runtime": "^7.21.5",
"@biomejs/biome": "1.5.3",
"@biomejs/biome": "1.8.0",
"@faker-js/faker": "^8.0.0",
"@ianvs/prettier-plugin-sort-imports": "^4.0.2",
"@linaria/core": "^6.0.0",
"@microsoft/api-extractor": "^7.23.0",
"@rollup/plugin-babel": "^6.0.3",
"@rollup/plugin-node-resolve": "^15.1.0",
"@testing-library/dom": "^10.1.0",
"@testing-library/jest-dom": "^6.2.0",
"@testing-library/react": "^14.1.2",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
"@types/lodash-es": "^4.17.7",
"@types/node": "^20.10.3",
"@types/react": "^18.2.35",
"@types/react-dom": "^18.2.4",
"@types/react": "^18.3.0",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@vitejs/plugin-react": "^4.2.1",
"@vitest/coverage-v8": "^1.2.0",
"@wyw-in-js/rollup": "^0.5.0",
"@wyw-in-js/vite": "^0.5.0",
"ajv": "^8.16.0",
"babel-plugin-optimize-clsx": "^2.6.2",
"eslint": "^8.43.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-jest-dom": "^5.0.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-sonarjs": "^0.24.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-sonarjs": "^1.0.3",
"eslint-plugin-testing-library": "^6.2.0",
"jsdom": "^24.0.0",
"jspdf": "^2.5.1",
"jspdf-autotable": "^3.5.23",
"lodash-es": "^4.17.21",
"postcss": "^8.4.25",
"prettier": "3.2.5",
"react": "^18.1.0",
"prettier": "3.3.1",
"react": "^18.3.1",
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "^18.1.0",
"react-dom": "^18.3.1",
"react-router-dom": "^6.11.1",
"rollup": "^4.0.2",
"rollup-plugin-postcss": "^4.0.2",
"typescript": "~5.3.2",
"typescript": "~5.4.2",
"vite": "^5.0.11",
"vitest": "^1.2.0"
"vitest": "^1.6.0"
},
"peerDependencies": {
"react": "^18.0",