@linzjs/step-ag-grid 7.1.1 → 7.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.
@@ -17,6 +17,8 @@ export interface GridProps {
17
17
  rowData: GridOptions["rowData"];
18
18
  noRowsOverlayText?: string;
19
19
  postSortRows?: GridOptions["postSortRows"];
20
+ animateRows?: boolean;
21
+ rowClassRules?: GridOptions["rowClassRules"];
20
22
  }
21
23
  /**
22
24
  * Wrapper for AgGrid to add commonly used functionality.
@@ -0,0 +1,2 @@
1
+ import { CellClassRules } from "ag-grid-community/dist/lib/entities/colDef";
2
+ export declare const GridCellMultiSelectClassRules: CellClassRules;
@@ -9,6 +9,7 @@ export interface MultiSelectOption {
9
9
  subValue?: any;
10
10
  filter?: string;
11
11
  checked?: boolean;
12
+ warning?: string | undefined;
12
13
  }
13
14
  export interface GridFormMultiSelectGroup {
14
15
  header: string;
@@ -12,7 +12,7 @@ export { Grid } from "./components/Grid";
12
12
  export * from "./components/GridCell";
13
13
  export { GridIcon } from "./components/GridIcon";
14
14
  export { ComponentLoadingWrapper } from "./components/ComponentLoadingWrapper";
15
- export { GenericMultiEditCellClass } from "./components/GenericCellClass";
15
+ export { GridCellMultiSelectClassRules } from "./components/GridCellMultiSelectClassRules";
16
16
  export { GridLoadableCell } from "./components/GridLoadableCell";
17
17
  export { useGridPopoverHook } from "./components/GridPopoverHook";
18
18
  export { usePostSortRowsHook } from "./components/PostSortRowsHook";
@@ -2804,20 +2804,17 @@ var Grid = function (params) {
2804
2804
  }, [columnDefs === null || columnDefs === void 0 ? void 0 : columnDefs.length, sizeColumnsToFit]);
2805
2805
  return (jsxs("div", __assign({ "data-testid": params.dataTestId, className: clsx("Grid-container", "ag-theme-alpine", staleGrid && "Grid-sortIsStale") }, { children: [params.quickFilter && (jsx("div", __assign({ className: "Grid-quickFilter" }, { children: jsx("input", { "aria-label": "Search", className: "lui-margin-top-xxs lui-margin-bottom-xxs Grid-quickFilterBox", type: "text", placeholder: (_a = params.quickFilterPlaceholder) !== null && _a !== void 0 ? _a : "Search...", value: internalQuickFilter, onChange: function (event) {
2806
2806
  setInternalQuickFilter(event.target.value);
2807
- } }) }))), jsx(AgGridReact, { getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, onCellEditingStopped: onCellEditingStopped, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_b = params.postSortRows) !== null && _b !== void 0 ? _b : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection })] })));
2807
+ } }) }))), jsx(AgGridReact, { animateRows: params.animateRows, rowClassRules: params.rowClassRules, defaultColDef: params.defaultColDef, getRowId: function (params) { return "".concat(params.data.id); }, suppressRowClickSelection: true, rowSelection: "multiple", suppressBrowserResizeObserver: true, colResizeDefault: "shift", onFirstDataRendered: sizeColumnsToFit, onGridSizeChanged: sizeColumnsToFit, suppressClickEdit: true, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, onCellEditingStopped: onCellEditingStopped, domLayout: params.domLayout, columnDefs: columnDefs, rowData: params.rowData, noRowsOverlayComponent: noRowsOverlayComponent, onGridReady: onGridReady, onSortChanged: ensureSelectedRowIsVisible, postSortRows: (_b = params.postSortRows) !== null && _b !== void 0 ? _b : postSortRows, onSelectionChanged: synchroniseExternalStateToGridSelection })] })));
2808
2808
  };
2809
2809
 
2810
- var GenericMultiEditCellClass = function (props) {
2811
- var api = props.api;
2812
- if (api == null)
2813
- return "";
2814
- var rowSelected = api
2815
- .getSelectedNodes()
2816
- .map(function (row) { return row.id; })
2817
- .includes(props.node.id);
2818
- return rowSelected && api.getEditingCells().some(function (cell) { return cell.column.getColDef() === props.colDef; })
2819
- ? "ag-selected-for-edit"
2820
- : "";
2810
+ var GridCellMultiSelectClassRules = {
2811
+ "ag-selected-for-edit": function (_a) {
2812
+ var api = _a.api, node = _a.node, colDef = _a.colDef;
2813
+ return api
2814
+ .getSelectedNodes()
2815
+ .map(function (row) { return row.id; })
2816
+ .includes(node.id) && api.getEditingCells().some(function (cell) { return cell.column.getColDef() === colDef; });
2817
+ }
2821
2818
  };
2822
2819
 
2823
2820
  function styleInject(css, ref) {
@@ -2895,7 +2892,7 @@ var GridCellRenderer = function (props) {
2895
2892
  var GridCell = function (props, custom) {
2896
2893
  var _a;
2897
2894
  return __assign(__assign(__assign(__assign(__assign(__assign({ colId: props.field, sortable: !!((props === null || props === void 0 ? void 0 : props.field) || (props === null || props === void 0 ? void 0 : props.valueGetter)), resizable: true }, ((custom === null || custom === void 0 ? void 0 : custom.editor) && {
2898
- cellClass: (custom === null || custom === void 0 ? void 0 : custom.multiEdit) ? GenericMultiEditCellClass : undefined,
2895
+ cellClassRules: GridCellMultiSelectClassRules,
2899
2896
  editable: (_a = props.editable) !== null && _a !== void 0 ? _a : true,
2900
2897
  cellEditor: GenericCellEditorComponentWrapper(custom)
2901
2898
  })), { suppressKeyboardEvent: function (e) {
@@ -3728,7 +3725,7 @@ var MenuRadioItem = function (props) {
3728
3725
  e.keepOpen = true;
3729
3726
  toggleValue(item);
3730
3727
  }
3731
- } }, { children: jsx(LuiCheckboxInput, { isChecked: (_a = item.checked) !== null && _a !== void 0 ? _a : false, value: "".concat(item.value), label: (_b = item.label) !== null && _b !== void 0 ? _b : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value)), inputProps: {
3728
+ } }, { children: jsx(LuiCheckboxInput, { isChecked: (_a = item.checked) !== null && _a !== void 0 ? _a : false, value: "".concat(item.value), label: jsxs(Fragment$1, { children: [item.warning && jsx(GridIcon, { icon: "ic_warning", title: item.warning }), (_b = item.label) !== null && _b !== void 0 ? _b : (item.value == null ? "<".concat(item.value, ">") : "".concat(item.value))] }), inputProps: {
3732
3729
  onClick: function (e) {
3733
3730
  // Click is handled by MenuItem onClick
3734
3731
  e.preventDefault();
@@ -3908,7 +3905,7 @@ var GridFormPopoverMenu = function (props) {
3908
3905
  * Popout burger menu
3909
3906
  */
