@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,9 +1,9 @@
1
- import { Input, InputAdornment } from '@mui/material';
2
- import ArrowRightAltIcon from '@mui/icons-material/ArrowRightAlt';
3
- import { useDimensions } from '@etsoo/react';
4
- import React from 'react';
5
- import { DateUtils, DomUtils } from '@etsoo/shared';
6
- import { InputField, InputFieldProps } from './InputField';
1
+ import { Input, InputAdornment } from "@mui/material";
2
+ import ArrowRightAltIcon from "@mui/icons-material/ArrowRightAlt";
3
+ import { useDimensions } from "@etsoo/react";
4
+ import React from "react";
5
+ import { DateUtils, DomUtils } from "@etsoo/shared";
6
+ import { InputField, InputFieldProps } from "./InputField";
7
7
 
8
8
  type ValueType = string | number | Date | null | undefined;
9
9
 
@@ -11,20 +11,20 @@ type ValueType = string | number | Date | null | undefined;
11
11
  * TwoField Input props
12
12
  */
13
13
  export type TwoFieldInputProps = Omit<
14
- InputFieldProps,
15
- 'InputProps' | 'value'
14
+ InputFieldProps,
15
+ "InputProps" | "value"
16
16
  > & {
17
- /**
18
- * Values
19
- */
20
- values?: unknown | [ValueType, ValueType];
17
+ /**
18
+ * Values
19
+ */
20
+ values?: unknown | [ValueType, ValueType];
21
21
 
22
- /**
23
- * On values change, return false to prevent further onChange handler
24
- */
25
- onValuesChange?: (
26
- values: [ValueType, ValueType]
27
- ) => boolean | void | Promise<boolean | void>;
22
+ /**
23
+ * On values change, return false to prevent further onChange handler
24
+ */
25
+ onValuesChange?: (
26
+ values: [ValueType, ValueType]
27
+ ) => boolean | void | Promise<boolean | void>;
28
28
  };
29
29
 
30
30
  /**
@@ -33,99 +33,99 @@ export type TwoFieldInputProps = Omit<
33
33
  * @returns Component
34
34
  */
35
35
  export function TwoFieldInput(props: TwoFieldInputProps) {
36
- // Destruct
37
- const {
38
- name,
39
- inputProps,
40
- type = inputProps?.inputMode,
41
- values,
42
- onValuesChange,
43
- onChange,
44
- onInput,
45
- ...rest
46
- } = props;
36
+ // Destruct
37
+ const {
38
+ name,
39
+ inputProps,
40
+ type = inputProps?.inputMode,
41
+ values,
42
+ onValuesChange,
43
+ onChange,
44
+ onInput,
45
+ ...rest
46
+ } = props;
47
47
 
48
- // Local values
49
- const localValues: [ValueType, ValueType] =
50
- values == null
51
- ? [null, null]
52
- : Array.isArray(values)
53
- ? (values as [ValueType, ValueType])
54
- : [values as ValueType, null];
48
+ // Local values
49
+ const localValues: [ValueType, ValueType] =
50
+ values == null
51
+ ? [null, null]
52
+ : Array.isArray(values)
53
+ ? (values as [ValueType, ValueType])
54
+ : [values as ValueType, null];
55
55
 
56
- // Ref
57
- const valueRef = React.useRef<[ValueType, ValueType]>(localValues);
56
+ // Ref
57
+ const valueRef = React.useRef<[ValueType, ValueType]>(localValues);
58
58
 
59
- // Watch container
60
- const { dimensions } = useDimensions(
61
- 1,
62
- (target, rect) => {
63
- const width = (rect.width - 64) / 2;
64
- const inputs = target.querySelectorAll('input');
65
- inputs[0].style.width = `${width}px`;
66
- inputs[1].parentElement!.style.width = `${width}px`;
67
- },
68
- 0
69
- );
59
+ // Watch container
60
+ const { dimensions } = useDimensions(
61
+ 1,
62
+ (target, rect) => {
63
+ const width = (rect.width - 64) / 2;
64
+ const inputs = target.querySelectorAll("input");
65
+ inputs[0].style.width = `${width}px`;
66
+ inputs[1].parentElement!.style.width = `${width}px`;
67
+ },
68
+ 0
69
+ );
70
70
 
71
- // Handle change
72
- const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
73
- const value = DomUtils.getInputValue(event.target);
74
- const index = event.target.name.endsWith('-start') ? 0 : 1;
75
- valueRef.current[index] = value;
71
+ // Handle change
72
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
73
+ const value = DomUtils.getInputValue(event.target);
74
+ const index = event.target.name.endsWith("-start") ? 0 : 1;
75
+ valueRef.current[index] = value;
76
76
 
77
- if (onValuesChange) {
78
- if (onValuesChange(valueRef.current) === false) return;
79
- }
80
- if (onChange) onChange(event);
81
- };
77
+ if (onValuesChange) {
78
+ if (onValuesChange(valueRef.current) === false) return;
79
+ }
80
+ if (onChange) onChange(event);
81
+ };
82
82
 
