@etsoo/materialui 1.2.35 → 1.2.37
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/UserAvatarEditor.js +3 -5
- package/lib/app/CommonApp.js +1 -1
- package/lib/app/ReactApp.js +4 -3
- package/lib/app/ServiceApp.js +2 -2
- package/package.json +3 -3
- package/src/UserAvatarEditor.tsx +8 -10
- package/src/app/CommonApp.ts +1 -1
- package/src/app/ReactApp.ts +4 -4
- package/src/app/ServiceApp.ts +2 -2
package/lib/UserAvatarEditor.js
CHANGED
|
@@ -10,6 +10,7 @@ const defaultState = {
|
|
|
10
10
|
scale: 1,
|
|
11
11
|
rotate: 0
|
|
12
12
|
};
|
|
13
|
+
const AE = React.lazy(() => import("react-avatar-editor"));
|
|
13
14
|
/**
|
|
14
15
|
* User avatar editor
|
|
15
16
|
* https://github.com/mosch/react-avatar-editor
|
|
@@ -27,7 +28,6 @@ export function UserAvatarEditor(props) {
|
|
|
27
28
|
const labels = Labels.UserAvatarEditor;
|
|
28
29
|
// Ref
|
|
29
30
|
const ref = React.createRef();
|
|
30
|
-
const [AE, setAE] = React.useState();
|
|
31
31
|
// Button ref
|
|
32
32
|
const buttonRef = React.createRef();
|
|
33
33
|
// Preview image state
|
|
@@ -111,15 +111,13 @@ export function UserAvatarEditor(props) {
|
|
|
111
111
|
onDone(data, toBlob);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
React.useEffect(() => {
|
|
115
|
-
import("react-avatar-editor").then((result) => setAE(result.default));
|
|
116
|
-
}, []);
|
|
117
114
|
return (React.createElement(Stack, { direction: "column", spacing: 0.5, width: containerWidth },
|
|
118
115
|
React.createElement(Button, { variant: "outlined", size: "medium", component: "label", startIcon: React.createElement(ComputerIcon, null), fullWidth: true },
|
|
119
116
|
labels.upload,
|
|
120
117
|
React.createElement("input", { id: "fileInput", type: "file", accept: "image/png, image/jpeg", multiple: false, hidden: true, onChange: handleFileChange })),
|
|
121
118
|
React.createElement(Stack, { direction: "row", spacing: 0.5 },
|
|
122
|
-
|
|
119
|
+
React.createElement(React.Suspense, { fallback: React.createElement(Skeleton, { variant: "rounded", width: width, height: height }) },
|
|
120
|
+
React.createElement(AE, { ref: ref, border: border, width: width, height: height, onLoadSuccess: handleLoad, image: previewImage !== null && previewImage !== void 0 ? previewImage : "", scale: editorState.scale, rotate: editorState.rotate })),
|
|
123
121
|
React.createElement(ButtonGroup, { size: "small", orientation: "vertical", disabled: !ready },
|
|
124
122
|
React.createElement(Button, { onClick: () => handleRotate(90), title: labels.rotateRight },
|
|
125
123
|
React.createElement(RotateRightIcon, null)),
|
package/lib/app/CommonApp.js
CHANGED
|
@@ -96,7 +96,7 @@ export class CommonApp extends ReactApp {
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
// Set password for the action
|
|
99
|
-
rq.pwd =
|
|
99
|
+
rq.pwd = this.encrypt(this.hash(pwd));
|
|
100
100
|
// Submit again
|
|
101
101
|
const result = await this.api.put("Auth/RefreshToken", rq, payload);
|
|
102
102
|
if (result == null)
|
package/lib/app/ReactApp.js
CHANGED
|
@@ -145,10 +145,11 @@ export class ReactApp extends CoreApp {
|
|
|
145
145
|
// Same?
|
|
146
146
|
if (culture.name === this.culture)
|
|
147
147
|
return;
|
|
148
|
-
// Dispatch action
|
|
149
|
-
dispatch(culture);
|
|
150
148
|
// Super call
|
|
151
|
-
this.changeCulture(culture)
|
|
149
|
+
this.changeCulture(culture).then(() => {
|
|
150
|
+
// Dispatch action
|
|
151
|
+
dispatch(culture);
|
|
152
|
+
});
|
|
152
153
|
}
|
|
153
154
|
/**
|
|
154
155
|
* Get date format props
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -110,7 +110,7 @@ export class ServiceApp extends ReactApp {
|
|
|
110
110
|
const userData = result.data;
|
|
111
111
|
// Use core system access token to service api to exchange service access token
|
|
112
112
|
const serviceResult = await this.serviceApi.put("Auth/ExchangeToken", {
|
|
113
|
-
token:
|
|
113
|
+
token: this.encryptEnhanced(userData.token, this.settings.serviceId.toString())
|
|
114
114
|
}, {
|
|
115
115
|
showLoading,
|
|
116
116
|
onError: (error) => {
|
|
@@ -154,7 +154,7 @@ export class ServiceApp extends ReactApp {
|
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
156
|
// Set password for the action
|
|
157
|
-
rq.pwd =
|
|
157
|
+
rq.pwd = this.encrypt(this.hash(pwd));
|
|
158
158
|
// Submit again
|
|
159
159
|
const result = await this.api.put("Auth/RefreshToken", rq, payload);
|
|
160
160
|
if (result == null)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.37",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@emotion/css": "^11.11.0",
|
|
51
51
|
"@emotion/react": "^11.11.0",
|
|
52
52
|
"@emotion/styled": "^11.11.0",
|
|
53
|
-
"@etsoo/appscript": "^1.4.
|
|
53
|
+
"@etsoo/appscript": "^1.4.7",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.25",
|
|
55
|
-
"@etsoo/react": "^1.6.
|
|
55
|
+
"@etsoo/react": "^1.6.80",
|
|
56
56
|
"@etsoo/shared": "^1.2.5",
|
|
57
57
|
"@mui/icons-material": "^5.11.16",
|
|
58
58
|
"@mui/material": "^5.12.3",
|
package/src/UserAvatarEditor.tsx
CHANGED
|
@@ -76,6 +76,8 @@ const defaultState: EditorState = {
|
|
|
76
76
|
rotate: 0
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
+
const AE = React.lazy(() => import("react-avatar-editor"));
|
|
80
|
+
|
|
79
81
|
/**
|
|
80
82
|
* User avatar editor
|
|
81
83
|
* https://github.com/mosch/react-avatar-editor
|
|
@@ -107,8 +109,6 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
107
109
|
// Ref
|
|
108
110
|
const ref = React.createRef<AvatarEditor>();
|
|
109
111
|
|
|
110
|
-
const [AE, setAE] = React.useState<typeof AvatarEditor>();
|
|
111
|
-
|
|
112
112
|
// Button ref
|
|
113
113
|
const buttonRef = React.createRef<HTMLButtonElement>();
|
|
114
114
|
|
|
@@ -214,10 +214,6 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
|
|
217
|
-
React.useEffect(() => {
|
|
218
|
-
import("react-avatar-editor").then((result) => setAE(result.default));
|
|
219
|
-
}, []);
|
|
220
|
-
|
|
221
217
|
return (
|
|
222
218
|
<Stack direction="column" spacing={0.5} width={containerWidth}>
|
|
223
219
|
<Button
|
|
@@ -238,9 +234,11 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
238
234
|
/>
|
|
239
235
|
</Button>
|
|
240
236
|
<Stack direction="row" spacing={0.5}>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
237
|
+
<React.Suspense
|
|
238
|
+
fallback={
|
|
239
|
+
<Skeleton variant="rounded" width={width} height={height} />
|
|
240
|
+
}
|
|
241
|
+
>
|
|
244
242
|
<AE
|
|
245
243
|
ref={ref}
|
|
246
244
|
border={border}
|
|
@@ -251,7 +249,7 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
251
249
|
scale={editorState.scale}
|
|
252
250
|
rotate={editorState.rotate}
|
|
253
251
|
/>
|
|
254
|
-
|
|
252
|
+
</React.Suspense>
|
|
255
253
|
<ButtonGroup size="small" orientation="vertical" disabled={!ready}>
|
|
256
254
|
<Button onClick={() => handleRotate(90)} title={labels.rotateRight}>
|
|
257
255
|
<RotateRightIcon />
|
package/src/app/CommonApp.ts
CHANGED
package/src/app/ReactApp.ts
CHANGED
|
@@ -355,11 +355,11 @@ export class ReactApp<
|
|
|
355
355
|
// Same?
|
|
356
356
|
if (culture.name === this.culture) return;
|
|
357
357
|
|
|
358
|
-
// Dispatch action
|
|
359
|
-
dispatch(culture);
|
|
360
|
-
|
|
361
358
|
// Super call
|
|
362
|
-
this.changeCulture(culture)
|
|
359
|
+
this.changeCulture(culture).then(() => {
|
|
360
|
+
// Dispatch action
|
|
361
|
+
dispatch(culture);
|
|
362
|
+
});
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
/**
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -167,7 +167,7 @@ export class ServiceApp<
|
|
|
167
167
|
const serviceResult = await this.serviceApi.put<ServiceLoginResult<U>>(
|
|
168
168
|
"Auth/ExchangeToken",
|
|
169
169
|
{
|
|
170
|
-
token:
|
|
170
|
+
token: this.encryptEnhanced(
|
|
171
171
|
userData.token,
|
|
172
172
|
this.settings.serviceId.toString()
|
|
173
173
|
)
|
|
@@ -226,7 +226,7 @@ export class ServiceApp<
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
// Set password for the action
|
|
229
|
-
rq.pwd =
|
|
229
|
+
rq.pwd = this.encrypt(this.hash(pwd));
|
|
230
230
|
|
|
231
231
|
// Submit again
|
|
232
232
|
const result = await this.api.put<LoginResult>(
|