@linzjs/step-ag-grid 7.11.7 → 7.11.8

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": "7.11.7",
5
+ "version": "7.11.8",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -186,9 +186,9 @@ export const Grid = (params: GridProps): JSX.Element => {
186
186
  } else {
187
187
  e.api.deselectAll();
188
188
  }
189
- return false;
189
+ return true;
190
190
  }
191
- return true;
191
+ return false;
192
192
  },
193
193
  onCellClicked: clickSelectorCheckboxWhenContainingCellClicked,
194
194
  },
@@ -1,6 +1,6 @@
1
1
  import clsx from "clsx";
2
2
  import { IHeaderParams } from "ag-grid-community";
3
- import { useEffect, useState } from "react";
3
+ import { useCallback, useEffect, useState } from "react";
4
4
 
5
5
  /**
6
6
  * AgGrid's existing select header doesn't work the way we want.
@@ -12,9 +12,9 @@ export const GridHeaderSelect = ({ api }: IHeaderParams) => {
12
12
  const [updateCounter, setUpdateCounter] = useState(0);
13
13
  const selectedNodeCount = api.getSelectedRows().length;
14
14
 
15
- const clickHandler = () => {
15
+ const clickHandler = useCallback(() => {
16
16
  setUpdateCounter(updateCounter + 1);
17
- };
17
+ }, [updateCounter]);
18
18
 
19
19
  useEffect(() => {
20
20
  api.addEventListener("selectionChanged", clickHandler);
@@ -1,7 +1,7 @@
1
1
  import { ReactElement, ReactNode, useContext, useRef, useState } from "react";
2
2
  import { ColDef, GridApi, RowNode } from "ag-grid-community";
3
3
  import { GridContext } from "./GridContext";
4
- import { delay, difference, isEmpty, last, sortBy } from "lodash-es";
4
+ import { defer, delay, difference, isEmpty, last, sortBy } from "lodash-es";
5
5
  import { isNotEmpty, wait } from "../utils/util";
6
6
  import { GridUpdatingContext } from "./GridUpdatingContext";
7
7
  import { GridBaseRow } from "../components/Grid";
@@ -139,7 +139,9 @@ export const GridContextProvider = (props: GridContextProps): ReactElement => {
139
139
  const rowIndex = firstNode.rowIndex;
140
140
  if (rowIndex != null && col != null) {
141
141
  const colId = col.colId;
142
- colId != null && setTimeout(() => gridApi.setFocusedCell(rowIndex, colId), 100);
142
+ // We need to make sure we aren't currently editing a cell otherwise tests will fail
143
+ // as they will start to edit the cell before this stuff has a chance to run
144
+ colId != null && defer(() => isEmpty(gridApi.getEditingCells()) && gridApi.setFocusedCell(rowIndex, colId));
143
145
  }
144
146
  }
145
147
  }