@etsoo/materialui 1.2.36 → 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/ReactApp.js +4 -3
- package/package.json +1 -1
- package/src/UserAvatarEditor.tsx +8 -12
- package/src/app/ReactApp.ts +4 -4
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, setAvatarEditor] = 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) => setAvatarEditor(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/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/package.json
CHANGED
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, setAvatarEditor] = React.useState<typeof AvatarEditor>();
|
|
111
|
-
|
|
112
112
|
// Button ref
|
|
113
113
|
const buttonRef = React.createRef<HTMLButtonElement>();
|
|
114
114
|
|
|
@@ -214,12 +214,6 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
|
|
217
|
-
React.useEffect(() => {
|
|
218
|
-
import("react-avatar-editor").then((result) =>
|
|
219
|
-
setAvatarEditor(result.default)
|
|
220
|
-
);
|
|
221
|
-
}, []);
|
|
222
|
-
|
|
223
217
|
return (
|
|
224
218
|
<Stack direction="column" spacing={0.5} width={containerWidth}>
|
|
225
219
|
<Button
|
|
@@ -240,9 +234,11 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
240
234
|
/>
|
|
241
235
|
</Button>
|
|
242
236
|
<Stack direction="row" spacing={0.5}>
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
<React.Suspense
|
|
238
|
+
fallback={
|
|
239
|
+
<Skeleton variant="rounded" width={width} height={height} />
|
|
240
|
+
}
|
|
241
|
+
>
|
|
246
242
|
<AE
|
|
247
243
|
ref={ref}
|
|
248
244
|
border={border}
|
|
@@ -253,7 +249,7 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
|
|
|
253
249
|
scale={editorState.scale}
|
|
254
250
|
rotate={editorState.rotate}
|
|
255
251
|
/>
|
|
256
|
-
|
|
252
|
+
</React.Suspense>
|
|
257
253
|
<ButtonGroup size="small" orientation="vertical" disabled={!ready}>
|
|
258
254
|
<Button onClick={() => handleRotate(90)} title={labels.rotateRight}>
|
|
259
255
|
<RotateRightIcon />
|
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
|
/**
|