@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.
@@ -26,4 +26,4 @@ export interface GridProps {
26
26
  /**
27
27
  * Wrapper for AgGrid to add commonly used functionality.
28
28
  */
29
- export declare const Grid: (params: GridProps) => JSX.Element;
29
+ export declare const Grid: ({ rowSelection, "data-testid": dataTestId, ...params }: GridProps) => JSX.Element;
@@ -495,12 +495,13 @@ var GridHeaderSelect = function (_a) {
495
495
  /**
496
496
  * Wrapper for AgGrid to add commonly used functionality.
497
497
  */
498
- var Grid = function (params) {
499
- var _a, _b, _c, _d;
500
- var _e = useContext(GridContext), gridReady = _e.gridReady, setApis = _e.setApis, prePopupOps = _e.prePopupOps, ensureRowVisible = _e.ensureRowVisible, selectRowsById = _e.selectRowsById, focusByRowById = _e.focusByRowById, ensureSelectedRowIsVisible = _e.ensureSelectedRowIsVisible, sizeColumnsToFit = _e.sizeColumnsToFit, externallySelectedItemsAreInSync = _e.externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync = _e.setExternallySelectedItemsAreInSync, isExternalFilterPresent = _e.isExternalFilterPresent, doesExternalFilterPass = _e.doesExternalFilterPass;
498
+ var Grid = function (_a) {
499
+ var _b, _c, _d;
500
+ var _e = _a.rowSelection, rowSelection = _e === void 0 ? "multiple" : _e, dataTestId = _a["data-testid"], params = __rest(_a, ["rowSelection", "data-testid"]);
501
+ var _f = useContext(GridContext), gridReady = _f.gridReady, setApis = _f.setApis, prePopupOps = _f.prePopupOps, ensureRowVisible = _f.ensureRowVisible, selectRowsById = _f.selectRowsById, focusByRowById = _f.focusByRowById, ensureSelectedRowIsVisible = _f.ensureSelectedRowIsVisible, sizeColumnsToFit = _f.sizeColumnsToFit, externallySelectedItemsAreInSync = _f.externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync = _f.setExternallySelectedItemsAreInSync, isExternalFilterPresent = _f.isExternalFilterPresent, doesExternalFilterPass = _f.doesExternalFilterPass;
501
502
  var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
502
503
  var lastSelectedIds = useRef([]);
503
- var _f = useState(false), staleGrid = _f[0], setStaleGrid = _f[1];
504
+ var _g = useState(false), staleGrid = _g[0], setStaleGrid = _g[1];
504
505
  var postSortRows = usePostSortRowsHook({ setStaleGrid: setStaleGrid });
505
506
  /**
506
507
  * On data load select the first row of the grid if required.
@@ -523,7 +524,7 @@ var Grid = function (params) {
523
524
  externallySelectedItemsAreInSync,
524
525
  focusByRowById,
525
526
  gridReady,
526
- params,
527
+ params.externalSelectedItems,
527
528
  params.autoSelectFirstRow,
528
529
  params.rowData,
529
530
  selectRowsById,
@@ -614,11 +615,10 @@ var Grid = function (params) {
614
615
  maxWidth: 42,
615
616
  suppressSizeToFit: true,
616
617
  checkboxSelection: true,
617
- headerComponent: params.rowSelection === "multiple" ? GridHeaderSelect : null,
618
+ headerComponent: rowSelection === "multiple" ? GridHeaderSelect : null,
618
619
  suppressHeaderKeyboardEvent: function (e) {
619
620
  if ((e.event.key === "Enter" || e.event.key === " ") && !e.event.repeat) {
620
- var selectedNodeCount = e.api.getSelectedRows().length;
621
- if (selectedNodeCount == 0) {
621
+ if (isEmpty(e.api.getSelectedRows())) {
622
622
  e.api.selectAllFiltered();
623
623
  }
624
624
  else {
@@ -634,15 +634,15 @@ var Grid = function (params) {
634
634
  }, [
635
635
  params.columnDefs,
636
636
  params.selectable,
637
- params.rowSelection,
638
637
  params.readOnly,
639
- (_a = params.defaultColDef) === null || _a === void 0 ? void 0 : _a.editable,
638
+ (_b = params.defaultColDef) === null || _b === void 0 ? void 0 : _b.editable,
639
+ rowSelection,
640
640
  clickSelectorCheckboxWhenContainingCellClicked,
641
641
  ]);
642
642
  var onGridReady = useCallback(function (event) {
643
- setApis(event.api, event.columnApi, params["data-testid"]);
643
+ setApis(event.api, event.columnApi, dataTestId);
644
644
  synchroniseExternallySelectedItemsToGrid();
645
- }, [setApis, synchroniseExternallySelectedItemsToGrid]);
645
+ }, [dataTestId, setApis, synchroniseExternallySelectedItemsToGrid]);
646
646
  var noRowsOverlayComponent = useCallback(function (event) {
647
647
  var _a, _b, _c;
648
648
  var hasData = ((_b = (_a = params.rowData) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
@@ -652,7 +652,7 @@ var Grid = function (params) {
652
652
  : !hasFilteredData
653
653
  ? "All rows have been filtered"
654
654
  : "" }));
655
- }, [params.noRowsOverlayText, (_b = params.rowData) === null || _b === void 0 ? void 0 : _b.length]);
655
+ }, [params.noRowsOverlayText, (_c = params.rowData) === null || _c === void 0 ? void 0 : _c.length]);
656
656
  var onModelUpdated = useCallback(function (event) {
657
657
  event.api.getDisplayedRowCount() === 0 ? event.api.showNoRowsOverlay() : event.api.hideOverlay();
658
658
  }, []);
@@ -716,7 +716,7 @@ var Grid = function (params) {
716
716
  sizeColumnsToFit();
717
717
  }
718
718
  }, [columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.length, sizeColumnsToFit]);
719
- return (jsx("div", __assign({ "data-testid": params["data-testid"], className: clsx("Grid-container", "ag-theme-alpine", staleGrid && "Grid-sortIsStale", gridReady && params.rowData && "Grid-ready") }, { children: jsx("div", __assign({ style: { flex: 1 } }, { children: jsx(AgGridReact, { animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: (_c = params.rowSelection) !== null && _c !== void 0 ? _c : "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_d = params.postSortRows) !== null && _d !== void 0 ? _d : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass }) })) })));
719
+ return (jsx("div", __assign({ "data-testid": dataTestId, className: clsx("Grid-container", "ag-theme-alpine", staleGrid && "Grid-sortIsStale", gridReady && params.rowData && "Grid-ready") }, { children: jsx("div", __assign({ style: { flex: 1 } }, { children: jsx(AgGridReact, { animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_d = params.postSortRows) !== null && _d !== void 0 ? _d : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass }) })) })));
720
720
  };
721
721
 
722
722
  var GridPopoverContext = createContext({