@etsoo/materialui 1.0.41 → 1.0.43
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/ComboBox.js +14 -15
- package/lib/DataSteps.js +6 -3
- package/package.json +4 -4
- package/src/ComboBox.tsx +11 -13
- package/src/DataSteps.tsx +5 -2
package/lib/ComboBox.js
CHANGED
|
@@ -24,7 +24,7 @@ export function ComboBox(props) {
|
|
|
24
24
|
React.useEffect(() => {
|
|
25
25
|
if (propertyWay && options != null)
|
|
26
26
|
setOptions(options);
|
|
27
|
-
}, [
|
|
27
|
+
}, [options, propertyWay]);
|
|
28
28
|
// Local default value
|
|
29
29
|
let localValue = idValue != null
|
|
30
30
|
? localOptions.find((o) => o[idField] === idValue)
|
|
@@ -75,21 +75,20 @@ export function ComboBox(props) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
// When value change
|
|
79
78
|
React.useEffect(() => {
|
|
80
|
-
if (loadData)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
}, [
|
|
79
|
+
if (propertyWay || loadData == null)
|
|
80
|
+
return;
|
|
81
|
+
loadData().then((result) => {
|
|
82
|
+
if (result == null || !isMounted.current)
|
|
83
|
+
return;
|
|
84
|
+
if (onLoadData)
|
|
85
|
+
onLoadData(result);
|
|
86
|
+
if (autoAddBlankItem) {
|
|
87
|
+
SharedUtils.addBlankItem(result, idField, labelField);
|
|
88
|
+
}
|
|
89
|
+
setOptions(result);
|
|
90
|
+
});
|
|
91
|
+
}, [propertyWay]);
|
|
93
92
|
React.useEffect(() => {
|
|
94
93
|
return () => {
|
|
95
94
|
isMounted.current = false;
|
package/lib/DataSteps.js
CHANGED
|
@@ -74,10 +74,13 @@ export function DataSteps(props) {
|
|
|
74
74
|
setLocalValue(valueFormatter(dataRef.current));
|
|
75
75
|
}
|
|
76
76
|
}, [jsonValue]);
|
|
77
|
-
return (React.createElement(TextField, { InputLabelProps: InputLabelProps, InputProps: {
|
|
78
|
-
onKeyDown:
|
|
77
|
+
return (React.createElement(TextField, { InputLabelProps: InputLabelProps, inputProps: { style: { cursor: 'pointer' } }, InputProps: {
|
|
78
|
+
onKeyDown: (event) => {
|
|
79
|
+
if (event.key === 'Tab')
|
|
80
|
+
return;
|
|
81
|
+
cancelInput(event);
|
|
82
|
+
},
|
|
79
83
|
onPaste: cancelInput,
|
|
80
|
-
sx: { cursor: 'pointer' },
|
|
81
84
|
endAdornment: (React.createElement(InputAdornment, { position: "end" },
|
|
82
85
|
React.createElement(IconButton, { edge: "end", size: "small" },
|
|
83
86
|
React.createElement(StartIcon, null))))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@etsoo/react": "^1.6.12",
|
|
57
57
|
"@etsoo/shared": "^1.1.59",
|
|
58
58
|
"@mui/icons-material": "^5.10.6",
|
|
59
|
-
"@mui/material": "^5.10.
|
|
59
|
+
"@mui/material": "^5.10.8",
|
|
60
60
|
"@types/pica": "^9.0.1",
|
|
61
61
|
"@types/pulltorefreshjs": "^0.1.5",
|
|
62
62
|
"@types/react": "^18.0.21",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"@testing-library/jest-dom": "^5.16.5",
|
|
84
84
|
"@testing-library/react": "^13.4.0",
|
|
85
85
|
"@types/jest": "^29.1.1",
|
|
86
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
87
|
-
"@typescript-eslint/parser": "^5.
|
|
86
|
+
"@typescript-eslint/eslint-plugin": "^5.39.0",
|
|
87
|
+
"@typescript-eslint/parser": "^5.39.0",
|
|
88
88
|
"eslint": "^8.24.0",
|
|
89
89
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
90
90
|
"eslint-plugin-import": "^2.26.0",
|
package/src/ComboBox.tsx
CHANGED
|
@@ -104,7 +104,7 @@ export function ComboBox<
|
|
|
104
104
|
const propertyWay = loadData == null;
|
|
105
105
|
React.useEffect(() => {
|
|
106
106
|
if (propertyWay && options != null) setOptions(options);
|
|
107
|
-
}, [
|
|
107
|
+
}, [options, propertyWay]);
|
|
108
108
|
|
|
109
109
|
// Local default value
|
|
110
110
|
let localValue =
|
|
@@ -168,19 +168,17 @@ export function ComboBox<
|
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
// When value change
|
|
172
171
|
React.useEffect(() => {
|
|
173
|
-
if (loadData)
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}, [localValue]);
|
|
172
|
+
if (propertyWay || loadData == null) return;
|
|
173
|
+
loadData().then((result) => {
|
|
174
|
+
if (result == null || !isMounted.current) return;
|
|
175
|
+
if (onLoadData) onLoadData(result);
|
|
176
|
+
if (autoAddBlankItem) {
|
|
177
|
+
SharedUtils.addBlankItem(result, idField, labelField);
|
|
178
|
+
}
|
|
179
|
+
setOptions(result);
|
|
180
|
+
});
|
|
181
|
+
}, [propertyWay]);
|
|
184
182
|
|
|
185
183
|
React.useEffect(() => {
|
|
186
184
|
return () => {
|
package/src/DataSteps.tsx
CHANGED
|
@@ -181,10 +181,13 @@ export function DataSteps<T extends object>(props: DataStepsProps<T>) {
|
|
|
181
181
|
return (
|
|
182
182
|
<TextField
|
|
183
183
|
InputLabelProps={InputLabelProps}
|
|
184
|
+
inputProps={{ style: { cursor: 'pointer' } }}
|
|
184
185
|
InputProps={{
|
|
185
|
-
onKeyDown:
|
|
186
|
+
onKeyDown: (event) => {
|
|
187
|
+
if (event.key === 'Tab') return;
|
|
188
|
+
cancelInput(event);
|
|
189
|
+
},
|
|
186
190
|
onPaste: cancelInput,
|
|
187
|
-
sx: { cursor: 'pointer' },
|
|
188
191
|
endAdornment: (
|
|
189
192
|
<InputAdornment position="end">
|
|
190
193
|
<IconButton edge="end" size="small">
|