@etsoo/react 1.4.95 → 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/app/ReactApp.js +5 -3
- package/lib/mu/BridgeCloseButton.d.ts +1 -1
- package/lib/mu/BridgeCloseButton.js +2 -2
- package/lib/mu/ComboBox.js +3 -0
- package/lib/mu/SelectEx.js +12 -9
- package/package.json +3 -3
- package/src/app/ReactApp.ts +4 -0
- package/src/mu/BridgeCloseButton.tsx +3 -3
- package/src/mu/ComboBox.tsx +3 -0
- package/src/mu/SelectEx.tsx +11 -8
package/lib/app/ReactApp.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionResultError, CoreApp, createClient } from '@etsoo/appscript';
|
|
1
|
+
import { ActionResultError, BridgeUtils, CoreApp, createClient } from '@etsoo/appscript';
|
|
2
2
|
import { WindowStorage } from '@etsoo/shared';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { NotifierMU } from '../mu/NotifierMU';
|
|
@@ -110,7 +110,7 @@ export class ReactApp extends CoreApp {
|
|
|
110
110
|
* @param culture New culture definition
|
|
111
111
|
*/
|
|
112
112
|
changeCulture(culture) {
|
|
113
|
-
var _a;
|
|
113
|
+
var _a, _b;
|
|
114
114
|
// Super call to update cultrue
|
|
115
115
|
super.changeCulture(culture);
|
|
116
116
|
// Update component labels
|
|
@@ -126,8 +126,10 @@ export class ReactApp extends CoreApp {
|
|
|
126
126
|
promptOK: 'ok'
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
|
+
// Notify host
|
|
130
|
+
(_a = BridgeUtils.host) === null || _a === void 0 ? void 0 : _a.changeCulture(culture.name);
|
|
129
131
|
// Document title
|
|
130
|
-
document.title = (
|
|
132
|
+
document.title = (_b = this.get(this.name)) !== null && _b !== void 0 ? _b : this.name;
|
|
131
133
|
}
|
|
132
134
|
/**
|
|
133
135
|
* Change culture extended
|
|
@@ -26,8 +26,8 @@ export function BridgeCloseButton(props) {
|
|
|
26
26
|
};
|
|
27
27
|
return (React.createElement(IconButton, { "aria-label": "close", color: "primary", onClick: onClickLocal, sx: {
|
|
28
28
|
position: 'absolute',
|
|
29
|
-
top: (theme) => theme.spacing(
|
|
30
|
-
right: (theme) => theme.spacing(
|
|
29
|
+
top: (theme) => theme.spacing(0.5),
|
|
30
|
+
right: (theme) => theme.spacing(0.5)
|
|
31
31
|
}, ...rest },
|
|
32
32
|
React.createElement(CloseIcon, null)));
|
|
33
33
|
}
|
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",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"react-beautiful-dnd": "^13.1.0",
|
|
73
73
|
"react-dom": "^17.0.2",
|
|
74
74
|
"react-draggable": "^4.4.4",
|
|
75
|
-
"react-imask": "^6.4.
|
|
75
|
+
"react-imask": "^6.4.2",
|
|
76
76
|
"react-window": "^1.8.6"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ActionResultError,
|
|
3
|
+
BridgeUtils,
|
|
3
4
|
CoreApp,
|
|
4
5
|
createClient,
|
|
5
6
|
IActionResult,
|
|
@@ -271,6 +272,9 @@ export class ReactApp<
|
|
|
271
272
|
}
|
|
272
273
|
});
|
|
273
274
|
|
|
275
|
+
// Notify host
|
|
276
|
+
BridgeUtils.host?.changeCulture(culture.name);
|
|
277
|
+
|
|
274
278
|
// Document title
|
|
275
279
|
document.title = this.get(this.name) ?? this.name;
|
|
276
280
|
}
|
|
@@ -12,7 +12,7 @@ export interface BridgeCloseButtonProps extends IconButtonProps {
|
|
|
12
12
|
* Validate the host
|
|
13
13
|
* @param host Host
|
|
14
14
|
*/
|
|
15
|
-
validate(host: IBridgeHost): boolean;
|
|
15
|
+
validate?(host: IBridgeHost): boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -51,8 +51,8 @@ export function BridgeCloseButton(props: BridgeCloseButtonProps) {
|
|
|
51
51
|
onClick={onClickLocal}
|
|
52
52
|
sx={{
|
|
53
53
|
position: 'absolute',
|
|
54
|
-
top: (theme) => theme.spacing(
|
|
55
|
-
right: (theme) => theme.spacing(
|
|
54
|
+
top: (theme) => theme.spacing(0.5),
|
|
55
|
+
right: (theme) => theme.spacing(0.5)
|
|
56
56
|
}}
|
|
57
57
|
{...rest}
|
|
58
58
|
>
|
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;
|