@etsoo/materialui 1.4.21 → 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.
Files changed (92) hide show
  1. package/README.md +2 -1
  2. package/babel.config.json +12 -12
  3. package/lib/AddresSelector.d.ts +8 -2
  4. package/lib/AddresSelector.js +1 -1
  5. package/lib/AuditDisplay.d.ts +1 -1
  6. package/lib/BackButton.d.ts +1 -1
  7. package/lib/BackButton.js +5 -5
  8. package/lib/CountryList.d.ts +5 -4
  9. package/lib/CountryList.js +3 -3
  10. package/lib/CustomFabProps.d.ts +3 -3
  11. package/lib/DataGridEx.js +3 -6
  12. package/lib/DataGridRenderers.d.ts +3 -3
  13. package/lib/DataGridRenderers.js +17 -17
  14. package/lib/DataTable.d.ts +1 -7
  15. package/lib/DataTable.js +3 -13
  16. package/lib/DialogButton.d.ts +2 -2
  17. package/lib/DialogButton.js +4 -4
  18. package/lib/EmailInput.d.ts +2 -2
  19. package/lib/EmailInput.js +2 -2
  20. package/lib/FlexBox.d.ts +3 -3
  21. package/lib/FlexBox.js +1 -1
  22. package/lib/GridDataFormat.d.ts +2 -2
  23. package/lib/GridDataFormat.js +7 -7
  24. package/lib/GridUtils.js +2 -1
  25. package/lib/ListItemRightIcon.d.ts +1 -1
  26. package/lib/ListItemRightIcon.js +2 -2
  27. package/lib/LoadingButton.d.ts +1 -1
  28. package/lib/LoadingButton.js +2 -2
  29. package/lib/MUGlobal.d.ts +6 -6
  30. package/lib/MUGlobal.js +20 -22
  31. package/lib/MobileListItemRenderer.d.ts +3 -3
  32. package/lib/MobileListItemRenderer.js +8 -10
  33. package/lib/PList.js +1 -1
  34. package/lib/ProgressCount.js +12 -12
  35. package/lib/RegionsRQ.d.ts +22 -0
  36. package/lib/RegionsRQ.js +1 -0
  37. package/lib/SearchField.d.ts +1 -1
  38. package/lib/SearchField.js +4 -4
  39. package/lib/SearchOptionGroup.d.ts +2 -2
  40. package/lib/SearchOptionGroup.js +3 -3
  41. package/lib/Switch.d.ts +3 -3
  42. package/lib/Switch.js +5 -5
  43. package/lib/TabBox.d.ts +5 -5
  44. package/lib/TabBox.js +5 -5
  45. package/lib/TableEx.js +4 -7
  46. package/lib/TooltipClick.d.ts +3 -3
  47. package/lib/TooltipClick.js +3 -3
  48. package/lib/TwoFieldInput.d.ts +2 -2
  49. package/lib/TwoFieldInput.js +13 -13
  50. package/lib/app/IServicePage.d.ts +1 -1
  51. package/lib/app/Labels.d.ts +1 -1
  52. package/lib/app/Labels.js +31 -31
  53. package/lib/index.d.ts +1 -0
  54. package/lib/index.js +1 -0
  55. package/lib/texts/MoneyText.d.ts +1 -1
  56. package/lib/texts/MoneyText.js +3 -3
  57. package/lib/texts/NumberText.d.ts +1 -1
  58. package/lib/texts/NumberText.js +3 -3
  59. package/package.json +25 -25
  60. package/src/AddresSelector.tsx +31 -4
  61. package/src/AuditDisplay.tsx +1 -1
  62. package/src/BackButton.tsx +39 -39
  63. package/src/CountryList.tsx +49 -48
  64. package/src/CustomFabProps.ts +19 -19
  65. package/src/DataGridEx.tsx +2 -7
  66. package/src/DataGridRenderers.tsx +119 -119
  67. package/src/DataTable.tsx +2 -31
  68. package/src/DialogButton.tsx +149 -151
  69. package/src/EmailInput.tsx +9 -11
  70. package/src/FlexBox.tsx +6 -6
  71. package/src/GridDataFormat.tsx +58 -58
  72. package/src/GridUtils.ts +2 -1
  73. package/src/ListItemRightIcon.tsx +3 -3
  74. package/src/LoadingButton.tsx +53 -53
  75. package/src/MUGlobal.ts +196 -203
  76. package/src/MobileListItemRenderer.tsx +63 -65
  77. package/src/NotifierPromptProps.ts +16 -16
  78. package/src/PList.tsx +14 -14
  79. package/src/ProgressCount.tsx +144 -148
  80. package/src/RegionsRQ.ts +26 -0
  81. package/src/SearchField.tsx +59 -59
  82. package/src/SearchOptionGroup.tsx +20 -20
  83. package/src/Switch.tsx +72 -72
  84. package/src/TabBox.tsx +87 -89
  85. package/src/TableEx.tsx +5 -8
  86. package/src/TooltipClick.tsx +62 -64
  87. package/src/TwoFieldInput.tsx +104 -104
  88. package/src/app/IServicePage.ts +1 -1
  89. package/src/app/Labels.ts +67 -67
  90. package/src/index.ts +1 -0
  91. package/src/texts/MoneyText.tsx +29 -35
  92. package/src/texts/NumberText.tsx +23 -23
