@m4l/components 1.0.0 → 1.0.2
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/components/AccountPopover/{index.efc74d5c.js → index.ec031003.js} +5 -3
- package/components/AppBar/{index.fc126a22.js → index.1499770b.js} +4 -4
- package/components/DragResizeWindow/{index.46b380e1.js → index.5e316291.js} +3 -3
- package/components/DynamicFilter/{index.d9168c12.js → index.05e15fb8.js} +28 -211
- package/components/FieldLabel/{index.f9cdcc27.js → index.400a46e0.js} +4 -4
- package/components/GridLayout/{index.bb3b7769.js → index.7156fbc9.js} +2 -2
- package/components/GridLayout/subcomponents/Griditem/{index.bb23f651.js → index.8946f18e.js} +4 -4
- package/components/GridLayout/subcomponents/Responsive/{index.b8a2a121.js → index.3c68f0cb.js} +2 -2
- package/components/GridLayout/subcomponents/SizeProvider/{index.094bc6b5.js → index.a5b2190d.js} +1 -1
- package/components/HamburgerMenu/{index.5997af31.js → index.d57bca4c.js} +3 -3
- package/components/HelperText/{index.be949cdf.js → index.651a9b4b.js} +1 -1
- package/components/Icon/index.2e8ec5a1.js +209 -0
- package/components/Image/index.0d32558e.js +168 -0
- package/components/LoadingError/{index.9f00c83c.js → index.d137be81.js} +5 -4
- package/components/MFLoader/{index.402c1acc.js → index.2038aa6c.js} +3 -3
- package/components/ModalDialog/{index.ea9189c3.js → index.85d30f10.js} +4 -4
- package/components/NavLink/{index.4e548cee.js → index.badec599.js} +2 -2
- package/components/NoItemSelected/{index.418c8316.js → index.008154ce.js} +2 -2
- package/components/ObjectLogs/{index.bfa7dad3.js → index.65a6b1bc.js} +8 -7
- package/components/PDFViewer/{index.bb2eca5a.js → index.9677b02a.js} +2 -2
- package/components/Page/index.7482cf60.js +98 -0
- package/components/PaperForm/{index.8121e3da.js → index.e04f9f1f.js} +2 -2
- package/components/Period/{index.5233694b.js → index.3d695534.js} +8 -103
- package/components/PrintingSystem/{index.fb176a93.js → index.89493ad6.js} +15 -14
- package/components/PrintingSystem/subcomponents/BodyNode/{index.c1d61038.js → index.fdd8cebb.js} +1 -1
- package/components/PrintingSystem/subcomponents/ChartNode/{index.18bd9bad.js → index.12293a60.js} +1 -1
- package/components/PrintingSystem/subcomponents/DividerNode/{index.67d9f1b4.js → index.7fdad1df.js} +1 -1
- package/components/PrintingSystem/subcomponents/FooterNode/{index.eaee152a.js → index.fcaf9b2f.js} +1 -1
- package/components/PrintingSystem/subcomponents/GridNode/{index.f5f63a2a.js → index.03148990.js} +1 -1
- package/components/PrintingSystem/subcomponents/HeaderNode/{index.7de4e411.js → index.691b5c38.js} +1 -1
- package/components/PrintingSystem/subcomponents/PaperNode/{index.f9ccf22b.js → index.3699b685.js} +1 -1
- package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.f2f2e903.js → index.bcc87da8.js} +1 -1
- package/components/PrintingSystem/subcomponents/SectionNode/{index.540a4b19.js → index.659f28e5.js} +1 -1
- package/components/PrintingSystem/subcomponents/TextBoxNode/{index.41e7fcb0.js → index.137ebb7a.js} +1 -1
- package/components/PropertyValue/{index.9572c347.js → index.e31d4282.js} +3 -3
- package/components/Resizeable/{index.1f0c1359.js → index.8c72e36a.js} +1 -1
- package/components/ScrollBar/{index.adf0eade.js → index.9bfcc74f.js} +1 -1
- package/components/SideBar/{index.629ba840.js → index.004a2de1.js} +7 -31
- package/components/SplitLayout/{index.74091a81.js → index.aed78a1f.js} +1 -1
- package/components/ToastContainer/{index.f9b507b9.js → index.586b1194.js} +3 -3
- package/components/areas/constants.630a4f42.js +293 -0
- package/components/areas/contexts/AreasContext/{index.bb316000.js → index.81b748ec.js} +4 -4
- package/components/areas/{dictionary.7e74022a.js → dictionary.19b25583.js} +26 -34
- package/components/areas/hooks/useAreas/{index.e24bd74d.js → index.b02d5bdc.js} +1 -1
- package/components/hook-form/HelperError/index.fd10c3ab.js +19 -0
- package/components/hook-form/RHFAutocompleteAsync/index.ea3ba7a7.js +160 -0
- package/components/hook-form/RHFCheckbox/index.9ac452cc.js +143 -0
- package/components/hook-form/RHFColorPicker/index.25e4e643.js +191 -0
- package/components/hook-form/RHFDateTime/index.31a0537d.js +190 -0
- package/components/hook-form/RHFMultiCheckbox/index.437e6ba3.js +34 -0
- package/components/hook-form/RHFPeriod/index.c8868100.js +105 -0
- package/components/hook-form/RHFRadioGroup/index.11c0add8.js +35 -0
- package/components/hook-form/RHFSelect/index.c6c60ecc.js +29 -0
- package/components/hook-form/RHFTextField/index.2ae1f130.js +326 -0
- package/components/{Image/index.36a3d440.js → hook-form/RHFUpload/index.9eeaee0f.js} +32 -232
- package/components/maps/components/GpsTools/index.ef751d28.js +251 -0
- package/components/maps/{index.8ec46ce4.js → index.ba1ccfad.js} +21 -555
- package/components/modal/{WindowBase.a3ac7adc.js → WindowBase.c1e879e4.js} +4 -3
- package/components/modal/{WindowConfirm.e35da619.js → WindowConfirm.1a123368.js} +6 -6
- package/components/modal/{index.a0e30c8b.js → index.7ca17f55.js} +1 -1
- package/components/mui_extended/Accordion/index.391679d1.js +143 -0
- package/components/mui_extended/Avatar/index.3ba36655.js +63 -0
- package/components/mui_extended/Badge/index.3465d7fb.js +31 -0
- package/components/mui_extended/BoxIcon/index.d61e7ac5.js +22 -0
- package/components/mui_extended/Breadcrumbs/index.4a44883c.js +87 -0
- package/components/mui_extended/Button/index.a7dc6ef0.js +289 -0
- package/components/mui_extended/CheckBox/index.c5c8721c.js +76 -0
- package/components/mui_extended/CircularProgress/index.967e70b7.js +8 -0
- package/components/mui_extended/IconButton/index.87f4726c.js +120 -0
- package/components/{LinearProgressIndeterminate/index.de9d447c.js → mui_extended/LinearProgress/index.52edc848.js} +11 -4
- package/components/mui_extended/LinkWithRoute/index.288c51f3.js +15 -0
- package/components/{Page/index.fdf04592.js → mui_extended/Pager/index.46aec921.js} +9 -98
- package/components/mui_extended/Popover/index.8e5ac765.js +1041 -0
- package/components/mui_extended/Stack/index.fe363ca5.js +31 -0
- package/components/{maps/components/GpsTools/index.75880ce0.js → mui_extended/Tab/index.ad88441e.js} +674 -239
- package/components/mui_extended/ToggleButton/index.38ca2330.js +18 -0
- package/components/mui_extended/ToggleIconButton/index.7fbece74.js +24 -0
- package/components/mui_extended/Tooltip/index.49bb5ee1.js +40 -0
- package/components/mui_extended/Typography/index.2a1c68f8.js +55 -0
- package/components/popups/PopupsProvider/{index.18669fb4.js → index.3b43e55f.js} +1 -1
- package/components/popups/PopupsViewer/{index.ba354267.js → index.fb3f0c48.js} +5 -4
- package/contexts/ModalContext/{index.cf02e6bd.js → index.82f61407.js} +1 -1
- package/contexts/RHFormContext/{index.dc955a09.js → index.e942a298.js} +1 -1
- package/hooks/useFormAddEdit/{index.f156a2cd.js → index.fa430551.js} +2 -2
- package/hooks/useModal/{index.ef54bcf2.js → index.9fe41bde.js} +3 -3
- package/index.js +266 -239
- package/package.json +1 -1
- package/{react-draggable.5331add7.js → react-draggable.2df3b71a.js} +1 -1
- package/{react-resizable.37bfb965.js → react-resizable.c60f3843.js} +2 -2
- package/utils/{index.9ee4c99a.js → index.0660ee9c.js} +9 -62
- package/{vendor.a1ce6777.js → vendor.3eadfa16.js} +746 -3011
- package/components/Icon/index.d5fed418.js +0 -420
- package/components/LanguagePopover/index.e6fa2336.js +0 -184
- package/components/areas/constants.5387d83e.js +0 -412
- package/hooks/useTab/index.bce8b99e.js +0 -12
|
@@ -1,182 +1,30 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { generateUtilityClasses, generateUtilityClass, IconButton, Tooltip, Skeleton, styled as styled$1 } from "@mui/material";
|
|
4
|
-
import { styled } from "@mui/material/styles";
|
|
5
|
-
import { unstable_composeClasses } from "@mui/base";
|
|
6
|
-
import { v as IMAGE_PREFIX, T as TEST_PROP_ID, w as componentName$1, x as IMAGEBUTTON_PREFIX, y as ICON_PREFIX, z as componentName$2 } from "../areas/constants.5387d83e.js";
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
7
3
|
import { useFormContext, Controller } from "react-hook-form";
|
|
8
4
|
import isString from "lodash/isString";
|
|
9
5
|
import { useDropzone } from "react-dropzone";
|
|
10
|
-
import
|
|
11
|
-
import { useEnvironment, useModuleDictionary, useModuleSkeleton
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
const ratioOptions = {
|
|
20
|
-
"1.168:1": {
|
|
21
|
-
width: 1.168,
|
|
22
|
-
height: 1
|
|
23
|
-
},
|
|
24
|
-
"16:9": {
|
|
25
|
-
width: 16,
|
|
26
|
-
height: 9
|
|
27
|
-
},
|
|
28
|
-
"1:1": {
|
|
29
|
-
width: 1,
|
|
30
|
-
height: 1
|
|
31
|
-
},
|
|
32
|
-
"1:1.168": {
|
|
33
|
-
width: 1,
|
|
34
|
-
height: 1.168
|
|
35
|
-
},
|
|
36
|
-
"2:1": {
|
|
37
|
-
width: 2,
|
|
38
|
-
height: 1
|
|
39
|
-
},
|
|
40
|
-
"2:3": {
|
|
41
|
-
width: 2,
|
|
42
|
-
height: 3
|
|
43
|
-
},
|
|
44
|
-
"3:1": {
|
|
45
|
-
width: 3,
|
|
46
|
-
height: 1
|
|
47
|
-
},
|
|
48
|
-
"3:2": {
|
|
49
|
-
width: 3,
|
|
50
|
-
height: 2
|
|
51
|
-
},
|
|
52
|
-
"3:4": {
|
|
53
|
-
width: 3,
|
|
54
|
-
height: 4
|
|
55
|
-
},
|
|
56
|
-
"4:3": {
|
|
57
|
-
width: 4,
|
|
58
|
-
height: 3
|
|
59
|
-
},
|
|
60
|
-
"5:2": {
|
|
61
|
-
width: 5,
|
|
62
|
-
height: 2
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
const getRatioValues = (ratio) => {
|
|
66
|
-
const numType = ratioOptions[ratio];
|
|
67
|
-
const numRef = numType.width / numType.height;
|
|
68
|
-
if (numRef >= 1) {
|
|
69
|
-
return {
|
|
70
|
-
width: "100%",
|
|
71
|
-
height: `${Math.trunc(numRef * 100)}%`
|
|
72
|
-
};
|
|
73
|
-
} else {
|
|
74
|
-
return {
|
|
75
|
-
width: `${Math.trunc(numRef * 100)}%`,
|
|
76
|
-
height: "100%"
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const getNameDataTestId$1 = (KEY) => {
|
|
81
|
-
return `${IMAGE_PREFIX}-${KEY}`;
|
|
82
|
-
};
|
|
83
|
-
const componentName = "M4LImage";
|
|
84
|
-
generateUtilityClasses(componentName, [
|
|
85
|
-
"root",
|
|
86
|
-
"img"
|
|
87
|
-
]);
|
|
88
|
-
function getImagenClassesUtilityClass(slot) {
|
|
89
|
-
return generateUtilityClass(componentName, slot);
|
|
90
|
-
}
|
|
91
|
-
const useUtilityClasses$1 = () => {
|
|
92
|
-
const slots = {
|
|
93
|
-
root: ["root"],
|
|
94
|
-
img: ["img"]
|
|
95
|
-
};
|
|
96
|
-
const composedClasses = unstable_composeClasses(slots, getImagenClassesUtilityClass, {});
|
|
97
|
-
return {
|
|
98
|
-
...composedClasses
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
function Image(props) {
|
|
102
|
-
const { src, alt, width, height, ratio = "1:1", className } = props;
|
|
103
|
-
const ratioImage = getRatioValues(ratio);
|
|
104
|
-
const classes2 = useUtilityClasses$1();
|
|
105
|
-
return /* @__PURE__ */ jsx(
|
|
106
|
-
ImageRoot,
|
|
107
|
-
{
|
|
108
|
-
className: clsx(classes2.root, className),
|
|
109
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId$1("root") } : {},
|
|
110
|
-
style: width && height ? { minWidth: width, minHeight: height, width, height } : { width: "100%", height: "100%" },
|
|
111
|
-
children: /* @__PURE__ */ jsx(
|
|
112
|
-
"img",
|
|
113
|
-
{
|
|
114
|
-
alt,
|
|
115
|
-
src,
|
|
116
|
-
className: classes2.img,
|
|
117
|
-
width: !width ? "100%" : ratioImage.width,
|
|
118
|
-
height: !height ? "100%" : ratioImage.height,
|
|
119
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId$1("img") } : {}
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
const WrapperImageButton = styled("div")(({ theme }) => ({
|
|
126
|
-
...theme.components?.M4LImageButton?.styleOverrides
|
|
127
|
-
}));
|
|
128
|
-
generateUtilityClasses(componentName$1, [
|
|
129
|
-
"root"
|
|
130
|
-
]);
|
|
131
|
-
function getImageButtonUtilityClass(slot) {
|
|
132
|
-
return generateUtilityClass(componentName$1, slot);
|
|
133
|
-
}
|
|
134
|
-
const useUtilityClasses = () => {
|
|
135
|
-
const slots = {
|
|
136
|
-
root: ["root"]
|
|
137
|
-
};
|
|
138
|
-
const composedClasses = unstable_composeClasses(slots, getImageButtonUtilityClass, {});
|
|
139
|
-
return {
|
|
140
|
-
...composedClasses
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
const getNameDataTestId = (KEY) => {
|
|
144
|
-
return `${IMAGEBUTTON_PREFIX}-${KEY}`;
|
|
145
|
-
};
|
|
146
|
-
function ImageButton({
|
|
147
|
-
src,
|
|
148
|
-
width,
|
|
149
|
-
height,
|
|
150
|
-
tooltip,
|
|
151
|
-
sx = { width, height },
|
|
152
|
-
...other
|
|
153
|
-
}) {
|
|
154
|
-
const finalTooltip = tooltip;
|
|
155
|
-
const classes2 = useUtilityClasses();
|
|
156
|
-
const imageButton = useMemo(() => {
|
|
157
|
-
return /* @__PURE__ */ jsx(IconButton, { sx, ...other, children: /* @__PURE__ */ jsx(Image, { src }) });
|
|
158
|
-
}, [src, width, height, sx]);
|
|
159
|
-
return /* @__PURE__ */ jsx(
|
|
160
|
-
WrapperImageButton,
|
|
161
|
-
{
|
|
162
|
-
className: classes2.root,
|
|
163
|
-
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameDataTestId("root") } : {},
|
|
164
|
-
children: finalTooltip ? /* @__PURE__ */ jsx(Tooltip, { title: finalTooltip || "", children: imageButton }) : imageButton
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
}
|
|
6
|
+
import { I as Image } from "../../Image/index.0d32558e.js";
|
|
7
|
+
import { useEnvironment, useModuleDictionary, useModuleSkeleton } from "@m4l/core";
|
|
8
|
+
import { styled } from "@mui/material/styles";
|
|
9
|
+
import { Skeleton, generateUtilityClasses, generateUtilityClass, styled as styled$1 } from "@mui/material";
|
|
10
|
+
import { T as TEST_PROP_ID } from "../../areas/constants.630a4f42.js";
|
|
11
|
+
import { unstable_composeClasses } from "@mui/base";
|
|
12
|
+
import { T as Typography } from "../../mui_extended/Typography/index.2a1c68f8.js";
|
|
13
|
+
import { B as Button } from "../../mui_extended/Button/index.a7dc6ef0.js";
|
|
14
|
+
import { H as HelperText } from "../../HelperText/index.651a9b4b.js";
|
|
168
15
|
const UploadImageRoot = styled("div")(({ theme }) => ({
|
|
169
16
|
...theme.components?.M4LRHFUploadImage?.styleOverrides
|
|
170
17
|
}));
|
|
18
|
+
const ICON_PREFIX = "M4LRHFUploadImage";
|
|
171
19
|
const getNameRHFUploadImageDataTestId = (KEY) => {
|
|
172
20
|
return `${ICON_PREFIX}-${KEY}`;
|
|
173
21
|
};
|
|
174
22
|
const SkeletonUploadImage = (props) => {
|
|
175
|
-
const { classes
|
|
23
|
+
const { classes } = props;
|
|
176
24
|
return /* @__PURE__ */ jsxs(
|
|
177
25
|
"div",
|
|
178
26
|
{
|
|
179
|
-
className:
|
|
27
|
+
className: classes,
|
|
180
28
|
...process.env.NODE_ENV !== "production" ? {
|
|
181
29
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("skeleton")
|
|
182
30
|
} : {},
|
|
@@ -187,8 +35,9 @@ const SkeletonUploadImage = (props) => {
|
|
|
187
35
|
}
|
|
188
36
|
);
|
|
189
37
|
};
|
|
38
|
+
const componentName = "M4LRHFUploadImage";
|
|
190
39
|
generateUtilityClasses(
|
|
191
|
-
componentName
|
|
40
|
+
componentName,
|
|
192
41
|
[
|
|
193
42
|
"root",
|
|
194
43
|
"dropZoneStyle",
|
|
@@ -208,7 +57,7 @@ generateUtilityClasses(
|
|
|
208
57
|
]
|
|
209
58
|
);
|
|
210
59
|
function getRHFUploadImagebUtilityClass(slot) {
|
|
211
|
-
return generateUtilityClass(componentName
|
|
60
|
+
return generateUtilityClass(componentName, slot);
|
|
212
61
|
}
|
|
213
62
|
const RHFUploadImageUtilityClasses = (ownerState) => {
|
|
214
63
|
const slots = {
|
|
@@ -249,25 +98,25 @@ function UploadImage({ error, file, helperText, sx, ...other }) {
|
|
|
249
98
|
isDragActive,
|
|
250
99
|
hasFile: file
|
|
251
100
|
};
|
|
252
|
-
const
|
|
101
|
+
const classes = RHFUploadImageUtilityClasses(ownerSate);
|
|
253
102
|
return /* @__PURE__ */ jsx(
|
|
254
103
|
UploadImageRoot,
|
|
255
104
|
{
|
|
256
|
-
className:
|
|
105
|
+
className: classes.root,
|
|
257
106
|
...process.env.NODE_ENV !== "production" ? { [TEST_PROP_ID]: getNameRHFUploadImageDataTestId("root") } : {},
|
|
258
107
|
children: !isSkeleton ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
259
108
|
"est\xE1 sin skeleton",
|
|
260
109
|
/* @__PURE__ */ jsx(
|
|
261
110
|
"div",
|
|
262
111
|
{
|
|
263
|
-
className:
|
|
112
|
+
className: classes.containerUploadImage,
|
|
264
113
|
...process.env.NODE_ENV !== "production" ? {
|
|
265
114
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("containerUploadImage")
|
|
266
115
|
} : {},
|
|
267
116
|
children: /* @__PURE__ */ jsxs(
|
|
268
117
|
"div",
|
|
269
118
|
{
|
|
270
|
-
className:
|
|
119
|
+
className: classes.dropZoneStyle,
|
|
271
120
|
...getRootProps(),
|
|
272
121
|
...process.env.NODE_ENV !== "production" ? {
|
|
273
122
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("dropZoneStyle")
|
|
@@ -277,7 +126,7 @@ function UploadImage({ error, file, helperText, sx, ...other }) {
|
|
|
277
126
|
"input",
|
|
278
127
|
{
|
|
279
128
|
...getInputProps(),
|
|
280
|
-
className:
|
|
129
|
+
className: classes.inputDropZone,
|
|
281
130
|
...process.env.NODE_ENV !== "production" ? {
|
|
282
131
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("inputDropZone")
|
|
283
132
|
} : {}
|
|
@@ -286,7 +135,7 @@ function UploadImage({ error, file, helperText, sx, ...other }) {
|
|
|
286
135
|
file && /* @__PURE__ */ jsx(
|
|
287
136
|
"div",
|
|
288
137
|
{
|
|
289
|
-
className:
|
|
138
|
+
className: classes.containerFileImage,
|
|
290
139
|
...process.env.NODE_ENV !== "production" ? {
|
|
291
140
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("containerFileImage")
|
|
292
141
|
} : {},
|
|
@@ -303,14 +152,14 @@ function UploadImage({ error, file, helperText, sx, ...other }) {
|
|
|
303
152
|
/* @__PURE__ */ jsx(
|
|
304
153
|
"div",
|
|
305
154
|
{
|
|
306
|
-
className:
|
|
155
|
+
className: classes.placeHolder,
|
|
307
156
|
...process.env.NODE_ENV !== "production" ? {
|
|
308
157
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("placeHolder")
|
|
309
158
|
} : {},
|
|
310
159
|
children: /* @__PURE__ */ jsxs(
|
|
311
160
|
"div",
|
|
312
161
|
{
|
|
313
|
-
className:
|
|
162
|
+
className: classes.containerUploadBoddy,
|
|
314
163
|
...process.env.NODE_ENV !== "production" ? {
|
|
315
164
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("containerUploadBoddy")
|
|
316
165
|
} : {},
|
|
@@ -318,7 +167,7 @@ function UploadImage({ error, file, helperText, sx, ...other }) {
|
|
|
318
167
|
/* @__PURE__ */ jsx(
|
|
319
168
|
"div",
|
|
320
169
|
{
|
|
321
|
-
className:
|
|
170
|
+
className: classes.containerBodyImage,
|
|
322
171
|
...process.env.NODE_ENV !== "production" ? {
|
|
323
172
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("containerBodyImage")
|
|
324
173
|
} : {},
|
|
@@ -334,7 +183,7 @@ function UploadImage({ error, file, helperText, sx, ...other }) {
|
|
|
334
183
|
/* @__PURE__ */ jsxs(
|
|
335
184
|
"div",
|
|
336
185
|
{
|
|
337
|
-
className:
|
|
186
|
+
className: classes.containerMessage,
|
|
338
187
|
...process.env.NODE_ENV !== "production" ? {
|
|
339
188
|
[TEST_PROP_ID]: getNameRHFUploadImageDataTestId("containerMessage")
|
|
340
189
|
} : {},
|
|
@@ -342,14 +191,14 @@ function UploadImage({ error, file, helperText, sx, ...other }) {
|
|
|
342
191
|
/* @__PURE__ */ jsx(
|
|
343
192
|
Typography,
|
|
344
193
|
{
|
|
345
|
-
className:
|
|
194
|
+
className: classes.containerTitle,
|
|
346
195
|
variant: "subtitle",
|
|
347
196
|
skeletonWidth: "150px",
|
|
348
197
|
children: getLabel("upload_image.title_upload")
|
|
349
198
|
}
|
|
350
199
|
),
|
|
351
|
-
/* @__PURE__ */ jsx(Typography, { className:
|
|
352
|
-
/* @__PURE__ */ jsx(Typography, { className:
|
|
200
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.containerDescription, variant: "body", children: getLabel("upload_image.description") }),
|
|
201
|
+
/* @__PURE__ */ jsx(Typography, { className: classes.containerConditions, variant: "body", children: getLabel("upload_image.conditions") }),
|
|
353
202
|
/* @__PURE__ */ jsx(Button, { onClick: open, children: getLabel("upload_image.label_button") })
|
|
354
203
|
]
|
|
355
204
|
}
|
|
@@ -365,7 +214,7 @@ function UploadImage({ error, file, helperText, sx, ...other }) {
|
|
|
365
214
|
}
|
|
366
215
|
),
|
|
367
216
|
helperText && helperText
|
|
368
|
-
] }) : /* @__PURE__ */ jsx(SkeletonUploadImage, { classes:
|
|
217
|
+
] }) : /* @__PURE__ */ jsx(SkeletonUploadImage, { classes: classes.skeleton })
|
|
369
218
|
}
|
|
370
219
|
);
|
|
371
220
|
}
|
|
@@ -405,55 +254,6 @@ function RHFUploadImage({ name, ...other }) {
|
|
|
405
254
|
}
|
|
406
255
|
);
|
|
407
256
|
}
|
|
408
|
-
const ImageNode = (props) => {
|
|
409
|
-
const { className, style, src, width = "100%", height = "100%" } = props;
|
|
410
|
-
const { unitSize, sourceData } = useBase();
|
|
411
|
-
const { host_static_assets, environment_assets } = useEnvironment();
|
|
412
|
-
const resourceImg = evaluateWithContext(sourceData, src);
|
|
413
|
-
return /* @__PURE__ */ jsx(
|
|
414
|
-
"img",
|
|
415
|
-
{
|
|
416
|
-
src: `${host_static_assets}/${environment_assets}/${resourceImg}`,
|
|
417
|
-
className: clsx(classes.imageNodeRoot, className),
|
|
418
|
-
style: {
|
|
419
|
-
width: getSize(width, unitSize),
|
|
420
|
-
height: getSize(height, unitSize),
|
|
421
|
-
...style
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
);
|
|
425
|
-
};
|
|
426
|
-
const convertToPx = (size, magnitud) => {
|
|
427
|
-
if (isNaN(size)) {
|
|
428
|
-
return 0;
|
|
429
|
-
}
|
|
430
|
-
if (magnitud === "px") {
|
|
431
|
-
return size;
|
|
432
|
-
}
|
|
433
|
-
switch (magnitud) {
|
|
434
|
-
case "cm":
|
|
435
|
-
return size * 37.8;
|
|
436
|
-
case "mm":
|
|
437
|
-
return size * 3.78;
|
|
438
|
-
case "in":
|
|
439
|
-
return size * 96;
|
|
440
|
-
case "pt":
|
|
441
|
-
return size * 1.33;
|
|
442
|
-
case "pc":
|
|
443
|
-
return size * 16;
|
|
444
|
-
default:
|
|
445
|
-
return 100;
|
|
446
|
-
}
|
|
447
|
-
};
|
|
448
|
-
const QRImageNode = (props) => {
|
|
449
|
-
const { url, size = 8, color } = props;
|
|
450
|
-
const { unitSize } = useBase();
|
|
451
|
-
return /* @__PURE__ */ jsx(QRCode, { value: url, size: convertToPx(size, unitSize), fgColor: color, renderAs: "canvas" });
|
|
452
|
-
};
|
|
453
257
|
export {
|
|
454
|
-
|
|
455
|
-
QRImageNode as Q,
|
|
456
|
-
RHFUploadImage as R,
|
|
457
|
-
ImageButton as a,
|
|
458
|
-
ImageNode as b
|
|
258
|
+
RHFUploadImage as R
|
|
459
259
|
};
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { createContext, useRef, useEffect, useContext } from "react";
|
|
2
|
+
import { shallow } from "zustand/shallow";
|
|
3
|
+
import { createStore, useStore } from "zustand";
|
|
4
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
5
|
+
import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
|
|
6
|
+
import { useModuleDictionary, useModuleSkeleton } from "@m4l/core";
|
|
7
|
+
import { devtools } from "zustand/middleware";
|
|
8
|
+
import { immer } from "zustand/middleware/immer";
|
|
9
|
+
import { enableMapSet } from "immer";
|
|
10
|
+
import { u as useMapStore, C as CommonFeatureRender } from "../../index.ba1ccfad.js";
|
|
11
|
+
import { G as GeofencesFeaturesLayers, T as TabsGpsTools } from "../../../mui_extended/Tab/index.ad88441e.js";
|
|
12
|
+
import { styled } from "@mui/material/styles";
|
|
13
|
+
import { generateUtilityClasses } from "@mui/material";
|
|
14
|
+
import "@mui/base";
|
|
15
|
+
import { _ as COMPONENT_CLASS_NAME, M as MAP_ZINDEX_OVER_MAP } from "../../../areas/constants.630a4f42.js";
|
|
16
|
+
enableMapSet();
|
|
17
|
+
const createGpsToolsStore = (initProps) => {
|
|
18
|
+
const startProps = {
|
|
19
|
+
currentTabGpsTool: "geofences",
|
|
20
|
+
geofenceState: {
|
|
21
|
+
rows: [],
|
|
22
|
+
checkedGeofences: /* @__PURE__ */ new Set(),
|
|
23
|
+
checkedCrossingFeatures: /* @__PURE__ */ new Set(),
|
|
24
|
+
checkedInternalFeatures: /* @__PURE__ */ new Set(),
|
|
25
|
+
hashGeofences: {}
|
|
26
|
+
},
|
|
27
|
+
...initProps
|
|
28
|
+
};
|
|
29
|
+
return createStore(
|
|
30
|
+
devtools(
|
|
31
|
+
immer((set, _get) => ({
|
|
32
|
+
...startProps,
|
|
33
|
+
gpsToolsActions: {
|
|
34
|
+
init: () => {
|
|
35
|
+
set((state) => {
|
|
36
|
+
state.ownerState.status = "ready";
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
setGpsToolsState: (status) => {
|
|
40
|
+
set((state) => {
|
|
41
|
+
state.ownerState.status = status;
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
setHandlerGetLabel: (newHandler) => {
|
|
45
|
+
set((state) => {
|
|
46
|
+
state.getLabel = newHandler;
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
setExternalState: (newExternalState) => {
|
|
50
|
+
set((state) => {
|
|
51
|
+
state.ownerState = { ...state.ownerState, ...newExternalState };
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
setCurrentTabTool: (newTabTool) => {
|
|
55
|
+
set((state) => {
|
|
56
|
+
state.currentTabGpsTool = newTabTool;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
geofenceActions: {
|
|
61
|
+
addGeofence: (geofenceId, geofence) => {
|
|
62
|
+
set((state) => {
|
|
63
|
+
state.geofenceState.hashGeofences[geofenceId] = geofence;
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
updatePartialGeofence: (geofenceId, geofence) => {
|
|
67
|
+
set((state) => {
|
|
68
|
+
state.geofenceState.hashGeofences[geofenceId] = {
|
|
69
|
+
...state.geofenceState.hashGeofences[geofenceId],
|
|
70
|
+
...geofence
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
updateRows: (newRows) => {
|
|
75
|
+
set((state) => {
|
|
76
|
+
state.geofenceState.rows = newRows;
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
addCheckedGeofence: (geofenceId) => {
|
|
80
|
+
set((state) => {
|
|
81
|
+
state.geofenceState.checkedGeofences.add(geofenceId);
|
|
82
|
+
state.geofenceState.checkedGeofences = new Set(state.geofenceState.checkedGeofences);
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
removeCheckedGeofence: (geofenceId) => {
|
|
86
|
+
set((state) => {
|
|
87
|
+
state.geofenceState.checkedGeofences.delete(geofenceId);
|
|
88
|
+
state.geofenceState.checkedGeofences = new Set(state.geofenceState.checkedGeofences);
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
setCheckedGeofences: (newGeofences) => {
|
|
92
|
+
set((state) => {
|
|
93
|
+
state.geofenceState.checkedGeofences = new Set(newGeofences);
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
setCheckedCrossingFeatures: (newFeatures) => {
|
|
97
|
+
set((state) => {
|
|
98
|
+
state.geofenceState.checkedCrossingFeatures = new Set(newFeatures);
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
setCheckedInternalFeatures: (newFeatures) => {
|
|
102
|
+
set((state) => {
|
|
103
|
+
state.geofenceState.checkedInternalFeatures = new Set(newFeatures);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})),
|
|
108
|
+
{ name: `Map Tools Store` }
|
|
109
|
+
)
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
const GpsToolsContext = createContext(null);
|
|
113
|
+
function GpsToolsProvider(props) {
|
|
114
|
+
const { children } = props;
|
|
115
|
+
const { getLabel } = useModuleDictionary();
|
|
116
|
+
const isDesktop = useResponsiveDesktop();
|
|
117
|
+
const isSkeleton = useModuleSkeleton();
|
|
118
|
+
const isFirstRender = useFirstRender([getLabel]);
|
|
119
|
+
const mapStoreRef = useRef();
|
|
120
|
+
if (!mapStoreRef.current) {
|
|
121
|
+
mapStoreRef.current = createGpsToolsStore({
|
|
122
|
+
getLabel,
|
|
123
|
+
ownerState: {
|
|
124
|
+
status: "init",
|
|
125
|
+
isMobile: !isDesktop,
|
|
126
|
+
isSkeleton,
|
|
127
|
+
focus: false
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
const { setHandlerGetLabel, setExternalState } = useStore(
|
|
132
|
+
mapStoreRef.current,
|
|
133
|
+
(state) => state.gpsToolsActions,
|
|
134
|
+
shallow
|
|
135
|
+
);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
if (!isFirstRender) {
|
|
138
|
+
setHandlerGetLabel(getLabel);
|
|
139
|
+
}
|
|
140
|
+
}, [getLabel]);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (isFirstRender) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
setExternalState({ isMobile: !isDesktop, isSkeleton });
|
|
146
|
+
}, [isDesktop, isSkeleton]);
|
|
147
|
+
return /* @__PURE__ */ jsx(GpsToolsContext.Provider, { value: mapStoreRef.current, children });
|
|
148
|
+
}
|
|
149
|
+
function useGpsToolsStore(selector, equalityFn) {
|
|
150
|
+
const context = useContext(GpsToolsContext);
|
|
151
|
+
if (!context)
|
|
152
|
+
throw new Error("useGpsToolsStore context must be use inside GpsToolsContext");
|
|
153
|
+
return useStore(context, selector, equalityFn);
|
|
154
|
+
}
|
|
155
|
+
function useLayers() {
|
|
156
|
+
const { addLayer, removeLayer } = useMapStore((state) => state.mapActions, shallow);
|
|
157
|
+
const { init } = useGpsToolsStore((state) => state.gpsToolsActions, shallow);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
addLayer({
|
|
160
|
+
layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES,
|
|
161
|
+
name: "Geocercas",
|
|
162
|
+
renderFeature: CommonFeatureRender,
|
|
163
|
+
geoJsonObject: {
|
|
164
|
+
object: {
|
|
165
|
+
type: "FeatureCollection",
|
|
166
|
+
features: []
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
autoFocus: false
|
|
170
|
+
});
|
|
171
|
+
addLayer({
|
|
172
|
+
layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES,
|
|
173
|
+
name: "Geometr\xEDas de tr\xE1nsito",
|
|
174
|
+
renderFeature: CommonFeatureRender,
|
|
175
|
+
geoJsonObject: {
|
|
176
|
+
object: {
|
|
177
|
+
type: "FeatureCollection",
|
|
178
|
+
features: []
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
autoFocus: false
|
|
182
|
+
});
|
|
183
|
+
addLayer({
|
|
184
|
+
layerId: GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES,
|
|
185
|
+
name: "Geometr\xEDas internas",
|
|
186
|
+
renderFeature: CommonFeatureRender,
|
|
187
|
+
geoJsonObject: {
|
|
188
|
+
object: {
|
|
189
|
+
type: "FeatureCollection",
|
|
190
|
+
features: []
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
autoFocus: false
|
|
194
|
+
});
|
|
195
|
+
init();
|
|
196
|
+
return () => {
|
|
197
|
+
removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES);
|
|
198
|
+
removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES_INTERNAL_FEATURES);
|
|
199
|
+
removeLayer(GeofencesFeaturesLayers.LAYER_GEOFENCES_TRANSIT_FEATURES);
|
|
200
|
+
};
|
|
201
|
+
}, []);
|
|
202
|
+
}
|
|
203
|
+
const gpsToolsClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
|
|
204
|
+
"gpsToolsRoot",
|
|
205
|
+
"gpsToolsTab",
|
|
206
|
+
"gpsToolsTabContent",
|
|
207
|
+
"gpsToolsGeofencesList",
|
|
208
|
+
"gpsToolsGeofencesAddEdit",
|
|
209
|
+
"gpsToolsGeofencesAddEditContent",
|
|
210
|
+
"toolGeofencesAddEditGeneral",
|
|
211
|
+
"toolGeofencesAddEditStyle",
|
|
212
|
+
"visible",
|
|
213
|
+
"hidden"
|
|
214
|
+
]);
|
|
215
|
+
const DivGpsToolsRoot = styled("div")`
|
|
216
|
+
position: relative;
|
|
217
|
+
display: flex;
|
|
218
|
+
flex-direction: column;
|
|
219
|
+
flex-grow: 1;
|
|
220
|
+
width: 100%;
|
|
221
|
+
height: 100%;
|
|
222
|
+
|
|
223
|
+
z-index: ${MAP_ZINDEX_OVER_MAP};
|
|
224
|
+
|
|
225
|
+
.${gpsToolsClasses.gpsToolsTabContent}.${gpsToolsClasses.hidden} {
|
|
226
|
+
display: none;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.${gpsToolsClasses.gpsToolsGeofencesList} .M4LDataGrid-root {
|
|
230
|
+
height: unset !important;
|
|
231
|
+
flex-grow: 1;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.${gpsToolsClasses.toolGeofencesAddEditGeneral} {
|
|
235
|
+
flex-grow: 1;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
${(props) => props.theme.components?.M4LGpsTools?.styleOverrides}
|
|
239
|
+
`;
|
|
240
|
+
function GpsTools() {
|
|
241
|
+
const isSkeleton = useModuleSkeleton();
|
|
242
|
+
return /* @__PURE__ */ jsx(Fragment, { children: !isSkeleton && /* @__PURE__ */ jsx(TabsGpsTools, {}) });
|
|
243
|
+
}
|
|
244
|
+
export {
|
|
245
|
+
DivGpsToolsRoot as D,
|
|
246
|
+
GpsTools as G,
|
|
247
|
+
useLayers as a,
|
|
248
|
+
GpsToolsProvider as b,
|
|
249
|
+
gpsToolsClasses as g,
|
|
250
|
+
useGpsToolsStore as u
|
|
251
|
+
};
|