@etsoo/materialui 1.3.42 → 1.3.43

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 (82) hide show
  1. package/__tests__/tsconfig.json +17 -17
  2. package/lib/AddresSelector.js +1 -2
  3. package/lib/AuditDisplay.js +2 -3
  4. package/lib/BridgeCloseButton.js +1 -2
  5. package/lib/ComboBox.js +5 -5
  6. package/lib/ComboBoxMultiple.js +7 -8
  7. package/lib/ComboBoxPro.js +1 -2
  8. package/lib/CultureDataTable.js +2 -2
  9. package/lib/DataGridEx.d.ts +2 -3
  10. package/lib/DataGridEx.js +12 -14
  11. package/lib/DataGridRenderers.js +6 -6
  12. package/lib/DataSteps.js +1 -2
  13. package/lib/DataTable.js +1 -2
  14. package/lib/DialogButton.js +2 -3
  15. package/lib/DnDList.js +1 -1
  16. package/lib/EmailInput.js +1 -2
  17. package/lib/FileUploadButton.js +1 -1
  18. package/lib/GridDataFormat.js +5 -5
  19. package/lib/GridUtils.js +1 -2
  20. package/lib/HiSelector.js +1 -1
  21. package/lib/HiSelectorTL.js +1 -1
  22. package/lib/InputField.js +4 -5
  23. package/lib/InputTipField.js +1 -1
  24. package/lib/ItemList.js +2 -3
  25. package/lib/ListChooser.js +4 -5
  26. package/lib/LoadingButton.js +1 -2
  27. package/lib/MaskInput.js +2 -3
  28. package/lib/NotifierMU.js +14 -19
  29. package/lib/OptionBool.js +1 -2
  30. package/lib/OptionGroup.js +3 -4
  31. package/lib/OptionGroupFlag.js +1 -1
  32. package/lib/QuickList.js +2 -2
  33. package/lib/ResponsibleContainer.d.ts +3 -3
  34. package/lib/ResponsibleContainer.js +3 -3
  35. package/lib/ScrollerListEx.d.ts +6 -7
  36. package/lib/ScrollerListEx.js +30 -36
  37. package/lib/SearchField.js +3 -4
  38. package/lib/SelectBool.js +1 -2
  39. package/lib/SelectEx.js +6 -8
  40. package/lib/ShowDataComparison.js +3 -4
  41. package/lib/Switch.js +1 -2
  42. package/lib/SwitchAnt.js +6 -7
  43. package/lib/TableEx.js +5 -7
  44. package/lib/TagList.js +3 -5
  45. package/lib/TagListPro.js +3 -5
  46. package/lib/TextFieldEx.js +2 -2
  47. package/lib/Tiplist.js +6 -8
  48. package/lib/TiplistPro.js +9 -10
  49. package/lib/TooltipClick.js +2 -2
  50. package/lib/TwoFieldInput.js +1 -1
  51. package/lib/UserAvatar.js +1 -2
  52. package/lib/UserAvatarEditor.js +4 -6
  53. package/lib/app/CommonApp.js +1 -1
  54. package/lib/app/ReactApp.js +4 -6
  55. package/lib/app/ServiceApp.js +5 -7
  56. package/lib/pages/DataGridPage.d.ts +2 -2
  57. package/lib/pages/DataGridPage.js +2 -3
  58. package/lib/pages/DataGridPageProps.d.ts +2 -2
  59. package/lib/pages/FixedListPage.d.ts +2 -2
  60. package/lib/pages/FixedListPage.js +2 -3
  61. package/lib/pages/LeftDrawer.js +2 -3
  62. package/lib/pages/ListPage.d.ts +2 -2
  63. package/lib/pages/ListPage.js +2 -3
  64. package/lib/pages/ListPageProps.d.ts +1 -1
  65. package/lib/pages/ResponsivePage.d.ts +2 -2
  66. package/lib/pages/ResponsivePage.js +1 -2
  67. package/lib/pages/ResponsivePageProps.d.ts +2 -2
  68. package/lib/pages/TablePage.js +3 -5
  69. package/lib/pages/UserMenu.js +1 -2
  70. package/lib/pages/ViewPage.js +6 -7
  71. package/package.json +14 -12
  72. package/src/DataGridEx.tsx +6 -12
  73. package/src/ResponsibleContainer.tsx +7 -9
  74. package/src/ScrollerListEx.tsx +301 -311
  75. package/src/pages/DataGridPage.tsx +4 -5
  76. package/src/pages/DataGridPageProps.ts +3 -4
  77. package/src/pages/FixedListPage.tsx +4 -5
  78. package/src/pages/ListPage.tsx +4 -5
  79. package/src/pages/ListPageProps.ts +2 -3
  80. package/src/pages/ResponsivePage.tsx +4 -5
  81. package/src/pages/ResponsivePageProps.ts +2 -3
  82. package/tsconfig.json +3 -3
