@etsoo/materialui 1.3.32 → 1.3.34
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/lib/ComboBoxPro.js +2 -2
- package/lib/FieldSetEx.d.ts +21 -0
- package/lib/FieldSetEx.js +29 -0
- package/lib/MUUtils.d.ts +0 -7
- package/lib/MUUtils.js +0 -13
- package/lib/OptionGroup.d.ts +1 -5
- package/lib/OptionGroup.js +9 -16
- package/lib/OptionGroupFlag.d.ts +76 -0
- package/lib/OptionGroupFlag.js +89 -0
- package/lib/QuickList.js +2 -2
- package/lib/SwitchField.d.ts +5 -5
- package/lib/SwitchField.js +11 -11
- package/lib/TagListPro.js +2 -1
- package/lib/Tiplist.d.ts +2 -2
- package/lib/Tiplist.js +1 -5
- package/lib/TiplistPro.js +2 -2
- package/lib/app/IServiceAppSettings.d.ts +3 -3
- package/lib/app/IServiceUser.d.ts +2 -1
- package/lib/app/ISmartERPUser.d.ts +2 -1
- package/lib/app/ReactApp.d.ts +2 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +25 -25
- package/src/ComboBoxPro.tsx +2 -3
- package/src/FieldSetEx.tsx +71 -0
- package/src/MUUtils.ts +0 -14
- package/src/OptionGroup.tsx +13 -29
- package/src/OptionGroupFlag.tsx +266 -0
- package/src/QuickList.tsx +2 -3
- package/src/SwitchField.tsx +29 -32
- package/src/TagListPro.tsx +2 -3
- package/src/Tiplist.tsx +3 -7
- package/src/TiplistPro.tsx +2 -3
- package/src/app/CommonApp.ts +1 -1
- package/src/app/IServiceAppSettings.ts +8 -8
- package/src/app/IServiceUser.ts +2 -1
- package/src/app/ISmartERPUser.ts +2 -1
- package/src/app/ReactApp.ts +1 -2
- package/src/app/ServiceApp.ts +1 -2
- package/src/index.ts +2 -0
package/lib/ComboBoxPro.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Autocomplete } from "@mui/material";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { globalApp } from "./app/ReactApp";
|
|
4
4
|
import { InputField } from "./InputField";
|
|
5
|
-
import {
|
|
5
|
+
import { DataTypes } from "@etsoo/shared";
|
|
6
6
|
export function ComboBoxPro(props) {
|
|
7
7
|
var _a;
|
|
8
8
|
// Labels
|
|
@@ -53,7 +53,7 @@ export function ComboBoxPro(props) {
|
|
|
53
53
|
if (!localValue && localValue != value)
|
|
54
54
|
onChange(event, value, "blur", undefined);
|
|
55
55
|
}
|
|
56
|
-
} })), getOptionLabel: (item) => typeof item === "object" ?
|
|
56
|
+
} })), getOptionLabel: (item) => typeof item === "object" ? DataTypes.getListItemLabel(item) : item, isOptionEqualToValue: (option, value) => option.id === value.id, noOptionsText: noOptionsText, loadingText: loadingText, openText: openText, onChange: (event, value, reason, details) => {
|
|
57
57
|
setValue(value);
|
|
58
58
|
if (onChange)
|
|
59
59
|
onChange(event, value, reason, details);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FormControlProps } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* FieldSetEx props
|
|
5
|
+
*/
|
|
6
|
+
export type FieldSetExProps = Omit<FormControlProps, "defaultValue" | "variant"> & {
|
|
7
|
+
/**
|
|
8
|
+
* Label
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Helper text
|
|
13
|
+
*/
|
|
14
|
+
helperText?: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* FieldSetEx
|
|
18
|
+
* @param props Props
|
|
19
|
+
* @returns Component
|
|
20
|
+
*/
|
|
21
|
+
export declare function FieldSetEx(props: FieldSetExProps): React.JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FormControl, FormHelperText, InputLabel } from "@mui/material";
|
|
2
|
+
import NotchedOutline from "@mui/material/OutlinedInput";
|
|
3
|
+
import React from "react";
|
|
4
|
+
/**
|
|
5
|
+
* FieldSetEx
|
|
6
|
+
* @param props Props
|
|
7
|
+
* @returns Component
|
|
8
|
+
*/
|
|
9
|
+
export function FieldSetEx(props) {
|
|
10
|
+
// Destruct
|
|
11
|
+
const { label, helperText, required, fullWidth, children, ...rest } = props;
|
|
12
|
+
// Layout
|
|
13
|
+
return (React.createElement(React.Fragment, null,
|
|
14
|
+
React.createElement(FormControl, { fullWidth: fullWidth, ...rest },
|
|
15
|
+
label && (React.createElement(InputLabel, { required: required, variant: "outlined", shrink: true }, label)),
|
|
16
|
+
React.createElement(NotchedOutline, { label: label && required ? label + " *" : label, notched: true, endAdornment: children, sx: {
|
|
17
|
+
cursor: "default",
|
|
18
|
+
display: "flex",
|
|
19
|
+
flexWrap: "wrap",
|
|
20
|
+
gap: 1,
|
|
21
|
+
paddingX: 2,
|
|
22
|
+
paddingY: "7px",
|
|
23
|
+
width: fullWidth ? "100%" : "auto",
|
|
24
|
+
"& input": {
|
|
25
|
+
display: "none"
|
|
26
|
+
}
|
|
27
|
+
} })),
|
|
28
|
+
helperText && (React.createElement(FormHelperText, { sx: { marginLeft: 2, marginRight: 2 } }, helperText))));
|
|
29
|
+
}
|
package/lib/MUUtils.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { ListType2 } from "@etsoo/shared";
|
|
2
1
|
import { GridApiCommunity } from "@mui/x-data-grid/models/api/gridApiCommunity";
|
|
3
2
|
/**
|
|
4
3
|
* MU utilities
|
|
5
4
|
*/
|
|
6
5
|
export declare namespace MUUtils {
|
|
7
|
-
/**
|
|
8
|
-
* Get ListType2 item label
|
|
9
|
-
* @param item Item
|
|
10
|
-
* @returns Result
|
|
11
|
-
*/
|
|
12
|
-
function getListItemLabel(item: ListType2): string;
|
|
13
6
|
/**
|
|
14
7
|
* Get grid data
|
|
15
8
|
* @param grid Grid
|
package/lib/MUUtils.js
CHANGED
|
@@ -3,19 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export var MUUtils;
|
|
5
5
|
(function (MUUtils) {
|
|
6
|
-
/**
|
|
7
|
-
* Get ListType2 item label
|
|
8
|
-
* @param item Item
|
|
9
|
-
* @returns Result
|
|
10
|
-
*/
|
|
11
|
-
function getListItemLabel(item) {
|
|
12
|
-
return "label" in item
|
|
13
|
-
? item.label
|
|
14
|
-
: "name" in item
|
|
15
|
-
? item.name
|
|
16
|
-
: item.title;
|
|
17
|
-
}
|
|
18
|
-
MUUtils.getListItemLabel = getListItemLabel;
|
|
19
6
|
/**
|
|
20
7
|
* Get grid data
|
|
21
8
|
* @param grid Grid
|
package/lib/OptionGroup.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export interface OptionGroupRef {
|
|
|
14
14
|
/**
|
|
15
15
|
* OptionGroup props
|
|
16
16
|
*/
|
|
17
|
-
export type OptionGroupProps<T extends object, D extends DataTypes.Keys<T>, L extends DataTypes.Keys<T, string>> = Omit<FormControlProps
|
|
17
|
+
export type OptionGroupProps<T extends object, D extends DataTypes.Keys<T>, L extends DataTypes.Keys<T, string>> = Omit<FormControlProps, "defaultValue"> & {
|
|
18
18
|
/**
|
|
19
19
|
* Default value
|
|
20
20
|
*/
|
|
@@ -67,10 +67,6 @@ export type OptionGroupProps<T extends object, D extends DataTypes.Keys<T>, L ex
|
|
|
67
67
|
* Item size
|
|
68
68
|
*/
|
|
69
69
|
itemSize?: "small" | "medium";
|
|
70
|
-
/**
|
|
71
|
-
* Item height in px
|
|
72
|
-
*/
|
|
73
|
-
itemHeight?: number;
|
|
74
70
|
/**
|
|
75
71
|
* Helper text
|
|
76
72
|
*/
|
package/lib/OptionGroup.js
CHANGED
|
@@ -10,18 +10,9 @@ import React from "react";
|
|
|
10
10
|
export function OptionGroup(props) {
|
|
11
11
|
var _a;
|
|
12
12
|
// Destruct
|
|
13
|
-
const { getOptionLabel, defaultValue, idField = "id", label, labelField = "label", multiple = false, mRef, name, onValueChange, options, readOnly, row, itemSize,
|
|
13
|
+
const { getOptionLabel, defaultValue, idField = "id", label, labelField = "label", multiple = false, mRef, name, onValueChange, options, readOnly, row, itemSize, helperText, variant, required, fullWidth, ...rest } = props;
|
|
14
14
|
// Outlined
|
|
15
15
|
const outlined = variant === "outlined";
|
|
16
|
-
if (sx) {
|
|
17
|
-
Object.assign(sx, {
|
|
18
|
-
height: outlined
|
|
19
|
-
? row
|
|
20
|
-
? `${itemHeight}px`
|
|
21
|
-
: `${options.length * itemHeight + 14}px`
|
|
22
|
-
: undefined
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
16
|
// Get option value
|
|
26
17
|
// D type should be the source id type
|
|
27
18
|
const getOptionValue = (option) => {
|
|
@@ -101,16 +92,18 @@ export function OptionGroup(props) {
|
|
|
101
92
|
} }, list));
|
|
102
93
|
// Layout
|
|
103
94
|
return (React.createElement(React.Fragment, null,
|
|
104
|
-
React.createElement(FormControl, {
|
|
95
|
+
React.createElement(FormControl, { fullWidth: fullWidth, ...rest },
|
|
105
96
|
label && (React.createElement(InputLabel, { required: required, variant: variant, shrink: true }, label)),
|
|
106
|
-
outlined
|
|
97
|
+
outlined ? (React.createElement(NotchedOutline, { label: label && required ? label + " *" : label, notched: true, endAdornment: group, sx: {
|
|
107
98
|
cursor: "default",
|
|
108
|
-
|
|
99
|
+
display: "flex",
|
|
100
|
+
gap: 1,
|
|
101
|
+
paddingX: 2,
|
|
102
|
+
paddingY: "7px",
|
|
109
103
|
width: fullWidth ? "100%" : "auto",
|
|
110
104
|
"& input": {
|
|
111
|
-
|
|
105
|
+
display: "none"
|
|
112
106
|
}
|
|
113
|
-
} })),
|
|
114
|
-
React.createElement(Box, { paddingLeft: 2, paddingY: "7px", position: outlined ? "absolute" : undefined }, group)),
|
|
107
|
+
} })) : (React.createElement(Box, { paddingLeft: 2, paddingY: "7px" }, group))),
|
|
115
108
|
helperText && (React.createElement(FormHelperText, { sx: { marginLeft: 2, marginRight: 2 } }, helperText))));
|
|
116
109
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { DataTypes, IdDefaultType, LabelDefaultType, ListType } from "@etsoo/shared";
|
|
2
|
+
import { FormControlProps } from "@mui/material";
|
|
3
|
+
import React from "react";
|
|
4
|
+
/**
|
|
5
|
+
* OptionGroupFlag methods ref
|
|
6
|
+
*/
|
|
7
|
+
export interface OptionGroupFlagRef {
|
|
8
|
+
/**
|
|
9
|
+
* Disable specific items with their ids
|
|
10
|
+
* @param ids Ids
|
|
11
|
+
*/
|
|
12
|
+
disable(ids: number[]): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* OptionGroupFlag props
|
|
16
|
+
*/
|
|
17
|
+
export type OptionGroupFlagProps<T extends object, D extends DataTypes.Keys<T, number>, L extends DataTypes.Keys<T, string>> = Omit<FormControlProps, "defaultValue"> & {
|
|
18
|
+
/**
|
|
19
|
+
* Default value
|
|
20
|
+
*/
|
|
21
|
+
defaultValue?: T[D] & number;
|
|
22
|
+
/**
|
|
23
|
+
* Get option label function
|
|
24
|
+
*/
|
|
25
|
+
getOptionLabel?: (option: T) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Id field
|
|
28
|
+
*/
|
|
29
|
+
idField?: D;
|
|
30
|
+
/**
|
|
31
|
+
* Label
|
|
32
|
+
*/
|
|
33
|
+
label?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Label field
|
|
36
|
+
*/
|
|
37
|
+
labelField?: L;
|
|
38
|
+
/**
|
|
39
|
+
* Methods
|
|
40
|
+
*/
|
|
41
|
+
mRef?: React.Ref<OptionGroupFlagRef>;
|
|
42
|
+
/**
|
|
43
|
+
* Field name
|
|
44
|
+
*/
|
|
45
|
+
name: string;
|
|
46
|
+
/**
|
|
47
|
+
* On value change handler
|
|
48
|
+
*/
|
|
49
|
+
onValueChange?: (value?: T[D] & number) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Array of options.
|
|
52
|
+
*/
|
|
53
|
+
options: ReadonlyArray<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Is the field read only?
|
|
56
|
+
*/
|
|
57
|
+
readOnly?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Display group of elements in a compact row
|
|
60
|
+
*/
|
|
61
|
+
row?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Item size
|
|
64
|
+
*/
|
|
65
|
+
itemSize?: "small" | "medium";
|
|
66
|
+
/**
|
|
67
|
+
* Helper text
|
|
68
|
+
*/
|
|
69
|
+
helperText?: React.ReactNode;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* OptionGroupFlag
|
|
73
|
+
* @param props Props
|
|
74
|
+
* @returns Component
|
|
75
|
+
*/
|
|
76
|
+
export declare function OptionGroupFlag<T extends object = ListType, D extends DataTypes.Keys<T, number> = IdDefaultType<T, number>, L extends DataTypes.Keys<T, string> = LabelDefaultType<T>>(props: OptionGroupFlagProps<T, D, L>): React.JSX.Element;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { DataTypes, Utils } from "@etsoo/shared";
|
|
2
|
+
import { Box, Checkbox, FormControl, FormControlLabel, FormGroup, FormHelperText, InputLabel } from "@mui/material";
|
|
3
|
+
import NotchedOutline from "@mui/material/OutlinedInput";
|
|
4
|
+
import React from "react";
|
|
5
|
+
/**
|
|
6
|
+
* OptionGroupFlag
|
|
7
|
+
* @param props Props
|
|
8
|
+
* @returns Component
|
|
9
|
+
*/
|
|
10
|
+
export function OptionGroupFlag(props) {
|
|
11
|
+
// Destruct
|
|
12
|
+
const { getOptionLabel, defaultValue, idField = "id", label, labelField = "label", mRef, name, onValueChange, options, readOnly, row, itemSize, helperText, variant, required, fullWidth, sx = {}, ...rest } = props;
|
|
13
|
+
// Outlined
|
|
14
|
+
const outlined = variant === "outlined";
|
|
15
|
+
// Get option value
|
|
16
|
+
// D type should be the source id type
|
|
17
|
+
const getOptionValue = (option) => {
|
|
18
|
+
const value = DataTypes.getValue(option, idField);
|
|
19
|
+
if (value == null)
|
|
20
|
+
return null;
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
// Value
|
|
24
|
+
const [value, setValue] = React.useState(defaultValue);
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
setValue(defaultValue);
|
|
27
|
+
}, [defaultValue]);
|
|
28
|
+
// Disabled ids
|
|
29
|
+
const [disabledIds, setDisabledIds] = React.useState();
|
|
30
|
+
// Item checked
|
|
31
|
+
const itemChecked = (option) => {
|
|
32
|
+
// Value
|
|
33
|
+
const itemValue = getOptionValue(option);
|
|
34
|
+
if (itemValue == null || value == null)
|
|
35
|
+
return false;
|
|
36
|
+
return (value & itemValue) > 0;
|
|
37
|
+
};
|
|
38
|
+
React.useImperativeHandle(mRef, () => ({
|
|
39
|
+
disable(ids) {
|
|
40
|
+
setDisabledIds(ids);
|
|
41
|
+
}
|
|
42
|
+
}));
|
|
43
|
+
// First item value
|
|
44
|
+
const firstOptionValue = getOptionValue(options[0]);
|
|
45
|
+
// Items
|
|
46
|
+
const list = options.map((option) => {
|
|
47
|
+
// Value
|
|
48
|
+
const ov = getOptionValue(option);
|
|
49
|
+
if (ov == null)
|
|
50
|
+
return;
|
|
51
|
+
// Control
|
|
52
|
+
const control = (React.createElement(Checkbox, { name: name, readOnly: readOnly, size: itemSize, checked: itemChecked(option), disabled: disabledIds === null || disabledIds === void 0 ? void 0 : disabledIds.includes(ov), onChange: (event) => {
|
|
53
|
+
if (firstOptionValue == null)
|
|
54
|
+
return;
|
|
55
|
+
const typeValue = Utils.parseString(event.target.value, firstOptionValue);
|
|
56
|
+
const newValue = (value == null
|
|
57
|
+
? event.target.checked
|
|
58
|
+
? typeValue
|
|
59
|
+
: undefined
|
|
60
|
+
: event.target.checked
|
|
61
|
+
? value | typeValue
|
|
62
|
+
: value ^ typeValue);
|
|
63
|
+
if (onValueChange)
|
|
64
|
+
onValueChange(newValue);
|
|
65
|
+
setValue(newValue);
|
|
66
|
+
} }));
|
|
67
|
+
// Label
|
|
68
|
+
const label = getOptionLabel == null ? `${option[labelField]}` : getOptionLabel(option);
|
|
69
|
+
return (React.createElement(FormControlLabel, { key: ov, control: control, value: ov, label: label }));
|
|
70
|
+
});
|
|
71
|
+
// Group
|
|
72
|
+
const group = React.createElement(FormGroup, { row: row }, list);
|
|
73
|
+
// Layout
|
|
74
|
+
return (React.createElement(React.Fragment, null,
|
|
75
|
+
React.createElement(FormControl, { fullWidth: fullWidth, sx: sx, ...rest },
|
|
76
|
+
label && (React.createElement(InputLabel, { required: required, variant: variant, shrink: true }, label)),
|
|
77
|
+
outlined ? (React.createElement(NotchedOutline, { label: label && required ? label + " *" : label, notched: true, endAdornment: group, sx: {
|
|
78
|
+
cursor: "default",
|
|
79
|
+
display: "flex",
|
|
80
|
+
gap: 1,
|
|
81
|
+
paddingX: 2,
|
|
82
|
+
paddingY: "7px",
|
|
83
|
+
width: fullWidth ? "100%" : "auto",
|
|
84
|
+
"& input": {
|
|
85
|
+
display: "none"
|
|
86
|
+
}
|
|
87
|
+
} })) : (React.createElement(Box, { paddingLeft: 2, paddingY: "7px" }, group))),
|
|
88
|
+
helperText && (React.createElement(FormHelperText, { sx: { marginLeft: 2, marginRight: 2 } }, helperText))));
|
|
89
|
+
}
|
package/lib/QuickList.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { DataTypes } from "@etsoo/shared";
|
|
1
2
|
import { LinearProgress, List, ListItem, ListItemButton, Typography } from "@mui/material";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { InputField } from "./InputField";
|
|
4
5
|
import { globalApp } from "./app/ReactApp";
|
|
5
6
|
import { VBox } from "./FlexBox";
|
|
6
|
-
import { MUUtils } from "./MUUtils";
|
|
7
7
|
/**
|
|
8
8
|
* Quick list
|
|
9
9
|
* @param props Props
|
|
@@ -11,7 +11,7 @@ import { MUUtils } from "./MUUtils";
|
|
|
11
11
|
*/
|
|
12
12
|
export function QuickList(props) {
|
|
13
13
|
// Destruct
|
|
14
|
-
const { buttonProps = {}, label, inputProps, itemLabel =
|
|
14
|
+
const { buttonProps = {}, label, inputProps, itemLabel = DataTypes.getListItemLabel, itemRenderer = (item) => itemLabel(item), itemProps, loadData, noMatchesLabel = globalApp === null || globalApp === void 0 ? void 0 : globalApp.get("noMatches"), gap = 1, height = "480px", onItemClick, ...rest } = props;
|
|
15
15
|
const { onClick, ...buttonRest } = buttonProps;
|
|
16
16
|
// States
|
|
17
17
|
const [loading, setLoading] = React.useState(false);
|
package/lib/SwitchField.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
/**
|
|
4
4
|
* SwitchField props
|
|
5
5
|
*/
|
|
6
|
-
export type SwitchFieldProps = Omit<FormControlProps
|
|
6
|
+
export type SwitchFieldProps = Omit<FormControlProps, "defaultValue"> & {
|
|
7
7
|
/**
|
|
8
8
|
* Helper text
|
|
9
9
|
*/
|
|
@@ -12,6 +12,10 @@ export type SwitchFieldProps = Omit<FormControlProps<"fieldset">, "defaultValue"
|
|
|
12
12
|
* Label
|
|
13
13
|
*/
|
|
14
14
|
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Field name
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
15
19
|
/**
|
|
16
20
|
* Checked
|
|
17
21
|
*/
|
|
@@ -28,10 +32,6 @@ export type SwitchFieldProps = Omit<FormControlProps<"fieldset">, "defaultValue"
|
|
|
28
32
|
* End label
|
|
29
33
|
*/
|
|
30
34
|
endLabel?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Height in px
|
|
33
|
-
*/
|
|
34
|
-
height?: number;
|
|
35
35
|
/**
|
|
36
36
|
* Value, default is true
|
|
37
37
|
*/
|
package/lib/SwitchField.js
CHANGED
|
@@ -9,25 +9,25 @@ import { SwitchAnt } from "./SwitchAnt";
|
|
|
9
9
|
*/
|
|
10
10
|
export function SwitchField(props) {
|
|
11
11
|
// Destruct
|
|
12
|
-
const { activeColor, startLabel, endLabel, value = true, fullWidth,
|
|
12
|
+
const { activeColor, startLabel, endLabel, value = true, fullWidth, helperText, label, name, required, checked, variant = "outlined", ...rest } = props;
|
|
13
13
|
// Outlined
|
|
14
14
|
const outlined = variant === "outlined";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
// Group
|
|
16
|
+
const group = (React.createElement(SwitchAnt, { activeColor: activeColor, name: name, startLabel: startLabel, endLabel: endLabel, value: value, checked: checked }));
|
|
18
17
|
// Layout
|
|
19
18
|
return (React.createElement(React.Fragment, null,
|
|
20
|
-
React.createElement(FormControl, {
|
|
19
|
+
React.createElement(FormControl, { fullWidth: fullWidth, ...rest },
|
|
21
20
|
label && (React.createElement(InputLabel, { required: required, variant: variant, shrink: true }, label)),
|
|
22
|
-
outlined
|
|
21
|
+
outlined ? (React.createElement(NotchedOutline, { label: label && required ? label + " *" : label, notched: true, endAdornment: group, sx: {
|
|
23
22
|
cursor: "default",
|
|
24
|
-
|
|
23
|
+
display: "flex",
|
|
24
|
+
gap: 1,
|
|
25
|
+
paddingX: 2,
|
|
26
|
+
paddingY: "7px",
|
|
25
27
|
width: fullWidth ? "100%" : "auto",
|
|
26
28
|
"& input": {
|
|
27
|
-
|
|
29
|
+
display: "none"
|
|
28
30
|
}
|
|
29
|
-
} })),
|
|
30
|
-
React.createElement(Box, { paddingLeft: 2, paddingY: "7px", position: outlined ? "absolute" : undefined },
|
|
31
|
-
React.createElement(SwitchAnt, { activeColor: activeColor, name: name, startLabel: startLabel, endLabel: endLabel, value: value, checked: checked }))),
|
|
31
|
+
} })) : (React.createElement(Box, { paddingLeft: 2, paddingY: "7px" }, group))),
|
|
32
32
|
helperText && React.createElement(FormHelperText, null, helperText)));
|
|
33
33
|
}
|
package/lib/TagListPro.js
CHANGED
|
@@ -4,12 +4,13 @@ import CheckBoxIcon from "@mui/icons-material/CheckBox";
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { InputField } from "./InputField";
|
|
6
6
|
import { globalApp } from "./app/ReactApp";
|
|
7
|
+
import { DataTypes } from "@etsoo/shared";
|
|
7
8
|
export function TagListPro(props) {
|
|
8
9
|
var _a;
|
|
9
10
|
// Labels
|
|
10
11
|
const { noOptions, loading: loadingLabel, more = "More", open: openDefault } = (_a = globalApp === null || globalApp === void 0 ? void 0 : globalApp.getLabels("noOptions", "loading", "more", "open")) !== null && _a !== void 0 ? _a : {};
|
|
11
12
|
const moreLabel = more + "...";
|
|
12
|
-
const getLabel = (item) =>
|
|
13
|
+
const getLabel = (item) => DataTypes.getListItemLabel(item);
|
|
13
14
|
// Destruct
|
|
14
15
|
const { renderOption = (props, option, { selected }) => (React.createElement("li", { ...props },
|
|
15
16
|
React.createElement(React.Fragment, null,
|
package/lib/Tiplist.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DataTypes, IdDefaultType,
|
|
1
|
+
import { DataTypes, IdDefaultType, ListType2 } from "@etsoo/shared";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { AutocompleteExtendedProps } from "./AutocompleteExtendedProps";
|
|
4
4
|
/**
|
|
@@ -23,4 +23,4 @@ export type TiplistProps<T extends object, D extends DataTypes.Keys<T>> = Omit<A
|
|
|
23
23
|
* @param props Props
|
|
24
24
|
* @returns Component
|
|
25
25
|
*/
|
|
26
|
-
export declare function Tiplist<T extends object =
|
|
26
|
+
export declare function Tiplist<T extends object = ListType2, D extends DataTypes.Keys<T> = IdDefaultType<T>>(props: TiplistProps<T, D>): React.JSX.Element;
|
package/lib/Tiplist.js
CHANGED
|
@@ -203,10 +203,6 @@ export function Tiplist(props) {
|
|
|
203
203
|
return (more !== null && more !== void 0 ? more : "More") + "...";
|
|
204
204
|
return getOptionLabel
|
|
205
205
|
? getOptionLabel(item)
|
|
206
|
-
:
|
|
207
|
-
? `${item.label}`
|
|
208
|
-
: "name" in item
|
|
209
|
-
? `${item.name}`
|
|
210
|
-
: `${item}`;
|
|
206
|
+
: DataTypes.getObjectItemLabel(item);
|
|
211
207
|
}, ...rest })));
|
|
212
208
|
}
|
package/lib/TiplistPro.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactUtils, useDelayedExecutor } from "@etsoo/react";
|
|
2
|
+
import { DataTypes } from "@etsoo/shared";
|
|
2
3
|
import { Autocomplete } from "@mui/material";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { InputField } from "./InputField";
|
|
5
6
|
import { globalApp } from "./app/ReactApp";
|
|
6
|
-
import { MUUtils } from "./MUUtils";
|
|
7
7
|
/**
|
|
8
8
|
* TiplistPro
|
|
9
9
|
* @param props Props
|
|
@@ -196,7 +196,7 @@ export function TiplistPro(props) {
|
|
|
196
196
|
if (item["id"] === -1)
|
|
197
197
|
return (more !== null && more !== void 0 ? more : "More") + "...";
|
|
198
198
|
if (getOptionLabel == null)
|
|
199
|
-
return
|
|
199
|
+
return DataTypes.getListItemLabel(item);
|
|
200
200
|
return getOptionLabel(item);
|
|
201
201
|
}, ...rest })));
|
|
202
202
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IAppSettings } from
|
|
2
|
-
import {
|
|
1
|
+
import { IAppSettings } from "@etsoo/appscript";
|
|
2
|
+
import { IdType } from "@etsoo/shared";
|
|
3
3
|
/**
|
|
4
4
|
* Service app settings interface
|
|
5
5
|
*/
|
|
6
|
-
export interface IServiceAppSettings<S extends
|
|
6
|
+
export interface IServiceAppSettings<S extends IdType = number> extends IAppSettings {
|
|
7
7
|
/**
|
|
8
8
|
* Service id
|
|
9
9
|
*/
|
package/lib/app/ReactApp.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CoreApp,
|
|
1
|
+
import { CoreApp, IApp, IAppSettings, ICoreApp, IUser } from "@etsoo/appscript";
|
|
2
2
|
import { INotifier, NotificationReturn } from "@etsoo/notificationbase";
|
|
3
|
-
import { DataTypes } from "@etsoo/shared";
|
|
3
|
+
import { DataTypes, IActionResult } from "@etsoo/shared";
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { CultureAction, CultureState, INotificationReact, InputDialogProps, IPageData, IStateProps, NotificationReactCallProps, PageAction, PageState, UserAction, UserState } from "@etsoo/react";
|
|
6
6
|
import { NavigateFunction, NavigateOptions } from "react-router-dom";
|
package/lib/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export * from "./DnDList";
|
|
|
55
55
|
export * from "./DraggablePaperComponent";
|
|
56
56
|
export * from "./EmailInput";
|
|
57
57
|
export * from "./FabBox";
|
|
58
|
+
export * from "./FieldSetEx";
|
|
58
59
|
export * from "./FileUploadButton";
|
|
59
60
|
export * from "./FlexBox";
|
|
60
61
|
export * from "./GridDataFormat";
|
|
@@ -82,6 +83,7 @@ export * from "./NotifierPopupProps";
|
|
|
82
83
|
export * from "./NumberInputField";
|
|
83
84
|
export * from "./OptionBool";
|
|
84
85
|
export * from "./OptionGroup";
|
|
86
|
+
export * from "./OptionGroupFlag";
|
|
85
87
|
export * from "./PercentCircularProgress";
|
|
86
88
|
export * from "./PercentLinearProgress";
|
|
87
89
|
export * from "./PList";
|
package/lib/index.js
CHANGED
|
@@ -55,6 +55,7 @@ export * from "./DnDList";
|
|
|
55
55
|
export * from "./DraggablePaperComponent";
|
|
56
56
|
export * from "./EmailInput";
|
|
57
57
|
export * from "./FabBox";
|
|
58
|
+
export * from "./FieldSetEx";
|
|
58
59
|
export * from "./FileUploadButton";
|
|
59
60
|
export * from "./FlexBox";
|
|
60
61
|
export * from "./GridDataFormat";
|
|
@@ -82,6 +83,7 @@ export * from "./NotifierPopupProps";
|
|
|
82
83
|
export * from "./NumberInputField";
|
|
83
84
|
export * from "./OptionBool";
|
|
84
85
|
export * from "./OptionGroup";
|
|
86
|
+
export * from "./OptionGroupFlag";
|
|
85
87
|
export * from "./PercentCircularProgress";
|
|
86
88
|
export * from "./PercentLinearProgress";
|
|
87
89
|
export * from "./PList";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.34",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -45,24 +45,24 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/ETSOO/ReactMU#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@dnd-kit/core": "^6.0
|
|
49
|
-
"@dnd-kit/sortable": "^
|
|
48
|
+
"@dnd-kit/core": "^6.1.0",
|
|
49
|
+
"@dnd-kit/sortable": "^8.0.0",
|
|
50
50
|
"@emotion/css": "^11.11.2",
|
|
51
51
|
"@emotion/react": "^11.11.1",
|
|
52
52
|
"@emotion/styled": "^11.11.0",
|
|
53
|
-
"@etsoo/appscript": "^1.4.
|
|
54
|
-
"@etsoo/notificationbase": "^1.1.
|
|
55
|
-
"@etsoo/react": "^1.7.
|
|
56
|
-
"@etsoo/shared": "^1.2.
|
|
57
|
-
"@mui/icons-material": "^5.14.
|
|
58
|
-
"@mui/material": "^5.14.
|
|
59
|
-
"@mui/x-data-grid": "^6.18.
|
|
60
|
-
"@types/pica": "^9.0.
|
|
61
|
-
"@types/pulltorefreshjs": "^0.1.
|
|
62
|
-
"@types/react": "^18.2.
|
|
63
|
-
"@types/react-avatar-editor": "^13.0.
|
|
64
|
-
"@types/react-dom": "^18.2.
|
|
65
|
-
"@types/react-input-mask": "^3.0.
|
|
53
|
+
"@etsoo/appscript": "^1.4.73",
|
|
54
|
+
"@etsoo/notificationbase": "^1.1.32",
|
|
55
|
+
"@etsoo/react": "^1.7.24",
|
|
56
|
+
"@etsoo/shared": "^1.2.22",
|
|
57
|
+
"@mui/icons-material": "^5.14.18",
|
|
58
|
+
"@mui/material": "^5.14.18",
|
|
59
|
+
"@mui/x-data-grid": "^6.18.1",
|
|
60
|
+
"@types/pica": "^9.0.4",
|
|
61
|
+
"@types/pulltorefreshjs": "^0.1.7",
|
|
62
|
+
"@types/react": "^18.2.37",
|
|
63
|
+
"@types/react-avatar-editor": "^13.0.2",
|
|
64
|
+
"@types/react-dom": "^18.2.15",
|
|
65
|
+
"@types/react-input-mask": "^3.0.5",
|
|
66
66
|
"chart.js": "^4.4.0",
|
|
67
67
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
68
68
|
"pica": "^9.0.1",
|
|
@@ -76,17 +76,17 @@
|
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@babel/cli": "^7.23.0",
|
|
79
|
-
"@babel/core": "^7.23.
|
|
80
|
-
"@babel/plugin-transform-runtime": "^7.23.
|
|
81
|
-
"@babel/preset-env": "^7.23.
|
|
82
|
-
"@babel/preset-react": "^7.
|
|
83
|
-
"@babel/preset-typescript": "^7.23.
|
|
79
|
+
"@babel/core": "^7.23.3",
|
|
80
|
+
"@babel/plugin-transform-runtime": "^7.23.3",
|
|
81
|
+
"@babel/preset-env": "^7.23.3",
|
|
82
|
+
"@babel/preset-react": "^7.23.3",
|
|
83
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
84
84
|
"@babel/runtime-corejs3": "^7.23.2",
|
|
85
85
|
"@testing-library/jest-dom": "^6.1.4",
|
|
86
|
-
"@testing-library/react": "^14.
|
|
87
|
-
"@types/jest": "^29.5.
|
|
88
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
89
|
-
"@typescript-eslint/parser": "^6.
|
|
86
|
+
"@testing-library/react": "^14.1.0",
|
|
87
|
+
"@types/jest": "^29.5.8",
|
|
88
|
+
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
89
|
+
"@typescript-eslint/parser": "^6.11.0",
|
|
90
90
|
"jest": "^29.7.0",
|
|
91
91
|
"jest-environment-jsdom": "^29.7.0",
|
|
92
92
|
"typescript": "^5.2.2"
|