@etsoo/materialui 1.4.4 → 1.4.6

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.
Files changed (39) hide show
  1. package/lib/AddresSelector.d.ts +3 -2
  2. package/lib/AddresSelector.js +3 -3
  3. package/lib/HiSelector.d.ts +3 -3
  4. package/lib/HiSelector.js +2 -2
  5. package/lib/HiSelectorTL.d.ts +3 -3
  6. package/lib/HiSelectorTL.js +2 -2
  7. package/lib/ResponsiveStyleValue.d.ts +7 -0
  8. package/lib/ResponsiveStyleValue.js +1 -0
  9. package/lib/app/CommonApp.d.ts +2 -7
  10. package/lib/app/CommonApp.js +13 -70
  11. package/lib/app/ReactApp.d.ts +1 -2
  12. package/lib/app/ReactApp.js +2 -3
  13. package/lib/app/ServiceApp.d.ts +5 -7
  14. package/lib/app/ServiceApp.js +12 -9
  15. package/lib/custom/CustomFieldUtils.d.ts +8 -2
  16. package/lib/custom/CustomFieldUtils.js +5 -5
  17. package/lib/custom/CustomFieldViewer.d.ts +2 -2
  18. package/lib/custom/CustomFieldViewer.js +3 -3
  19. package/lib/custom/CustomFieldWindow.d.ts +2 -2
  20. package/lib/custom/CustomFieldWindow.js +2 -2
  21. package/lib/index.d.ts +1 -0
  22. package/lib/index.js +1 -0
  23. package/lib/pages/EditPage.js +2 -2
  24. package/lib/pages/ViewPage.d.ts +3 -3
  25. package/lib/pages/ViewPage.js +7 -6
  26. package/package.json +8 -8
  27. package/src/AddresSelector.tsx +13 -13
  28. package/src/HiSelector.tsx +13 -13
  29. package/src/HiSelectorTL.tsx +14 -13
  30. package/src/ResponsiveStyleValue.ts +11 -0
  31. package/src/app/CommonApp.ts +16 -99
  32. package/src/app/ReactApp.ts +2 -8
  33. package/src/app/ServiceApp.ts +14 -14
  34. package/src/custom/CustomFieldUtils.tsx +10 -11
  35. package/src/custom/CustomFieldViewer.tsx +7 -8
  36. package/src/custom/CustomFieldWindow.tsx +4 -4
  37. package/src/index.ts +1 -0
  38. package/src/pages/EditPage.tsx +10 -5
  39. package/src/pages/ViewPage.tsx +26 -25
@@ -2,7 +2,7 @@ import { createElement as _createElement } from "react";
2
2
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { ScrollRestoration } from "@etsoo/react";
4
4
  import { DateUtils, Utils } from "@etsoo/shared";
5
- import { Grid, LinearProgress, Stack, Typography } from "@mui/material";
5
+ import { Grid2, LinearProgress, Stack, Typography } from "@mui/material";
6
6
  import React from "react";
7
7
  import { Labels } from "../app/Labels";
8
8
  import { globalApp } from "../app/ReactApp";
