@etsoo/materialui 1.3.42 → 1.3.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/tsconfig.json +17 -17
- package/lib/AddresSelector.js +1 -2
- package/lib/AuditDisplay.js +2 -3
- package/lib/BridgeCloseButton.js +1 -2
- package/lib/ComboBox.js +5 -5
- package/lib/ComboBoxMultiple.js +7 -8
- package/lib/ComboBoxPro.js +1 -2
- package/lib/CultureDataTable.js +2 -2
- package/lib/DataGridEx.d.ts +2 -3
- package/lib/DataGridEx.js +12 -14
- package/lib/DataGridRenderers.js +6 -6
- package/lib/DataSteps.js +1 -2
- package/lib/DataTable.js +1 -2
- package/lib/DialogButton.js +2 -3
- package/lib/DnDList.js +1 -1
- package/lib/EmailInput.js +1 -2
- package/lib/FileUploadButton.js +1 -1
- package/lib/GridDataFormat.js +5 -5
- package/lib/GridUtils.js +1 -2
- package/lib/HiSelector.js +1 -1
- package/lib/HiSelectorTL.js +1 -1
- package/lib/InputField.js +4 -5
- package/lib/InputTipField.js +1 -1
- package/lib/ItemList.js +2 -3
- package/lib/ListChooser.js +4 -5
- package/lib/LoadingButton.js +1 -2
- package/lib/MaskInput.js +2 -3
- package/lib/NotifierMU.js +14 -19
- package/lib/OptionBool.js +1 -2
- package/lib/OptionGroup.js +3 -4
- package/lib/OptionGroupFlag.js +1 -1
- package/lib/QuickList.js +2 -2
- package/lib/ResponsibleContainer.d.ts +3 -3
- package/lib/ResponsibleContainer.js +3 -3
- package/lib/ScrollerListEx.d.ts +6 -7
- package/lib/ScrollerListEx.js +30 -36
- package/lib/SearchField.js +3 -4
- package/lib/SelectBool.js +1 -2
- package/lib/SelectEx.js +6 -8
- package/lib/ShowDataComparison.js +3 -4
- package/lib/Switch.js +1 -2
- package/lib/SwitchAnt.js +6 -7
- package/lib/TableEx.js +5 -7
- package/lib/TagList.js +3 -5
- package/lib/TagListPro.js +3 -5
- package/lib/TextFieldEx.js +2 -2
- package/lib/Tiplist.js +6 -8
- package/lib/TiplistPro.js +9 -10
- package/lib/TooltipClick.js +2 -2
- package/lib/TwoFieldInput.js +1 -1
- package/lib/UserAvatar.js +1 -2
- package/lib/UserAvatarEditor.js +4 -6
- package/lib/app/CommonApp.js +1 -1
- package/lib/app/ReactApp.js +4 -6
- package/lib/app/ServiceApp.js +5 -7
- package/lib/pages/DataGridPage.d.ts +2 -2
- package/lib/pages/DataGridPage.js +2 -3
- package/lib/pages/DataGridPageProps.d.ts +2 -2
- package/lib/pages/FixedListPage.d.ts +2 -2
- package/lib/pages/FixedListPage.js +2 -3
- package/lib/pages/LeftDrawer.js +2 -3
- package/lib/pages/ListPage.d.ts +2 -2
- package/lib/pages/ListPage.js +2 -3
- package/lib/pages/ListPageProps.d.ts +1 -1
- package/lib/pages/ResponsivePage.d.ts +2 -2
- package/lib/pages/ResponsivePage.js +1 -2
- package/lib/pages/ResponsivePageProps.d.ts +2 -2
- package/lib/pages/TablePage.js +3 -5
- package/lib/pages/UserMenu.js +1 -2
- package/lib/pages/ViewPage.js +6 -7
- package/package.json +14 -12
- package/src/DataGridEx.tsx +6 -12
- package/src/ResponsibleContainer.tsx +7 -9
- package/src/ScrollerListEx.tsx +301 -311
- package/src/pages/DataGridPage.tsx +4 -5
- package/src/pages/DataGridPageProps.ts +3 -4
- package/src/pages/FixedListPage.tsx +4 -5
- package/src/pages/ListPage.tsx +4 -5
- package/src/pages/ListPageProps.ts +2 -3
- package/src/pages/ResponsivePage.tsx +4 -5
- package/src/pages/ResponsivePageProps.ts +2 -3
- package/tsconfig.json +3 -3
package/__tests__/tsconfig.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
}
|
package/lib/AddresSelector.js
CHANGED
|
@@ -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" } =
|
|
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);
|
package/lib/AuditDisplay.js
CHANGED
|
@@ -6,8 +6,7 @@ import { ListMoreDisplay } from "./ListMoreDisplay";
|
|
|
6
6
|
import { ShowDataComparison } from "./ShowDataComparison";
|
|
7
7
|
// Get label
|
|
8
8
|
const getLabel = (key) => {
|
|
9
|
-
|
|
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
|
|
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),
|
package/lib/BridgeCloseButton.js
CHANGED
|
@@ -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 =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
package/lib/ComboBoxMultiple.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
37
|
-
:
|
|
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
|
|
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
|
|
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)
|
package/lib/ComboBoxPro.js
CHANGED
|
@@ -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 } =
|
|
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);
|
package/lib/CultureDataTable.js
CHANGED
|
@@ -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
|
|
12
|
-
const getCultureLabel = React.useCallback((value) =>
|
|
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",
|
package/lib/DataGridEx.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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) =>
|
|
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
|
-
|
|
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
|
-
?
|
|
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
|
|
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",
|
package/lib/DataGridRenderers.js
CHANGED
|
@@ -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
|
|
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
|
|
39
|
+
const nearDays = renderProps?.nearDays;
|
|
40
40
|
if (nearDays != null) {
|
|
41
|
-
return (React.createElement(DateText, { value: dateValue, locale: renderProps
|
|
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
|
|
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
|
|
48
|
+
return NumberUtils.formatMoney(value, renderProps?.currency, renderProps?.culture, type === GridDataType.IntMoney, renderProps?.numberFormatOptions);
|
|
49
49
|
else
|
|
50
|
-
return NumberUtils.format(value, renderProps
|
|
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
|
-
|
|
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 } =
|
|
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);
|
package/lib/DialogButton.js
CHANGED
|
@@ -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
|
|
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,
|
|
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
|
|
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
|
-
|
|
11
|
+
inputProps.maxLength ?? (inputProps.maxLength = 128);
|
|
13
12
|
// Layout
|
|
14
13
|
return (React.createElement(TextField, { type: "email", fullWidth: true, inputProps: inputProps, ...rest }));
|
|
15
14
|
}
|
package/lib/FileUploadButton.js
CHANGED
|
@@ -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
|
|
11
|
+
const { onChange } = inputProps ?? {};
|
|
12
12
|
// Layout
|
|
13
13
|
return (React.createElement(Button, { component: "label", ...rest },
|
|
14
14
|
children,
|
package/lib/GridDataFormat.js
CHANGED
|
@@ -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
|
|
27
|
+
const nearDays = renderProps?.nearDays;
|
|
28
28
|
if (nearDays != null) {
|
|
29
|
-
return (React.createElement(DateText, { value: dateValue, locale: renderProps
|
|
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
|
|
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
|
|
36
|
+
return NumberUtils.formatMoney(data, renderProps?.currency, renderProps?.culture, type === GridDataType.IntMoney, renderProps?.numberFormatOptions);
|
|
37
37
|
else
|
|
38
|
-
return NumberUtils.format(data, renderProps
|
|
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
|
-
|
|
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
|
|
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 },
|
package/lib/HiSelectorTL.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
|
31
|
+
delayed?.call(undefined, event);
|
|
33
32
|
};
|
|
34
33
|
React.useEffect(() => {
|
|
35
34
|
return () => {
|
|
36
35
|
isMounted.current = false;
|
|
37
|
-
delayed
|
|
36
|
+
delayed?.clear();
|
|
38
37
|
};
|
|
39
38
|
}, []);
|
|
40
39
|
// Layout
|
package/lib/InputTipField.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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 } },
|
package/lib/ListChooser.js
CHANGED
|
@@ -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
|
-
|
|
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 =
|
|
83
|
-
.closest("form")
|
|
80
|
+
const button = event.currentTarget
|
|
81
|
+
.closest("form")
|
|
82
|
+
?.elements.namedItem("okButton");
|
|
84
83
|
if (button) {
|
|
85
84
|
button.click();
|
|
86
85
|
}
|
package/lib/LoadingButton.js
CHANGED
|
@@ -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
|
-
|
|
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);
|