@etsoo/materialui 1.2.34 → 1.2.36

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.
@@ -27,7 +27,7 @@ export function UserAvatarEditor(props) {
27
27
  const labels = Labels.UserAvatarEditor;
28
28
  // Ref
29
29
  const ref = React.createRef();
30
- const [AE, setAE] = React.useState();
30
+ const [AE, setAvatarEditor] = React.useState();
31
31
  // Button ref
32
32
  const buttonRef = React.createRef();
33
33
  // Preview image state
@@ -112,7 +112,7 @@ export function UserAvatarEditor(props) {
112
112
  }
113
113
  };
114
114
  React.useEffect(() => {
115
- import("react-avatar-editor").then((result) => setAE(result.default));
115
+ import("react-avatar-editor").then((result) => setAvatarEditor(result.default));
116
116
  }, []);
117
117
  return (React.createElement(Stack, { direction: "column", spacing: 0.5, width: containerWidth },
118
118
  React.createElement(Button, { variant: "outlined", size: "medium", component: "label", startIcon: React.createElement(ComputerIcon, null), fullWidth: true },
@@ -96,7 +96,7 @@ export class CommonApp extends ReactApp {
96
96
  return;
97
97
  }
98
98
  // Set password for the action
99
- rq.pwd = await this.encrypt(await this.hash(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)
@@ -149,7 +149,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
149
149
  * Change culture
150
150
  * @param culture New culture definition
151
151
  */
152
- changeCulture(culture: DataTypes.CultureDefinition): void;
152
+ changeCulture(culture: DataTypes.CultureDefinition): Promise<DataTypes.StringRecord>;
153
153
  /**
154
154
  * Change culture extended
155
155
  * @param dispatch Dispatch method
@@ -105,23 +105,22 @@ export class ReactApp extends CoreApp {
105
105
  * Change culture
106
106
  * @param culture New culture definition
107
107
  */
108
- changeCulture(culture) {
108
+ async changeCulture(culture) {
109
109
  var _a, _b;
110
110
  // Super call to update cultrue
111
- super.changeCulture(culture, (resources) => {
112
- // Update component labels
113
- Labels.setLabels(resources, {
114
- notificationMU: {
115
- alertTitle: "warning",
116
- alertOK: "ok",
117
- confirmTitle: "confirm",
118
- confirmYes: "ok",
119
- confirmNo: "cancel",
120
- promptTitle: "prompt",
121
- promptCancel: "cancel",
122
- promptOK: "ok"
123
- }
124
- });
111
+ const resources = await super.changeCulture(culture);
112
+ // Update component labels
113
+ Labels.setLabels(resources, {
114
+ notificationMU: {
115
+ alertTitle: "warning",
116
+ alertOK: "ok",
117
+ confirmTitle: "confirm",
118
+ confirmYes: "ok",
119
+ confirmNo: "cancel",
120
+ promptTitle: "prompt",
121
+ promptCancel: "cancel",
122
+ promptOK: "ok"
123
+ }
125
124
  });
126
125
  // Document title
127
126
  // Default is servier name's label or appName label
@@ -135,6 +134,7 @@ export class ReactApp extends CoreApp {
135
134
  else {
136
135
  document.title = title;
137
136
  }
137
+ return resources;
138
138
  }
139
139
  /**
140
140
  * Change culture extended
@@ -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: await this.encryptEnhanced(userData.token, this.settings.serviceId.toString())
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 = await this.encrypt(await this.hash(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.34",
3
+ "version": "1.2.36",
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.5",
53
+ "@etsoo/appscript": "^1.4.7",
54
54
  "@etsoo/notificationbase": "^1.1.25",
55
- "@etsoo/react": "^1.6.79",
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",
@@ -107,7 +107,7 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
107
107
  // Ref
108
108
  const ref = React.createRef<AvatarEditor>();
109
109
 
110
- const [AE, setAE] = React.useState<typeof AvatarEditor>();
110
+ const [AE, setAvatarEditor] = React.useState<typeof AvatarEditor>();
111
111
 
112
112
  // Button ref
113
113
  const buttonRef = React.createRef<HTMLButtonElement>();
@@ -215,7 +215,9 @@ export function UserAvatarEditor(props: UserAvatarEditorProps) {
215
215
  };
216
216
 
217
217
  React.useEffect(() => {
218
- import("react-avatar-editor").then((result) => setAE(result.default));
218
+ import("react-avatar-editor").then((result) =>
219
+ setAvatarEditor(result.default)
220
+ );
219
221
  }, []);
220
222
 
221
223
  return (
@@ -144,7 +144,7 @@ export abstract class CommonApp<
144
144
  }
145
145
 
146
146
  // Set password for the action
147
- rq.pwd = await this.encrypt(await this.hash(pwd));
147
+ rq.pwd = this.encrypt(this.hash(pwd));
148
148
 
149
149
  // Submit again
150
150
  const result = await this.api.put<LoginResult>(
@@ -310,22 +310,22 @@ export class ReactApp<
310
310
  * Change culture
311
311
  * @param culture New culture definition
312
312
  */
313
- override changeCulture(culture: DataTypes.CultureDefinition) {
313
+ override async changeCulture(culture: DataTypes.CultureDefinition) {
314
314
  // Super call to update cultrue
315
- super.changeCulture(culture, (resources) => {
316
- // Update component labels
317
- Labels.setLabels(resources, {
318
- notificationMU: {
319
- alertTitle: "warning",
320
- alertOK: "ok",
321
- confirmTitle: "confirm",
322
- confirmYes: "ok",
323
- confirmNo: "cancel",
324
- promptTitle: "prompt",
325
- promptCancel: "cancel",
326
- promptOK: "ok"
327
- }
328
- });
315
+ const resources = await super.changeCulture(culture);
316
+
317
+ // Update component labels
318
+ Labels.setLabels(resources, {
319
+ notificationMU: {
320
+ alertTitle: "warning",
321
+ alertOK: "ok",
322
+ confirmTitle: "confirm",
323
+ confirmYes: "ok",
324
+ confirmNo: "cancel",
325
+ promptTitle: "prompt",
326
+ promptCancel: "cancel",
327
+ promptOK: "ok"
328
+ }
329
329
  });
330
330
 
331
331
  // Document title
@@ -339,6 +339,8 @@ export class ReactApp<
339
339
  } else {
340
340
  document.title = title;
341
341
  }
342
+
343
+ return resources;
342
344
  }
343
345
 
344
346
  /**
@@ -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: await this.encryptEnhanced(
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 = await this.encrypt(await this.hash(pwd));
229
+ rq.pwd = this.encrypt(this.hash(pwd));
230
230
 
231
231
  // Submit again
232
232
  const result = await this.api.put<LoginResult>(