@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/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;
@@ -2349,6 +2349,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2349
2349
  const hasSetContentSize = React.useRef(false);
2350
2350
  const hasSetContentSizeEmpty = React.useRef(false);
2351
2351
  const needsAutoSize = React.useRef(true);
2352
+ const lastFullResize = React.useRef();
2352
2353
  const setInitialContentSize = React.useCallback(() => {
2353
2354
  if (!gridDivRef.current?.clientWidth || rowData == null) {
2354
2355
  // Don't resize grids if they are offscreen as it doesn't work.
@@ -2376,8 +2377,14 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
2376
2377
  }
2377
2378
  else if (gridRendered === "rows-visible") {
2378
2379
  if (!hasSetContentSize.current) {
2379
- hasSetContentSize.current = true;
2380
- params.onContentSize?.(result);
2380
+ if (lastFullResize.current === result.width) {
2381
+ hasSetContentSize.current = true;
2382
+ params.onContentSize?.(result);
2383
+ }
2384
+ else {
2385
+ needsAutoSize.current = true;
2386
+ }
2387
+ lastFullResize.current = result.width;
2381
2388
  }
2382
2389
  }
2383
2390
  else {
@@ -2814,6 +2821,7 @@ const GridPopoverContext = React.createContext({
2814
2821
  anchorRef: { current: null },
2815
2822
  saving: false,
2816
2823
  setSaving: () => { },
2824
+ colId: "",
2817
2825
  field: "",
2818
2826
  value: null,
2819
2827
  data: {},
@@ -2834,6 +2842,7 @@ const GridPopoverContextProvider = ({ props, children }) => {
2834
2842
  // Then item that is clicked on will always be first in the list
2835
2843
  const selectedRows = React.useMemo(() => multiEdit ? lodashEs.sortBy(getFilteredSelectedRows(), (row) => row.id !== props.data.id) : [props.data], [getFilteredSelectedRows, multiEdit, props.data]);
2836
2844
  const field = props.colDef?.field ?? "";
2845
+ const colId = props.colDef?.colId ?? field ?? "";
2837
2846
  const updateValue = React.useCallback(async (saveFn, tabDirection) => {
2838
2847
  if (hasSaved.current)
2839
2848
  return true;
@@ -2845,6 +2854,7 @@ const GridPopoverContextProvider = ({ props, children }) => {
2845
2854
  saving,
2846
2855
  setSaving,
2847
2856
  selectedRows,
2857
+ colId,
2848
2858
  field,
2849
2859
  data: props.data,
2850
2860
  value: props.value,