@linzjs/step-ag-grid 13.1.0 → 13.1.2
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
package/src/components/Grid.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export interface GridProps {
|
|
|
40
40
|
/**
|
|
41
41
|
* Wrapper for AgGrid to add commonly used functionality.
|
|
42
42
|
*/
|
|
43
|
-
export const Grid = (params: GridProps): JSX.Element => {
|
|
43
|
+
export const Grid = ({ rowSelection = "multiple", "data-testid": dataTestId, ...params }: GridProps): JSX.Element => {
|
|
44
44
|
const {
|
|
45
45
|
gridReady,
|
|
46
46
|
setApis,
|
|
@@ -80,7 +80,7 @@ export const Grid = (params: GridProps): JSX.Element => {
|
|
|
80
80
|
externallySelectedItemsAreInSync,
|
|
81
81
|
focusByRowById,
|
|
82
82
|
gridReady,
|
|
83
|
-
params,
|
|
83
|
+
params.externalSelectedItems,
|
|
84
84
|
params.autoSelectFirstRow,
|
|
85
85
|
params.rowData,
|
|
86
86
|
selectRowsById,
|
|
@@ -179,11 +179,10 @@ export const Grid = (params: GridProps): JSX.Element => {
|
|
|
179
179
|
maxWidth: 42,
|
|
180
180
|
suppressSizeToFit: true,
|
|
181
181
|
checkboxSelection: true,
|
|
182
|
-
headerComponent:
|
|
182
|
+
headerComponent: rowSelection === "multiple" ? GridHeaderSelect : null,
|
|
183
183
|
suppressHeaderKeyboardEvent: (e) => {
|
|
184
184
|
if ((e.event.key === "Enter" || e.event.key === " ") && !e.event.repeat) {
|
|
185
|
-
|
|
186
|
-
if (selectedNodeCount == 0) {
|
|
185
|
+
if (isEmpty(e.api.getSelectedRows())) {
|
|
187
186
|
e.api.selectAllFiltered();
|
|
188
187
|
} else {
|
|
189
188
|
e.api.deselectAll();
|
|
@@ -200,18 +199,18 @@ export const Grid = (params: GridProps): JSX.Element => {
|
|
|
200
199
|
}, [
|
|
201
200
|
params.columnDefs,
|
|
202
201
|
params.selectable,
|
|
203
|
-
params.rowSelection,
|
|
204
202
|
params.readOnly,
|
|
205
203
|
params.defaultColDef?.editable,
|
|
204
|
+
rowSelection,
|
|
206
205
|
clickSelectorCheckboxWhenContainingCellClicked,
|
|
207
206
|
]);
|
|
208
207
|
|
|
209
208
|
const onGridReady = useCallback(
|
|
210
209
|
(event: GridReadyEvent) => {
|
|
211
|
-
setApis(event.api, event.columnApi,
|
|
210
|
+
setApis(event.api, event.columnApi, dataTestId);
|
|
212
211
|
synchroniseExternallySelectedItemsToGrid();
|
|
213
212
|
},
|
|
214
|
-
[setApis, synchroniseExternallySelectedItemsToGrid],
|
|
213
|
+
[dataTestId, setApis, synchroniseExternallySelectedItemsToGrid],
|
|
215
214
|
);
|
|
216
215
|
|
|
217
216
|
const noRowsOverlayComponent = useCallback(
|
|
@@ -312,7 +311,7 @@ export const Grid = (params: GridProps): JSX.Element => {
|
|
|
312
311
|
|
|
313
312
|
return (
|
|
314
313
|
<div
|
|
315
|
-
data-testid={
|
|
314
|
+
data-testid={dataTestId}
|
|
316
315
|
className={clsx(
|
|
317
316
|
"Grid-container",
|
|
318
317
|
"ag-theme-alpine",
|
|
@@ -326,7 +325,7 @@ export const Grid = (params: GridProps): JSX.Element => {
|
|
|
326
325
|
rowClassRules={params.rowClassRules}
|
|
327
326
|
getRowId={(params) => `${params.data.id}`}
|
|
328
327
|
suppressRowClickSelection={true}
|
|
329
|
-
rowSelection={
|
|
328
|
+
rowSelection={rowSelection}
|
|
330
329
|
suppressBrowserResizeObserver={true}
|
|
331
330
|
colResizeDefault={"shift"}
|
|
332
331
|
onFirstDataRendered={sizeColumnsToFit}
|
|
@@ -92,7 +92,7 @@ export const GridFilterColumnsToggle = ({ saveState = true }: GridFilterColumnsT
|
|
|
92
92
|
.map((col) => (
|
|
93
93
|
<MenuItem
|
|
94
94
|
key={col.colId}
|
|
95
|
-
disabled={col
|
|
95
|
+
disabled={isNonManageableColumn(col)}
|
|
96
96
|
onClick={(e: ClickEvent) => {
|
|
97
97
|
// Global react-menu MenuItem handler handles tabs
|
|
98
98
|
if (e.key !== "Tab") {
|