@linzjs/step-ag-grid 14.8.0 → 14.9.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.
@@ -22,6 +22,7 @@ export interface GridProps {
22
22
  noRowsOverlayText?: string;
23
23
  postSortRows?: GridOptions["postSortRows"];
24
24
  animateRows?: boolean;
25
+ rowHeight?: number;
25
26
  rowClassRules?: GridOptions["rowClassRules"];
26
27
  rowSelection?: "single" | "multiple";
27
28
  autoSelectFirstRow?: boolean;
@@ -1,9 +1,9 @@
1
- /// <reference types="react" />
1
+ import { ReactElement } from "react";
2
2
  import { GridBaseRow } from "../Grid";
3
3
  import { CellEditorCommon } from "../GridCell";
4
4
  export interface MultiSelectGridOption {
5
5
  value: any;
6
- label?: string;
6
+ label?: string | ReactElement;
7
7
  checked?: boolean | "partial";
8
8
  canSelectPartial?: boolean;
9
9
  warning?: string | undefined;
@@ -21,4 +21,4 @@ export interface GridFormMultiSelectGridProps<RowType extends GridBaseRow> exten
21
21
  invalid?: (props: GridFormMultiSelectGridSaveProps<RowType>) => boolean;
22
22
  maxRowCount?: number;
23
23
  }
24
- export declare const GridFormMultiSelectGrid: <RowType extends GridBaseRow>(props: GridFormMultiSelectGridProps<RowType>) => JSX.Element;
24
+ export declare const GridFormMultiSelectGrid: <RowType extends GridBaseRow>(props: GridFormMultiSelectGridProps<RowType>) => ReactElement;
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { LuiMiniSpinner, LuiIcon, LuiButton, LuiCheckboxInput, LuiButtonGroup } from '@linzjs/lui';
3
3
  import { AgGridReact } from 'ag-grid-react';
4
- import { negate, isEmpty, xorBy, last, difference, defer as defer$1, omit, sortBy, findIndex, debounce as debounce$1, delay, partition, pick, groupBy, fromPairs, toPairs, sumBy, compact, remove, castArray, flatten, isEqual } from 'lodash-es';
4
+ import { negate, isEmpty, xorBy, last, difference, defer as defer$1, omit, sortBy, findIndex, debounce as debounce$1, delay, partition, pick, groupBy, fromPairs, toPairs, isEqual, sumBy, compact, remove, castArray, flatten } from 'lodash-es';
5
5
  import * as React from 'react';
6
6
  import { createContext, useContext, useEffect, useRef, useCallback, useState, useMemo, forwardRef, useLayoutEffect, memo, useReducer, cloneElement, useImperativeHandle, Fragment as Fragment$1 } from 'react';
7
7
  import ReactDOM, { unstable_batchedUpdates, flushSync, createPortal } from 'react-dom';
@@ -1002,7 +1002,7 @@ const Grid = ({ "data-testid": dataTestId, rowSelection = "multiple", suppressCo
1002
1002
  }
1003
1003
  }, []);
1004
1004
  setOnCellEditingComplete(params.onCellEditingComplete);
