@m4l/components 0.1.26 → 0.1.28
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/assets/Logo/index.228dcb5a.js +42 -35
- package/commonjs.565e6834.js +5 -5
- package/components/CommonActions/components/ActionCancel/index.e498eeb2.js +17 -0
- package/components/CommonActions/components/ActionFormCancel/index.4ff0ad73.js +64 -0
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +28 -22
- package/components/CommonActions/components/ActionIntro/index.60ef7bd7.js +18 -0
- package/components/CommonActions/components/Actions/index.0645e30f.js +867 -0
- package/components/DataGrid/index.76d8fd25.js +1075 -0
- package/components/DynamicFilter/index.342ba5fe.js +1577 -0
- package/components/ErrorLabel/index.c8615f16.js +13 -12
- package/components/Icon/index.619c31c4.js +96 -0
- package/components/Icon/types.d.ts +2 -1
- package/components/Image/index.93d5f37f.js +190 -0
- package/components/Loadable/index.f5518558.js +8 -8
- package/components/ModalDialog/index.9ea10764.js +184 -0
- package/components/NoItemSelected/{index.9609a7f7.js → index.46d2f632.js} +52 -41
- package/components/ObjectLogs/index.f941fb79.js +288 -0
- package/components/Page/index.4237c241.js +22 -20
- package/components/PaperForm/index.ec9cb8c9.js +112 -0
- package/components/Period/index.2941fbda.js +249 -0
- package/components/PropertyValue/index.dfcfe1ba.js +147 -0
- package/components/PropertyValue/styles.d.ts +2 -1
- package/components/PropertyValue/types.d.ts +3 -3
- package/components/Resizeable/index.45995d2b.js +19 -19
- package/components/ScrollBar/index.39eeb2de.js +26 -21
- package/components/ScrollToTop/index.e06f98f6.js +8 -7
- package/components/SplitLayout/index.4032673d.js +35 -33
- package/components/animate/LoadingScreen/index.1d0c4307.js +33 -33
- package/components/animate/MotionContainer/index.8d9f9d80.js +25 -22
- package/components/animate/MotionLazyContainer/index.572dd012.js +10 -10
- package/components/animate/features.0fbf41e1.js +3 -3
- package/components/animate/variants/bounce.784aaaaa.js +16 -13
- package/components/animate/variants/container.11f82b76.js +8 -6
- package/components/animate/variants/fade.b561c0fc.js +32 -28
- package/components/animate/variants/transition.bd46b9ce.js +17 -12
- package/components/formatters/BooleanFormatter/index.8da35c9c.js +55 -0
- package/components/formatters/DateFormatter/index.1b9baacc.js +69 -0
- package/components/formatters/index.689a8086.js +119 -0
- package/components/hook-form/RHFAutocomplete/index.59a68f9f.js +224 -0
- package/components/hook-form/RHFAutocompleteAsync/index.c3083062.js +87 -0
- package/components/hook-form/RHFCheckbox/index.6dcec9e2.js +49 -39
- package/components/hook-form/RHFDateTime/index.9231a7c7.js +69 -56
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +23 -23
- package/components/hook-form/RHFPeriod/index.64a228d5.js +55 -0
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +29 -29
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +24 -24
- package/components/hook-form/RHFTextField/index.f9aaaa90.js +146 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/index.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/styles.d.ts +4 -3
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/index.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/subcomponents/Skeleton/styles.d.ts +0 -0
- package/components/hook-form/RHFUpload/RHFUploadImage/{components → subcomponents}/UploadImage/types.d.ts +0 -0
- package/components/hook-form/RHFUpload/index.d5cc7c13.js +285 -0
- package/components/mui_extended/Accordion/index.a02ac6ae.js +107 -0
- package/components/mui_extended/Avatar/index.fe06afd7.js +51 -0
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +10 -10
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +49 -44
- package/components/mui_extended/Button/index.53b56958.js +178 -0
- package/components/mui_extended/CircularProgress/index.ad569afd.js +8 -6
- package/components/mui_extended/IconButton/index.a321e5cb.js +120 -0
- package/components/mui_extended/IconButton/index.d.ts +1 -1
- package/components/mui_extended/LinkWithRoute/index.16436ab8.js +25 -21
- package/components/mui_extended/Pager/index.c0865b70.js +141 -0
- package/components/mui_extended/Popover/index.705275a4.js +278 -0
- package/components/mui_extended/Tab/index.e0653a0a.js +25 -21
- package/components/mui_extended/Typography/index.e5494696.js +25 -21
- package/contexts/ModalContext/index.b92fa565.js +153 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/index.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/styles.d.ts +0 -0
- package/contexts/ModalContext/{components → subcomponents}/ContentConfirm/types.d.ts +0 -0
- package/contexts/RHFormContext/index.b142190a.js +63 -0
- package/hooks/useFormAddEdit/index.d4845f1a.js +40 -22
- package/hooks/useModal/index.5fee01a3.js +11 -0
- package/index.js +153 -153
- package/package.json +2 -1
- package/react-data-grid.d46d625e.js +2206 -1663
- package/react-draggable.20e95c61.js +800 -553
- package/react-json-view.f56a7f8e.js +2344 -2340
- package/react-resizable.5277deaf.js +470 -298
- package/react-splitter-layout.7810ac1b.js +130 -128
- package/utils/index.214d9542.js +500 -354
- package/components/CommonActions/components/ActionCancel/index.6736b782.js +0 -17
- package/components/CommonActions/components/ActionFormCancel/index.281ee166.js +0 -49
- package/components/CommonActions/components/ActionIntro/index.4665a611.js +0 -18
- package/components/CommonActions/components/Actions/index.cd7b2671.js +0 -742
- package/components/DataGrid/index.2caf6231.js +0 -894
- package/components/DynamicFilter/index.f2377369.js +0 -1157
- package/components/Icon/index.f569765b.js +0 -82
- package/components/Image/index.c9da2d5a.js +0 -152
- package/components/ModalDialog/index.bee344a5.js +0 -168
- package/components/ObjectLogs/index.6b6f95e6.js +0 -266
- package/components/PaperForm/index.3f8c7ef2.js +0 -105
- package/components/Period/index.a112ce37.js +0 -175
- package/components/PropertyValue/index.ab3dd7e9.js +0 -116
- package/components/contexts/RHFormContext/index.33dba822.js +0 -56
- package/components/formatters/BooleanFormatter/index.3ec56305.js +0 -42
- package/components/formatters/DateFormatter/index.08d8823b.js +0 -57
- package/components/formatters/index.6959c2de.js +0 -106
- package/components/hook-form/RHFAutocomplete/index.5eee9d7c.js +0 -174
- package/components/hook-form/RHFAutocompleteAsync/index.757b5080.js +0 -65
- package/components/hook-form/RHFPeriod/index.979d0898.js +0 -51
- package/components/hook-form/RHFTextField/index.ba2a8f67.js +0 -129
- package/components/hook-form/RHFUpload/index.6347159a.js +0 -258
- package/components/mui_extended/Accordion/index.49f5df8e.js +0 -103
- package/components/mui_extended/Avatar/index.dadb0528.js +0 -37
- package/components/mui_extended/Button/index.52d18aea.js +0 -144
- package/components/mui_extended/IconButton/index.4b5ce8b5.js +0 -103
- package/components/mui_extended/Pager/index.951b6975.js +0 -126
- package/components/mui_extended/Popover/index.4da8587a.js +0 -252
- package/contexts/ModalContext/index.5388dfd5.js +0 -136
- package/hooks/useModal/index.3b1ff084.js +0 -11
- package/node_modules.168cb897.js +0 -55
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import { Link as
|
|
2
|
-
import { Skeleton
|
|
3
|
-
import { useModuleSkeleton
|
|
4
|
-
import { jsx
|
|
5
|
-
const
|
|
1
|
+
import { Link as Link$1 } from "react-router-dom";
|
|
2
|
+
import { Skeleton, Link } from "@mui/material";
|
|
3
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
const LinkWithRoute = (props) => {
|
|
6
6
|
const {
|
|
7
|
-
to
|
|
8
|
-
children
|
|
9
|
-
skeletonWidth
|
|
10
|
-
skeletonHeight
|
|
11
|
-
...
|
|
12
|
-
} =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
to,
|
|
8
|
+
children,
|
|
9
|
+
skeletonWidth = "100%",
|
|
10
|
+
skeletonHeight = "14px",
|
|
11
|
+
...other
|
|
12
|
+
} = props;
|
|
13
|
+
const isSkeleton = useModuleSkeleton();
|
|
14
|
+
if (isSkeleton) {
|
|
15
|
+
return /* @__PURE__ */ jsx(Skeleton, {
|
|
16
|
+
variant: "text",
|
|
17
|
+
width: skeletonWidth,
|
|
18
|
+
height: skeletonHeight
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
22
|
+
component: Link$1,
|
|
23
|
+
to,
|
|
24
|
+
...other,
|
|
25
|
+
children
|
|
22
26
|
});
|
|
23
27
|
};
|
|
24
28
|
export {
|
|
25
|
-
|
|
29
|
+
LinkWithRoute as L
|
|
26
30
|
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { Skeleton, TablePagination } from "@mui/material";
|
|
3
|
+
import { P as PagerActions } from "../../CommonActions/components/Actions/index.0645e30f.js";
|
|
4
|
+
import { styled } from "@mui/material/styles";
|
|
5
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
6
|
+
styled("div")(() => ({
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "column",
|
|
9
|
+
height: "100%",
|
|
10
|
+
overflow: "hidden"
|
|
11
|
+
}));
|
|
12
|
+
const SKTWrapperPagerActions = styled("div")(({ theme }) => ({
|
|
13
|
+
width: "100%",
|
|
14
|
+
display: "flex",
|
|
15
|
+
justifyContent: "center",
|
|
16
|
+
alignItems: "center",
|
|
17
|
+
marginLeft: theme.spacing(3)
|
|
18
|
+
}));
|
|
19
|
+
const SKTSvgIconButtonContainer = styled("div")(({ theme }) => ({
|
|
20
|
+
display: "flex",
|
|
21
|
+
marginLeft: theme.spacing(3)
|
|
22
|
+
}));
|
|
23
|
+
const SKTSvgIconButton = styled("div")(({ theme }) => ({
|
|
24
|
+
display: "flex",
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
width: theme.spacing(3.75),
|
|
28
|
+
height: theme.spacing(3.75)
|
|
29
|
+
}));
|
|
30
|
+
const SKTWrapperRowsPerPage = styled("div")(({ theme }) => ({
|
|
31
|
+
display: "grid",
|
|
32
|
+
gridTemplateColumns: "auto auto",
|
|
33
|
+
gridGap: theme.spacing(1),
|
|
34
|
+
marginRight: theme.spacing(3)
|
|
35
|
+
}));
|
|
36
|
+
function Pager(props) {
|
|
37
|
+
const {
|
|
38
|
+
totalRecords,
|
|
39
|
+
rowsPerPageOptions = [5, 10, 2],
|
|
40
|
+
rowsPerPage = 25,
|
|
41
|
+
page,
|
|
42
|
+
onPageChange,
|
|
43
|
+
onRowsPerPageChange,
|
|
44
|
+
labelRows = "Rows per page",
|
|
45
|
+
labelOf = "Of",
|
|
46
|
+
isSkeleton = "false",
|
|
47
|
+
isDesktop
|
|
48
|
+
} = props;
|
|
49
|
+
const currentPage = useMemo(() => {
|
|
50
|
+
if (rowsPerPage * page > totalRecords) {
|
|
51
|
+
return Math.floor(totalRecords / rowsPerPage);
|
|
52
|
+
}
|
|
53
|
+
return page;
|
|
54
|
+
}, [page, rowsPerPage, totalRecords]);
|
|
55
|
+
const handleChangeRowsPerPage = (event) => {
|
|
56
|
+
onRowsPerPageChange(parseInt(event.target.value, 10));
|
|
57
|
+
onPageChange(0);
|
|
58
|
+
};
|
|
59
|
+
const handleChangePage = (_event, newPage) => {
|
|
60
|
+
onPageChange(newPage);
|
|
61
|
+
};
|
|
62
|
+
if (isSkeleton) {
|
|
63
|
+
return /* @__PURE__ */ jsxs(SKTWrapperPagerActions, {
|
|
64
|
+
children: [/* @__PURE__ */ jsxs(SKTWrapperRowsPerPage, {
|
|
65
|
+
children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
66
|
+
variant: "text",
|
|
67
|
+
width: "40px",
|
|
68
|
+
height: "16px"
|
|
69
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
70
|
+
variant: "text",
|
|
71
|
+
width: "20px",
|
|
72
|
+
height: "16px"
|
|
73
|
+
})]
|
|
74
|
+
}), /* @__PURE__ */ jsx(Skeleton, {
|
|
75
|
+
variant: "text",
|
|
76
|
+
width: "50px",
|
|
77
|
+
height: "16px"
|
|
78
|
+
}), /* @__PURE__ */ jsxs(SKTSvgIconButtonContainer, {
|
|
79
|
+
children: [/* @__PURE__ */ jsx(SKTSvgIconButton, {
|
|
80
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
81
|
+
variant: "circular",
|
|
82
|
+
width: 20,
|
|
83
|
+
height: 20
|
|
84
|
+
})
|
|
85
|
+
}), /* @__PURE__ */ jsx(SKTSvgIconButton, {
|
|
86
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
87
|
+
variant: "circular",
|
|
88
|
+
width: 20,
|
|
89
|
+
height: 20
|
|
90
|
+
})
|
|
91
|
+
}), /* @__PURE__ */ jsx(SKTSvgIconButton, {
|
|
92
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
93
|
+
variant: "circular",
|
|
94
|
+
width: 20,
|
|
95
|
+
height: 20
|
|
96
|
+
})
|
|
97
|
+
}), /* @__PURE__ */ jsx(SKTSvgIconButton, {
|
|
98
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
99
|
+
variant: "circular",
|
|
100
|
+
width: 20,
|
|
101
|
+
height: 20
|
|
102
|
+
})
|
|
103
|
+
})]
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return /* @__PURE__ */ jsx(TablePagination, {
|
|
108
|
+
id: "TablePagination",
|
|
109
|
+
rowsPerPageOptions,
|
|
110
|
+
component: "div",
|
|
111
|
+
count: totalRecords,
|
|
112
|
+
rowsPerPage,
|
|
113
|
+
page: currentPage,
|
|
114
|
+
onPageChange: handleChangePage,
|
|
115
|
+
onRowsPerPageChange: handleChangeRowsPerPage,
|
|
116
|
+
labelDisplayedRows: isDesktop ? ({
|
|
117
|
+
from,
|
|
118
|
+
to,
|
|
119
|
+
count
|
|
120
|
+
}) => `${from}-${to} ${labelOf} ${count}` : () => ``,
|
|
121
|
+
labelRowsPerPage: isDesktop ? labelRows : "",
|
|
122
|
+
ActionsComponent: PagerActions
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function getPagerComponentsDictionary() {
|
|
126
|
+
return ["pager"];
|
|
127
|
+
}
|
|
128
|
+
const defaultPagerDictionary = {
|
|
129
|
+
pager: {
|
|
130
|
+
first: "First",
|
|
131
|
+
previous: "Previous",
|
|
132
|
+
before: "Before",
|
|
133
|
+
last: "Last",
|
|
134
|
+
of: "of"
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
export {
|
|
138
|
+
Pager as P,
|
|
139
|
+
defaultPagerDictionary as d,
|
|
140
|
+
getPagerComponentsDictionary as g
|
|
141
|
+
};
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
import { Popover as Popover$1, styled as styled$1, Stack, MenuItem } from "@mui/material";
|
|
3
|
+
import { I as Image } from "../../Image/index.93d5f37f.js";
|
|
4
|
+
import { useLocales } from "@m4l/graphics";
|
|
5
|
+
import { useEnvironment, useNetwork } from "@m4l/core";
|
|
6
|
+
import "../../Icon/index.619c31c4.js";
|
|
7
|
+
import { styled } from "@mui/material/styles";
|
|
8
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
9
|
+
import "../Accordion/index.a02ac6ae.js";
|
|
10
|
+
import "../Avatar/index.fe06afd7.js";
|
|
11
|
+
import "react-router-dom";
|
|
12
|
+
import "@mui/material/Button";
|
|
13
|
+
import { C as CircularProgress } from "../CircularProgress/index.ad569afd.js";
|
|
14
|
+
import "@mui/lab";
|
|
15
|
+
import { I as ImageButton } from "../Button/index.53b56958.js";
|
|
16
|
+
import "../../CommonActions/components/Actions/index.0645e30f.js";
|
|
17
|
+
import "../Pager/index.c0865b70.js";
|
|
18
|
+
import "../Tab/index.e0653a0a.js";
|
|
19
|
+
const ArrowStyle = styled("span")(({
|
|
20
|
+
arrowType,
|
|
21
|
+
theme
|
|
22
|
+
}) => {
|
|
23
|
+
const SIZE = 12;
|
|
24
|
+
const POSITION = -(SIZE / 2);
|
|
25
|
+
const borderStyle = `solid 1px ${theme.palette.grey[50012]}`;
|
|
26
|
+
const topStyle = {
|
|
27
|
+
borderRadius: "0 0 3px 0",
|
|
28
|
+
top: POSITION,
|
|
29
|
+
borderBottom: borderStyle,
|
|
30
|
+
borderRight: borderStyle
|
|
31
|
+
};
|
|
32
|
+
const bottomStyle = {
|
|
33
|
+
borderRadius: "3px 0 0 0",
|
|
34
|
+
bottom: POSITION,
|
|
35
|
+
borderTop: borderStyle,
|
|
36
|
+
borderLeft: borderStyle
|
|
37
|
+
};
|
|
38
|
+
const leftStyle = {
|
|
39
|
+
borderRadius: "0 3px 0 0",
|
|
40
|
+
left: POSITION,
|
|
41
|
+
borderTop: borderStyle,
|
|
42
|
+
borderRight: borderStyle
|
|
43
|
+
};
|
|
44
|
+
const rightStyle = {
|
|
45
|
+
borderRadius: "0 0 0 3px",
|
|
46
|
+
right: POSITION,
|
|
47
|
+
borderBottom: borderStyle,
|
|
48
|
+
borderLeft: borderStyle
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
display: "none",
|
|
52
|
+
[theme.breakpoints.up("sm")]: {
|
|
53
|
+
zIndex: 1,
|
|
54
|
+
width: SIZE,
|
|
55
|
+
height: SIZE,
|
|
56
|
+
content: "''",
|
|
57
|
+
position: "absolute",
|
|
58
|
+
display: "block",
|
|
59
|
+
transform: "rotate(-135deg)",
|
|
60
|
+
background: theme.palette.background.paper
|
|
61
|
+
},
|
|
62
|
+
...arrowType === "top-left" && {
|
|
63
|
+
...topStyle,
|
|
64
|
+
left: 20
|
|
65
|
+
},
|
|
66
|
+
...arrowType === "top-center" && {
|
|
67
|
+
...topStyle,
|
|
68
|
+
left: 0,
|
|
69
|
+
right: 0,
|
|
70
|
+
margin: "auto"
|
|
71
|
+
},
|
|
72
|
+
...arrowType === "top-right" && {
|
|
73
|
+
...topStyle,
|
|
74
|
+
right: 20
|
|
75
|
+
},
|
|
76
|
+
...arrowType === "bottom-left" && {
|
|
77
|
+
...bottomStyle,
|
|
78
|
+
left: 20
|
|
79
|
+
},
|
|
80
|
+
...arrowType === "bottom-center" && {
|
|
81
|
+
...bottomStyle,
|
|
82
|
+
left: 0,
|
|
83
|
+
right: 0,
|
|
84
|
+
margin: "auto"
|
|
85
|
+
},
|
|
86
|
+
...arrowType === "bottom-right" && {
|
|
87
|
+
...bottomStyle,
|
|
88
|
+
right: 20
|
|
89
|
+
},
|
|
90
|
+
...arrowType === "left-top" && {
|
|
91
|
+
...leftStyle,
|
|
92
|
+
top: 20
|
|
93
|
+
},
|
|
94
|
+
...arrowType === "left-center" && {
|
|
95
|
+
...leftStyle,
|
|
96
|
+
top: 0,
|
|
97
|
+
bottom: 0,
|
|
98
|
+
margin: "auto"
|
|
99
|
+
},
|
|
100
|
+
...arrowType === "left-bottom" && {
|
|
101
|
+
...leftStyle,
|
|
102
|
+
bottom: 20
|
|
103
|
+
},
|
|
104
|
+
...arrowType === "right-top" && {
|
|
105
|
+
...rightStyle,
|
|
106
|
+
top: 20
|
|
107
|
+
},
|
|
108
|
+
...arrowType === "right-center" && {
|
|
109
|
+
...rightStyle,
|
|
110
|
+
top: 0,
|
|
111
|
+
bottom: 0,
|
|
112
|
+
margin: "auto"
|
|
113
|
+
},
|
|
114
|
+
...arrowType === "right-bottom" && {
|
|
115
|
+
...rightStyle,
|
|
116
|
+
bottom: 20
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
function Popover({
|
|
121
|
+
children,
|
|
122
|
+
arrowType = "top-right",
|
|
123
|
+
sx,
|
|
124
|
+
className,
|
|
125
|
+
...other
|
|
126
|
+
}) {
|
|
127
|
+
return /* @__PURE__ */ jsxs(Popover$1, {
|
|
128
|
+
className: `m4l_popover ${className ? className : ""}`,
|
|
129
|
+
anchorOrigin: {
|
|
130
|
+
vertical: "bottom",
|
|
131
|
+
horizontal: "right"
|
|
132
|
+
},
|
|
133
|
+
transformOrigin: {
|
|
134
|
+
vertical: "top",
|
|
135
|
+
horizontal: "right"
|
|
136
|
+
},
|
|
137
|
+
PaperProps: {
|
|
138
|
+
sx: {
|
|
139
|
+
p: 1,
|
|
140
|
+
overflow: "inherit",
|
|
141
|
+
...sx
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
...other,
|
|
145
|
+
children: [arrowType !== "no-arrow" && /* @__PURE__ */ jsx(ArrowStyle, {
|
|
146
|
+
arrowType
|
|
147
|
+
}), children]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
const LabelItem = styled$1("span")(({
|
|
151
|
+
theme
|
|
152
|
+
}) => ({
|
|
153
|
+
marginLeft: theme.spacing(1)
|
|
154
|
+
}));
|
|
155
|
+
const ContainerProgress = styled$1("div")(({
|
|
156
|
+
theme
|
|
157
|
+
}) => ({
|
|
158
|
+
padding: theme.spacing(0.75, 0),
|
|
159
|
+
margin: theme.spacing(0, 1.25)
|
|
160
|
+
}));
|
|
161
|
+
const ContainerMenuItems = styled$1("div")(() => ({
|
|
162
|
+
display: "flex",
|
|
163
|
+
flexDirection: "column"
|
|
164
|
+
}));
|
|
165
|
+
function LanguagePopover() {
|
|
166
|
+
const {
|
|
167
|
+
currentLocale,
|
|
168
|
+
onChangeLocale
|
|
169
|
+
} = useLocales();
|
|
170
|
+
const {
|
|
171
|
+
domain_token
|
|
172
|
+
} = useEnvironment();
|
|
173
|
+
const {
|
|
174
|
+
networkOperation
|
|
175
|
+
} = useNetwork();
|
|
176
|
+
const [open, setOpen] = useState(null);
|
|
177
|
+
const [loading, setLoading] = useState(false);
|
|
178
|
+
const [allLocales, setAllLocales] = useState([]);
|
|
179
|
+
const handleOpen = (event) => {
|
|
180
|
+
console.log("handleOpen", allLocales, loading);
|
|
181
|
+
setOpen(event.currentTarget);
|
|
182
|
+
};
|
|
183
|
+
const handleClose = () => {
|
|
184
|
+
setOpen(null);
|
|
185
|
+
};
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
let mounted = true;
|
|
188
|
+
if (open === null || loading || allLocales.length > 0) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
setLoading(true);
|
|
192
|
+
networkOperation({
|
|
193
|
+
method: "GET",
|
|
194
|
+
endPoint: `na/locales`,
|
|
195
|
+
parms: {
|
|
196
|
+
domain_token
|
|
197
|
+
}
|
|
198
|
+
}).then((response) => {
|
|
199
|
+
console.log("Response", response.data);
|
|
200
|
+
if (mounted) {
|
|
201
|
+
setAllLocales(response.data);
|
|
202
|
+
}
|
|
203
|
+
}).finally(() => {
|
|
204
|
+
setLoading(false);
|
|
205
|
+
});
|
|
206
|
+
return function cleanUp() {
|
|
207
|
+
mounted = false;
|
|
208
|
+
};
|
|
209
|
+
}, [open]);
|
|
210
|
+
console.log("Render lang", allLocales, loading);
|
|
211
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
212
|
+
children: [/* @__PURE__ */ jsx(ImageButton, {
|
|
213
|
+
className: "m4l_language_popover",
|
|
214
|
+
onClick: handleOpen,
|
|
215
|
+
sx: {
|
|
216
|
+
width: 40,
|
|
217
|
+
height: 40,
|
|
218
|
+
...open && {
|
|
219
|
+
bgcolor: "action.selected"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
src: currentLocale?.url_icon || "",
|
|
223
|
+
alt: currentLocale?.name,
|
|
224
|
+
width: "24px",
|
|
225
|
+
height: "24px",
|
|
226
|
+
skeletonVariant: "circle",
|
|
227
|
+
tooltip: "dddd"
|
|
228
|
+
}), /* @__PURE__ */ jsx(Popover, {
|
|
229
|
+
arrowType: "top-right",
|
|
230
|
+
open: Boolean(open),
|
|
231
|
+
anchorEl: open,
|
|
232
|
+
anchorOrigin: {
|
|
233
|
+
vertical: "bottom",
|
|
234
|
+
horizontal: "right"
|
|
235
|
+
},
|
|
236
|
+
onClose: handleClose,
|
|
237
|
+
sx: {
|
|
238
|
+
mt: 1.5,
|
|
239
|
+
ml: 0.75,
|
|
240
|
+
width: 180,
|
|
241
|
+
rowGap: "100px",
|
|
242
|
+
"& .MuiMenuItem-root": {
|
|
243
|
+
px: 1,
|
|
244
|
+
typography: "body2",
|
|
245
|
+
borderRadius: 0.75
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
children: /* @__PURE__ */ jsxs(ContainerMenuItems, {
|
|
249
|
+
children: [allLocales.length === 0 && /* @__PURE__ */ jsx(ContainerProgress, {
|
|
250
|
+
children: /* @__PURE__ */ jsx(CircularProgress, {
|
|
251
|
+
size: "20px"
|
|
252
|
+
})
|
|
253
|
+
}), allLocales.length > 0 && /* @__PURE__ */ jsx(Stack, {
|
|
254
|
+
spacing: 0.75,
|
|
255
|
+
children: allLocales.map((option) => /* @__PURE__ */ jsxs(MenuItem, {
|
|
256
|
+
selected: option.lang === currentLocale?.lang && option?.script === currentLocale?.script && option?.region === currentLocale?.region,
|
|
257
|
+
onClick: () => {
|
|
258
|
+
onChangeLocale(option);
|
|
259
|
+
handleClose();
|
|
260
|
+
},
|
|
261
|
+
children: [/* @__PURE__ */ jsx(Image, {
|
|
262
|
+
alt: option.name,
|
|
263
|
+
src: option.url_icon,
|
|
264
|
+
width: "24px",
|
|
265
|
+
height: "24px"
|
|
266
|
+
}), /* @__PURE__ */ jsx(LabelItem, {
|
|
267
|
+
children: option.name
|
|
268
|
+
})]
|
|
269
|
+
}, option.lang || option.script || option.region))
|
|
270
|
+
})]
|
|
271
|
+
})
|
|
272
|
+
})]
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
export {
|
|
276
|
+
LanguagePopover as L,
|
|
277
|
+
Popover as P
|
|
278
|
+
};
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { useModuleSkeleton
|
|
2
|
-
import { Skeleton
|
|
3
|
-
import { styled
|
|
4
|
-
import { jsx
|
|
5
|
-
const
|
|
6
|
-
theme
|
|
1
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
2
|
+
import { Skeleton, Tab as Tab$1 } from "@mui/material";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
const SKTTabWrapper = styled("div")(({
|
|
6
|
+
theme
|
|
7
7
|
}) => ({
|
|
8
|
-
padding:
|
|
8
|
+
padding: theme.spacing(1.5, 2)
|
|
9
9
|
}));
|
|
10
|
-
function
|
|
10
|
+
function Tab(props) {
|
|
11
11
|
const {
|
|
12
|
-
SKTWidth
|
|
13
|
-
SKTHeight
|
|
14
|
-
...
|
|
15
|
-
} =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
SKTWidth,
|
|
13
|
+
SKTHeight,
|
|
14
|
+
...other
|
|
15
|
+
} = props;
|
|
16
|
+
const isSkeleton = useModuleSkeleton();
|
|
17
|
+
if (isSkeleton) {
|
|
18
|
+
return /* @__PURE__ */ jsx(SKTTabWrapper, {
|
|
19
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
20
|
+
variant: "text",
|
|
21
|
+
width: SKTWidth,
|
|
22
|
+
height: SKTHeight
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsx(Tab$1, {
|
|
27
|
+
...other
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
export {
|
|
27
|
-
|
|
31
|
+
Tab as T
|
|
28
32
|
};
|
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import { useModuleSkeleton
|
|
2
|
-
import { Skeleton
|
|
3
|
-
import { jsx
|
|
4
|
-
const
|
|
1
|
+
import { useModuleSkeleton } from "@m4l/core";
|
|
2
|
+
import { Skeleton, Typography as Typography$1 } from "@mui/material";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
const SkeletonTypography = (props) => {
|
|
5
5
|
const {
|
|
6
|
-
skeletonWidth
|
|
7
|
-
skeletongHeight
|
|
8
|
-
} =
|
|
9
|
-
return /* @__PURE__ */
|
|
6
|
+
skeletonWidth,
|
|
7
|
+
skeletongHeight
|
|
8
|
+
} = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(Skeleton, {
|
|
10
10
|
variant: "text",
|
|
11
|
-
width:
|
|
12
|
-
height:
|
|
11
|
+
width: skeletonWidth,
|
|
12
|
+
height: skeletongHeight
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function Typography(props) {
|
|
16
16
|
const {
|
|
17
|
-
skeletonWidth
|
|
18
|
-
skeletongHeight
|
|
19
|
-
...
|
|
20
|
-
} =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
skeletonWidth = "100%",
|
|
18
|
+
skeletongHeight = "18px",
|
|
19
|
+
...other
|
|
20
|
+
} = props;
|
|
21
|
+
const isSkeleton = useModuleSkeleton();
|
|
22
|
+
if (isSkeleton) {
|
|
23
|
+
return /* @__PURE__ */ jsx(SkeletonTypography, {
|
|
24
|
+
skeletonWidth,
|
|
25
|
+
skeletongHeight
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ jsx(Typography$1, {
|
|
25
29
|
className: "m4l_typography",
|
|
26
|
-
...
|
|
30
|
+
...other
|
|
27
31
|
});
|
|
28
32
|
}
|
|
29
33
|
export {
|
|
30
|
-
|
|
34
|
+
Typography as T
|
|
31
35
|
};
|