@linzjs/step-ag-grid 21.2.0 → 21.2.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/dist/step-ag-grid.cjs.js +17 -1
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +17 -1
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/contexts/GridContextProvider.tsx +18 -1
- package/src/stories/grid/GridReadOnly.stories.tsx +8 -1
package/dist/step-ag-grid.cjs.js
CHANGED
|
@@ -5025,7 +5025,23 @@ const GridContextProvider = (props) => {
|
|
|
5025
5025
|
}
|
|
5026
5026
|
}, []);
|
|
5027
5027
|
const onFilterChanged = React.useMemo(() => debounce(() => {
|
|
5028
|
-
|
|
5028
|
+
// This is terrible, but there's no other way for me to check whether a filter has changed the grid
|
|
5029
|
+
const getDisplayedRowsHash = () => {
|
|
5030
|
+
const arr = [];
|
|
5031
|
+
gridApi?.forEachNodeAfterFilter((rowNode) => {
|
|
5032
|
+
arr.push(rowNode.id);
|
|
5033
|
+
});
|
|
5034
|
+
return arr.join("|");
|
|
5035
|
+
};
|
|
5036
|
+
if (gridApi) {
|
|
5037
|
+
const hasFocusedCell = gridApi.getFocusedCell();
|
|
5038
|
+
const preHash = hasFocusedCell && getDisplayedRowsHash();
|
|
5039
|
+
gridApi.onFilterChanged();
|
|
5040
|
+
const postHash = hasFocusedCell && getDisplayedRowsHash();
|
|
5041
|
+
// Ag-grid has a bug where if a focused cell comes into view after a filter the filter loses focus
|
|
5042
|
+
// So the focus is cleared to prevent this
|
|
5043
|
+
preHash !== postHash && gridApi.clearFocusedCell();
|
|
5044
|
+
}
|
|
5029
5045
|
}, 200), [gridApi]);
|
|
5030
5046
|
const addExternalFilter = (filter) => {
|
|
5031
5047
|
externalFilters.current.push(filter);
|