@etsoo/materialui 1.6.86 → 1.6.88
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/cjs/app/ReactApp.d.ts +2 -2
- package/lib/cjs/app/ReactApp.js +10 -11
- package/lib/cjs/app/ServiceApp.js +6 -6
- package/lib/mjs/app/ReactApp.d.ts +2 -2
- package/lib/mjs/app/ReactApp.js +10 -11
- package/lib/mjs/app/ServiceApp.js +6 -6
- package/package.json +8 -8
- package/src/app/ReactApp.ts +17 -12
- package/src/app/ServiceApp.ts +6 -6
|
@@ -180,7 +180,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
|
|
|
180
180
|
* @param refreshToken Refresh token
|
|
181
181
|
* @param dispatch User state dispatch
|
|
182
182
|
*/
|
|
183
|
-
userLogin(user: D, refreshToken: string, dispatch?: boolean): void
|
|
183
|
+
userLogin(user: D, refreshToken: string, dispatch?: boolean): Promise<void>;
|
|
184
184
|
/**
|
|
185
185
|
* User login callback
|
|
186
186
|
* @param user New user
|
|
@@ -190,7 +190,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
|
|
|
190
190
|
* User login dispatch
|
|
191
191
|
* @param user New user
|
|
192
192
|
*/
|
|
193
|
-
protected doLoginDispatch(user: D): void
|
|
193
|
+
protected doLoginDispatch(user: D): Promise<void>;
|
|
194
194
|
/**
|
|
195
195
|
* User logout
|
|
196
196
|
* @param clearToken Clear refresh token or not
|
package/lib/cjs/app/ReactApp.js
CHANGED
|
@@ -307,12 +307,12 @@ class ReactApp extends appscript_1.CoreApp {
|
|
|
307
307
|
* @param refreshToken Refresh token
|
|
308
308
|
* @param dispatch User state dispatch
|
|
309
309
|
*/
|
|
310
|
-
userLogin(user, refreshToken, dispatch) {
|
|
310
|
+
async userLogin(user, refreshToken, dispatch) {
|
|
311
311
|
// Super call, set token
|
|
312
|
-
super.userLogin(user, refreshToken);
|
|
312
|
+
await super.userLogin(user, refreshToken);
|
|
313
313
|
// Dispatch action
|
|
314
314
|
if (dispatch !== false) {
|
|
315
|
-
this.doLoginDispatch(user);
|
|
315
|
+
await this.doLoginDispatch(user);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
@@ -326,14 +326,13 @@ class ReactApp extends appscript_1.CoreApp {
|
|
|
326
326
|
* User login dispatch
|
|
327
327
|
* @param user New user
|
|
328
328
|
*/
|
|
329
|
-
doLoginDispatch(user) {
|
|
330
|
-
this.onUserLogin(user)
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
});
|
|
329
|
+
async doLoginDispatch(user) {
|
|
330
|
+
await this.onUserLogin(user);
|
|
331
|
+
if (this.userStateDispatch != null)
|
|
332
|
+
this.userStateDispatch({
|
|
333
|
+
type: react_2.UserActionType.Login,
|
|
334
|
+
user
|
|
335
|
+
});
|
|
337
336
|
}
|
|
338
337
|
/**
|
|
339
338
|
* User logout
|
|
@@ -141,9 +141,9 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
141
141
|
expiresIn: user.seconds
|
|
142
142
|
};
|
|
143
143
|
// Cache the core system data
|
|
144
|
-
this.saveCoreToken(core);
|
|
144
|
+
await this.saveCoreToken(core);
|
|
145
145
|
// User login and trigger the dispatch at last
|
|
146
|
-
this.userLogin(user, refreshToken, dispatch);
|
|
146
|
+
await this.userLogin(user, refreshToken, dispatch);
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
149
|
* Save core system data
|
|
@@ -155,7 +155,7 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
155
155
|
// Cache the core system refresh token
|
|
156
156
|
this.storage.setData(coreTokenKey, await this.encrypt(data.refreshToken));
|
|
157
157
|
// Exchange tokens
|
|
158
|
-
this.exchangeTokenAll(data);
|
|
158
|
+
await this.exchangeTokenAll(data);
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
* On switch organization handler
|
|
@@ -189,11 +189,11 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
189
189
|
// Override the user data's refresh token
|
|
190
190
|
const user = refreshToken ? { ...result.data, refreshToken } : result.data;
|
|
191
191
|
// User login without dispatch
|
|
192
|
-
this.userLoginEx(user, core, false);
|
|
192
|
+
await this.userLoginEx(user, core, false);
|
|
193
193
|
// Handle the switch organization
|
|
194
194
|
await this.onSwitchOrg();
|
|
195
195
|
// Trigger the dispatch at last
|
|
196
|
-
this.doLoginDispatch(user);
|
|
196
|
+
await this.doLoginDispatch(user);
|
|
197
197
|
return result;
|
|
198
198
|
}
|
|
199
199
|
async refreshTokenSucceed(user, token, callback) {
|
|
@@ -221,7 +221,7 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
221
221
|
return;
|
|
222
222
|
// Cache the core system refresh token
|
|
223
223
|
// Follow similar logic in userLoginEx
|
|
224
|
-
this.saveCoreToken(data);
|
|
224
|
+
await this.saveCoreToken(data);
|
|
225
225
|
// Call the super
|
|
226
226
|
await super.refreshTokenSucceed(user, token, callback);
|
|
227
227
|
}
|
|
@@ -180,7 +180,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
|
|
|
180
180
|
* @param refreshToken Refresh token
|
|
181
181
|
* @param dispatch User state dispatch
|
|
182
182
|
*/
|
|
183
|
-
userLogin(user: D, refreshToken: string, dispatch?: boolean): void
|
|
183
|
+
userLogin(user: D, refreshToken: string, dispatch?: boolean): Promise<void>;
|
|
184
184
|
/**
|
|
185
185
|
* User login callback
|
|
186
186
|
* @param user New user
|
|
@@ -190,7 +190,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
|
|
|
190
190
|
* User login dispatch
|
|
191
191
|
* @param user New user
|
|
192
192
|
*/
|
|
193
|
-
protected doLoginDispatch(user: D): void
|
|
193
|
+
protected doLoginDispatch(user: D): Promise<void>;
|
|
194
194
|
/**
|
|
195
195
|
* User logout
|
|
196
196
|
* @param clearToken Clear refresh token or not
|
package/lib/mjs/app/ReactApp.js
CHANGED
|
@@ -299,12 +299,12 @@ export class ReactApp extends CoreApp {
|
|
|
299
299
|
* @param refreshToken Refresh token
|
|
300
300
|
* @param dispatch User state dispatch
|
|
301
301
|
*/
|
|
302
|
-
userLogin(user, refreshToken, dispatch) {
|
|
302
|
+
async userLogin(user, refreshToken, dispatch) {
|
|
303
303
|
// Super call, set token
|
|
304
|
-
super.userLogin(user, refreshToken);
|
|
304
|
+
await super.userLogin(user, refreshToken);
|
|
305
305
|
// Dispatch action
|
|
306
306
|
if (dispatch !== false) {
|
|
307
|
-
this.doLoginDispatch(user);
|
|
307
|
+
await this.doLoginDispatch(user);
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
/**
|
|
@@ -318,14 +318,13 @@ export class ReactApp extends CoreApp {
|
|
|
318
318
|
* User login dispatch
|
|
319
319
|
* @param user New user
|
|
320
320
|
*/
|
|
321
|
-
doLoginDispatch(user) {
|
|
322
|
-
this.onUserLogin(user)
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
});
|
|
321
|
+
async doLoginDispatch(user) {
|
|
322
|
+
await this.onUserLogin(user);
|
|
323
|
+
if (this.userStateDispatch != null)
|
|
324
|
+
this.userStateDispatch({
|
|
325
|
+
type: UserActionType.Login,
|
|
326
|
+
user
|
|
327
|
+
});
|
|
329
328
|
}
|
|
330
329
|
/**
|
|
331
330
|
* User logout
|
|
@@ -138,9 +138,9 @@ export class ServiceApp extends ReactApp {
|
|
|
138
138
|
expiresIn: user.seconds
|
|
139
139
|
};
|
|
140
140
|
// Cache the core system data
|
|
141
|
-
this.saveCoreToken(core);
|
|
141
|
+
await this.saveCoreToken(core);
|
|
142
142
|
// User login and trigger the dispatch at last
|
|
143
|
-
this.userLogin(user, refreshToken, dispatch);
|
|
143
|
+
await this.userLogin(user, refreshToken, dispatch);
|
|
144
144
|
}
|
|
145
145
|
/**
|
|
146
146
|
* Save core system data
|
|
@@ -152,7 +152,7 @@ export class ServiceApp extends ReactApp {
|
|
|
152
152
|
// Cache the core system refresh token
|
|
153
153
|
this.storage.setData(coreTokenKey, await this.encrypt(data.refreshToken));
|
|
154
154
|
// Exchange tokens
|
|
155
|
-
this.exchangeTokenAll(data);
|
|
155
|
+
await this.exchangeTokenAll(data);
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* On switch organization handler
|
|
@@ -186,11 +186,11 @@ export class ServiceApp extends ReactApp {
|
|
|
186
186
|
// Override the user data's refresh token
|
|
187
187
|
const user = refreshToken ? { ...result.data, refreshToken } : result.data;
|
|
188
188
|
// User login without dispatch
|
|
189
|
-
this.userLoginEx(user, core, false);
|
|
189
|
+
await this.userLoginEx(user, core, false);
|
|
190
190
|
// Handle the switch organization
|
|
191
191
|
await this.onSwitchOrg();
|
|
192
192
|
// Trigger the dispatch at last
|
|
193
|
-
this.doLoginDispatch(user);
|
|
193
|
+
await this.doLoginDispatch(user);
|
|
194
194
|
return result;
|
|
195
195
|
}
|
|
196
196
|
async refreshTokenSucceed(user, token, callback) {
|
|
@@ -218,7 +218,7 @@ export class ServiceApp extends ReactApp {
|
|
|
218
218
|
return;
|
|
219
219
|
// Cache the core system refresh token
|
|
220
220
|
// Follow similar logic in userLoginEx
|
|
221
|
-
this.saveCoreToken(data);
|
|
221
|
+
await this.saveCoreToken(data);
|
|
222
222
|
// Call the super
|
|
223
223
|
await super.refreshTokenSucceed(user, token, callback);
|
|
224
224
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.88",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
"@dnd-kit/react": "^0.5.0",
|
|
41
41
|
"@emotion/react": "^11.14.0",
|
|
42
42
|
"@emotion/styled": "^11.14.1",
|
|
43
|
-
"@etsoo/appscript": "^1.6.
|
|
43
|
+
"@etsoo/appscript": "^1.6.78",
|
|
44
44
|
"@etsoo/notificationbase": "^1.1.75",
|
|
45
|
-
"@etsoo/react": "^1.9.
|
|
45
|
+
"@etsoo/react": "^1.9.4",
|
|
46
46
|
"@etsoo/shared": "^1.2.91",
|
|
47
47
|
"@mui/icons-material": "^9.4.0",
|
|
48
48
|
"@mui/material": "^9.4.0",
|
|
49
49
|
"@mui/x-data-grid": "^9.13.0",
|
|
50
50
|
"chart.js": "^4.5.1",
|
|
51
51
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
52
|
-
"dompurify": "^3.4.
|
|
52
|
+
"dompurify": "^3.4.15",
|
|
53
53
|
"eventemitter3": "^5.0.4",
|
|
54
54
|
"pica": "^10.0.3",
|
|
55
55
|
"pulltorefreshjs": "^0.1.22",
|
|
56
|
-
"react": "^19.
|
|
56
|
+
"react": "^19.3.0",
|
|
57
57
|
"react-avatar-editor": "^15.1.0",
|
|
58
58
|
"react-chartjs-2": "^5.3.1",
|
|
59
|
-
"react-dom": "^19.
|
|
59
|
+
"react-dom": "^19.3.0",
|
|
60
60
|
"react-draggable": "^4.7.1",
|
|
61
61
|
"react-imask": "7.6.1",
|
|
62
62
|
"signature_pad": "^5.1.4"
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"@testing-library/react": "^16.3.3",
|
|
71
71
|
"@types/pica": "^9.0.5",
|
|
72
72
|
"@types/pulltorefreshjs": "^0.1.7",
|
|
73
|
-
"@types/react": "^19.
|
|
73
|
+
"@types/react": "^19.3.0",
|
|
74
74
|
"@types/react-avatar-editor": "^13.0.4",
|
|
75
|
-
"@types/react-dom": "^19.
|
|
75
|
+
"@types/react-dom": "^19.3.0",
|
|
76
76
|
"@types/react-input-mask": "^3.0.6",
|
|
77
77
|
"@vitejs/plugin-react": "^6.1.1",
|
|
78
78
|
"jsdom": "^30.0.1",
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -113,7 +113,8 @@ export interface IReactAppBase {
|
|
|
113
113
|
* Core application interface
|
|
114
114
|
*/
|
|
115
115
|
export interface IReactApp<S extends IAppSettings, D extends IUser>
|
|
116
|
-
extends
|
|
116
|
+
extends
|
|
117
|
+
ICoreApp<D, S, React.ReactNode, NotificationReactCallProps>,
|
|
117
118
|
Omit<IReactAppBase, "userState"> {
|
|
118
119
|
/**
|
|
119
120
|
* User state
|
|
@@ -478,13 +479,17 @@ export class ReactApp<S extends IAppSettings, D extends IUser>
|
|
|
478
479
|
* @param refreshToken Refresh token
|
|
479
480
|
* @param dispatch User state dispatch
|
|
480
481
|
*/
|
|
481
|
-
override userLogin(
|
|
482
|
+
override async userLogin(
|
|
483
|
+
user: D,
|
|
484
|
+
refreshToken: string,
|
|
485
|
+
dispatch?: boolean
|
|
486
|
+
): Promise<void> {
|
|
482
487
|
// Super call, set token
|
|
483
|
-
super.userLogin(user, refreshToken);
|
|
488
|
+
await super.userLogin(user, refreshToken);
|
|
484
489
|
|
|
485
490
|
// Dispatch action
|
|
486
491
|
if (dispatch !== false) {
|
|
487
|
-
this.doLoginDispatch(user);
|
|
492
|
+
await this.doLoginDispatch(user);
|
|
488
493
|
}
|
|
489
494
|
}
|
|
490
495
|
|
|
@@ -500,14 +505,14 @@ export class ReactApp<S extends IAppSettings, D extends IUser>
|
|
|
500
505
|
* User login dispatch
|
|
501
506
|
* @param user New user
|
|
502
507
|
*/
|
|
503
|
-
protected doLoginDispatch(user: D) {
|
|
504
|
-
this.onUserLogin(user)
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
508
|
+
protected async doLoginDispatch(user: D) {
|
|
509
|
+
await this.onUserLogin(user);
|
|
510
|
+
|
|
511
|
+
if (this.userStateDispatch != null)
|
|
512
|
+
this.userStateDispatch({
|
|
513
|
+
type: UserActionType.Login,
|
|
514
|
+
user
|
|
515
|
+
});
|
|
511
516
|
}
|
|
512
517
|
|
|
513
518
|
/**
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -188,10 +188,10 @@ export class ServiceApp<
|
|
|
188
188
|
};
|
|
189
189
|
|
|
190
190
|
// Cache the core system data
|
|
191
|
-
this.saveCoreToken(core);
|
|
191
|
+
await this.saveCoreToken(core);
|
|
192
192
|
|
|
193
193
|
// User login and trigger the dispatch at last
|
|
194
|
-
this.userLogin(user, refreshToken, dispatch);
|
|
194
|
+
await this.userLogin(user, refreshToken, dispatch);
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
/**
|
|
@@ -206,7 +206,7 @@ export class ServiceApp<
|
|
|
206
206
|
this.storage.setData(coreTokenKey, await this.encrypt(data.refreshToken));
|
|
207
207
|
|
|
208
208
|
// Exchange tokens
|
|
209
|
-
this.exchangeTokenAll(data);
|
|
209
|
+
await this.exchangeTokenAll(data);
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
/**
|
|
@@ -255,13 +255,13 @@ export class ServiceApp<
|
|
|
255
255
|
const user = refreshToken ? { ...result.data, refreshToken } : result.data;
|
|
256
256
|
|
|
257
257
|
// User login without dispatch
|
|
258
|
-
this.userLoginEx(user, core, false);
|
|
258
|
+
await this.userLoginEx(user, core, false);
|
|
259
259
|
|
|
260
260
|
// Handle the switch organization
|
|
261
261
|
await this.onSwitchOrg();
|
|
262
262
|
|
|
263
263
|
// Trigger the dispatch at last
|
|
264
|
-
this.doLoginDispatch(user);
|
|
264
|
+
await this.doLoginDispatch(user);
|
|
265
265
|
|
|
266
266
|
return result;
|
|
267
267
|
}
|
|
@@ -298,7 +298,7 @@ export class ServiceApp<
|
|
|
298
298
|
|
|
299
299
|
// Cache the core system refresh token
|
|
300
300
|
// Follow similar logic in userLoginEx
|
|
301
|
-
this.saveCoreToken(data);
|
|
301
|
+
await this.saveCoreToken(data);
|
|
302
302
|
|
|
303
303
|
// Call the super
|
|
304
304
|
await super.refreshTokenSucceed(user, token, callback);
|