@etsoo/materialui 1.4.22 → 1.4.24

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.
Files changed (93) hide show
  1. package/README.md +2 -1
  2. package/__tests__/ReactAppTests.tsx +6 -4
  3. package/babel.config.json +12 -12
  4. package/lib/AddresSelector.d.ts +8 -2
  5. package/lib/AddresSelector.js +1 -1
  6. package/lib/AuditDisplay.d.ts +1 -1
  7. package/lib/BackButton.d.ts +1 -1
  8. package/lib/BackButton.js +5 -5
  9. package/lib/CountryList.d.ts +5 -4
  10. package/lib/CountryList.js +3 -3
  11. package/lib/CustomFabProps.d.ts +3 -3
  12. package/lib/DataGridEx.js +3 -6
  13. package/lib/DataGridRenderers.d.ts +3 -3
  14. package/lib/DataGridRenderers.js +17 -17
  15. package/lib/DataTable.d.ts +1 -7
  16. package/lib/DataTable.js +3 -13
  17. package/lib/DialogButton.d.ts +2 -2
  18. package/lib/DialogButton.js +4 -4
  19. package/lib/EmailInput.d.ts +2 -2
  20. package/lib/EmailInput.js +2 -2
  21. package/lib/FlexBox.d.ts +3 -3
  22. package/lib/FlexBox.js +1 -1
  23. package/lib/GridDataFormat.d.ts +2 -2
  24. package/lib/GridDataFormat.js +7 -7
  25. package/lib/GridUtils.js +2 -1
  26. package/lib/ListItemRightIcon.d.ts +1 -1
  27. package/lib/ListItemRightIcon.js +2 -2
  28. package/lib/LoadingButton.d.ts +1 -1
  29. package/lib/LoadingButton.js +2 -2
  30. package/lib/MUGlobal.d.ts +6 -6
  31. package/lib/MUGlobal.js +20 -22
  32. package/lib/MobileListItemRenderer.d.ts +3 -3
  33. package/lib/MobileListItemRenderer.js +8 -10
  34. package/lib/PList.js +1 -1
  35. package/lib/ProgressCount.js +12 -12
  36. package/lib/RegionsRQ.d.ts +22 -0
  37. package/lib/RegionsRQ.js +1 -0
  38. package/lib/SearchField.d.ts +1 -1
  39. package/lib/SearchField.js +4 -4
  40. package/lib/SearchOptionGroup.d.ts +2 -2
  41. package/lib/SearchOptionGroup.js +3 -3
  42. package/lib/Switch.d.ts +3 -3
  43. package/lib/Switch.js +5 -5
  44. package/lib/TabBox.d.ts +5 -5
  45. package/lib/TabBox.js +5 -5
  46. package/lib/TableEx.js +4 -7
  47. package/lib/TooltipClick.d.ts +3 -3
  48. package/lib/TooltipClick.js +3 -3
  49. package/lib/TwoFieldInput.d.ts +2 -2
  50. package/lib/TwoFieldInput.js +13 -13
  51. package/lib/app/IServicePage.d.ts +1 -1
  52. package/lib/app/Labels.d.ts +1 -1
  53. package/lib/app/Labels.js +31 -31
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.js +1 -0
  56. package/lib/texts/MoneyText.d.ts +1 -1
  57. package/lib/texts/MoneyText.js +3 -3
  58. package/lib/texts/NumberText.d.ts +1 -1
  59. package/lib/texts/NumberText.js +3 -3
  60. package/package.json +20 -20
  61. package/src/AddresSelector.tsx +31 -4
  62. package/src/AuditDisplay.tsx +1 -1
  63. package/src/BackButton.tsx +39 -39
  64. package/src/CountryList.tsx +49 -48
  65. package/src/CustomFabProps.ts +19 -19
  66. package/src/DataGridEx.tsx +2 -7
  67. package/src/DataGridRenderers.tsx +119 -119
  68. package/src/DataTable.tsx +2 -31
  69. package/src/DialogButton.tsx +149 -151
  70. package/src/EmailInput.tsx +9 -11
  71. package/src/FlexBox.tsx +6 -6
  72. package/src/GridDataFormat.tsx +58 -58
  73. package/src/GridUtils.ts +2 -1
  74. package/src/ListItemRightIcon.tsx +3 -3
  75. package/src/LoadingButton.tsx +53 -53
  76. package/src/MUGlobal.ts +196 -203
  77. package/src/MobileListItemRenderer.tsx +63 -65
  78. package/src/NotifierPromptProps.ts +16 -16
  79. package/src/PList.tsx +14 -14
  80. package/src/ProgressCount.tsx +144 -148
  81. package/src/RegionsRQ.ts +26 -0
  82. package/src/SearchField.tsx +59 -59
  83. package/src/SearchOptionGroup.tsx +20 -20
  84. package/src/Switch.tsx +72 -72
  85. package/src/TabBox.tsx +87 -89
  86. package/src/TableEx.tsx +5 -8
  87. package/src/TooltipClick.tsx +62 -64
  88. package/src/TwoFieldInput.tsx +104 -104
  89. package/src/app/IServicePage.ts +1 -1
  90. package/src/app/Labels.ts +67 -67
  91. package/src/index.ts +1 -0
  92. package/src/texts/MoneyText.tsx +29 -35
  93. package/src/texts/NumberText.tsx +23 -23
