@etsoo/materialui 1.2.62 → 1.2.64
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/lib/HiSelector.js +5 -6
- package/lib/HiSelectorTL.js +6 -8
- package/lib/ListChooser.d.ts +4 -0
- package/lib/ListChooser.js +1 -1
- package/package.json +9 -9
- package/src/HiSelector.tsx +5 -6
- package/src/HiSelectorTL.tsx +6 -8
- package/src/ListChooser.tsx +7 -1
package/lib/HiSelector.js
CHANGED
|
@@ -17,7 +17,6 @@ export function HiSelector(props) {
|
|
|
17
17
|
const doChange = (event, index) => {
|
|
18
18
|
const value = event.target.value;
|
|
19
19
|
const itemValue = value === "" ? undefined : value;
|
|
20
|
-
updateValue(itemValue);
|
|
21
20
|
const newValues = [...localValues.slice(0, index)];
|
|
22
21
|
if (itemValue != null)
|
|
23
22
|
newValues.push(itemValue);
|
|
@@ -33,12 +32,12 @@ export function HiSelector(props) {
|
|
|
33
32
|
onItemChange(option, userAction);
|
|
34
33
|
};
|
|
35
34
|
React.useEffect(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
updateValue(values.at(-1));
|
|
39
|
-
}
|
|
40
|
-
}, [values]);
|
|
35
|
+
setValues(values);
|
|
36
|
+
}, [values.toString()]);
|
|
41
37
|
const currentValue = localValues.at(-1);
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
updateValue(currentValue);
|
|
40
|
+
}, [currentValue]);
|
|
42
41
|
return (React.createElement(React.Fragment, null,
|
|
43
42
|
label && (React.createElement(Grid, { item: true, xs: 12 },
|
|
44
43
|
React.createElement(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption } }, label))),
|
package/lib/HiSelectorTL.js
CHANGED
|
@@ -20,20 +20,18 @@ export function HiSelectorTL(props) {
|
|
|
20
20
|
if (event.isDefaultPrevented())
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
const itemValue = value ? value[idField] : undefined;
|
|
24
|
-
updateValue(itemValue);
|
|
25
23
|
const newValues = [...localValues.slice(0, index)];
|
|
26
|
-
if (
|
|
27
|
-
newValues.push(
|
|
24
|
+
if (value)
|
|
25
|
+
newValues.push(value[idField]);
|
|
28
26
|
setValues(newValues);
|
|
29
27
|
};
|
|
30
28
|
React.useEffect(() => {
|
|
31
|
-
|
|
32
|
-
setValues(values);
|
|
33
|
-
updateValue(values.at(-1));
|
|
34
|
-
}
|
|
29
|
+
setValues(values);
|
|
35
30
|
}, [values.toString()]);
|
|
36
31
|
const currentValue = localValues.at(-1);
|
|
32
|
+
React.useEffect(() => {
|
|
33
|
+
updateValue(currentValue);
|
|
34
|
+
}, [currentValue]);
|
|
37
35
|
return (React.createElement(React.Fragment, null,
|
|
38
36
|
label && (React.createElement(Grid, { item: true, xs: 12 },
|
|
39
37
|
React.createElement(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption } }, label))),
|
package/lib/ListChooser.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export interface ListChooserButtonProps<T extends object, D extends DataTypes.Ke
|
|
|
14
14
|
* List chooser props
|
|
15
15
|
*/
|
|
16
16
|
export type ListChooserProps<T extends object, D extends DataTypes.Keys<T>, Q extends object> = ListProps & {
|
|
17
|
+
/**
|
|
18
|
+
* Condition field name
|
|
19
|
+
*/
|
|
20
|
+
conditionField?: string;
|
|
17
21
|
/**
|
|
18
22
|
* Condition renderer
|
|
19
23
|
*/
|
package/lib/ListChooser.js
CHANGED
|
@@ -29,7 +29,7 @@ export function ListChooser(props) {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
// Destruct
|
|
32
|
-
const { conditionRenderer = (rq, delayed) => (React.createElement(TextField, { autoFocus: true, margin: "dense", name:
|
|
32
|
+
const { conditionField = "title", conditionRenderer = (rq, delayed) => (React.createElement(TextField, { autoFocus: true, margin: "dense", name: conditionField, label: title, fullWidth: true, variant: "standard", inputProps: { maxLength: 128 }, onChange: (event) => {
|
|
33
33
|
Reflect.set(rq, "title", event.target.value);
|
|
34
34
|
delayed.call();
|
|
35
35
|
} })), itemRenderer = (item, selectProps) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.64",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"@emotion/css": "^11.11.2",
|
|
51
51
|
"@emotion/react": "^11.11.1",
|
|
52
52
|
"@emotion/styled": "^11.11.0",
|
|
53
|
-
"@etsoo/appscript": "^1.4.
|
|
53
|
+
"@etsoo/appscript": "^1.4.22",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.25",
|
|
55
|
-
"@etsoo/react": "^1.6.
|
|
55
|
+
"@etsoo/react": "^1.6.95",
|
|
56
56
|
"@etsoo/shared": "^1.2.7",
|
|
57
57
|
"@mui/icons-material": "^5.11.16",
|
|
58
|
-
"@mui/material": "^5.13.
|
|
59
|
-
"@mui/x-data-grid": "^6.9.
|
|
58
|
+
"@mui/material": "^5.13.6",
|
|
59
|
+
"@mui/x-data-grid": "^6.9.1",
|
|
60
60
|
"@types/pica": "^9.0.1",
|
|
61
61
|
"@types/pulltorefreshjs": "^0.1.5",
|
|
62
|
-
"@types/react": "^18.2.
|
|
62
|
+
"@types/react": "^18.2.14",
|
|
63
63
|
"@types/react-avatar-editor": "^13.0.0",
|
|
64
64
|
"@types/react-dom": "^18.2.6",
|
|
65
65
|
"@types/react-input-mask": "^3.0.2",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"@testing-library/jest-dom": "^5.16.5",
|
|
86
86
|
"@testing-library/react": "^14.0.0",
|
|
87
87
|
"@types/jest": "^29.5.2",
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "^5.60.
|
|
89
|
-
"@typescript-eslint/parser": "^5.60.
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
89
|
+
"@typescript-eslint/parser": "^5.60.1",
|
|
90
90
|
"jest": "^29.5.0",
|
|
91
91
|
"jest-environment-jsdom": "^29.5.0",
|
|
92
|
-
"typescript": "^5.1.
|
|
92
|
+
"typescript": "^5.1.6"
|
|
93
93
|
}
|
|
94
94
|
}
|
package/src/HiSelector.tsx
CHANGED
|
@@ -126,7 +126,6 @@ export function HiSelector<
|
|
|
126
126
|
const doChange = (event: SelectChangeEvent<unknown>, index: number) => {
|
|
127
127
|
const value = event.target.value;
|
|
128
128
|
const itemValue = value === "" ? undefined : (value as T[D]);
|
|
129
|
-
updateValue(itemValue);
|
|
130
129
|
|
|
131
130
|
const newValues = [...localValues.slice(0, index)];
|
|
132
131
|
if (itemValue != null) newValues.push(itemValue);
|
|
@@ -143,13 +142,13 @@ export function HiSelector<
|
|
|
143
142
|
};
|
|
144
143
|
|
|
145
144
|
React.useEffect(() => {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
updateValue(values.at(-1));
|
|
149
|
-
}
|
|
150
|
-
}, [values]);
|
|
145
|
+
setValues(values);
|
|
146
|
+
}, [values.toString()]);
|
|
151
147
|
|
|
152
148
|
const currentValue = localValues.at(-1);
|
|
149
|
+
React.useEffect(() => {
|
|
150
|
+
updateValue(currentValue);
|
|
151
|
+
}, [currentValue]);
|
|
153
152
|
|
|
154
153
|
return (
|
|
155
154
|
<React.Fragment>
|
package/src/HiSelectorTL.tsx
CHANGED
|
@@ -130,22 +130,20 @@ export function HiSelectorTL<
|
|
|
130
130
|
if (event.isDefaultPrevented()) return;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
const itemValue = value ? value[idField] : undefined;
|
|
134
|
-
updateValue(itemValue);
|
|
135
|
-
|
|
136
133
|
const newValues = [...localValues.slice(0, index)];
|
|
137
|
-
if (
|
|
134
|
+
if (value) newValues.push(value[idField]);
|
|
135
|
+
|
|
138
136
|
setValues(newValues);
|
|
139
137
|
};
|
|
140
138
|
|
|
141
139
|
React.useEffect(() => {
|
|
142
|
-
|
|
143
|
-
setValues(values);
|
|
144
|
-
updateValue(values.at(-1));
|
|
145
|
-
}
|
|
140
|
+
setValues(values);
|
|
146
141
|
}, [values.toString()]);
|
|
147
142
|
|
|
148
143
|
const currentValue = localValues.at(-1);
|
|
144
|
+
React.useEffect(() => {
|
|
145
|
+
updateValue(currentValue);
|
|
146
|
+
}, [currentValue]);
|
|
149
147
|
|
|
150
148
|
return (
|
|
151
149
|
<React.Fragment>
|
package/src/ListChooser.tsx
CHANGED
|
@@ -35,6 +35,11 @@ export type ListChooserProps<
|
|
|
35
35
|
D extends DataTypes.Keys<T>,
|
|
36
36
|
Q extends object
|
|
37
37
|
> = ListProps & {
|
|
38
|
+
/**
|
|
39
|
+
* Condition field name
|
|
40
|
+
*/
|
|
41
|
+
conditionField?: string;
|
|
42
|
+
|
|
38
43
|
/**
|
|
39
44
|
* Condition renderer
|
|
40
45
|
*/
|
|
@@ -116,11 +121,12 @@ export function ListChooser<
|
|
|
116
121
|
|
|
117
122
|
// Destruct
|
|
118
123
|
const {
|
|
124
|
+
conditionField = "title",
|
|
119
125
|
conditionRenderer = (rq: Partial<Q>, delayed: DelayedExecutorType) => (
|
|
120
126
|
<TextField
|
|
121
127
|
autoFocus
|
|
122
128
|
margin="dense"
|
|
123
|
-
name=
|
|
129
|
+
name={conditionField}
|
|
124
130
|
label={title}
|
|
125
131
|
fullWidth
|
|
126
132
|
variant="standard"
|