@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/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/step-ag-grid.esm.js +8 -6
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +2 -2
- package/src/components/gridHeader/GridHeaderSelect.tsx +3 -3
- package/src/contexts/GridContextProvider.tsx +4 -2
package/package.json
CHANGED
package/src/components/Grid.tsx
CHANGED
|
@@ -186,9 +186,9 @@ export const Grid = (params: GridProps): JSX.Element => {
|
|
|
186
186
|
} else {
|
|
187
187
|
e.api.deselectAll();
|
|
188
188
|
}
|
|
189
|
-
return
|
|
189
|
+
return true;
|
|
190
190
|
}
|
|
191
|
-
return
|
|
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
|
-
|
|
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
|
}
|