@etsoo/materialui 1.6.39 → 1.6.42
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__/SwitchAnt.tsx +6 -7
- package/lib/cjs/ButtonPopupCheckbox.js +8 -3
- package/lib/cjs/ButtonPopupRadio.js +6 -2
- package/lib/cjs/ComboBox.js +7 -5
- package/lib/cjs/ComboBoxMultiple.js +5 -3
- package/lib/cjs/DataGridEx.js +25 -6
- package/lib/cjs/DataSteps.js +21 -11
- package/lib/cjs/FileUploadButton.js +5 -1
- package/lib/cjs/FlexBox.d.ts +2 -2
- package/lib/cjs/FlexBox.js +3 -2
- package/lib/cjs/InputField.js +3 -4
- package/lib/cjs/MoreFab.js +1 -1
- package/lib/cjs/NotifierMU.js +12 -5
- package/lib/cjs/OptionGroup.js +1 -1
- package/lib/cjs/OptionGroupFlag.js +1 -1
- package/lib/cjs/QuickList.js +3 -3
- package/lib/cjs/ResponsibleContainer.js +4 -1
- package/lib/cjs/SearchBar.js +9 -2
- package/lib/cjs/SearchField.js +8 -9
- package/lib/cjs/SwitchAnt.js +2 -2
- package/lib/cjs/SwitchField.js +1 -1
- package/lib/cjs/TextFieldEx.js +6 -11
- package/lib/cjs/Tiplist.js +2 -2
- package/lib/cjs/TiplistPro.js +1 -1
- package/lib/cjs/TwoFieldInput.d.ts +1 -1
- package/lib/cjs/TwoFieldInput.js +12 -7
- package/lib/cjs/UserAvatarEditor.js +8 -5
- package/lib/cjs/ViewContainer.js +2 -2
- package/lib/cjs/custom/CustomAttributeArea.js +2 -2
- package/lib/cjs/custom/CustomFieldViewer.js +3 -2
- package/lib/cjs/custom/CustomFieldWindow.js +2 -1
- package/lib/cjs/custom/FieldJson.js +1 -1
- package/lib/cjs/custom/FieldTexarea.js +1 -1
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +7 -0
- package/lib/cjs/pages/EditPage.js +3 -1
- package/lib/cjs/pages/ViewPage.js +8 -2
- package/lib/mjs/ButtonPopupCheckbox.js +8 -3
- package/lib/mjs/ButtonPopupRadio.js +6 -2
- package/lib/mjs/ComboBox.js +7 -5
- package/lib/mjs/ComboBoxMultiple.js +5 -3
- package/lib/mjs/DataGridEx.js +25 -6
- package/lib/mjs/DataSteps.js +21 -11
- package/lib/mjs/FileUploadButton.js +5 -1
- package/lib/mjs/FlexBox.d.ts +2 -2
- package/lib/mjs/FlexBox.js +3 -2
- package/lib/mjs/InputField.js +3 -4
- package/lib/mjs/MoreFab.js +1 -1
- package/lib/mjs/NotifierMU.js +12 -5
- package/lib/mjs/OptionGroup.js +1 -1
- package/lib/mjs/OptionGroupFlag.js +1 -1
- package/lib/mjs/QuickList.js +3 -3
- package/lib/mjs/ResponsibleContainer.js +4 -1
- package/lib/mjs/SearchBar.js +9 -2
- package/lib/mjs/SearchField.js +8 -9
- package/lib/mjs/SwitchAnt.js +2 -2
- package/lib/mjs/SwitchField.js +1 -1
- package/lib/mjs/TextFieldEx.js +6 -11
- package/lib/mjs/Tiplist.js +2 -2
- package/lib/mjs/TiplistPro.js +1 -1
- package/lib/mjs/TwoFieldInput.d.ts +1 -1
- package/lib/mjs/TwoFieldInput.js +12 -7
- package/lib/mjs/UserAvatarEditor.js +8 -5
- package/lib/mjs/ViewContainer.js +2 -2
- package/lib/mjs/custom/CustomAttributeArea.js +2 -2
- package/lib/mjs/custom/CustomFieldViewer.js +3 -2
- package/lib/mjs/custom/CustomFieldWindow.js +2 -1
- package/lib/mjs/custom/FieldJson.js +1 -1
- package/lib/mjs/custom/FieldTexarea.js +1 -1
- package/lib/mjs/index.d.ts +1 -0
- package/lib/mjs/index.js +2 -0
- package/lib/mjs/pages/EditPage.js +3 -1
- package/lib/mjs/pages/ViewPage.js +8 -2
- package/package.json +14 -14
- package/src/ButtonPopupCheckbox.tsx +10 -8
- package/src/ButtonPopupRadio.tsx +8 -6
- package/src/ComboBox.tsx +7 -5
- package/src/ComboBoxMultiple.tsx +5 -3
- package/src/ComboBoxPro.tsx +1 -1
- package/src/CultureDataTable.tsx +1 -1
- package/src/DataGridEx.tsx +27 -20
- package/src/DataSteps.tsx +27 -22
- package/src/FileUploadButton.tsx +6 -5
- package/src/FlexBox.tsx +7 -7
- package/src/InputField.tsx +2 -5
- package/src/MoreFab.tsx +8 -8
- package/src/NotifierMU.tsx +12 -12
- package/src/NumberInputField.tsx +1 -0
- package/src/OptionGroup.tsx +3 -5
- package/src/OptionGroupFlag.tsx +3 -5
- package/src/QuickList.tsx +4 -4
- package/src/ResponsibleContainer.tsx +3 -3
- package/src/SearchBar.tsx +7 -7
- package/src/SearchField.tsx +8 -14
- package/src/SwitchAnt.tsx +2 -2
- package/src/SwitchField.tsx +1 -3
- package/src/TextFieldEx.tsx +32 -36
- package/src/Tiplist.tsx +2 -2
- package/src/TiplistPro.tsx +2 -2
- package/src/TwoFieldInput.tsx +33 -31
- package/src/UserAvatarEditor.tsx +15 -10
- package/src/ViewContainer.tsx +6 -2
- package/src/custom/CustomAttributeArea.tsx +3 -3
- package/src/custom/CustomFieldViewer.tsx +8 -3
- package/src/custom/CustomFieldWindow.tsx +4 -4
- package/src/custom/FieldJson.tsx +3 -3
- package/src/custom/FieldTexarea.tsx +1 -1
- package/src/index.ts +3 -0
- package/src/pages/EditPage.tsx +4 -5
- package/src/pages/ViewPage.tsx +11 -8
- package/tsconfig.cjs.json +1 -1
- package/tsconfig.json +2 -2
package/lib/cjs/Tiplist.js
CHANGED
|
@@ -62,7 +62,7 @@ function Tiplist(props) {
|
|
|
62
62
|
}
|
|
63
63
|
// https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
|
|
64
64
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
|
|
65
|
-
Object.assign(params.
|
|
65
|
+
Object.assign(params.slotProps.htmlInput, {
|
|
66
66
|
autoComplete: inputAutoComplete,
|
|
67
67
|
"data-reset": inputReset
|
|
68
68
|
});
|
|
@@ -176,7 +176,7 @@ function Tiplist(props) {
|
|
|
176
176
|
};
|
|
177
177
|
}, []);
|
|
178
178
|
// Layout
|
|
179
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : localIdValue ?? "")}`, readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, disabled: disabled, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
179
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: `${inputValue ?? (state.current.idSet ? "" : (localIdValue ?? ""))}`, readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, disabled: disabled, value: states.value, options: states.options, onChange: (event, value, reason, details) => {
|
|
180
180
|
// Set value
|
|
181
181
|
setInputValue(value);
|
|
182
182
|
// Custom
|
package/lib/cjs/TiplistPro.js
CHANGED
|
@@ -162,7 +162,7 @@ function TiplistPro(props) {
|
|
|
162
162
|
};
|
|
163
163
|
}, []);
|
|
164
164
|
// Layout
|
|
165
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : localIdValue ?? ""), readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, disabled: disabled, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
|
|
165
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { flex: 2 }, children: [(0, jsx_runtime_1.jsx)("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: inputValue ?? (state.current.idSet ? "" : (localIdValue ?? "")), readOnly: true, onChange: inputOnChange, disabled: disabled }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { filterOptions: (options, _state) => options, value: states.value, options: states.options, disabled: disabled, freeSolo: true, clearOnBlur: false, onChange: (event, value, reason, details) => {
|
|
166
166
|
if (typeof value === "object") {
|
|
167
167
|
// Set value
|
|
168
168
|
setInputValue(value);
|
|
@@ -3,7 +3,7 @@ type ValueType = string | number | Date | null | undefined;
|
|
|
3
3
|
/**
|
|
4
4
|
* TwoField Input props
|
|
5
5
|
*/
|
|
6
|
-
export type TwoFieldInputProps = Omit<InputFieldProps, "
|
|
6
|
+
export type TwoFieldInputProps = Omit<InputFieldProps, "value"> & {
|
|
7
7
|
/**
|
|
8
8
|
* Values
|
|
9
9
|
*/
|
package/lib/cjs/TwoFieldInput.js
CHANGED
|
@@ -19,7 +19,8 @@ const Input_1 = __importDefault(require("@mui/material/Input"));
|
|
|
19
19
|
*/
|
|
20
20
|
function TwoFieldInput(props) {
|
|
21
21
|
// Destruct
|
|
22
|
-
const { name,
|
|
22
|
+
const { name, slotProps, type, values, onValuesChange, onChange, onInput, ...rest } = props;
|
|
23
|
+
const { htmlInput, input, ...restSlotProps } = slotProps ?? {};
|
|
23
24
|
// Local values
|
|
24
25
|
const localValues = values == null
|
|
25
26
|
? [null, null]
|
|
@@ -60,11 +61,15 @@ function TwoFieldInput(props) {
|
|
|
60
61
|
valueRef.current = localValues;
|
|
61
62
|
}, [localValues]);
|
|
62
63
|
// Layout
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { name: `${name}-start`, type: type, value: formatValue(localValues[0], type), ref: dimensions[0][0],
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { name: `${name}-start`, type: type, value: formatValue(localValues[0], type), ref: dimensions[0][0], slotProps: {
|
|
65
|
+
input: {
|
|
66
|
+
...input,
|
|
67
|
+
endAdornment: ((0, jsx_runtime_1.jsxs)(InputAdornment_1.default, { position: "end", sx: {
|
|
68
|
+
display: "flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
gap: 1
|
|
71
|
+
}, children: [(0, jsx_runtime_1.jsx)(ArrowRightAlt_1.default, {}), (0, jsx_runtime_1.jsx)(Input_1.default, { type: type, name: `${name}-end`, value: formatValue(localValues[1], type), disableUnderline: true, onInput: onInput, onChange: handleChange, slotProps: { input: htmlInput } })] }))
|
|
72
|
+
},
|
|
73
|
+
...restSlotProps
|
|
69
74
|
}, onInput: onInput, onChange: handleChange, ...rest }));
|
|
70
75
|
}
|
|
@@ -15,6 +15,7 @@ const Remove_1 = __importDefault(require("@mui/icons-material/Remove"));
|
|
|
15
15
|
const Add_1 = __importDefault(require("@mui/icons-material/Add"));
|
|
16
16
|
const Labels_1 = require("./app/Labels");
|
|
17
17
|
const FileUploadButton_1 = require("./FileUploadButton");
|
|
18
|
+
const react_avatar_editor_1 = __importDefault(require("react-avatar-editor"));
|
|
18
19
|
const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
19
20
|
const Skeleton_1 = __importDefault(require("@mui/material/Skeleton"));
|
|
20
21
|
const ButtonGroup_1 = __importDefault(require("@mui/material/ButtonGroup"));
|
|
@@ -42,7 +43,7 @@ function UserAvatarEditor(props) {
|
|
|
42
43
|
// Calculated max width
|
|
43
44
|
const maxWidthCalculated = maxWidth == null || maxWidth < defaultSize ? 2 * width : maxWidth;
|
|
44
45
|
// Ref
|
|
45
|
-
const ref = react_1.default.
|
|
46
|
+
const ref = react_1.default.useRef(null);
|
|
46
47
|
// Image type
|
|
47
48
|
const type = react_1.default.useRef("image/jpeg");
|
|
48
49
|
// Button ref
|
|
@@ -87,6 +88,10 @@ function UserAvatarEditor(props) {
|
|
|
87
88
|
};
|
|
88
89
|
// Handle image load
|
|
89
90
|
const handleLoad = (imageInfo) => {
|
|
91
|
+
if (imageInfo.resource == null ||
|
|
92
|
+
imageInfo.height == null ||
|
|
93
|
+
imageInfo.width == null)
|
|
94
|
+
return;
|
|
90
95
|
// Ignore too small images
|
|
91
96
|
if (imageInfo.resource.width < 10 || imageInfo.resource.height < 10)
|
|
92
97
|
return;
|
|
@@ -167,8 +172,6 @@ function UserAvatarEditor(props) {
|
|
|
167
172
|
}
|
|
168
173
|
}
|
|
169
174
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { direction: "column", spacing: 0.5, width: containerWidth, children: [(0, jsx_runtime_1.jsx)(FileUploadButton_1.FileUploadButton, { variant: "outlined", size: "medium", startIcon: (0, jsx_runtime_1.jsx)(Image_1.default, {}), fullWidth: true, onUploadFiles: handleFileUpload, inputProps: { accept: "image/png, image/jpeg" }, children: selectFileLabel }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { direction: "row", spacing: 0.5, children: [(0, jsx_runtime_1.jsx)(react_1.default.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", width: width, height: localHeight }), children: (0, jsx_runtime_1.jsx)(AE, { ref: ref, border: border, width: width, height: localHeight, onLoadSuccess: handleLoad, image: previewImage ??
|
|
173
|
-
"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", scale: editorState.scale, rotate: editorState.rotate }) }), (0, jsx_runtime_1.jsxs)(ButtonGroup_1.default, { size: "small", orientation: "vertical", disabled: !ready, children: [(0, jsx_runtime_1.jsx)(Button_1.default, { onClick: () => handleRotate(90), title: labels.rotateRight, children: (0, jsx_runtime_1.jsx)(RotateRight_1.default, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default, { onClick: () => handleRotate(-90), title: labels.rotateLeft, children: (0, jsx_runtime_1.jsx)(RotateLeft_1.default, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default, { onClick: handleReset, title: labels.reset, children: (0, jsx_runtime_1.jsx)(ClearAll_1.default, {}) })] })] }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { spacing: 0.5, direction: "row", sx: { paddingBottom: 2 }, alignItems: "center", children: [(0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", disabled: !ready || editorState.scale <= min, onClick: () => adjustScale(false), children: (0, jsx_runtime_1.jsx)(Remove_1.default, {}) }), (0, jsx_runtime_1.jsx)(Slider_1.default, { title: labels.zoom, disabled: !ready, min: min, max: max, step: step, value: editorState.scale, valueLabelDisplay: "auto", valueLabelFormat: (value) => `${Math.round(100 * value) / 100}`, marks: marks, onChange: handleZoom }), (0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", disabled: !ready || editorState.scale >= max, onClick: () => adjustScale(true), children: (0, jsx_runtime_1.jsx)(Add_1.default, {}) })] }), (0, jsx_runtime_1.jsx)(Button_1.default, { ref: buttonRef, variant: "contained", startIcon: (0, jsx_runtime_1.jsx)(Done_1.default, {}), disabled: !ready, onClick: handleDone, children: labels.done })] }));
|
|
175
|
+
return ((0, jsx_runtime_1.jsxs)(Stack_1.default, { direction: "column", spacing: 0.5, sx: { width: containerWidth }, children: [(0, jsx_runtime_1.jsx)(FileUploadButton_1.FileUploadButton, { variant: "outlined", size: "medium", startIcon: (0, jsx_runtime_1.jsx)(Image_1.default, {}), fullWidth: true, onUploadFiles: handleFileUpload, inputProps: { accept: "image/png, image/jpeg" }, children: selectFileLabel }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { direction: "row", spacing: 0.5, children: [(0, jsx_runtime_1.jsx)(react_1.default.Suspense, { fallback: (0, jsx_runtime_1.jsx)(Skeleton_1.default, { variant: "rounded", width: width, height: localHeight }), children: (0, jsx_runtime_1.jsx)(react_avatar_editor_1.default, { ref: ref, border: border, width: width, height: localHeight, onLoadSuccess: handleLoad, image: previewImage ??
|
|
176
|
+
"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", scale: editorState.scale, rotate: editorState.rotate }) }), (0, jsx_runtime_1.jsxs)(ButtonGroup_1.default, { size: "small", orientation: "vertical", disabled: !ready, children: [(0, jsx_runtime_1.jsx)(Button_1.default, { onClick: () => handleRotate(90), title: labels.rotateRight, children: (0, jsx_runtime_1.jsx)(RotateRight_1.default, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default, { onClick: () => handleRotate(-90), title: labels.rotateLeft, children: (0, jsx_runtime_1.jsx)(RotateLeft_1.default, {}) }), (0, jsx_runtime_1.jsx)(Button_1.default, { onClick: handleReset, title: labels.reset, children: (0, jsx_runtime_1.jsx)(ClearAll_1.default, {}) })] })] }), (0, jsx_runtime_1.jsxs)(Stack_1.default, { spacing: 0.5, direction: "row", sx: { alignItems: "center", paddingBottom: 2 }, children: [(0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", disabled: !ready || editorState.scale <= min, onClick: () => adjustScale(false), children: (0, jsx_runtime_1.jsx)(Remove_1.default, {}) }), (0, jsx_runtime_1.jsx)(Slider_1.default, { title: labels.zoom, disabled: !ready, min: min, max: max, step: step, value: editorState.scale, valueLabelDisplay: "auto", valueLabelFormat: (value) => `${Math.round(100 * value) / 100}`, marks: marks, onChange: handleZoom }), (0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", disabled: !ready || editorState.scale >= max, onClick: () => adjustScale(true), children: (0, jsx_runtime_1.jsx)(Add_1.default, {}) })] }), (0, jsx_runtime_1.jsx)(Button_1.default, { ref: buttonRef, variant: "contained", startIcon: (0, jsx_runtime_1.jsx)(Done_1.default, {}), disabled: !ready, onClick: handleDone, children: labels.done })] }));
|
|
174
177
|
}
|
package/lib/cjs/ViewContainer.js
CHANGED
|
@@ -164,7 +164,7 @@ function ViewPageGridItem(props) {
|
|
|
164
164
|
options = getResp(singleRow ?? "small");
|
|
165
165
|
}
|
|
166
166
|
// Layout
|
|
167
|
-
return ((0, jsx_runtime_1.jsxs)(Grid_1.default, { ...gridProps, ...options, children: [label != null && ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "caption", component: horizontal ? "span" : "div", children: label })), typeof data === "object" ? (data) : horizontal ? ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "subtitle2", component: "span", marginLeft: 0.5, children: data })) : ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "subtitle2", children: data }))] }));
|
|
167
|
+
return ((0, jsx_runtime_1.jsxs)(Grid_1.default, { ...gridProps, ...options, children: [label != null && ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "caption", component: horizontal ? "span" : "div", children: label })), typeof data === "object" ? (data) : horizontal ? ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "subtitle2", component: "span", sx: { marginLeft: 0.5 }, children: data })) : ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: "subtitle2", children: data }))] }));
|
|
168
168
|
}
|
|
169
169
|
function ViewContainer(props) {
|
|
170
170
|
// Global app
|
|
@@ -234,5 +234,5 @@ function ViewContainer(props) {
|
|
|
234
234
|
}, [app, fields, data, bp]);
|
|
235
235
|
let leftResult;
|
|
236
236
|
// Layout
|
|
237
|
-
return ((0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true,
|
|
237
|
+
return ((0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, className: "ET-ViewContainer", ref: gridRef, spacing: spacing, sx: { justifyContent: "left" }, children: [leftContainer && (leftResult = leftContainer(data)) != null && ((0, jsx_runtime_1.jsxs)(react_2.default.Fragment, { children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, className: "ET-ViewPage-LeftContainer", spacing: spacing, size: size, ...leftContainerPropsRest, children: leftResult }), (0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, className: "ET-ViewPage-LeftOthers", spacing: spacing, size: ViewPageSize.matchSize(size), children: createFields(data, leftContainerLines * (12 - getItemSize(bp, size))) })] })), createFields(data)] }));
|
|
238
238
|
}
|
|
@@ -41,7 +41,7 @@ function InputItemUIs({ data }) {
|
|
|
41
41
|
const types = Object.keys(CustomFieldUtils_1.CustomFieldUtils.customFieldCreators);
|
|
42
42
|
const nameRef = react_1.default.useRef(null);
|
|
43
43
|
const optionsRef = react_1.default.useRef(null);
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, spacing: 2, marginTop: 1, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { size: { xs: 12, sm: 6 }, children: (0, jsx_runtime_1.jsx)(ComboBox_1.ComboBox, { name: "type", label: labels.type, inputRequired: true, size: "small", loadData: () => Promise.resolve(types.map((t) => ({ id: t, label: t }))), onValueChange: (item) => {
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, spacing: 2, sx: { marginTop: 1 }, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { size: { xs: 12, sm: 6 }, children: (0, jsx_runtime_1.jsx)(ComboBox_1.ComboBox, { name: "type", label: labels.type, inputRequired: true, size: "small", loadData: () => Promise.resolve(types.map((t) => ({ id: t, label: t }))), onValueChange: (item) => {
|
|
45
45
|
const type = item?.id;
|
|
46
46
|
optionsRef.current.disabled =
|
|
47
47
|
type !== "combobox" &&
|
|
@@ -165,7 +165,7 @@ function InputUIs({ source, onChange }) {
|
|
|
165
165
|
console.error("Failed to parse source:", error);
|
|
166
166
|
}
|
|
167
167
|
}, [source]);
|
|
168
|
-
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, {
|
|
168
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsxs)(FlexBox_1.HBox, { spacing: 1, sx: { marginTop: 0.5, alignItems: "center" }, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: labels.sortTip }), (0, jsx_runtime_1.jsx)(Button_1.default, { size: "small", color: "primary", variant: "outlined", startIcon: (0, jsx_runtime_1.jsx)(Add_1.default, {}), onClick: () => editItem(), children: labels.add })] }), (0, jsx_runtime_1.jsx)(Card_1.default, { children: (0, jsx_runtime_1.jsx)(CardContent_1.default, { children: (0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, spacing: 0, children: (0, jsx_runtime_1.jsx)(DnDSortableList_1.DnDSortableList, { items: items, idField: (item) => item.name, labelField: (item) => item.label || item.name, onChange: (items) => doChange(items), itemRenderer: (data, style, { sortable: { index }, ref, handleRef }) => ((0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, size: { xs: 12, sm: 12 }, ref: ref, style: style, spacing: 1, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { size: smallSize, children: (0, jsx_runtime_1.jsx)(IconButton_1.default, { style: { cursor: "move" }, size: "small", title: labels.dragIndicator, ref: handleRef, children: (0, jsx_runtime_1.jsx)(DragIndicator_1.default, {}) }) }), (0, jsx_runtime_1.jsxs)(Grid_1.default, { size: size, children: [index + 1, " - ", data.type, " / ", data.space] }), (0, jsx_runtime_1.jsxs)(Grid_1.default, { size: size, children: [data.name, " - ", data.label] }), (0, jsx_runtime_1.jsxs)(Grid_1.default, { size: smallSize, children: [(0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", title: labels.delete, onClick: () => doChange(items.filter((item) => item.name !== data.name)), children: (0, jsx_runtime_1.jsx)(Delete_1.default, {}) }), (0, jsx_runtime_1.jsx)(IconButton_1.default, { size: "small", title: labels.edit, onClick: () => editItem(data), children: (0, jsx_runtime_1.jsx)(Edit_1.default, {}) })] })] })) }) }) }) })] }));
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* Custom attribute area
|
|
@@ -45,7 +45,8 @@ function CustomFieldViewer(props) {
|
|
|
45
45
|
if (data == null || typeof data !== "object" || Array.isArray(data)) {
|
|
46
46
|
throw new Error("Invalid JSON data");
|
|
47
47
|
}
|
|
48
|
-
return ((0, jsx_runtime_1.jsx)(Grid_1.default, { container: true,
|
|
48
|
+
return ((0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, spacing: spacing, sx: {
|
|
49
|
+
justifyContent: "left",
|
|
49
50
|
".MuiTypography-subtitle2": {
|
|
50
51
|
fontWeight: "bold"
|
|
51
52
|
}
|
|
@@ -56,6 +57,6 @@ function CustomFieldViewer(props) {
|
|
|
56
57
|
return;
|
|
57
58
|
// Field value
|
|
58
59
|
const value = shared_1.Utils.getNestedValue(data, name);
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(Grid_1.default, { size: CustomFieldUtils_1.CustomFieldUtils.transformSpace(field.space), ...field.gridItemProps, children: (0, jsx_runtime_1.jsxs)(FlexBox_1.VBox, {
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(Grid_1.default, { size: CustomFieldUtils_1.CustomFieldUtils.transformSpace(field.space), ...field.gridItemProps, children: (0, jsx_runtime_1.jsxs)(FlexBox_1.VBox, { spacing: verticalGap, children: [(0, jsx_runtime_1.jsx)(Typography_1.default, { component: "div", fontWeight: "bold", fontSize: "small", ...titleProps, children: field.label ?? name }), (0, jsx_runtime_1.jsx)(Typography_1.default, { ...valueProps, children: valueLabelFormatter(value, field) })] }) }, name ?? index));
|
|
60
61
|
}) }));
|
|
61
62
|
}
|
|
@@ -77,7 +77,8 @@ function CustomFieldWindow(props) {
|
|
|
77
77
|
}
|
|
78
78
|
}, {
|
|
79
79
|
fullScreen: app.smDown,
|
|
80
|
-
inputs: ((0, jsx_runtime_1.jsx)(Stack_1.default, { marginTop: 1.5, children: (0, jsx_runtime_1.jsx)(Grid_1.default, { container: true,
|
|
80
|
+
inputs: ((0, jsx_runtime_1.jsx)(Stack_1.default, { sx: { marginTop: 1.5 }, children: (0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, spacing: spacing, sx: {
|
|
81
|
+
justifyContent: "left",
|
|
81
82
|
".MuiTypography-subtitle2": {
|
|
82
83
|
fontWeight: "bold"
|
|
83
84
|
}
|
|
@@ -52,6 +52,6 @@ const FieldJson = ({ field, mref, onChange, defaultValue }) => {
|
|
|
52
52
|
if (!name) {
|
|
53
53
|
return ((0, jsx_runtime_1.jsxs)(Typography_1.default, { children: ["No name for FieldJson ", JSON.stringify(field)] }));
|
|
54
54
|
}
|
|
55
|
-
return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { label: field.label ?? "", helperText: field.helperText, name: name, fullWidth: true, multiline: true, rows: 4,
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { label: field.label ?? "", helperText: field.helperText, name: name, fullWidth: true, multiline: true, rows: 4, slotProps: { htmlInput: { maxLength: 1280 } }, inputRef: inputRef, onChange: () => onChange(name, getValue()), ...field.mainSlotProps }));
|
|
56
56
|
};
|
|
57
57
|
exports.FieldJson = FieldJson;
|
|
@@ -30,6 +30,6 @@ const FieldTexarea = ({ field, mref, onChange, defaultValue }) => {
|
|
|
30
30
|
if (!name) {
|
|
31
31
|
return ((0, jsx_runtime_1.jsxs)(Typography_1.default, { children: ["No name for FieldTextarea ", JSON.stringify(field)] }));
|
|
32
32
|
}
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { label: field.label ?? "", helperText: field.helperText, name: name, fullWidth: true, multiline: true, rows: 4,
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(InputField_1.InputField, { label: field.label ?? "", helperText: field.helperText, name: name, fullWidth: true, multiline: true, rows: 4, slotProps: { htmlInput: { maxLength: 1280 } }, inputRef: inputRef, defaultValue: defaultValue, onChange: () => onChange(name, getValue()), ...field.mainSlotProps }));
|
|
34
34
|
};
|
|
35
35
|
exports.FieldTexarea = FieldTexarea;
|
package/lib/cjs/index.d.ts
CHANGED
package/lib/cjs/index.js
CHANGED
|
@@ -13,7 +13,11 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.AccountTreeIcon = void 0;
|
|
17
21
|
__exportStar(require("./app/CommonApp"), exports);
|
|
18
22
|
__exportStar(require("./app/IServiceApp"), exports);
|
|
19
23
|
__exportStar(require("./app/IServiceAppSettings"), exports);
|
|
@@ -150,3 +154,6 @@ __exportStar(require("./TooltipClick"), exports);
|
|
|
150
154
|
__exportStar(require("./UserAvatar"), exports);
|
|
151
155
|
__exportStar(require("./UserAvatarEditor"), exports);
|
|
152
156
|
__exportStar(require("./ViewContainer"), exports);
|
|
157
|
+
// Icons
|
|
158
|
+
var AccountTree_1 = require("@mui/icons-material/AccountTree");
|
|
159
|
+
Object.defineProperty(exports, "AccountTreeIcon", { enumerable: true, get: function () { return __importDefault(AccountTree_1).default; } });
|
|
@@ -23,7 +23,9 @@ function EditPage(props) {
|
|
|
23
23
|
const { children, isEditing, onDelete, onSubmit, paddings = MUGlobal_1.MUGlobal.pagePaddings, scrollContainer = globalThis, supportBack = true, submitDisabled = false, bottomPart, topPart, operationMessageHandler, gridSpacing = MUGlobal_1.MUGlobal.pagePaddings, ...rest } = props;
|
|
24
24
|
// Labels
|
|
25
25
|
const labels = Labels_1.Labels.CommonPage;
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(CommonPage_1.CommonPage, { paddings: paddings, scrollContainer: scrollContainer, ...rest, children: [operationMessageHandler && ((0, jsx_runtime_1.jsx)(OperationMessageContainer_1.OperationMessageContainer, { handler: operationMessageHandler })), topPart, (0, jsx_runtime_1.jsxs)("form", { onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, justifyContent: "left",
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(CommonPage_1.CommonPage, { paddings: paddings, scrollContainer: scrollContainer, ...rest, children: [operationMessageHandler && ((0, jsx_runtime_1.jsx)(OperationMessageContainer_1.OperationMessageContainer, { handler: operationMessageHandler })), topPart, (0, jsx_runtime_1.jsxs)("form", { onSubmit: onSubmit, children: [(0, jsx_runtime_1.jsx)(Grid_1.default, { container: true, spacing: gridSpacing, sx: { justifyContent: "left", paddingTop: 1 }, children: children }), (0, jsx_runtime_1.jsxs)(Grid_1.default, { container: true, spacing: gridSpacing, sx: {
|
|
27
|
+
position: "sticky",
|
|
28
|
+
display: "flex",
|
|
27
29
|
top: "auto",
|
|
28
30
|
bottom: (theme) => MUGlobal_1.MUGlobal.updateWithTheme(gridSpacing, theme.spacing),
|
|
29
31
|
paddingTop: gridSpacing
|
|
@@ -24,8 +24,14 @@ const Stack_1 = __importDefault(require("@mui/material/Stack"));
|
|
|
24
24
|
* @returns Component
|
|
25
25
|
*/
|
|
26
26
|
function ViewPageActionBar(props) {
|
|
27
|
-
const { actionPaddings = MUGlobal_1.MUGlobal.pagePaddings, ...rest } = props;
|
|
28
|
-
return ((0, jsx_runtime_1.jsx)(Stack_1.default, { className: "ET-ViewPage-Actions", direction: "row",
|
|
27
|
+
const { actionPaddings = MUGlobal_1.MUGlobal.pagePaddings, sx, ...rest } = props;
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(Stack_1.default, { className: "ET-ViewPage-Actions", direction: "row", spacing: actionPaddings, sx: {
|
|
29
|
+
flexWrap: "wrap",
|
|
30
|
+
justifyContent: "center",
|
|
31
|
+
paddingTop: actionPaddings,
|
|
32
|
+
paddingBottom: actionPaddings,
|
|
33
|
+
...sx
|
|
34
|
+
}, ...rest }));
|
|
29
35
|
}
|
|
30
36
|
/**
|
|
31
37
|
* View page
|
|
@@ -34,19 +34,24 @@ function ButtonPopupList(props) {
|
|
|
34
34
|
// Set selected ids
|
|
35
35
|
setSelectedIdsHandler([...value]);
|
|
36
36
|
}, [value]);
|
|
37
|
-
return (_jsxs(VBox, {
|
|
37
|
+
return (_jsxs(VBox, { spacing: 2, children: [_jsx(DnDSortableList, { component: Grid, componentProps: { container: true, spacing: 0 }, items: items, labelField: labelField, onChange: (items) => {
|
|
38
38
|
const ids = items
|
|
39
39
|
.filter((item) => tempSelectedIds.current.includes(item.id))
|
|
40
40
|
.map((item) => item.id);
|
|
41
41
|
onValueChange(ids);
|
|
42
|
-
}, itemRenderer: (item, style, { sortable: { index }, ref, handleRef }) => (_jsxs(Grid, { size: itemSize,
|
|
42
|
+
}, itemRenderer: (item, style, { sortable: { index }, ref, handleRef }) => (_jsxs(Grid, { size: itemSize, spacing: 1, ref: ref, style: {
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
justifyContent: "flex-start",
|
|
46
|
+
...style
|
|
47
|
+
}, children: [_jsx(IconButton, { style: { cursor: "move" }, size: "small", title: labels?.dragIndicator, ref: handleRef, children: _jsx(DragIndicatorIcon, {}) }), _jsx(FormControlLabel, { control: _jsx(Checkbox, { name: "item", value: item.id, checked: selectedIds.includes(item.id), onChange: (e) => {
|
|
43
48
|
const checked = e.target.checked;
|
|
44
49
|
const newIds = [
|
|
45
50
|
...selectedIds.toggleItem(item.id, checked)
|
|
46
51
|
];
|
|
47
52
|
setSelectedIdsHandler(newIds);
|
|
48
53
|
onValueChange(newIds);
|
|
49
|
-
} }), label: `${index + 1}. ${labelFormatter(item)}` })] })), mRef: dndRef }), onAdd && (_jsxs(HBox, {
|
|
54
|
+
} }), label: `${index + 1}. ${labelFormatter(item)}` })] })), mRef: dndRef }), onAdd && (_jsxs(HBox, { spacing: 1, children: [_jsx(TextField, { variant: "outlined", label: labels?.more, fullWidth: true, inputRef: inputRef }), _jsx(Button, { sx: { width: "120px" }, variant: "contained", startIcon: _jsx(AddIcon, {}), size: "small", onClick: async () => {
|
|
50
55
|
if (inputRef.current == null)
|
|
51
56
|
return;
|
|
52
57
|
const input = inputRef.current.value.trim();
|
|
@@ -23,7 +23,7 @@ function ButtonPopupList(props) {
|
|
|
23
23
|
React.useEffect(() => {
|
|
24
24
|
setCurrentValue(value);
|
|
25
25
|
}, [value]);
|
|
26
|
-
return (_jsxs(VBox, {
|
|
26
|
+
return (_jsxs(VBox, { spacing: 2, children: [_jsx(RadioGroup, { value: currentValue ?? "", name: "radio-buttons-group", onChange: (e, v) => {
|
|
27
27
|
const checked = e.target.checked;
|
|
28
28
|
const value = checked
|
|
29
29
|
? typeof items[0].id === "number"
|
|
@@ -32,7 +32,11 @@ function ButtonPopupList(props) {
|
|
|
32
32
|
: undefined;
|
|
33
33
|
setCurrentValue(value);
|
|
34
34
|
onValueChange(value);
|
|
35
|
-
}, children: _jsx(Grid, { container: true, spacing: 0, children: items.map((item) => (_jsx(Grid, { size: itemSize,
|
|
35
|
+
}, children: _jsx(Grid, { container: true, spacing: 0, children: items.map((item) => (_jsx(Grid, { size: itemSize, sx: {
|
|
36
|
+
display: "flex",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
justifyContent: "flex-start"
|
|
39
|
+
}, spacing: 1, children: _jsx(FormControlLabel, { control: _jsx(Radio, { value: item.id }), label: `${labelFormatter(item)}` }) }, item.id))) }) }), onAdd && (_jsxs(HBox, { spacing: 1, children: [_jsx(TextField, { variant: "outlined", label: labels?.more, fullWidth: true, inputRef: inputRef }), _jsx(Button, { sx: { width: "120px" }, variant: "contained", startIcon: _jsx(AddIcon, {}), size: "small", onClick: async () => {
|
|
36
40
|
if (inputRef.current == null)
|
|
37
41
|
return;
|
|
38
42
|
const input = inputRef.current.value.trim();
|
package/lib/mjs/ComboBox.js
CHANGED
|
@@ -42,7 +42,7 @@ export function ComboBox(props) {
|
|
|
42
42
|
// Local default value
|
|
43
43
|
const localValue = idValue != null
|
|
44
44
|
? localOptions.find((o) => o[idField] === idValue)
|
|
45
|
-
: defaultValue ?? value;
|
|
45
|
+
: (defaultValue ?? value);
|
|
46
46
|
// State
|
|
47
47
|
// null for controlled
|
|
48
48
|
const [stateValue, setStateValue] = React.useState(null);
|
|
@@ -59,9 +59,9 @@ export function ComboBox(props) {
|
|
|
59
59
|
if (readOnly != null) {
|
|
60
60
|
Object.assign(params, { readOnly });
|
|
61
61
|
}
|
|
62
|
-
Object.assign(params.
|
|
62
|
+
Object.assign(params.slotProps.htmlInput, { "data-reset": inputReset });
|
|
63
63
|
if (dataReadonly) {
|
|
64
|
-
params.
|
|
64
|
+
params.slotProps.htmlInput.onKeyDown = (event) => {
|
|
65
65
|
if (Keyboard.isTypingContent(event.key)) {
|
|
66
66
|
event.preventDefault();
|
|
67
67
|
}
|
|
@@ -69,7 +69,9 @@ export function ComboBox(props) {
|
|
|
69
69
|
}
|
|
70
70
|
// https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
|
|
71
71
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
|
|
72
|
-
Object.assign(params.
|
|
72
|
+
Object.assign(params.slotProps.htmlInput, {
|
|
73
|
+
autoComplete: inputAutoComplete
|
|
74
|
+
});
|
|
73
75
|
return params;
|
|
74
76
|
};
|
|
75
77
|
const getValue = (value) => {
|
|
@@ -118,7 +120,7 @@ export function ComboBox(props) {
|
|
|
118
120
|
};
|
|
119
121
|
}, []);
|
|
120
122
|
// Layout
|
|
121
|
-
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange, disabled: disabled }), _jsxs(Stack, {
|
|
123
|
+
return (_jsxs("div", { style: { flex: 2 }, children: [_jsx("input", { ref: inputRef, "data-reset": inputReset ?? true, type: idIsString ? "text" : "number", style: { display: "none" }, name: name, value: getValue(stateValue), readOnly: true, onChange: inputOnChange, disabled: disabled }), _jsxs(Stack, { spacing: 0.5, direction: "row", children: [_jsx(Autocomplete, { value: stateValue, disabled: disabled, disableCloseOnSelect: disableCloseOnSelect, getOptionLabel: getOptionLabel, isOptionEqualToValue: (option, value) => option[idField] === value[idField], onChange: (event, value, reason, details) => {
|
|
122
124
|
// Set value
|
|
123
125
|
setInputValue(value);
|
|
124
126
|
// Custom
|
|
@@ -57,9 +57,9 @@ export function ComboBoxMultiple(props) {
|
|
|
57
57
|
if (readOnly != null) {
|
|
58
58
|
Object.assign(params, { readOnly });
|
|
59
59
|
}
|
|
60
|
-
Object.assign(params.
|
|
60
|
+
Object.assign(params.slotProps.htmlInput, { "data-reset": inputReset });
|
|
61
61
|
if (dataReadonly) {
|
|
62
|
-
params.
|
|
62
|
+
params.slotProps.htmlInput.onKeyDown = (event) => {
|
|
63
63
|
if (Keyboard.isTypingContent(event.key)) {
|
|
64
64
|
event.preventDefault();
|
|
65
65
|
}
|
|
@@ -67,7 +67,9 @@ export function ComboBoxMultiple(props) {
|
|
|
67
67
|
}
|
|
68
68
|
// https://stackoverflow.com/questions/15738259/disabling-chrome-autofill
|
|
69
69
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html
|
|
70
|
-
Object.assign(params.
|
|
70
|
+
Object.assign(params.slotProps.htmlInput, {
|
|
71
|
+
autoComplete: inputAutoComplete
|
|
72
|
+
});
|
|
71
73
|
return params;
|
|
72
74
|
};
|
|
73
75
|
const getValue = (value) => {
|
package/lib/mjs/DataGridEx.js
CHANGED
|
@@ -81,7 +81,14 @@ export function DataGridEx(props) {
|
|
|
81
81
|
const theme = useTheme();
|
|
82
82
|
const defaultHeaderRenderer = (states) => {
|
|
83
83
|
const { orderBy } = states.queryPaging;
|
|
84
|
-
return (_jsx(Box, { className: "DataGridEx-Header",
|
|
84
|
+
return (_jsx(Box, { className: "DataGridEx-Header", sx: {
|
|
85
|
+
display: "flex",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
borderBottom: boldBorder,
|
|
88
|
+
fontWeight: 500,
|
|
89
|
+
minWidth: widthCalculator.total,
|
|
90
|
+
height: headerHeight
|
|
91
|
+
}, children: columns.map((column, index) => {
|
|
85
92
|
// Destruct
|
|
86
93
|
const { align, field, header, headerCellRenderer, sortable, sortAsc = true, type } = column;
|
|
87
94
|
// Header text
|
|
@@ -109,11 +116,21 @@ export function DataGridEx(props) {
|
|
|
109
116
|
else {
|
|
110
117
|
sortLabel = headerText;
|
|
111
118
|
}
|
|
112
|
-
return (_jsx(Box, {
|
|
119
|
+
return (_jsx(Box, { sx: {
|
|
120
|
+
textAlign: GridAlignGet(align, type),
|
|
121
|
+
width: columnWidth(index)
|
|
122
|
+
}, children: _jsx(Box, { className: "DataGridEx-Cell", onMouseEnter: handleMouseEnter, ...cellProps, children: sortLabel }) }, field ?? index.toString()));
|
|
113
123
|
}) }));
|
|
114
124
|
};
|
|
115
125
|
function defaultFooterRenderer(rows, states) {
|
|
116
|
-
return (_jsx(Box, { className: "DataGridEx-Footer",
|
|
126
|
+
return (_jsx(Box, { className: "DataGridEx-Footer", sx: {
|
|
127
|
+
display: "flex",
|
|
128
|
+
alignItems: "center",
|
|
129
|
+
borderTop: thinBorder,
|
|
130
|
+
marginTop: "1px",
|
|
131
|
+
minHeight: widthCalculator.total,
|
|
132
|
+
height: bottomHeight - 1
|
|
133
|
+
}, children: columns.map((column, index) => {
|
|
117
134
|
// Destruct
|
|
118
135
|
const { align, field, type } = column;
|
|
119
136
|
// Cell props
|
|
@@ -128,7 +145,10 @@ export function DataGridEx(props) {
|
|
|
128
145
|
checkable
|
|
129
146
|
})
|
|
130
147
|
: undefined;
|
|
131
|
-
return (_jsx(Box, {
|
|
148
|
+
return (_jsx(Box, { sx: {
|
|
149
|
+
textAlign: GridAlignGet(align, type),
|
|
150
|
+
width: columnWidth(index)
|
|
151
|
+
}, children: _jsx(Box, { className: "DataGridEx-Cell", onMouseEnter: handleMouseEnter, ...cellProps, children: cell }) }, "bottom-" + (field ?? index.toString())));
|
|
132
152
|
}) }));
|
|
133
153
|
}
|
|
134
154
|
// Destruct
|
|
@@ -287,8 +307,7 @@ export function DataGridEx(props) {
|
|
|
287
307
|
: cellBoxStyle;
|
|
288
308
|
const cellProps = {
|
|
289
309
|
className: "DataGridEx-Cell",
|
|
290
|
-
textAlign: GridAlignGet(align, type),
|
|
291
|
-
sx: { ...boxStyle }
|
|
310
|
+
sx: { textAlign: GridAlignGet(align, type), ...boxStyle }
|
|
292
311
|
};
|
|
293
312
|
const child = cellRenderer({
|
|
294
313
|
data,
|
package/lib/mjs/DataSteps.js
CHANGED
|
@@ -23,9 +23,8 @@ export function DataSteps(props) {
|
|
|
23
23
|
// Labels
|
|
24
24
|
const labels = app.getLabels("close", "nextStep", "previousStep", "submit");
|
|
25
25
|
// Destruct
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
|
|
26
|
+
const { jsonValue, valueFormatter = (_data) => "...", onValueChange, steps, value = "", slotProps, ...rest } = props;
|
|
27
|
+
const { input, htmlInput, inputLabel, ...restSlotProps } = slotProps ?? {};
|
|
29
28
|
// Current index
|
|
30
29
|
const indexRef = React.useRef(-1);
|
|
31
30
|
// Current Json data
|
|
@@ -41,7 +40,12 @@ export function DataSteps(props) {
|
|
|
41
40
|
const [{ callback, ...rest }, more] = steps(index, jsonRef.current);
|
|
42
41
|
app.showInputDialog({
|
|
43
42
|
...rest,
|
|
44
|
-
buttons: (n, callback) => (_jsxs(HBox, {
|
|
43
|
+
buttons: (n, callback) => (_jsxs(HBox, { spacing: 2, sx: {
|
|
44
|
+
justifyContent: "space-between",
|
|
45
|
+
paddingLeft: 2,
|
|
46
|
+
paddingRight: 2,
|
|
47
|
+
paddingBottom: 2
|
|
48
|
+
}, children: [index === 0 ? (_jsx(Button, { variant: "outlined", startIcon: _jsx(CloseIcon, {}), onClick: () => n.dismiss(), children: labels.close })) : (_jsx(Button, { variant: "outlined", startIcon: _jsx(NavigateBeforeIcon, {}), onClick: () => {
|
|
45
49
|
n.dismiss();
|
|
46
50
|
showStep(indexRef.current - 1);
|
|
47
51
|
}, children: labels.previousStep })), more ? (_jsx(Button, { variant: "contained", startIcon: _jsx(NavigateNextIcon, {}), onClick: async (event) => {
|
|
@@ -75,13 +79,19 @@ export function DataSteps(props) {
|
|
|
75
79
|
React.useEffect(() => {
|
|
76
80
|
setLocalValue(valueFormatter(jsonRef.current));
|
|
77
81
|
}, [valueFormatter]);
|
|
78
|
-
return (_jsx(TextField, { autoComplete: "off",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
return (_jsx(TextField, { autoComplete: "off", slotProps: {
|
|
83
|
+
input: {
|
|
84
|
+
onKeyDown: (event) => {
|
|
85
|
+
if (event.key === "Tab")
|
|
86
|
+
return;
|
|
87
|
+
cancelInput(event);
|
|
88
|
+
},
|
|
89
|
+
onPaste: cancelInput,
|
|
90
|
+
endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { edge: "end", size: "small", children: _jsx(StartIcon, {}) }) })),
|
|
91
|
+
...input
|
|
83
92
|
},
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
htmlInput: { style: { cursor: "pointer" }, ...htmlInput },
|
|
94
|
+
inputLabel: { shrink: MUGlobal.searchFieldShrink, ...inputLabel },
|
|
95
|
+
...restSlotProps
|
|
86
96
|
}, onClick: () => showStep(0), value: localValue, ...rest }));
|
|
87
97
|
}
|
|
@@ -45,7 +45,11 @@ export function FileUploadButton(props) {
|
|
|
45
45
|
onUploadFiles(files);
|
|
46
46
|
};
|
|
47
47
|
// Layout
|
|
48
|
-
return (_jsxs(HBox, {
|
|
48
|
+
return (_jsxs(HBox, { sx: {
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
flexWrap: "wrap",
|
|
51
|
+
border: (theme) => dragOver ? "1px dashed " + theme.palette.warning.main : undefined
|
|
52
|
+
}, spacing: 0.5, ...(dropFilesLabel == null
|
|
49
53
|
? undefined
|
|
50
54
|
: {
|
|
51
55
|
onDrop: handleDrop,
|
package/lib/mjs/FlexBox.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { StackProps } from "@mui/material/Stack";
|
|
|
4
4
|
* @param props Props
|
|
5
5
|
* @returns Component
|
|
6
6
|
*/
|
|
7
|
-
export declare function HBox(props: Omit<StackProps, "ref">): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function HBox(props: Omit<StackProps, "ref" | "direction">): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
/**
|
|
9
9
|
* Horizonal box with list items
|
|
10
10
|
* @param props Props
|
|
@@ -16,4 +16,4 @@ export declare function HBoxList(props: Omit<StackProps, "direction">): import("
|
|
|
16
16
|
* @param props Props
|
|
17
17
|
* @returns Component
|
|
18
18
|
*/
|
|
19
|
-
export declare function VBox(props: Omit<StackProps, "ref">): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function VBox(props: Omit<StackProps, "ref" | "direction">): import("react/jsx-runtime").JSX.Element;
|
package/lib/mjs/FlexBox.js
CHANGED
|
@@ -6,7 +6,7 @@ import Stack from "@mui/material/Stack";
|
|
|
6
6
|
* @returns Component
|
|
7
7
|
*/
|
|
8
8
|
export function HBox(props) {
|
|
9
|
-
return _jsx(Stack, { direction: "row",
|
|
9
|
+
return _jsx(Stack, { direction: "row", ...props });
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* Horizonal box with list items
|
|
@@ -14,7 +14,8 @@ export function HBox(props) {
|
|
|
14
14
|
* @returns Component
|
|
15
15
|
*/
|
|
16
16
|
export function HBoxList(props) {
|
|
17
|
-
|
|
17
|
+
const { sx, ...rest } = props;
|
|
18
|
+
return (_jsx(Stack, { spacing: 1, direction: "row", sx: { flexWrap: "wrap", ...sx }, ...rest }));
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Vertial box
|
package/lib/mjs/InputField.js
CHANGED
|
@@ -10,7 +10,7 @@ import TextField from "@mui/material/TextField";
|
|
|
10
10
|
*/
|
|
11
11
|
export function InputField(props) {
|
|
12
12
|
// Destruct
|
|
13
|
-
const {
|
|
13
|
+
const { slotProps, onChange, onChangeDelay, changeDelay = onChangeDelay ? [480] : undefined, readOnly, size = MUGlobal.inputFieldSize, variant = MUGlobal.inputFieldVariant, ...rest } = props;
|
|
14
14
|
// Slot props
|
|
15
15
|
const { htmlInput, input, inputLabel, ...restSlotProps } = slotProps ?? {};
|
|
16
16
|
const isMounted = React.useRef(true);
|
|
@@ -44,10 +44,9 @@ export function InputField(props) {
|
|
|
44
44
|
return (_jsx(TextField, { slotProps: {
|
|
45
45
|
htmlInput: {
|
|
46
46
|
["data-min-chars"]: changeDelay?.[1],
|
|
47
|
-
...htmlInput
|
|
48
|
-
...inputProps
|
|
47
|
+
...htmlInput
|
|
49
48
|
},
|
|
50
|
-
input: { readOnly, ...input
|
|
49
|
+
input: { readOnly, ...input },
|
|
51
50
|
inputLabel: {
|
|
52
51
|
shrink: MUGlobal.inputFieldShrink,
|
|
53
52
|
...inputLabel
|
package/lib/mjs/MoreFab.js
CHANGED
|
@@ -80,7 +80,7 @@ export function MoreFab(props) {
|
|
|
80
80
|
const hasIcon = actionsLocal.some((action) => action.icon != null);
|
|
81
81
|
// Main
|
|
82
82
|
const main = iconButton ? (_jsx(IconButton, { color: color, size: size, title: title, onClick: handleClick, children: icon })) : (_jsx(Fab, { color: color, size: size, title: title, onClick: handleClick, children: icon }));
|
|
83
|
-
return (_jsxs(React.Fragment, { children: [main, _jsx(Menu, { disableScrollLock: true, anchorEl: anchorEl, anchorOrigin: anchorOrigin, keepMounted: true, transformOrigin: transformOrigin, open: open, onClose: handleClose,
|
|
83
|
+
return (_jsxs(React.Fragment, { children: [main, _jsx(Menu, { disableScrollLock: true, anchorEl: anchorEl, anchorOrigin: anchorOrigin, keepMounted: true, transformOrigin: transformOrigin, open: open, onClose: handleClose, slotProps: { paper: PaperProps }, children: actionsLocal.map(({ label, icon, action }, index) => label === "-" ? (_jsx(Divider, {}, index)) : (_jsxs(MenuItem, { ...(typeof action === "string"
|
|
84
84
|
? action.includes("://")
|
|
85
85
|
? {
|
|
86
86
|
component: "a",
|