@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
@@ -1,19 +1,19 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "ES2019",
4
- "module": "ESNext",
5
- "allowJs": true,
6
- "skipLibCheck": true,
7
- "esModuleInterop": true,
8
- "allowSyntheticDefaultImports": true,
9
- "strict": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "moduleResolution": "node",
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "noEmit": true,
15
- "jsx": "react",
16
- "declaration": true
17
- },
18
- "include": [".."]
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Node10",
6
+ "allowJs": false,
7
+ "skipLibCheck": true,
8
+ "esModuleInterop": true,
9
+ "allowSyntheticDefaultImports": true,
10
+ "strict": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react",
16
+ "declaration": true
17
+ },
18
+ "include": [".."]
19
19
  }
@@ -18,9 +18,8 @@ export var AddressField;
18
18
  * @param props Props
19
19
  */
20
20
  export function AddressSelector(props) {
21
- var _a;
22
21
  // Labels
23
- const { city: cityDefault = "City", district: districtDefault = "District", region: regionDefault = "Region", state: stateDefault = "State" } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("region", "state", "city", "district")) !== null && _a !== void 0 ? _a : {};
22
+ const { city: cityDefault = "City", district: districtDefault = "District", region: regionDefault = "Region", state: stateDefault = "State" } = globalApp?.getLabels("region", "state", "city", "district") ?? {};
24
23
  // Destruct
25
24
  const { api, city, cityLabel = cityDefault, district, districtLabel = districtDefault, error, favoredIds, helperText, hideRegion, label, onChange, region, regionLabel = regionDefault, required, search, state, stateLabel = stateDefault, breakPoints = { xs: 12, md: 6, lg: hideRegion ? 4 : 3 } } = props;
26
25
  const isMounted = React.useRef(true);
@@ -6,8 +6,7 @@ import { ListMoreDisplay } from "./ListMoreDisplay";
6
6
  import { ShowDataComparison } from "./ShowDataComparison";
7
7
  // Get label
8
8
  const getLabel = (key) => {
9
- var _a;
10
- return (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get(Utils.formatInitial(key))) !== null && _a !== void 0 ? _a : key;
9
+ return globalApp?.get(Utils.formatInitial(key)) ?? key;
11
10
  };
12
11
  // Format date
