@linzjs/step-ag-grid 2.3.1 → 2.4.1
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/index.js +95 -16
- package/dist/index.js.map +1 -1
- package/dist/src/components/GridSubComponentTextArea.d.ts +4 -4
- package/dist/src/components/gridForm/GridFormDropDown.d.ts +2 -0
- package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +7 -0
- package/dist/src/components/gridForm/GridFormTextArea.d.ts +1 -1
- package/dist/src/components/gridForm/GridFormTextInput.d.ts +1 -1
- package/dist/src/contexts/GridSubComponentContext.d.ts +8 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/step-ag-grid.esm.js +95 -17
- package/dist/step-ag-grid.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/GridSubComponentTextArea.tsx +22 -10
- package/src/components/gridForm/GridFormDropDown.tsx +55 -11
- package/src/components/gridForm/GridFormMultiSelect.tsx +19 -15
- package/src/components/gridForm/GridFormSubComponentTextInput.tsx +34 -0
- package/src/components/gridForm/GridFormTextArea.tsx +3 -3
- package/src/components/gridForm/GridFormTextInput.tsx +3 -3
- package/src/contexts/GridSubComponentContext.ts +21 -0
- package/src/index.ts +1 -0
- package/src/stories/components/ActionButton.stories.tsx +1 -1
- package/src/stories/grid/FormTest.tsx +5 -6
- package/src/stories/grid/GridPopoutBearing.stories.tsx +1 -1
- package/src/stories/grid/GridPopoutEditDropDown.stories.tsx +42 -1
- package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +1 -1
- package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +3 -3
- package/src/stories/grid/GridPopoutEditMultiSelect.stories.tsx +2 -2
- package/src/stories/grid/GridReadOnly.stories.tsx +1 -1
- package/dist/src/components/gridForm/GridSubComponentProps.d.ts +0 -6
- package/src/components/gridForm/GridSubComponentProps.ts +0 -6
package/package.json
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
import { useCallback, useEffect } from "react";
|
|
2
|
-
import { GridSubComponentProps } from "./gridForm/GridSubComponentProps";
|
|
1
|
+
import { useCallback, useContext, useEffect } from "react";
|
|
3
2
|
import { TextInputFormatted } from "../lui/TextInputFormatted";
|
|
3
|
+
import { GridSubComponentContext } from "../contexts/GridSubComponentContext";
|
|
4
4
|
|
|
5
|
-
export interface GridSubComponentTextAreaProps
|
|
5
|
+
export interface GridSubComponentTextAreaProps {
|
|
6
6
|
placeholder?: string;
|
|
7
7
|
required?: boolean;
|
|
8
|
-
|
|
8
|
+
maxLength?: number;
|
|
9
9
|
width?: string | number;
|
|
10
|
-
validate
|
|
10
|
+
validate?: (value: string) => string | null;
|
|
11
|
+
defaultValue: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export const GridSubComponentTextArea = (props: GridSubComponentTextAreaProps): JSX.Element => {
|
|
14
|
-
const { value, setValue, setValid, triggerSave } =
|
|
15
|
+
const { value, setValue, setValid, triggerSave } = useContext(GridSubComponentContext);
|
|
16
|
+
|
|
17
|
+
// If is not initialised yet as it's just been created then set the default value
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (value == null) setValue(props.defaultValue);
|
|
20
|
+
}, [props.defaultValue, setValue, value]);
|
|
21
|
+
|
|
15
22
|
const validate = useCallback(
|
|
16
|
-
(value: string) => {
|
|
23
|
+
(value: string | null) => {
|
|
24
|
+
if (value == null) return null;
|
|
25
|
+
// This can happen because subcomponent is invoked without type safety
|
|
26
|
+
if (typeof value !== "string") {
|
|
27
|
+
console.error("Value is not a string", value);
|
|
28
|
+
}
|
|
17
29
|
if (props.required && value.length === 0) {
|
|
18
30
|
return `Some text is required`;
|
|
19
31
|
}
|
|
20
|
-
if (props.
|
|
21
|
-
return `Text must be no longer than ${props.
|
|
32
|
+
if (props.maxLength && value.length > props.maxLength) {
|
|
33
|
+
return `Text must be no longer than ${props.maxLength} characters`;
|
|
22
34
|
}
|
|
23
35
|
if (props.validate) {
|
|
24
36
|
return props.validate(value);
|
|
@@ -29,7 +41,7 @@ export const GridSubComponentTextArea = (props: GridSubComponentTextAreaProps):
|
|
|
29
41
|
);
|
|
30
42
|
|
|
31
43
|
useEffect(() => {
|
|
32
|
-
setValid(validate(value) == null);
|
|
44
|
+
setValid(value != null && validate(value) == null);
|
|
33
45
|
}, [setValid, validate, value]);
|
|
34
46
|
|
|
35
47
|
return (
|
|
@@ -14,12 +14,14 @@ export interface GridPopoutEditDropDownSelectedItem<RowType, ValueType> {
|
|
|
14
14
|
// Note the row that was clicked on will be first
|
|
15
15
|
selectedRows: RowType[];
|
|
16
16
|
value: ValueType;
|
|
17
|
+
subComponentValue?: ValueType;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
interface FinalSelectOption<ValueType> {
|
|
20
21
|
value: ValueType;
|
|
21
22
|
label?: JSX.Element | string;
|
|
22
23
|
disabled?: boolean | string;
|
|
24
|
+
subComponent?: (props: any, ref: any) => any;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export const MenuSeparatorString = "_____MENU_SEPARATOR_____";
|
|
@@ -61,15 +63,16 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(
|
|
|
61
63
|
const [filteredValues, setFilteredValues] = useState<any[]>([]);
|
|
62
64
|
const optionsInitialising = useRef(false);
|
|
63
65
|
const [options, setOptions] = useState<FinalSelectOption<ValueType>[] | null>(null);
|
|
66
|
+
const [subComponentValues, setSubComponentValues] = useState<{ optionValue: any; subComponentValue: any }[]>([]);
|
|
64
67
|
|
|
65
68
|
const selectItemHandler = useCallback(
|
|
66
|
-
async (value: ValueType): Promise<boolean> => {
|
|
69
|
+
async (value: ValueType, subComponentValue?: ValueType): Promise<boolean> => {
|
|
67
70
|
const field = props.field;
|
|
68
71
|
return await updatingCells({ selectedRows: props.selectedRows, field }, async (selectedRows) => {
|
|
69
72
|
const hasChanged = selectedRows.some((row) => row[field as keyof RowType] !== value);
|
|
70
73
|
if (hasChanged) {
|
|
71
74
|
if (props.onSelectedItem) {
|
|
72
|
-
await props.onSelectedItem({ selectedRows, value });
|
|
75
|
+
await props.onSelectedItem({ selectedRows, value, subComponentValue });
|
|
73
76
|
} else {
|
|
74
77
|
selectedRows.forEach((row) => (row[field as keyof RowType] = value));
|
|
75
78
|
}
|
|
@@ -214,15 +217,56 @@ export const GridFormDropDown = <RowType extends GridBaseRow, ValueType>(
|
|
|
214
217
|
) : item.value === MenuHeaderString ? (
|
|
215
218
|
<MenuHeader>{item.label}</MenuHeader>
|
|
216
219
|
) : filteredValues.includes(item.value) ? null : (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
220
|
+
<>
|
|
221
|
+
{!item.subComponent ? (
|
|
222
|
+
<MenuItem
|
|
223
|
+
key={`${props.field}-${index}`}
|
|
224
|
+
disabled={!!item.disabled}
|
|
225
|
+
title={item.disabled && typeof item.disabled !== "boolean" ? item.disabled : ""}
|
|
226
|
+
value={item.value}
|
|
227
|
+
onClick={() => {
|
|
228
|
+
selectItemHandler(item.value);
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
{item.label ?? (item.value == null ? `<${item.value}>` : `${item.value}`)}
|
|
232
|
+
</MenuItem>
|
|
233
|
+
) : (
|
|
234
|
+
<FocusableItem className={"LuiDeprecatedForms"} key={`${props.field}-${index}_subcomponent`}>
|
|
235
|
+
{(ref: any) =>
|
|
236
|
+
item.subComponent &&
|
|
237
|
+
item.subComponent(
|
|
238
|
+
{
|
|
239
|
+
setValue: (value: any) => {
|
|
240
|
+
const localSubComponentValues = [...subComponentValues];
|
|
241
|
+
const subComponentValueIndex = localSubComponentValues.findIndex(
|
|
242
|
+
({ optionValue }) => optionValue === item.value,
|
|
243
|
+
);
|
|
244
|
+
if (subComponentValueIndex !== -1) {
|
|
245
|
+
localSubComponentValues[subComponentValueIndex].subComponentValue = value;
|
|
246
|
+
} else {
|
|
247
|
+
localSubComponentValues.push({
|
|
248
|
+
subComponentValue: value,
|
|
249
|
+
optionValue: item.value,
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
setSubComponentValues(localSubComponentValues);
|
|
253
|
+
},
|
|
254
|
+
keyDown: (key: string) => {
|
|
255
|
+
const subComponentItem = subComponentValues.find(
|
|
256
|
+
({ optionValue }) => optionValue === item.value,
|
|
257
|
+
);
|
|
258
|
+
if (key === "Enter" && subComponentItem) {
|
|
259
|
+
selectItemHandler(item.value, subComponentItem.subComponentValue);
|
|
260
|
+
ref.closeMenu();
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
ref,
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
</FocusableItem>
|
|
268
|
+
)}
|
|
269
|
+
</>
|
|
226
270
|
),
|
|
227
271
|
)}
|
|
228
272
|
</>
|
|
@@ -10,7 +10,7 @@ import { useGridPopoverHook } from "../GridPopoverHook";
|
|
|
10
10
|
import { MenuSeparatorString } from "./GridFormDropDown";
|
|
11
11
|
import { CellEditorCommon, CellParams } from "../GridCell";
|
|
12
12
|
import { ClickEvent } from "../../react-menu3/types";
|
|
13
|
-
import {
|
|
13
|
+
import { GridSubComponentContext } from "contexts/GridSubComponentContext";
|
|
14
14
|
|
|
15
15
|
interface MultiFinalSelectOption<ValueType> {
|
|
16
16
|
value: ValueType;
|
|
@@ -208,20 +208,24 @@ export const GridFormMultiSelect = <RowType extends GridBaseRow, ValueType>(
|
|
|
208
208
|
|
|
209
209
|
{selectedValues.includes(item.value) && item.subComponent && (
|
|
210
210
|
<FocusableItem className={"LuiDeprecatedForms"} key={`${item.value}_subcomponent`}>
|
|
211
|
-
{(
|
|
212
|
-
item.subComponent &&
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
211
|
+
{(_: any) =>
|
|
212
|
+
item.subComponent && (
|
|
213
|
+
<GridSubComponentContext.Provider
|
|
214
|
+
value={{
|
|
215
|
+
value: subSelectedValues[`${item.value}`],
|
|
216
|
+
setValue: (value: any) => {
|
|
217
|
+
subSelectedValues[`${item.value}`] = value;
|
|
218
|
+
setSubSelectedValues({ ...subSelectedValues });
|
|
219
|
+
},
|
|
220
|
+
setValid: (valid: boolean) => {
|
|
221
|
+
subComponentIsValid.current[`${item.value}`] = valid;
|
|
222
|
+
},
|
|
223
|
+
triggerSave,
|
|
224
|
+
}}
|
|
225
|
+
>
|
|
226
|
+
<item.subComponent />
|
|
227
|
+
</GridSubComponentContext.Provider>
|
|
228
|
+
)
|
|
225
229
|
}
|
|
226
230
|
</FocusableItem>
|
|
227
231
|
)}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { TextInputFormatted } from "../../lui/TextInputFormatted";
|
|
3
|
+
|
|
4
|
+
export interface GridFormSubComponentTextInput {
|
|
5
|
+
setValue: (value: string) => void;
|
|
6
|
+
keyDown: (key: string) => void;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const GridFormSubComponentTextInput = ({ keyDown, placeholder, setValue }: GridFormSubComponentTextInput) => {
|
|
11
|
+
const placeholderText = placeholder || "Other...";
|
|
12
|
+
const [inputValue, setInputValue] = useState("");
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<TextInputFormatted
|
|
16
|
+
value={inputValue}
|
|
17
|
+
onChange={(e) => {
|
|
18
|
+
const value = e.target.value;
|
|
19
|
+
setValue(value);
|
|
20
|
+
setInputValue(value);
|
|
21
|
+
}}
|
|
22
|
+
inputProps={{
|
|
23
|
+
onKeyDown: (k: any) => keyDown(k.key),
|
|
24
|
+
placeholder: placeholderText,
|
|
25
|
+
onMouseEnter: (e) => {
|
|
26
|
+
if (document.activeElement != e.currentTarget) {
|
|
27
|
+
e.currentTarget.focus();
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
</>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
@@ -7,7 +7,7 @@ import { CellEditorCommon, CellParams } from "../GridCell";
|
|
|
7
7
|
export interface GridFormTextAreaProps<RowType extends GridBaseRow> extends CellEditorCommon {
|
|
8
8
|
placeholder?: string;
|
|
9
9
|
required?: boolean;
|
|
10
|
-
|
|
10
|
+
maxLength?: number;
|
|
11
11
|
width?: string | number;
|
|
12
12
|
validate?: (value: string) => string | null;
|
|
13
13
|
onSave?: (selectedRows: RowType[], value: string) => Promise<boolean>;
|
|
@@ -21,8 +21,8 @@ export const GridFormTextArea = <RowType extends GridBaseRow>(_props: GridFormTe
|
|
|
21
21
|
if (props.required && value.length == 0) {
|
|
22
22
|
return `Some text is required`;
|
|
23
23
|
}
|
|
24
|
-
if (props.
|
|
25
|
-
return `Text must be no longer than ${props.
|
|
24
|
+
if (props.maxLength && value.length > props.maxLength) {
|
|
25
|
+
return `Text must be no longer than ${props.maxLength} characters`;
|
|
26
26
|
}
|
|
27
27
|
if (props.validate) {
|
|
28
28
|
return props.validate(value);
|
|
@@ -8,7 +8,7 @@ export interface GridFormTextInputProps<RowType extends GridBaseRow> extends Cel
|
|
|
8
8
|
placeholder?: string;
|
|
9
9
|
units?: string;
|
|
10
10
|
required?: boolean;
|
|
11
|
-
|
|
11
|
+
maxLength?: number;
|
|
12
12
|
width?: string | number;
|
|
13
13
|
// Return null for ok, otherwise an error string
|
|
14
14
|
validate?: (value: string, data: RowType) => string | null;
|
|
@@ -25,8 +25,8 @@ export const GridFormTextInput = <RowType extends GridBaseRow>(_props: GridFormT
|
|
|
25
25
|
if (props.required && trimmedValue.length == 0) {
|
|
26
26
|
return `Some text is required`;
|
|
27
27
|
}
|
|
28
|
-
if (props.
|
|
29
|
-
return `Text must be no longer than ${props.
|
|
28
|
+
if (props.maxLength && trimmedValue.length > props.maxLength) {
|
|
29
|
+
return `Text must be no longer than ${props.maxLength} characters`;
|
|
30
30
|
}
|
|
31
31
|
if (props.validate) {
|
|
32
32
|
return props.validate(trimmedValue, props.data);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
|
|
3
|
+
export interface GridSubComponentContextType {
|
|
4
|
+
value: any;
|
|
5
|
+
setValue: (value: string) => void;
|
|
6
|
+
setValid: (valid: boolean) => void;
|
|
7
|
+
triggerSave: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const GridSubComponentContext = createContext<GridSubComponentContextType>({
|
|
11
|
+
value: "GridSubComponentContext value no context",
|
|
12
|
+
setValue: () => {
|
|
13
|
+
console.error("GridSubComponentContext setValue no context");
|
|
14
|
+
},
|
|
15
|
+
setValid: () => {
|
|
16
|
+
console.error("GridSubComponentContext setValid no context");
|
|
17
|
+
},
|
|
18
|
+
triggerSave: async () => {
|
|
19
|
+
console.error("GridSubComponentContext triggerSave no context");
|
|
20
|
+
},
|
|
21
|
+
});
|
package/src/index.ts
CHANGED
|
@@ -27,6 +27,7 @@ export { GridPopoverEditDropDown } from "./components/gridPopoverEdit/GridPopove
|
|
|
27
27
|
export { GridPopoverMessage } from "./components/gridPopoverEdit/GridPopoverMessage";
|
|
28
28
|
export { GridPopoverTextArea } from "./components/gridPopoverEdit/GridPopoverTextArea";
|
|
29
29
|
export { GridPopoverTextInput } from "./components/gridPopoverEdit/GridPopoverTextInput";
|
|
30
|
+
export { GridFormSubComponentTextInput } from "./components/gridForm/GridFormSubComponentTextInput";
|
|
30
31
|
export * from "./components/gridForm/GridFormDropDown";
|
|
31
32
|
export * from "./components/gridForm/GridFormMultiSelect";
|
|
32
33
|
export * from "./components/gridForm/GridFormPopoutMenu";
|
|
@@ -7,7 +7,7 @@ import { useCallback, useState } from "react";
|
|
|
7
7
|
import { wait } from "../../utils/util";
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
title: "Components /
|
|
10
|
+
title: "Components / ActionButton",
|
|
11
11
|
component: ActionButton,
|
|
12
12
|
args: {},
|
|
13
13
|
} as ComponentMeta<typeof ActionButton>;
|
|
@@ -18,23 +18,22 @@ export interface IFormTestRow {
|
|
|
18
18
|
|
|
19
19
|
export const FormTest = <RowType extends GridBaseRow>(_props: CellEditorCommon): JSX.Element => {
|
|
20
20
|
const props = _props as CellParams<RowType>;
|
|
21
|
-
const [v1, v2
|
|
21
|
+
const [v1, ...v2] = props.value.split(" ");
|
|
22
22
|
|
|
23
23
|
const [nameType, setNameType] = useState(v1);
|
|
24
|
-
const [numba, setNumba] = useState(v2);
|
|
25
|
-
const [plan, setPlan] = useState(v3.join(" "));
|
|
24
|
+
const [numba, setNumba] = useState(v2.join(" "));
|
|
26
25
|
|
|
27
26
|
const save = useCallback(async (): Promise<boolean> => {
|
|
28
27
|
// eslint-disable-next-line no-console
|
|
29
|
-
console.log("onSave", props.selectedRows, nameType, numba
|
|
28
|
+
console.log("onSave", props.selectedRows, nameType, numba);
|
|
30
29
|
|
|
31
30
|
// @ts-ignore
|
|
32
|
-
props.selectedRows.forEach((row) => (row["name"] = [nameType, numba
|
|
31
|
+
props.selectedRows.forEach((row) => (row["name"] = [nameType, numba].join(" ")));
|
|
33
32
|
await wait(1000);
|
|
34
33
|
|
|
35
34
|
// Close form
|
|
36
35
|
return true;
|
|
37
|
-
}, [nameType, numba,
|
|
36
|
+
}, [nameType, numba, props.selectedRows]);
|
|
38
37
|
|
|
39
38
|
const [showModal, setShowModal] = useState<boolean>(false);
|
|
40
39
|
|
|
@@ -83,7 +83,7 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
|
|
|
83
83
|
[],
|
|
84
84
|
);
|
|
85
85
|
|
|
86
|
-
const [rowData
|
|
86
|
+
const [rowData] = useState([
|
|
87
87
|
{ id: 1000, bearing1: 1.234, bearingCorrection: 90 },
|
|
88
88
|
{ id: 1001, bearing1: 1.565, bearingCorrection: 240 },
|
|
89
89
|
{ id: 1002, bearing1: null, bearingCorrection: 355.1 },
|
|
@@ -12,6 +12,7 @@ import { MenuHeaderItem, MenuSeparator, MenuSeparatorString } from "../../compon
|
|
|
12
12
|
import { wait } from "../../utils/util";
|
|
13
13
|
import { ColDefT, GridCell } from "../../components/GridCell";
|
|
14
14
|
import { GridPopoverEditDropDown } from "../../components/gridPopoverEdit/GridPopoverEditDropDown";
|
|
15
|
+
import { GridFormSubComponentTextInput } from "../../components/gridForm/GridFormSubComponentTextInput";
|
|
15
16
|
|
|
16
17
|
export default {
|
|
17
18
|
title: "Components / Grids",
|
|
@@ -40,6 +41,7 @@ interface ITestRow {
|
|
|
40
41
|
position3: string | null;
|
|
41
42
|
position4: ICode | null;
|
|
42
43
|
code: string | null;
|
|
44
|
+
sub: string | null;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
interface ICode {
|
|
@@ -241,11 +243,48 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
241
243
|
},
|
|
242
244
|
},
|
|
243
245
|
),
|
|
246
|
+
GridPopoverEditDropDown(
|
|
247
|
+
{
|
|
248
|
+
field: "sub",
|
|
249
|
+
initialWidth: 65,
|
|
250
|
+
maxWidth: 150,
|
|
251
|
+
headerName: "Subcomponent",
|
|
252
|
+
valueGetter: (params) => params.data.sub,
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
multiEdit: true,
|
|
256
|
+
editorParams: {
|
|
257
|
+
filtered: "local",
|
|
258
|
+
filterPlaceholder: "Filter this",
|
|
259
|
+
options: [
|
|
260
|
+
{
|
|
261
|
+
value: "one",
|
|
262
|
+
label: "One",
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
value: "two",
|
|
266
|
+
label: "Two",
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
value: "oth",
|
|
270
|
+
label: "Other",
|
|
271
|
+
subComponent: (props) => (
|
|
272
|
+
<GridFormSubComponentTextInput {...props} placeholder={"Subcomponent value"} />
|
|
273
|
+
),
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
onSelectedItem: async (selected) => {
|
|
277
|
+
// eslint-disable-next-line no-console
|
|
278
|
+
console.log("onSelectedItem", selected);
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
),
|
|
244
283
|
],
|
|
245
284
|
[optionsFn, optionsObjects],
|
|
246
285
|
);
|
|
247
286
|
|
|
248
|
-
const [rowData
|
|
287
|
+
const [rowData] = useState([
|
|
249
288
|
{
|
|
250
289
|
id: 1000,
|
|
251
290
|
position: "Tester",
|
|
@@ -253,6 +292,7 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
253
292
|
position3: "Tester",
|
|
254
293
|
position4: { code: "O1", desc: "Object One" },
|
|
255
294
|
code: "O1",
|
|
295
|
+
sub: "two",
|
|
256
296
|
},
|
|
257
297
|
{
|
|
258
298
|
id: 1001,
|
|
@@ -261,6 +301,7 @@ const GridEditDropDownTemplate: ComponentStory<typeof Grid> = (props: GridProps)
|
|
|
261
301
|
position3: "Developer",
|
|
262
302
|
position4: { code: "O2", desc: "Object Two" },
|
|
263
303
|
code: "O2",
|
|
304
|
+
sub: "one",
|
|
264
305
|
},
|
|
265
306
|
] as ITestRow[]);
|
|
266
307
|
|
|
@@ -57,7 +57,7 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
|
|
|
57
57
|
[],
|
|
58
58
|
);
|
|
59
59
|
|
|
60
|
-
const [rowData
|
|
60
|
+
const [rowData] = useState([
|
|
61
61
|
{ id: 1000, name: "IS IS DP12345", nameType: "IS", numba: "IX", plan: "DP 12345" },
|
|
62
62
|
{ id: 1001, name: "PEG V SD523", nameType: "PEG", numba: "V", plan: "SD 523" },
|
|
63
63
|
] as IFormTestRow[]);
|
|
@@ -61,7 +61,7 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
|
|
|
61
61
|
multiEdit: true,
|
|
62
62
|
editorParams: {
|
|
63
63
|
required: true,
|
|
64
|
-
|
|
64
|
+
maxLength: 12,
|
|
65
65
|
placeholder: "Enter some text...",
|
|
66
66
|
validate: (value: string) => {
|
|
67
67
|
if (value === "never") return "The value 'never' is not allowed";
|
|
@@ -88,7 +88,7 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
|
|
|
88
88
|
{
|
|
89
89
|
multiEdit: true,
|
|
90
90
|
editorParams: {
|
|
91
|
-
|
|
91
|
+
maxLength: 12,
|
|
92
92
|
placeholder: "Enter distance...",
|
|
93
93
|
units: "m",
|
|
94
94
|
validate: (value: string) => {
|
|
@@ -115,7 +115,7 @@ const GridPopoutEditGenericTemplate: ComponentStory<typeof Grid> = (props: GridP
|
|
|
115
115
|
multiEdit: true,
|
|
116
116
|
editorParams: {
|
|
117
117
|
required: true,
|
|
118
|
-
|
|
118
|
+
maxLength: 32,
|
|
119
119
|
placeholder: "Enter some text...",
|
|
120
120
|
|
|
121
121
|
validate: (value: string) => {
|
|
@@ -80,7 +80,7 @@ const GridEditMultiSelectTemplate: ComponentStory<typeof Grid> = (props: GridPro
|
|
|
80
80
|
{
|
|
81
81
|
value: "other",
|
|
82
82
|
label: "Other",
|
|
83
|
-
subComponent: (
|
|
83
|
+
subComponent: () => <GridSubComponentTextArea maxLength={2} defaultValue={""} />,
|
|
84
84
|
},
|
|
85
85
|
],
|
|
86
86
|
initialSelectedValues: () => ({
|
|
@@ -128,7 +128,7 @@ const GridEditMultiSelectTemplate: ComponentStory<typeof Grid> = (props: GridPro
|
|
|
128
128
|
];
|
|
129
129
|
}, []);
|
|
130
130
|
|
|
131
|
-
const [rowData
|
|
131
|
+
const [rowData] = useState([
|
|
132
132
|
{ id: 1000, position: "Tester", position2: "1", position3: "Tester" },
|
|
133
133
|
{ id: 1001, position: "Developer", position2: "2", position3: "Developer" },
|
|
134
134
|
] as ITestRow[]);
|
|
@@ -151,7 +151,7 @@ const GridReadOnlyTemplate: ComponentStory<typeof Grid> = (props: GridProps) =>
|
|
|
151
151
|
[],
|
|
152
152
|
);
|
|
153
153
|
|
|
154
|
-
const [rowData
|
|
154
|
+
const [rowData] = useState([
|
|
155
155
|
{ id: 1000, position: "Tester", age: 30, desc: "Tests application", dd: "1" },
|
|
156
156
|
{ id: 1001, position: "Developer", age: 12, desc: "Develops application", dd: "2" },
|
|
157
157
|
]);
|