@m4l/components 0.1.13 → 0.1.15
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.js +91 -0
- package/commonjs.js +9 -0
- package/components/CommonActions/components/ActionCancel/index.js +15 -0
- package/components/CommonActions/components/ActionFormCancel/index.js +62 -0
- package/components/CommonActions/components/ActionFormIntro/index.js +35 -0
- package/components/CommonActions/components/ActionIntro/index.js +16 -0
- package/components/CommonActions/components/Actions/index.js +859 -0
- package/components/CompanyLogo/{index.f81c179c.js → index.js} +48 -42
- package/components/DataGrid/index.js +1067 -0
- package/components/DynamicFilter/index.js +1573 -0
- package/components/ErrorLabel/index.js +18 -0
- package/components/Icon/index.js +80 -0
- package/components/Image/index.js +128 -0
- package/components/LanguagePopover/index.js +93 -0
- package/components/Loadable/index.js +13 -0
- package/components/ModalDialog/index.js +180 -0
- package/components/NoItemSelected/{index.12f0ca67.js → index.js} +50 -43
- package/components/ObjectLogs/index.js +284 -0
- package/components/Page/index.js +36 -0
- package/components/PaperForm/index.js +110 -0
- package/components/Period/index.js +230 -0
- package/components/PropertyValue/index.js +142 -0
- package/components/Resizeable/{index.45995d2b.js → index.js} +19 -21
- package/components/ScrollBar/index.js +52 -0
- package/components/ScrollToTop/index.js +10 -0
- package/components/SplitLayout/{index.4032673d.js → index.js} +35 -35
- package/components/animate/LoadingScreen/{index.f1cec7db.js → index.js} +27 -29
- package/components/animate/MotionContainer/index.js +31 -0
- package/components/animate/MotionLazyContainer/index.js +13 -0
- package/components/animate/features.js +2 -0
- package/components/animate/variants/{bounce.784aaaaa.js → bounce.js} +16 -15
- package/components/animate/variants/container.js +20 -0
- package/components/animate/variants/fade.js +61 -0
- package/components/animate/variants/{index.7a912140.js → index.js} +0 -0
- package/components/animate/variants/transition.js +16 -0
- package/components/formatters/BooleanFormatter/index.js +52 -0
- package/components/formatters/DateFormatter/index.js +66 -0
- package/components/formatters/index.js +112 -0
- package/components/hook-form/FormProvider/index.js +61 -0
- package/components/hook-form/RHFAutocomplete/index.js +144 -0
- package/components/hook-form/RHFAutocompleteAsync/index.js +191 -0
- package/components/hook-form/RHFCheckbox/index.js +65 -0
- package/components/hook-form/RHFDateTime/index.js +79 -0
- package/components/hook-form/RHFMultiCheckbox/index.js +32 -0
- package/components/hook-form/RHFPeriod/index.js +47 -0
- package/components/hook-form/RHFRadioGroup/index.js +41 -0
- package/components/hook-form/RHFSelect/index.js +34 -0
- package/components/hook-form/RHFTextField/index.js +87 -0
- package/components/hook-form/RHFUpload/index.js +255 -0
- package/components/mui_extended/Accordion/index.js +105 -0
- package/components/mui_extended/Avatar/index.js +33 -0
- package/components/mui_extended/BoxIcon/index.js +20 -0
- package/components/mui_extended/Breadcrumbs/index.js +92 -0
- package/components/mui_extended/Button/index.js +131 -0
- package/components/mui_extended/IconButton/index.js +108 -0
- package/components/mui_extended/LinkWithRoute/index.js +30 -0
- package/components/mui_extended/MenuPopover/index.js +135 -0
- package/components/mui_extended/Pager/index.js +137 -0
- package/components/mui_extended/Tab/index.js +30 -0
- package/components/mui_extended/Typography/index.js +21 -0
- package/contexts/ModalContext/index.js +165 -0
- package/hooks/useFormAddEdit/index.js +42 -0
- package/hooks/useModal/index.js +4 -0
- package/index.js +70 -162
- package/lodash.js +62 -0
- package/node_modules.js +54 -0
- package/package.json +2 -1
- package/react-data-grid.js +2652 -0
- package/react-draggable.js +960 -0
- package/react-json-view.js +2764 -0
- package/react-lazy-load-image-component.js +792 -0
- package/react-resizable.js +541 -0
- package/react-splitter-layout.js +165 -0
- package/utils/index.js +572 -0
- package/assets/Logo/index.228dcb5a.js +0 -86
- package/commonjs.565e6834.js +0 -12
- package/components/CommonActions/components/ActionCancel/index.cba1b460.js +0 -17
- package/components/CommonActions/components/ActionFormCancel/index.be2fe891.js +0 -49
- package/components/CommonActions/components/ActionFormIntro/index.ca4d2674.js +0 -31
- package/components/CommonActions/components/ActionIntro/index.cc4b1e0e.js +0 -18
- package/components/CommonActions/components/Actions/index.e8148d98.js +0 -743
- package/components/DataGrid/index.b688877d.js +0 -894
- package/components/DynamicFilter/index.82ce857e.js +0 -1158
- package/components/ErrorLabel/index.c8615f16.js +0 -19
- package/components/Icon/index.cbca79b0.js +0 -70
- package/components/Image/index.e790b50b.js +0 -122
- package/components/LanguagePopover/index.3d9611cb.js +0 -87
- package/components/Loadable/index.f5518558.js +0 -15
- package/components/ModalDialog/index.3850c053.js +0 -168
- package/components/ObjectLogs/index.27ef875d.js +0 -266
- package/components/Page/index.6d69977e.js +0 -35
- package/components/PaperForm/index.d7c74064.js +0 -105
- package/components/Period/index.5e68286a.js +0 -160
- package/components/PropertyValue/index.ab3dd7e9.js +0 -116
- package/components/ScrollBar/index.39eeb2de.js +0 -49
- package/components/ScrollToTop/index.e06f98f6.js +0 -11
- package/components/animate/MotionContainer/index.8d9f9d80.js +0 -30
- package/components/animate/MotionLazyContainer/index.572dd012.js +0 -15
- package/components/animate/features.0fbf41e1.js +0 -5
- package/components/animate/variants/container.11f82b76.js +0 -20
- package/components/animate/variants/fade.b561c0fc.js +0 -59
- package/components/animate/variants/transition.bd46b9ce.js +0 -15
- package/components/formatters/BooleanFormatter/index.cca53b7f.js +0 -42
- package/components/formatters/DateFormatter/index.ad8d9b8e.js +0 -57
- package/components/formatters/index.55856d65.js +0 -106
- package/components/hook-form/FormProvider/index.257acd9f.js +0 -55
- package/components/hook-form/RHFAutocomplete/index.6ed76d4c.js +0 -122
- package/components/hook-form/RHFAutocompleteAsync/index.8f2c97ea.js +0 -153
- package/components/hook-form/RHFCheckbox/index.f9ce6c39.js +0 -59
- package/components/hook-form/RHFDateTime/index.fc5cbafe.js +0 -68
- package/components/hook-form/RHFMultiCheckbox/index.2680b3b6.js +0 -34
- package/components/hook-form/RHFPeriod/index.23c254e9.js +0 -45
- package/components/hook-form/RHFRadioGroup/index.b3335e13.js +0 -43
- package/components/hook-form/RHFSelect/index.b6ca8bb2.js +0 -36
- package/components/hook-form/RHFTextField/index.4c455f75.js +0 -77
- package/components/hook-form/RHFUpload/index.ed3d739f.js +0 -244
- package/components/mui_extended/Accordion/index.2116e423.js +0 -103
- package/components/mui_extended/Avatar/index.0a2a4523.js +0 -32
- package/components/mui_extended/BoxIcon/index.e638ecc8.js +0 -22
- package/components/mui_extended/Breadcrumbs/index.5e37d903.js +0 -89
- package/components/mui_extended/Button/index.84d8898c.js +0 -110
- package/components/mui_extended/IconButton/index.88f3aadb.js +0 -98
- package/components/mui_extended/LinkWithRoute/index.d4b263de.js +0 -28
- package/components/mui_extended/MenuPopover/index.488fc536.js +0 -131
- package/components/mui_extended/Pager/index.0576814f.js +0 -126
- package/components/mui_extended/Tab/index.e0653a0a.js +0 -28
- package/components/mui_extended/Typography/index.0c4604b3.js +0 -22
- package/contexts/ModalContext/index.2188b69e.js +0 -150
- package/hooks/useFormAddEdit/index.d4845f1a.js +0 -26
- package/hooks/useModal/index.6571d2d9.js +0 -6
- package/lodash.e09401f0.js +0 -32
- package/node_modules.168cb897.js +0 -55
- package/react-data-grid.d46d625e.js +0 -2115
- package/react-draggable.20e95c61.js +0 -714
- package/react-json-view.f56a7f8e.js +0 -2762
- package/react-lazy-load-image-component.45b56650.js +0 -784
- package/react-resizable.5277deaf.js +0 -371
- package/react-splitter-layout.7810ac1b.js +0 -165
- package/utils/index.214d9542.js +0 -435
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { Skeleton, TablePagination } from "@mui/material";
|
|
3
|
+
import { P as PagerActions } from "../../CommonActions/components/Actions/index.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 { Pager as P, defaultPagerDictionary as d, getPagerComponentsDictionary as g };
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}) => ({
|
|
8
|
+
padding: theme.spacing(1.5, 2)
|
|
9
|
+
}));
|
|
10
|
+
function Tab(props) {
|
|
11
|
+
const {
|
|
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
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export { Tab as T };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Skeleton, Typography as Typography$1 } from "@mui/material";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
function Typography(props) {
|
|
4
|
+
const {
|
|
5
|
+
skeletonProps = {},
|
|
6
|
+
...other
|
|
7
|
+
} = props;
|
|
8
|
+
const {
|
|
9
|
+
isSkeleton = "false",
|
|
10
|
+
width = "100%",
|
|
11
|
+
height = "14px"
|
|
12
|
+
} = skeletonProps;
|
|
13
|
+
return isSkeleton ? /* @__PURE__ */ jsx(Skeleton, {
|
|
14
|
+
variant: "text",
|
|
15
|
+
width,
|
|
16
|
+
height
|
|
17
|
+
}) : /* @__PURE__ */ jsx(Typography$1, {
|
|
18
|
+
...other
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { Typography as T };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createContext, useState } from "react";
|
|
2
|
+
import { useEnvironment, voidFunction } from "@m4l/core";
|
|
3
|
+
import { Typography } from "@mui/material";
|
|
4
|
+
import { styled } from "@mui/material/styles";
|
|
5
|
+
import { B as BoxIcon } from "../../components/mui_extended/BoxIcon/index.js";
|
|
6
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
7
|
+
import { M as ModalDialog } from "../../components/ModalDialog/index.js";
|
|
8
|
+
import { A as ActionIntro } from "../../components/CommonActions/components/ActionIntro/index.js";
|
|
9
|
+
import { A as ActionCancel } from "../../components/CommonActions/components/ActionCancel/index.js";
|
|
10
|
+
import { b as getVariantColor } from "../../utils/index.js";
|
|
11
|
+
const WrapperContentConfirm = styled("div")(() => ({
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
height: "100%"
|
|
15
|
+
}));
|
|
16
|
+
const ModalContent = styled("div")(({
|
|
17
|
+
theme
|
|
18
|
+
}) => ({
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
gridGap: theme.spacing(5),
|
|
24
|
+
flexGrow: 1,
|
|
25
|
+
[theme.breakpoints.up("sm")]: {
|
|
26
|
+
display: "grid",
|
|
27
|
+
flexDirection: "row",
|
|
28
|
+
gridTemplateColumns: "1fr 1fr"
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
const IllustrationContainer = styled("div")(({
|
|
32
|
+
theme,
|
|
33
|
+
variant
|
|
34
|
+
}) => ({
|
|
35
|
+
display: "flex",
|
|
36
|
+
justifyContent: "center",
|
|
37
|
+
alignItems: "center",
|
|
38
|
+
"& > span": {
|
|
39
|
+
background: variant === "warning" ? theme.palette.warning.main : variant === "delete" ? theme.palette.error.main : variant === "info" ? theme.palette.info.main : "theme.palette.text.primary"
|
|
40
|
+
}
|
|
41
|
+
}));
|
|
42
|
+
const MessageContainer = styled("div")(() => ({
|
|
43
|
+
display: "flex",
|
|
44
|
+
alignItems: "center"
|
|
45
|
+
}));
|
|
46
|
+
const ContentConfirm = (props) => {
|
|
47
|
+
const {
|
|
48
|
+
variant = "info",
|
|
49
|
+
msg = "Are you sure you want to perform this action? Once complete, the information will be deleted."
|
|
50
|
+
} = props;
|
|
51
|
+
const {
|
|
52
|
+
host_static_assets,
|
|
53
|
+
environment_assets
|
|
54
|
+
} = useEnvironment();
|
|
55
|
+
const illustrationWarning = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_warning.svg`;
|
|
56
|
+
const illustrationError = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_danger.svg`;
|
|
57
|
+
const illustrationInfo = `${host_static_assets}/${environment_assets}/frontend/components/dialog/assets/icons/illustration_confirm_info.svg`;
|
|
58
|
+
return /* @__PURE__ */ jsx(WrapperContentConfirm, {
|
|
59
|
+
children: /* @__PURE__ */ jsxs(ModalContent, {
|
|
60
|
+
children: [/* @__PURE__ */ jsx(IllustrationContainer, {
|
|
61
|
+
variant,
|
|
62
|
+
children: /* @__PURE__ */ jsx(BoxIcon, {
|
|
63
|
+
src: variant === "warning" ? illustrationWarning : variant === "delete" ? illustrationError : illustrationInfo,
|
|
64
|
+
sx: {
|
|
65
|
+
width: "230px",
|
|
66
|
+
height: "194px"
|
|
67
|
+
}
|
|
68
|
+
})
|
|
69
|
+
}), /* @__PURE__ */ jsx(MessageContainer, {
|
|
70
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
71
|
+
variant: "body1",
|
|
72
|
+
children: msg
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const initialState = {
|
|
79
|
+
initialWidth: 600,
|
|
80
|
+
initialHeigth: 400,
|
|
81
|
+
open: false,
|
|
82
|
+
withClose: true,
|
|
83
|
+
onQueryClose: voidFunction,
|
|
84
|
+
iconComponent: void 0,
|
|
85
|
+
contentComponent: void 0,
|
|
86
|
+
openModal: voidFunction,
|
|
87
|
+
openModalConfirm: voidFunction,
|
|
88
|
+
closeModal: voidFunction,
|
|
89
|
+
hasChanges: false,
|
|
90
|
+
setChanges: voidFunction,
|
|
91
|
+
title: ""
|
|
92
|
+
};
|
|
93
|
+
const ModalContext = createContext(initialState);
|
|
94
|
+
function ModalProvider({
|
|
95
|
+
children
|
|
96
|
+
}) {
|
|
97
|
+
const [modalOptions, setModalOptions] = useState({
|
|
98
|
+
open: initialState.open,
|
|
99
|
+
withClose: true,
|
|
100
|
+
onQueryClose: voidFunction,
|
|
101
|
+
title: "",
|
|
102
|
+
iconComponent: void 0,
|
|
103
|
+
contentComponent: void 0,
|
|
104
|
+
variant: void 0
|
|
105
|
+
});
|
|
106
|
+
const [hasChanges, setHasChanges] = useState(false);
|
|
107
|
+
const openModal = (modalOpenProps) => {
|
|
108
|
+
setModalOptions({
|
|
109
|
+
open: true,
|
|
110
|
+
...modalOpenProps
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const openModalConfirm = (modalOpenConfirmProps) => {
|
|
114
|
+
const {
|
|
115
|
+
variant = "warning",
|
|
116
|
+
title,
|
|
117
|
+
msg,
|
|
118
|
+
onClickIntro,
|
|
119
|
+
onClickCancel = closeModal
|
|
120
|
+
} = modalOpenConfirmProps;
|
|
121
|
+
const onClickIntroClose = () => {
|
|
122
|
+
onClickIntro && onClickIntro();
|
|
123
|
+
closeModal();
|
|
124
|
+
};
|
|
125
|
+
setModalOptions({
|
|
126
|
+
open: true,
|
|
127
|
+
title,
|
|
128
|
+
variant,
|
|
129
|
+
contentComponent: /* @__PURE__ */ jsx(ContentConfirm, {
|
|
130
|
+
variant,
|
|
131
|
+
msg
|
|
132
|
+
}),
|
|
133
|
+
actions: /* @__PURE__ */ jsxs(Fragment, {
|
|
134
|
+
children: [/* @__PURE__ */ jsx(ActionCancel, {
|
|
135
|
+
onClick: onClickCancel
|
|
136
|
+
}), " ", /* @__PURE__ */ jsx(ActionIntro, {
|
|
137
|
+
onClick: onClickIntroClose,
|
|
138
|
+
color: getVariantColor(variant)
|
|
139
|
+
})]
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const closeModal = () => {
|
|
144
|
+
setModalOptions((last) => ({
|
|
145
|
+
...last,
|
|
146
|
+
open: false
|
|
147
|
+
}));
|
|
148
|
+
setHasChanges(false);
|
|
149
|
+
};
|
|
150
|
+
const setChanges = () => {
|
|
151
|
+
setHasChanges(true);
|
|
152
|
+
};
|
|
153
|
+
return /* @__PURE__ */ jsxs(ModalContext.Provider, {
|
|
154
|
+
value: {
|
|
155
|
+
...modalOptions,
|
|
156
|
+
openModal,
|
|
157
|
+
openModalConfirm,
|
|
158
|
+
closeModal,
|
|
159
|
+
hasChanges,
|
|
160
|
+
setChanges
|
|
161
|
+
},
|
|
162
|
+
children: [children, /* @__PURE__ */ jsx(ModalDialog, {})]
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
export { ModalContext as M, ModalProvider as a };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { useNetwork, useFlags } from "@m4l/core";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
const useFormAddEdit = (props) => {
|
|
4
|
+
const { initialValues, objectId, endPoint, formatDataEnpoint } = props;
|
|
5
|
+
const [formValues, setFormValues] = useState(initialValues);
|
|
6
|
+
const [statusLoad, setStatusLoad] = useState(
|
|
7
|
+
objectId === void 0 ? "new" : "edit"
|
|
8
|
+
);
|
|
9
|
+
const { networkOperation } = useNetwork();
|
|
10
|
+
const { addFlag } = useFlags();
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
let mounted = true;
|
|
13
|
+
if (statusLoad === "edit") {
|
|
14
|
+
networkOperation({
|
|
15
|
+
method: "GET",
|
|
16
|
+
endPoint: `${endPoint}/${objectId}`
|
|
17
|
+
}).then(
|
|
18
|
+
(response) => {
|
|
19
|
+
if (mounted) {
|
|
20
|
+
if (formatDataEnpoint) {
|
|
21
|
+
setFormValues(formatDataEnpoint(response));
|
|
22
|
+
} else {
|
|
23
|
+
setFormValues(response);
|
|
24
|
+
}
|
|
25
|
+
setStatusLoad("reload_values_provider");
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
() => {
|
|
29
|
+
setStatusLoad("error");
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
} else if (statusLoad === "new" || statusLoad === "reload_values_provider") {
|
|
33
|
+
addFlag("form_loaded");
|
|
34
|
+
setStatusLoad("ready");
|
|
35
|
+
}
|
|
36
|
+
return () => {
|
|
37
|
+
mounted = false;
|
|
38
|
+
};
|
|
39
|
+
}, [statusLoad]);
|
|
40
|
+
return { formValues, statusLoad };
|
|
41
|
+
};
|
|
42
|
+
export { useFormAddEdit as u };
|
package/index.js
CHANGED
|
@@ -1,184 +1,92 @@
|
|
|
1
|
-
|
|
1
|
+
export { I as IconButton, a as IconButtonAnimate } from "./components/mui_extended/IconButton/index.js";
|
|
2
2
|
import "framer-motion";
|
|
3
3
|
import "@mui/material";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
export { L as LoadingScreen } from "./components/animate/LoadingScreen/index.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "react-hook-form";
|
|
8
|
-
|
|
8
|
+
export { F as FormProvider } from "./components/hook-form/FormProvider/index.js";
|
|
9
9
|
import "@m4l/core";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
export { R as RHFAutocomplete } from "./components/hook-form/RHFAutocomplete/index.js";
|
|
11
|
+
export { R as RHFAutocompleteAsync } from "./components/hook-form/RHFAutocompleteAsync/index.js";
|
|
12
|
+
export { R as RHFCheckbox } from "./components/hook-form/RHFCheckbox/index.js";
|
|
13
|
+
export { R as RHFDateTime } from "./components/hook-form/RHFDateTime/index.js";
|
|
14
14
|
import "@mui/x-date-pickers";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export { R as RHFTextField } from "./components/hook-form/RHFTextField/index.js";
|
|
16
|
+
export { R as RHFPeriod } from "./components/hook-form/RHFPeriod/index.js";
|
|
17
|
+
export { E as ErrorLabel } from "./components/ErrorLabel/index.js";
|
|
18
|
+
export { P as Period, g as getPeriodComponetsDictionary } from "./components/Period/index.js";
|
|
19
|
+
export { I as Icon } from "./components/Icon/index.js";
|
|
20
20
|
import "@mui/material/styles";
|
|
21
|
-
|
|
21
|
+
export { b as Actions, M as MenuActions, d as defaultCommonActionsDictionary, g as getCommonActionsDictionary } from "./components/CommonActions/components/Actions/index.js";
|
|
22
22
|
import "@mui/material/Button";
|
|
23
|
-
|
|
23
|
+
export { B as Button, L as LoadingButton } from "./components/mui_extended/Button/index.js";
|
|
24
24
|
import "react-router-dom";
|
|
25
|
-
|
|
25
|
+
export { M as ModalContext, a as ModalProvider } from "./contexts/ModalContext/index.js";
|
|
26
26
|
import "@mui/lab";
|
|
27
|
-
import "./lodash.
|
|
27
|
+
import "./lodash.js";
|
|
28
28
|
import "react-dropzone";
|
|
29
|
-
import "./react-lazy-load-image-component.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
import "./react-lazy-load-image-component.js";
|
|
30
|
+
export { I as Image } from "./components/Image/index.js";
|
|
31
|
+
export { R as RHFUploadImage } from "./components/hook-form/RHFUpload/index.js";
|
|
32
|
+
export { A as Accordion } from "./components/mui_extended/Accordion/index.js";
|
|
33
|
+
export { A as Avatar } from "./components/mui_extended/Avatar/index.js";
|
|
34
|
+
export { M as MenuPopover } from "./components/mui_extended/MenuPopover/index.js";
|
|
35
|
+
export { P as Pager, g as getPagerComponentsDictionary } from "./components/mui_extended/Pager/index.js";
|
|
36
|
+
export { T as Tab } from "./components/mui_extended/Tab/index.js";
|
|
37
37
|
import "@m4l/graphics";
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
export { C as CompanyLogo } from "./components/CompanyLogo/index.js";
|
|
39
|
+
export { D as DataGrid, N as NumberEditor, T as TextEditor, g as getGridComponentsDictionary } from "./components/DataGrid/index.js";
|
|
40
40
|
import "react-dnd";
|
|
41
41
|
import "react-dnd-html5-backend";
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
export { S as ScrollBar } from "./components/ScrollBar/index.js";
|
|
43
|
+
export { D as DynamicFilter, d as defaultDynamicFilterDictionary, g as getDynamicFilterComponentsDictionary } from "./components/DynamicFilter/index.js";
|
|
44
44
|
import "simplebar/dist/simplebar.min.css";
|
|
45
|
-
|
|
46
|
-
import "./react-draggable.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
import "./react-json-view.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
import "./react-splitter-layout.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
import "./node_modules.
|
|
83
|
-
import "./utils/index.
|
|
84
|
-
import "./react-data-grid.
|
|
45
|
+
export { L as LanguagePopover } from "./components/LanguagePopover/index.js";
|
|
46
|
+
import "./react-draggable.js";
|
|
47
|
+
export { M as ModalDialog, d as defaultModalDialogDictionary, g as getModalDialogComponentsDictionary } from "./components/ModalDialog/index.js";
|
|
48
|
+
export { R as Resizeable } from "./components/Resizeable/index.js";
|
|
49
|
+
export { N as NoItemSelected, d as defaultNoItemSelectedDictionary, g as getNoItemSelectedComponentsDictionary } from "./components/NoItemSelected/index.js";
|
|
50
|
+
export { O as ObjectLogs, d as defaultObjectLogDictionary, g as getObjectLogsComponentsDictionary } from "./components/ObjectLogs/index.js";
|
|
51
|
+
import "./react-json-view.js";
|
|
52
|
+
export { P as PaperForm } from "./components/PaperForm/index.js";
|
|
53
|
+
export { P as Page } from "./components/Page/index.js";
|
|
54
|
+
export { P as PropertyValue } from "./components/PropertyValue/index.js";
|
|
55
|
+
import "./react-splitter-layout.js";
|
|
56
|
+
export { S as SplitLayout } from "./components/SplitLayout/index.js";
|
|
57
|
+
export { v as varFade } from "./components/animate/variants/fade.js";
|
|
58
|
+
export { v as varBounce } from "./components/animate/variants/bounce.js";
|
|
59
|
+
export { v as varContainer } from "./components/animate/variants/container.js";
|
|
60
|
+
export { v as varTranEnter, a as varTranExit, b as varTranHover } from "./components/animate/variants/transition.js";
|
|
61
|
+
export { M as MotionContainer } from "./components/animate/MotionContainer/index.js";
|
|
62
|
+
export { M as MotionLazyContainer } from "./components/animate/MotionLazyContainer/index.js";
|
|
63
|
+
export { R as RHFMultiCheckbox } from "./components/hook-form/RHFMultiCheckbox/index.js";
|
|
64
|
+
export { R as RHFSelect } from "./components/hook-form/RHFSelect/index.js";
|
|
65
|
+
export { R as RHFRadioGroup } from "./components/hook-form/RHFRadioGroup/index.js";
|
|
66
|
+
export { B as BoxIcon } from "./components/mui_extended/BoxIcon/index.js";
|
|
67
|
+
export { B as Breadcrumbs } from "./components/mui_extended/Breadcrumbs/index.js";
|
|
68
|
+
export { L as LinkWithRoute } from "./components/mui_extended/LinkWithRoute/index.js";
|
|
69
|
+
export { T as Typography } from "./components/mui_extended/Typography/index.js";
|
|
70
|
+
export { B as BooleanFormatter, c as columnBooleanFormatter } from "./components/formatters/BooleanFormatter/index.js";
|
|
71
|
+
export { D as DateFormatter, c as columnDateFormatter } from "./components/formatters/DateFormatter/index.js";
|
|
72
|
+
export { P as PointsFormatter, a as PriceFormatter, U as UncertaintyFormatter, e as columnNestedValueFormatter, b as columnPointsFormatter, c as columnUncertaintyFormatter, d as defaultFormattersDictionary, g as getFormattersComponentsDictionary } from "./components/formatters/index.js";
|
|
73
|
+
export { A as ActionCancel } from "./components/CommonActions/components/ActionCancel/index.js";
|
|
74
|
+
export { A as ActionIntro } from "./components/CommonActions/components/ActionIntro/index.js";
|
|
75
|
+
export { A as ActionFormCancel } from "./components/CommonActions/components/ActionFormCancel/index.js";
|
|
76
|
+
export { A as ActionFormIntro } from "./components/CommonActions/components/ActionFormIntro/index.js";
|
|
77
|
+
export { L as Loadable } from "./components/Loadable/index.js";
|
|
78
|
+
export { S as ScrollToTop } from "./components/ScrollToTop/index.js";
|
|
79
|
+
export { u as useFormAddEdit } from "./hooks/useFormAddEdit/index.js";
|
|
80
|
+
export { u as useModal } from "./hooks/useModal/index.js";
|
|
81
|
+
export { L as Logo } from "./assets/Logo/index.js";
|
|
82
|
+
import "./node_modules.js";
|
|
83
|
+
import "./utils/index.js";
|
|
84
|
+
import "./react-data-grid.js";
|
|
85
85
|
import "clsx";
|
|
86
|
-
import "./commonjs.
|
|
86
|
+
import "./commonjs.js";
|
|
87
87
|
import "prop-types";
|
|
88
88
|
import "react-dom";
|
|
89
89
|
import "simplebar-react";
|
|
90
90
|
import "yup";
|
|
91
|
-
import "./react-resizable.
|
|
91
|
+
import "./react-resizable.js";
|
|
92
92
|
import "react-helmet-async";
|
|
93
|
-
export {
|
|
94
|
-
Po as Accordion,
|
|
95
|
-
mt as ActionCancel,
|
|
96
|
-
nt as ActionFormCancel,
|
|
97
|
-
ft as ActionFormIntro,
|
|
98
|
-
pt as ActionIntro,
|
|
99
|
-
so as Actions,
|
|
100
|
-
Lo as Avatar,
|
|
101
|
-
qr as BooleanFormatter,
|
|
102
|
-
Or as BoxIcon,
|
|
103
|
-
jr as Breadcrumbs,
|
|
104
|
-
fo as Button,
|
|
105
|
-
Eo as CompanyLogo,
|
|
106
|
-
ho as DataGrid,
|
|
107
|
-
Kr as DateFormatter,
|
|
108
|
-
Vo as DynamicFilter,
|
|
109
|
-
$ as ErrorLabel,
|
|
110
|
-
k as FormProvider,
|
|
111
|
-
eo as Icon,
|
|
112
|
-
N as IconButton,
|
|
113
|
-
h as IconButtonAnimate,
|
|
114
|
-
Do as Image,
|
|
115
|
-
Jo as LanguagePopover,
|
|
116
|
-
Gr as LinkWithRoute,
|
|
117
|
-
lt as Loadable,
|
|
118
|
-
co as LoadingButton,
|
|
119
|
-
U as LoadingScreen,
|
|
120
|
-
At as Logo,
|
|
121
|
-
po as MenuActions,
|
|
122
|
-
vo as MenuPopover,
|
|
123
|
-
go as ModalContext,
|
|
124
|
-
Qo as ModalDialog,
|
|
125
|
-
uo as ModalProvider,
|
|
126
|
-
vr as MotionContainer,
|
|
127
|
-
Br as MotionLazyContainer,
|
|
128
|
-
or as NoItemSelected,
|
|
129
|
-
Oo as NumberEditor,
|
|
130
|
-
er as ObjectLogs,
|
|
131
|
-
xr as Page,
|
|
132
|
-
Bo as Pager,
|
|
133
|
-
ir as PaperForm,
|
|
134
|
-
ro as Period,
|
|
135
|
-
Yr as PointsFormatter,
|
|
136
|
-
Zr as PriceFormatter,
|
|
137
|
-
cr as PropertyValue,
|
|
138
|
-
z as RHFAutocomplete,
|
|
139
|
-
W as RHFAutocompleteAsync,
|
|
140
|
-
w as RHFCheckbox,
|
|
141
|
-
K as RHFDateTime,
|
|
142
|
-
Tr as RHFMultiCheckbox,
|
|
143
|
-
Z as RHFPeriod,
|
|
144
|
-
Nr as RHFRadioGroup,
|
|
145
|
-
Sr as RHFSelect,
|
|
146
|
-
X as RHFTextField,
|
|
147
|
-
Ro as RHFUploadImage,
|
|
148
|
-
_o as Resizeable,
|
|
149
|
-
Go as ScrollBar,
|
|
150
|
-
gt as ScrollToTop,
|
|
151
|
-
dr as SplitLayout,
|
|
152
|
-
Ho as Tab,
|
|
153
|
-
Uo as TextEditor,
|
|
154
|
-
Vr as Typography,
|
|
155
|
-
_r as UncertaintyFormatter,
|
|
156
|
-
wr as columnBooleanFormatter,
|
|
157
|
-
Qr as columnDateFormatter,
|
|
158
|
-
$r as columnNestedValueFormatter,
|
|
159
|
-
ot as columnPointsFormatter,
|
|
160
|
-
rt as columnUncertaintyFormatter,
|
|
161
|
-
io as defaultCommonActionsDictionary,
|
|
162
|
-
Wo as defaultDynamicFilterDictionary,
|
|
163
|
-
tt as defaultFormattersDictionary,
|
|
164
|
-
Xo as defaultModalDialogDictionary,
|
|
165
|
-
rr as defaultNoItemSelectedDictionary,
|
|
166
|
-
mr as defaultObjectLogDictionary,
|
|
167
|
-
no as getCommonActionsDictionary,
|
|
168
|
-
qo as getDynamicFilterComponentsDictionary,
|
|
169
|
-
at as getFormattersComponentsDictionary,
|
|
170
|
-
jo as getGridComponentsDictionary,
|
|
171
|
-
Yo as getModalDialogComponentsDictionary,
|
|
172
|
-
tr as getNoItemSelectedComponentsDictionary,
|
|
173
|
-
sr as getObjectLogsComponentsDictionary,
|
|
174
|
-
Io as getPagerComponentsDictionary,
|
|
175
|
-
to as getPeriodComponetsDictionary,
|
|
176
|
-
Ft as useFormAddEdit,
|
|
177
|
-
yt as useModal,
|
|
178
|
-
Dr as varBounce,
|
|
179
|
-
Rr as varContainer,
|
|
180
|
-
ur as varFade,
|
|
181
|
-
Pr as varTranEnter,
|
|
182
|
-
Cr as varTranExit,
|
|
183
|
-
Lr as varTranHover
|
|
184
|
-
};
|