@linzjs/step-ag-grid 21.0.3 → 21.1.0
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/README.md +1 -1
- package/dist/src/contexts/GridPopoverContext.d.ts +1 -0
- package/dist/step-ag-grid.cjs.js +17 -8
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +17 -8
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +14 -10
- package/src/contexts/GridPopoverContext.tsx +2 -0
- package/src/contexts/GridPopoverContextProvider.tsx +3 -0
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -2367,13 +2367,13 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2367
2367
|
return;
|
|
2368
2368
|
}
|
|
2369
2369
|
if (gridRendered === "empty") {
|
|
2370
|
-
if (!hasSetContentSizeEmpty.current &&
|
|
2370
|
+
if (!hasSetContentSizeEmpty.current && !hasSetContentSize.current) {
|
|
2371
2371
|
hasSetContentSizeEmpty.current = true;
|
|
2372
2372
|
params.onContentSize?.(result);
|
|
2373
2373
|
}
|
|
2374
2374
|
}
|
|
2375
2375
|
else if (gridRendered === "rows-visible") {
|
|
2376
|
-
if (
|
|
2376
|
+
if (!hasSetContentSize.current) {
|
|
2377
2377
|
hasSetContentSize.current = true;
|
|
2378
2378
|
params.onContentSize?.(result);
|
|
2379
2379
|
}
|
|
@@ -2584,7 +2584,9 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2584
2584
|
if (!isEmpty(updatingCols()))
|
|
2585
2585
|
return;
|
|
2586
2586
|
const skipHeader = sizeColumns === "auto-skip-headers";
|
|
2587
|
-
|
|
2587
|
+
if (hasSetContentSize.current) {
|
|
2588
|
+
autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current, colIds: colIdsEdited.current });
|
|
2589
|
+
}
|
|
2588
2590
|
colIdsEdited.current.clear();
|
|
2589
2591
|
}, [autoSizeColumns, rowData?.length, setInitialContentSize, sizeColumns, updatedDep, updatingCols]);
|
|
2590
2592
|
/**
|
|
@@ -2697,11 +2699,15 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
|
|
|
2697
2699
|
if (!isEmpty(colIdsEdited.current)) {
|
|
2698
2700
|
const skipHeader = sizeColumns === "auto-skip-headers";
|
|
2699
2701
|
if (sizeColumns === "auto" || skipHeader) {
|
|
2700
|
-
defer$1(() =>
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2702
|
+
defer$1(() => {
|
|
2703
|
+
if (hasSetContentSize.current) {
|
|
2704
|
+
autoSizeColumns({
|
|
2705
|
+
skipHeader,
|
|
2706
|
+
userSizedColIds: userSizedColIds.current,
|
|
2707
|
+
colIds: colIdsEdited.current,
|
|
2708
|
+
});
|
|
2709
|
+
}
|
|
2710
|
+
});
|
|
2705
2711
|
}
|
|
2706
2712
|
colIdsEdited.current.clear();
|
|
2707
2713
|
}
|
|
@@ -2806,6 +2812,7 @@ const GridPopoverContext = createContext({
|
|
|
2806
2812
|
anchorRef: { current: null },
|
|
2807
2813
|
saving: false,
|
|
2808
2814
|
setSaving: () => { },
|
|
2815
|
+
colId: "",
|
|
2809
2816
|
field: "",
|
|
2810
2817
|
value: null,
|
|
2811
2818
|
data: {},
|
|
@@ -2826,6 +2833,7 @@ const GridPopoverContextProvider = ({ props, children }) => {
|
|
|
2826
2833
|
// Then item that is clicked on will always be first in the list
|
|
2827
2834
|
const selectedRows = useMemo(() => multiEdit ? sortBy(getFilteredSelectedRows(), (row) => row.id !== props.data.id) : [props.data], [getFilteredSelectedRows, multiEdit, props.data]);
|
|
2828
2835
|
const field = props.colDef?.field ?? "";
|
|
2836
|
+
const colId = props.colDef?.colId ?? field ?? "";
|
|
2829
2837
|
const updateValue = useCallback(async (saveFn, tabDirection) => {
|
|
2830
2838
|
if (hasSaved.current)
|
|
2831
2839
|
return true;
|
|
@@ -2837,6 +2845,7 @@ const GridPopoverContextProvider = ({ props, children }) => {
|
|
|
2837
2845
|
saving,
|
|
2838
2846
|
setSaving,
|
|
2839
2847
|
selectedRows,
|
|
2848
|
+
colId,
|
|
2840
2849
|
field,
|
|
2841
2850
|
data: props.data,
|
|
2842
2851
|
value: props.value,
|