@etsoo/react 1.4.97 → 1.5.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/lib/app/ReactApp.d.ts +5 -0
- package/lib/app/ReactApp.js +8 -0
- package/lib/mu/BridgeCloseButton.js +2 -1
- package/lib/mu/ComboBox.js +3 -0
- package/lib/mu/SelectEx.js +15 -10
- package/package.json +3 -3
- package/src/app/ReactApp.ts +9 -0
- package/src/mu/BridgeCloseButton.tsx +3 -1
- package/src/mu/ComboBox.tsx +3 -0
- package/src/mu/SelectEx.tsx +16 -9
package/lib/app/ReactApp.d.ts
CHANGED
|
@@ -138,6 +138,11 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
|
|
|
138
138
|
* @param callback Callback
|
|
139
139
|
*/
|
|
140
140
|
freshCountdownUI(callback?: () => PromiseLike<unknown>): void;
|
|
141
|
+
/**
|
|
142
|
+
* Redirect to the Url
|
|
143
|
+
* @param url Url
|
|
144
|
+
*/
|
|
145
|
+
redirectTo(url: string): void;
|
|
141
146
|
/**
|
|
142
147
|
* Set page data
|
|
143
148
|
* @param data Page data
|
package/lib/app/ReactApp.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ActionResultError, BridgeUtils, CoreApp, createClient } from '@etsoo/appscript';
|
|
2
2
|
import { WindowStorage } from '@etsoo/shared';
|
|
3
|
+
import { navigate } from '@reach/router';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { NotifierMU } from '../mu/NotifierMU';
|
|
5
6
|
import { ProgressCount } from '../mu/ProgressCount';
|
|
@@ -188,6 +189,13 @@ export class ReactApp extends CoreApp {
|
|
|
188
189
|
inputs: progress
|
|
189
190
|
});
|
|
190
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Redirect to the Url
|
|
194
|
+
* @param url Url
|
|
195
|
+
*/
|
|
196
|
+
redirectTo(url) {
|
|
197
|
+
navigate(url);
|
|
198
|
+
}
|
|
191
199
|
/**
|
|
192
200
|
* Set page data
|
|
193
201
|
* @param data Page data
|
|
@@ -24,8 +24,9 @@ export function BridgeCloseButton(props) {
|
|
|
24
24
|
onClick(event);
|
|
25
25
|
host.exit();
|
|
26
26
|
};
|
|
27
|
-
return (React.createElement(IconButton, { "aria-label": "close", color: "
|
|
27
|
+
return (React.createElement(IconButton, { "aria-label": "close", color: "secondary", onClick: onClickLocal, title: title, sx: {
|
|
28
28
|
position: 'absolute',
|
|
29
|
+
zIndex: (theme) => theme.zIndex.appBar + 1,
|
|
29
30
|
top: (theme) => theme.spacing(0.5),
|
|
30
31
|
right: (theme) => theme.spacing(0.5)
|
|
31
32
|
}, ...rest },
|
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);
|
|
@@ -113,7 +116,9 @@ export function SelectEx(props) {
|
|
|
113
116
|
React.createElement(InputLabel, { id: labelId, shrink: search
|
|
114
117
|
? MUGlobal.searchFieldShrink
|
|
115
118
|
: MUGlobal.inputFieldShrink }, label),
|
|
116
|
-
React.createElement(Select, { ref: divRef, value: localOptions.
|
|
119
|
+
React.createElement(Select, { ref: divRef, value: localOptions.some((option) => itemChecked(getId(option)))
|
|
120
|
+
? valueState !== null && valueState !== void 0 ? valueState : ''
|
|
121
|
+
: '', input: React.createElement(OutlinedInput, { notched: true, label: label }), labelId: labelId, name: name, multiple: multiple, onChange: (event, child) => {
|
|
117
122
|
if (onChange)
|
|
118
123
|
onChange(event, child);
|
|
119
124
|
if (multiple)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
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.43",
|
|
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
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
NotificationReturn
|
|
15
15
|
} from '@etsoo/notificationbase';
|
|
16
16
|
import { DataTypes, WindowStorage } from '@etsoo/shared';
|
|
17
|
+
import { navigate } from '@reach/router';
|
|
17
18
|
import React from 'react';
|
|
18
19
|
import { NotifierMU } from '../mu/NotifierMU';
|
|
19
20
|
import { ProgressCount } from '../mu/ProgressCount';
|
|
@@ -349,6 +350,14 @@ export class ReactApp<
|
|
|
349
350
|
);
|
|
350
351
|
}
|
|
351
352
|
|
|
353
|
+
/**
|
|
354
|
+
* Redirect to the Url
|
|
355
|
+
* @param url Url
|
|
356
|
+
*/
|
|
357
|
+
override redirectTo(url: string) {
|
|
358
|
+
navigate(url);
|
|
359
|
+
}
|
|
360
|
+
|
|
352
361
|
/**
|
|
353
362
|
* Set page data
|
|
354
363
|
* @param data Page data
|
|
@@ -47,10 +47,12 @@ export function BridgeCloseButton(props: BridgeCloseButtonProps) {
|
|
|
47
47
|
return (
|
|
48
48
|
<IconButton
|
|
49
49
|
aria-label="close"
|
|
50
|
-
color="
|
|
50
|
+
color="secondary"
|
|
51
51
|
onClick={onClickLocal}
|
|
52
|
+
title={title}
|
|
52
53
|
sx={{
|
|
53
54
|
position: 'absolute',
|
|
55
|
+
zIndex: (theme) => theme.zIndex.appBar + 1,
|
|
54
56
|
top: (theme) => theme.spacing(0.5),
|
|
55
57
|
right: (theme) => theme.spacing(0.5)
|
|
56
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;
|
|
@@ -208,7 +211,11 @@ export function SelectEx<T extends {} = IdLabelDto>(props: SelectExProps<T>) {
|
|
|
208
211
|
</InputLabel>
|
|
209
212
|
<Select
|
|
210
213
|
ref={divRef}
|
|
211
|
-
value={
|
|
214
|
+
value={
|
|
215
|
+
localOptions.some((option) => itemChecked(getId(option)))
|
|
216
|
+
? valueState ?? ''
|
|
217
|
+
: ''
|
|
218
|
+
}
|
|
212
219
|
input={<OutlinedInput notched label={label} />}
|
|
213
220
|
labelId={labelId}
|
|
214
221
|
name={name}
|