@linzjs/step-ag-grid 22.2.4 → 22.3.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/README.md CHANGED
@@ -221,7 +221,6 @@ To exclude a column from CSV download add ```export: false``` to the GridCell de
221
221
 
222
222
  ## Writing tests
223
223
 
224
-
225
224
  The following testing calls can be imported from step-ag-grid:
226
225
 
227
226
  - findRow
@@ -1,9 +1,10 @@
1
1
  import { ReactElement } from "react";
2
2
  import { GridBaseRow } from "../Grid";
3
3
  import { CellEditorCommon } from "../GridCell";
4
- export interface GridPopoutEditDropDownSelectedItem<TData> {
4
+ export interface GridPopoutEditDropDownSelectedItem<TData extends GridBaseRow, TValue> {
5
5
  selectedRows: TData[];
6
- value: any;
6
+ selectedRowIds: TData["id"][];
7
+ value: TValue;
7
8
  subComponentValue?: any;
8
9
  }
9
10
  interface FinalSelectOption {
@@ -22,16 +23,16 @@ export declare const MenuHeaderItem: (title: string) => {
22
23
  value: string;
23
24
  };
24
25
  export type SelectOption = null | string | FinalSelectOption;
25
- export interface GridFormDropDownProps<TData extends GridBaseRow> extends CellEditorCommon {
26
+ export interface GridFormDropDownProps<TData extends GridBaseRow, TValue> extends CellEditorCommon {
26
27
  className?: "GridPopoverEditDropDown-containerSmall" | "GridPopoverEditDropDown-containerMedium" | "GridPopoverEditDropDown-containerLarge" | "GridPopoverEditDropDown-containerUnlimited" | "GridPopoverEditDropDown-containerAutoWidth" | string | undefined;
27
28
  filtered?: "local" | "reload";
28
29
  filterDefaultValue?: string;
29
30
  filterPlaceholder?: string;
30
31
  filterHelpText?: string;
31
32
  noOptionsMessage?: string;
32
- onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<TData>) => Promise<void>;
33
- onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<TData>) => Promise<void>;
33
+ onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<TData, TValue>) => Promise<void>;
34
+ onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<TData, TValue>) => Promise<void>;
34
35
  options: SelectOption[] | ((selectedRows: TData[], filter?: string) => Promise<SelectOption[] | undefined> | SelectOption[] | undefined) | undefined;
35
36
  }
36
- export declare const GridFormDropDown: <TData extends GridBaseRow>(props: GridFormDropDownProps<TData>) => import("react/jsx-runtime").JSX.Element;
37
+ export declare const GridFormDropDown: <TData extends GridBaseRow, TValue>(props: GridFormDropDownProps<TData, TValue>) => import("react/jsx-runtime").JSX.Element;
37
38
  export {};
@@ -2,11 +2,11 @@ import { ICellEditorParams } from "ag-grid-community";
2
2
  import { ColDefT } from "../GridCell";
3
3
  import { GenericCellColDef } from "../gridRender";
4
4
  import { GridBaseRow } from "../Grid";
