@etsoo/materialui 1.4.22 → 1.4.23
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/README.md +2 -1
- package/babel.config.json +12 -12
- package/lib/AddresSelector.d.ts +8 -2
- package/lib/AddresSelector.js +1 -1
- package/lib/AuditDisplay.d.ts +1 -1
- package/lib/BackButton.d.ts +1 -1
- package/lib/BackButton.js +5 -5
- package/lib/CountryList.d.ts +5 -4
- package/lib/CountryList.js +3 -3
- package/lib/CustomFabProps.d.ts +3 -3
- package/lib/DataGridEx.js +3 -6
- package/lib/DataGridRenderers.d.ts +3 -3
- package/lib/DataGridRenderers.js +17 -17
- package/lib/DataTable.d.ts +1 -7
- package/lib/DataTable.js +3 -13
- package/lib/DialogButton.d.ts +2 -2
- package/lib/DialogButton.js +4 -4
- package/lib/EmailInput.d.ts +2 -2
- package/lib/EmailInput.js +2 -2
- package/lib/FlexBox.d.ts +3 -3
- package/lib/FlexBox.js +1 -1
- package/lib/GridDataFormat.d.ts +2 -2
- package/lib/GridDataFormat.js +7 -7
- package/lib/GridUtils.js +2 -1
- package/lib/ListItemRightIcon.d.ts +1 -1
- package/lib/ListItemRightIcon.js +2 -2
- package/lib/LoadingButton.d.ts +1 -1
- package/lib/LoadingButton.js +2 -2
- package/lib/MUGlobal.d.ts +6 -6
- package/lib/MUGlobal.js +20 -22
- package/lib/MobileListItemRenderer.d.ts +3 -3
- package/lib/MobileListItemRenderer.js +8 -10
- package/lib/PList.js +1 -1
- package/lib/ProgressCount.js +12 -12
- package/lib/RegionsRQ.d.ts +22 -0
- package/lib/RegionsRQ.js +1 -0
- package/lib/SearchField.d.ts +1 -1
- package/lib/SearchField.js +4 -4
- package/lib/SearchOptionGroup.d.ts +2 -2
- package/lib/SearchOptionGroup.js +3 -3
- package/lib/Switch.d.ts +3 -3
- package/lib/Switch.js +5 -5
- package/lib/TabBox.d.ts +5 -5
- package/lib/TabBox.js +5 -5
- package/lib/TableEx.js +4 -7
- package/lib/TooltipClick.d.ts +3 -3
- package/lib/TooltipClick.js +3 -3
- package/lib/TwoFieldInput.d.ts +2 -2
- package/lib/TwoFieldInput.js +13 -13
- package/lib/app/IServicePage.d.ts +1 -1
- package/lib/app/Labels.d.ts +1 -1
- package/lib/app/Labels.js +31 -31
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/texts/MoneyText.d.ts +1 -1
- package/lib/texts/MoneyText.js +3 -3
- package/lib/texts/NumberText.d.ts +1 -1
- package/lib/texts/NumberText.js +3 -3
- package/package.json +20 -20
- package/src/AddresSelector.tsx +31 -4
- package/src/AuditDisplay.tsx +1 -1
- package/src/BackButton.tsx +39 -39
- package/src/CountryList.tsx +49 -48
- package/src/CustomFabProps.ts +19 -19
- package/src/DataGridEx.tsx +2 -7
- package/src/DataGridRenderers.tsx +119 -119
- package/src/DataTable.tsx +2 -31
- package/src/DialogButton.tsx +149 -151
- package/src/EmailInput.tsx +9 -11
- package/src/FlexBox.tsx +6 -6
- package/src/GridDataFormat.tsx +58 -58
- package/src/GridUtils.ts +2 -1
- package/src/ListItemRightIcon.tsx +3 -3
- package/src/LoadingButton.tsx +53 -53
- package/src/MUGlobal.ts +196 -203
- package/src/MobileListItemRenderer.tsx +63 -65
- package/src/NotifierPromptProps.ts +16 -16
- package/src/PList.tsx +14 -14
- package/src/ProgressCount.tsx +144 -148
- package/src/RegionsRQ.ts +26 -0
- package/src/SearchField.tsx +59 -59
- package/src/SearchOptionGroup.tsx +20 -20
- package/src/Switch.tsx +72 -72
- package/src/TabBox.tsx +87 -89
- package/src/TableEx.tsx +5 -8
- package/src/TooltipClick.tsx +62 -64
- package/src/TwoFieldInput.tsx +104 -104
- package/src/app/IServicePage.ts +1 -1
- package/src/app/Labels.ts +67 -67
- package/src/index.ts +1 -0
- package/src/texts/MoneyText.tsx +29 -35
- package/src/texts/NumberText.tsx +23 -23
package/src/ProgressCount.tsx
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from
|
|
7
|
-
import React from
|
|
2
|
+
Box,
|
|
3
|
+
CircularProgress,
|
|
4
|
+
LinearProgress,
|
|
5
|
+
Typography
|
|
6
|
+
} from "@mui/material";
|
|
7
|
+
import React from "react";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Process count props
|
|
11
11
|
*/
|
|
12
12
|
export interface ProgressCountProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Is countdown or opposite
|
|
15
|
+
* @default 'true'
|
|
16
|
+
*/
|
|
17
|
+
countdown?: boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Is linear or circular
|
|
21
|
+
* @default 'true'
|
|
22
|
+
*/
|
|
23
|
+
linear?: boolean;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Min width
|
|
27
|
+
* @default 36
|
|
28
|
+
*/
|
|
29
|
+
minWidth?: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* On complete callback, return false will stop it
|
|
33
|
+
*/
|
|
34
|
+
onComplete?: () => boolean;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* On progress callback
|
|
38
|
+
*/
|
|
39
|
+
onProgress?: (value: number) => void;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Seconds for count
|
|
43
|
+
*/
|
|
44
|
+
seconds: number;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Value unit, like 's' or '%'
|
|
48
|
+
* @default ''
|
|
49
|
+
*/
|
|
50
|
+
valueUnit?: string;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
@@ -56,111 +56,107 @@ export interface ProgressCountProps {
|
|
|
56
56
|
* @returns Component
|
|
57
57
|
*/
|
|
58
58
|
export function ProgressCount(props: ProgressCountProps) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<Box sx={{ display: 'flex', alignItems: 'center', width: '100%' }}>
|
|
129
|
-
<Box sx={{ width: '100%', mr: 1 }}>
|
|
130
|
-
<LinearProgress variant={variant} value={progressValue} />
|
|
131
|
-
</Box>
|
|
132
|
-
<Box sx={{ minWidth }}>
|
|
133
|
-
<Typography
|
|
134
|
-
variant="body2"
|
|
135
|
-
color="text.secondary"
|
|
136
|
-
>{`${value}${valueUnit}`}</Typography>
|
|
137
|
-
</Box>
|
|
138
|
-
</Box>
|
|
139
|
-
);
|
|
140
|
-
|
|
59
|
+
// Destruct
|
|
60
|
+
const {
|
|
61
|
+
countdown = true,
|
|
62
|
+
linear = true,
|
|
63
|
+
minWidth = 36,
|
|
64
|
+
onComplete,
|
|
65
|
+
onProgress,
|
|
66
|
+
seconds,
|
|
67
|
+
valueUnit = ""
|
|
68
|
+
} = props;
|
|
69
|
+
|
|
70
|
+
// Progress value
|
|
71
|
+
const [value, setValue] = React.useState(countdown ? seconds : 0);
|
|
72
|
+
|
|
73
|
+
// Variant
|
|
74
|
+
const [variant, setVariant] = React.useState<"determinate" | "indeterminate">(
|
|
75
|
+
"determinate"
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// Progress value
|
|
79
|
+
const progressValue = (100.0 * value) / seconds;
|
|
80
|
+
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
const timer = setInterval(() => {
|
|
83
|
+
setValue((prev) => {
|
|
84
|
+
const newValue = countdown
|
|
85
|
+
? prev === 0
|
|
86
|
+
? seconds
|
|
87
|
+
: prev - 1
|
|
88
|
+
: prev === seconds
|
|
89
|
+
? 0
|
|
90
|
+
: prev + 1;
|
|
91
|
+
|
|
92
|
+
if (countdown) {
|
|
93
|
+
if (newValue === 0) {
|
|
94
|
+
if (onComplete) {
|
|
95
|
+
const result = onComplete();
|
|
96
|
+
// Finish
|
|
97
|
+
if (result === false) {
|
|
98
|
+
clearInterval(timer);
|
|
99
|
+
setVariant("indeterminate");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
if (newValue === seconds) {
|
|
105
|
+
if (onComplete) {
|
|
106
|
+
const result = onComplete();
|
|
107
|
+
// Finish
|
|
108
|
+
if (result === false) {
|
|
109
|
+
clearInterval(timer);
|
|
110
|
+
setVariant("indeterminate");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (onProgress) onProgress(newValue);
|
|
117
|
+
|
|
118
|
+
return newValue;
|
|
119
|
+
});
|
|
120
|
+
}, 1000);
|
|
121
|
+
return () => {
|
|
122
|
+
clearInterval(timer);
|
|
123
|
+
};
|
|
124
|
+
}, []);
|
|
125
|
+
|
|
126
|
+
if (linear)
|
|
141
127
|
return (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
display: 'flex',
|
|
152
|
-
alignItems: 'center',
|
|
153
|
-
justifyContent: 'center'
|
|
154
|
-
}}
|
|
155
|
-
>
|
|
156
|
-
<Typography
|
|
157
|
-
variant="caption"
|
|
158
|
-
component="div"
|
|
159
|
-
color="text.secondary"
|
|
160
|
-
>
|
|
161
|
-
{`${value}${valueUnit}`}
|
|
162
|
-
</Typography>
|
|
163
|
-
</Box>
|
|
128
|
+
<Box sx={{ display: "flex", alignItems: "center", width: "100%" }}>
|
|
129
|
+
<Box sx={{ width: "100%", mr: 1 }}>
|
|
130
|
+
<LinearProgress variant={variant} value={progressValue} />
|
|
131
|
+
</Box>
|
|
132
|
+
<Box sx={{ minWidth }}>
|
|
133
|
+
<Typography
|
|
134
|
+
variant="body2"
|
|
135
|
+
color="text.secondary"
|
|
136
|
+
>{`${value}${valueUnit}`}</Typography>
|
|
164
137
|
</Box>
|
|
138
|
+
</Box>
|
|
165
139
|
);
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Box sx={{ position: "relative", display: "inline-flex" }}>
|
|
143
|
+
<CircularProgress variant={variant} value={progressValue} />
|
|
144
|
+
<Box
|
|
145
|
+
sx={{
|
|
146
|
+
top: 0,
|
|
147
|
+
left: 0,
|
|
148
|
+
bottom: 0,
|
|
149
|
+
right: 0,
|
|
150
|
+
position: "absolute",
|
|
151
|
+
display: "flex",
|
|
152
|
+
alignItems: "center",
|
|
153
|
+
justifyContent: "center"
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
<Typography variant="caption" component="div" color="text.secondary">
|
|
157
|
+
{`${value}${valueUnit}`}
|
|
158
|
+
</Typography>
|
|
159
|
+
</Box>
|
|
160
|
+
</Box>
|
|
161
|
+
);
|
|
166
162
|
}
|
package/src/RegionsRQ.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type RegionsRQ = {
|
|
2
|
+
/**
|
|
3
|
+
* Country id
|
|
4
|
+
*/
|
|
5
|
+
id?: string;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Favored country ids from top to bottom
|
|
9
|
+
*/
|
|
10
|
+
favoredIds?: string[];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Items count to query
|
|
14
|
+
*/
|
|
15
|
+
items?: number;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Filter keyword
|
|
19
|
+
*/
|
|
20
|
+
keyword?: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Cultrue
|
|
24
|
+
*/
|
|
25
|
+
culture?: string;
|
|
26
|
+
};
|
package/src/SearchField.tsx
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { useDelayedExecutor } from
|
|
2
|
-
import { TextField, TextFieldProps } from
|
|
3
|
-
import React from
|
|
4
|
-
import { MUGlobal } from
|
|
1
|
+
import { useDelayedExecutor } from "@etsoo/react";
|
|
2
|
+
import { TextField, TextFieldProps } from "@mui/material";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { MUGlobal } from "./MUGlobal";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Search field props
|
|
8
8
|
*/
|
|
9
9
|
export type SearchFieldProps = TextFieldProps & {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Change delay (ms) to avoid repeatly dispatch onChange
|
|
12
|
+
*/
|
|
13
|
+
changeDelay?: number;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Is the field read only?
|
|
17
|
+
*/
|
|
18
|
+
readOnly?: boolean;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/**
|
|
@@ -24,59 +24,59 @@ export type SearchFieldProps = TextFieldProps & {
|
|
|
24
24
|
* @returns Component
|
|
25
25
|
*/
|
|
26
26
|
export function SearchField(props: SearchFieldProps) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
// Destruct
|
|
28
|
+
const {
|
|
29
|
+
changeDelay,
|
|
30
|
+
InputLabelProps = {},
|
|
31
|
+
InputProps = {},
|
|
32
|
+
onChange,
|
|
33
|
+
readOnly,
|
|
34
|
+
size = MUGlobal.searchFieldSize,
|
|
35
|
+
variant = MUGlobal.searchFieldVariant,
|
|
36
|
+
...rest
|
|
37
|
+
} = props;
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// Shrink
|
|
40
|
+
InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// Read only
|
|
43
|
+
if (readOnly != null) InputProps.readOnly = readOnly;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
const isMounted = React.useRef(true);
|
|
46
|
+
const delayed =
|
|
47
|
+
onChange != null && changeDelay != null && changeDelay >= 1
|
|
48
|
+
? useDelayedExecutor(onChange, changeDelay)
|
|
49
|
+
: undefined;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const onChangeEx = (
|
|
52
|
+
event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
|
|
53
|
+
) => {
|
|
54
|
+
if (onChange == null) return;
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
if (changeDelay == null || changeDelay < 1) {
|
|
57
|
+
onChange(event);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
delayed?.call(undefined, event);
|
|
62
|
+
};
|
|
63
63
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
return () => {
|
|
66
|
+
isMounted.current = false;
|
|
67
|
+
delayed?.clear();
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
// Layout
|
|
72
|
+
return (
|
|
73
|
+
<TextField
|
|
74
|
+
InputLabelProps={InputLabelProps}
|
|
75
|
+
InputProps={InputProps}
|
|
76
|
+
onChange={onChangeEx}
|
|
77
|
+
size={size}
|
|
78
|
+
variant={variant}
|
|
79
|
+
{...rest}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
82
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from
|
|
7
|
-
import React from
|
|
8
|
-
import { MUGlobal } from
|
|
9
|
-
import { OptionGroup, OptionGroupProps } from
|
|
2
|
+
DataTypes,
|
|
3
|
+
IdDefaultType,
|
|
4
|
+
LabelDefaultType,
|
|
5
|
+
ListType
|
|
6
|
+
} from "@etsoo/shared";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { MUGlobal } from "./MUGlobal";
|
|
9
|
+
import { OptionGroup, OptionGroupProps } from "./OptionGroup";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Search OptionGroup
|
|
@@ -14,18 +14,18 @@ import { OptionGroup, OptionGroupProps } from './OptionGroup';
|
|
|
14
14
|
* @returns Component
|
|
15
15
|
*/
|
|
16
16
|
export function SearchOptionGroup<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
T extends object = ListType,
|
|
18
|
+
D extends DataTypes.Keys<T> = IdDefaultType<T>,
|
|
19
|
+
L extends DataTypes.Keys<T, string> = LabelDefaultType<T>
|
|
20
20
|
>(props: OptionGroupProps<T, D, L>) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
// Destruct
|
|
22
|
+
const {
|
|
23
|
+
row = true,
|
|
24
|
+
size = MUGlobal.searchFieldSize,
|
|
25
|
+
sx = { "& .MuiFormLabel-root": { fontSize: "0.75em" } },
|
|
26
|
+
...rest
|
|
27
|
+
} = props;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// Layout
|
|
30
|
+
return <OptionGroup<T, D, L> row={row} size={size} sx={sx} {...rest} />;
|
|
31
31
|
}
|