@etsoo/materialui 1.3.41 → 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/MaskInput.js CHANGED
@@ -9,7 +9,6 @@ import { useIMask } from "react-imask";
9
9
  * @returns Component
10
10
  */
11
11
  export function MaskInput(props) {
12
- var _a;
13
12
  // Destruct
14
13
  const { defaultValue, mask, InputLabelProps = {}, InputProps = {}, onAccept, onComplete, readOnly, search = false, size = search ? MUGlobal.searchFieldSize : MUGlobal.inputFieldSize, value, variant = search ? MUGlobal.searchFieldVariant : MUGlobal.inputFieldVariant, ...rest } = props;
15
14
  const { ref, maskRef } = useIMask(mask, {
@@ -22,9 +21,9 @@ export function MaskInput(props) {
22
21
  onComplete(value, maskRef, event);
23
22
  }
24
23
  });
25
- const localValue = defaultValue !== null && defaultValue !== void 0 ? defaultValue : value;
24
+ const localValue = defaultValue ?? value;
26
25
  // Shrink
27
- (_a = InputLabelProps.shrink) !== null && _a !== void 0 ? _a : (InputLabelProps.shrink = search
26
+ InputLabelProps.shrink ?? (InputLabelProps.shrink = search
28
27
  ? MUGlobal.searchFieldShrink
29
28
  : MUGlobal.inputFieldShrink);
30
29
  // Read only
package/lib/NotifierMU.js CHANGED
@@ -32,26 +32,25 @@ const IconDialogTitle = styled(DialogTitle) `
32
32
  export class NotificationMU extends NotificationReact {
33
33
  // Create alert
34
34
  createAlert(_props, className) {
35
- var _a;
36
35
  const labels = Labels.NotificationMU;
37
- const { buttons, inputs, fullScreen, fullWidth = true, maxWidth, okLabel = labels.alertOK, primaryButton, closable = false } = (_a = this.inputProps) !== null && _a !== void 0 ? _a : {};
36
+ const { buttons, inputs, fullScreen, fullWidth = true, maxWidth, okLabel = labels.alertOK, primaryButton, closable = false } = this.inputProps ?? {};
38
37
  let title = this.title;
39
38
  let icon;
40
39
  if (this.type === NotificationMessageType.Success) {
41
40
  icon = React.createElement(Done, { color: "primary" });
42
- title !== null && title !== void 0 ? title : (title = labels.success);
41
+ title ?? (title = labels.success);
43
42
  }
44
43
  else if (this.type === NotificationMessageType.Info) {
45
44
  icon = React.createElement(Info, null);
46
- title !== null && title !== void 0 ? title : (title = labels.info);
45
+ title ?? (title = labels.info);
47
46
  }
48
47
  else if (this.type === NotificationMessageType.Warning) {
49
48
  icon = React.createElement(Warning, { color: "secondary" });
50
- title !== null && title !== void 0 ? title : (title = labels.warning);
49
+ title ?? (title = labels.warning);
51
50
  }
52
51
  else {
53
52
  icon = React.createElement(Error, { color: "error" });
54
- title !== null && title !== void 0 ? title : (title = labels.alertTitle);
53
+ title ?? (title = labels.alertTitle);
55
54
  }
56
55
  const setupProps = {
57
56
  color: "primary"
@@ -76,10 +75,9 @@ export class NotificationMU extends NotificationReact {
76
75
  }
77
76
  // Create confirm
78
77
  createConfirm(_props, className) {
79
- var _a, _b;
80
78
  const labels = Labels.NotificationMU;
81
- const title = (_a = this.title) !== null && _a !== void 0 ? _a : labels.confirmTitle;
82
- const { buttons, okLabel = labels.confirmYes, cancelLabel = labels.confirmNo, cancelButton = true, inputs, fullScreen, fullWidth = true, maxWidth, primaryButton, closable = false } = (_b = this.inputProps) !== null && _b !== void 0 ? _b : {};
79
+ const title = this.title ?? labels.confirmTitle;
80
+ const { buttons, okLabel = labels.confirmYes, cancelLabel = labels.confirmNo, cancelButton = true, inputs, fullScreen, fullWidth = true, maxWidth, primaryButton, closable = false } = this.inputProps ?? {};
83
81
  // Setup callback
84
82
  const options = this.renderSetup ? this.renderSetup({}) : undefined;
85
83
  const callback = async (_event, value) => {
@@ -127,16 +125,15 @@ export class NotificationMU extends NotificationReact {
127
125
  }
128
126
  // Create prompt
129
127
  createPrompt(_props, className) {
130
- var _a, _b;
131
128
  const labels = Labels.NotificationMU;
132
- const title = (_a = this.title) !== null && _a !== void 0 ? _a : labels.promptTitle;
133
- const { buttons, cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton, inputProps, closable = false } = (_b = this.inputProps) !== null && _b !== void 0 ? _b : {};
129
+ const title = this.title ?? labels.promptTitle;
130
+ const { buttons, cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton, inputProps, closable = false } = this.inputProps ?? {};
134
131
  const inputRef = React.createRef();
135
132
  const errorRef = React.createRef();
136
133
  const setError = (error) => {
137
134
  if (errorRef.current == null)
138
135
  return;
139
- errorRef.current.innerText = error !== null && error !== void 0 ? error : "";
136
+ errorRef.current.innerText = error ?? "";
140
137
  };
141
138
  const handleSubmit = async (event) => {
142
139
  // Result
@@ -168,12 +165,12 @@ export class NotificationMU extends NotificationReact {
168
165
  // returns false to prevent default dismiss
169
166
  const v = await result;
170
167
  if (v === false) {
171
- input === null || input === void 0 ? void 0 : input.focus();
168
+ input?.focus();
172
169
  return false;
173
170
  }
174
171
  if (typeof v === "string") {
175
172
  setError(v);
176
- input === null || input === void 0 ? void 0 : input.focus();
173
+ input?.focus();
177
174
  return false;
178
175
  }
179
176
  this.dismiss();
@@ -199,9 +196,8 @@ export class NotificationMU extends NotificationReact {
199
196
  const options = this.renderSetup ? this.renderSetup({}) : undefined;
200
197
  return (React.createElement(Dialog, { key: this.id, open: this.open, PaperComponent: DraggablePaperComponent, className: className, fullWidth: fullWidth, maxWidth: maxWidth, fullScreen: fullScreen, ...options },
201
198
  React.createElement("form", { onSubmit: (event) => {
202
- var _a;
203
199
  event.preventDefault();
204
- (_a = event.currentTarget.elements.namedItem("okButton")) === null || _a === void 0 ? void 0 : _a.click();
200
+ event.currentTarget.elements.namedItem("okButton")?.click();
205
201
  return false;
206
202
  } },
207
203
  React.createElement(IconDialogTitle, { className: "draggable-dialog-title" },
@@ -231,12 +227,11 @@ export class NotificationMU extends NotificationReact {
231
227
  }
232
228
  // Create loading
233
229
  createLoading(_props, className) {
234
- var _a;
235
230
  // Properties
236
231
  const setupProps = { color: "primary" };
237
232
  const labels = Labels.NotificationMU;
238
233
  // Input props
239
- const { maxWidth = "xs" } = (_a = this.inputProps) !== null && _a !== void 0 ? _a : {};
234
+ const { maxWidth = "xs" } = this.inputProps ?? {};
240
235
  // Content
241
236
  let content = this.content;
242
237
  if (content === "@")
package/lib/OptionBool.js CHANGED
@@ -7,9 +7,8 @@ import { OptionGroup } from "./OptionGroup";
7
7
  * @returns Component
8
8
  */
9
9
  export function OptionBool(props) {
10
- var _a;
11
10
  // Options
12
- const options = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getBools()) !== null && _a !== void 0 ? _a : [];
11
+ const options = globalApp?.getBools() ?? [];
13
12
  // Layout
14
13
  return (React.createElement(OptionGroup, { options: options, row: true, multiple: false, ...props }));
15
14
  }
@@ -8,7 +8,6 @@ import React from "react";
8
8
  * @returns Component
9
9
  */
10
10
  export function OptionGroup(props) {
11
- var _a;
12
11
  // Destruct
13
12
  const { getOptionLabel, defaultValue, idField = "id", label, labelField = "label", multiple = false, mRef, name, onValueChange, options, readOnly, row, itemSize, helperText, variant, required, fullWidth, ...rest } = props;
14
13
  // Outlined
@@ -54,7 +53,7 @@ export function OptionGroup(props) {
54
53
  // Value
55
54
  const ov = getOptionValue(option);
56
55
  // Control
57
- const control = multiple ? (React.createElement(Checkbox, { name: name, readOnly: readOnly, size: itemSize, checked: itemChecked(option), disabled: disabledIds === null || disabledIds === void 0 ? void 0 : disabledIds.includes(ov), onChange: (event) => {
56
+ const control = multiple ? (React.createElement(Checkbox, { name: name, readOnly: readOnly, size: itemSize, checked: itemChecked(option), disabled: disabledIds?.includes(ov), onChange: (event) => {
58
57
  if (firstOptionValue == null)
59
58
  return;
60
59
  const typeValue = Utils.parseString(event.target.value, firstOptionValue);
@@ -73,7 +72,7 @@ export function OptionGroup(props) {
73
72
  if (onValueChange)
74
73
  onValueChange(changedValues);
75
74
  setValues(changedValues);
76
- } })) : (React.createElement(Radio, { disabled: disabledIds === null || disabledIds === void 0 ? void 0 : disabledIds.includes(ov), size: itemSize, readOnly: readOnly }));
75
+ } })) : (React.createElement(Radio, { disabled: disabledIds?.includes(ov), size: itemSize, readOnly: readOnly }));
77
76
  // Label
78
77
  const label = getOptionLabel == null ? `${option[labelField]}` : getOptionLabel(option);
79
78
  // Value, convert to string
@@ -82,7 +81,7 @@ export function OptionGroup(props) {
82
81
  return (React.createElement(FormControlLabel, { key: value, control: control, value: value, label: label }));
83
82
  });
84
83
  // Group
85
- const group = multiple ? (React.createElement(FormGroup, { row: row }, list)) : (React.createElement(RadioGroup, { row: row, name: name, value: (_a = values[0]) !== null && _a !== void 0 ? _a : "", onChange: (_event, value) => {
84
+ const group = multiple ? (React.createElement(FormGroup, { row: row }, list)) : (React.createElement(RadioGroup, { row: row, name: name, value: values[0] ?? "", onChange: (_event, value) => {
86
85
  if (firstOptionValue == null)
87
86
  return;
88
87
  const typeValue = Utils.parseString(value, firstOptionValue);
@@ -49,7 +49,7 @@ export function OptionGroupFlag(props) {
49
49
  if (ov == null)
50
50
  return;
51
51
  // Control
52
- const control = (React.createElement(Checkbox, { name: name, readOnly: readOnly, size: itemSize, checked: itemChecked(option), disabled: disabledIds === null || disabledIds === void 0 ? void 0 : disabledIds.includes(ov), onChange: (event) => {
52
+ const control = (React.createElement(Checkbox, { name: name, readOnly: readOnly, size: itemSize, checked: itemChecked(option), disabled: disabledIds?.includes(ov), onChange: (event) => {
53
53
  if (firstOptionValue == null)
54
54
  return;
55
55
  const typeValue = Utils.parseString(event.target.value, firstOptionValue);
package/lib/QuickList.js CHANGED
@@ -11,7 +11,7 @@ import { VBox } from "./FlexBox";
11
11
  */
12
12
  export function QuickList(props) {
13
13
  // Destruct
14
- const { buttonProps = {}, label, inputProps, itemLabel = DataTypes.getListItemLabel, itemRenderer = (item) => itemLabel(item), itemProps, loadData, noMatchesLabel = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("noMatches"), gap = 1, height = "480px", onItemClick, ...rest } = props;
14
+ const { buttonProps = {}, label, inputProps, itemLabel = DataTypes.getListItemLabel, itemRenderer = (item) => itemLabel(item), itemProps, loadData, noMatchesLabel = globalApp?.get("noMatches"), gap = 1, height = "480px", onItemClick, ...rest } = props;
15
15
  const { onClick, ...buttonRest } = buttonProps;
16
16
  // States
17
17
  const [loading, setLoading] = React.useState(false);
@@ -20,7 +20,7 @@ export function QuickList(props) {
20
20
  setLoading(true);
21
21
  loadData(keyword).then((result) => {
22
22
  setLoading(false);
23
- setItems(result !== null && result !== void 0 ? result : []);
23
+ setItems(result ?? []);
24
24
  });
25
25
  };
26
26
  React.useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { DataTypes, IdDefaultType } from "@etsoo/shared";
1
+ import { DataTypes } from "@etsoo/shared";
2
2
  import { SxProps, Theme } from "@mui/material";
3
3
  import React from "react";
4
4
  import { ListChildComponentProps } from "react-window";
@@ -8,7 +8,7 @@ import { ScrollerListExInnerItemRendererProps, ScrollerListExItemSize } from "./
8
8
  /**
9
9
  * ResponsibleContainer props
10
10
  */
11
- export type ResponsibleContainerProps<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>> = Omit<DataGridExProps<T, D>, "height" | "itemKey" | "loadData" | "mRef" | "onScroll" | "onItemsRendered" | "onInitLoad" | "onUpdateRows"> & {
11
+ export type ResponsibleContainerProps<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate> = Omit<DataGridExProps<T>, "height" | "itemKey" | "loadData" | "mRef" | "onScroll" | "onItemsRendered" | "onInitLoad" | "onUpdateRows"> & {
12
12
  /**
13
13
  * Height will be deducted
14
14
  * @param height Current calcuated height
@@ -96,4 +96,4 @@ export type ResponsibleContainerProps<T extends object, F extends DataTypes.Basi
96
96
  * @param props Props
97
97
  * @returns Layout
98
98
  */
99
- export declare function ResponsibleContainer<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ResponsibleContainerProps<T, F, D>): React.JSX.Element;
99
+ export declare function ResponsibleContainer<T extends object, F extends DataTypes.BasicTemplate = DataTypes.BasicTemplate>(props: ResponsibleContainerProps<T, F>): React.JSX.Element;
@@ -172,7 +172,7 @@ export function ResponsibleContainer(props) {
172
172
  const searchBar = React.useMemo(() => {
173
173
  if (!hasFields || showDataGrid == null)
174
174
  return;
175
- const f = typeof fields == "function" ? fields(searchData !== null && searchData !== void 0 ? searchData : {}) : fields;
175
+ const f = typeof fields == "function" ? fields(searchData ?? {}) : fields;
176
176
  return (React.createElement(SearchBar, { fields: f, onSubmit: onSubmit, className: `searchBar${showDataGrid ? "Grid" : "List"}` }));
177
177
  }, [showDataGrid, hasFields, searchBarHeight]);
178
178
  // Pull container
@@ -188,8 +188,8 @@ export function ResponsibleContainer(props) {
188
188
  React.createElement(Stack, null,
189
189
  React.createElement(Box, { ref: dimensions[0][0], className: "SearchBox", sx: { height: hasFields ? searchBarHeight : 0 } }, searchBar),
190
190
  list),
191
- pullToRefresh && pullContainer && (React.createElement(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: () => { var _a; return (_a = state.ref) === null || _a === void 0 ? void 0 : _a.reset(); }, shouldPullToRefresh: () => {
191
+ pullToRefresh && pullContainer && (React.createElement(PullToRefreshUI, { mainElement: pullContainer, triggerElement: pullContainer, instructionsPullToRefresh: labels.pullToRefresh, instructionsReleaseToRefresh: labels.releaseToRefresh, instructionsRefreshing: labels.refreshing, onRefresh: () => state.ref?.reset(), shouldPullToRefresh: () => {
192
192
  const container = document.querySelector(pullContainer);
193
- return !(container === null || container === void 0 ? void 0 : container.scrollTop);
193
+ return !container?.scrollTop;
194
194
  } }))));
195
195
  }
@@ -1,8 +1,7 @@
1
- import { ScrollerListProps } from '@etsoo/react';
2
- import { DataTypes, IdDefaultType } from '@etsoo/shared';
3
- import React from 'react';
4
- import { ListChildComponentProps } from 'react-window';
5
- import { MouseEventWithDataHandler } from './MUGlobal';
1
+ import { ScrollerListProps } from "@etsoo/react";
2
+ import React from "react";
3
+ import { ListChildComponentProps } from "react-window";
4
+ import { MouseEventWithDataHandler } from "./MUGlobal";
6
5
  /**
7
6
  * Extended ScrollerList inner item renderer props
8
7
  */
@@ -34,7 +33,7 @@ export type ScrollerListExItemSize = ((index: number) => [number, number] | [num
34
33
  /**
35
34
  * Extended ScrollerList Props
36
35
  */
37
- export type ScrollerListExProps<T extends object, D extends DataTypes.Keys<T>> = Omit<ScrollerListProps<T, D>, 'itemRenderer' | 'itemSize'> & {
36
+ export type ScrollerListExProps<T extends object> = Omit<ScrollerListProps<T>, "itemRenderer" | "itemSize"> & {
38
37
  /**
39
38
  * Alternating colors for odd/even rows
40
39
  */
@@ -73,4 +72,4 @@ export type ScrollerListExProps<T extends object, D extends DataTypes.Keys<T>> =
73
72
  * @param props Props
74
73
  * @returns Component
75
74
  */
76
- export declare function ScrollerListEx<T extends object, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: ScrollerListExProps<T, D>): React.JSX.Element;
75
+ export declare function ScrollerListEx<T extends object>(props: ScrollerListExProps<T>): React.JSX.Element;
@@ -1,39 +1,39 @@
1
- import { css } from '@emotion/css';
2
- import { ScrollerList } from '@etsoo/react';
3
- import { Utils } from '@etsoo/shared';
4
- import { useTheme } from '@mui/material';
5
- import React from 'react';
6
- import { MUGlobal } from './MUGlobal';
1
+ import { css } from "@emotion/css";
2
+ import { ScrollerList } from "@etsoo/react";
3
+ import { Utils } from "@etsoo/shared";
4
+ import { useTheme } from "@mui/material";
5
+ import React from "react";
6
+ import { MUGlobal } from "./MUGlobal";
7
7
  // Scroll bar size
8
8
  const scrollbarSize = 16;
9
9
  // Selected class name
10
- const selectedClassName = 'ScrollerListEx-Selected';
10
+ const selectedClassName = "ScrollerListEx-Selected";
11
11
  const createGridStyle = (alternatingColors, selectedColor) => {
12
12
  return css({
13
- '& .ScrollerListEx-Selected': {
13
+ "& .ScrollerListEx-Selected": {
14
14
  backgroundColor: selectedColor
15
15
  },
16
- '& .ScrollerListEx-Row0:not(.ScrollerListEx-Selected)': {
16
+ "& .ScrollerListEx-Row0:not(.ScrollerListEx-Selected)": {
17
17
  backgroundColor: alternatingColors[0]
18
18
  },
19
- '& .ScrollerListEx-Row1:not(.ScrollerListEx-Selected)': {
19
+ "& .ScrollerListEx-Row1:not(.ScrollerListEx-Selected)": {
20
20
  backgroundColor: alternatingColors[1]
21
21
  },
22
- '@media (min-width: 800px)': {
23
- '::-webkit-scrollbar': {
22
+ "@media (min-width: 800px)": {
23
+ "::-webkit-scrollbar": {
24
24
  width: scrollbarSize,
25
25
  height: scrollbarSize,
26
- backgroundColor: '#f6f6f6'
26
+ backgroundColor: "#f6f6f6"
27
27
  },
28
- '::-webkit-scrollbar-thumb': {
29
- backgroundColor: 'rgba(0,0,0,0.4)',
30
- borderRadius: '2px'
28
+ "::-webkit-scrollbar-thumb": {
29
+ backgroundColor: "rgba(0,0,0,0.4)",
30
+ borderRadius: "2px"
31
31
  },
32
- '::-webkit-scrollbar-track-piece:start': {
33
- background: 'transparent'
32
+ "::-webkit-scrollbar-track-piece:start": {
33
+ background: "transparent"
34
34
  },
35
- '::-webkit-scrollbar-track-piece:end': {
36
- background: 'transparent'
35
+ "::-webkit-scrollbar-track-piece:end": {
36
+ background: "transparent"
37
37
  }
38
38
  }
39
39
  });
@@ -92,27 +92,25 @@ export function ScrollerListEx(props) {
92
92
  // Selected item ref
93
93
  const selectedItem = React.useRef();
94
94
  const onMouseDown = (div, data) => {
95
- var _a;
96
95
  // Destruct
97
- const [selectedDiv, selectedData] = (_a = selectedItem.current) !== null && _a !== void 0 ? _a : [];
96
+ const [selectedDiv, selectedData] = selectedItem.current ?? [];
98
97
  if (selectedData != null && selectedData[idField] === data[idField])
99
98
  return;
100
- selectedDiv === null || selectedDiv === void 0 ? void 0 : selectedDiv.classList.remove(selectedClassName);
99
+ selectedDiv?.classList.remove(selectedClassName);
101
100
  div.classList.add(selectedClassName);
102
101
  selectedItem.current = [div, data];
103
102
  if (onSelectChange)
104
103
  onSelectChange([data]);
105
104
  };
106
105
  const isSelected = (data) => {
107
- var _a;
108
- const [_, selectedData] = (_a = selectedItem.current) !== null && _a !== void 0 ? _a : [];
106
+ const [_, selectedData] = selectedItem.current ?? [];
109
107
  const selected = selectedData && data && selectedData[idField] === data[idField]
110
108
  ? true
111
109
  : false;
112
110
  return selected;
113
111
  };
114
112
  // Destruct
115
- const { alternatingColors = [undefined, undefined], className, idField = 'id', innerItemRenderer, itemSize, itemRenderer = (itemProps) => {
113
+ const { alternatingColors = [undefined, undefined], className, idField = "id", innerItemRenderer, itemSize, itemRenderer = (itemProps) => {
116
114
  const [itemHeight, space, margins] = calculateItemSize(itemProps.index);
117
115
  return defaultItemRenderer({
118
116
  itemHeight,
@@ -125,20 +123,16 @@ export function ScrollerListEx(props) {
125
123
  selected: isSelected(itemProps.data),
126
124
  ...itemProps
127
125
  });
128
- }, onClick, onDoubleClick, onSelectChange, selectedColor = '#edf4fb', ...rest } = props;
126
+ }, onClick, onDoubleClick, onSelectChange, selectedColor = "#edf4fb", ...rest } = props;
129
127
  // Theme
130
128
  const theme = useTheme();
131
129
  // Cache calculation
132
130
  const itemSizeResult = React.useMemo(() => {
133
- if (typeof itemSize === 'function')
131
+ if (typeof itemSize === "function")
134
132
  return undefined;
135
133
  const [size, spaces, isNarrow] = itemSize;
136
- if (typeof spaces === 'number')
137
- return [
138
- size,
139
- spaces,
140
- defaultMargin(MUGlobal.pagePaddings, undefined)
141
- ];
134
+ if (typeof spaces === "number")
135
+ return [size, spaces, defaultMargin(MUGlobal.pagePaddings, undefined)];
142
136
  return [
143
137
  size,
144
138
  MUGlobal.getSpace(spaces, theme),
@@ -148,7 +142,7 @@ export function ScrollerListEx(props) {
148
142
  // Calculate size
149
143
  const calculateItemSize = (index) => {
150
144
  // Callback function
151
- if (typeof itemSize === 'function') {
145
+ if (typeof itemSize === "function") {
152
146
  const result = itemSize(index);
153
147
  if (result.length == 2)
154
148
  return [...result, defaultMargin(MUGlobal.pagePaddings)];
@@ -163,5 +157,5 @@ export function ScrollerListEx(props) {
163
157
  return size + space;
164
158
  };
165
159
  // Layout
166
- return (React.createElement(ScrollerList, { className: Utils.mergeClasses('ScrollerListEx-Body', className, createGridStyle(alternatingColors, selectedColor)), idField: idField, itemRenderer: itemRenderer, itemSize: itemSizeLocal, ...rest }));
160
+ return (React.createElement(ScrollerList, { className: Utils.mergeClasses("ScrollerListEx-Body", className, createGridStyle(alternatingColors, selectedColor)), idField: idField, itemRenderer: itemRenderer, itemSize: itemSizeLocal, ...rest }));
167
161
  }
@@ -8,11 +8,10 @@ import { MUGlobal } from './MUGlobal';
8
8
  * @returns Component
9
9
  */
10
10
  export function SearchField(props) {
11
- var _a;
12
11
  // Destruct
13
12
  const { changeDelay, InputLabelProps = {}, InputProps = {}, onChange, readOnly, size = MUGlobal.searchFieldSize, variant = MUGlobal.searchFieldVariant, ...rest } = props;
14
13
  // Shrink
15
- (_a = InputLabelProps.shrink) !== null && _a !== void 0 ? _a : (InputLabelProps.shrink = MUGlobal.searchFieldShrink);
14
+ InputLabelProps.shrink ?? (InputLabelProps.shrink = MUGlobal.searchFieldShrink);
16
15
  // Read only
17
16
  if (readOnly != null)
18
17
  InputProps.readOnly = readOnly;
@@ -27,12 +26,12 @@ export function SearchField(props) {
27
26
  onChange(event);
28
27
  return;
29
28
  }
30
- delayed === null || delayed === void 0 ? void 0 : delayed.call(undefined, event);
29
+ delayed?.call(undefined, event);
31
30
  };
32
31
  React.useEffect(() => {
33
32
  return () => {
34
33
  isMounted.current = false;
35
- delayed === null || delayed === void 0 ? void 0 : delayed.clear();
34
+ delayed?.clear();
36
35
  };
37
36
  }, []);
38
37
  // Layout
package/lib/SelectBool.js CHANGED
@@ -8,11 +8,10 @@ import { SelectEx } from "./SelectEx";
8
8
  * @returns Component
9
9
  */
10
10
  export function SelectBool(props) {
11
- var _a;
12
11
  // Destruct
13
12
  const { search = true, autoAddBlankItem = search, ...rest } = props;
14
13
  // Options
15
- const options = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getBools()) !== null && _a !== void 0 ? _a : [];
14
+ const options = globalApp?.getBools() ?? [];
16
15
  if (autoAddBlankItem)
17
16
  Utils.addBlankItem(options);
18
17
  // Layout
package/lib/SelectEx.js CHANGED
@@ -45,8 +45,8 @@ export function SelectEx(props) {
45
45
  setOptionsAdd(options);
46
46
  }, [options, propertyWay]);
47
47
  // Local value
48
- const v = defaultValue !== null && defaultValue !== void 0 ? defaultValue : value;
49
- const valueSource = React.useMemo(() => (multiple ? (v ? (Array.isArray(v) ? v : [v]) : []) : v !== null && v !== void 0 ? v : ""), [multiple, v]);
48
+ const v = defaultValue ?? value;
49
+ const valueSource = React.useMemo(() => (multiple ? (v ? (Array.isArray(v) ? v : [v]) : []) : v ?? ""), [multiple, v]);
50
50
  // Value state
51
51
  const [valueState, setValueStateBase] = React.useState(valueSource);
52
52
  const valueRef = React.useRef();
@@ -62,14 +62,13 @@ export function SelectEx(props) {
62
62
  const labelId = `selectex-label-${name}`;
63
63
  // Set item
64
64
  const setItemValue = (id) => {
65
- var _a;
66
65
  if (id !== valueRef.current) {
67
66
  // Difference
68
67
  const diff = multiple
69
68
  ? ArrayUtils.differences(id, valueRef.current)
70
69
  : id;
71
70
  setValueState(id);
72
- const input = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("input");
71
+ const input = divRef.current?.querySelector("input");
73
72
  if (input) {
74
73
  // Different value, trigger change event
75
74
  ReactUtils.triggerChange(input, id, false);
@@ -111,18 +110,17 @@ export function SelectEx(props) {
111
110
  }, [valueSource]);
112
111
  // When layout ready
113
112
  React.useEffect(() => {
114
- var _a;
115
- const input = (_a = divRef.current) === null || _a === void 0 ? void 0 : _a.querySelector("input");
113
+ const input = divRef.current?.querySelector("input");
116
114
  const inputChange = (event) => {
117
115
  // Reset case
118
116
  if (event.cancelable)
119
117
  setValueState(multiple ? [] : "");
120
118
  };
121
- input === null || input === void 0 ? void 0 : input.addEventListener("change", inputChange);
119
+ input?.addEventListener("change", inputChange);
122
120
  isMounted.current = true;
123
121
  return () => {
124
122
  isMounted.current = false;
125
- input === null || input === void 0 ? void 0 : input.removeEventListener("change", inputChange);
123
+ input?.removeEventListener("change", inputChange);
126
124
  };
127
125
  }, [multiple]);
128
126
  // Layout
@@ -38,10 +38,9 @@ export const ShowDataComparison = (data, modelTitle, getLabel, equalCheck = true
38
38
  }
39
39
  // Labels
40
40
  const { dataComparison, field, newValue, oldValue } = app.getLabels("dataComparison", "field", "newValue", "oldValue");
41
- modelTitle !== null && modelTitle !== void 0 ? modelTitle : (modelTitle = dataComparison);
42
- getLabel !== null && getLabel !== void 0 ? getLabel : (getLabel = (key) => {
43
- var _a;
44
- return (_a = app.get(Utils.formatInitial(key))) !== null && _a !== void 0 ? _a : key;
41
+ modelTitle ?? (modelTitle = dataComparison);
42
+ getLabel ?? (getLabel = (key) => {
43
+ return app.get(Utils.formatInitial(key)) ?? key;
45
44
  });
46
45
  const keys = new Set([
47
46
  ...Object.keys(data.oldData),
package/lib/Switch.js CHANGED
@@ -8,11 +8,10 @@ import MuiSwitch from '@mui/material/Switch';
8
8
  * @returns Component
9
9
  */
10
10
  export function Switch(props) {
11
- var _a;
12
11
  // Destruct
13
12
  const { checked, defaultChecked, defaultValue, onChange, readOnly, size, checkbox = false, value = 'true', ...rest } = props;
14
13
  // Checked state
15
- const [controlChecked, setControlChecked] = React.useState((_a = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _a !== void 0 ? _a : defaultValue == value);
14
+ const [controlChecked, setControlChecked] = React.useState(checked ?? defaultChecked ?? defaultValue == value);
16
15
  React.useEffect(() => {
17
16
  if (checked)
18
17
  setControlChecked(checked);
package/lib/SwitchAnt.js CHANGED
@@ -8,13 +8,12 @@ import { globalApp } from "./app/ReactApp";
8
8
  * @returns Component
9
9
  */
10
10
  export function SwitchAnt(props) {
11
- var _a, _b;
12
11
  // Labels
13
- const { yes = "Yes", no = "No" } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("yes", "no")) !== null && _a !== void 0 ? _a : {};
12
+ const { yes = "Yes", no = "No" } = globalApp?.getLabels("yes", "no") ?? {};
14
13
  // Destruct
15
14
  const { activeColor, checked, defaultChecked, defaultValue, endLabel = yes, startLabel = no, onChange, value = "true", ...rest } = props;
16
15
  // Checked state
17
- const [controlChecked, setControlChecked] = React.useState((_b = checked !== null && checked !== void 0 ? checked : defaultChecked) !== null && _b !== void 0 ? _b : defaultValue == value);
16
+ const [controlChecked, setControlChecked] = React.useState(checked ?? defaultChecked ?? defaultValue == value);
18
17
  // Ref
19
18
  const ref = React.useRef(null);
20
19
  React.useEffect(() => {
@@ -29,17 +28,17 @@ export function SwitchAnt(props) {
29
28
  };
30
29
  // Layout
31
30
  return (React.createElement(Stack, { direction: "row", spacing: 1, alignItems: "center" },
32
- React.createElement(Typography, { onClick: () => { var _a; return controlChecked && ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.click()); }, sx: {
31
+ React.createElement(Typography, { onClick: () => controlChecked && ref.current?.click(), sx: {
33
32
  cursor: "pointer",
34
33
  color: controlChecked
35
34
  ? undefined
36
- : (theme) => activeColor !== null && activeColor !== void 0 ? activeColor : theme.palette.warning.main
35
+ : (theme) => activeColor ?? theme.palette.warning.main
37
36
  } }, startLabel),
38
37
  React.createElement(Switch, { checked: controlChecked, inputRef: ref, value: value, onChange: onChangeLocal, ...rest }),
39
- React.createElement(Typography, { onClick: () => { var _a; return !controlChecked && ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.click()); }, sx: {
38
+ React.createElement(Typography, { onClick: () => !controlChecked && ref.current?.click(), sx: {
40
39
  cursor: "pointer",
41
40
  color: controlChecked
42
- ? (theme) => activeColor !== null && activeColor !== void 0 ? activeColor : theme.palette.warning.main
41
+ ? (theme) => activeColor ?? theme.palette.warning.main
43
42
  : undefined
44
43
  } }, endLabel)));
45
44
  }
package/lib/TableEx.js CHANGED
@@ -13,7 +13,6 @@ export const TableExMinWidth = 180;
13
13
  * @returns Component
14
14
  */
15
15
  export function TableEx(props) {
16
- var _a;
17
16
  // Theme
18
17
  const theme = useTheme();
19
18
  // Destruct
@@ -48,7 +47,7 @@ export function TableEx(props) {
48
47
  isNextPageLoading: false,
49
48
  orderBy: defaultOrderBy,
50
49
  orderByAsc: defaultOrderBy
51
- ? (_a = columns.find((column) => column.field === defaultOrderBy)) === null || _a === void 0 ? void 0 : _a.sortAsc
50
+ ? columns.find((column) => column.field === defaultOrderBy)?.sortAsc
52
51
  : undefined,
53
52
  batchSize: rowsPerPageLocal,
54
53
  selectedItems: [],
@@ -193,7 +192,7 @@ export function TableEx(props) {
193
192
  // Total rows
194
193
  const totalRows = hasNextPage
195
194
  ? -1
196
- : currentPage * batchSize + (lastLoadedItems !== null && lastLoadedItems !== void 0 ? lastLoadedItems : 0);
195
+ : currentPage * batchSize + (lastLoadedItems ?? 0);
197
196
  // Auto load data when current page is 0
198
197
  if (currentPage === 0 && stateAutoLoad && lastLoadedItems == null)
199
198
  loadDataLocal();
@@ -219,7 +218,7 @@ export function TableEx(props) {
219
218
  // Destruct
220
219
  const { align, field, header, minWidth, sortable, sortAsc = true, type, width } = column;
221
220
  // Header text
222
- const headerText = header !== null && header !== void 0 ? header : field;
221
+ const headerText = header ?? field;
223
222
  // Sortable
224
223
  let sortLabel;
225
224
  if (sortable && field != null) {
@@ -233,7 +232,7 @@ export function TableEx(props) {
233
232
  else {
234
233
  sortLabel = headerText;
235
234
  }
236
- return (React.createElement(TableCell, { align: GridAlignGet(align, type), key: field !== null && field !== void 0 ? field : index.toString(), width: width, sx: {
235
+ return (React.createElement(TableCell, { align: GridAlignGet(align, type), key: field ?? index.toString(), width: width, sx: {
237
236
  minWidth: minWidth == null
238
237
  ? width == null
239
238
  ? TableExMinWidth
@@ -249,11 +248,10 @@ export function TableEx(props) {
249
248
  backgroundColor: alternatingColors[1]
250
249
  }
251
250
  } }, [...Array(batchSize)].map((_item, rowIndex) => {
252
- var _a;
253
251
  // Row
254
252
  const row = rowIndex < rows.length ? rows[rowIndex] : undefined;
255
253
  // Row id field value
256
- const rowId = (_a = DataTypes.getValue(row, idField)) !== null && _a !== void 0 ? _a : rowIndex;
254
+ const rowId = DataTypes.getValue(row, idField) ?? rowIndex;
257
255
  // Selected or not
258
256
  const isItemSelected = selectable
259
257
  ? selectedItems.some((item) => item[idField] === rowId)