@linzjs/step-ag-grid 29.3.1 → 29.3.2
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.
- package/dist/step-ag-grid.cjs +12 -13
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +13 -14
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +14 -15
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { LuiMiniSpinner, LuiStatusSpinner, LuiIcon, LuiButtonGroup, LuiButton, LuiCheckboxInput } from '@linzjs/lui';
|
|
3
3
|
import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community';
|
|
4
4
|
import { AgGridReact } from 'ag-grid-react';
|
|
5
|
-
import { negate, isEmpty, findIndex, defer, debounce as debounce$1,
|
|
5
|
+
import { negate, isEmpty, findIndex, defer, debounce as debounce$1, xorBy, last, difference, omit, sortBy, delay, partition, compact, pick, groupBy, fromPairs, toPairs, isEqual, pull, filter, sumBy, remove, flatten, castArray } from 'lodash-es';
|
|
6
6
|
import React, { useRef, useLayoutEffect, useEffect, createContext, useContext, useState, useMemo, memo, forwardRef, useCallback, useReducer, cloneElement, useImperativeHandle, Fragment as Fragment$1, useId } from 'react';
|
|
7
7
|
import { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
|
|
8
8
|
|
|
@@ -2836,19 +2836,10 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
2836
2836
|
// It should be impossible to get here
|
|
2837
2837
|
console.error('Unknown value returned from hasGridRendered');
|
|
2838
2838
|
}
|
|
2839
|
-
// If there's no contentSize callback there'll be on onGridResize callback
|
|
2840
|
-
// which is required to run sizeColumnsToFit.
|
|
2841
|
-
// There's also the possibility that the panel was already the right size so didn't trigger onGridResize.
|
|
2842
|
-
delay(() => {
|
|
2843
|
-
if (requiresInitialSizeToFitRef.current) {
|
|
2844
|
-
requiresInitialSizeToFitRef.current = false;
|
|
2845
|
-
sizeColumnsToFit();
|
|
2846
|
-
}
|
|
2847
|
-
}, 50);
|
|
2848
2839
|
}
|
|
2849
2840
|
setAutoSized(true);
|
|
2850
2841
|
needsAutoSize.current = false;
|
|
2851
|
-
}, [autoSizeColumns, gridRenderState, maxInitialWidth, params, rowData, sizeColumns
|
|
2842
|
+
}, [autoSizeColumns, gridRenderState, maxInitialWidth, params, rowData, sizeColumns]);
|
|
2852
2843
|
const lastOwnerDocumentRef = useRef();
|
|
2853
2844
|
const wasVisibleRef = useRef(false);
|
|
2854
2845
|
/**
|
|
@@ -3145,6 +3136,9 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3145
3136
|
* Resize columns to fit if required on window/container resize
|
|
3146
3137
|
*/
|
|
3147
3138
|
const onGridResize = useCallback((event) => {
|
|
3139
|
+
if (!hasSetContentSizeEmpty.current && !hasSetContentSize.current) {
|
|
3140
|
+
return;
|
|
3141
|
+
}
|
|
3148
3142
|
if (sizeColumns !== 'none') {
|
|
3149
3143
|
// Flex columns can expand to fit after resize, but they cannot shrink less than use resized value
|
|
3150
3144
|
// Double click column resize handle to reset this behaviour
|
|
@@ -3155,7 +3149,6 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3155
3149
|
maxWidth: w,
|
|
3156
3150
|
})),
|
|
3157
3151
|
];
|
|
3158
|
-
requiresInitialSizeToFitRef.current = false;
|
|
3159
3152
|
defer(() => event.api.sizeColumnsToFit({ columnLimits }));
|
|
3160
3153
|
}
|
|
3161
3154
|
}, [sizeColumns]);
|
|
@@ -3329,9 +3322,15 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3329
3322
|
? {
|
|
3330
3323
|
enableSelectionWithoutKeys: params.enableSelectionWithoutKeys ?? false,
|
|
3331
3324
|
enableClickSelection: params.enableClickSelection ?? false,
|
|
3332
|
-
mode: rowSelection
|
|
3325
|
+
mode: rowSelection === 'single' ? 'singleRow' : 'multiRow',
|
|
3326
|
+
}
|
|
3327
|
+
: undefined, onDisplayedColumnsChanged: () => {
|
|
3328
|
+
// This happens after an autosize event, if we don't wait for it size columns to fit doesn't work
|
|
3329
|
+
if (requiresInitialSizeToFitRef.current) {
|
|
3330
|
+
requiresInitialSizeToFitRef.current = false;
|
|
3331
|
+
sizeColumnsToFit();
|
|
3333
3332
|
}
|
|
3334
|
-
|
|
3333
|
+
}, rowHeight: rowHeight, animateRows: params.animateRows ?? false, rowClassRules: params.rowClassRules, getRowId: getRowId, onGridSizeChanged: onGridResize, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: setInitialContentSize, onRowDataUpdated: onRowDataChanged, onCellFocused: onCellFocused, onCellKeyDown: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, domLayout: params.domLayout, onColumnResized: onColumnResized, defaultColDef: defaultColDef, columnDefs: columnDefsAdjusted, selectionColumnDef: selectionColumnDef, rowData: rowData, postSortRows: params.onRowDragEnd || !defaultPostSort ? undefined : postSortRows, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, quickFilterParser: quickFilterParser, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, noRowsOverlayComponent: noRowsOverlayComponent, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass, maintainColumnOrder: true, preventDefaultOnContextMenu: true, onCellContextMenu: gridContextMenu.cellContextMenu, rowDragText: params.rowDragText, onRowDragCancel: clearHighlightRowClasses, onRowDragMove: onRowDragMove, onRowDragEnd: onRowDragEnd, suppressCellFocus: params.suppressCellFocus, pinnedTopRowData: params.pinnedTopRowData, pinnedBottomRowData: params.pinnedBottomRowData, onRowClicked: params.onRowClicked, onRowDoubleClicked: params.onRowDoubleClicked, suppressStartEditOnTab: true }) })] }));
|
|
3335
3334
|
};
|
|
3336
3335
|
const quickFilterParser = (filterStr) => {
|
|
3337
3336
|
// filter is exact matches exactly groups separated by commas
|