@linzjs/step-ag-grid 13.1.0 → 13.1.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/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": "13.1.0",
5
+ "version": "13.1.1",
6
6
  "keywords": [
7
7
  "aggrid",
8
8
  "ag-grid",
@@ -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: params.rowSelection === "multiple" ? GridHeaderSelect : null,
182
+ headerComponent: rowSelection === "multiple" ? GridHeaderSelect : null,
183
183
  suppressHeaderKeyboardEvent: (e) => {
184
184
  if ((e.event.key === "Enter" || e.event.key === " ") && !e.event.repeat) {
185
- const selectedNodeCount = e.api.getSelectedRows().length;
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, params["data-testid"]);
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={params["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={params.rowSelection ?? "multiple"}
328
+ rowSelection={rowSelection}
330
329
  suppressBrowserResizeObserver={true}
331
330
  colResizeDefault={"shift"}
332
331
  onFirstDataRendered={sizeColumnsToFit}