@alaarab/ogrid-react-material 2.0.13 → 2.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -187,7 +187,7 @@ function GridRowInner(props) {
|
|
|
187
187
|
const GridRow = React.memo(GridRowInner, areGridRowPropsEqual);
|
|
188
188
|
function DataGridTableInner(props) {
|
|
189
189
|
const o = useDataGridTableOrchestration({ props });
|
|
190
|
-
const { wrapperRef, tableContainerRef, lastMouseShiftRef, interaction, pinning, handleResizeStart, getColumnWidth, isReorderDragging, dropIndicatorX, handleHeaderMouseDown, virtualScrollEnabled, visibleRange, items, getRowId, emptyState, freezeRows, freezeCols, suppressHorizontalScroll, isLoading, loadingMessage, ariaLabel, ariaLabelledBy, columnReorder, density, rowNumberOffset, headerRows, allowOverflowX, fitToContent, editCallbacks, interactionHandlers, cellDescriptorInputRef, pendingEditorValueRef, popoverAnchorElRef, handleSingleRowClick, handlePasteVoid, visibleCols, hasCheckboxCol, hasRowNumbersCol, colOffset, minTableWidth, columnSizingOverrides, selectedRowIds, handleRowCheckboxChange, handleSelectAll, allSelected, someSelected, editingCell, setPopoverAnchorEl, cancelPopoverEdit, setActiveCell, selectionRange, hasCellSelection, handleGridKeyDown, handleFillHandleMouseDown, handleCopy, handleCut, cutRange, copyRange, canUndo, canRedo, onUndo, onRedo, isDragging, menuPosition, closeContextMenu, headerFilterInput, statusBarConfig, showEmptyInGrid, onCellError, } = o;
|
|
190
|
+
const { wrapperRef, tableContainerRef, lastMouseShiftRef, interaction, pinning, handleResizeStart, getColumnWidth, isReorderDragging, dropIndicatorX, handleHeaderMouseDown, virtualScrollEnabled, visibleRange, items, getRowId, emptyState, freezeRows, freezeCols, suppressHorizontalScroll, isLoading, loadingMessage, ariaLabel, ariaLabelledBy, columnReorder, density, rowNumberOffset, headerRows, allowOverflowX, fitToContent, editCallbacks, interactionHandlers, cellDescriptorInputRef, pendingEditorValueRef, popoverAnchorElRef, handleSingleRowClick, handlePasteVoid, visibleCols, hasCheckboxCol, hasRowNumbersCol, colOffset, minTableWidth, columnSizingOverrides, measuredColumnWidths, selectedRowIds, handleRowCheckboxChange, handleSelectAll, allSelected, someSelected, editingCell, setPopoverAnchorEl, cancelPopoverEdit, setActiveCell, selectionRange, hasCellSelection, handleGridKeyDown, handleFillHandleMouseDown, handleCopy, handleCut, cutRange, copyRange, canUndo, canRedo, onUndo, onRedo, isDragging, menuPosition, closeContextMenu, headerFilterInput, statusBarConfig, showEmptyInGrid, onCellError, } = o;
|
|
191
191
|
// Density-aware cell padding
|
|
192
192
|
const densityPadding = useMemo(() => getDensityPadding(density), [density]);
|
|
193
193
|
const _cellSx = useMemo(() => ({ ...CELL_CONTENT_BASE_SX, ...densityPadding }), [densityPadding]);
|
|
@@ -206,8 +206,13 @@ function DataGridTableInner(props) {
|
|
|
206
206
|
? { ...baseTdSx, right: pinning.rightOffsets[col.columnId] }
|
|
207
207
|
: baseTdSx;
|
|
208
208
|
const hasResizeOverride = !!columnSizingOverrides[col.columnId];
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
// Use previously-measured DOM width as a minWidth floor to prevent columns
|
|
210
|
+
// from shrinking when new data loads (e.g. server-side pagination).
|
|
211
|
+
const measuredW = measuredColumnWidths[col.columnId];
|
|
212
|
+
const baseMinWidth = col.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH;
|
|
213
|
+
const effectiveMinWidth = hasResizeOverride ? columnWidth : Math.max(baseMinWidth, measuredW ?? 0);
|
|
214
|
+
return { col, tdSx, minWidth: effectiveMinWidth, width: columnWidth, maxWidth: columnWidth };
|
|
215
|
+
}), [visibleCols, freezeCols, getColumnWidth, columnSizingOverrides, measuredColumnWidths, pinning.pinnedColumns, pinning.leftOffsets, pinning.rightOffsets]);
|
|
211
216
|
// Wrapper sx (depends on dynamic values — memoize to avoid recreation)
|
|
212
217
|
const wrapperSx = useMemo(() => ({
|
|
213
218
|
position: 'relative',
|
|
@@ -313,7 +318,7 @@ function DataGridTableInner(props) {
|
|
|
313
318
|
sx: {
|
|
314
319
|
...headerSx,
|
|
315
320
|
...headerCellSx,
|
|
316
|
-
minWidth: col.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH,
|
|
321
|
+
minWidth: Math.max(col.minWidth ?? DEFAULT_MIN_COLUMN_WIDTH, measuredColumnWidths[col.columnId] ?? 0),
|
|
317
322
|
width: columnWidth,
|
|
318
323
|
maxWidth: columnWidth,
|
|
319
324
|
...(columnReorder ? { cursor: isReorderDragging ? 'grabbing' : 'grab' } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alaarab/ogrid-react-material",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "OGrid React Material implementation – MUI Table–based data grid with sorting, filtering, pagination, column chooser, spreadsheet selection, and CSV export.",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"node": ">=18"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@alaarab/ogrid-react": "2.0.
|
|
42
|
+
"@alaarab/ogrid-react": "2.0.15"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@emotion/react": "^11.0.0",
|