@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.
- 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 +25 -25
- 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/lib/app/Labels.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Utils } from
|
|
1
|
+
import { Utils } from "@etsoo/shared";
|
|
2
2
|
/**
|
|
3
3
|
* Labels
|
|
4
4
|
*/
|
|
@@ -8,46 +8,46 @@ export var Labels;
|
|
|
8
8
|
* Common page labels
|
|
9
9
|
*/
|
|
10
10
|
Labels.CommonPage = {
|
|
11
|
-
add:
|
|
12
|
-
back:
|
|
13
|
-
delete:
|
|
14
|
-
more:
|
|
15
|
-
pullToRefresh:
|
|
16
|
-
refresh:
|
|
17
|
-
refreshing:
|
|
18
|
-
releaseToRefresh:
|
|
19
|
-
reset:
|
|
20
|
-
save:
|
|
21
|
-
scrollTop:
|
|
22
|
-
submit:
|
|
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
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* Notification MU labels
|
|
26
26
|
*/
|
|
27
27
|
Labels.NotificationMU = {
|
|
28
|
-
alertTitle:
|
|
29
|
-
alertOK:
|
|
30
|
-
confirmTitle:
|
|
31
|
-
confirmYes:
|
|
32
|
-
confirmNo:
|
|
33
|
-
promptTitle:
|
|
34
|
-
promptCancel:
|
|
35
|
-
promptOK:
|
|
36
|
-
loading:
|
|
37
|
-
success:
|
|
38
|
-
warning:
|
|
39
|
-
info:
|
|
28
|
+
alertTitle: "Warning",
|
|
29
|
+
alertOK: "OK",
|
|
30
|
+
confirmTitle: "Confirm",
|
|
31
|
+
confirmYes: "OK",
|
|
32
|
+
confirmNo: "Cancel",
|
|
33
|
+
promptTitle: "Input",
|
|
34
|
+
promptCancel: "Cancel",
|
|
35
|
+
promptOK: "OK",
|
|
36
|
+
loading: "Loading",
|
|
37
|
+
success: "Success",
|
|
38
|
+
warning: "Warning",
|
|
39
|
+
info: "Information"
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
42
|
* UserAvatarEditor labels
|
|
43
43
|
*/
|
|
44
44
|
Labels.UserAvatarEditor = {
|
|
45
|
-
done:
|
|
46
|
-
reset:
|
|
47
|
-
rotateLeft:
|
|
48
|
-
rotateRight:
|
|
49
|
-
upload:
|
|
50
|
-
zoom:
|
|
45
|
+
done: "Done",
|
|
46
|
+
reset: "Reset",
|
|
47
|
+
rotateLeft: "Rotate left 90°",
|
|
48
|
+
rotateRight: "Rotate right 90°",
|
|
49
|
+
upload: "Upload",
|
|
50
|
+
zoom: "Zoom"
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
53
|
* Set components' labels
|
package/lib/index.d.ts
CHANGED
|
@@ -89,6 +89,7 @@ export * from "./PList";
|
|
|
89
89
|
export * from "./ProgressCount";
|
|
90
90
|
export * from "./PullToRefreshUI";
|
|
91
91
|
export * from "./QuickList";
|
|
92
|
+
export * from "./RegionsRQ";
|
|
92
93
|
export * from "./ResponsibleContainer";
|
|
93
94
|
export * from "./ResponsiveStyleValue";
|
|
94
95
|
export * from "./ScrollerListEx";
|
package/lib/index.js
CHANGED
|
@@ -89,6 +89,7 @@ export * from "./PList";
|
|
|
89
89
|
export * from "./ProgressCount";
|
|
90
90
|
export * from "./PullToRefreshUI";
|
|
91
91
|
export * from "./QuickList";
|
|
92
|
+
export * from "./RegionsRQ";
|
|
92
93
|
export * from "./ResponsibleContainer";
|
|
93
94
|
export * from "./ResponsiveStyleValue";
|
|
94
95
|
export * from "./ScrollerListEx";
|
package/lib/texts/MoneyText.d.ts
CHANGED
package/lib/texts/MoneyText.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { NumberUtils } from
|
|
3
|
-
import { Typography } from
|
|
2
|
+
import { NumberUtils } from "@etsoo/shared";
|
|
3
|
+
import { Typography } from "@mui/material";
|
|
4
4
|
/**
|
|
5
5
|
* Money text
|
|
6
6
|
* @param props Props
|
|
@@ -11,6 +11,6 @@ export function MoneyText(props) {
|
|
|
11
11
|
const { currency, isInteger = false, locale, options = {}, value, ...rest } = props;
|
|
12
12
|
// Layout
|
|
13
13
|
return (_jsx(Typography, { component: "span", fontSize: "inherit", ...rest, children: value == null
|
|
14
|
-
?
|
|
14
|
+
? ""
|
|
15
15
|
: NumberUtils.formatMoney(value, currency, locale, isInteger, options) }));
|
|
16
16
|
}
|
package/lib/texts/NumberText.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { NumberUtils } from
|
|
3
|
-
import { Typography } from
|
|
2
|
+
import { NumberUtils } from "@etsoo/shared";
|
|
3
|
+
import { Typography } from "@mui/material";
|
|
4
4
|
/**
|
|
5
5
|
* Number text
|
|
6
6
|
* @param props Props
|
|
@@ -10,5 +10,5 @@ export function NumberText(props) {
|
|
|
10
10
|
// Destruct
|
|
11
11
|
const { locale, options = {}, value, ...rest } = props;
|
|
12
12
|
// Layout
|
|
13
|
-
return (_jsx(Typography, { component: "span", fontSize: "inherit", ...rest, children: value == null ?
|
|
13
|
+
return (_jsx(Typography, { component: "span", fontSize: "inherit", ...rest, children: value == null ? "" : NumberUtils.format(value, locale, options) }));
|
|
14
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.23",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@dnd-kit/core": "^6.1.0",
|
|
49
49
|
"@dnd-kit/sortable": "^8.0.0",
|
|
50
|
-
"@emotion/css": "^11.13.
|
|
51
|
-
"@emotion/react": "^11.13.
|
|
52
|
-
"@emotion/styled": "^11.13.
|
|
53
|
-
"@etsoo/appscript": "^1.5.
|
|
54
|
-
"@etsoo/notificationbase": "^1.1.
|
|
55
|
-
"@etsoo/react": "^1.7.
|
|
56
|
-
"@etsoo/shared": "^1.2.
|
|
57
|
-
"@mui/icons-material": "^6.1.
|
|
58
|
-
"@mui/material": "^6.1.
|
|
59
|
-
"@mui/x-data-grid": "^7.
|
|
60
|
-
"chart.js": "^4.4.
|
|
50
|
+
"@emotion/css": "^11.13.5",
|
|
51
|
+
"@emotion/react": "^11.13.5",
|
|
52
|
+
"@emotion/styled": "^11.13.5",
|
|
53
|
+
"@etsoo/appscript": "^1.5.64",
|
|
54
|
+
"@etsoo/notificationbase": "^1.1.53",
|
|
55
|
+
"@etsoo/react": "^1.7.96",
|
|
56
|
+
"@etsoo/shared": "^1.2.54",
|
|
57
|
+
"@mui/icons-material": "^6.1.8",
|
|
58
|
+
"@mui/material": "^6.1.8",
|
|
59
|
+
"@mui/x-data-grid": "^7.22.3",
|
|
60
|
+
"chart.js": "^4.4.6",
|
|
61
61
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
62
62
|
"eventemitter3": "^5.0.1",
|
|
63
63
|
"pica": "^9.0.1",
|
|
@@ -70,25 +70,25 @@
|
|
|
70
70
|
"react-imask": "7.6.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@babel/cli": "^7.25.
|
|
74
|
-
"@babel/core": "^7.
|
|
75
|
-
"@babel/plugin-transform-runtime": "^7.25.
|
|
76
|
-
"@babel/preset-env": "^7.
|
|
77
|
-
"@babel/preset-react": "^7.25.
|
|
78
|
-
"@babel/preset-typescript": "^7.
|
|
79
|
-
"@babel/runtime-corejs3": "^7.
|
|
80
|
-
"@testing-library/jest-dom": "^6.6.
|
|
73
|
+
"@babel/cli": "^7.25.9",
|
|
74
|
+
"@babel/core": "^7.26.0",
|
|
75
|
+
"@babel/plugin-transform-runtime": "^7.25.9",
|
|
76
|
+
"@babel/preset-env": "^7.26.0",
|
|
77
|
+
"@babel/preset-react": "^7.25.9",
|
|
78
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
79
|
+
"@babel/runtime-corejs3": "^7.26.0",
|
|
80
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
81
81
|
"@testing-library/react": "^16.0.1",
|
|
82
|
-
"@types/jest": "^29.5.
|
|
82
|
+
"@types/jest": "^29.5.14",
|
|
83
83
|
"@types/pica": "^9.0.4",
|
|
84
84
|
"@types/pulltorefreshjs": "^0.1.7",
|
|
85
|
-
"@types/react": "^18.3.
|
|
85
|
+
"@types/react": "^18.3.12",
|
|
86
86
|
"@types/react-avatar-editor": "^13.0.3",
|
|
87
87
|
"@types/react-dom": "^18.3.1",
|
|
88
|
-
"@types/react-input-mask": "^3.0.
|
|
88
|
+
"@types/react-input-mask": "^3.0.6",
|
|
89
89
|
"@types/react-window": "^1.8.8",
|
|
90
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
91
|
-
"@typescript-eslint/parser": "^8.
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
|
91
|
+
"@typescript-eslint/parser": "^8.15.0",
|
|
92
92
|
"jest": "^29.7.0",
|
|
93
93
|
"jest-environment-jsdom": "^29.7.0",
|
|
94
94
|
"typescript": "^5.6.3"
|
package/src/AddresSelector.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AddressApi,
|
|
3
2
|
AddressCity,
|
|
4
3
|
AddressDistrict,
|
|
5
4
|
AddressRegionDb,
|
|
6
|
-
AddressState
|
|
5
|
+
AddressState,
|
|
6
|
+
IApiPayload
|
|
7
7
|
} from "@etsoo/appscript";
|
|
8
8
|
import { FormLabel, Grid2, GridSize } from "@mui/material";
|
|
9
9
|
import React from "react";
|
|
@@ -11,6 +11,7 @@ import { globalApp } from "./app/ReactApp";
|
|
|
11
11
|
import { ComboBox } from "./ComboBox";
|
|
12
12
|
import { Tiplist } from "./Tiplist";
|
|
13
13
|
import { ResponsiveStyleValue } from "./ResponsiveStyleValue";
|
|
14
|
+
import { RegionsRQ } from "./RegionsRQ";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Address field
|
|
@@ -43,7 +44,33 @@ export type AddressSelectorProps = {
|
|
|
43
44
|
/**
|
|
44
45
|
* Address API
|
|
45
46
|
*/
|
|
46
|
-
api:
|
|
47
|
+
api: {
|
|
48
|
+
regions(
|
|
49
|
+
rq: RegionsRQ,
|
|
50
|
+
payload?: IApiPayload<AddressRegionDb[]>
|
|
51
|
+
): Promise<AddressRegionDb[] | undefined>;
|
|
52
|
+
|
|
53
|
+
states(
|
|
54
|
+
regionId: string,
|
|
55
|
+
favoredIds?: string[],
|
|
56
|
+
payload?: IApiPayload<AddressState[]>,
|
|
57
|
+
culture?: string
|
|
58
|
+
): Promise<AddressState[] | undefined>;
|
|
59
|
+
|
|
60
|
+
cities(
|
|
61
|
+
stateId: string,
|
|
62
|
+
favoredIds?: number[],
|
|
63
|
+
payload?: IApiPayload<AddressCity[]>,
|
|
64
|
+
culture?: string
|
|
65
|
+
): Promise<AddressCity[] | undefined>;
|
|
66
|
+
|
|
67
|
+
districts(
|
|
68
|
+
cityId: number,
|
|
69
|
+
favoredIds?: number[],
|
|
70
|
+
payload?: IApiPayload<AddressDistrict[]>,
|
|
71
|
+
culture?: string
|
|
72
|
+
): Promise<AddressDistrict[] | undefined>;
|
|
73
|
+
};
|
|
47
74
|
|
|
48
75
|
/**
|
|
49
76
|
* Break points
|
|
@@ -305,7 +332,7 @@ export function AddressSelector(props: AddressSelectorProps) {
|
|
|
305
332
|
fullWidth
|
|
306
333
|
idValue={regionState}
|
|
307
334
|
loadData={(keyword, id, items) =>
|
|
308
|
-
api.
|
|
335
|
+
api.regions({
|
|
309
336
|
keyword,
|
|
310
337
|
id,
|
|
311
338
|
items,
|
package/src/AuditDisplay.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AuditLineDto } from "@etsoo/appscript";
|
|
2
1
|
import { Utils } from "@etsoo/shared";
|
|
3
2
|
import { Button, Divider, Theme, Typography, useTheme } from "@mui/material";
|
|
4
3
|
import React, { CSSProperties } from "react";
|
|
5
4
|
import { globalApp } from "./app/ReactApp";
|
|
6
5
|
import { ListMoreDisplay, ListMoreDisplayProps } from "./ListMoreDisplay";
|
|
7
6
|
import { ShowDataComparison } from "./ShowDataComparison";
|
|
7
|
+
import { AuditLineDto } from "@etsoo/appscript";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Audit display props
|
package/src/BackButton.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { IconButton, IconButtonProps, useTheme } from
|
|
2
|
-
import ArrowBackIcon from
|
|
3
|
-
import React from
|
|
4
|
-
import { useNavigate } from
|
|
1
|
+
import { IconButton, IconButtonProps, useTheme } from "@mui/material";
|
|
2
|
+
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { useNavigate } from "react-router-dom";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* BackButton props
|
|
@@ -14,42 +14,42 @@ export interface BackButtonProps extends IconButtonProps {}
|
|
|
14
14
|
* @returns Component
|
|
15
15
|
*/
|
|
16
16
|
export function BackButton(props: BackButtonProps) {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
// Destruct
|
|
18
|
+
const { color = "primary", size = "small", onClick, ...rest } = props;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// Theme
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
|
|
23
|
+
// Navigate
|
|
24
|
+
const navigate = useNavigate();
|
|
25
|
+
|
|
26
|
+
// Color
|
|
27
|
+
const pColor =
|
|
28
|
+
color != "inherit" && color != "default" && color in theme.palette
|
|
29
|
+
? theme.palette[color]
|
|
30
|
+
: theme.palette.primary;
|
|
31
|
+
|
|
32
|
+
// Click handler
|
|
33
|
+
const onClickLocal = async (event: React.MouseEvent<HTMLButtonElement>) => {
|
|
34
|
+
if (onClick) onClick(event);
|
|
22
35
|
|
|
23
36
|
// Navigate
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
aria-label="Back"
|
|
43
|
-
color={color}
|
|
44
|
-
size={size}
|
|
45
|
-
onClick={onClickLocal}
|
|
46
|
-
sx={{
|
|
47
|
-
backgroundColor: pColor.contrastText,
|
|
48
|
-
border: `1px solid ${pColor.light}`
|
|
49
|
-
}}
|
|
50
|
-
{...rest}
|
|
51
|
-
>
|
|
52
|
-
<ArrowBackIcon />
|
|
53
|
-
</IconButton>
|
|
54
|
-
);
|
|
37
|
+
navigate(-1);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<IconButton
|
|
42
|
+
aria-label="Back"
|
|
43
|
+
color={color}
|
|
44
|
+
size={size}
|
|
45
|
+
onClick={onClickLocal}
|
|
46
|
+
sx={{
|
|
47
|
+
backgroundColor: pColor.contrastText,
|
|
48
|
+
border: `1px solid ${pColor.light}`
|
|
49
|
+
}}
|
|
50
|
+
{...rest}
|
|
51
|
+
>
|
|
52
|
+
<ArrowBackIcon />
|
|
53
|
+
</IconButton>
|
|
54
|
+
);
|
|
55
55
|
}
|
package/src/CountryList.tsx
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { AddressRegionDb
|
|
2
|
-
import { DataTypes } from
|
|
3
|
-
import React from
|
|
4
|
-
import { Tiplist, TiplistProps } from
|
|
1
|
+
import { AddressRegionDb } from "@etsoo/appscript";
|
|
2
|
+
import { DataTypes } from "@etsoo/shared";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Tiplist, TiplistProps } from "./Tiplist";
|
|
5
|
+
import { RegionsRQ } from "./RegionsRQ";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Country list props
|
|
8
9
|
*/
|
|
9
10
|
export type CountryListProps = Omit<
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
DataTypes.Optional<TiplistProps<AddressRegionDb, "id">, "name">,
|
|
12
|
+
"loadData"
|
|
12
13
|
> & {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Load data
|
|
16
|
+
* @param rq Request data
|
|
17
|
+
* @returns Result
|
|
18
|
+
*/
|
|
19
|
+
loadData: (rq: RegionsRQ) => Promise<AddressRegionDb[] | undefined>;
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Load favored country ids
|
|
23
|
+
* @returns Result
|
|
24
|
+
*/
|
|
25
|
+
loadFavoredIds?: () => Promise<string[]>;
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Max items to display
|
|
29
|
+
*/
|
|
30
|
+
items?: number;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
/**
|
|
@@ -35,34 +36,34 @@ export type CountryListProps = Omit<
|
|
|
35
36
|
* @returns Component
|
|
36
37
|
*/
|
|
37
38
|
export function CountryList(props: CountryListProps) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
// Destruct
|
|
40
|
+
const {
|
|
41
|
+
items = 16,
|
|
42
|
+
loadData,
|
|
43
|
+
loadFavoredIds,
|
|
44
|
+
name = "countryId",
|
|
45
|
+
...rest
|
|
46
|
+
} = props;
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
// Ref
|
|
49
|
+
const favoredIds = React.useRef<string[]>([]);
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
// Ready
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
if (loadFavoredIds && favoredIds.current.length === 0)
|
|
54
|
+
loadFavoredIds().then((ids) => {
|
|
55
|
+
favoredIds.current = ids;
|
|
56
|
+
});
|
|
57
|
+
}, [loadFavoredIds]);
|
|
57
58
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
// Layout
|
|
60
|
+
return (
|
|
61
|
+
<Tiplist<AddressRegionDb, "id">
|
|
62
|
+
name={name}
|
|
63
|
+
loadData={(keyword, id) =>
|
|
64
|
+
loadData({ id, keyword, favoredIds: favoredIds.current, items })
|
|
65
|
+
}
|
|
66
|
+
{...rest}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
68
69
|
}
|
package/src/CustomFabProps.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { FabPropsColorOverrides, PropTypes } from
|
|
2
|
-
import { OverridableStringUnion } from
|
|
1
|
+
import { FabPropsColorOverrides, PropTypes } from "@mui/material";
|
|
2
|
+
import { OverridableStringUnion } from "@mui/types";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Custom fab size
|
|
6
6
|
*/
|
|
7
|
-
export type CustomFabSize =
|
|
7
|
+
export type CustomFabSize = "small" | "medium" | "large";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Custom fab props
|
|
11
11
|
*/
|
|
12
12
|
export interface CustomFabProps {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Color
|
|
15
|
+
*/
|
|
16
|
+
color?: OverridableStringUnion<PropTypes.Color, FabPropsColorOverrides>;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Fab size
|
|
20
|
+
*/
|
|
21
|
+
size?: CustomFabSize;
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Scroll target
|
|
25
|
+
*/
|
|
26
|
+
target?: any;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Fab title
|
|
30
|
+
*/
|
|
31
|
+
title?: string;
|
|
32
32
|
}
|
package/src/DataGridEx.tsx
CHANGED
|
@@ -258,7 +258,7 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
|
|
|
258
258
|
states
|
|
259
259
|
});
|
|
260
260
|
} else if (sortable && field != null) {
|
|
261
|
-
const active = orderBy
|
|
261
|
+
const active = orderBy != null && orderBy[field] != null;
|
|
262
262
|
|
|
263
263
|
sortLabel = (
|
|
264
264
|
<TableSortLabel
|
|
@@ -438,7 +438,7 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
|
|
|
438
438
|
|
|
439
439
|
// New sort
|
|
440
440
|
const handleSort = (field: string, asc?: boolean) => {
|
|
441
|
-
reset({ queryPaging: { orderBy: field
|
|
441
|
+
reset({ queryPaging: { orderBy: { [field]: asc ?? true } } });
|
|
442
442
|
};
|
|
443
443
|
|
|
444
444
|
// Reset
|
|
@@ -626,10 +626,6 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
|
|
|
626
626
|
|
|
627
627
|
// Table
|
|
628
628
|
const table = React.useMemo(() => {
|
|
629
|
-
const defaultOrderByAsc = defaultOrderBy
|
|
630
|
-
? columns.find((column) => column.field === defaultOrderBy)?.sortAsc
|
|
631
|
-
: undefined;
|
|
632
|
-
|
|
633
629
|
return (
|
|
634
630
|
<ScrollerGrid<T>
|
|
635
631
|
className={Utils.mergeClasses(
|
|
@@ -641,7 +637,6 @@ export function DataGridEx<T extends object>(props: DataGridExProps<T>) {
|
|
|
641
637
|
columnCount={columns.length}
|
|
642
638
|
columnWidth={columnWidth}
|
|
643
639
|
defaultOrderBy={defaultOrderBy}
|
|
644
|
-
defaultOrderByAsc={defaultOrderByAsc}
|
|
645
640
|
height={
|
|
646
641
|
height -
|
|
647
642
|
headerHeight -
|