@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 +0 -1
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +7 -6
- package/dist/src/components/gridPopoverEdit/GridButton.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridEditBoolean.d.ts +2 -2
- package/dist/src/components/gridPopoverEdit/GridPopoverEditDropDown.d.ts +1 -1
- package/dist/step-ag-grid.cjs.js +10 -5
- package/dist/step-ag-grid.cjs.js.map +1 -1
- package/dist/step-ag-grid.esm.js +10 -5
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/gridForm/GridFormDropDown.tsx +14 -8
- package/src/components/gridPopoverEdit/GridButton.tsx +3 -3
- package/src/components/gridPopoverEdit/GridEditBoolean.tsx +2 -6
- package/src/components/gridPopoverEdit/GridPopoverEditDropDown.ts +3 -3
- package/src/lui/FormError.scss +22 -4
- package/src/lui/FormError.tsx +5 -3
- package/src/lui/TextInputFormatted.scss +3 -1
package/package.json
CHANGED
|
@@ -14,10 +14,11 @@ import { GridBaseRow } from "../Grid";
|
|
|
14
14
|
import { CellEditorCommon } from "../GridCell";
|
|
15
15
|
import { useGridPopoverHook } from "../GridPopoverHook";
|
|
16
16
|
|
|
17
|
-
export interface GridPopoutEditDropDownSelectedItem<TData> {
|
|
17
|
+
export interface GridPopoutEditDropDownSelectedItem<TData extends GridBaseRow, TValue> {
|
|
18
18
|
// Note the row that was clicked on will be first
|
|
19
19
|
selectedRows: TData[];
|
|
20
|
-
|
|
20
|
+
selectedRowIds: TData["id"][];
|
|
21
|
+
value: TValue;
|
|
21
22
|
subComponentValue?: any;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -38,7 +39,7 @@ export const MenuHeaderItem = (title: string) => {
|
|
|
38
39
|
|
|
39
40
|
export type SelectOption = null | string | FinalSelectOption;
|
|
40
41
|
|
|
41
|
-
export interface GridFormDropDownProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
42
|
+
export interface GridFormDropDownProps<TData extends GridBaseRow, TValue> extends CellEditorCommon {
|
|
42
43
|
// This overrides CellEditorCommon to provide some common class options
|
|
43
44
|
className?:
|
|
44
45
|
| "GridPopoverEditDropDown-containerSmall"
|
|
@@ -54,8 +55,8 @@ export interface GridFormDropDownProps<TData extends GridBaseRow> extends CellEd
|
|
|
54
55
|
filterPlaceholder?: string;
|
|
55
56
|
filterHelpText?: string;
|
|
56
57
|
noOptionsMessage?: string;
|
|
57
|
-
onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<TData>) => Promise<void>;
|
|
58
|
-
onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<TData>) => Promise<void>;
|
|
58
|
+
onSelectedItem?: (props: GridPopoutEditDropDownSelectedItem<TData, TValue>) => Promise<void>;
|
|
59
|
+
onSelectFilter?: (props: GridPopoutEditDropDownSelectedItem<TData, TValue>) => Promise<void>;
|
|
59
60
|
options:
|
|
60
61
|
| SelectOption[]
|
|
61
62
|
| ((selectedRows: TData[], filter?: string) => Promise<SelectOption[] | undefined> | SelectOption[] | undefined)
|
|
@@ -66,7 +67,7 @@ const fieldToString = (field: any) => {
|
|
|
66
67
|
return typeof field == "symbol" ? field.toString() : `${field}`;
|
|
67
68
|
};
|
|
68
69
|
|
|
69
|
-
export const GridFormDropDown = <TData extends GridBaseRow>(props: GridFormDropDownProps<TData>) => {
|
|
70
|
+
export const GridFormDropDown = <TData extends GridBaseRow, TValue>(props: GridFormDropDownProps<TData, TValue>) => {
|
|
70
71
|
const { selectedRows, field, data } = useGridPopoverContext<TData>();
|
|
71
72
|
|
|
72
73
|
// Save triggers during async action processing which triggers another selectItem(), this ref blocks that
|
|
@@ -86,7 +87,12 @@ export const GridFormDropDown = <TData extends GridBaseRow>(props: GridFormDropD
|
|
|
86
87
|
(subComponentValue !== undefined && subComponentInitialValue.current !== JSON.stringify(subComponentValue));
|
|
87
88
|
if (hasChanged) {
|
|
88
89
|
if (props.onSelectedItem) {
|
|
89
|
-
await props.onSelectedItem({
|
|
90
|
+
await props.onSelectedItem({
|
|
91
|
+
selectedRows,
|
|
92
|
+
selectedRowIds: selectedRows.map((row) => row.id),
|
|
93
|
+
value,
|
|
94
|
+
subComponentValue,
|
|
95
|
+
});
|
|
90
96
|
} else {
|
|
91
97
|
selectedRows.forEach((row) => (row[field] = value as any));
|
|
92
98
|
}
|
|
@@ -167,7 +173,7 @@ export const GridFormDropDown = <TData extends GridBaseRow>(props: GridFormDropD
|
|
|
167
173
|
if (selectedItem === null) {
|
|
168
174
|
if (props.onSelectFilter) {
|
|
169
175
|
const { onSelectFilter } = props;
|
|
170
|
-
await onSelectFilter({ selectedRows, value: filter });
|
|
176
|
+
await onSelectFilter({ selectedRows, selectedRowIds: selectedRows.map((row) => row.id), value: filter as any });
|
|
171
177
|
return true;
|
|
172
178
|
} else {
|
|
173
179
|
if (filteredValues && filteredValues.length === 1) {
|
|
@@ -5,7 +5,7 @@ import { GridBaseRow } from "../Grid";
|
|
|
5
5
|
import { LuiButton, LuiIcon } from "@linzjs/lui";
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
7
|
|
|
8
|
-
const ButtonCellRenderer = (props: SAICellRendererParams) => {
|
|
8
|
+
const ButtonCellRenderer = <TData extends GridBaseRow>(props: SAICellRendererParams<TData>) => {
|
|
9
9
|
const { data, node, column, colDef, api } = props;
|
|
10
10
|
const inputRef = useRef<HTMLButtonElement>(null);
|
|
11
11
|
|
|
@@ -39,9 +39,9 @@ const ButtonCellRenderer = (props: SAICellRendererParams) => {
|
|
|
39
39
|
);
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
export interface GridButtonProps<TData> {
|
|
42
|
+
export interface GridButtonProps<TData extends GridBaseRow> {
|
|
43
43
|
visible?: (cellEditorParams: ICellEditorParams) => boolean;
|
|
44
|
-
onClick?: (props: { selectedRows: TData[]; selectedRowIds:
|
|
44
|
+
onClick?: (props: { selectedRows: TData[]; selectedRowIds: TData["id"][] }) => void;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
export const GridButton = <TData extends GridBaseRow>(
|
|
@@ -65,12 +65,8 @@ const BooleanCellRenderer = (props: CustomCellEditorProps) => {
|
|
|
65
65
|
);
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
export interface GridEditBooleanEditorProps<TData> extends CellEditorCommon {
|
|
69
|
-
onClick: (props: {
|
|
70
|
-
selectedRows: TData[];
|
|
71
|
-
selectedRowIds: (string | number)[];
|
|
72
|
-
checked: boolean;
|
|
73
|
-
}) => Promise<boolean>;
|
|
68
|
+
export interface GridEditBooleanEditorProps<TData extends GridBaseRow> extends CellEditorCommon {
|
|
69
|
+
onClick: (props: { selectedRows: TData[]; selectedRowIds: TData["id"][]; checked: boolean }) => Promise<boolean>;
|
|
74
70
|
}
|
|
75
71
|
|
|
76
72
|
export const GridEditBoolean = <TData extends GridBaseRow>(
|
|
@@ -6,13 +6,13 @@ import { GenericCellColDef } from "../gridRender/GridRenderGenericCell";
|
|
|
6
6
|
|
|
7
7
|
export const GridPopoverEditDropDown = <TData extends GridBaseRow, TValue = any>(
|
|
8
8
|
colDef: GenericCellColDef<TData, TValue>,
|
|
9
|
-
props: GenericCellEditorProps<GridFormDropDownProps<TData>>,
|
|
9
|
+
props: GenericCellEditorProps<GridFormDropDownProps<TData, TValue>>,
|
|
10
10
|
): ColDefT<TData, TValue> =>
|
|
11
|
-
GridCell<TData, TValue, GridFormDropDownProps<TData>>(colDef, {
|
|
11
|
+
GridCell<TData, TValue, GridFormDropDownProps<TData, TValue>>(colDef, {
|
|
12
12
|
editor: GridFormDropDown,
|
|
13
13
|
...props,
|
|
14
14
|
editorParams: {
|
|
15
|
-
...(props.editorParams as GridFormDropDownProps<TData>),
|
|
15
|
+
...(props.editorParams as GridFormDropDownProps<TData, TValue>),
|
|
16
16
|
className: clsx(
|
|
17
17
|
{
|
|
18
18
|
"GridPopoverEditDropDown-containerLarge": !props.editorParams?.className?.includes(
|
package/src/lui/FormError.scss
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
@use "../../node_modules/@linzjs/lui/dist/scss/Foundation/Variables/ColorVars" as colors;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
|
|
4
|
+
.FormError {
|
|
5
|
+
display: flex;
|
|
6
|
+
|
|
7
|
+
&-helpText {
|
|
8
|
+
font-size: 0.75rem;
|
|
9
|
+
color: colors.$fuscous;
|
|
10
|
+
font-weight: 400;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&-text-icon {
|
|
14
|
+
margin-top: 4px;
|
|
15
|
+
margin-right: 4px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&-error {
|
|
19
|
+
padding-left: 0;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
font-weight: 600;
|
|
22
|
+
color: colors.$charcoal;
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
7
25
|
}
|
package/src/lui/FormError.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./FormError.scss";
|
|
2
2
|
|
|
3
3
|
import { ReactElement } from "react";
|
|
4
|
+
import { LuiIcon } from "@linzjs/lui";
|
|
4
5
|
|
|
5
6
|
export interface FormErrorProps {
|
|
6
7
|
helpText?: string;
|
|
@@ -11,9 +12,10 @@ export const FormError = (props: FormErrorProps) => {
|
|
|
11
12
|
return (
|
|
12
13
|
<>
|
|
13
14
|
{props.error && (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
<div className="FormError">
|
|
16
|
+
<LuiIcon alt="error" name="ic_error" className="FormError-text-icon" size="sm" status="error" />
|
|
17
|
+
<span className="FormError-error">{props.error}</span>
|
|
18
|
+
</div>
|
|
17
19
|
)}
|
|
18
20
|
|
|
19
21
|
{props.helpText && !props.error && <span className={"FormError-helpText"}>{props.helpText}</span>}
|