package/src/FlexBox.tsx CHANGED
@@ -1,13 +1,13 @@
1
- import { Stack, StackProps } from '@mui/material';
2
- import React from 'react';
1
+ import { Stack, StackProps } from "@mui/material";
2
+ import React from "react";
3
3
 
4
4
  /**
5
5
  * Horizonal box
6
6
  * @param props Props
7
7
  * @returns Component
8
8
  */
9
- export function HBox(props: Omit<StackProps, 'ref'>) {
10
- return <Stack direction="row" width="100%" {...props} />;
9
+ export function HBox(props: Omit<StackProps, "ref">) {
10
+ return <Stack direction="row" width="100%" {...props} />;
11
11
  }
12
12
 
13
13
  /**
@@ -15,6 +15,6 @@ export function HBox(props: Omit<StackProps, 'ref'>) {
15
15
  * @param props Props
16
16
  * @returns Component
17
17
  */
18
- export function VBox(props: Omit<StackProps, 'ref'>) {
19
- return <Stack direction="column" {...props} />;
18
+ export function VBox(props: Omit<StackProps, "ref">) {
19
+ return <Stack direction="column" {...props} />;
20
20
  }
@@ -1,7 +1,7 @@
1
- import { GridColumnRenderProps, GridDataType } from '@etsoo/react';
2
- import { DateUtils, NumberUtils } from '@etsoo/shared';
3
- import React from 'react';
4
- import { DateText } from './texts/DateText';
1
+ import { GridColumnRenderProps, GridDataType } from "@etsoo/react";
2
+ import { DateUtils, NumberUtils } from "@etsoo/shared";
3
+ import React from "react";
4
+ import { DateText } from "./texts/DateText";
5
5
 
6
6
  /**
7
7
  * Grid data format
@@ -11,67 +11,67 @@ import { DateText } from './texts/DateText';
11
11
  * @returns Result
12
12
  */
13
13
  export function GridDataFormat(
14
- data: unknown,
15
- type: GridDataType,
16
- renderProps?: GridColumnRenderProps
14
+ data: unknown,
15
+ type: GridDataType,
16
+ renderProps?: GridColumnRenderProps
17
17
  ): React.ReactNode {
18
- // Null
19
- if (data == null) return undefined;
18
+ // Null
19
+ if (data == null) return undefined;
20
20
 
21
- // For date time
22
- // Conversion if necessary
23
- if (type === GridDataType.Date || type === GridDataType.DateTime) {
24
- const dateValue =
25
- data instanceof Date
26
- ? data
27
- : typeof data === 'number' || typeof data === 'string'
28
- ? new Date(data)
29
- : undefined;
21
+ // For date time
22
+ // Conversion if necessary
23
+ if (type === GridDataType.Date || type === GridDataType.DateTime) {
24
+ const dateValue =
25
+ data instanceof Date
26
+ ? data
27
+ : typeof data === "number" || typeof data === "string"
28
+ ? new Date(data)
29
+ : undefined;
30
30
 
31
- if (dateValue == null) return undefined;
31
+ if (dateValue == null) return undefined;
32
32
 
33
- const option = type === GridDataType.DateTime ? 'ds' : 'd';
33
+ const option = type === GridDataType.DateTime ? "ds" : "d";
34
34
 
35
- const nearDays = renderProps?.nearDays;
36
- if (nearDays != null) {
37
- return (
38
- <DateText
39
- value={dateValue}
40
- locale={renderProps?.culture}
41
- timeZone={renderProps?.timeZone}
42
- options={option}
43
- nearDays={nearDays}
44
- />
45
- );
46
- }
47
-
48
- return DateUtils.format(
49
- dateValue,
50
- renderProps?.culture,
51
- option,
52
- renderProps?.timeZone
53
- );
35
+ const nearDays = renderProps?.nearDays;
36
+ if (nearDays != null) {
37
+ return (
38
+ <DateText
39
+ value={dateValue}
40
+ locale={renderProps?.culture}
41
+ timeZone={renderProps?.timeZone}
42
+ options={option}
43
+ nearDays={nearDays}
44
+ />
45
+ );
54
46
  }
55
47
 
56
- // For numbers
57
- if (typeof data === 'number') {
58
- if (type === GridDataType.Money || type === GridDataType.IntMoney)
59
- return NumberUtils.formatMoney(
60
- data,
61
- renderProps?.currency,
62
- renderProps?.culture,
63
- type === GridDataType.IntMoney,
64
- renderProps?.numberFormatOptions
65
- );
66
- else
67
- return NumberUtils.format(
68
- data,
69
- renderProps?.culture,
70
- renderProps?.numberFormatOptions
71
- );
72
- }
48
+ return DateUtils.format(
49
+ dateValue,
50
+ renderProps?.culture,
51
+ option,
52
+ renderProps?.timeZone
53
+ );
54
+ }
55
+
56
+ // For numbers
57
+ if (typeof data === "number") {
58
+ if (type === GridDataType.Money || type === GridDataType.IntMoney)
59
+ return NumberUtils.formatMoney(
60
+ data,
61
+ renderProps?.currency,
62
+ renderProps?.culture,
63
+ type === GridDataType.IntMoney,
64
+ renderProps?.numberFormatOptions
65
+ );
66
+ else
67
+ return NumberUtils.format(
68
+ data,
69
+ renderProps?.culture,
70
+ renderProps?.numberFormatOptions
71
+ );
72
+ }
73
73
 
74
- if (typeof data === 'string') return data;
74
+ if (typeof data === "string") return data;
75
75
 
76
- return `${data}`;
76
+ return `${data}`;
77
77
  }
package/src/GridUtils.ts CHANGED
@@ -73,7 +73,8 @@ export namespace GridUtils {
73
73
  */
74
74
  export function getUpdateRowsHandler<T extends object>(cacheKey?: string) {
75
75
  return (rows: T[], state: GridLoaderStates<T>) => {
76
- if (state.queryPaging.currentPage > 0 && cacheKey) {
76
+ const page = state.queryPaging.currentPage ?? 0;
77
+ if (page > 0 && cacheKey) {
77
78
  const data: GridDataCacheType<T> = {
78
79
  rows,
79
80
  state,
@@ -1,9 +1,9 @@
1
- import { ListItemIcon, styled } from '@mui/material';
1
+ import { ListItemIcon, styled } from "@mui/material";
2
2
 
3
3
  /**
4
4
  * List item right icon component
5
5
  */
6
6
  export const ListItemRightIcon = styled(ListItemIcon)(({ theme }) => ({
7
- minWidth: '20px!important',
8
- paddingLeft: theme.spacing(2)
7
+ minWidth: "20px!important",
8
+ paddingLeft: theme.spacing(2)
9
9
  })) as typeof ListItemIcon;
@@ -1,19 +1,19 @@
1
1
  import {
2
- Button,
3
- ButtonProps,
4
- CircularProgress,
5
- CircularProgressProps
6
- } from '@mui/material';
7
- import React from 'react';
2
+ Button,
3
+ ButtonProps,
4
+ CircularProgress,
5
+ CircularProgressProps
6
+ } from "@mui/material";
7
+ import React from "react";
8
8
 
9
9
  /**
10
10
  * Loading button props
11
11
  */
12
12
  export type LoadingButtonProps = ButtonProps & {
13
- /**
14
- * Loading icon props
15
- */
16
- loadingIconProps?: CircularProgressProps;
13
+ /**
14
+ * Loading icon props
15
+ */
16
+ loadingIconProps?: CircularProgressProps;
17
17
  };
18
18
 
19
19
  /**
@@ -21,55 +21,55 @@ export type LoadingButtonProps = ButtonProps & {
21
21
  * @param props Props
22
22
  */
23
23
  export function LoadingButton(props: LoadingButtonProps) {
24
- // Destruct
25
- const { endIcon, loadingIconProps = {}, onClick, ...rest } = props;
24
+ // Destruct
25
+ const { endIcon, loadingIconProps = {}, onClick, ...rest } = props;
26
26
 
27
- // Default size
28
- loadingIconProps.size ??= 12;
27
+ // Default size
28
+ loadingIconProps.size ??= 12;
29
29
 
30
- // State
31
- // https://stackoverflow.com/questions/55265255/react-usestate-hook-event-handler-using-initial-state
32
- const [loading, setLoading] = React.useState(false);
30
+ // State
31
+ // https://stackoverflow.com/questions/55265255/react-usestate-hook-event-handler-using-initial-state
32
+ const [loading, setLoading] = React.useState(false);
33
33
 
34
- // Icon
35
- const localEndIcon = loading ? (
36
- <CircularProgress {...loadingIconProps} />
37
- ) : (
38
- endIcon
39
- );
34
+ // Icon
35
+ const localEndIcon = loading ? (
36
+ <CircularProgress {...loadingIconProps} />
37
+ ) : (
38
+ endIcon
39
+ );
40
40
 
41
- // Check if the component is mounted
42
- const isMounted = React.useRef(true);
41
+ // Check if the component is mounted
42
+ const isMounted = React.useRef(true);
43
43
 
44
- React.useEffect(() => {
45
- return () => {
46
- isMounted.current = false;
47
- };
48
- }, []);
44
+ React.useEffect(() => {
45
+ return () => {
46
+ isMounted.current = false;
47
+ };
48
+ }, []);
49
49
 
50
- // Layout
51
- return (
52
- <Button
53
- disabled={loading}
54
- endIcon={localEndIcon}
55
- onClick={async (event) => {
56
- if (onClick) {
57
- // Update state
58
- setLoading(true);
50
+ // Layout
51
+ return (
52
+ <Button
53
+ disabled={loading}
54
+ endIcon={localEndIcon}
55
+ onClick={async (event) => {
56
+ if (onClick) {
57
+ // Update state
58
+ setLoading(true);
59
59
 
60
- // https://stackoverflow.com/questions/38508420/how-to-know-if-a-function-is-async
61
- // const AsyncFunction = (async () => {}).constructor;
62
- // onClick instanceof AsyncFunction
63
- await onClick(event);
60
+ // https://stackoverflow.com/questions/38508420/how-to-know-if-a-function-is-async
61
+ // const AsyncFunction = (async () => {}).constructor;
62
+ // onClick instanceof AsyncFunction
63
+ await onClick(event);
64
64
 
65
- // Warning: Can't perform a React state update on an unmounted component
66
- // It's necessary to check the component is mounted now
67
- if (isMounted.current) {
68
- setLoading(false);
69
- }
70
- }
71
- }}
72
- {...rest}
73
- />
74
- );
65
+ // Warning: Can't perform a React state update on an unmounted component
66
+ // It's necessary to check the component is mounted now
67
+ if (isMounted.current) {
68
+ setLoading(false);
69
+ }
70
+ }
71
+ }}
72
+ {...rest}
73
+ />
74
+ );
75
75
  }