@@ -22,14 +22,14 @@ export function ViewPageGridItem(props) {
22
22
  const { data, label, singleRow, ...gridProps } = props;
23
23
  // Default options
24
24
  let options = {};
25
- if (gridProps.xs == null && gridProps.md == null) {
25
+ if (gridProps.size == null) {
26
26
  options = getResp(singleRow ?? "small");
27
27
  }
28
28
  else if (singleRow != null) {
29
29
  options = getResp(singleRow ?? "small");
30
30
  }
31
31
  // Layout
32
- return (_jsxs(Grid, { item: true, ...gridProps, ...options, children: [label != null && (_jsxs(Typography, { variant: "caption", component: "div", children: [label, ":"] })), typeof data === "object" ? (data) : (_jsx(Typography, { variant: "subtitle2", children: data }))] }));
32
+ return (_jsxs(Grid2, { ...gridProps, ...options, children: [label != null && (_jsxs(Typography, { variant: "caption", component: "div", children: [label, ":"] })), typeof data === "object" ? (data) : (_jsx(Typography, { variant: "subtitle2", children: data }))] }));
33
33
  }
34
34
  function formatItemData(fieldData) {
35
35
  if (fieldData == null)
@@ -43,7 +43,7 @@ function formatItemData(fieldData) {
43
43
  return `${fieldData}`;
44
44
  }
45
45
  function getResp(singleRow) {
46
- return typeof singleRow === "object"
46
+ const size = typeof singleRow === "object"
47
47
  ? singleRow
48
48
  : singleRow === "medium"
49
49
  ? { xs: 12, sm: 12, md: 6, lg: 4, xl: 3 }
@@ -56,6 +56,7 @@ function getResp(singleRow) {
56
56
  lg: 3,
57
57
  xl: 2
58
58
  };
59
+ return { size };
59
60
  }
60
61
  function getItemField(field, data) {
61
62
  // Item data and label
@@ -129,7 +130,7 @@ export function ViewPage(props) {
129
130
  refresh,
130
131
  operationMessageHandler.id
131
132
  ]
132
- : operationMessageHandler })), _jsx(Grid, { container: true, justifyContent: "left", spacing: spacing, className: "ET-ViewPage", ref: gridRef, sx: {
133
+ : operationMessageHandler })), _jsx(Grid2, { container: true, justifyContent: "left", spacing: spacing, className: "ET-ViewPage", ref: gridRef, sx: {
133
134
  ".MuiTypography-subtitle2": {
134
135
  fontWeight: "bold"
135
136
  }
@@ -144,7 +145,7 @@ export function ViewPage(props) {
144
145
  if (itemData == null || itemData === "")
145
146
  return undefined;
146
147
  // Layout
147
- return (_createElement(ViewPageGridItem, { item: true, ...gridProps, key: index, data: itemData, label: itemLabel }));
148
+ return (_createElement(ViewPageGridItem, { ...gridProps, key: index, data: itemData, label: itemLabel }));
148
149
  }) }), actions !== null && (_jsx(Stack, { className: "ET-ViewPage-Actions", direction: "row", width: "100%", flexWrap: "wrap", justifyContent: "flex-end", paddingTop: actions == null ? undefined : paddings, paddingBottom: paddings, gap: paddings, children: actions != null && Utils.getResult(actions, data, refresh) })), Utils.getResult(children, data, refresh), pullToRefresh && (_jsx(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: refresh, shouldPullToRefresh: () => {
149
150
  const container = document.querySelector(pullContainer);
150
151
  return !container?.scrollTop;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,14 +50,14 @@
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.39",
53
+ "@etsoo/appscript": "^1.5.47",
54
54
  "@etsoo/notificationbase": "^1.1.49",
55
- "@etsoo/react": "^1.7.75",
55
+ "@etsoo/react": "^1.7.80",
56
56
  "@etsoo/shared": "^1.2.48",
57
- "@mui/icons-material": "^6.1.3",
58
- "@mui/material": "^6.1.3",
57
+ "@mui/icons-material": "^6.1.4",
58
+ "@mui/material": "^6.1.4",
59
59
  "@mui/x-data-grid": "^7.20.0",
60
- "chart.js": "^4.4.4",
60
+ "chart.js": "^4.4.5",
61
61
  "chartjs-plugin-datalabels": "^2.2.0",
62
62
  "eventemitter3": "^5.0.1",
63
63
  "pica": "^9.0.1",
@@ -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.8.1",
91
- "@typescript-eslint/parser": "^8.8.1",
90
+ "@typescript-eslint/eslint-plugin": "^8.9.0",
91
+ "@typescript-eslint/parser": "^8.9.0",
92
92
  "jest": "^29.7.0",
93
93
  "jest-environment-jsdom": "^29.7.0",
94
94
  "typescript": "^5.6.3"
@@ -5,12 +5,12 @@ import {
5
5
  AddressRegionDb,
6
6
  AddressState
7
7
  } from "@etsoo/appscript";
8
- import { FormLabel, Grid } from "@mui/material";
8
+ import { FormLabel, Grid2, GridSize } from "@mui/material";
9
9
  import React from "react";
10
10
  import { globalApp } from "./app/ReactApp";
11
11
  import { ComboBox } from "./ComboBox";
12
12
  import { Tiplist } from "./Tiplist";
13
- import { RegularBreakpoints } from "@mui/material/Grid";
13
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
14
14
 
15
15
  /**
16
16
  * Address field
@@ -48,7 +48,7 @@ export type AddressSelectorProps = {
48
48
  /**
49
49
  * Break points
50
50
  */
51
- breakPoints?: RegularBreakpoints;
51
+ breakPoints?: ResponsiveStyleValue<GridSize>;
52
52
 
53
53
  /**
54
54
  * City
@@ -287,17 +287,17 @@ export function AddressSelector(props: AddressSelectorProps) {
287
287
  return (
288
288
  <React.Fragment>
289
289
  {label && (
290
- <Grid item xs={12}>
290
+ <Grid2 size={{ xs: 12 }}>
291
291
  <FormLabel
292
292
  required={required}
293
293
  sx={{ fontSize: (theme) => theme.typography.caption }}
294
294
  >
295
295
  {label}
296
296
  </FormLabel>
297
- </Grid>
297
+ </Grid2>
298
298
  )}
299
299
  {!hideRegion && (
300
- <Grid item {...breakPoints}>
300
+ <Grid2 size={breakPoints}>
301
301
  <Tiplist<AddressRegionDb>
302
302
  label={regionLabel}
303
303
  name={AddressField.Region}
@@ -322,9 +322,9 @@ export function AddressSelector(props: AddressSelectorProps) {
322
322
  handleChange([AddressField.Region, value])
323
323
  }
324
324
  />
325
- </Grid>
325
+ </Grid2>
326
326
  )}
327
- <Grid item {...breakPoints}>
327
+ <Grid2 size={breakPoints}>
328
328
  <ComboBox<AddressState>
329
329
  name={AddressField.State}
330
330
  label={stateLabel}
@@ -339,8 +339,8 @@ export function AddressSelector(props: AddressSelectorProps) {
339
339
  handleChange([AddressField.State, value])
340
340
  }
341
341
  />
342
- </Grid>
343
- <Grid item {...breakPoints}>
342
+ </Grid2>
343
+ <Grid2 size={breakPoints}>
344
344
  <ComboBox<AddressCity>
345
345
  name={AddressField.City}
346
346
  label={cityLabel}
@@ -350,8 +350,8 @@ export function AddressSelector(props: AddressSelectorProps) {
350
350
  options={cities}
351
351
  onChange={(_event, value) => handleChange([AddressField.City, value])}
352
352
  />
353
- </Grid>
354
- <Grid item {...breakPoints}>
353
+ </Grid2>
354
+ <Grid2 size={breakPoints}>
355
355
  <ComboBox<AddressDistrict>
356
356
  name={AddressField.District}
357
357
  label={districtLabel}
@@ -363,7 +363,7 @@ export function AddressSelector(props: AddressSelectorProps) {
363
363
  handleChange([AddressField.District, value])
364
364
  }
365
365
  />
366
- </Grid>
366
+ </Grid2>
367
367
  </React.Fragment>
368
368
  );
369
369
  }
@@ -1,8 +1,8 @@
1
1
  import { DataTypes, IdDefaultType, LabelDefaultType } from "@etsoo/shared";
2
- import { FormLabel, Grid, SelectChangeEvent } from "@mui/material";
2
+ import { FormLabel, Grid2, GridSize, SelectChangeEvent } from "@mui/material";
3
3
  import React from "react";
4
4
  import { SelectEx } from "./SelectEx";
5
- import { RegularBreakpoints } from "@mui/material/Grid";
5
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
6
6
 
7
7
  /**
8
8
  * Hierarchy selector props
@@ -15,7 +15,7 @@ export type HiSelectorProps<
15
15
  /**
16
16
  * Break points
17
17
  */
18
- breakPoints?: RegularBreakpoints;
18
+ breakPoints?: ResponsiveStyleValue<GridSize>;
19
19
 
20
20
  /**
21
21
  * Id field
@@ -161,17 +161,17 @@ export function HiSelector<
161
161
  return (
162
162
  <React.Fragment>
163
163
  {label && (
164
- <Grid item xs={12}>
164
+ <Grid2 size={{ xs: 12 }}>
165
165
  <FormLabel
166
166
  required={required}
167
167
  sx={{ fontSize: (theme) => theme.typography.caption }}
168
168
  >
169
169
  {label}
170
170
  </FormLabel>
171
- </Grid>
171
+ </Grid2>
172
172
  )}
173
173
  <input type="hidden" name={name} value={`${currentValue ?? ""}`} />
174
- <Grid item {...breakPoints}>
174
+ <Grid2 size={breakPoints}>
175
175
  <SelectEx<T, D, L>
176
176
  idField={idField}
177
177
  label={labels[0]}
@@ -188,9 +188,9 @@ export function HiSelector<
188
188
  helperText={helperText}
189
189
  variant={variant}
190
190
  />
191
- </Grid>
191
+ </Grid2>
192
192
  {localValues[0] != null && (
193
- <Grid item {...breakPoints}>
193
+ <Grid2 size={breakPoints}>
194
194
  <SelectEx<T, D, L>
195
195
  key={`${localValues[0]}`}
196
196
  idField={idField}
@@ -205,10 +205,10 @@ export function HiSelector<
205
205
  onItemChange={doItemChange}
206
206
  variant={variant}
207
207
  />
208
- </Grid>
208
+ </Grid2>
209
209
  )}
210
210
  {localValues[1] != null && (
211
- <Grid item {...breakPoints}>
211
+ <Grid2 size={breakPoints}>
212
212
  <SelectEx<T, D, L>
213
213
  key={`${localValues[1]}`}
214
214
  idField={idField}
@@ -223,10 +223,10 @@ export function HiSelector<
223
223
  onItemChange={doItemChange}
224
224
  variant={variant}
225
225
  />
226
- </Grid>
226
+ </Grid2>
227
227
  )}
228
228
  {localValues[2] != null && (
229
- <Grid item {...breakPoints}>
229
+ <Grid2 size={breakPoints}>
230
230
  <SelectEx<T, D, L>
231
231
  key={`${localValues[2]}`}
232
232
  idField={idField}
@@ -241,7 +241,7 @@ export function HiSelector<
241
241
  onItemChange={doItemChange}
242
242
  variant={variant}
243
243
  />
244
- </Grid>
244
+ </Grid2>
245
245
  )}
246
246
  </React.Fragment>
247
247
  );
@@ -3,11 +3,12 @@ import {
3
3
  AutocompleteChangeReason,
4
4
  AutocompleteValue,
5
5
  FormLabel,
6
- Grid
6
+ Grid2,
7
+ GridSize
7
8
  } from "@mui/material";
8
9
  import React from "react";
9
10
  import { Tiplist } from "./Tiplist";
10
- import { RegularBreakpoints } from "@mui/material/Grid";
11
+ import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
11
12
 
12
13
  /**
13
14
  * Hierarchy tiplist selector props
@@ -19,7 +20,7 @@ export type HiSelectorTLProps<
19
20
  /**
20
21
  * Break points
21
22
  */
22
- breakPoints?: RegularBreakpoints;
23
+ breakPoints?: ResponsiveStyleValue<GridSize>;
23
24
 
24
25
  /**
25
26
  * Id field
@@ -154,17 +155,17 @@ export function HiSelectorTL<
154
155
  return (
155
156
  <React.Fragment>
156
157
  {label && (
157
- <Grid item xs={12}>
158
+ <Grid2 size={{ xs: 12 }}>
158
159
  <FormLabel
159
160
  required={required}
160
161
  sx={{ fontSize: (theme) => theme.typography.caption }}
161
162
  >
162
163
  {label}
163
164
  </FormLabel>
164
- </Grid>
165
+ </Grid2>
165
166
  )}
166
167
  <input type="hidden" name={name} value={`${currentValue ?? ""}`} />
167
- <Grid item {...breakPoints}>
168
+ <Grid2 size={breakPoints}>
168
169
  <Tiplist<T, D>
169
170
  idField={idField}
170
171
  label={labels[0]}
@@ -178,9 +179,9 @@ export function HiSelectorTL<
178
179
  inputHelperText={helperText}
179
180
  onChange={(event, value, reason) => doChange(0, event, value, reason)}
180
181
  />
181
- </Grid>
182
+ </Grid2>
182
183
  {localValues[0] != null && (
183
- <Grid item {...breakPoints}>
184
+ <Grid2 size={breakPoints}>
184
185
  <Tiplist<T, D>
185
186
  key={`${localValues[0]}`}
186
187
  label={labels[1]}
@@ -196,10 +197,10 @@ export function HiSelectorTL<
196
197
  doChange(1, event, value, reason)
197
198
  }
198
199
  />
199
- </Grid>
200
+ </Grid2>
200
201
  )}
201
202
  {localValues[1] != null && (
202
- <Grid item {...breakPoints}>
203
+ <Grid2 size={breakPoints}>
203
204
  <Tiplist<T, D>
204
205
  key={`${localValues[1]}`}
205
206
  label={labels[2]}
@@ -215,10 +216,10 @@ export function HiSelectorTL<
215
216
  doChange(2, event, value, reason)
216
217
  }
217
218
  />
218
- </Grid>
219
+ </Grid2>
219
220
  )}
220
221
  {localValues[2] != null && (
221
- <Grid item {...breakPoints}>
222
+ <Grid2 size={breakPoints}>
222
223
  <Tiplist<T, D>
223
224
  key={`${localValues[2]}`}
224
225
  label={labels[3]}
@@ -234,7 +235,7 @@ export function HiSelectorTL<
234
235
  doChange(3, event, value, reason)
235
236
  }
236
237
  />
237
- </Grid>
238
+ </Grid2>
238
239
  )}
239
240
  </React.Fragment>
240
241
  );
@@ -0,0 +1,11 @@
1
+ import { Breakpoint } from "@mui/material";
2
+
3
+ /**
4
+ * Responsive style value
5
+ */
6
+ export type ResponsiveStyleValue<T> =
7
+ | T
8
+ | Array<T | null>
9
+ | {
10
+ [key in Breakpoint]?: T | null;
11
+ };
@@ -1,14 +1,6 @@
1
- import {
2
- IApiPayload,
3
- IAppSettings,
4
- IUser,
5
- RefreshTokenProps,
6
- RefreshTokenResult,
7
- RefreshTokenRQ
8
- } from "@etsoo/appscript";
1
+ import { AppLoginParams, IAppSettings, IUser } from "@etsoo/appscript";
9
2
  import { CoreConstants, IPageData } from "@etsoo/react";
10
3
  import { ReactApp } from "./ReactApp";
11
- import { IActionResult } from "@etsoo/shared";
12
4
 
13
5
  /**
14
6
  * Common independent application
@@ -36,102 +28,27 @@ export abstract class CommonApp<
36
28
  return fields;
37
29
  }
38
30
 
39
- /**
40
- * Refresh token
41
- * @param props Props
42
- */
43
- override async refreshToken(props?: RefreshTokenProps) {
44
- // Destruct
45
- const { callback, showLoading = false } = props ?? {};
46
-
47
- // Token
48
- const token = this.getCacheToken();
49
- if (token == null || token === "") {
50
- if (callback) callback(false);
51
- return false;
52
- }
53
-
54
- // Reqest data
55
- const rq: RefreshTokenRQ = {
56
- deviceId: this.deviceId
57
- };
58
-
59
- // Login result type
60
- type LoginResult = IActionResult<U>;
61
-
62
- // Payload
63
- const payload: IApiPayload<LoginResult, any> = {
64
- // No loading bar needed to avoid screen flicks
65
- showLoading,
66
- config: { headers: { [CoreConstants.TokenHeaderRefresh]: token } },
67
- onError: (error) => {
68
- if (callback) callback(error);
69
-
70
- // Prevent further processing
71
- return false;
72
- }
73
- };
74
-
75
- // Success callback
76
- const success = (
77
- result: LoginResult,
78
- failCallback?: (result: RefreshTokenResult) => void
79
- ) => {
80
- // Token
81
- const refreshToken = this.getResponseToken(payload.response);
82
- if (refreshToken == null || result.data == null) {
83
- if (failCallback) failCallback(this.get("noData")!);
84
- return false;
85
- }
86
-
87
- // Keep
88
- const keep = this.storage.getData(CoreConstants.FieldLoginKeep, false);
89
-
90
- // User login
91
- this.userLogin(result.data, refreshToken, keep);
92
-
93
- // Callback
94
- if (failCallback) failCallback(true);
95
-
96
- return true;
97
- };
98
-
99
- // Call API
100
- const result = await this.api.put<LoginResult>(
101
- "Auth/RefreshToken",
102
- rq,
103
- payload
104
- );
105
-
106
- if (result == null) return false;
107
-
108
- if (!result.ok) {
109
- // Remove the wrong token
110
- this.clearCacheToken();
111
-
112
- // Callback
113
- if (callback) callback(result);
114
-
115
- return false;
116
- }
117
-
118
- return success(result, callback);
119
- }
120
-
121
31
  /**
122
32
  * Try login
123
33
  * @param showLoading Show loading bar or not
124
34
  * @returns Result
125
35
  */
126
- override async tryLogin(showLoading?: boolean) {
127
- // Reset user state
128
- const result = await super.tryLogin(showLoading);
129
- if (!result) return false;
36
+ override async tryLogin(params?: AppLoginParams) {
37
+ // Check status
38
+ if (this.isTryingLogin) return;
39
+ this.isTryingLogin = true;
130
40
 
131
41
  // Refresh token
132
- return await this.refreshToken({
133
- callback: (result) => this.doRefreshTokenResult(result),
134
- showLoading
135
- });
42
+ await this.refreshToken(
43
+ {
44
+ showLoading: params?.showLoading
45
+ },
46
+ (result) => {
47
+ if (result) {
48
+ } else {
49
+ this.toLoginPage(params);
50
+ }
51
+ }
52
+ );
136
53
  }
137
54
  }
@@ -494,17 +494,11 @@ export class ReactApp<
494
494
  * User login extended
495
495
  * @param user New user
496
496
  * @param refreshToken Refresh token
497
- * @param keep Keep in local storage or not
498
497
  * @param dispatch User state dispatch
499
498
  */
500
- override userLogin(
501
- user: D,
502
- refreshToken: string,
503
- keep?: boolean,
504
- dispatch?: boolean
505
- ): void {
499
+ override userLogin(user: D, refreshToken: string, dispatch?: boolean): void {
506
500
  // Super call, set token
507
- super.userLogin(user, refreshToken, keep);
501
+ super.userLogin(user, refreshToken);
508
502
 
509
503
  // Dispatch action
510
504
  if (this.userStateDispatch != null && dispatch !== false)
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  ApiRefreshTokenDto,
3
+ AppLoginParams,
3
4
  AuthApi,
4
5
  BridgeUtils,
5
6
  ExternalEndpoint,
@@ -12,6 +13,7 @@ import { IServiceUser, ServiceUserToken } from "./IServiceUser";
12
13
  import { ReactApp } from "./ReactApp";
13
14
 
14
15
  const coreName = "core";
16
+ const coreTokenKey = "core-refresh-token";
15
17
 
16
18
  /**
17
19
  * Core Service App
@@ -73,10 +75,12 @@ export class ServiceApp<
73
75
 
74
76
  /**
75
77
  * Go to the login page
76
- * @param tryLogin Try to login again
77
- * @param removeUrl Remove current URL for reuse
78
+ * @params Login parameters
78
79
  */
79
- override toLoginPage(tryLogin?: boolean, removeUrl?: boolean) {
80
+ override toLoginPage(params?: AppLoginParams) {
81
+ // Destruct
82
+ const { removeUrl, showLoading, ...rest } = params ?? {};
83
+
80
84
  // Cache current URL
81
85
  this.cachedUrl = removeUrl ? undefined : globalThis.location.href;
82
86
 
@@ -90,7 +94,7 @@ export class ServiceApp<
90
94
  if (!url) return;
91
95
 
92
96
  // Add try login flag
93
- url = url.addUrlParam("tryLogin", tryLogin ?? false);
97
+ url = url.addUrlParams(rest);
94
98
 
95
99
  // Is it embeded?
96
100
  if (this.embedded) {
@@ -112,15 +116,9 @@ export class ServiceApp<
112
116
  * User login extended
113
117
  * @param user New user
114
118
  * @param refreshToken Refresh token
115
- * @param keep Keep in local storage or not
116
119
  * @param dispatch User state dispatch
117
120
  */
118
- override userLogin(
119
- user: U,
120
- refreshToken: string,
121
- keep?: boolean,
122
- dispatch?: boolean
123
- ): void {
121
+ override userLogin(user: U, refreshToken: string, dispatch?: boolean): void {
124
122
  if (user.clientDeviceId && user.passphrase) {
125
123
  // Save the passphrase
126
124
  // Interpolated string expressions are different between TypeScript and C# for the null value
@@ -135,7 +133,7 @@ export class ServiceApp<
135
133
  }
136
134
 
137
135
  // Super call, set token
138
- super.userLogin(user, refreshToken, keep, dispatch);
136
+ super.userLogin(user, refreshToken, dispatch);
139
137
  }
140
138
 
141
139
  /**
@@ -148,12 +146,11 @@ export class ServiceApp<
148
146
  userLoginEx(
149
147
  user: U & ServiceUserToken,
150
148
  core?: ApiRefreshTokenDto,
151
- keep?: boolean,
152
149
  dispatch?: boolean
153
150
  ) {
154
151
  // User login
155
152
  const { refreshToken } = user;
156
- this.userLogin(user, refreshToken, keep, dispatch);
153
+ this.userLogin(user, refreshToken, dispatch);
157
154
 
158
155
  // Core system login
159
156
  core ??= {
@@ -163,6 +160,9 @@ export class ServiceApp<
163
160
  expiresIn: user.seconds
164
161
  };
165
162
 
163
+ // Cache the core system refresh token
164
+ this.storage.setData(coreTokenKey, core.refreshToken);
165
+
166
166
  this.exchangeTokenAll(core, coreName);
167
167
  }
168
168
  }