83
- const formatValue = (v: ValueType, type?: string) => {
84
- if (v == null) return '';
85
- if (typeof v === 'number') return v;
86
- if (type === 'date' || type === 'datetime-local')
87
- return DateUtils.formatForInput(v, type);
88
- return v;
89
- };
83
+ const formatValue = (v: ValueType, type?: string) => {
84
+ if (v == null) return "";
85
+ if (typeof v === "number") return v;
86
+ if (type === "date" || type === "datetime-local")
87
+ return DateUtils.formatForInput(v, type);
88
+ return v;
89
+ };
90
90
 
91
- React.useEffect(() => {
92
- valueRef.current = localValues;
93
- }, [localValues]);
91
+ React.useEffect(() => {
92
+ valueRef.current = localValues;
93
+ }, [localValues]);
94
94
 
95
- // Layout
96
- return (
97
- <InputField
98
- name={`${name}-start`}
99
- type={type}
100
- value={formatValue(localValues[0], type)}
101
- ref={dimensions[0][0]}
102
- inputProps={inputProps}
103
- InputProps={{
104
- endAdornment: (
105
- <InputAdornment
106
- position="end"
107
- sx={{
108
- display: 'flex',
109
- alignItems: 'center',
110
- gap: 1
111
- }}
112
- >
113
- <ArrowRightAltIcon />
114
- <Input
115
- type={type}
116
- name={`${name}-end`}
117
- value={formatValue(localValues[1], type)}
118
- disableUnderline
119
- onInput={onInput}
120
- onChange={handleChange}
121
- inputProps={inputProps}
122
- />
123
- </InputAdornment>
124
- )
95
+ // Layout
96
+ return (
97
+ <InputField
98
+ name={`${name}-start`}
99
+ type={type}
100
+ value={formatValue(localValues[0], type)}
101
+ ref={dimensions[0][0]}
102
+ inputProps={inputProps}
103
+ InputProps={{
104
+ endAdornment: (
105
+ <InputAdornment
106
+ position="end"
107
+ sx={{
108
+ display: "flex",
109
+ alignItems: "center",
110
+ gap: 1
125
111
  }}
126
- onInput={onInput}
127
- onChange={handleChange}
128
- {...rest}
129
- />
130
- );
112
+ >
113
+ <ArrowRightAltIcon />
114
+ <Input
115
+ type={type}
116
+ name={`${name}-end`}
117
+ value={formatValue(localValues[1], type)}
118
+ disableUnderline
119
+ onInput={onInput}
120
+ onChange={handleChange}
121
+ inputProps={inputProps}
122
+ />
123
+ </InputAdornment>
124
+ )
125
+ }}
126
+ onInput={onInput}
127
+ onChange={handleChange}
128
+ {...rest}
129
+ />
130
+ );
131
131
  }
@@ -1,4 +1,4 @@
1
- import { IPageData } from '@etsoo/react';
1
+ import { IPageData } from "@etsoo/react";
2
2
 
3
3
  /**
4
4
  * Service page data interface
package/src/app/Labels.ts CHANGED
@@ -1,77 +1,77 @@
1
- import { DataTypes, Utils } from '@etsoo/shared';
1
+ import { DataTypes, Utils } from "@etsoo/shared";
2
2
 
3
3
  /**
4
4
  * Labels
5
5
  */
6
6
  export namespace Labels {
7
- /**
8
- * Common page labels
9
- */
10
- export const CommonPage = {
11
- add: 'Add',
12
- back: 'Back',
13
- delete: 'Delete',
14
- more: 'More',
15
- pullToRefresh: 'Pull down to refresh',
16
- refresh: 'Refresh',
17
- refreshing: 'Refreshing',
18
- releaseToRefresh: 'Release to refresh',
19
- reset: 'Reset',
20
- save: 'Save',
21
- scrollTop: 'Scroll to top',
22
- submit: 'Submit'
23
- };
7
+ /**
8
+ * Common page labels
9
+ */
10
+ export const CommonPage = {
11
+ add: "Add",
12
+ back: "Back",
13
+ delete: "Delete",
14
+ more: "More",
15
+ pullToRefresh: "Pull down to refresh",
16
+ refresh: "Refresh",
17
+ refreshing: "Refreshing",
18
+ releaseToRefresh: "Release to refresh",
19
+ reset: "Reset",
20
+ save: "Save",
21
+ scrollTop: "Scroll to top",
22
+ submit: "Submit"
23
+ };
24
24
 
25
- /**
26
- * Notification MU labels
27
- */
28
- export const NotificationMU = {
29
- alertTitle: 'Warning',
30
- alertOK: 'OK',
31
- confirmTitle: 'Confirm',
32
- confirmYes: 'OK',
33
- confirmNo: 'Cancel',
34
- promptTitle: 'Input',
35
- promptCancel: 'Cancel',
36
- promptOK: 'OK',
37
- loading: 'Loading',
38
- success: 'Success',
39
- warning: 'Warning',
40
- info: 'Information'
41
- };
25
+ /**
26
+ * Notification MU labels
27
+ */
28
+ export const NotificationMU = {
29
+ alertTitle: "Warning",
30
+ alertOK: "OK",
31
+ confirmTitle: "Confirm",
32
+ confirmYes: "OK",
33
+ confirmNo: "Cancel",
34
+ promptTitle: "Input",
35
+ promptCancel: "Cancel",
36
+ promptOK: "OK",
37
+ loading: "Loading",
38
+ success: "Success",
39
+ warning: "Warning",
40
+ info: "Information"
41
+ };
42
42
 
43
- /**
44
- * UserAvatarEditor labels
45
- */
46
- export const UserAvatarEditor = {
47
- done: 'Done',
48
- reset: 'Reset',
49
- rotateLeft: 'Rotate left 90°',
50
- rotateRight: 'Rotate right 90°',
51
- upload: 'Upload',
52
- zoom: 'Zoom'
53
- };
43
+ /**
44
+ * UserAvatarEditor labels
45
+ */
46
+ export const UserAvatarEditor = {
47
+ done: "Done",
48
+ reset: "Reset",
49
+ rotateLeft: "Rotate left 90°",
50
+ rotateRight: "Rotate right 90°",
51
+ upload: "Upload",
52
+ zoom: "Zoom"
53
+ };
54
54
 
55
- /**
56
- * setLabelReference key reference
57
- */
58
- export interface setLabelsReference {
59
- commonPage?: DataTypes.StringDictionary;
60
- notificationMU?: DataTypes.StringDictionary;
61
- userAvatarEditor?: DataTypes.StringDictionary;
62
- }
55
+ /**
56
+ * setLabelReference key reference
57
+ */
58
+ export interface setLabelsReference {
59
+ commonPage?: DataTypes.StringDictionary;
60
+ notificationMU?: DataTypes.StringDictionary;
61
+ userAvatarEditor?: DataTypes.StringDictionary;
62
+ }
63
63
 
64
- /**
65
- * Set components' labels
66
- * @param labels Labels
67
- * @param reference Key reference
68
- */
69
- export const setLabels = (
70
- labels: DataTypes.StringRecord,
71
- reference: setLabelsReference = {}
72
- ) => {
73
- Utils.setLabels(CommonPage, labels, reference.commonPage);
74
- Utils.setLabels(NotificationMU, labels, reference.notificationMU);
75
- Utils.setLabels(UserAvatarEditor, labels, reference.userAvatarEditor);
76
- };
64
+ /**
65
+ * Set components' labels
66
+ * @param labels Labels
67
+ * @param reference Key reference
68
+ */
69
+ export const setLabels = (
70
+ labels: DataTypes.StringRecord,
71
+ reference: setLabelsReference = {}
72
+ ) => {
73
+ Utils.setLabels(CommonPage, labels, reference.commonPage);
74
+ Utils.setLabels(NotificationMU, labels, reference.notificationMU);
75
+ Utils.setLabels(UserAvatarEditor, labels, reference.userAvatarEditor);
76
+ };
77
77
  }
package/src/index.ts CHANGED
@@ -94,6 +94,7 @@ export * from "./PList";
94
94
  export * from "./ProgressCount";
95
95
  export * from "./PullToRefreshUI";
96
96
  export * from "./QuickList";
97
+ export * from "./RegionsRQ";
97
98
  export * from "./ResponsibleContainer";
98
99
  export * from "./ResponsiveStyleValue";
99
100
  export * from "./ScrollerListEx";
@@ -1,21 +1,21 @@
1
- import { NumberUtils } from '@etsoo/shared';
2
- import { Typography } from '@mui/material';
3
- import React from 'react';
4
- import { NumberTextProps } from './NumberText';
1
+ import { NumberUtils } from "@etsoo/shared";
2
+ import { Typography } from "@mui/material";
3
+ import React from "react";
4
+ import { NumberTextProps } from "./NumberText";
5
5
 
6
6
  /**
7
7
  * Money text props
8
8
  */
9
9
  export interface MoneyTextProps extends NumberTextProps {
10
- /**
11
- * Currency, USD for US dollar
12
- */
13
- currency?: string;
10
+ /**
11
+ * Currency, USD for US dollar
12
+ */
13
+ currency?: string;
14
14
 
15
- /**
16
- * Is integer number
17
- */
18
- isInteger?: boolean;
15
+ /**
16
+ * Is integer number
17
+ */
18
+ isInteger?: boolean;
19
19
  }
20
20
 
21
21
  /**
@@ -24,28 +24,22 @@ export interface MoneyTextProps extends NumberTextProps {
24
24
  * @returns Component
25
25
  */
26
26
  export function MoneyText(props: MoneyTextProps) {
27
- // Destruct
28
- const {
29
- currency,
30
- isInteger = false,
31
- locale,
32
- options = {},
33
- value,
34
- ...rest
35
- } = props;
27
+ // Destruct
28
+ const {
29
+ currency,
30
+ isInteger = false,
31
+ locale,
32
+ options = {},
33
+ value,
34
+ ...rest
35
+ } = props;
36
36
 
37
- // Layout
38
- return (
39
- <Typography component="span" fontSize="inherit" {...rest}>
40
- {value == null
41
- ? ''
42
- : NumberUtils.formatMoney(
43
- value,
44
- currency,
45
- locale,
46
- isInteger,
47
- options
48
- )}
49
- </Typography>
50
- );
37
+ // Layout
38
+ return (
39
+ <Typography component="span" fontSize="inherit" {...rest}>
40
+ {value == null
41
+ ? ""
42
+ : NumberUtils.formatMoney(value, currency, locale, isInteger, options)}
43
+ </Typography>
44
+ );
51
45
  }
@@ -1,25 +1,25 @@
1
- import { NumberUtils } from '@etsoo/shared';
2
- import { Typography, TypographyProps } from '@mui/material';
3
- import React from 'react';
1
+ import { NumberUtils } from "@etsoo/shared";
2
+ import { Typography, TypographyProps } from "@mui/material";
3
+ import React from "react";
4
4
 
5
5
  /**
6
6
  * Number text props
7
7
  */
8
8
  export interface NumberTextProps extends TypographyProps {
9
- /**
10
- * Locale
11
- */
12
- locale?: string | string[];
9
+ /**
10
+ * Locale
11
+ */
12
+ locale?: string | string[];
13
13
 
14
- /**
15
- * Options
16
- */
17
- options?: Intl.NumberFormatOptions;
14
+ /**
15
+ * Options
16
+ */
17
+ options?: Intl.NumberFormatOptions;
18
18
 
19
- /**
20
- * Value
21
- */
22
- value?: number | bigint | null;
19
+ /**
20
+ * Value
21
+ */
22
+ value?: number | bigint | null;
23
23
  }
24
24
 
25
25
  /**
@@ -28,13 +28,13 @@ export interface NumberTextProps extends TypographyProps {
28
28
  * @returns Component
29
29
  */
30
30
  export function NumberText(props: NumberTextProps) {
31
- // Destruct
32
- const { locale, options = {}, value, ...rest } = props;
31
+ // Destruct
32
+ const { locale, options = {}, value, ...rest } = props;
33
33
 
34
- // Layout
35
- return (
36
- <Typography component="span" fontSize="inherit" {...rest}>
37
- {value == null ? '' : NumberUtils.format(value, locale, options)}
38
- </Typography>
39
- );
34
+ // Layout
35
+ return (
36
+ <Typography component="span" fontSize="inherit" {...rest}>
37
+ {value == null ? "" : NumberUtils.format(value, locale, options)}
38
+ </Typography>
39
+ );
40
40
  }