3910
3907
  var GridPopoverMenu = function (colDef, custom) {
3911
- return GridCell(__assign(__assign({ maxWidth: 40, editable: colDef.editable != null ? colDef.editable : true, cellStyle: { justifyContent: "flex-end" }, cellRenderer: GridRenderPopoutMenuCell, cellClass: (custom === null || custom === void 0 ? void 0 : custom.multiEdit) ? GenericMultiEditCellClass : undefined }, colDef), { cellRendererParams: {
3908
+ return GridCell(__assign(__assign({ maxWidth: 40, editable: colDef.editable != null ? colDef.editable : true, cellStyle: { justifyContent: "center" }, cellRenderer: GridRenderPopoutMenuCell }, colDef), { cellRendererParams: {
3912
3909
  // Menus open on single click, this parameter is picked up in Grid.tsx
3913
3910
  singleClickEdit: true
3914
3911
  } }), __assign({ editor: GridFormPopoverMenu }, custom));
@@ -24615,5 +24612,5 @@ var clickActionButton = function (text, container) { return __awaiter(void 0, vo
24615
24612
  });
24616
24613
  }); };
24617
24614
 
24618
- export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, GenericMultiEditCellClass, Grid, GridCell, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, convertDDToDMS, deselectRow, editCell, findActionButton, findCell, findMenuOption, findMultiSelectOption, findRow, getMultiSelectOptions, hasParentClass, isFloat, isNotEmpty, openAndClickMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, typeOtherInput, typeOtherTextArea, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait$2 as wait };
24615
+ export { ActionButton, ComponentLoadingWrapper, ControlledMenu, FocusableItem, GenericCellEditorComponentWrapper, Grid, GridCell, GridCellMultiSelectClassRules, GridCellRenderer, GridContext, GridContextProvider, GridFormDropDown, GridFormMultiSelect, GridFormPopoverMenu, GridFormSubComponentTextArea, GridFormSubComponentTextInput, GridHeaderSelect, GridIcon, GridLoadableCell, GridPopoutEditMultiSelect, GridPopoverContext, GridPopoverContextProvider, GridPopoverEditBearing, GridPopoverEditBearingCorrection, GridPopoverEditDropDown, GridPopoverMenu, GridPopoverMessage, GridPopoverTextArea, GridPopoverTextInput, GridRenderPopoutMenuCell, GridRendererGenericCell, GridSubComponentContext, GridUpdatingContext, GridUpdatingContextProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuHeader, MenuHeaderItem, MenuHeaderString, MenuItem, MenuRadioGroup, MenuSeparator, MenuSeparatorString, PopoutMenuSeparator, SubMenu, TextAreaInput, TextInputFormatted, bearingCorrectionValueFormatter, bearingNumberParser, bearingStringValidator, bearingValueFormatter, clickActionButton, clickMenuOption, clickMultiSelectOption, closeMenu, convertDDToDMS, deselectRow, editCell, findActionButton, findCell, findMenuOption, findMultiSelectOption, findRow, getMultiSelectOptions, hasParentClass, isFloat, isNotEmpty, openAndClickMenuOption, queryMenuOption, queryRow, selectCell, selectRow, stringByteLengthIsInvalid, typeOtherInput, typeOtherTextArea, useGridPopoverContext, useGridPopoverHook, useMenuState, usePostSortRowsHook, wait$2 as wait };
24619
24616
  //# sourceMappingURL=step-ag-grid.esm.js.map