@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 CHANGED
@@ -277,4 +277,4 @@ This will throw an exception if the row id is not found.
277
277
 
278
278
  ```tsx
279
279
  window.__stepAgGrid.grids[dataTestId].scrollRowIntoViewById("1000")
280
- ```
280
+ ```
@@ -4,6 +4,7 @@ export interface GridPopoverContextType<TData extends GridBaseRow> {
4
4
  anchorRef: RefObject<Element>;
5
5
  saving: boolean;
6
6
  setSaving: (saving: boolean) => void;
7
+ colId: string;
7
8
  field: keyof TData;
8
9
  value: any;
9
10
  data: TData;
@@ -2369,13 +2369,13 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2369
2369
  return;
2370
2370
  }
2371
2371
  if (gridRendered === "empty") {
2372
- if (!hasSetContentSizeEmpty.current && result && !hasSetContentSize.current) {
2372
+ if (!hasSetContentSizeEmpty.current && !hasSetContentSize.current) {
2373
2373
  hasSetContentSizeEmpty.current = true;
2374
2374
  params.onContentSize?.(result);
2375
2375
  }
2376
2376
  }
2377
2377
  else if (gridRendered === "rows-visible") {
2378
- if (result && !hasSetContentSize.current) {
2378
+ if (!hasSetContentSize.current) {
2379
2379
  hasSetContentSize.current = true;
2380
2380
  params.onContentSize?.(result);
2381
2381
  }
@@ -2586,7 +2586,9 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2586
2586
  if (!lodashEs.isEmpty(updatingCols()))
2587
2587
  return;
2588
2588
  const skipHeader = sizeColumns === "auto-skip-headers";
2589
- autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current, colIds: colIdsEdited.current });
2589
+ if (hasSetContentSize.current) {
2590
+ autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current, colIds: colIdsEdited.current });
2591
+ }
2590
2592
  colIdsEdited.current.clear();
2591
2593
  }, [autoSizeColumns, rowData?.length, setInitialContentSize, sizeColumns, updatedDep, updatingCols]);
2592
2594
  /**
@@ -2699,11 +2701,15 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2699
2701
  if (!lodashEs.isEmpty(colIdsEdited.current)) {
2700
2702
  const skipHeader = sizeColumns === "auto-skip-headers";
2701
2703
  if (sizeColumns === "auto" || skipHeader) {
2702
- lodashEs.defer(() => autoSizeColumns({
2703
- skipHeader,
2704
- userSizedColIds: userSizedColIds.current,
2705
- colIds: colIdsEdited.current,
2706
- }));
2704
+ lodashEs.defer(() => {
2705
+ if (hasSetContentSize.current) {
2706
+ autoSizeColumns({
2707
+ skipHeader,
2708
+ userSizedColIds: userSizedColIds.current,
2709
+ colIds: colIdsEdited.current,
2710
+ });
2711
+ }
2712
+ });
2707
2713
  }
2708
2714
  colIdsEdited.current.clear();
2709
2715
  }
@@ -2808,6 +2814,7 @@ const GridPopoverContext = React.createContext({
2808
2814
  anchorRef: { current: null },
2809
2815
  saving: false,
2810
2816
  setSaving: () => { },
2817
+ colId: "",
2811
2818
  field: "",
2812
2819
  value: null,
2813
2820
  data: {},
@@ -2828,6 +2835,7 @@ const GridPopoverContextProvider = ({ props, children }) => {
2828
2835
  // Then item that is clicked on will always be first in the list
2829
2836
  const selectedRows = React.useMemo(() => multiEdit ? lodashEs.sortBy(getFilteredSelectedRows(), (row) => row.id !== props.data.id) : [props.data], [getFilteredSelectedRows, multiEdit, props.data]);
2830
2837
  const field = props.colDef?.field ?? "";
2838
+ const colId = props.colDef?.colId ?? field ?? "";
2831
2839
  const updateValue = React.useCallback(async (saveFn, tabDirection) => {
2832
2840
  if (hasSaved.current)
2833
2841
  return true;
@@ -2839,6 +2847,7 @@ const GridPopoverContextProvider = ({ props, children }) => {
2839
2847
  saving,
2840
2848
  setSaving,
2841
2849
  selectedRows,
2850
+ colId,
2842
2851
  field,
2843
2852
  data: props.data,
2844
2853
  value: props.value,