@linzjs/step-ag-grid 29.3.0 → 29.3.1
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 +17 -16
- package/dist/step-ag-grid.cjs.map +1 -1
- package/dist/step-ag-grid.esm.js +18 -17
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Grid.tsx +19 -17
- package/src/stories/grid/gridAutosize/ShowPanelResizingAgGrid/ShowPanelResizingAgGrid.stories.tsx +1 -1
package/dist/step-ag-grid.cjs
CHANGED
|
@@ -2778,7 +2778,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
2778
2778
|
const hasSetContentSize = React.useRef(false);
|
|
2779
2779
|
const hasSetContentSizeEmpty = React.useRef(false);
|
|
2780
2780
|
const needsAutoSize = React.useRef(true);
|
|
2781
|
-
const
|
|
2781
|
+
const requiresInitialSizeToFitRef = React.useRef(true);
|
|
2782
2782
|
const autoSizeResultRef = React.useRef(null);
|
|
2783
2783
|
const prevRowsVisibleRef = React.useRef(false);
|
|
2784
2784
|
const setInitialContentSize = React.useCallback(() => {
|
|
@@ -2807,6 +2807,7 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
2807
2807
|
autoSizeColumns({
|
|
2808
2808
|
skipHeader,
|
|
2809
2809
|
userSizedColIds: new Set(userSizedColIds.current.keys()),
|
|
2810
|
+
includeFlex: true,
|
|
2810
2811
|
});
|
|
2811
2812
|
// Auto-size failed retry later
|
|
2812
2813
|
if (!autoSizeResult) {
|
|
@@ -2821,32 +2822,31 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
2821
2822
|
// We don't do this callback if we have previously had row data, or have already called back for empty
|
|
2822
2823
|
if (!hasSetContentSizeEmpty.current && !hasSetContentSize.current) {
|
|
2823
2824
|
hasSetContentSizeEmpty.current = true;
|
|
2825
|
+
requiresInitialSizeToFitRef.current = true;
|
|
2824
2826
|
params.onContentSize?.(autoSizeResult);
|
|
2825
2827
|
}
|
|
2826
2828
|
}
|
|
2827
2829
|
else if (gridRendered === 'rows-visible') {
|
|
2828
2830
|
// we have rows now so callback grid size
|
|
2829
2831
|
if (!hasSetContentSize.current) {
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
params.onContentSize?.(autoSizeResult);
|
|
2834
|
-
}
|
|
2835
|
-
else {
|
|
2836
|
-
// Need to retry callback when size has settelled
|
|
2837
|
-
lastFullResize.current = autoSizeResult.width;
|
|
2838
|
-
return;
|
|
2839
|
-
}
|
|
2832
|
+
hasSetContentSize.current = true;
|
|
2833
|
+
requiresInitialSizeToFitRef.current = true;
|
|
2834
|
+
params.onContentSize?.(autoSizeResult);
|
|
2840
2835
|
}
|
|
2841
2836
|
}
|
|
2842
2837
|
else {
|
|
2843
2838
|
// It should be impossible to get here
|
|
2844
2839
|
console.error('Unknown value returned from hasGridRendered');
|
|
2845
2840
|
}
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2841
|
+
// If there's no contentSize callback there'll be on onGridResize callback
|
|
2842
|
+
// which is required to run sizeColumnsToFit.
|
|
2843
|
+
// There's also the possibility that the panel was already the right size so didn't trigger onGridResize.
|
|
2844
|
+
lodashEs.delay(() => {
|
|
2845
|
+
if (requiresInitialSizeToFitRef.current) {
|
|
2846
|
+
requiresInitialSizeToFitRef.current = false;
|
|
2847
|
+
sizeColumnsToFit();
|
|
2848
|
+
}
|
|
2849
|
+
}, 50);
|
|
2850
2850
|
}
|
|
2851
2851
|
setAutoSized(true);
|
|
2852
2852
|
needsAutoSize.current = false;
|
|
@@ -3157,7 +3157,8 @@ const Grid = ({ 'data-testid': dataTestId, defaultPostSort = true, rowSelection
|
|
|
3157
3157
|
maxWidth: w,
|
|
3158
3158
|
})),
|
|
3159
3159
|
];
|
|
3160
|
-
|
|
3160
|
+
requiresInitialSizeToFitRef.current = false;
|
|
3161
|
+
lodashEs.defer(() => event.api.sizeColumnsToFit({ columnLimits }));
|
|
3161
3162
|
}
|
|
3162
3163
|
}, [sizeColumns]);
|
|
3163
3164
|
/**
|