5
- export interface GridButtonProps<TData> {
5
+ export interface GridButtonProps<TData extends GridBaseRow> {
6
6
  visible?: (cellEditorParams: ICellEditorParams) => boolean;
7
7
  onClick?: (props: {
8
8
  selectedRows: TData[];
9
- selectedRowIds: (string | number)[];
9
+ selectedRowIds: TData["id"][];
10
10
  }) => void;
11
11
  }
12
12
  export declare const GridButton: <TData extends GridBaseRow>(colDef: GenericCellColDef<TData, boolean>, editor: GridButtonProps<TData>) => ColDefT<TData>;
@@ -1,10 +1,10 @@
1
1
  import { CellEditorCommon, ColDefT } from "../GridCell";
2
2
  import { GenericCellColDef } from "../gridRender";
3
3
  import { GridBaseRow } from "../Grid";
4
- export interface GridEditBooleanEditorProps<TData> extends CellEditorCommon {
4
+ export interface GridEditBooleanEditorProps<TData extends GridBaseRow> extends CellEditorCommon {
5
5
  onClick: (props: {
6
6
  selectedRows: TData[];
7
- selectedRowIds: (string | number)[];
7
+ selectedRowIds: TData["id"][];
8
8
  checked: boolean;
9
9
  }) => Promise<boolean>;
10
10
  }
@@ -2,4 +2,4 @@ import { GridBaseRow } from "../Grid";
2
2
  import { ColDefT, GenericCellEditorProps } from "../GridCell";
3
3
  import { GridFormDropDownProps } from "../gridForm/GridFormDropDown";
4
4
  import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
5
- export declare const GridPopoverEditDropDown: <TData extends GridBaseRow, TValue = any>(colDef: GenericCellColDef<TData, TValue>, props: GenericCellEditorProps<GridFormDropDownProps<TData>>) => ColDefT<TData, TValue>;
5
+ export declare const GridPopoverEditDropDown: <TData extends GridBaseRow, TValue = any>(colDef: GenericCellColDef<TData, TValue>, props: GenericCellEditorProps<GridFormDropDownProps<TData, TValue>>) => ColDefT<TData, TValue>;
@@ -3350,11 +3350,11 @@ function styleInject(css, ref) {
3350
3350
  }
3351
3351
  }
3352
3352
 
3353
- var css_248z$2 = ".FormError-helpText{color:#6b6966;font-size:.75rem;font-weight:400}";
3353
+ var css_248z$2 = ".FormError{display:flex}.FormError-helpText{color:#6b6966;font-size:.75rem;font-weight:400}.FormError-text-icon{margin-right:4px;margin-top:4px}.FormError-error{align-items:center;color:#2a292c;font-size:14px;font-weight:600;padding-left:0}";
3354
3354
  styleInject(css_248z$2);
3355
3355
 
3356
3356
  const FormError = (props) => {
3357
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props.error && (jsxRuntime.jsx("span", { className: "LuiTextInput-error", style: { paddingLeft: 0 }, children: props.error })), props.helpText && !props.error && jsxRuntime.jsx("span", { className: "FormError-helpText", children: props.helpText })] }));
3357
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [props.error && (jsxRuntime.jsxs("div", { className: "FormError", children: [jsxRuntime.jsx(lui.LuiIcon, { alt: "error", name: "ic_error", className: "FormError-text-icon", size: "sm", status: "error" }), jsxRuntime.jsx("span", { className: "FormError-error", children: props.error })] })), props.helpText && !props.error && jsxRuntime.jsx("span", { className: "FormError-helpText", children: props.helpText })] }));
3358
3358
  };
3359
3359
 
3360
3360
  function escapeStringRegexp(string) {
@@ -3587,7 +3587,12 @@ const GridFormDropDown = (props) => {
3587
3587
  (subComponentValue !== undefined && subComponentInitialValue.current !== JSON.stringify(subComponentValue));
3588
3588
  if (hasChanged) {
3589
3589
  if (props.onSelectedItem) {
3590
- await props.onSelectedItem({ selectedRows, value, subComponentValue });
3590
+ await props.onSelectedItem({
3591
+ selectedRows,
3592
+ selectedRowIds: selectedRows.map((row) => row.id),
3593
+ value,
3594
+ subComponentValue,
3595
+ });
3591
3596
  }
3592
3597
  else {
3593
3598
  selectedRows.forEach((row) => (row[field] = value));
@@ -3653,7 +3658,7 @@ const GridFormDropDown = (props) => {
3653
3658
  if (selectedItem === null) {
3654
3659
  if (props.onSelectFilter) {
3655
3660
  const { onSelectFilter } = props;
3656
- await onSelectFilter({ selectedRows, value: filter });
3661
+ await onSelectFilter({ selectedRows, selectedRowIds: selectedRows.map((row) => row.id), value: filter });
3657
3662
  return true;
3658
3663
  }
3659
3664
  else {
@@ -3730,7 +3735,7 @@ const GridFormDropDown = (props) => {
3730
3735
  })] }) })] }));
3731
3736
  };
3732
3737
 
3733
- var css_248z$1 = ".LuiTextInput.GridLuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#beb9b4;line-height:48px;position:absolute;right:14px;top:0}";
3738
+ var css_248z$1 = ".LuiTextInput.GridLuiTextInput{margin-bottom:0}.LuiTextInput-formatted{color:#6b6966;line-height:48px;position:absolute;right:14px;top:0}";
3734
3739
  styleInject(css_248z$1);
3735
3740
 
3736
3741
  const TextInputFormatted = (props) => {