@linzjs/step-ag-grid 21.1.4 → 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/index.css +12 -1
- package/dist/src/contexts/GridContext.d.ts +0 -1
- package/dist/src/contexts/GridSubComponentContext.d.ts +0 -1
- package/dist/src/contexts/GridUpdatingContext.d.ts +0 -1
- package/dist/src/react-menu3/components/ControlledMenu.d.ts +1 -1
- package/dist/src/react-menu3/components/MenuDivider.d.ts +0 -1
- package/dist/src/react-menu3/components/MenuItem.d.ts +0 -1
- package/dist/src/react-menu3/contexts/EventHandlersContext.d.ts +0 -1
- package/dist/src/react-menu3/contexts/HoverItemContext.d.ts +0 -1
- package/dist/src/react-menu3/contexts/ItemSettingsContext.d.ts +0 -1
- package/dist/src/react-menu3/contexts/MenuListContext.d.ts +5 -5
- package/dist/src/react-menu3/contexts/MenuListItemContext.d.ts +0 -1
- package/dist/src/react-menu3/contexts/RadioGroupContext.d.ts +2 -3
- package/dist/src/react-menu3/hooks/useMenuState.d.ts +15 -17
- package/dist/src/react-menu3/utils/utils.d.ts +0 -1
- package/dist/step-ag-grid.cjs.js +50 -31
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +50 -31
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +36 -36
- package/src/components/gridFilter/GridFilterQuick.tsx +5 -1
- package/src/contexts/GridContextProvider.tsx +28 -2
- package/src/stories/grid/GridReadOnly.stories.tsx +8 -1
- package/src/styles/Grid.scss +13 -1
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.1
|
|
5
|
+
"version": "21.2.1",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"aggrid",
|
|
8
8
|
"ag-grid",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"matcher": "^5.0.0",
|
|
42
42
|
"react-transition-state": "^2.1.1",
|
|
43
43
|
"usehooks-ts": "^3.1.0",
|
|
44
|
-
"uuid": "^
|
|
44
|
+
"uuid": "^10.0.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "run-s clean stylelint lint css bundle",
|
|
@@ -79,50 +79,50 @@
|
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
|
81
81
|
"@chromatic-com/storybook": "^1.3.5",
|
|
82
|
-
"@linzjs/lui": "^21.
|
|
83
|
-
"@rollup/plugin-commonjs": "^
|
|
82
|
+
"@linzjs/lui": "^21.38.2",
|
|
83
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
84
84
|
"@rollup/plugin-json": "^6.1.0",
|
|
85
85
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
86
86
|
"@semantic-release/changelog": "^6.0.3",
|
|
87
87
|
"@semantic-release/git": "^10.0.1",
|
|
88
|
-
"@storybook/addon-essentials": "^8.1.
|
|
89
|
-
"@storybook/addon-interactions": "^8.1.
|
|
90
|
-
"@storybook/addon-links": "^8.1.
|
|
91
|
-
"@storybook/react": "^8.1.
|
|
92
|
-
"@storybook/react-vite": "^8.1.
|
|
93
|
-
"@storybook/test": "^8.1.
|
|
94
|
-
"@storybook/test-runner": "^0.
|
|
95
|
-
"@testing-library/dom": "^10.
|
|
96
|
-
"@testing-library/jest-dom": "^6.4.
|
|
88
|
+
"@storybook/addon-essentials": "^8.1.11",
|
|
89
|
+
"@storybook/addon-interactions": "^8.1.11",
|
|
90
|
+
"@storybook/addon-links": "^8.1.11",
|
|
91
|
+
"@storybook/react": "^8.1.11",
|
|
92
|
+
"@storybook/react-vite": "^8.1.11",
|
|
93
|
+
"@storybook/test": "^8.1.11",
|
|
94
|
+
"@storybook/test-runner": "^0.19.0",
|
|
95
|
+
"@testing-library/dom": "^10.2.0",
|
|
96
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
97
97
|
"@testing-library/react": "^15.0.7",
|
|
98
98
|
"@testing-library/user-event": "^14.5.2",
|
|
99
99
|
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
100
100
|
"@types/debounce-promise": "^3.1.9",
|
|
101
101
|
"@types/jest": "^29.5.12",
|
|
102
102
|
"@types/lodash-es": "^4.17.12",
|
|
103
|
-
"@types/node": "^18.19.
|
|
104
|
-
"@types/react": "^18.3.
|
|
103
|
+
"@types/node": "^18.19.39",
|
|
104
|
+
"@types/react": "^18.3.3",
|
|
105
105
|
"@types/react-dom": "^18.3.0",
|
|
106
|
-
"@types/uuid": "^
|
|
107
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
108
|
-
"@typescript-eslint/parser": "^7.
|
|
109
|
-
"@vitejs/plugin-react-swc": "^3.
|
|
110
|
-
"ag-grid-community": "^31",
|
|
111
|
-
"ag-grid-react": "^31",
|
|
106
|
+
"@types/uuid": "^10.0.0",
|
|
107
|
+
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
108
|
+
"@typescript-eslint/parser": "^7.15.0",
|
|
109
|
+
"@vitejs/plugin-react-swc": "^3.7.0",
|
|
110
|
+
"ag-grid-community": "^31.3.2",
|
|
111
|
+
"ag-grid-react": "^31.3.2",
|
|
112
112
|
"babel-jest": "^29.7.0",
|
|
113
113
|
"babel-preset-react-app": "^10.0.1",
|
|
114
|
-
"chromatic": "^11.
|
|
115
|
-
"css-loader": "^7.1.
|
|
116
|
-
"esbuild": "^0.
|
|
114
|
+
"chromatic": "^11.5.4",
|
|
115
|
+
"css-loader": "^7.1.2",
|
|
116
|
+
"esbuild": "^0.22.0",
|
|
117
117
|
"eslint": "^8.57.0",
|
|
118
118
|
"eslint-config-prettier": "^9.1.0",
|
|
119
119
|
"eslint-config-react-app": "^7.0.1",
|
|
120
120
|
"eslint-plugin-deprecation": "^2.0.0",
|
|
121
121
|
"eslint-plugin-import": "^2.29.1",
|
|
122
|
-
"eslint-plugin-jest": "^28.
|
|
123
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
122
|
+
"eslint-plugin-jest": "^28.6.0",
|
|
123
|
+
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
124
124
|
"eslint-plugin-prettier": "^5.1.3",
|
|
125
|
-
"eslint-plugin-react": "^7.34.
|
|
125
|
+
"eslint-plugin-react": "^7.34.3",
|
|
126
126
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
127
127
|
"eslint-plugin-storybook": "^0.8.0",
|
|
128
128
|
"eslint-plugin-testing-library": "^6.2.2",
|
|
@@ -132,31 +132,31 @@
|
|
|
132
132
|
"jest-expect-message": "^1.1.3",
|
|
133
133
|
"mkdirp": "^3.0.1",
|
|
134
134
|
"npm-run-all": "^4.1.5",
|
|
135
|
-
"postcss": "^8.4.
|
|
135
|
+
"postcss": "^8.4.39",
|
|
136
136
|
"postcss-loader": "^7.3.4",
|
|
137
137
|
"postcss-scss": "^4.0.9",
|
|
138
|
-
"prettier": "^3.2
|
|
138
|
+
"prettier": "^3.3.2",
|
|
139
139
|
"react": ">=18",
|
|
140
140
|
"react-app-polyfill": "^3.0.0",
|
|
141
|
-
"react-dom": "
|
|
142
|
-
"rollup": "^4.
|
|
141
|
+
"react-dom": "^18.3.1",
|
|
142
|
+
"rollup": "^4.18.0",
|
|
143
143
|
"rollup-plugin-copy": "^3.5.0",
|
|
144
144
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
145
145
|
"rollup-plugin-postcss": "^4.0.2",
|
|
146
146
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
147
|
-
"sass": "1.77.
|
|
147
|
+
"sass": "^1.77.6",
|
|
148
148
|
"sass-loader": "^14.2.1",
|
|
149
149
|
"semantic-release": "^22.0.12",
|
|
150
|
-
"storybook": "^8.1.
|
|
150
|
+
"storybook": "^8.1.11",
|
|
151
151
|
"storybook-css-modules-preset": "^1.1.1",
|
|
152
152
|
"style-loader": "^4.0.0",
|
|
153
|
-
"stylelint": "15.11.0",
|
|
153
|
+
"stylelint": "^15.11.0",
|
|
154
154
|
"stylelint-config-recommended-scss": "^13.1.0",
|
|
155
155
|
"stylelint-config-standard": "^34.0.0",
|
|
156
156
|
"stylelint-prettier": "^4.1.0",
|
|
157
157
|
"stylelint-scss": "^5.3.2",
|
|
158
|
-
"typescript": "^5.
|
|
159
|
-
"vite": "^5.2
|
|
158
|
+
"typescript": "^5.5.3",
|
|
159
|
+
"vite": "^5.3.2",
|
|
160
160
|
"vite-plugin-html": "^3.2.2",
|
|
161
161
|
"vite-tsconfig-paths": "^4.3.2"
|
|
162
162
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LuiIcon } from "@linzjs/lui";
|
|
1
2
|
import { useContext, useEffect, useState } from "react";
|
|
2
3
|
|
|
3
4
|
import { GridContext } from "../../contexts/GridContext";
|
|
@@ -17,11 +18,14 @@ export const GridFilterQuick = ({ quickFilterPlaceholder, defaultValue }: GridFi
|
|
|
17
18
|
|
|
18
19
|
return (
|
|
19
20
|
<div className="GridFilterQuick-container">
|
|
21
|
+
<div className="GridFilterQuick-icon">
|
|
22
|
+
<LuiIcon name={"ic_search"} alt={"Search"} size={"md"} />
|
|
23
|
+
</div>
|
|
20
24
|
<input
|
|
21
25
|
aria-label="Search"
|
|
22
26
|
className="GridFilterQuick-input"
|
|
23
27
|
type="text"
|
|
24
|
-
placeholder={quickFilterPlaceholder ?? "Search
|
|
28
|
+
placeholder={quickFilterPlaceholder ?? "Search"}
|
|
25
29
|
value={quickFilterValue}
|
|
26
30
|
onChange={(event) => {
|
|
27
31
|
setQuickFilterValue(event.target.value);
|
|
@@ -20,7 +20,7 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
|
|
|
20
20
|
const { modifyUpdating, checkUpdating } = useContext(GridUpdatingContext);
|
|
21
21
|
const [gridApi, setGridApi] = useState<GridApi>();
|
|
22
22
|
const [gridReady, setGridReady] = useState(false);
|
|
23
|
-
const [quickFilter,
|
|
23
|
+
const [quickFilter, _setQuickFilter] = useState("");
|
|
24
24
|
const [invisibleColumnIds, _setInvisibleColumnIds] = useState<string[]>();
|
|
25
25
|
const testId = useRef<string | undefined>();
|
|
26
26
|
const idsBeforeUpdate = useRef<number[]>([]);
|
|
@@ -28,6 +28,15 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
|
|
|
28
28
|
const [externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync] = useState(false);
|
|
29
29
|
const externalFilters = useRef<GridFilterExternal<TData>[]>([]);
|
|
30
30
|
|
|
31
|
+
const setQuickFilter = useCallback(
|
|
32
|
+
(filter: string) => {
|
|
33
|
+
// If we don't clear the focused cell focus switches back to grid when typing in the quick filter input
|
|
34
|
+
gridApi?.clearFocusedCell();
|
|
35
|
+
_setQuickFilter(filter);
|
|
36
|
+
},
|
|
37
|
+
[gridApi],
|
|
38
|
+
);
|
|
39
|
+
|
|
31
40
|
/**
|
|
32
41
|
* Make extra sure the GridCellFillerColId never gets added to invisibleColumnIds as it's dynamically determined
|
|
33
42
|
*/
|
|
@@ -630,7 +639,24 @@ export const GridContextProvider = <TData extends GridBaseRow>(props: PropsWithC
|
|
|
630
639
|
const onFilterChanged = useMemo(
|
|
631
640
|
() =>
|
|
632
641
|
debounce(() => {
|
|
633
|
-
|
|
642
|
+
// This is terrible, but there's no other way for me to check whether a filter has changed the grid
|
|
643
|
+
const getDisplayedRowsHash = () => {
|
|
644
|
+
const arr: any[] = [];
|
|
645
|
+
gridApi?.forEachNodeAfterFilter((rowNode) => {
|
|
646
|
+
arr.push(rowNode.id);
|
|
647
|
+
});
|
|
648
|
+
return arr.join("|");
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
if (gridApi) {
|
|
652
|
+
const hasFocusedCell = gridApi.getFocusedCell();
|
|
653
|
+
const preHash = hasFocusedCell && getDisplayedRowsHash();
|
|
654
|
+
gridApi.onFilterChanged();
|
|
655
|
+
const postHash = hasFocusedCell && getDisplayedRowsHash();
|
|
656
|
+
// Ag-grid has a bug where if a focused cell comes into view after a filter the filter loses focus
|
|
657
|
+
// So the focus is cleared to prevent this
|
|
658
|
+
preHash !== postHash && gridApi.clearFocusedCell();
|
|
659
|
+
}
|
|
634
660
|
}, 200),
|
|
635
661
|
[gridApi],
|
|
636
662
|
);
|
|
@@ -255,7 +255,14 @@ const GridReadOnlyTemplate: StoryFn<typeof Grid> = (props: GridProps) => {
|
|
|
255
255
|
);
|
|
256
256
|
};
|
|
257
257
|
|
|
258
|
-
|
|
258
|
+
type KeysOfType<TObject, TValue> = {
|
|
259
|
+
[K in keyof TObject]: TObject[K] extends TValue ? K : never;
|
|
260
|
+
}[keyof TObject];
|
|
261
|
+
|
|
262
|
+
const GridFilterLessThan = (props: {
|
|
263
|
+
field: KeysOfType<ITestRow, number | null | undefined>;
|
|
264
|
+
text: string;
|
|
265
|
+
}): ReactElement => {
|
|
259
266
|
const [value, setValue] = useState<number>();
|
|
260
267
|
|
|
261
268
|
const filter = useCallback(
|
package/src/styles/Grid.scss
CHANGED
|
@@ -54,15 +54,27 @@
|
|
|
54
54
|
flex: 1;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
.GridFilterQuick-icon {
|
|
58
|
+
position: absolute;
|
|
59
|
+
margin: 8px;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
fill: colors.$fuscous;
|
|
62
|
+
}
|
|
63
|
+
|
|
57
64
|
.GridFilterQuick-input {
|
|
58
65
|
width: 100%;
|
|
59
66
|
height: 40px;
|
|
60
67
|
min-height: 40px;
|
|
61
68
|
border: 0.06rem solid colors.$silver;
|
|
62
69
|
border-radius: 3px;
|
|
63
|
-
padding-left:
|
|
70
|
+
padding-left: 36px;
|
|
64
71
|
padding-right: 0.75rem;
|
|
65
72
|
font-family: "Open Sans", system-ui, sans-serif;
|
|
73
|
+
|
|
74
|
+
&::placeholder {
|
|
75
|
+
color: colors.$fuscous;
|
|
76
|
+
font-style: italic;
|
|
77
|
+
}
|
|
66
78
|
}
|
|
67
79
|
|
|
68
80
|
.Grid-popoverContainer {
|