13
12
  const formatDate = (date) => {
@@ -30,7 +29,7 @@ export function AuditDisplay(props) {
30
29
  padding: [theme.spacing(1.5), theme.spacing(1)].join(" "),
31
30
  background: index % 2 === 0 ? theme.palette.grey[100] : theme.palette.grey[50]
32
31
  }), getColumnLabel, equalCheck, itemRenderer = (data) => {
33
- const { newData, oldData, changes = { newData: newData !== null && newData !== void 0 ? newData : {}, oldData: oldData !== null && oldData !== void 0 ? oldData : {} } } = data;
32
+ const { newData, oldData, changes = { newData: newData ?? {}, oldData: oldData ?? {} } } = data;
34
33
  return (React.createElement(React.Fragment, null,
35
34
  changes != null && (React.createElement(Button, { variant: "outlined", size: "small", onClick: () => ShowDataComparison(changes, title, getColumnLabel, equalCheck), sx: {
36
35
  marginLeft: theme.spacing(1),
@@ -9,9 +9,8 @@ import { globalApp } from "./app/ReactApp";
9
9
  * @returns Component
10
10
  */
11
11
  export function BridgeCloseButton(props) {
12
- var _a;
13
12
  // Destruct
14
- const { boxProps, onClick, title = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("close")) !== null && _a !== void 0 ? _a : "Close", validate, ...rest } = props;
13
+ const { boxProps, onClick, title = globalApp?.get("close") ?? "Close", validate, ...rest } = props;
15
14
  // Host
16
15
  const host = BridgeUtils.host;
17
16
  if (host == null ||
package/lib/ComboBox.js CHANGED
@@ -14,13 +14,13 @@ import { globalApp } from "./app/ReactApp";
14
14
  */
15
15
  export function ComboBox(props) {
16
16
  // Labels
17
- const labels = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "open", "add");
17
+ const labels = globalApp?.getLabels("noOptions", "loading", "open", "add");
18
18
  // Destruct
19
- const { search = false, autoAddBlankItem = search, idField = "id", idValue, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels === null || labels === void 0 ? void 0 : labels.noOptions, loadingText = labels === null || labels === void 0 ? void 0 : labels.loading, openText = labels === null || labels === void 0 ? void 0 : labels.open, addLabel = labels === null || labels === void 0 ? void 0 : labels.add, onAdd, ...rest } = props;
19
+ const { search = false, autoAddBlankItem = search, idField = "id", idValue, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, onValueChange, openOnFocus = true, value, disableCloseOnSelect = false, getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px", flexGrow: 2 }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, openText = labels?.open, addLabel = labels?.add, onAdd, ...rest } = props;
20
20
  // Value input ref
21
21
  const inputRef = React.createRef();
22
22
  // Options state
23
- const [localOptions, setOptions] = React.useState(options !== null && options !== void 0 ? options : []);
23
+ const [localOptions, setOptions] = React.useState(options ?? []);
24
24
  const isMounted = React.useRef(true);
25
25
  // When options change
26
26
  // [options] will cause infinite loop
@@ -37,7 +37,7 @@ export function ComboBox(props) {
37
37
  // Local default value
38
38
  const localValue = idValue != null
39
39
  ? localOptions.find((o) => o[idField] === idValue)
40
- : defaultValue !== null && defaultValue !== void 0 ? defaultValue : value;
40
+ : defaultValue ?? value;
41
41
  // State
42
42
  // null for controlled
43
43
  const [stateValue, setStateValue] = React.useState(null);
@@ -113,7 +113,7 @@ export function ComboBox(props) {
113
113
  }, []);
114
114
  // Layout
115
115
  return (React.createElement("div", null,
116
- React.createElement("input", { ref: inputRef, "data-reset": inputReset !== null && inputReset !== void 0 ? inputReset : true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }),
116
+ React.createElement("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }),
117
117
  React.createElement(Stack, { gap: 0.5, direction: "row", width: "100%" },
118
118
  React.createElement(Autocomplete, { value: stateValue, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
119
119
  // Set value
@@ -16,30 +16,29 @@ const checkedIcon = React.createElement(CheckBoxIcon, { fontSize: "small" });
16
16
  * @returns Component
17
17
  */
18
18
  export function ComboBoxMultiple(props) {
19
- var _a;
20
19
  // Labels
21
- const labels = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading");
20
+ const labels = globalApp?.getLabels("noOptions", "loading");
22
21
  // Destruct
23
22
  const { search = false, autoAddBlankItem = search, idField = "id", idValue, idValues, inputError, inputHelperText, inputMargin, inputOnChange, inputRequired, inputReset, inputVariant, defaultValue, label, labelField = "label", loadData, onLoadData, name, inputAutoComplete = "off", options, dataReadonly = true, readOnly, onChange, openOnFocus = true, value, disableCloseOnSelect = true, renderOption = (props, option, { selected }) => (React.createElement("li", { ...props },
24
23
  React.createElement(React.Fragment, null,
25
24
  React.createElement(Checkbox, { icon: icon, checkedIcon: checkedIcon, style: { marginRight: 8 }, checked: selected }),
26
- option[labelField]))), getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px" }, noOptionsText = labels === null || labels === void 0 ? void 0 : labels.noOptions, loadingText = labels === null || labels === void 0 ? void 0 : labels.loading, ...rest } = props;
25
+ option[labelField]))), getOptionLabel = (option) => `${option[labelField]}`, sx = { minWidth: "150px" }, noOptionsText = labels?.noOptions, loadingText = labels?.loading, ...rest } = props;
27
26
  // Value input ref
28
27
  const inputRef = React.createRef();
29
28
  // Options state
30
- const [localOptions, setOptions] = React.useState(options !== null && options !== void 0 ? options : []);
29
+ const [localOptions, setOptions] = React.useState(options ?? []);
31
30
  const isMounted = React.useRef(true);
32
31
  // Local default value
33
32
  const localValue = idValue != null
34
33
  ? localOptions.filter((o) => o[idField] === idValue)
35
34
  : idValues != null
36
- ? localOptions.filter((o) => idValues === null || idValues === void 0 ? void 0 : idValues.includes(o[idField]))
37
- : (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.concat()) !== null && _a !== void 0 ? _a : value === null || value === void 0 ? void 0 : value.concat();
35
+ ? localOptions.filter((o) => idValues?.includes(o[idField]))
36
+ : defaultValue?.concat() ?? value?.concat();
38
37
  // State
39
38
  // null for controlled
40
39
  const [stateValue, setStateValue] = React.useState(null);
41
40
  React.useEffect(() => {
42
- setStateValue(localValue !== null && localValue !== void 0 ? localValue : []);
41
+ setStateValue(localValue ?? []);
43
42
  }, [localValue]);
44
43
  // When options change
45
44
  // [options] will cause infinite loop
@@ -116,7 +115,7 @@ export function ComboBoxMultiple(props) {
116
115
  }, []);
117
116
  // Layout
118
117
  return (React.createElement("div", null,
119
- React.createElement("input", { ref: inputRef, "data-reset": inputReset !== null && inputReset !== void 0 ? inputReset : true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }),
118
+ React.createElement("input", { ref: inputRef, "data-reset": inputReset ?? true, type: "text", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange }),
120
119
  React.createElement(Autocomplete, { value: stateValue == null
121
120
  ? []
122
121
  : Array.isArray(stateValue)
@@ -4,9 +4,8 @@ import { globalApp } from "./app/ReactApp";
4
4
  import { InputField } from "./InputField";
5
5
  import { DataTypes } from "@etsoo/shared";
6
6
  export function ComboBoxPro(props) {
7
- var _a;
8
7
  // Labels
9
- const { noOptions, loading: loadingLabel, open: openDefault } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "open")) !== null && _a !== void 0 ? _a : {};
8
+ const { noOptions, loading: loadingLabel, open: openDefault } = globalApp?.getLabels("noOptions", "loading", "open") ?? {};
10
9
  // Destruct
11
10
  const { noOptionsText = noOptions, loadingText = loadingLabel, openText = openDefault, options, openOnFocus = true, label, inputProps, name, value, idValue, onChange, onValueChange, ...rest } = props;
12
11
  const [open, setOpen] = React.useState(false);
@@ -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);