@etsoo/materialui 1.4.13 → 1.4.15

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.
@@ -182,10 +182,10 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
182
182
  freshCountdownUI(callback?: () => PromiseLike<unknown>): void;
183
183
  /**
184
184
  * Try login
185
- * @param showLoading Show loading bar or not
185
+ * @param data Try login parameters
186
186
  * @returns Result
187
187
  */
188
- tryLogin(params?: AppTryLoginParams): Promise<boolean>;
188
+ tryLogin(data?: AppTryLoginParams): Promise<boolean>;
189
189
  /**
190
190
  * Check if the action result should be ignored during try login
191
191
  * @param result Action result
@@ -199,22 +199,23 @@ export class ReactApp extends CoreApp {
199
199
  }
200
200
  /**
201
201
  * Try login
202
- * @param showLoading Show loading bar or not
202
+ * @param data Try login parameters
203
203
  * @returns Result
204
204
  */
205
- async tryLogin(params) {
205
+ async tryLogin(data) {
206
+ // Destruct
207
+ const { onFailure = () => {
208
+ this.toLoginPage(rest);
209
+ }, onSuccess, ...rest } = data ?? {};
206
210
  // Check status
207
- const result = await super.tryLogin(params);
211
+ const result = await super.tryLogin(data);
208
212
  if (!result) {
213
+ onFailure();
209
214
  return false;
210
215
  }
211
- // Destruct
212
- const { onFailure = () => {
213
- this.toLoginPage(rest);
214
- }, onSuccess, ...rest } = params ?? {};
215
216
  // Refresh token
216
217
  await this.refreshToken({
217
- showLoading: params?.showLoading
218
+ showLoading: data?.showLoading
218
219
  }, (result) => {
219
220
  if (result === true) {
220
221
  onSuccess?.();
@@ -36,9 +36,9 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, P extends
36
36
  loadCore(): void;
37
37
  /**
38
38
  * Go to the login page
39
- * @params Login parameters
39
+ * @param data Login parameters
40
40
  */
41
- toLoginPage(params?: AppLoginParams): void;
41
+ toLoginPage(data?: AppLoginParams): void;
42
42
  /**
43
43
  * User login extended
44
44
  * @param user New user
@@ -38,11 +38,11 @@ export class ServiceApp extends ReactApp {
38
38
  }
39
39
  /**
40
40
  * Go to the login page
41
- * @params Login parameters
41
+ * @param data Login parameters
42
42
  */
43
- toLoginPage(params) {
43
+ toLoginPage(data) {
44
44
  // Destruct
45
- const { removeUrl, showLoading, ...rest } = params ?? {};
45
+ const { removeUrl, showLoading, params } = data ?? {};
46
46
  // Cache current URL
47
47
  this.cachedUrl = removeUrl ? undefined : globalThis.location.href;
48
48
  // Get the redirect URL
@@ -55,7 +55,9 @@ export class ServiceApp extends ReactApp {
55
55
  if (!url)
56
56
  return;
57
57
  // Add try login flag
58
- url = url.addUrlParams(rest);
58
+ if (params != null) {
59
+ url = url.addUrlParams(params);
60
+ }
59
61
  // Is it embeded?
60
62
  if (this.embedded) {
61
63
  globalThis.parent.postMessage(["login", url], this.coreOrigin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.4.13",
3
+ "version": "1.4.15",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,13 +50,13 @@
50
50
  "@emotion/css": "^11.13.4",
51
51
  "@emotion/react": "^11.13.3",
52
52
  "@emotion/styled": "^11.13.0",
53
- "@etsoo/appscript": "^1.5.53",
53
+ "@etsoo/appscript": "^1.5.56",
54
54
  "@etsoo/notificationbase": "^1.1.52",
55
- "@etsoo/react": "^1.7.87",
55
+ "@etsoo/react": "^1.7.89",
56
56
  "@etsoo/shared": "^1.2.51",
57
57
  "@mui/icons-material": "^6.1.4",
58
58
  "@mui/material": "^6.1.4",
59
- "@mui/x-data-grid": "^7.20.0",
59
+ "@mui/x-data-grid": "^7.21.0",
60
60
  "chart.js": "^4.4.5",
61
61
  "chartjs-plugin-datalabels": "^2.2.0",
62
62
  "eventemitter3": "^5.0.1",
@@ -77,7 +77,7 @@
77
77
  "@babel/preset-react": "^7.25.7",
78
78
  "@babel/preset-typescript": "^7.25.7",
79
79
  "@babel/runtime-corejs3": "^7.25.7",
80
- "@testing-library/jest-dom": "^6.6.1",
80
+ "@testing-library/jest-dom": "^6.6.2",
81
81
  "@testing-library/react": "^16.0.1",
82
82
  "@types/jest": "^29.5.13",
83
83
  "@types/pica": "^9.0.4",
@@ -87,8 +87,8 @@
87
87
  "@types/react-dom": "^18.3.1",
88
88
  "@types/react-input-mask": "^3.0.5",
89
89
  "@types/react-window": "^1.8.8",
90
- "@typescript-eslint/eslint-plugin": "^8.9.0",
91
- "@typescript-eslint/parser": "^8.9.0",
90
+ "@typescript-eslint/eslint-plugin": "^8.10.0",
91
+ "@typescript-eslint/parser": "^8.10.0",
92
92
  "jest": "^29.7.0",
93
93
  "jest-environment-jsdom": "^29.7.0",
94
94
  "typescript": "^5.6.3"
@@ -421,16 +421,10 @@ export class ReactApp<
421
421
 
422
422
  /**
423
423
  * Try login
424
- * @param showLoading Show loading bar or not
424
+ * @param data Try login parameters
425
425
  * @returns Result
426
426
  */
427
- override async tryLogin(params?: AppTryLoginParams) {
428
- // Check status
429
- const result = await super.tryLogin(params);
430
- if (!result) {
431
- return false;
432
- }
433
-
427
+ override async tryLogin(data?: AppTryLoginParams) {
434
428
  // Destruct
435
429
  const {
436
430
  onFailure = () => {
@@ -438,12 +432,19 @@ export class ReactApp<
438
432
  },
439
433
  onSuccess,
440
434
  ...rest
441
- } = params ?? {};
435
+ } = data ?? {};
436
+
437
+ // Check status
438
+ const result = await super.tryLogin(data);
439
+ if (!result) {
440
+ onFailure();
441
+ return false;
442
+ }
442
443
 
443
444
  // Refresh token
444
445
  await this.refreshToken(
445
446
  {
446
- showLoading: params?.showLoading
447
+ showLoading: data?.showLoading
447
448
  },
448
449
  (result) => {
449
450
  if (result === true) {
@@ -76,11 +76,11 @@ export class ServiceApp<
76
76
 
77
77
  /**
78
78
  * Go to the login page
79
- * @params Login parameters
79
+ * @param data Login parameters
80
80
  */
81
- override toLoginPage(params?: AppLoginParams) {
81
+ override toLoginPage(data?: AppLoginParams) {
82
82
  // Destruct
83
- const { removeUrl, showLoading, ...rest } = params ?? {};
83
+ const { removeUrl, showLoading, params } = data ?? {};
84
84
 
85
85
  // Cache current URL
86
86
  this.cachedUrl = removeUrl ? undefined : globalThis.location.href;
@@ -95,7 +95,9 @@ export class ServiceApp<
95
95
  if (!url) return;
96
96
 
97
97
  // Add try login flag
98
- url = url.addUrlParams(rest);
98
+ if (params != null) {
99
+ url = url.addUrlParams(params);
100
+ }
99
101
 
100
102
  // Is it embeded?
101
103
  if (this.embedded) {