@linzjs/step-ag-grid 13.1.2 → 13.1.3

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.
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const GridNoRowsOverlay: (params: {
3
+ rowData: any[] | null | undefined;
4
+ noRowsOverlayText: string | undefined;
5
+ }) => JSX.Element;
@@ -8,6 +8,7 @@ export * from "./gridForm";
8
8
  export * from "./gridHeader";
9
9
  export * from "./GridIcon";
10
10
  export * from "./GridLoadableCell";
11
+ export * from "./GridNoRowsOverlay";
11
12
  export * from "./gridPopoverEdit";
12
13
  export * from "./GridPopoverHook";
13
14
  export * from "./gridRender";
@@ -295,6 +295,13 @@ var stringByteLengthIsInvalid = function (str, maxBytes) {
295
295
  };
296
296
  var fnOrVar = function (fn, param) { return (typeof fn === "function" ? fn(param) : fn); };
297
297
 
298
+ var GridNoRowsOverlay = function (params) {
299
+ var _a;
300
+ return (jsx("span", { children: isEmpty(params.rowData)
301
+ ? (_a = params.noRowsOverlayText) !== null && _a !== void 0 ? _a : "There are currently no rows"
302
+ : "All rows have been filtered" }));
303
+ };
304
+
298
305
  /**
299
306
  * Retains last sort order from via <AgGrid postRowSort>.
300
307
  * Then applies this sort until next sort column change.
@@ -496,12 +503,12 @@ var GridHeaderSelect = function (_a) {
496
503
  * Wrapper for AgGrid to add commonly used functionality.
497
504
  */
498
505
  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;
506
+ var _b, _c;
507
+ var _d = _a.rowSelection, rowSelection = _d === void 0 ? "multiple" : _d, dataTestId = _a["data-testid"], params = __rest(_a, ["rowSelection", "data-testid"]);
508
+ 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;
502
509
  var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
503
510
  var lastSelectedIds = useRef([]);
504
- var _g = useState(false), staleGrid = _g[0], setStaleGrid = _g[1];
511
+ var _f = useState(false), staleGrid = _f[0], setStaleGrid = _f[1];
505
512
  var postSortRows = usePostSortRowsHook({ setStaleGrid: setStaleGrid });
506
513
  /**
507
514
  * On data load select the first row of the grid if required.
@@ -643,16 +650,6 @@ var Grid = function (_a) {
643
650
  setApis(event.api, event.columnApi, dataTestId);
644
651
  synchroniseExternallySelectedItemsToGrid();
645
652
  }, [dataTestId, setApis, synchroniseExternallySelectedItemsToGrid]);
646
- var noRowsOverlayComponent = useCallback(function (event) {
647
- var _a, _b, _c;
648
- var hasData = ((_b = (_a = params.rowData) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
649
- var hasFilteredData = event.api.getDisplayedRowCount() > 0;
650
- return (jsx("span", { children: !hasData
651
- ? (_c = params.noRowsOverlayText) !== null && _c !== void 0 ? _c : "There are currently no rows"
652
- : !hasFilteredData
653
- ? "All rows have been filtered"
654
- : "" }));
655
- }, [params.noRowsOverlayText, (_c = params.rowData) === null || _c === void 0 ? void 0 : _c.length]);
656
653
  var onModelUpdated = useCallback(function (event) {
657
654
  event.api.getDisplayedRowCount() === 0 ? event.api.showNoRowsOverlay() : event.api.hideOverlay();
658
655
  }, []);
@@ -716,7 +713,7 @@ var Grid = function (_a) {
716
713
  sizeColumnsToFit();
717
714
  }
718
715
  }, [columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.length, sizeColumnsToFit]);
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 }) })) })));
716
+ 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: GridNoRowsOverlay, noRowsOverlayComponentParams: { rowData: params.rowData, noRowsOverlayText: params.noRowsOverlayText }, onModelUpdated: onModelUpdated, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_c = params.postSortRows) !== null && _c !== void 0 ? _c : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection, onColumnMoved: params.onColumnMoved, alwaysShowVerticalScroll: params.alwaysShowVerticalScroll, isExternalFilterPresent: isExternalFilterPresent, doesExternalFilterPass: doesExternalFilterPass }) })) })));
720
717
  };
721
718
 
722
719
  var GridPopoverContext = createContext({
@@ -25003,5 +25000,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
25003
25000
  });
25004
25001
  }); };
25005
25002
 
25006
- export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
25003
+ export { ActionButton, ComponentLoadingWrapper, ControlledMenu, Editor, FocusableItem, FormError, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiEditor, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFilterButtons, GridFilterColumnsToggle, GridFilterHeaderIconButton, GridFilterQuick, GridFilters, GridFormDropDown, GridFormEditBearing, GridFormMessage, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridFormTextArea, GridFormTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridNoRowsOverlay, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditBearingCorrectionEditorParams, GridPopoverEditBearingEditorParams, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, GridWrapper, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionRangeValidator, bearingCorrectionValueFormatter, bearingNumberParser, bearingRangeValidator, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, closePopover, convertDDToDMS, countRows, deselectRow, editCell, findActionButton, findCell, findCellContains, findMenuOption, findMultiSelectOption, findOpenPopover, findParentWithClass, findRow, fnOrVar, generateFilterGetter, getMultiSelectOptions, hasParentClass, isCellReadOnly, isFloat, isNotEmpty, openAndClickMenuOption, openAndFindMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, suppressCellKeyboardEvents, typeInputByLabel, typeInputByPlaceholder, typeOnlyInput, typeOtherInput, typeOtherTextArea, useDeferredPromise, useGenerateOrDefaultId, useGridContext, useGridFilter, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, validateMenuOptions, wait$2 as wait };
25007
25004
  //# sourceMappingURL=step-ag-grid.esm.js.map