@etsoo/materialui 1.3.42 → 1.3.44

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 (86) hide show
  1. package/__tests__/NotifierMUTests.tsx +140 -140
  2. package/__tests__/ResponsePage.tsx +48 -0
  3. package/__tests__/SelectEx.tsx +2 -2
  4. package/__tests__/SwitchAnt.tsx +17 -17
  5. package/__tests__/tsconfig.json +17 -17
  6. package/lib/AddresSelector.js +1 -2
  7. package/lib/AuditDisplay.js +2 -3
  8. package/lib/BridgeCloseButton.js +1 -2
  9. package/lib/ComboBox.js +5 -5
  10. package/lib/ComboBoxMultiple.js +7 -8
  11. package/lib/ComboBoxPro.js +1 -2
  12. package/lib/CultureDataTable.js +2 -2
  13. package/lib/DataGridEx.d.ts +2 -3
  14. package/lib/DataGridEx.js +12 -14
  15. package/lib/DataGridRenderers.js +6 -6
  16. package/lib/DataSteps.js +1 -2
  17. package/lib/DataTable.js +1 -2
  18. package/lib/DialogButton.js +2 -3
  19. package/lib/DnDList.js +1 -1
  20. package/lib/EmailInput.js +1 -2
  21. package/lib/FileUploadButton.js +1 -1
  22. package/lib/GridDataFormat.js +5 -5
  23. package/lib/GridUtils.js +1 -2
  24. package/lib/HiSelector.js +1 -1
  25. package/lib/HiSelectorTL.js +1 -1
  26. package/lib/InputField.js +4 -5
  27. package/lib/InputTipField.js +1 -1
  28. package/lib/ItemList.js +2 -3
  29. package/lib/ListChooser.js +4 -5
  30. package/lib/LoadingButton.js +1 -2
  31. package/lib/MaskInput.js +2 -3
  32. package/lib/NotifierMU.js +14 -19
  33. package/lib/OptionBool.js +1 -2
  34. package/lib/OptionGroup.js +3 -4
  35. package/lib/OptionGroupFlag.js +1 -1
  36. package/lib/QuickList.js +2 -2
  37. package/lib/ResponsibleContainer.d.ts +3 -3
  38. package/lib/ResponsibleContainer.js +3 -3
  39. package/lib/ScrollerListEx.d.ts +6 -7
  40. package/lib/ScrollerListEx.js +30 -36
  41. package/lib/SearchField.js +3 -4
  42. package/lib/SelectBool.js +1 -2
  43. package/lib/SelectEx.js +6 -8
  44. package/lib/ShowDataComparison.js +3 -4
  45. package/lib/Switch.js +1 -2
  46. package/lib/SwitchAnt.js +6 -7
  47. package/lib/TableEx.js +5 -7
  48. package/lib/TagList.js +3 -5
  49. package/lib/TagListPro.js +3 -5
  50. package/lib/TextFieldEx.js +2 -2
  51. package/lib/Tiplist.js +6 -8
  52. package/lib/TiplistPro.js +9 -10
  53. package/lib/TooltipClick.js +2 -2
  54. package/lib/TwoFieldInput.js +1 -1
  55. package/lib/UserAvatar.js +1 -2
  56. package/lib/UserAvatarEditor.js +4 -6
  57. package/lib/app/CommonApp.js +1 -1
  58. package/lib/app/ReactApp.js +4 -6
  59. package/lib/app/ServiceApp.js +5 -7
  60. package/lib/pages/DataGridPage.d.ts +2 -2
  61. package/lib/pages/DataGridPage.js +2 -3
  62. package/lib/pages/DataGridPageProps.d.ts +2 -2
  63. package/lib/pages/FixedListPage.d.ts +2 -2
  64. package/lib/pages/FixedListPage.js +2 -3
  65. package/lib/pages/LeftDrawer.js +2 -3
  66. package/lib/pages/ListPage.d.ts +2 -2
  67. package/lib/pages/ListPage.js +2 -3
  68. package/lib/pages/ListPageProps.d.ts +1 -1
  69. package/lib/pages/ResponsivePage.d.ts +2 -2
  70. package/lib/pages/ResponsivePage.js +1 -2
  71. package/lib/pages/ResponsivePageProps.d.ts +2 -2
  72. package/lib/pages/TablePage.js +3 -5
  73. package/lib/pages/UserMenu.js +1 -2
  74. package/lib/pages/ViewPage.js +6 -7
  75. package/package.json +14 -12
  76. package/src/DataGridEx.tsx +6 -12
  77. package/src/ResponsibleContainer.tsx +7 -9
  78. package/src/ScrollerListEx.tsx +301 -311
  79. package/src/pages/DataGridPage.tsx +4 -5
  80. package/src/pages/DataGridPageProps.ts +3 -4
  81. package/src/pages/FixedListPage.tsx +4 -5
  82. package/src/pages/ListPage.tsx +4 -5
  83. package/src/pages/ListPageProps.ts +2 -3
  84. package/src/pages/ResponsivePage.tsx +4 -5
  85. package/src/pages/ResponsivePageProps.ts +3 -4
  86. package/tsconfig.json +3 -3