1005
- return (jsx("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, staleGrid && "Grid-sortIsStale", gridReady && params.rowData && "Grid-ready"), children: jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsx(AgGridReact, { animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: (params) => `${params.data.id}`, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, onGridSizeChanged: onGridSizeChanged, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: () => {
1005
+ return (jsx("div", { "data-testid": dataTestId, className: clsx("Grid-container", theme, staleGrid && "Grid-sortIsStale", gridReady && params.rowData && "Grid-ready"), children: jsx("div", { style: { flex: 1 }, ref: gridDivRef, children: jsx(AgGridReact, { rowHeight: params.rowHeight, animateRows: params.animateRows, rowClassRules: params.rowClassRules, getRowId: (params) => `${params.data.id}`, suppressRowClickSelection: true, rowSelection: rowSelection, suppressBrowserResizeObserver: true, onGridSizeChanged: onGridSizeChanged, suppressColumnVirtualisation: suppressColumnVirtualization, suppressClickEdit: true, onColumnVisible: () => {
1006
1006
  setInitialContentSize();
1007
1007
  }, onRowDataChanged: onRowDataChanged, onCellKeyPress: onCellKeyPress, onCellClicked: onCellClicked, onCellDoubleClicked: onCellDoubleClick, onCellEditingStarted: refreshSelectedRows, domLayout: params.domLayout, onColumnResized: onColumnResized, defaultColDef: { minWidth: 48, ...omit(params.defaultColDef, ["editable"]) }, columnDefs: columnDefsAdjusted, rowData: params.rowData, noRowsOverlayComponent: GridNoRowsOverlay, noRowsOverlayComponentParams: {
1008
1008
  rowData: params.rowData,
@@ -4039,8 +4039,9 @@ const GridFormMultiSelectGrid = (props) => {
4039
4039
  if (!options || !props.onSave)
4040
4040
  return true;
4041
4041
  // Any changes to save?
4042
- if (JSON.stringify(initialValues) === JSON.stringify(options))
4042
+ if (isEqual(initialValues?.map((o) => o.checked), options.map((o) => o.checked))) {
4043
4043
  return true;
4044
+ }
4044
4045
  if (!props.onSave)
4045
4046
  return true;
4046
4047
  return await props.onSave(genSave(selectedRows));
@@ -4062,7 +4063,7 @@ const GridFormMultiSelectGrid = (props) => {
4062
4063
  optionsInitialising.current = true;
4063
4064
  (async () => {
4064
4065
  const optionsList = typeof props.options === "function" ? await props.options(selectedRows) : props.options;
4065
- setInitialValues(JSON.parse(JSON.stringify(optionsList)));
4066
+ setInitialValues(optionsList.map((o) => ({ ...o, label: "" })));
4066
4067
  setOptions(optionsList);
4067
4068
  optionsInitialising.current = false;
4068
4069
  })();
@@ -4086,7 +4087,7 @@ const GridFormMultiSelectGrid = (props) => {
4086
4087
  e.keepOpen = true;
4087
4088
  toggleValue(o);
4088
4089
  }
4089
- }, children: jsx(LuiCheckboxInput, { isChecked: !!o.checked ?? false, isIndeterminate: o.checked === "partial", value: `${o.value}`, label: jsxs(Fragment, { children: [o.warning && jsx(GridIcon, { icon: "ic_warning_outline", title: o.warning }), jsx("span", { className: "GridMultiSelectGrid-Label", style: { fontWeight: o.label?.endsWith("0") ? "bold" : "regular" }, children: o.label ?? (o.value == null ? `<${o.value}>` : `${o.value}`) })] }), inputProps: {
4090
+ }, children: jsx(LuiCheckboxInput, { isChecked: !!o.checked ?? false, isIndeterminate: o.checked === "partial", value: `${o.value}`, label: jsxs(Fragment, { children: [o.warning && jsx(GridIcon, { icon: "ic_warning_outline", title: o.warning }), jsx("span", { className: "GridMultiSelectGrid-Label", children: o.label ?? (o.value == null ? `<${o.value}>` : `${o.value}`) })] }), inputProps: {
4090
4091
  onClick: (e) => {
4091
4092
  // Click is handled by MenuItem onClick
4092
4093
  e.preventDefault();
@@ -4094,7 +4095,7 @@ const GridFormMultiSelectGrid = (props) => {
4094
4095
  },
4095
4096
  }, onChange: () => {
4096
4097
  /*Do nothing, change handled by menuItem*/
4097
- } }) }, o.label) }))) }) }) }));
4098
+ } }) }, JSON.stringify(o.value)) }))) }) }) }));
4098
4099
  };
4099
4100
 
4100
4101
  /** Menu configuration types **/