@linzjs/step-ag-grid 21.0.4 → 21.1.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/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.4",
5
+ "version": "21.1.1",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -165,6 +165,8 @@ export const Grid = ({
165
165
  const hasSetContentSizeEmpty = useRef(false);
166
166
  const needsAutoSize = useRef(true);
167
167
 
168
+ const lastFullResize = useRef<number>();
169
+
168
170
  const setInitialContentSize = useCallback(() => {
169
171
  if (!gridDivRef.current?.clientWidth || rowData == null) {
170
172
  // Don't resize grids if they are offscreen as it doesn't work.
@@ -193,8 +195,13 @@ export const Grid = ({
193
195
  }
194
196
  } else if (gridRendered === "rows-visible") {
195
197
  if (!hasSetContentSize.current) {
196
- hasSetContentSize.current = true;
197
- params.onContentSize?.(result);
198
+ if (lastFullResize.current === result.width) {
199
+ hasSetContentSize.current = true;
200
+ params.onContentSize?.(result);
201
+ } else {
202
+ needsAutoSize.current = true;
203
+ }
204
+ lastFullResize.current = result.width;
198
205
  }
199
206
  } else {
200
207
  // It should be impossible to get here
@@ -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,