@@ -8,8 +8,8 @@ import { globalApp } from "./app/ReactApp";
8
8
  */
9
9
  export function CultureDataTable(props) {
10
10
  // Destruct
11
- const { cultures, cultureLabel = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("culture"), editable = true, titleLabel, hasDescription = false, descriptionLabel = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("description"), ...rest } = props;
12
- const getCultureLabel = React.useCallback((value) => { var _a, _b; return (_b = (_a = cultures.find((c) => c.id == value.id)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : `${value.value}`; }, [cultures]);
11
+ const { cultures, cultureLabel = globalApp?.get("culture"), editable = true, titleLabel, hasDescription = false, descriptionLabel = globalApp?.get("description"), ...rest } = props;
12
+ const getCultureLabel = React.useCallback((value) => cultures.find((c) => c.id == value.id)?.label ?? `${value.value}`, [cultures]);
13
13
  return (React.createElement(DataTable, { columns: [
14
14
  {
15
15
  field: "id",
@@ -1,5 +1,4 @@
1
1
  import { GridColumn, GridLoaderStates, ScrollerGridProps } from "@etsoo/react";
2
- import { DataTypes, IdDefaultType } from "@etsoo/shared";
3
2
  import React from "react";
4
3
  import { MouseEventWithDataHandler } from "./MUGlobal";
5
4
  /**
@@ -15,7 +14,7 @@ export type DataGridExFooterItemRendererProps<T extends object> = {
15
14
  /**
16
15
  * Extended DataGrid with VariableSizeGrid props
17
16
  */
18
- export type DataGridExProps<T extends object, D extends DataTypes.Keys<T>> = Omit<ScrollerGridProps<T, D>, "itemRenderer" | "columnCount" | "columnWidth" | "width"> & {
17
+ export type DataGridExProps<T extends object> = Omit<ScrollerGridProps<T>, "itemRenderer" | "columnCount" | "columnWidth" | "width"> & {
19
18
  /**
20
19
  * Alternating colors for odd/even rows
21
20
  */
@@ -99,4 +98,4 @@ export declare function DataGridExCalColumns<T>(columns: GridColumn<T>[]): {
99
98
  * @param props Props
100
99
  * @returns Component
101
100
  */
102
- export declare function DataGridEx<T extends object, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: DataGridExProps<T, D>): React.JSX.Element;
101
+ export declare function DataGridEx<T extends object>(props: DataGridExProps<T>): React.JSX.Element;
package/lib/DataGridEx.js CHANGED
@@ -39,7 +39,9 @@ const rowItems = (div, callback) => {
39
39
  const doRowItems = (parent, rowIndex, callback) => {
40
40
  if (parent == null || rowIndex == null)
41
41
  return;
42
- parent === null || parent === void 0 ? void 0 : parent.querySelectorAll(`div[data-row="${rowIndex}"]`).forEach((rowItem) => {
42
+ parent
43
+ ?.querySelectorAll(`div[data-row="${rowIndex}"]`)
44
+ .forEach((rowItem) => {
43
45
  callback(rowItem);
44
46
  });
45
47
  };
@@ -50,9 +52,8 @@ const doRowItems = (parent, rowIndex, callback) => {
50
52
  */
51
53
  export function DataGridExCalColumns(columns) {
52
54
  return columns.reduce((previousValue, currentItem) => {
53
- var _a, _b;
54
55
  previousValue.total +=
55
- (_b = (_a = currentItem.width) !== null && _a !== void 0 ? _a : currentItem.minWidth) !== null && _b !== void 0 ? _b : minWidth;
56
+ currentItem.width ?? currentItem.minWidth ?? minWidth;
56
57
  if (currentItem.width == null)
57
58
  previousValue.unset++;
58
59
  return previousValue;
@@ -75,7 +76,7 @@ export function DataGridEx(props) {
75
76
  // Destruct
76
77
  const { align, field, header, headerCellRenderer, sortable, sortAsc = true, type } = column;
77
78
  // Header text
78
- const headerText = header !== null && header !== void 0 ? header : field;
79
+ const headerText = header ?? field;
79
80
  // Cell props
80
81
  const cellProps = {};
81
82
  // Sortable
@@ -99,7 +100,7 @@ export function DataGridEx(props) {
99
100
  else {
100
101
  sortLabel = headerText;
101
102
  }
102
- return (React.createElement(Box, { key: field !== null && field !== void 0 ? field : index.toString(), textAlign: GridAlignGet(align, type), width: columnWidth(index) },
103
+ return (React.createElement(Box, { key: field ?? index.toString(), textAlign: GridAlignGet(align, type), width: columnWidth(index) },
103
104
  React.createElement(Box, { className: "DataGridEx-Cell", onMouseEnter: handleMouseEnter, ...cellProps }, sortLabel)));
104
105
  })));
105
106
  };
@@ -119,7 +120,7 @@ export function DataGridEx(props) {
119
120
  checkable
120
121
  })
121
122
  : undefined;
122
- return (React.createElement(Box, { key: "bottom-" + (field !== null && field !== void 0 ? field : index.toString()), textAlign: GridAlignGet(align, type), width: columnWidth(index) },
123
+ return (React.createElement(Box, { key: "bottom-" + (field ?? index.toString()), textAlign: GridAlignGet(align, type), width: columnWidth(index) },
123
124
  React.createElement(Box, { className: "DataGridEx-Cell", onMouseEnter: handleMouseEnter, ...cellProps }, cell)));
124
125
  })));
125
126
  }
@@ -136,8 +137,7 @@ export function DataGridEx(props) {
136
137
  padding: "4px!important"
137
138
  };
138
139
  return (React.createElement(Checkbox, { color: "primary", checked: selected, onChange: (_event, checked) => {
139
- var _a;
140
- (_a = refs.current.ref) === null || _a === void 0 ? void 0 : _a.selectItem(data, checked);
140
+ refs.current.ref?.selectItem(data, checked);
141
141
  } }));
142
142
  },
143
143
  headerCellRenderer: ({ cellProps, states }) => {
@@ -147,7 +147,7 @@ export function DataGridEx(props) {
147
147
  padding: `${hpad}px 4px ${hpad - 1}px 4px!important`
148
148
  };
149
149
  return (React.createElement(Checkbox, { color: "primary", indeterminate: states.selectedItems.length > 0 &&
150
- states.selectedItems.length < states.loadedItems, checked: states.selectedItems.length > 0, onChange: (_event, checked) => { var _a; return (_a = refs.current.ref) === null || _a === void 0 ? void 0 : _a.selectAll(checked); } }));
150
+ states.selectedItems.length < states.loadedItems, checked: states.selectedItems.length > 0, onChange: (_event, checked) => refs.current.ref?.selectAll(checked) }));
151
151
  }
152
152
  };
153
153
  // Update to the latest version
@@ -170,8 +170,7 @@ export function DataGridEx(props) {
170
170
  };
171
171
  // Reset
172
172
  const reset = (add) => {
173
- var _a;
174
- (_a = refs.current.ref) === null || _a === void 0 ? void 0 : _a.reset(add);
173
+ refs.current.ref?.reset(add);
175
174
  };
176
175
  // Show hover tooltip for trucated text
177
176
  const handleMouseEnter = (event) => {
@@ -286,14 +285,13 @@ export function DataGridEx(props) {
286
285
  }, [columns, width]);
287
286
  // Table
288
287
  const table = React.useMemo(() => {
289
- var _a;
290
288
  const defaultOrderByAsc = defaultOrderBy
291
- ? (_a = columns.find((column) => column.field === defaultOrderBy)) === null || _a === void 0 ? void 0 : _a.sortAsc
289
+ ? columns.find((column) => column.field === defaultOrderBy)?.sortAsc
292
290
  : undefined;
293
291
  return (React.createElement(ScrollerGrid, { className: Utils.mergeClasses("DataGridEx-Body", "DataGridEx-CustomBar", className, createGridStyle(alternatingColors, selectedColor, hoverColor)), columnCount: columns.length, columnWidth: columnWidth, defaultOrderBy: defaultOrderBy, defaultOrderByAsc: defaultOrderByAsc, height: height -
294
292
  headerHeight -
295
293
  (hideFooter ? 0 : bottomHeight + 1) -
296
- scrollbarSize, headerRenderer: headerRenderer, idField: idField, itemRenderer: itemRenderer, footerRenderer: hideFooter ? undefined : footerRenderer, width: Math.max(width !== null && width !== void 0 ? width : 0, widthCalculator.total), mRef: mRefLocal, ...rest }));
294
+ scrollbarSize, headerRenderer: headerRenderer, idField: idField, itemRenderer: itemRenderer, footerRenderer: hideFooter ? undefined : footerRenderer, width: Math.max(width ?? 0, widthCalculator.total), mRef: mRefLocal, ...rest }));
297
295
  }, [width]);
298
296
  return (React.createElement(Paper, { sx: {
299
297
  fontSize: "0.875rem",
@@ -28,7 +28,7 @@ export var DataGridRenderers;
28
28
  if (formattedValue == null && field == null)
29
29
  return undefined;
30
30
  // Cell value
31
- const value = formattedValue !== null && formattedValue !== void 0 ? formattedValue : data[field];
31
+ const value = formattedValue ?? data[field];
32
32
  if (value == null)
33
33
  return undefined;
34
34
  // For date time
@@ -36,18 +36,18 @@ export var DataGridRenderers;
36
36
  if (type === GridDataType.Date || type === GridDataType.DateTime) {
37
37
  const dateValue = value instanceof Date ? value : new Date(value);
38
38
  const option = type === GridDataType.DateTime ? 'ds' : 'd';
39
- const nearDays = renderProps === null || renderProps === void 0 ? void 0 : renderProps.nearDays;
39
+ const nearDays = renderProps?.nearDays;
40
40
  if (nearDays != null) {
41
- return (React.createElement(DateText, { value: dateValue, locale: renderProps === null || renderProps === void 0 ? void 0 : renderProps.culture, timeZone: renderProps === null || renderProps === void 0 ? void 0 : renderProps.timeZone, options: option, nearDays: nearDays }));
41
+ return (React.createElement(DateText, { value: dateValue, locale: renderProps?.culture, timeZone: renderProps?.timeZone, options: option, nearDays: nearDays }));
42
42
  }
43
- return DateUtils.format(dateValue, renderProps === null || renderProps === void 0 ? void 0 : renderProps.culture, option, renderProps === null || renderProps === void 0 ? void 0 : renderProps.timeZone);
43
+ return DateUtils.format(dateValue, renderProps?.culture, option, renderProps?.timeZone);
44
44
  }
45
45
  // For numbers
46
46
  if (typeof value === 'number') {
47
47
  if (type === GridDataType.Money || type === GridDataType.IntMoney)
48
- return NumberUtils.formatMoney(value, renderProps === null || renderProps === void 0 ? void 0 : renderProps.currency, renderProps === null || renderProps === void 0 ? void 0 : renderProps.culture, type === GridDataType.IntMoney, renderProps === null || renderProps === void 0 ? void 0 : renderProps.numberFormatOptions);
48
+ return NumberUtils.formatMoney(value, renderProps?.currency, renderProps?.culture, type === GridDataType.IntMoney, renderProps?.numberFormatOptions);
49
49
  else
50
- return NumberUtils.format(value, renderProps === null || renderProps === void 0 ? void 0 : renderProps.culture, renderProps === null || renderProps === void 0 ? void 0 : renderProps.numberFormatOptions);
50
+ return NumberUtils.format(value, renderProps?.culture, renderProps?.numberFormatOptions);
51
51
  }
52
52
  // For boolean
53
53
  if (typeof value === 'boolean') {
package/lib/DataSteps.js CHANGED
@@ -14,7 +14,6 @@ import { MUGlobal } from "./MUGlobal";
14
14
  * @returns Component
15
15
  */
16
16
  export function DataSteps(props) {
17
- var _a;
18
17
  // App
19
18
  const app = globalApp;
20
19
  if (app == null) {
@@ -25,7 +24,7 @@ export function DataSteps(props) {
25
24
  // Destruct
26
25
  const { InputLabelProps = {}, jsonValue, valueFormatter = (_data) => "...", onValueChange, steps, value = "", ...rest } = props;
27
26
  // Shrink
28
- (_a = InputLabelProps.shrink) !== null && _a !== void 0 ? _a : (InputLabelProps.shrink = MUGlobal.searchFieldShrink);
27
+ InputLabelProps.shrink ?? (InputLabelProps.shrink = MUGlobal.searchFieldShrink);
29
28
  // Current index
30
29
  const indexRef = React.useRef(-1);
31
30
  // Current Json data
package/lib/DataTable.js CHANGED
@@ -7,11 +7,10 @@ import { globalApp } from "./app/ReactApp";
7
7
  * @returns Component
8
8
  */
9
9
  export function DataTable(props) {
10
- var _a;
11
10
  // Destructor
12
11
  const { localeText = {}, onCellSelection, toolbarCreator, onProcessRowUpdateError = (error) => console.log("onProcessRowUpdateError", error), ...rest } = props;
13
12
  // Labels
14
- const { noRows } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noRows")) !== null && _a !== void 0 ? _a : {};
13
+ const { noRows } = globalApp?.getLabels("noRows") ?? {};
15
14
  if (noRows && !localeText.noRowsLabel)
16
15
  localeText.noRowsLabel = noRows;
17
16
  const [selectedCellParams, setSelectedCellParams] = React.useState(null);
@@ -7,7 +7,6 @@ import { Labels } from './app/Labels';
7
7
  * @returns Component
8
8
  */
9
9
  export function DialogButton(props) {
10
- var _a;
11
10
  // Labels shared with NotificationMU
12
11
  const labels = Labels.NotificationMU;
13
12
  // Destruct
@@ -30,13 +29,13 @@ export function DialogButton(props) {
30
29
  };
31
30
  // Layout
32
31
  return (React.createElement(React.Fragment, null,
33
- icon == null ? (React.createElement(Button, { ...rest, title: title, onClick: onClickLocal }, children)) : (React.createElement(IconButton, { ...rest, onClick: onClickLocal, title: title !== null && title !== void 0 ? title : children === null || children === void 0 ? void 0 : children.toString() }, icon)),
32
+ icon == null ? (React.createElement(Button, { ...rest, title: title, onClick: onClickLocal }, children)) : (React.createElement(IconButton, { ...rest, onClick: onClickLocal, title: title ?? children?.toString() }, icon)),
34
33
  React.createElement(Dialog, { disableScrollLock: disableScrollLock, fullScreen: fullScreen, fullWidth: fullWidth, maxWidth: maxWidth, open: open, onClose: () => setOpen(false), onClick: (event) => {
35
34
  // The dialog will be embeded and the click event will bubble up
36
35
  // Stop propatation but will also cancel onClose and onBackdropClick event
37
36
  event.stopPropagation();
38
37
  } },
39
- React.createElement(DialogTitle, null, (_a = dialogTitle !== null && dialogTitle !== void 0 ? dialogTitle : title) !== null && _a !== void 0 ? _a : children),
38
+ React.createElement(DialogTitle, null, dialogTitle ?? title ?? children),
40
39
  React.createElement(DialogContent, null,
41
40
  React.createElement(DialogContentText, { component: contentPre ? 'pre' : 'span' }, content),
42
41
  inputs),
package/lib/DnDList.js CHANGED
@@ -55,7 +55,7 @@ export function DnDList(props) {
55
55
  }, [props.items]);
56
56
  const doFormChange = React.useCallback((newItems) => {
57
57
  if (onFormChange)
58
- onFormChange(newItems !== null && newItems !== void 0 ? newItems : items);
58
+ onFormChange(newItems ?? items);
59
59
  }, [items, onFormChange]);
60
60
  const changeItems = React.useCallback((newItems) => {
61
61
  // Possible to alter items with the handler
package/lib/EmailInput.js CHANGED
@@ -5,11 +5,10 @@ import React from 'react';
5
5
  * @param props Props
6
6
  */
7
7
  export function EmailInput(props) {
8
- var _a;
9
8
  // Destruct
10
9
  const { inputProps = {}, ...rest } = props;
11
10
  // Default max length
12
- (_a = inputProps.maxLength) !== null && _a !== void 0 ? _a : (inputProps.maxLength = 128);
11
+ inputProps.maxLength ?? (inputProps.maxLength = 128);
13
12
  // Layout
14
13
  return (React.createElement(TextField, { type: "email", fullWidth: true, inputProps: inputProps, ...rest }));
15
14
  }
@@ -8,7 +8,7 @@ import React from "react";
8
8
  export function FileUploadButton(props) {
9
9
  // Destruct
10
10
  const { maxFiles, maxFileSize, inputProps, onFileInvalid, onUploadFiles, children, ...rest } = props;
11
- const { onChange } = inputProps !== null && inputProps !== void 0 ? inputProps : {};
11
+ const { onChange } = inputProps ?? {};
12
12
  // Layout
13
13
  return (React.createElement(Button, { component: "label", ...rest },
14
14
  children,
@@ -24,18 +24,18 @@ export function GridDataFormat(data, type, renderProps) {
24
24
  if (dateValue == null)
25
25
  return undefined;
26
26
  const option = type === GridDataType.DateTime ? 'ds' : 'd';
27
- const nearDays = renderProps === null || renderProps === void 0 ? void 0 : renderProps.nearDays;
27
+ const nearDays = renderProps?.nearDays;
28
28
  if (nearDays != null) {
29
- return (React.createElement(DateText, { value: dateValue, locale: renderProps === null || renderProps === void 0 ? void 0 : renderProps.culture, timeZone: renderProps === null || renderProps === void 0 ? void 0 : renderProps.timeZone, options: option, nearDays: nearDays }));
29
+ return (React.createElement(DateText, { value: dateValue, locale: renderProps?.culture, timeZone: renderProps?.timeZone, options: option, nearDays: nearDays }));
30
30
  }
31
- return DateUtils.format(dateValue, renderProps === null || renderProps === void 0 ? void 0 : renderProps.culture, option, renderProps === null || renderProps === void 0 ? void 0 : renderProps.timeZone);
31
+ return DateUtils.format(dateValue, renderProps?.culture, option, renderProps?.timeZone);
32
32
  }
33
33
  // For numbers
34
34
  if (typeof data === 'number') {
35
35
  if (type === GridDataType.Money || type === GridDataType.IntMoney)
36
- return NumberUtils.formatMoney(data, renderProps === null || renderProps === void 0 ? void 0 : renderProps.currency, renderProps === null || renderProps === void 0 ? void 0 : renderProps.culture, type === GridDataType.IntMoney, renderProps === null || renderProps === void 0 ? void 0 : renderProps.numberFormatOptions);
36
+ return NumberUtils.formatMoney(data, renderProps?.currency, renderProps?.culture, type === GridDataType.IntMoney, renderProps?.numberFormatOptions);
37
37
  else
38
- return NumberUtils.format(data, renderProps === null || renderProps === void 0 ? void 0 : renderProps.culture, renderProps === null || renderProps === void 0 ? void 0 : renderProps.numberFormatOptions);
38
+ return NumberUtils.format(data, renderProps?.culture, renderProps?.numberFormatOptions);
39
39
  }
40
40
  if (typeof data === 'string')
41
41
  return data;
package/lib/GridUtils.js CHANGED
@@ -76,10 +76,9 @@ export var GridUtils;
76
76
  * @param searchData Search data
77
77
  */
78
78
  function mergeSearchData(state, searchData) {
79
- var _a;
80
79
  if (searchData == null)
81
80
  return;
82
- (_a = state.data) !== null && _a !== void 0 ? _a : (state.data = {});
81
+ state.data ?? (state.data = {});
83
82
  Object.assign(state.data, searchData);
84
83
  }
85
84
  GridUtils.mergeSearchData = mergeSearchData;
package/lib/HiSelector.js CHANGED
@@ -41,7 +41,7 @@ export function HiSelector(props) {
41
41
  return (React.createElement(React.Fragment, null,
42
42
  label && (React.createElement(Grid, { item: true, xs: 12 },
43
43
  React.createElement(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption } }, label))),
44
- React.createElement("input", { type: "hidden", name: name, value: `${currentValue !== null && currentValue !== void 0 ? currentValue : ""}` }),
44
+ React.createElement("input", { type: "hidden", name: name, value: `${currentValue ?? ""}` }),
45
45
  React.createElement(Grid, { item: true, ...breakPoints },
46
46
  React.createElement(SelectEx, { idField: idField, label: labels[0], labelField: labelField, name: "tab1", search: search, fullWidth: true, loadData: () => loadData(), value: values[0], onChange: (event) => doChange(event, 0), onItemChange: doItemChange, required: required, error: error, helperText: helperText, variant: variant })),
47
47
  localValues[0] != null && (React.createElement(Grid, { item: true, ...breakPoints },
@@ -35,7 +35,7 @@ export function HiSelectorTL(props) {
35
35
  return (React.createElement(React.Fragment, null,
36
36
  label && (React.createElement(Grid, { item: true, xs: 12 },
37
37
  React.createElement(FormLabel, { required: required, sx: { fontSize: (theme) => theme.typography.caption } }, label))),
38
- React.createElement("input", { type: "hidden", name: name, value: `${currentValue !== null && currentValue !== void 0 ? currentValue : ""}` }),
38
+ React.createElement("input", { type: "hidden", name: name, value: `${currentValue ?? ""}` }),
39
39
  React.createElement(Grid, { item: true, ...breakPoints },
40
40
  React.createElement(Tiplist, { idField: idField, label: labels[0], name: "tab1", search: search, fullWidth: true, idValue: values[0], loadData: (keyword, id, items) => loadData(keyword, id, items), inputRequired: required, inputError: error, inputHelperText: helperText, onChange: (event, value, reason) => doChange(0, event, value, reason) })),
41
41
  localValues[0] != null && (React.createElement(Grid, { item: true, ...breakPoints },
package/lib/InputField.js CHANGED
@@ -8,18 +8,17 @@ import { MUGlobal } from "./MUGlobal";
8
8
  * @returns Component
9
9
  */
10
10
  export const InputField = React.forwardRef((props, ref) => {
11
- var _a;
12
11
  // Destruct
13
12
  const { changeDelay, InputLabelProps = {}, InputProps = {}, onChange, onChangeDelay, readOnly, size = MUGlobal.inputFieldSize, variant = MUGlobal.inputFieldVariant, ...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;
19
18
  const isMounted = React.useRef(true);
20
19
  const createDelayed = () => {
21
20
  if (changeDelay != null && changeDelay >= 1) {
22
- const changeHandler = onChangeDelay !== null && onChangeDelay !== void 0 ? onChangeDelay : onChange;
21
+ const changeHandler = onChangeDelay ?? onChange;
23
22
  if (changeHandler)
24
23
  return useDelayedExecutor(changeHandler, changeDelay);
25
24
  }
@@ -29,12 +28,12 @@ export const InputField = React.forwardRef((props, ref) => {
29
28
  const onChangeEx = (event) => {
30
29
  if (onChange && (delayed == null || onChangeDelay != null))
31
30
  onChange(event);
32
- delayed === null || delayed === void 0 ? void 0 : delayed.call(undefined, event);
31
+ delayed?.call(undefined, event);
33
32
  };
34
33
  React.useEffect(() => {
35
34
  return () => {
36
35
  isMounted.current = false;
37
- delayed === null || delayed === void 0 ? void 0 : delayed.clear();
36
+ delayed?.clear();
38
37
  };
39
38
  }, []);
40
39
  // Layout
@@ -15,7 +15,7 @@ export function InputTipField(props) {
15
15
  const [data, setData] = React.useState();
16
16
  // Destruct
17
17
  const { labelProps = {
18
- title: globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("clickForDetails"),
18
+ title: globalApp?.get("clickForDetails"),
19
19
  sx: { color: (theme) => theme.palette.error.main, cursor: "pointer" }
20
20
  }, InputProps = {
21
21
  endAdornment: title ? (React.createElement(InputAdornment, { position: "end" },
package/lib/ItemList.js CHANGED
@@ -10,12 +10,11 @@ export function ItemList(props) {
10
10
  const { buttonLabel, className, color = "primary", keepClick = false, items, idField = "id", labelField = "label", minWidth, icon, onClose, selectedValue, size = "medium", title, variant = "outlined" } = props;
11
11
  // Get label
12
12
  const getLabel = (item) => {
13
- var _a;
14
13
  if (typeof labelField === "function") {
15
14
  return labelField(item);
16
15
  }
17
16
  else {
18
- return (_a = DataTypes.convert(item[labelField], "string")) !== null && _a !== void 0 ? _a : "";
17
+ return DataTypes.convert(item[labelField], "string") ?? "";
19
18
  }
20
19
  };
21
20
  // Dialog open or not state
@@ -58,7 +57,7 @@ export function ItemList(props) {
58
57
  }
59
58
  };
60
59
  return (React.createElement(React.Fragment, null,
61
- React.createElement(Button, { className: className, variant: variant, startIcon: icon, color: color, size: size, onClick: clickHandler }, buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : (currentItem ? getLabel(currentItem) : undefined)),
60
+ React.createElement(Button, { className: className, variant: variant, startIcon: icon, color: color, size: size, onClick: clickHandler }, buttonLabel ?? (currentItem ? getLabel(currentItem) : undefined)),
62
61
  React.createElement(Dialog, { "aria-labelledby": "dialog-title", open: open, onClose: closeHandler },
63
62
  title && React.createElement(DialogTitle, { id: "dialog-title" }, title),
64
63
  React.createElement(DialogContent, { sx: { minWidth } },
@@ -9,7 +9,6 @@ import { VBox } from "./FlexBox";
9
9
  * @returns Component
10
10
  */
11
11
  export function ListChooser(props) {
12
- var _a;
13
12
  // Selected ids state
14
13
  const [selectedIds, setSelectedIds] = React.useState([]);
15
14
  const selectProps = (id) => ({
@@ -43,7 +42,7 @@ export function ListChooser(props) {
43
42
  React.createElement(ListItemText, { primary: label }))));
44
43
  }, idField = "id", labelField = "label", loadData, multiple = false, onItemChange, title, doubleClickEnabled = false, onDoubleClick, ...rest } = props;
45
44
  // Default minimum height
46
- (_a = rest.sx) !== null && _a !== void 0 ? _a : (rest.sx = { minHeight: "220px" });
45
+ rest.sx ?? (rest.sx = { minHeight: "220px" });
47
46
  // State
48
47
  const [items, setItems] = React.useState([]);
49
48
  // Query request data
@@ -75,12 +74,12 @@ export function ListChooser(props) {
75
74
  };
76
75
  }, [delayed]);
77
76
  const onDoubleClickLocal = (event) => {
78
- var _a;
79
77
  if (onDoubleClick)
80
78
  onDoubleClick(event);
81
79
  if (doubleClickEnabled) {
82
- const button = (_a = event.currentTarget
83
- .closest("form")) === null || _a === void 0 ? void 0 : _a.elements.namedItem("okButton");
80
+ const button = event.currentTarget
81
+ .closest("form")
82
+ ?.elements.namedItem("okButton");
84
83
  if (button) {
85
84
  button.click();
86
85
  }
@@ -5,11 +5,10 @@ import React from 'react';
5
5
  * @param props Props
6
6
  */
7
7
  export function LoadingButton(props) {
8
- var _a;
9
8
  // Destruct
10
9
  const { endIcon, loadingIconProps = {}, onClick, ...rest } = props;
11
10
  // Default size
12
- (_a = loadingIconProps.size) !== null && _a !== void 0 ? _a : (loadingIconProps.size = 12);
11
+ loadingIconProps.size ?? (loadingIconProps.size = 12);
13
12
  // State
14
13
  // https://stackoverflow.com/questions/55265255/react-usestate-hook-event-handler-using-initial-state
15
14
  const [loading, setLoading] = React.useState(false);
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);