package/lib/TagList.js CHANGED
@@ -5,9 +5,8 @@ import React from "react";
5
5
  import { InputField } from "./InputField";
6
6
  import { globalApp } from "./app/ReactApp";
7
7
  export function TagList(props) {
8
- var _a;
9
8
  // Labels
10
- const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more", "open")) !== null && _a !== void 0 ? _a : {};
9
+ const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = globalApp?.getLabels("noOptions", "loading", "more", "open") ?? {};
11
10
  const moreLabel = more + "...";
12
11
  // Destruct
13
12
  const { renderOption = (props, option, { selected }) => (React.createElement("li", { ...props },
@@ -17,11 +16,10 @@ export function TagList(props) {
17
16
  const [options, setOptions] = React.useState([]);
18
17
  const [loading, setLoading] = React.useState(false);
19
18
  const currentValue = React.useRef([]);
20
- currentValue.current = value !== null && value !== void 0 ? value : [];
19
+ currentValue.current = value ?? [];
21
20
  const loadDataLocal = async (keyword) => {
22
- var _a;
23
21
  setLoading(true);
24
- const result = (_a = (await loadData(keyword, maxItems))) !== null && _a !== void 0 ? _a : [];
22
+ const result = (await loadData(keyword, maxItems)) ?? [];
25
23
  const len = result.length;
26
24
  currentValue.current.forEach((item) => {
27
25
  if (!result.includes(item))
package/lib/TagListPro.js CHANGED
@@ -6,9 +6,8 @@ import { InputField } from "./InputField";
6
6
  import { globalApp } from "./app/ReactApp";
7
7
  import { DataTypes } from "@etsoo/shared";
8
8
  export function TagListPro(props) {
9
- var _a;
10
9
  // Labels
11
- const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more", "open")) !== null && _a !== void 0 ? _a : {};
10
+ const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = globalApp?.getLabels("noOptions", "loading", "more", "open") ?? {};
12
11
  const moreLabel = more + "...";
13
12
  const getLabel = (item) => DataTypes.getListItemLabel(item);
14
13
  // Destruct
@@ -20,11 +19,10 @@ export function TagListPro(props) {
20
19
  const [options, setOptions] = React.useState([]);
21
20
  const [loading, setLoading] = React.useState(false);
22
21
  const currentValue = React.useRef([]);
23
- currentValue.current = value !== null && value !== void 0 ? value : [];
22
+ currentValue.current = value ?? [];
24
23
  const loadDataLocal = async (keyword) => {
25
- var _a;
26
24
  setLoading(true);
27
- const result = (_a = (await loadData(keyword, maxItems))) !== null && _a !== void 0 ? _a : [];
25
+ const result = (await loadData(keyword, maxItems)) ?? [];
28
26
  const len = result.length;
29
27
  currentValue.current.forEach((item) => {
30
28
  if (!result.some((r) => r.id === item.id))
@@ -121,12 +121,12 @@ export const TextFieldEx = React.forwardRef((props, ref) => {
121
121
  onChange(event);
122
122
  return;
123
123
  }
124
- delayed === null || delayed === void 0 ? void 0 : delayed.call(undefined, event);
124
+ delayed?.call(undefined, event);
125
125
  };
126
126
  React.useEffect(() => {
127
127
  return () => {
128
128
  isMounted.current = false;
129
- delayed === null || delayed === void 0 ? void 0 : delayed.clear();
129
+ delayed?.clear();
130
130
  };
131
131
  }, []);
132
132
  // Textfield
package/lib/Tiplist.js CHANGED
@@ -11,9 +11,8 @@ import { InputField } from "./InputField";
11
11
  * @returns Component
12
12
  */
13
13
  export function Tiplist(props) {
14
- var _a;
15
14
  // Labels
16
- const { noOptions, loading, more, open: openDefault } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more", "open")) !== null && _a !== void 0 ? _a : {};
15
+ const { noOptions, loading, more, open: openDefault } = globalApp?.getLabels("noOptions", "loading", "more", "open") ?? {};
17
16
  // Destruct
18
17
  const { search = false, idField = "id", idValue, inputAutoComplete = "off", inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, label, loadData, defaultValue, value, maxItems = 16, width = search ? 160 : undefined, name, readOnly, onChange, onValueChange, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionLabel, getOptionDisabled, sx = {}, ...rest } = props;
19
18
  if (width && sx)
@@ -21,9 +20,9 @@ export function Tiplist(props) {
21
20
  // Value input ref
22
21
  const inputRef = React.createRef();
23
22
  // Local value
24
- let localValue = value !== null && value !== void 0 ? value : defaultValue;
23
+ let localValue = value ?? defaultValue;
25
24
  // One time calculation for input's default value (uncontrolled)
26
- const localIdValue = idValue !== null && idValue !== void 0 ? idValue : DataTypes.getValue(localValue, idField);
25
+ const localIdValue = idValue ?? DataTypes.getValue(localValue, idField);
27
26
  // Changable states
28
27
  const [states, stateUpdate] = React.useReducer((currentState, newState) => {
29
28
  return { ...currentState, ...newState };
@@ -112,13 +111,12 @@ export function Tiplist(props) {
112
111
  };
113
112
  const delayed = useDelayedExecutor(loadDataDirect, 480);
114
113
  const setInputValue = (value) => {
115
- var _a;
116
114
  stateUpdate({ value });
117
115
  // Input value
118
116
  const input = inputRef.current;
119
117
  if (input) {
120
118
  // Update value
121
- const newValue = (_a = DataTypes.getStringValue(value, idField)) !== null && _a !== void 0 ? _a : "";
119
+ const newValue = DataTypes.getStringValue(value, idField) ?? "";
122
120
  if (newValue !== input.value) {
123
121
  // Different value, trigger change event
124
122
  ReactUtils.triggerChange(input, newValue, false);
@@ -166,7 +164,7 @@ export function Tiplist(props) {
166
164
  }, []);
167
165
  // Layout
168
166
  return (React.createElement("div", null,
169
- React.createElement("input", { ref: inputRef, "data-reset": inputReset !== null && inputReset !== void 0 ? inputReset : true, type: "text", style: { display: "none" }, name: name, value: `${inputValue !== null && inputValue !== void 0 ? inputValue : (state.current.idSet ? "" : localIdValue !== null && localIdValue !== void 0 ? localIdValue : "")}`, readOnly: true, onChange: inputOnChange }),
167
+ React.createElement("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange }),
170
168
  React.createElement(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
171
169
  // Set value
172
170
  setInputValue(value);
@@ -200,7 +198,7 @@ export function Tiplist(props) {
200
198
  if (typeof item !== "object")
201
199
  return `${item}`;
202
200
  if (item[idField] === "n/a")
203
- return (more !== null && more !== void 0 ? more : "More") + "...";
201
+ return (more ?? "More") + "...";
204
202
  return getOptionLabel
205
203
  ? getOptionLabel(item)
206
204
  : DataTypes.getObjectItemLabel(item);
package/lib/TiplistPro.js CHANGED
@@ -10,9 +10,8 @@ import { globalApp } from "./app/ReactApp";
10
10
  * @returns Component
11
11
  */
12
12
  export function TiplistPro(props) {
13
- var _a;
14
13
  // Labels
15
- const { noOptions, loading, more, open: openDefault } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more", "open")) !== null && _a !== void 0 ? _a : {};
14
+ const { noOptions, loading, more, open: openDefault } = globalApp?.getLabels("noOptions", "loading", "more", "open") ?? {};
16
15
  // Destruct
17
16
  const { label, loadData, defaultValue, value, idValue, maxItems = 16, width, name, inputOnChange, inputProps, inputReset, sx, openOnFocus = true, noOptionsText = noOptions, loadingText = loading, openText = openDefault, getOptionDisabled, getOptionLabel, onChange, onValueChange, ...rest } = props;
18
17
  if (width && sx)
@@ -20,11 +19,12 @@ export function TiplistPro(props) {
20
19
  // Value input ref
21
20
  const inputRef = React.createRef();
22
21
  // Local value
23
- let localValue = value !== null && value !== void 0 ? value : defaultValue;
22
+ let localValue = value ?? defaultValue;
24
23
  // One time calculation for input's default value (uncontrolled)
25
- const localIdValue = idValue !== null && idValue !== void 0 ? idValue : (localValue != null && typeof localValue === "object"
26
- ? localValue.id
27
- : null);
24
+ const localIdValue = idValue ??
25
+ (localValue != null && typeof localValue === "object"
26
+ ? localValue.id
27
+ : null);
28
28
  // Changable states
29
29
  const [states, stateUpdate] = React.useReducer((currentState, newState) => {
30
30
  return { ...currentState, ...newState };
@@ -100,13 +100,12 @@ export function TiplistPro(props) {
100
100
  };
101
101
  const delayed = useDelayedExecutor(loadDataDirect, 480);
102
102
  const setInputValue = (value) => {
103
- var _a;
104
103
  stateUpdate({ value });
105
104
  // Input value
106
105
  const input = inputRef.current;
107
106
  if (input) {
108
107
  // Update value
109
- const newValue = (_a = value === null || value === void 0 ? void 0 : value.id.toString()) !== null && _a !== void 0 ? _a : "";
108
+ const newValue = value?.id.toString() ?? "";
110
109
  if (newValue !== input.value) {
111
110
  // Different value, trigger change event
112
111
  ReactUtils.triggerChange(input, newValue, false);
@@ -151,7 +150,7 @@ export function TiplistPro(props) {
151
150
  }, []);
152
151
  // Layout
153
152
  return (React.createElement("div", null,
154
- React.createElement("input", { ref: inputRef, "data-reset": inputReset !== null && inputReset !== void 0 ? inputReset : true, type: "text", style: { display: "none" }, name: name, value: inputValue !== null && inputValue !== void 0 ? inputValue : (state.current.idSet ? "" : localIdValue !== null && localIdValue !== void 0 ? localIdValue : ""), readOnly: true, onChange: inputOnChange }),
153
+ React.createElement("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange }),
155
154
  React.createElement(Autocomplete, { filterOptions: (options, _state) => options, value: states.value, options: states.options, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
156
155
  if (typeof value === "object") {
157
156
  // Set value
@@ -194,7 +193,7 @@ export function TiplistPro(props) {
194
193
  if (typeof item === "string")
195
194
  return item;
196
195
  if (item["id"] === -1)
197
- return (more !== null && more !== void 0 ? more : "More") + "...";
196
+ return (more ?? "More") + "...";
198
197
  if (getOptionLabel == null)
199
198
  return DataTypes.getListItemLabel(item);
200
199
  return getOptionLabel(item);
@@ -21,11 +21,11 @@ export function TooltipClick(props) {
21
21
  setOpen(true);
22
22
  if (newTitle)
23
23
  setTitle(newTitle);
24
- delayed === null || delayed === void 0 ? void 0 : delayed.call();
24
+ delayed?.call();
25
25
  };
26
26
  React.useEffect(() => {
27
27
  return () => {
28
- delayed === null || delayed === void 0 ? void 0 : delayed.clear();
28
+ delayed?.clear();
29
29
  };
30
30
  }, []);
31
31
  // Layout
@@ -11,7 +11,7 @@ import { InputField } from './InputField';
11
11
  */
12
12
  export function TwoFieldInput(props) {
13
13
  // Destruct
14
- const { name, inputProps, type = inputProps === null || inputProps === void 0 ? void 0 : inputProps.inputMode, values, onValuesChange, onChange, onInput, ...rest } = props;
14
+ const { name, inputProps, type = inputProps?.inputMode, values, onValuesChange, onChange, onInput, ...rest } = props;
15
15
  // Local values
16
16
  const localValues = values == null
17
17
  ? [null, null]
package/lib/UserAvatar.js CHANGED
@@ -10,8 +10,7 @@ import { globalApp } from "./app/ReactApp";
10
10
  export function UserAvatar(props) {
11
11
  // Destruct
12
12
  const { src, title, formatTitle = (title) => {
13
- var _a;
14
- return BusinessUtils.formatAvatarTitle(title, 3, (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("me")) !== null && _a !== void 0 ? _a : "ME");
13
+ return BusinessUtils.formatAvatarTitle(title, 3, globalApp?.get("me") ?? "ME");
15
14
  } } = props;
16
15
  // Format
17
16
  const fTitle = formatTitle(title);
@@ -73,7 +73,6 @@ export function UserAvatarEditor(props) {
73
73
  };
74
74
  // Handle file upload
75
75
  const handleFileUpload = (files) => {
76
- var _a;
77
76
  // Reset all settings
78
77
  handleReset();
79
78
  // Set new preview image
@@ -83,7 +82,7 @@ export function UserAvatarEditor(props) {
83
82
  // Set ready state
84
83
  setReady(false);
85
84
  // Make the submit button visible
86
- (_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView(false);
85
+ buttonRef.current?.scrollIntoView(false);
87
86
  };
88
87
  // Handle reset
89
88
  const handleReset = () => {
@@ -99,11 +98,10 @@ export function UserAvatarEditor(props) {
99
98
  };
100
99
  // Handle done
101
100
  const handleDone = async () => {
102
- var _a, _b;
103
101
  // Data
104
102
  var data = scaledResult
105
- ? (_a = ref.current) === null || _a === void 0 ? void 0 : _a.getImageScaledToCanvas()
106
- : (_b = ref.current) === null || _b === void 0 ? void 0 : _b.getImage();
103
+ ? ref.current?.getImageScaledToCanvas()
104
+ : ref.current?.getImage();
107
105
  if (data == null)
108
106
  return;
109
107
  // pica
@@ -141,7 +139,7 @@ export function UserAvatarEditor(props) {
141
139
  React.createElement(FileUploadButton, { variant: "outlined", size: "medium", startIcon: React.createElement(ComputerIcon, null), fullWidth: true, onUploadFiles: handleFileUpload, inputProps: { multiple: false, accept: "image/png, image/jpeg" } }, labels.upload),
142
140
  React.createElement(Stack, { direction: "row", spacing: 0.5 },
143
141
  React.createElement(React.Suspense, { fallback: React.createElement(Skeleton, { variant: "rounded", width: width, height: height }) },
144
- 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 })),
142
+ React.createElement(AE, { ref: ref, border: border, width: width, height: height, onLoadSuccess: handleLoad, image: previewImage ?? "", scale: editorState.scale, rotate: editorState.rotate })),
145
143
  React.createElement(ButtonGroup, { size: "small", orientation: "vertical", disabled: !ready },
146
144
  React.createElement(Button, { onClick: () => handleRotate(90), title: labels.rotateRight },
147
145
  React.createElement(RotateRightIcon, null)),
@@ -37,7 +37,7 @@ export class CommonApp extends ReactApp {
37
37
  */
38
38
  async refreshToken(props) {
39
39
  // Destruct
40
- const { callback, data, relogin = false, showLoading = false } = props !== null && props !== void 0 ? props : {};
40
+ const { callback, data, relogin = false, showLoading = false } = props ?? {};
41
41
  // Token
42
42
  const token = this.getCacheToken();
43
43
  if (token == null || token === "") {
@@ -38,7 +38,7 @@ export function ReactAppStateDetector(props) {
38
38
  matchedFields = [];
39
39
  targetFields.forEach((targetField) => {
40
40
  if (changedFields.includes(targetField))
41
- matchedFields === null || matchedFields === void 0 ? void 0 : matchedFields.push(targetField);
41
+ matchedFields?.push(targetField);
42
42
  });
43
43
  }
44
44
  // Callback
@@ -106,7 +106,6 @@ export class ReactApp extends CoreApp {
106
106
  * @param culture New culture definition
107
107
  */
108
108
  async changeCulture(culture) {
109
- var _a, _b;
110
109
  // Super call to update cultrue
111
110
  const resources = await super.changeCulture(culture);
112
111
  // Update component labels
@@ -124,7 +123,7 @@ export class ReactApp extends CoreApp {
124
123
  });
125
124
  // Document title
126
125
  // Default is servier name's label or appName label
127
- const title = (_b = (_a = this.get(this.name)) !== null && _a !== void 0 ? _a : this.get("appName")) !== null && _b !== void 0 ? _b : this.name;
126
+ const title = this.get(this.name) ?? this.get("appName") ?? this.name;
128
127
  const host = BridgeUtils.host;
129
128
  if (host) {
130
129
  // Notify host
@@ -164,7 +163,7 @@ export class ReactApp extends CoreApp {
164
163
  * @returns Props
165
164
  */
166
165
  getMoneyFormatProps(currency) {
167
- return { culture: this.culture, currency: currency !== null && currency !== void 0 ? currency : this.currency };
166
+ return { culture: this.culture, currency: currency ?? this.currency };
168
167
  }
169
168
  /**
170
169
  * Fresh countdown UI
@@ -241,8 +240,7 @@ export class ReactApp extends CoreApp {
241
240
  * @param key Page title resource key
242
241
  */
243
242
  setPageKey(key) {
244
- var _a;
245
- this.setPageTitle((_a = this.get(key)) !== null && _a !== void 0 ? _a : "");
243
+ this.setPageTitle(this.get(key) ?? "");
246
244
  }
247
245
  /**
248
246
  * Show input dialog
@@ -88,7 +88,7 @@ export class ServiceApp extends ReactApp {
88
88
  */
89
89
  async refreshToken(props) {
90
90
  // Destruct
91
- const { appApi, callback, data, relogin = false, showLoading = false } = props !== null && props !== void 0 ? props : {};
91
+ const { appApi, callback, data, relogin = false, showLoading = false } = props ?? {};
92
92
  // Token
93
93
  const token = this.getCacheToken();
94
94
  if (token == null || token === "") {
@@ -116,7 +116,6 @@ export class ServiceApp extends ReactApp {
116
116
  };
117
117
  // Success callback
118
118
  const success = async (result, failCallback) => {
119
- var _a;
120
119
  // Token
121
120
  const refreshToken = this.getResponseToken(payload.response);
122
121
  if (refreshToken == null || result.data == null) {
@@ -129,7 +128,7 @@ export class ServiceApp extends ReactApp {
129
128
  // Use core system access token to service api to exchange service access token
130
129
  const api = appApi ? appApi.api : this.serviceApi;
131
130
  const serviceResult = await api.put("Auth/ExchangeToken", {
132
- token: this.encryptEnhanced(userData.token, ((_a = appApi === null || appApi === void 0 ? void 0 : appApi.serviceId) !== null && _a !== void 0 ? _a : this.settings.serviceId).toString())
131
+ token: this.encryptEnhanced(userData.token, (appApi?.serviceId ?? this.settings.serviceId).toString())
133
132
  }, {
134
133
  showLoading,
135
134
  onError: (error) => {
@@ -218,7 +217,7 @@ export class ServiceApp extends ReactApp {
218
217
  * @returns Pure text
219
218
  */
220
219
  serviceDecrypt(messageEncrypted, passphrase) {
221
- return this.decrypt(messageEncrypted, passphrase !== null && passphrase !== void 0 ? passphrase : this.servicePassphrase);
220
+ return this.decrypt(messageEncrypted, passphrase ?? this.servicePassphrase);
222
221
  }
223
222
  /**
224
223
  * Service encrypt message
@@ -228,7 +227,7 @@ export class ServiceApp extends ReactApp {
228
227
  * @returns Result
229
228
  */
230
229
  serviceEncrypt(message, passphrase, iterations) {
231
- return this.encrypt(message, passphrase !== null && passphrase !== void 0 ? passphrase : this.servicePassphrase, iterations);
230
+ return this.encrypt(message, passphrase ?? this.servicePassphrase, iterations);
232
231
  }
233
232
  /**
234
233
  * Try login
@@ -256,10 +255,9 @@ export class ServiceApp extends ReactApp {
256
255
  * @param serviceUser Service user
257
256
  */
258
257
  userLoginEx(user, refreshToken, serviceUser) {
259
- var _a;
260
258
  // Service user login
261
259
  this.servicePassphrase =
262
- (_a = this.decrypt(serviceUser.servicePassphrase, this.settings.serviceId.toString())) !== null && _a !== void 0 ? _a : "";
260
+ this.decrypt(serviceUser.servicePassphrase, this.settings.serviceId.toString()) ?? "";
263
261
  // Service user
264
262
  this.serviceUser = serviceUser;
265
263
  // Service API token
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType } from "@etsoo/shared";
1
+ import { DataTypes } from "@etsoo/shared";
2
2
  import React from "react";
3
3
  import { DataGridPageProps } from "./DataGridPageProps";
4
4
  /**
@@ -6,4 +6,4 @@ import { DataGridPageProps } from "./DataGridPageProps";
6
6
  * @param props Props
7
7
  * @returns Component
8
8
  */
9
- export declare function DataGridPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: DataGridPageProps<T, F, D>): React.JSX.Element;
9
+ export declare function DataGridPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: DataGridPageProps<T, F>): React.JSX.Element;
@@ -12,10 +12,9 @@ import { GridUtils } from "../GridUtils";
12
12
  * @returns Component
13
13
  */
14
14
  export function DataGridPage(props) {
15
- var _a;
16
15
  // Destruct
17
16
  const { adjustHeight, fields, fieldTemplate, height, loadData, mRef, sizeReadyMiliseconds = 100, pageProps = {}, cacheKey, cacheMinutes = 15, ...rest } = props;
18
- (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
17
+ pageProps.paddings ?? (pageProps.paddings = MUGlobal.pagePaddings);
19
18
  // States
20
19
  const [states, setStates] = React.useReducer((currentState, newState) => {
21
20
  return { ...currentState, ...newState };
@@ -97,7 +96,7 @@ export function DataGridPage(props) {
97
96
  return;
98
97
  ref.reset({ data });
99
98
  }, [ref, data]);
100
- const f = typeof fields == "function" ? fields(searchData !== null && searchData !== void 0 ? searchData : {}) : fields;
99
+ const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
101
100
  // Layout
102
101
  return (React.createElement(CommonPage, { ...pageProps, scrollContainer: states.element },
103
102
  React.createElement(Stack, null,
@@ -1,10 +1,10 @@
1
- import { DataTypes, IdDefaultType } from "@etsoo/shared";
1
+ import { DataTypes } from "@etsoo/shared";
2
2
  import { DataGridExProps } from "../DataGridEx";
3
3
  import { SearchPageProps } from "./SearchPageProps";
4
4
  /**
5
5
  * DataGrid page props
6
6
  */
7
- export type DataGridPageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>> = SearchPageProps<T, F> & Omit<DataGridExProps<T, D>, "loadData" | "height"> & {
7
+ export type DataGridPageProps<T extends object, F extends DataTypes.BasicTemplate> = SearchPageProps<T, F> & Omit<DataGridExProps<T>, "loadData" | "height"> & {
8
8
  /**
9
9
  * Height will be deducted
10
10
  * @param height Current calcuated height
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType } from "@etsoo/shared";
1
+ import { DataTypes } from "@etsoo/shared";
2
2
  import React from "react";
3
3
  import { ListPageProps } from "./ListPageProps";
4
4
  /**
@@ -6,7 +6,7 @@ import { ListPageProps } from "./ListPageProps";
6
6
  * @param props Props
7
7
  * @returns Component
8
8
  */
9
- export declare function FixedListPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ListPageProps<T, F, D> & {
9
+ export declare function FixedListPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: ListPageProps<T, F> & {
10
10
  /**
11
11
  * Height will be deducted
12
12
  * @param height Current calcuated height
@@ -12,10 +12,9 @@ import { GridUtils } from "../GridUtils";
12
12
  * @returns Component
13
13
  */
14
14
  export function FixedListPage(props) {
15
- var _a;
16
15
  // Destruct
17
16
  const { adjustHeight, fields, fieldTemplate, loadData, mRef, sizeReadyMiliseconds = 0, pageProps = {}, cacheKey, cacheMinutes = 15, ...rest } = props;
18
- (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
17
+ pageProps.paddings ?? (pageProps.paddings = MUGlobal.pagePaddings);
19
18
  // States
20
19
  const [states] = React.useState({});
21
20
  const initLoadedRef = React.useRef();
@@ -89,7 +88,7 @@ export function FixedListPage(props) {
89
88
  }, ...rest })));
90
89
  }
91
90
  }, [rect]);
92
- const f = typeof fields == "function" ? fields(searchData !== null && searchData !== void 0 ? searchData : {}) : fields;
91
+ const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
93
92
  const { paddings, ...pageRest } = pageProps;
94
93
  // Layout
95
94
  return (React.createElement(CommonPage, { ...pageRest, paddings: {}, scrollContainer: scrollContainer },
@@ -4,9 +4,8 @@ import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
4
4
  import { DrawerHeader } from "./DrawerHeader";
5
5
  import { globalApp } from "../app/ReactApp";
6
6
  export function LeftDrawer(props) {
7
- var _a;
8
7
  // Destruct
9
- const { mdUp, width, appName = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("appName"), onMinimize, open = mdUp, children } = props;
8
+ const { mdUp, width, appName = globalApp?.get("appName"), onMinimize, open = mdUp, children } = props;
10
9
  // Menu open/close state
11
10
  const [openLocal, setOpen] = React.useState();
12
11
  const handleDrawerClose = () => {
@@ -29,7 +28,7 @@ export function LeftDrawer(props) {
29
28
  keepMounted: true // Better open performance on mobile.
30
29
  } },
31
30
  React.createElement(DrawerHeader, null,
32
- React.createElement("a", { href: "https://www.etsoo.com", title: (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("etsoo")) !== null && _a !== void 0 ? _a : "ETSOO", target: "_blank", rel: "noreferrer" },
31
+ React.createElement("a", { href: "https://www.etsoo.com", title: globalApp?.get("etsoo") ?? "ETSOO", target: "_blank", rel: "noreferrer" },
33
32
  React.createElement(Avatar, { src: process.env.PUBLIC_URL + "/logo192.png", variant: "square", sx: { marginLeft: -0.5, marginRight: 1.5, marginBottom: 1 } })),
34
33
  React.createElement(Typography, { noWrap: true, component: "div", title: appName, sx: { flexGrow: 2 } }, appName),
35
34
  React.createElement(IconButton, { size: "small", onClick: handleDrawerClose },
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType } from "@etsoo/shared";
1
+ import { DataTypes } from "@etsoo/shared";
2
2
  import React from "react";
3
3
  import { ListPageProps } from "./ListPageProps";
4
4
  /**
@@ -6,4 +6,4 @@ import { ListPageProps } from "./ListPageProps";
6
6
  * @param props Props
7
7
  * @returns Component
8
8
  */
9
- export declare function ListPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ListPageProps<T, F, D>): React.JSX.Element;
9
+ export declare function ListPage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: ListPageProps<T, F>): React.JSX.Element;
@@ -12,10 +12,9 @@ import { GridUtils } from "../GridUtils";
12
12
  * @returns Component
13
13
  */
14
14
  export function ListPage(props) {
15
- var _a;
16
15
  // Destruct
17
16
  const { fields, fieldTemplate, loadData, mRef, pageProps = {}, cacheKey, cacheMinutes = 15, ...rest } = props;
18
- (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
17
+ pageProps.paddings ?? (pageProps.paddings = MUGlobal.pagePaddings);
19
18
  // States
20
19
  const [states] = React.useState({});
21
20
  const refs = useCombinedRefs(mRef, (ref) => {
@@ -69,7 +68,7 @@ export function ListPage(props) {
69
68
  return;
70
69
  sessionStorage.setItem(`${cacheKey}-scroll`, JSON.stringify(props));
71
70
  };
72
- const f = typeof fields == "function" ? fields(searchData !== null && searchData !== void 0 ? searchData : {}) : fields;
71
+ const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
73
72
  // Layout
74
73
  return (React.createElement(CommonPage, { ...pageProps, scrollContainer: globalThis },
75
74
  React.createElement(Stack, null,
@@ -4,4 +4,4 @@ import { SearchPageProps } from "./SearchPageProps";
4
4
  /**
5
5
  * List page props
6
6
  */
7
- export type ListPageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T>> = SearchPageProps<T, F> & Omit<ScrollerListExProps<T, D>, "loadData">;
7
+ export type ListPageProps<T extends object, F extends DataTypes.BasicTemplate> = SearchPageProps<T, F> & Omit<ScrollerListExProps<T>, "loadData">;
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType } from "@etsoo/shared";
1
+ import { DataTypes } from "@etsoo/shared";
2
2
  import React from "react";
3
3
  import { ResponsePageProps } from "./ResponsivePageProps";
4
4
  /**
@@ -6,4 +6,4 @@ import { ResponsePageProps } from "./ResponsivePageProps";
6
6
  * @param props Props
7
7
  * @returns Component
8
8
  */
9
- export declare function ResponsivePage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ResponsePageProps<T, F, D>): React.JSX.Element;
9
+ export declare function ResponsivePage<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: ResponsePageProps<T, F>): React.JSX.Element;
@@ -9,10 +9,9 @@ import { OperationMessageContainer } from "../messages/OperationMessageContainer
9
9
  * @returns Component
10
10
  */
11
11
  export function ResponsivePage(props) {
12
- var _a;
13
12
  // Destruct
14
13
  const { pageProps = {}, operationMessageHandler, ...rest } = props;
15
- (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
14
+ pageProps.paddings ?? (pageProps.paddings = MUGlobal.pagePaddings);
16
15
  const { paddings, fabColumnDirection, ...pageRest } = pageProps;
17
16
  // State
18
17
  const [scrollContainer, setScrollContainer] = React.useState();
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { GridMethodRef } from "@etsoo/react";
3
- import { DataTypes, IdDefaultType } from "@etsoo/shared";
3
+ import { DataTypes } from "@etsoo/shared";
4
4
  import { ListChildComponentProps } from "react-window";
5
5
  import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from "../ScrollerListEx";
6
6
  import { DataGridPageProps } from "./DataGridPageProps";
@@ -8,7 +8,7 @@ import { OperationMessageHandlerAll } from "../messages/OperationMessageHandler"
8
8
  /**
9
9
  * Response page props
10
10
  */
11
- export type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>> = Omit<DataGridPageProps<T, F, D>, "mRef" | "itemKey" | "onScroll" | "onItemsRendered"> & {
11
+ export type ResponsePageProps<T extends object, F extends DataTypes.BasicTemplate> = Omit<DataGridPageProps<T, F>, "mRef" | "itemKey" | "onScroll" | "onItemsRendered"> & {
12
12
  /**
13
13
  *
14
14
  * @param height Current height
@@ -12,10 +12,9 @@ import { GridUtils } from "../GridUtils";
12
12
  * @returns Component
13
13
  */
14
14
  export function TablePage(props) {
15
- var _a;
16
15
  // Destruct
17
16
  const { columns, fields, fieldTemplate, loadData, mRef, sizeReadyMiliseconds = 0, pageProps = {}, cacheKey, cacheMinutes = 15, ...rest } = props;
18
- (_a = pageProps.paddings) !== null && _a !== void 0 ? _a : (pageProps.paddings = MUGlobal.pagePaddings);
17
+ pageProps.paddings ?? (pageProps.paddings = MUGlobal.pagePaddings);
19
18
  // States
20
19
  const [states] = React.useState({});
21
20
  const refs = useCombinedRefs(mRef, (ref) => {
@@ -43,8 +42,7 @@ export function TablePage(props) {
43
42
  const searchData = GridUtils.getSearchData(cacheKey);
44
43
  // Total width
45
44
  const totalWidth = React.useMemo(() => columns.reduce((previousValue, { width, minWidth }) => {
46
- var _a;
47
- return previousValue + ((_a = width !== null && width !== void 0 ? width : minWidth) !== null && _a !== void 0 ? _a : TableExMinWidth);
45
+ return previousValue + (width ?? minWidth ?? TableExMinWidth);
48
46
  }, 0), [columns]);
49
47
  // Watch container
50
48
  const { dimensions } = useDimensions(1, undefined, sizeReadyMiliseconds);
@@ -59,7 +57,7 @@ export function TablePage(props) {
59
57
  return (React.createElement(TableEx, { autoLoad: false, columns: columns, loadData: localLoadData, maxHeight: maxHeight, mRef: refs, ...rest }));
60
58
  }
61
59
  }, [rect]);
62
- const f = typeof fields == "function" ? fields(searchData !== null && searchData !== void 0 ? searchData : {}) : fields;
60
+ const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
63
61
  // Layout
64
62
  return (React.createElement(CommonPage, { ...pageProps, scrollContainer: globalThis },
65
63
  React.createElement(Stack, null,
@@ -30,9 +30,8 @@ export function UserMenu(props) {
30
30
  setAnchorEl(undefined);
31
31
  };
32
32
  const handleClick = async (event) => {
33
- var _a;
34
33
  handleMenuClose();
35
- const item = (_a = event.target) === null || _a === void 0 ? void 0 : _a.closest("li[href]");
34
+ const item = event.target?.closest("li[href]");
36
35
  if (item != null) {
37
36
  const href = item.getAttribute("href");
38
37
  if (href) {