@linzjs/step-ag-grid 29.3.0 → 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 +19 -19
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +19 -19
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Grid.tsx +20 -19
- package/src/stories/grid/gridAutosize/ShowPanelResizingAgGrid/ShowPanelResizingAgGrid.stories.tsx +1 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@linzjs/step-ag-grid",
|
|
3
3
|
"repository": "github:linz/step-ag-grid.git",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "29.3.
|
|
5
|
+
"version": "29.3.2",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"aggrid",
|
|
8
8
|
"ag-grid",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@chromatic-com/storybook": "^4.1.1",
|
|
84
84
|
"@linzjs/lui": "^23.11.1",
|
|
85
85
|
"@linzjs/style": "^5.4.0",
|
|
86
|
-
"@linzjs/windows": "^5.
|
|
86
|
+
"@linzjs/windows": "^5.7.0",
|
|
87
87
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
88
88
|
"@rollup/plugin-json": "^6.1.0",
|
|
89
89
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
package/src/components/Grid.tsx
CHANGED
|
@@ -172,7 +172,6 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
172
172
|
prePopupOps,
|
|
173
173
|
startCellEditing,
|
|
174
174
|
} = useGridContext<TData>();
|
|
175
|
-
|
|
176
175
|
const { updatedDep, updatingCols } = useContext(GridUpdatingContext);
|
|
177
176
|
|
|
178
177
|
const gridDivRef = useRef<HTMLDivElement>(null);
|
|
@@ -192,8 +191,7 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
192
191
|
const hasSetContentSizeEmpty = useRef(false);
|
|
193
192
|
const needsAutoSize = useRef(true);
|
|
194
193
|
|
|
195
|
-
const
|
|
196
|
-
|
|
194
|
+
const requiresInitialSizeToFitRef = useRef(true);
|
|
197
195
|
const autoSizeResultRef = useRef<AutoSizeColumnsResult | null>(null);
|
|
198
196
|
const prevRowsVisibleRef = useRef(false);
|
|
199
197
|
const setInitialContentSize = useCallback(() => {
|
|
@@ -225,6 +223,7 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
225
223
|
autoSizeColumns({
|
|
226
224
|
skipHeader,
|
|
227
225
|
userSizedColIds: new Set(userSizedColIds.current.keys()),
|
|
226
|
+
includeFlex: true,
|
|
228
227
|
});
|
|
229
228
|
// Auto-size failed retry later
|
|
230
229
|
if (!autoSizeResult) {
|
|
@@ -240,20 +239,15 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
240
239
|
// We don't do this callback if we have previously had row data, or have already called back for empty
|
|
241
240
|
if (!hasSetContentSizeEmpty.current && !hasSetContentSize.current) {
|
|
242
241
|
hasSetContentSizeEmpty.current = true;
|
|
242
|
+
requiresInitialSizeToFitRef.current = true;
|
|
243
243
|
params.onContentSize?.(autoSizeResult);
|
|
244
244
|
}
|
|
245
245
|
} else if (gridRendered === 'rows-visible') {
|
|
246
246
|
// we have rows now so callback grid size
|
|
247
247
|
if (!hasSetContentSize.current) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
params.onContentSize?.(autoSizeResult);
|
|
252
|
-
} else {
|
|
253
|
-
// Need to retry callback when size has settelled
|
|
254
|
-
lastFullResize.current = autoSizeResult.width;
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
248
|
+
hasSetContentSize.current = true;
|
|
249
|
+
requiresInitialSizeToFitRef.current = true;
|
|
250
|
+
params.onContentSize?.(autoSizeResult);
|
|
257
251
|
}
|
|
258
252
|
} else {
|
|
259
253
|
// It should be impossible to get here
|
|
@@ -261,13 +255,9 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
261
255
|
}
|
|
262
256
|
}
|
|
263
257
|
|
|
264
|
-
// 2. Now we size columns to fit the grid width
|
|
265
|
-
if (sizeColumns !== 'none') {
|
|
266
|
-
sizeColumnsToFit();
|
|
267
|
-
}
|
|
268
258
|
setAutoSized(true);
|
|
269
259
|
needsAutoSize.current = false;
|
|
270
|
-
}, [autoSizeColumns, gridRenderState, maxInitialWidth, params, rowData, sizeColumns
|
|
260
|
+
}, [autoSizeColumns, gridRenderState, maxInitialWidth, params, rowData, sizeColumns]);
|
|
271
261
|
|
|
272
262
|
const lastOwnerDocumentRef = useRef<Document>();
|
|
273
263
|
const wasVisibleRef = useRef(false);
|
|
@@ -613,6 +603,9 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
613
603
|
*/
|
|
614
604
|
const onGridResize = useCallback(
|
|
615
605
|
(event: AgGridEvent<TData>) => {
|
|
606
|
+
if (!hasSetContentSizeEmpty.current && !hasSetContentSize.current) {
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
616
609
|
if (sizeColumns !== 'none') {
|
|
617
610
|
// Flex columns can expand to fit after resize, but they cannot shrink less than use resized value
|
|
618
611
|
// Double click column resize handle to reset this behaviour
|
|
@@ -625,7 +618,7 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
625
618
|
}),
|
|
626
619
|
),
|
|
627
620
|
];
|
|
628
|
-
event.api.sizeColumnsToFit({ columnLimits });
|
|
621
|
+
defer(() => event.api.sizeColumnsToFit({ columnLimits }));
|
|
629
622
|
}
|
|
630
623
|
},
|
|
631
624
|
[sizeColumns],
|
|
@@ -649,6 +642,7 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
649
642
|
if (width == null) {
|
|
650
643
|
return;
|
|
651
644
|
}
|
|
645
|
+
|
|
652
646
|
switch (e.source) {
|
|
653
647
|
case 'uiColumnResized':
|
|
654
648
|
userSizedColIds.current.set(colId, width);
|
|
@@ -861,10 +855,17 @@ export const Grid = <TData extends GridBaseRow = GridBaseRow>({
|
|
|
861
855
|
? {
|
|
862
856
|
enableSelectionWithoutKeys: params.enableSelectionWithoutKeys ?? false,
|
|
863
857
|
enableClickSelection: params.enableClickSelection ?? false,
|
|
864
|
-
mode: rowSelection
|
|
858
|
+
mode: rowSelection === 'single' ? 'singleRow' : 'multiRow',
|
|
865
859
|
}
|
|
866
860
|
: undefined
|
|
867
861
|
}
|
|
862
|
+
onDisplayedColumnsChanged={() => {
|
|
863
|
+
// This happens after an autosize event, if we don't wait for it size columns to fit doesn't work
|
|
864
|
+
if (requiresInitialSizeToFitRef.current) {
|
|
865
|
+
requiresInitialSizeToFitRef.current = false;
|
|
866
|
+
sizeColumnsToFit();
|
|
867
|
+
}
|
|
868
|
+
}}
|
|
868
869
|
rowHeight={rowHeight}
|
|
869
870
|
animateRows={params.animateRows ?? false}
|
|
870
871
|
rowClassRules={params.rowClassRules}
|
package/src/stories/grid/gridAutosize/ShowPanelResizingAgGrid/ShowPanelResizingAgGrid.stories.tsx
CHANGED
|
@@ -12,7 +12,7 @@ const meta: Meta<typeof TestShowPanelResizingAgGrid> = {
|
|
|
12
12
|
decorators: [
|
|
13
13
|
(Story) => (
|
|
14
14
|
<div>
|
|
15
|
-
<PanelsContextProvider baseZIndex={500}>
|
|
15
|
+
<PanelsContextProvider baseZIndex={500} panelStateOptions={null}>
|
|
16
16
|
<Story />
|
|
17
17
|
</PanelsContextProvider>
|
|
18
18
|
</div>
|