@etsoo/react 1.4.98 → 1.4.99
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/mu/ComboBox.js +3 -0
- package/lib/mu/SelectEx.js +12 -9
- package/package.json +2 -2
- package/src/mu/ComboBox.tsx +3 -0
- package/src/mu/SelectEx.tsx +11 -8
package/lib/mu/ComboBox.js
CHANGED
|
@@ -75,6 +75,7 @@ export function ComboBox(props) {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
+
// When value change
|
|
78
79
|
React.useEffect(() => {
|
|
79
80
|
if (loadData) {
|
|
80
81
|
loadData().then((result) => {
|
|
@@ -88,6 +89,8 @@ export function ComboBox(props) {
|
|
|
88
89
|
setOptions(result);
|
|
89
90
|
});
|
|
90
91
|
}
|
|
92
|
+
}, [localValue]);
|
|
93
|
+
React.useEffect(() => {
|
|
91
94
|
return () => {
|
|
92
95
|
isMounted.current = false;
|
|
93
96
|
};
|
package/lib/mu/SelectEx.js
CHANGED
|
@@ -81,16 +81,8 @@ export function SelectEx(props) {
|
|
|
81
81
|
};
|
|
82
82
|
// Refs
|
|
83
83
|
const divRef = React.useRef();
|
|
84
|
-
// When
|
|
84
|
+
// When value change
|
|
85
85
|
React.useEffect(() => {
|
|
86
|
-
var _a;
|
|
87
|
-
const input = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('input');
|
|
88
|
-
const inputChange = (event) => {
|
|
89
|
-
// Reset case
|
|
90
|
-
if (event.cancelable)
|
|
91
|
-
setValueState(multiple ? [] : '');
|
|
92
|
-
};
|
|
93
|
-
input === null || input === void 0 ? void 0 : input.addEventListener('change', inputChange);
|
|
94
86
|
if (loadData) {
|
|
95
87
|
loadData().then((result) => {
|
|
96
88
|
if (result == null || !isMounted.current)
|
|
@@ -103,6 +95,17 @@ export function SelectEx(props) {
|
|
|
103
95
|
setOptions(result);
|
|
104
96
|
});
|
|
105
97
|
}
|
|
98
|
+
}, [localValue]);
|
|
99
|
+
// When layout ready
|
|
100
|
+
React.useEffect(() => {
|
|
101
|
+
var _a;
|
|
102
|
+
const input = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('input');
|
|
103
|
+
const inputChange = (event) => {
|
|
104
|
+
// Reset case
|
|
105
|
+
if (event.cancelable)
|
|
106
|
+
setValueState(multiple ? [] : '');
|
|
107
|
+
};
|
|
108
|
+
input === null || input === void 0 ? void 0 : input.addEventListener('change', inputChange);
|
|
106
109
|
return () => {
|
|
107
110
|
isMounted.current = false;
|
|
108
111
|
input === null || input === void 0 ? void 0 : input.removeEventListener('change', inputChange);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.99",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
51
51
|
"@emotion/style": "^0.8.0",
|
|
52
52
|
"@emotion/styled": "^11.6.0",
|
|
53
|
-
"@etsoo/appscript": "^1.2.
|
|
53
|
+
"@etsoo/appscript": "^1.2.42",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.1",
|
|
55
55
|
"@etsoo/shared": "^1.1.11",
|
|
56
56
|
"@mui/icons-material": "^5.4.1",
|
package/src/mu/ComboBox.tsx
CHANGED
|
@@ -157,6 +157,7 @@ export function ComboBox<T extends {} = IdLabelDto>(props: ComboBoxProps<T>) {
|
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
|
|
160
|
+
// When value change
|
|
160
161
|
React.useEffect(() => {
|
|
161
162
|
if (loadData) {
|
|
162
163
|
loadData().then((result) => {
|
|
@@ -168,7 +169,9 @@ export function ComboBox<T extends {} = IdLabelDto>(props: ComboBoxProps<T>) {
|
|
|
168
169
|
setOptions(result);
|
|
169
170
|
});
|
|
170
171
|
}
|
|
172
|
+
}, [localValue]);
|
|
171
173
|
|
|
174
|
+
React.useEffect(() => {
|
|
172
175
|
return () => {
|
|
173
176
|
isMounted.current = false;
|
|
174
177
|
};
|
package/src/mu/SelectEx.tsx
CHANGED
|
@@ -165,15 +165,8 @@ export function SelectEx<T extends {} = IdLabelDto>(props: SelectExProps<T>) {
|
|
|
165
165
|
// Refs
|
|
166
166
|
const divRef = React.useRef<HTMLDivElement>();
|
|
167
167
|
|
|
168
|
-
// When
|
|
168
|
+
// When value change
|
|
169
169
|
React.useEffect(() => {
|
|
170
|
-
const input = divRef.current?.querySelector('input');
|
|
171
|
-
const inputChange = (event: Event) => {
|
|
172
|
-
// Reset case
|
|
173
|
-
if (event.cancelable) setValueState(multiple ? [] : '');
|
|
174
|
-
};
|
|
175
|
-
input?.addEventListener('change', inputChange);
|
|
176
|
-
|
|
177
170
|
if (loadData) {
|
|
178
171
|
loadData().then((result) => {
|
|
179
172
|
if (result == null || !isMounted.current) return;
|
|
@@ -184,6 +177,16 @@ export function SelectEx<T extends {} = IdLabelDto>(props: SelectExProps<T>) {
|
|
|
184
177
|
setOptions(result);
|
|
185
178
|
});
|
|
186
179
|
}
|
|
180
|
+
}, [localValue]);
|
|
181
|
+
|
|
182
|
+
// When layout ready
|
|
183
|
+
React.useEffect(() => {
|
|
184
|
+
const input = divRef.current?.querySelector('input');
|
|
185
|
+
const inputChange = (event: Event) => {
|
|
186
|
+
// Reset case
|
|
187
|
+
if (event.cancelable) setValueState(multiple ? [] : '');
|
|
188
|
+
};
|
|
189
|
+
input?.addEventListener('change', inputChange);
|
|
187
190
|
|
|
188
191
|
return () => {
|
|
189
192
|
isMounted.current = false;
|