@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/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": "21.0.3",
5
+ "version": "21.1.0",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -187,12 +187,12 @@ export const Grid = ({
187
187
  return;
188
188
  }
189
189
  if (gridRendered === "empty") {
190
- if (!hasSetContentSizeEmpty.current && result && !hasSetContentSize.current) {
190
+ if (!hasSetContentSizeEmpty.current && !hasSetContentSize.current) {
191
191
  hasSetContentSizeEmpty.current = true;
192
192
  params.onContentSize?.(result);
193
193
  }
194
194
  } else if (gridRendered === "rows-visible") {
195
- if (result && !hasSetContentSize.current) {
195
+ if (!hasSetContentSize.current) {
196
196
  hasSetContentSize.current = true;
197
197
  params.onContentSize?.(result);
198
198
  }
@@ -425,7 +425,9 @@ export const Grid = ({
425
425
  if (!isEmpty(updatingCols())) return;
426
426
 
427
427
  const skipHeader = sizeColumns === "auto-skip-headers";
428
- autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current, colIds: colIdsEdited.current });
428
+ if (hasSetContentSize.current) {
429
+ autoSizeColumns({ skipHeader, userSizedColIds: userSizedColIds.current, colIds: colIdsEdited.current });
430
+ }
429
431
  colIdsEdited.current.clear();
430
432
  }, [autoSizeColumns, rowData?.length, setInitialContentSize, sizeColumns, updatedDep, updatingCols]);
431
433
 
@@ -563,13 +565,15 @@ export const Grid = ({
563
565
  if (!isEmpty(colIdsEdited.current)) {
564
566
  const skipHeader = sizeColumns === "auto-skip-headers";
565
567
  if (sizeColumns === "auto" || skipHeader) {
566
- defer(() =>
567
- autoSizeColumns({
568
- skipHeader,
569
- userSizedColIds: userSizedColIds.current,
570
- colIds: colIdsEdited.current,
571
- }),
572
- );
568
+ defer(() => {
569
+ if (hasSetContentSize.current) {
570
+ autoSizeColumns({
571
+ skipHeader,
572
+ userSizedColIds: userSizedColIds.current,
573
+ colIds: colIdsEdited.current,
574
+ });
575
+ }
576
+ });
573
577
  }
574
578
  colIdsEdited.current.clear();
575
579
  }
@@ -6,6 +6,7 @@ export interface GridPopoverContextType<TData extends GridBaseRow> {
6
6
  anchorRef: RefObject<Element>;
7
7
  saving: boolean;
8
8
  setSaving: (saving: boolean) => void;
9
+ colId: string;
9
10
  field: keyof TData;
10
11
  value: any;
11
12
  data: TData;
@@ -18,6 +19,7 @@ export const GridPopoverContext = createContext<GridPopoverContextType<any>>({
18
19
  anchorRef: { current: null },
19
20
  saving: false,
20
21
  setSaving: () => {},
22
+ colId: "",
21
23
  field: "",
22
24
  value: null,
23
25
  data: {} as GridBaseRow,
@@ -26,7 +26,9 @@ export const GridPopoverContextProvider = ({ props, children }: PropsWithChildre
26
26
  multiEdit ? sortBy(getFilteredSelectedRows(), (row) => row.id !== props.data.id) : [props.data as GridBaseRow],
27
27
  [getFilteredSelectedRows, multiEdit, props.data],
28
28
  );
29
+
29
30
  const field = props.colDef?.field ?? "";
31
+ const colId = props.colDef?.colId ?? field ?? "";
30
32
 
31
33
  const updateValue = useCallback(
32
34
  async (saveFn: (selectedRows: any[]) => Promise<boolean>, tabDirection: 1 | 0 | -1): Promise<boolean> => {
@@ -44,6 +46,7 @@ export const GridPopoverContextProvider = ({ props, children }: PropsWithChildre
44
46
  saving,
45
47
  setSaving,
46
48
  selectedRows,
49
+ colId,
47
50
  field,
48
51
  data: props.data,
49
52
  value: props.value,