@linzjs/step-ag-grid 13.1.2 → 13.2.0
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/src/components/Grid.d.ts +4 -1
- package/dist/src/components/GridNoRowsOverlay.d.ts +5 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +13 -16
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Grid.tsx +16 -22
- package/src/components/GridNoRowsOverlay.tsx +12 -0
- package/src/components/index.ts +1 -0
- package/src/stories/grid/GridNoRowsOverlay.stories.tsx +36 -0
- package/src/stories/grid/{GridKeyboardInteractions.stories.tsx → interactions/GridKeyboardInteractions.stories.tsx} +3 -3
|
@@ -22,8 +22,11 @@ export interface GridProps {
|
|
|
22
22
|
autoSelectFirstRow?: boolean;
|
|
23
23
|
onColumnMoved?: GridOptions["onColumnMoved"];
|
|
24
24
|
alwaysShowVerticalScroll?: boolean;
|
|
25
|
+
onGridSizeChanged: GridOptions["onGridSizeChanged"];
|
|
26
|
+
onFirstDataRendered: GridOptions["onFirstDataRendered"];
|
|
27
|
+
suppressColumnVirtualization: GridOptions["suppressColumnVirtualisation"];
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
* Wrapper for AgGrid to add commonly used functionality.
|
|
28
31
|
*/
|
|
29
|
-
export declare const Grid: ({
|
|
32
|
+
export declare const Grid: ({ "data-testid": dataTestId, rowSelection, suppressColumnVirtualization, ...params }: GridProps) => 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";
|
package/dist/step-ag-grid.esm.js
CHANGED
|
@@ -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
|
|
501
|
-
var
|
|
506
|
+
var _b, _c, _d, _e;
|
|
507
|
+
var dataTestId = _a["data-testid"], _f = _a.rowSelection, rowSelection = _f === void 0 ? "multiple" : _f, _g = _a.suppressColumnVirtualization, suppressColumnVirtualization = _g === void 0 ? true : _g, params = __rest(_a, ["data-testid", "rowSelection", "suppressColumnVirtualization"]);
|
|
508
|
+
var _h = useContext(GridContext), gridReady = _h.gridReady, setApis = _h.setApis, prePopupOps = _h.prePopupOps, ensureRowVisible = _h.ensureRowVisible, selectRowsById = _h.selectRowsById, focusByRowById = _h.focusByRowById, ensureSelectedRowIsVisible = _h.ensureSelectedRowIsVisible, sizeColumnsToFit = _h.sizeColumnsToFit, externallySelectedItemsAreInSync = _h.externallySelectedItemsAreInSync, setExternallySelectedItemsAreInSync = _h.setExternallySelectedItemsAreInSync, isExternalFilterPresent = _h.isExternalFilterPresent, doesExternalFilterPass = _h.doesExternalFilterPass;
|
|
502
509
|
var checkUpdating = useContext(GridUpdatingContext).checkUpdating;
|
|
503
510
|
var lastSelectedIds = useRef([]);
|
|
504
|
-
var
|
|
511
|
+
var _j = useState(false), staleGrid = _j[0], setStaleGrid = _j[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:
|
|
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: (_c = params.onFirstDataRendered) !== null && _c !== void 0 ? _c : sizeColumnsToFit, onGridSizeChanged: (_d = params.onGridSizeChanged) !== null && _d !== void 0 ? _d : sizeColumnsToFit, suppressColumnVirtualisation: suppressColumnVirtualization, 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: (_e = params.postSortRows) !== null && _e !== void 0 ? _e : 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
|