@m4l/components 1.0.11 → 1.0.13
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.62b1290b.js → index.f22ad364.js} +4 -4
- package/components/AppBar/{index.b48343d8.js → index.8d90ce87.js} +4 -4
- package/components/CommonActions/components/ActionCancel/index.609a78ca.js +12 -0
- package/components/CommonActions/components/ActionFormCancel/index.a1318eac.js +56 -0
- package/components/CommonActions/components/ActionFormIntro/index.34d569d1.js +33 -0
- package/components/CommonActions/components/ActionIntro/index.ebac0bc1.js +25 -0
- package/components/CommonActions/components/Actions/index.258bf919.js +71 -0
- package/components/DataGrid/constants.e334cd50.js +10 -0
- package/components/DataGrid/formatters/ColumnBooleanFormatter/index.7fb1ebaa.js +26 -0
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.0ee10612.js +22 -0
- package/components/DataGrid/formatters/ColumnDateFormatter/index.e00d0cf2.js +19 -0
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.dce9ada8.js +23 -0
- package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.880e743b.js +14 -0
- package/components/DataGrid/formatters/ColumnPointsFormatter/index.226cc583.js +10 -0
- package/components/DataGrid/formatters/ColumnPriceFormatter/index.bf9d9e60.js +10 -0
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.4045b2f2.js +36 -0
- package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.a87302d1.js +10 -0
- package/components/DataGrid/formatters/index.2c2f0ae4.js +1 -0
- package/components/DataGrid/index.68e19254.js +915 -0
- package/components/DataGrid/subcomponents/Actions/index.6b044e84.js +596 -0
- package/components/DataGrid/subcomponents/editors/TextEditor/index.3f0d9e28.js +76 -0
- package/components/DragResizeWindow/{index.8b3e79f7.js → index.a358789f.js} +6 -3
- package/components/DynamicFilter/constants.1dddd09c.js +31 -0
- package/components/DynamicFilter/dictionary.d28d39ef.js +51 -0
- package/components/DynamicFilter/helpers/{index.609b3915.js → index.11ed2896.js} +4 -4
- package/components/DynamicFilter/{index.0f04f223.js → index.056a99c7.js} +3 -3
- package/components/DynamicFilter/slots/{index.00b68384.js → index.82d7eaf2.js} +31 -31
- package/components/DynamicFilter/store/{index.85a2812f.js → index.9b5121d6.js} +2 -2
- package/components/DynamicFilter/subcomponents/{index.86c6fda2.js → index.778c93cc.js} +217 -15
- package/components/FieldLabel/{index.1577ac9c.js → index.6b6f708e.js} +4 -4
- package/components/GridLayout/{index.656840a5.js → index.68d907d4.js} +34 -11
- package/components/GridLayout/subcomponents/Griditem/{index.b23625d7.js → index.8955a794.js} +3 -4
- package/components/GridLayout/subcomponents/Responsive/{index.97505a31.js → index.45cecca2.js} +1 -2
- package/components/GridLayout/subcomponents/SizeProvider/{index.36cb4139.js → index.7050ac4f.js} +1 -1
- package/components/HelperText/{index.ebb53dac.js → index.09e80920.js} +1 -1
- package/components/Icon/{index.8ecfb193.js → index.83867398.js} +10 -26
- package/components/Image/{index.4a822ede.js → index.19aa7ff5.js} +3 -2
- package/components/LanguagePopover/index.921efd11.js +188 -0
- package/components/{mui_extended/LinearProgress/index.e9455b2e.js → LinearProgressIndeterminate/index.ea9c8518.js} +4 -9
- package/components/LoadingError/{index.9e829e8d.js → index.aee18b24.js} +11 -7
- package/components/MFLoader/{index.29f445e2.js → index.c975666e.js} +8 -4
- package/components/ModalDialog/{index.96c4aba3.js → index.0dd5af28.js} +14 -5
- package/components/NavLink/{index.9f5d5670.js → index.ad039baf.js} +3 -2
- package/components/NoItemSelected/{index.0ae9f28f.js → index.d10603d7.js} +13 -3
- package/components/ObjectLogs/{index.40c5047f.js → index.a3e42b21.js} +26 -8
- package/components/PDFViewer/{index.651cc4b6.js → index.35f68e67.js} +2 -2
- package/components/Page/{index.1d08818c.js → index.f4755eba.js} +18 -2
- package/components/PaperForm/{index.1a8b10d4.js → index.007ef4cf.js} +2 -2
- package/components/Period/{index.236971ae.js → index.9647181b.js} +15 -54
- package/components/PrintingSystem/{index.9fdae551.js → index.a69a9d85.js} +14 -15
- package/components/PrintingSystem/subcomponents/BodyNode/{index.794dbc69.js → index.528fcfbf.js} +1 -1
- package/components/PrintingSystem/subcomponents/ChartNode/{index.6bbf7d75.js → index.fbe87257.js} +1 -1
- package/components/PrintingSystem/subcomponents/DividerNode/{index.015a2212.js → index.f5adab1d.js} +1 -1
- package/components/PrintingSystem/subcomponents/FooterNode/{index.08eeb1d2.js → index.f42ca7dc.js} +1 -1
- package/components/PrintingSystem/subcomponents/GridNode/{index.23995699.js → index.041b9cff.js} +1 -1
- package/components/PrintingSystem/subcomponents/HeaderNode/{index.3fa36620.js → index.a8140332.js} +1 -1
- package/components/PrintingSystem/subcomponents/PaperNode/{index.8b7d43f4.js → index.aabde2bb.js} +1 -1
- package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.9856c572.js → index.7f75ca46.js} +1 -1
- package/components/PrintingSystem/subcomponents/SectionNode/{index.89b3a4e0.js → index.61babb47.js} +1 -1
- package/components/PrintingSystem/subcomponents/TextBoxNode/{index.dc6e9dc2.js → index.4d0e67a3.js} +1 -1
- package/components/PropertyValue/{index.646a7e8b.js → index.51faabb5.js} +7 -4
- package/components/Resizeable/{index.414ff687.js → index.4f75c0b5.js} +1 -1
- package/components/ScrollBar/{index.1e89bb44.js → index.21bc5025.js} +1 -1
- package/components/SideBar/{index.d221254d.js → index.4075c562.js} +36 -7
- package/components/SplitLayout/{index.7d9edf4e.js → index.15756f0f.js} +3 -1
- package/components/ToastContainer/{index.7f246bbd.js → index.2a7d304e.js} +3 -3
- package/components/animate/variants/index.7a912140.js +1 -0
- package/components/areas/components/AreasAdmin/index.325bac22.js +733 -0
- package/components/areas/components/AreasViewer/index.6e30ec72.js +1072 -0
- package/components/areas/components/index.558684b3.js +1 -0
- package/components/areas/constants.66529246.js +6 -0
- package/components/areas/contexts/AreasContext/{index.0815f278.js → index.3311cbf9.js} +6 -5
- package/components/areas/contexts/DynamicMFParmsContext/{index.37d1d444.js → index.3d9ad0ad.js} +2 -2
- package/components/areas/contexts/WindowToolsMFContext/{index.69d95c15.js → index.992ae7a3.js} +2 -2
- package/components/areas/contexts/index.24025b97.js +1 -0
- package/components/areas/dictionary.08cfc4c9.js +36 -0
- package/components/areas/hooks/index.d9dc1e21.js +1 -0
- package/components/areas/hooks/useAreas/{index.4039e30d.js → index.f81493ef.js} +1 -1
- package/components/areas/hooks/useDynamicMFParameters/{index.03ce6078.js → index.9e09e1e3.js} +1 -1
- package/components/areas/hooks/useWindowToolsMF/{index.09801b66.js → index.2fbae9dc.js} +1 -1
- package/components/areas/icons.8266ccc8.js +26 -0
- package/components/areas/index.4cc6a221.js +22 -0
- package/components/commercial/AppBarCommercial/index.cbd55cf8.js +28 -0
- package/components/commercial/SectionCommercial/index.d22ebbd5.js +57 -0
- package/components/commercial/TopBar/index.410fffa8.js +234 -0
- package/components/{HamburgerMenu/index.6c82741d.js → commercial/index.07638f52.js} +5 -3
- package/components/formatters/BooleanFormatter/index.cbf9cd6e.js +44 -0
- package/components/formatters/DateFormatter/index.2ef6f261.js +43 -0
- package/components/formatters/PointsFormatter/index.d8a4ee54.js +25 -0
- package/components/formatters/PriceFormatter/index.97f75b4b.js +35 -0
- package/components/formatters/UncertaintyFormatter/index.c3ffdebc.js +29 -0
- package/components/formatters/index.63a3e08e.js +117 -0
- package/components/hook-form/HelperError/{index.2ed03a3c.js → index.c0109d5b.js} +1 -1
- package/components/hook-form/RHFAutocomplete/index.2991d444.js +404 -0
- package/components/hook-form/RHFAutocompleteAsync/{index.69f5661d.js → index.d97c727b.js} +2 -3
- package/components/hook-form/RHFCheckbox/{index.13de27db.js → index.b57e3131.js} +4 -4
- package/components/hook-form/RHFColorPicker/{index.66004599.js → index.310f6ff0.js} +6 -6
- package/components/hook-form/RHFDateTime/{index.dfe07e18.js → index.5689a29f.js} +5 -5
- package/components/hook-form/RHFPeriod/{index.d852649b.js → index.019e61ae.js} +4 -4
- package/components/hook-form/RHFTextField/{index.d207efc1.js → index.10e57945.js} +6 -6
- package/components/hook-form/RHFUpload/{index.955a4ba5.js → index.7fd23b2a.js} +5 -5
- package/components/{mui_extended/Tab/index.37d588d6.js → maps/components/GpsTools/index.20f83559.js} +331 -645
- package/components/maps/{index.a1bf63f2.js → components/Map/index.c37f3304.js} +737 -28
- package/components/maps/index.13bb982c.js +7 -0
- package/components/modal/{WindowBase.390b0910.js → WindowBase.cfbb0c9e.js} +4 -4
- package/components/modal/{WindowConfirm.243e1bef.js → WindowConfirm.300bd34b.js} +10 -6
- package/components/modal/{index.5bce430d.js → index.81eb6def.js} +5 -1
- package/components/mui_extended/Accordion/{index.f7a17c83.js → index.0843a609.js} +5 -5
- package/components/mui_extended/Avatar/{index.12b96914.js → index.fb9ad158.js} +1 -1
- package/components/mui_extended/Badge/{index.4737c113.js → index.8beaeefc.js} +1 -1
- package/components/mui_extended/Button/{index.52852c42.js → index.d742e9ee.js} +6 -81
- package/components/mui_extended/{CheckBox/index.01218423.js → CheckBox.21c25705.js} +1 -1
- package/components/mui_extended/IconButton/{index.d5b273e6.js → index.b4532b85.js} +1 -1
- package/components/mui_extended/LinearProgress/index.4092bb69.js +9 -0
- package/components/mui_extended/MenuActions/index.eae97857.js +176 -0
- package/components/mui_extended/Pager/{index.8960227c.js → index.3926c835.js} +22 -40
- package/components/mui_extended/Popover/index.2348fc4f.js +143 -0
- package/components/mui_extended/Tab/index.e911930f.js +135 -0
- package/components/mui_extended/ToggleButton/{index.c441b949.js → index.b834f5f0.js} +1 -1
- package/components/mui_extended/ToggleIconButton/{index.8a84f25e.js → index.fcd5205c.js} +1 -1
- package/components/mui_extended/Typography/{index.463f613f.js → index.642798f1.js} +1 -1
- package/components/mui_extended/index.b606cd9d.js +1 -0
- package/components/popups/PopupsProvider/{index.d4caacc3.js → index.d7c9efce.js} +1 -1
- package/components/popups/PopupsViewer/{index.42312806.js → index.f3677ab1.js} +10 -6
- package/contexts/ModalContext/{index.5f77a463.js → index.ad1fb73b.js} +1 -1
- package/contexts/RHFormContext/{index.95ebabc9.js → index.bf3a2812.js} +6 -2
- package/hooks/useFormAddEdit/{index.ecb77e67.js → index.6d983cd8.js} +6 -2
- package/hooks/useModal/index.2003c854.js +11 -0
- package/hooks/useTab/index.8d1a6e63.js +12 -0
- package/index.js +328 -273
- package/package.json +1 -1
- package/{react-draggable.0cc9b257.js → react-draggable.1c1ba224.js} +1 -1
- package/{react-resizable.837c446d.js → react-resizable.a59c14f4.js} +2 -2
- package/test/constants_no_mock.86c553a9.js +4 -0
- package/test/{getNameDataTestId.aee44365.js → getNameDataTestId.0faeade8.js} +2 -2
- package/utils/{index.c64c2dd1.js → index.14912462.js} +1 -54
- package/components/CommonActions/index.19f39dca.js +0 -170
- package/components/areas/constants.0d3ba950.js +0 -289
- package/components/areas/dictionary.6168209a.js +0 -266
- package/components/areas/icons.504ec098.js +0 -83
- package/components/maps/components/GpsTools/index.01acaf3e.js +0 -251
- package/components/mui_extended/Popover/index.146ded9e.js +0 -1044
- package/hooks/useModal/index.d14c7e46.js +0 -67
- package/vendor.5b266106.js +0 -3952
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { u as useAreasStore } from "../../hooks/useAreas/index.f81493ef.js";
|
|
3
|
+
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
4
|
+
import { useState, useRef, useMemo } from "react";
|
|
5
|
+
import * as Yup from "yup";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { generateUtilityClasses, useTheme, styled as styled$1 } from "@mui/material";
|
|
8
|
+
import { unstable_composeClasses } from "@mui/base";
|
|
9
|
+
import { g as getComponentUtilityClass } from "../../../../utils/index.14912462.js";
|
|
10
|
+
import { A as AREAS_ADMIN_CLASS_NAME } from "../../constants.66529246.js";
|
|
11
|
+
import { I as ICONS } from "../../icons.8266ccc8.js";
|
|
12
|
+
import { g as getAreasDictionary, D as DICCTIONARY } from "../../dictionary.08cfc4c9.js";
|
|
13
|
+
import { styled } from "@mui/material/styles";
|
|
14
|
+
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
15
|
+
import { shallow } from "zustand/shallow";
|
|
16
|
+
import { M as MenuActions } from "../../../mui_extended/MenuActions/index.eae97857.js";
|
|
17
|
+
import { R as RHFormProvider } from "../../../../contexts/RHFormContext/index.bf3a2812.js";
|
|
18
|
+
import { R as RHFTextField } from "../../../hook-form/RHFTextField/index.10e57945.js";
|
|
19
|
+
import { A as Actions } from "../../../CommonActions/components/Actions/index.258bf919.js";
|
|
20
|
+
import { A as ActionCancel } from "../../../CommonActions/components/ActionCancel/index.609a78ca.js";
|
|
21
|
+
import { A as ActionIntro } from "../../../CommonActions/components/ActionIntro/index.ebac0bc1.js";
|
|
22
|
+
import { I as IconButton } from "../../../mui_extended/IconButton/index.b4532b85.js";
|
|
23
|
+
import { P as Popover } from "../../../mui_extended/Popover/index.2348fc4f.js";
|
|
24
|
+
import { T as Typography } from "../../../mui_extended/Typography/index.642798f1.js";
|
|
25
|
+
import { S as ScrollBar } from "../../../ScrollBar/index.21bc5025.js";
|
|
26
|
+
import TouchRipple from "@mui/material/ButtonBase/TouchRipple";
|
|
27
|
+
import { B as Button } from "../../../mui_extended/Button/index.d742e9ee.js";
|
|
28
|
+
import { I as Icon } from "../../../Icon/index.83867398.js";
|
|
29
|
+
import { u as useOnClickOutside } from "../../index.4cc6a221.js";
|
|
30
|
+
const areasAdminClasses = generateUtilityClasses(
|
|
31
|
+
AREAS_ADMIN_CLASS_NAME,
|
|
32
|
+
[
|
|
33
|
+
"root",
|
|
34
|
+
"rootContent",
|
|
35
|
+
"areaChipRoot",
|
|
36
|
+
"areaChipTitle",
|
|
37
|
+
"areaChipDeleteButton",
|
|
38
|
+
"areasAddButton",
|
|
39
|
+
"areaContainerChipEditButton",
|
|
40
|
+
"areaContainerChips",
|
|
41
|
+
"areaContainerContentChips",
|
|
42
|
+
"areaContainerChipsIcon",
|
|
43
|
+
"areaEditPopover",
|
|
44
|
+
"areaChipMobileRoot",
|
|
45
|
+
"areaChipMobileIconContainer",
|
|
46
|
+
"areaIconLayer",
|
|
47
|
+
"areaIconLayerContent",
|
|
48
|
+
"areaChipEditButton",
|
|
49
|
+
"areasPopoverMobileOptions",
|
|
50
|
+
"areasPopoverListWindows",
|
|
51
|
+
"areasPopoverListWindowsIcon",
|
|
52
|
+
"areaContentChips",
|
|
53
|
+
"selected",
|
|
54
|
+
"isMobile",
|
|
55
|
+
"disabled",
|
|
56
|
+
"isFocus"
|
|
57
|
+
],
|
|
58
|
+
AREAS_ADMIN_CLASS_NAME
|
|
59
|
+
);
|
|
60
|
+
const useAreasAdminUtilityClasses = (ownerState) => {
|
|
61
|
+
const slots = {
|
|
62
|
+
root: [
|
|
63
|
+
"root",
|
|
64
|
+
ownerState.status,
|
|
65
|
+
ownerState.isMobile && "isMobile",
|
|
66
|
+
ownerState.isSkeleton && "isSkeleton",
|
|
67
|
+
ownerState.focus && "isFocus"
|
|
68
|
+
],
|
|
69
|
+
rootContent: ["rootContent"],
|
|
70
|
+
areaChipRoot: ["areaChipRoot"],
|
|
71
|
+
areaIconLayer: ["areaIconLayer"],
|
|
72
|
+
areaContainerChipsIcon: ["areaContainerChipsIcon"],
|
|
73
|
+
areaContainerChips: ["areaContainerChips"],
|
|
74
|
+
areaContainerContentChips: ["areaContainerContentChips"],
|
|
75
|
+
areaEditPopover: ["areaEditPopover"],
|
|
76
|
+
areaChipMobileRoot: ["areaChipMobileRoot"],
|
|
77
|
+
areaChipMobileIconContainer: ["areaChipMobileIconContainer"],
|
|
78
|
+
areaChipTitle: ["areaChipTitle"],
|
|
79
|
+
areaContainerChipEditButton: ["areaContainerChipEditButton"],
|
|
80
|
+
areaChipDeleteButton: ["areaChipDeleteButton"],
|
|
81
|
+
areaChipEditButton: ["areaChipEditButton"],
|
|
82
|
+
areasAddButton: ["areasAddButton"],
|
|
83
|
+
areasPopoverMobileOptions: ["areasPopoverMobileOptions"],
|
|
84
|
+
areasPopoverListWindows: ["areasPopoverListWindows"],
|
|
85
|
+
areasPopoverListWindowsIcon: ["areasPopoverListWindowsIcon"],
|
|
86
|
+
areaContentChips: ["areaContentChips"]
|
|
87
|
+
};
|
|
88
|
+
return unstable_composeClasses(slots, getComponentUtilityClass(AREAS_ADMIN_CLASS_NAME), {});
|
|
89
|
+
};
|
|
90
|
+
styled("div")(() => ({
|
|
91
|
+
display: "flex",
|
|
92
|
+
flexDirection: "row",
|
|
93
|
+
border: "1px solid gray",
|
|
94
|
+
"&.active": {
|
|
95
|
+
border: "1px solid red"
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
styled("div")(({ theme }) => ({
|
|
99
|
+
height: "100%",
|
|
100
|
+
width: theme.spacing(1),
|
|
101
|
+
backgroundColor: theme.vars.palette.background.default,
|
|
102
|
+
"&.active": {
|
|
103
|
+
backgroundColor: theme.vars.palette.primary.main
|
|
104
|
+
}
|
|
105
|
+
}));
|
|
106
|
+
const EditAreaHeader = styled("div")(({ theme }) => ({
|
|
107
|
+
display: "flex",
|
|
108
|
+
width: "100%",
|
|
109
|
+
height: "25px",
|
|
110
|
+
borderBottom: "1px solid",
|
|
111
|
+
borderColor: theme.vars.palette.state.default,
|
|
112
|
+
justifyContent: "space-between",
|
|
113
|
+
alignItems: "center"
|
|
114
|
+
}));
|
|
115
|
+
const ChipActionsMobile = (props) => {
|
|
116
|
+
const { handlerOpenPopoverEditArea, areaId } = props;
|
|
117
|
+
const { deleteArea } = useAreasStore((state) => state.areasActions);
|
|
118
|
+
const { setFocus } = useAreasStore((state) => state.areaAdminActions, shallow);
|
|
119
|
+
const listAreas = useAreasStore((state) => state.areasIds, shallow);
|
|
120
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
121
|
+
const { getLabel } = useModuleDictionary();
|
|
122
|
+
const menuActions = [
|
|
123
|
+
{
|
|
124
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.EDIT_AREA}`,
|
|
125
|
+
onClick: handlerOpenPopoverEditArea,
|
|
126
|
+
label: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area))
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
if (listAreas.length > 1) {
|
|
130
|
+
menuActions.push({
|
|
131
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
|
|
132
|
+
onClick: () => {
|
|
133
|
+
deleteArea(areaId);
|
|
134
|
+
setFocus(false);
|
|
135
|
+
},
|
|
136
|
+
label: getLabel(getAreasDictionary(DICCTIONARY.label_delete_area))
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return /* @__PURE__ */ jsx(
|
|
140
|
+
MenuActions,
|
|
141
|
+
{
|
|
142
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.SHOW_OPTIONS}`,
|
|
143
|
+
arrowType: "no-arrow",
|
|
144
|
+
marginTop: "12px",
|
|
145
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
146
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
147
|
+
menuActions,
|
|
148
|
+
externalClose: () => setFocus(false)
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
const AreaChip = (props) => {
|
|
153
|
+
const { areaId, selected, disabled, setAnchorMenuAreas } = props;
|
|
154
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
155
|
+
const { deleteArea, selectArea, editArea } = useAreasStore((state) => state.areasActions);
|
|
156
|
+
const { setFocus } = useAreasStore((state) => state.areaAdminActions);
|
|
157
|
+
const areaName = useAreasStore((state) => state.hashAreas[areaId].name, shallow);
|
|
158
|
+
const listAreas = useAreasStore((state) => state.areasIds, shallow);
|
|
159
|
+
const [open, setOpen] = useState(false);
|
|
160
|
+
const { getLabel } = useModuleDictionary();
|
|
161
|
+
const isDesktop = useResponsiveDesktop();
|
|
162
|
+
const anchorRef = useRef(null);
|
|
163
|
+
const theme = useTheme();
|
|
164
|
+
const onClickDeleteArea = (e) => {
|
|
165
|
+
if (listAreas.length > 1) {
|
|
166
|
+
e.stopPropagation();
|
|
167
|
+
setFocus(true);
|
|
168
|
+
deleteArea(areaId);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
const onSubmit = (data) => {
|
|
172
|
+
editArea(areaId, data.inputEditArea);
|
|
173
|
+
setOpen(false);
|
|
174
|
+
setFocus(false);
|
|
175
|
+
};
|
|
176
|
+
const handlerOpenPopoverEditArea = (e) => {
|
|
177
|
+
e?.stopPropagation();
|
|
178
|
+
setFocus(true);
|
|
179
|
+
setOpen(true);
|
|
180
|
+
};
|
|
181
|
+
const initialValues = {
|
|
182
|
+
inputEditArea: areaName
|
|
183
|
+
};
|
|
184
|
+
const validationSchema = useMemo(
|
|
185
|
+
() => Yup.object().shape({
|
|
186
|
+
inputEditArea: Yup.string().required(
|
|
187
|
+
getLabel(getAreasDictionary(DICCTIONARY.validation_edit_area))
|
|
188
|
+
)
|
|
189
|
+
}),
|
|
190
|
+
[getLabel]
|
|
191
|
+
);
|
|
192
|
+
const handlerOnClick = (e) => {
|
|
193
|
+
setAnchorMenuAreas && setAnchorMenuAreas(e.currentTarget);
|
|
194
|
+
selectArea(areaId);
|
|
195
|
+
};
|
|
196
|
+
const rippleRef = useRef(null);
|
|
197
|
+
const onRippleStart = (e) => {
|
|
198
|
+
if (rippleRef.current) {
|
|
199
|
+
rippleRef.current.start(e);
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
const onRippleStop = (e) => {
|
|
203
|
+
if (rippleRef.current) {
|
|
204
|
+
rippleRef.current.stop(e);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
208
|
+
/* @__PURE__ */ jsxs(
|
|
209
|
+
"div",
|
|
210
|
+
{
|
|
211
|
+
role: "presentation",
|
|
212
|
+
ref: anchorRef,
|
|
213
|
+
onMouseDown: onRippleStart,
|
|
214
|
+
onMouseUp: onRippleStop,
|
|
215
|
+
className: clsx(
|
|
216
|
+
areasAdminClasses.areaChipRoot,
|
|
217
|
+
selected ? areasAdminClasses.selected : null,
|
|
218
|
+
disabled ? areasAdminClasses.disabled : null
|
|
219
|
+
),
|
|
220
|
+
onClick: (e) => {
|
|
221
|
+
handlerOnClick(e);
|
|
222
|
+
},
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaChipTitle, children: areaName }),
|
|
225
|
+
isDesktop ? /* @__PURE__ */ jsxs("div", { className: areasAdminClasses.areaContainerChipEditButton, children: [
|
|
226
|
+
/* @__PURE__ */ jsx(
|
|
227
|
+
IconButton,
|
|
228
|
+
{
|
|
229
|
+
className: areasAdminClasses.areaChipEditButton,
|
|
230
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.EDIT_AREA}`,
|
|
231
|
+
size: "small",
|
|
232
|
+
onClick: (e) => {
|
|
233
|
+
handlerOpenPopoverEditArea(e);
|
|
234
|
+
},
|
|
235
|
+
tooltip: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area))
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ jsx(
|
|
239
|
+
IconButton,
|
|
240
|
+
{
|
|
241
|
+
className: areasAdminClasses.areaChipDeleteButton,
|
|
242
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
|
|
243
|
+
size: "small",
|
|
244
|
+
onClick: (e) => {
|
|
245
|
+
onClickDeleteArea(e);
|
|
246
|
+
},
|
|
247
|
+
tooltip: getLabel(getAreasDictionary(DICCTIONARY.label_delete_area))
|
|
248
|
+
}
|
|
249
|
+
)
|
|
250
|
+
] }) : /* @__PURE__ */ jsx(
|
|
251
|
+
ChipActionsMobile,
|
|
252
|
+
{
|
|
253
|
+
areaId,
|
|
254
|
+
handlerOpenPopoverEditArea
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
/* @__PURE__ */ jsx(
|
|
261
|
+
"div",
|
|
262
|
+
{
|
|
263
|
+
role: "presentation",
|
|
264
|
+
onClick: (e) => {
|
|
265
|
+
e.stopPropagation();
|
|
266
|
+
},
|
|
267
|
+
children: /* @__PURE__ */ jsx(
|
|
268
|
+
Popover,
|
|
269
|
+
{
|
|
270
|
+
arrowType: "top-center",
|
|
271
|
+
open,
|
|
272
|
+
className: areasAdminClasses.areaEditPopover,
|
|
273
|
+
anchorEl: anchorRef.current,
|
|
274
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
275
|
+
transformOrigin: { vertical: "top", horizontal: "center" },
|
|
276
|
+
onClose: () => {
|
|
277
|
+
setFocus(false);
|
|
278
|
+
setOpen(false);
|
|
279
|
+
},
|
|
280
|
+
sx: {
|
|
281
|
+
mt: "10px",
|
|
282
|
+
...theme.components?.M4LAreasAdminEditPopover?.styleOverrides
|
|
283
|
+
},
|
|
284
|
+
children: /* @__PURE__ */ jsxs(
|
|
285
|
+
RHFormProvider,
|
|
286
|
+
{
|
|
287
|
+
onSubmit,
|
|
288
|
+
values: initialValues,
|
|
289
|
+
validationSchema,
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ jsxs(EditAreaHeader, { children: [
|
|
292
|
+
/* @__PURE__ */ jsx(Typography, { children: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area)) }),
|
|
293
|
+
/* @__PURE__ */ jsx(
|
|
294
|
+
IconButton,
|
|
295
|
+
{
|
|
296
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CLOSE}`,
|
|
297
|
+
size: "small",
|
|
298
|
+
onClick: () => {
|
|
299
|
+
setFocus(false);
|
|
300
|
+
setOpen(false);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
] }),
|
|
305
|
+
/* @__PURE__ */ jsx(
|
|
306
|
+
RHFTextField,
|
|
307
|
+
{
|
|
308
|
+
name: "inputEditArea",
|
|
309
|
+
skeletonWidth: "70%",
|
|
310
|
+
skeletonHeight: "18px",
|
|
311
|
+
sx: { mt: "20px" }
|
|
312
|
+
}
|
|
313
|
+
),
|
|
314
|
+
/* @__PURE__ */ jsxs(Actions, { children: [
|
|
315
|
+
/* @__PURE__ */ jsx(
|
|
316
|
+
ActionCancel,
|
|
317
|
+
{
|
|
318
|
+
onClick: () => {
|
|
319
|
+
setOpen(false);
|
|
320
|
+
setFocus(false);
|
|
321
|
+
},
|
|
322
|
+
variant: "outlined",
|
|
323
|
+
skeletonWidth: "100%"
|
|
324
|
+
}
|
|
325
|
+
),
|
|
326
|
+
/* @__PURE__ */ jsx(ActionIntro, { skeletonWidth: "100%" })
|
|
327
|
+
] })
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
] });
|
|
336
|
+
};
|
|
337
|
+
AreaChip.displayName = "AreaButtons";
|
|
338
|
+
const AreasAdminRoot = styled$1("div")`
|
|
339
|
+
display: flex;
|
|
340
|
+
position: relative;
|
|
341
|
+
background-color: transparent;
|
|
342
|
+
|
|
343
|
+
//areaRoot
|
|
344
|
+
& .${areasAdminClasses.areaChipRoot} {
|
|
345
|
+
display: flex;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
${(props) => props.theme.components?.M4LAreasAdmin?.styleOverrides}
|
|
349
|
+
`;
|
|
350
|
+
const ChipMobile = (props) => {
|
|
351
|
+
const { areaId, selected, disabled, setAnchorMenuAreas } = props;
|
|
352
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
353
|
+
const { deleteArea, selectArea, editArea } = useAreasStore((state) => state.areasActions);
|
|
354
|
+
const { setFocus } = useAreasStore((state) => state.areaAdminActions);
|
|
355
|
+
const areaName = useAreasStore((state) => state.hashAreas[areaId].name, shallow);
|
|
356
|
+
const listAreas = useAreasStore((state) => state.areasIds, shallow);
|
|
357
|
+
const [open, setOpen] = useState(false);
|
|
358
|
+
const { getLabel } = useModuleDictionary();
|
|
359
|
+
const isDesktop = useResponsiveDesktop();
|
|
360
|
+
const anchorRef = useRef(null);
|
|
361
|
+
const theme = useTheme();
|
|
362
|
+
const onClickDeleteArea = (e) => {
|
|
363
|
+
if (listAreas.length > 1) {
|
|
364
|
+
e.stopPropagation();
|
|
365
|
+
setFocus(true);
|
|
366
|
+
deleteArea(areaId);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
const onSubmit = (data) => {
|
|
370
|
+
editArea(areaId, data.inputEditArea);
|
|
371
|
+
setOpen(false);
|
|
372
|
+
setFocus(false);
|
|
373
|
+
};
|
|
374
|
+
const handlerOpenPopoverEditArea = (e) => {
|
|
375
|
+
e?.stopPropagation();
|
|
376
|
+
setFocus(true);
|
|
377
|
+
setOpen(true);
|
|
378
|
+
};
|
|
379
|
+
const initialValues = {
|
|
380
|
+
inputEditArea: areaName
|
|
381
|
+
};
|
|
382
|
+
const validationSchema = useMemo(
|
|
383
|
+
() => Yup.object().shape({
|
|
384
|
+
inputEditArea: Yup.string().required(
|
|
385
|
+
getLabel(getAreasDictionary(DICCTIONARY.validation_edit_area))
|
|
386
|
+
)
|
|
387
|
+
}),
|
|
388
|
+
[getLabel]
|
|
389
|
+
);
|
|
390
|
+
const handlerOnClick = (e) => {
|
|
391
|
+
setAnchorMenuAreas && setAnchorMenuAreas(e.currentTarget);
|
|
392
|
+
selectArea(areaId);
|
|
393
|
+
};
|
|
394
|
+
const rippleRef = useRef(null);
|
|
395
|
+
const onRippleStart = (e) => {
|
|
396
|
+
if (rippleRef.current) {
|
|
397
|
+
rippleRef.current.start(e);
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
const onRippleStop = (e) => {
|
|
401
|
+
if (rippleRef.current) {
|
|
402
|
+
rippleRef.current.stop(e);
|
|
403
|
+
}
|
|
404
|
+
};
|
|
405
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
406
|
+
/* @__PURE__ */ jsxs(
|
|
407
|
+
"div",
|
|
408
|
+
{
|
|
409
|
+
role: "presentation",
|
|
410
|
+
ref: anchorRef,
|
|
411
|
+
onMouseDown: onRippleStart,
|
|
412
|
+
onMouseUp: onRippleStop,
|
|
413
|
+
className: clsx(
|
|
414
|
+
areasAdminClasses.areaChipRoot,
|
|
415
|
+
selected ? areasAdminClasses.selected : null,
|
|
416
|
+
disabled ? areasAdminClasses.disabled : null
|
|
417
|
+
),
|
|
418
|
+
onClick: (e) => {
|
|
419
|
+
handlerOnClick(e);
|
|
420
|
+
},
|
|
421
|
+
children: [
|
|
422
|
+
/* @__PURE__ */ jsx(TouchRipple, { ref: rippleRef, center: false, style: { position: "absolute", inset: "0" } }),
|
|
423
|
+
/* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaChipTitle, children: areaName })
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
),
|
|
427
|
+
isDesktop ? /* @__PURE__ */ jsxs("div", { className: areasAdminClasses.areaContainerChipEditButton, children: [
|
|
428
|
+
/* @__PURE__ */ jsx(
|
|
429
|
+
IconButton,
|
|
430
|
+
{
|
|
431
|
+
className: areasAdminClasses.areaChipEditButton,
|
|
432
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.EDIT_AREA}`,
|
|
433
|
+
size: "small",
|
|
434
|
+
onClick: (e) => {
|
|
435
|
+
handlerOpenPopoverEditArea(e);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
/* @__PURE__ */ jsx(
|
|
440
|
+
IconButton,
|
|
441
|
+
{
|
|
442
|
+
className: areasAdminClasses.areaChipDeleteButton,
|
|
443
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
|
|
444
|
+
size: "small",
|
|
445
|
+
onClick: (e) => {
|
|
446
|
+
onClickDeleteArea(e);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
] }) : /* @__PURE__ */ jsx(
|
|
451
|
+
ChipActionsMobile,
|
|
452
|
+
{
|
|
453
|
+
areaId,
|
|
454
|
+
handlerOpenPopoverEditArea
|
|
455
|
+
}
|
|
456
|
+
),
|
|
457
|
+
/* @__PURE__ */ jsx(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
role: "presentation",
|
|
461
|
+
onClick: (e) => {
|
|
462
|
+
e.stopPropagation();
|
|
463
|
+
},
|
|
464
|
+
children: /* @__PURE__ */ jsx(
|
|
465
|
+
Popover,
|
|
466
|
+
{
|
|
467
|
+
arrowType: "top-center",
|
|
468
|
+
open,
|
|
469
|
+
className: areasAdminClasses.areaEditPopover,
|
|
470
|
+
anchorEl: anchorRef.current,
|
|
471
|
+
anchorOrigin: { vertical: "bottom", horizontal: "center" },
|
|
472
|
+
transformOrigin: { vertical: "top", horizontal: "center" },
|
|
473
|
+
onClose: () => {
|
|
474
|
+
setFocus(false);
|
|
475
|
+
setOpen(false);
|
|
476
|
+
},
|
|
477
|
+
sx: {
|
|
478
|
+
mt: "10px",
|
|
479
|
+
...theme.components?.M4LAreasAdminEditPopover?.styleOverrides
|
|
480
|
+
},
|
|
481
|
+
children: /* @__PURE__ */ jsxs(
|
|
482
|
+
RHFormProvider,
|
|
483
|
+
{
|
|
484
|
+
onSubmit,
|
|
485
|
+
values: initialValues,
|
|
486
|
+
validationSchema,
|
|
487
|
+
children: [
|
|
488
|
+
/* @__PURE__ */ jsxs(EditAreaHeader, { children: [
|
|
489
|
+
/* @__PURE__ */ jsx(Typography, { children: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area)) }),
|
|
490
|
+
/* @__PURE__ */ jsx(
|
|
491
|
+
IconButton,
|
|
492
|
+
{
|
|
493
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CLOSE}`,
|
|
494
|
+
size: "small",
|
|
495
|
+
onClick: () => {
|
|
496
|
+
setFocus(false);
|
|
497
|
+
setOpen(false);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
)
|
|
501
|
+
] }),
|
|
502
|
+
/* @__PURE__ */ jsx(
|
|
503
|
+
RHFTextField,
|
|
504
|
+
{
|
|
505
|
+
name: "inputEditArea",
|
|
506
|
+
skeletonWidth: "70%",
|
|
507
|
+
skeletonHeight: "18px",
|
|
508
|
+
sx: { mt: "20px" }
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
/* @__PURE__ */ jsxs(Actions, { children: [
|
|
512
|
+
/* @__PURE__ */ jsx(
|
|
513
|
+
ActionCancel,
|
|
514
|
+
{
|
|
515
|
+
onClick: () => {
|
|
516
|
+
setOpen(false);
|
|
517
|
+
setFocus(false);
|
|
518
|
+
},
|
|
519
|
+
variant: "outlined",
|
|
520
|
+
skeletonWidth: "100%"
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ jsx(ActionIntro, { skeletonWidth: "100%" })
|
|
524
|
+
] })
|
|
525
|
+
]
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
}
|
|
531
|
+
)
|
|
532
|
+
] });
|
|
533
|
+
};
|
|
534
|
+
ChipMobile.displayName = "AreaButtons";
|
|
535
|
+
const AreaChipMobile = () => {
|
|
536
|
+
const areas = useAreasStore(
|
|
537
|
+
(state) => state.areasIds.map((a) => ({ id: a, name: state.hashAreas[a].name })),
|
|
538
|
+
shallow
|
|
539
|
+
);
|
|
540
|
+
const { selectArea } = useAreasStore((state) => state.areasActions);
|
|
541
|
+
const currentAreaId = useAreasStore((state) => state.currentAreaId, shallow);
|
|
542
|
+
const { addArea } = useAreasStore((state) => state.areasActions, shallow);
|
|
543
|
+
const { setFocus } = useAreasStore((state) => state.areaAdminActions, shallow);
|
|
544
|
+
const [anchorMenuAreas, setAnchorMenuAreas] = useState(null);
|
|
545
|
+
const { getLabel } = useModuleDictionary();
|
|
546
|
+
const theme = useTheme();
|
|
547
|
+
const currentArea = areas.find((area) => area.id === currentAreaId);
|
|
548
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
549
|
+
const menuActions = useMemo(
|
|
550
|
+
() => areas.filter((area) => area.id !== currentAreaId).map((area) => {
|
|
551
|
+
return {
|
|
552
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.LAYERS}`,
|
|
553
|
+
onClick: () => {
|
|
554
|
+
selectArea(area.id);
|
|
555
|
+
setFocus(false);
|
|
556
|
+
},
|
|
557
|
+
label: area.name
|
|
558
|
+
};
|
|
559
|
+
}),
|
|
560
|
+
[areas, currentAreaId]
|
|
561
|
+
);
|
|
562
|
+
const handlerSetAnchorMenuAreas = (element) => {
|
|
563
|
+
setFocus(false);
|
|
564
|
+
setAnchorMenuAreas(element);
|
|
565
|
+
};
|
|
566
|
+
return /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaChipMobileRoot, children: /* @__PURE__ */ jsxs("div", { className: areasAdminClasses.areaContainerContentChips, children: [
|
|
567
|
+
currentArea ? /* @__PURE__ */ jsx(
|
|
568
|
+
ChipMobile,
|
|
569
|
+
{
|
|
570
|
+
areaId: currentArea.id,
|
|
571
|
+
selected: true,
|
|
572
|
+
disabled: true,
|
|
573
|
+
setAnchorMenuAreas
|
|
574
|
+
},
|
|
575
|
+
currentArea.id
|
|
576
|
+
) : null,
|
|
577
|
+
menuActions.length >= 0 ? /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaChipMobileIconContainer, children: /* @__PURE__ */ jsx(
|
|
578
|
+
MenuActions,
|
|
579
|
+
{
|
|
580
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CHEVRON_DOWN}`,
|
|
581
|
+
arrowType: "no-arrow",
|
|
582
|
+
marginTop: "12px!important",
|
|
583
|
+
marginLeft: "14px!important",
|
|
584
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
585
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
586
|
+
menuActions,
|
|
587
|
+
externalOpen: anchorMenuAreas,
|
|
588
|
+
externalClose: handlerSetAnchorMenuAreas,
|
|
589
|
+
className: areasAdminClasses.areasPopoverMobileOptions,
|
|
590
|
+
menuActionSx: theme.components?.M4LAreasAdminMobilePopoverOptions?.styleOverrides,
|
|
591
|
+
endListElement: /* @__PURE__ */ jsx(
|
|
592
|
+
Button,
|
|
593
|
+
{
|
|
594
|
+
onClick: () => {
|
|
595
|
+
addArea();
|
|
596
|
+
setAnchorMenuAreas(null);
|
|
597
|
+
},
|
|
598
|
+
variant: "outlined",
|
|
599
|
+
startIcon: /* @__PURE__ */ jsx(
|
|
600
|
+
Icon,
|
|
601
|
+
{
|
|
602
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.ADD_AREA}`
|
|
603
|
+
}
|
|
604
|
+
),
|
|
605
|
+
children: getLabel(getAreasDictionary(DICCTIONARY.area_add_new))
|
|
606
|
+
}
|
|
607
|
+
)
|
|
608
|
+
}
|
|
609
|
+
) }) : null
|
|
610
|
+
] }) });
|
|
611
|
+
};
|
|
612
|
+
const PanelWindowPopUp = (props) => {
|
|
613
|
+
const { currentAreaId } = props;
|
|
614
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
615
|
+
const windowsLayouts = useAreasStore(
|
|
616
|
+
(state) => state.hashAreas[currentAreaId].layoutItemsIds.filter((li) => state.hashWindows[li].emergeType === "layout").map((lim) => {
|
|
617
|
+
const w = state.hashWindows[lim];
|
|
618
|
+
return {
|
|
619
|
+
i: w.windowId,
|
|
620
|
+
url_icon: w.url_icon,
|
|
621
|
+
title: w.title
|
|
622
|
+
};
|
|
623
|
+
}),
|
|
624
|
+
shallow
|
|
625
|
+
);
|
|
626
|
+
const theme = useTheme();
|
|
627
|
+
const { maximizeLayout } = useAreasStore((state) => state.areaActions);
|
|
628
|
+
const onTouched = (layoutId) => {
|
|
629
|
+
maximizeLayout(currentAreaId, layoutId);
|
|
630
|
+
};
|
|
631
|
+
const menuActions = windowsLayouts.map((element) => {
|
|
632
|
+
return {
|
|
633
|
+
onClick: () => onTouched(element.i),
|
|
634
|
+
label: element.title,
|
|
635
|
+
urlIcon: element.url_icon
|
|
636
|
+
};
|
|
637
|
+
});
|
|
638
|
+
return menuActions.length > 0 ? /* @__PURE__ */ jsx(
|
|
639
|
+
MenuActions,
|
|
640
|
+
{
|
|
641
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.LAYERS}`,
|
|
642
|
+
arrowType: "no-arrow",
|
|
643
|
+
marginTop: "12px!important",
|
|
644
|
+
marginLeft: "14px!important",
|
|
645
|
+
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
646
|
+
transformOrigin: { vertical: "top", horizontal: "right" },
|
|
647
|
+
menuActions,
|
|
648
|
+
className: areasAdminClasses.areasPopoverListWindows,
|
|
649
|
+
iconButtonClassName: areasAdminClasses.areasPopoverListWindowsIcon,
|
|
650
|
+
menuActionSx: theme.components?.M4LAreasAdminMobilePopoverOptions?.styleOverrides
|
|
651
|
+
}
|
|
652
|
+
) : null;
|
|
653
|
+
};
|
|
654
|
+
function AreasAdmin() {
|
|
655
|
+
const areas = useAreasStore((state) => state.areasIds, shallow);
|
|
656
|
+
const currentArea = useAreasStore((state) => state.currentAreaId, shallow);
|
|
657
|
+
const status = useAreasStore((state) => state.ownerState.status);
|
|
658
|
+
const { setFocus } = useAreasStore((state) => state.areaAdminActions, shallow);
|
|
659
|
+
const classesRoot = useAreasStore((state) => state.adminClasses.root);
|
|
660
|
+
const areasLength = useAreasStore((state) => state.areasIds.length);
|
|
661
|
+
const isDesktop = useResponsiveDesktop();
|
|
662
|
+
const { addArea } = useAreasStore((state) => state.areasActions, shallow);
|
|
663
|
+
const maximizedId = useAreasStore(
|
|
664
|
+
(state) => state.hashAreas[currentArea] ? state.hashAreas[currentArea].maximizedId : false,
|
|
665
|
+
shallow
|
|
666
|
+
);
|
|
667
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
668
|
+
const { getLabel } = useModuleDictionary();
|
|
669
|
+
const divRef = useRef(null);
|
|
670
|
+
const divRefOut = useRef(null);
|
|
671
|
+
const handleClickOutsideFn = () => {
|
|
672
|
+
setFocus(false);
|
|
673
|
+
};
|
|
674
|
+
useOnClickOutside(divRef, handleClickOutsideFn, divRefOut);
|
|
675
|
+
const rippleRef = useRef(null);
|
|
676
|
+
const onRippleStart = (e) => {
|
|
677
|
+
if (rippleRef.current) {
|
|
678
|
+
rippleRef.current.start(e);
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
const onRippleStop = (e) => {
|
|
682
|
+
if (rippleRef.current) {
|
|
683
|
+
rippleRef.current.stop(e);
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
if (status !== "loaded") {
|
|
687
|
+
return null;
|
|
688
|
+
}
|
|
689
|
+
return /* @__PURE__ */ jsx(
|
|
690
|
+
AreasAdminRoot,
|
|
691
|
+
{
|
|
692
|
+
ref: divRefOut,
|
|
693
|
+
onMouseDown: onRippleStart,
|
|
694
|
+
onMouseUp: onRippleStop,
|
|
695
|
+
className: classesRoot,
|
|
696
|
+
children: /* @__PURE__ */ jsxs(
|
|
697
|
+
"div",
|
|
698
|
+
{
|
|
699
|
+
role: "presentation",
|
|
700
|
+
ref: divRef,
|
|
701
|
+
className: areasAdminClasses.rootContent,
|
|
702
|
+
onClick: () => setFocus(true),
|
|
703
|
+
children: [
|
|
704
|
+
/* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaContainerChipsIcon, children: /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaContainerChips, children: /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaContainerContentChips, children: isDesktop ? /* @__PURE__ */ jsx(ScrollBar, { children: /* @__PURE__ */ jsx("div", { className: areasAdminClasses.areaContentChips, children: areas.map((area) => /* @__PURE__ */ jsx(
|
|
705
|
+
AreaChip,
|
|
706
|
+
{
|
|
707
|
+
areaId: area,
|
|
708
|
+
selected: area === currentArea,
|
|
709
|
+
disabled: areasLength === 1
|
|
710
|
+
},
|
|
711
|
+
area
|
|
712
|
+
)) }) }) : /* @__PURE__ */ jsx(AreaChipMobile, {}) }) }) }),
|
|
713
|
+
isDesktop ? /* @__PURE__ */ jsx(
|
|
714
|
+
IconButton,
|
|
715
|
+
{
|
|
716
|
+
className: areasAdminClasses.areasAddButton,
|
|
717
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.ADD_AREA}`,
|
|
718
|
+
size: "small",
|
|
719
|
+
onClick: addArea,
|
|
720
|
+
tooltip: getLabel(getAreasDictionary(DICCTIONARY.area_add_new))
|
|
721
|
+
}
|
|
722
|
+
) : null,
|
|
723
|
+
!isDesktop && maximizedId ? /* @__PURE__ */ jsx(PanelWindowPopUp, { currentAreaId: currentArea }) : null
|
|
724
|
+
]
|
|
725
|
+
}
|
|
726
|
+
)
|
|
727
|
+
}
|
|
728
|
+
);
|
|
729
|
+
}
|
|
730
|
+
export {
|
|
731
|
+
AreasAdmin as A,
|
|
732
|
+
useAreasAdminUtilityClasses as u
|
|
733
|
+
};
|