@@ -1,53 +1,53 @@
1
1
  import {
2
- Box,
3
- CircularProgress,
4
- LinearProgress,
5
- Typography
6
- } from '@mui/material';
7
- import React from 'react';
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
- * 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;
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
- // 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<
75
- 'determinate' | 'indeterminate'
76
- >('determinate');
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)
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
- <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
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
  }
@@ -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
+ };
@@ -1,21 +1,21 @@
1
- import { useDelayedExecutor } from '@etsoo/react';
2
- import { TextField, TextFieldProps } from '@mui/material';
3
- import React from 'react';
4
- import { MUGlobal } from './MUGlobal';
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
- * Change delay (ms) to avoid repeatly dispatch onChange
12
- */
13
- changeDelay?: number;
10
+ /**
11
+ * Change delay (ms) to avoid repeatly dispatch onChange
12
+ */
13
+ changeDelay?: number;
14
14
 
15
- /**
16
- * Is the field read only?
17
- */
18
- readOnly?: boolean;
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
- // 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;
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
- // Shrink
40
- InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
39
+ // Shrink
40
+ InputLabelProps.shrink ??= MUGlobal.searchFieldShrink;
41
41
 
42
- // Read only
43
- if (readOnly != null) InputProps.readOnly = readOnly;
42
+ // Read only
43
+ if (readOnly != null) InputProps.readOnly = readOnly;
44
44
 
45
- const isMounted = React.useRef(true);
46
- const delayed =
47
- onChange != null && changeDelay != null && changeDelay >= 1
48
- ? useDelayedExecutor(onChange, changeDelay)
49
- : undefined;
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
- const onChangeEx = (
52
- event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
53
- ) => {
54
- if (onChange == null) return;
51
+ const onChangeEx = (
52
+ event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>
53
+ ) => {
54
+ if (onChange == null) return;
55
55
 
56
- if (changeDelay == null || changeDelay < 1) {
57
- onChange(event);
58
- return;
59
- }
56
+ if (changeDelay == null || changeDelay < 1) {
57
+ onChange(event);
58
+ return;
59
+ }
60
60
 
61
- delayed?.call(undefined, event);
62
- };
61
+ delayed?.call(undefined, event);
62
+ };
63
63
 
64
- React.useEffect(() => {
65
- return () => {
66
- isMounted.current = false;
67
- delayed?.clear();
68
- };
69
- }, []);
64
+ React.useEffect(() => {
65
+ return () => {
66
+ isMounted.current = false;
67
+ delayed?.clear();
68
+ };
69
+ }, []);
70
70
 
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
- );
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
- 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';
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
- T extends object = ListType,
18
- D extends DataTypes.Keys<T> = IdDefaultType<T>,
19
- L extends DataTypes.Keys<T, string> = LabelDefaultType<T>
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
- // Destruct
22
- const {
23
- row = true,
24
- size = MUGlobal.searchFieldSize,
25
- sx = { '& .MuiFormLabel-root': { fontSize: '0.75em' } },
26
- ...rest
27
- } = props;
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
- // Layout
30
- return <OptionGroup<T, D, L> row={row} size={size} sx={sx} {...rest} />;
29
+ // Layout
30
+ return <OptionGroup<T, D, L> row={row} size={size} sx={sx} {...rest} />;
31
31
  }