@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.
- package/__tests__/NotifierMUTests.tsx +140 -140
- package/__tests__/ResponsePage.tsx +48 -0
- package/__tests__/SelectEx.tsx +2 -2
- package/__tests__/SwitchAnt.tsx +17 -17
- 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 +3 -4
- package/tsconfig.json +3 -3
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);
|
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
|
|
24
|
+
const localValue = defaultValue ?? value;
|
|
26
25
|
// Shrink
|
|
27
|
-
|
|
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 } =
|
|
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
|
|
41
|
+
title ?? (title = labels.success);
|
|
43
42
|
}
|
|
44
43
|
else if (this.type === NotificationMessageType.Info) {
|
|
45
44
|
icon = React.createElement(Info, null);
|
|
46
|
-
title
|
|
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
|
|
49
|
+
title ?? (title = labels.warning);
|
|
51
50
|
}
|
|
52
51
|
else {
|
|
53
52
|
icon = React.createElement(Error, { color: "error" });
|
|
54
|
-
title
|
|
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 =
|
|
82
|
-
const { buttons, okLabel = labels.confirmYes, cancelLabel = labels.confirmNo, cancelButton = true, inputs, fullScreen, fullWidth = true, maxWidth, primaryButton, closable = false } =
|
|
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 =
|
|
133
|
-
const { buttons, cancelLabel = labels.promptCancel, okLabel = labels.promptOK, cancelButton = true, inputs, type, fullScreen, fullWidth = true, maxWidth, primaryButton, inputProps, closable = false } =
|
|
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
|
|
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
|
|
168
|
+
input?.focus();
|
|
172
169
|
return false;
|
|
173
170
|
}
|
|
174
171
|
if (typeof v === "string") {
|
|
175
172
|
setError(v);
|
|
176
|
-
input
|
|
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
|
-
|
|
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" } =
|
|
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 =
|
|
11
|
+
const options = globalApp?.getBools() ?? [];
|
|
13
12
|
// Layout
|
|
14
13
|
return (React.createElement(OptionGroup, { options: options, row: true, multiple: false, ...props }));
|
|
15
14
|
}
|
package/lib/OptionGroup.js
CHANGED
|
@@ -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
|
|
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
|
|
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:
|
|
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);
|
package/lib/OptionGroupFlag.js
CHANGED
|
@@ -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
|
|
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);
|