@m4l/components 0.1.83 → 0.1.85
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/@types/export.d.ts +25 -4
- package/components/AccountPopover/classes/index.d.ts +4 -0
- package/components/AccountPopover/classes/types.d.ts +4 -0
- package/components/AccountPopover/dictionary.d.ts +1 -0
- package/components/AccountPopover/{index.2677fe77.js → index.35c29a55.js} +86 -36
- package/components/AccountPopover/index.d.ts +1 -0
- package/components/AccountPopover/types.d.ts +2 -0
- package/components/AppBar/dictionary.d.ts +1 -0
- package/components/AppBar/{index.ad2a6f0e.js → index.291da9fd.js} +19 -11
- package/components/AppBar/index.d.ts +1 -0
- package/components/CommonActions/components/ActionCancel/{index.b2fc495d.js → index.67b91376.js} +1 -1
- package/components/CommonActions/components/ActionFormCancel/{index.60d8963e.js → index.d4503410.js} +17 -16
- package/components/CommonActions/components/ActionFormIntro/{index.fde4ea51.js → index.01ed67de.js} +1 -1
- package/components/CommonActions/components/ActionIntro/{index.724d8e17.js → index.53e7fe2b.js} +1 -1
- package/components/CommonActions/components/Actions/{index.23a2d6ae.js → index.c91c27f9.js} +15 -14
- package/components/DataGrid/{index.d5d0d62f.js → index.37e14e83.js} +14 -12
- package/components/DataGrid/subcomponents/Actions/{index.201394f5.js → index.155c63af.js} +47 -31
- package/components/DynamicFilter/{index.7d134537.js → index.a8c2609c.js} +29 -28
- package/components/GridLayout/constants.d.ts +1 -1
- package/components/GridLayout/{index.70085b00.js → index.2383aaf9.js} +86 -23
- package/components/GridLayout/index.d.ts +1 -1
- package/components/GridLayout/subcomponents/Griditem/{index.c09681ff.js → index.58168132.js} +1 -6
- package/components/GridLayout/subcomponents/Responsive/{index.eb04fd5e.js → index.a6642437.js} +1 -2
- package/components/GridLayout/types.d.ts +2 -2
- package/components/HelperText/{index.28e9105d.js → index.8b5911d1.js} +9 -8
- package/components/Icon/{index.2414ff25.js → index.c3a579e7.js} +1 -1
- package/components/LanguagePopover/{index.065e0296.js → index.7681b08e.js} +9 -8
- package/components/ModalDialog/{index.fb148f76.js → index.b85ee3cb.js} +4 -6
- package/components/NavLink/{index.2ef07c44.js → index.bb879650.js} +9 -8
- package/components/NoItemSelected/classes/constants.d.ts +1 -0
- package/components/NoItemSelected/classes/index.d.ts +6 -0
- package/components/NoItemSelected/classes/types.d.ts +6 -0
- package/components/NoItemSelected/{index.23dfc897.js → index.a2807715.js} +46 -31
- package/components/NoItemSelected/index.d.ts +2 -1
- package/components/NoItemSelected/types.d.ts +4 -0
- package/components/ObjectLogs/{index.5d74dfe0.js → index.2ed38a84.js} +22 -19
- package/components/PaperForm/{index.f931dc02.js → index.989377a5.js} +1 -1
- package/components/Period/{index.0e6512b2.js → index.061c9b2f.js} +16 -15
- package/components/PropertyValue/{index.a67c9916.js → index.ac46f441.js} +1 -1
- package/components/ScrollBar/{index.d4410cb5.js → index.1247c1c5.js} +38 -9
- package/components/SideBar/classes/index.d.ts +0 -1
- package/components/SideBar/classes/types.d.ts +0 -1
- package/components/SideBar/{index.72564ef2.js → index.e0587639.js} +131 -75
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/type.d.ts +5 -0
- package/components/areas/components/AreasAdmin/classes/index.d.ts +1 -1
- package/components/areas/components/AreasAdmin/classes/types.d.ts +3 -0
- package/components/areas/components/AreasAdmin/index.d.ts +2 -2
- package/components/areas/components/AreasAdmin/index.f505897a.js +767 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/subcomponents/ChipActionsMobile/types.d.ts +2 -1
- package/components/areas/components/AreasAdmin/subcomponents/AreaChip/types.d.ts +2 -0
- package/components/areas/components/AreasAdmin/subcomponents/AreaChipMobile/subcomponents/ChipMobile/ChipMobile.d.ts +6 -0
- package/components/areas/components/AreasViewer/classes/index.d.ts +1 -1
- package/components/areas/components/AreasViewer/classes/types.d.ts +1 -0
- package/components/areas/components/AreasViewer/{index.9ed7dfd7.js → index.cacec884.js} +77 -52
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/index.d.ts +2 -2
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/subcomponents/ResizeHandle/index.d.ts +4 -0
- package/components/areas/components/index.6d5dfeec.js +31 -0
- package/components/areas/contexts/AreasContext/helper.d.ts +10 -3
- package/components/areas/contexts/AreasContext/{index.36fe6953.js → index.6f56b1da.js} +103 -80
- package/components/areas/contexts/AreasContext/types.d.ts +28 -8
- package/components/areas/contexts/{index.68c53fc9.js → index.999e8b1e.js} +1 -1
- package/components/areas/hooks/useAreas/{index.a4c03e23.js → index.4baec91c.js} +1 -1
- package/components/areas/index.3088f99e.js +54 -0
- package/components/areas/utils/useOnClickOutside/index.d.ts +4 -0
- package/components/formatters/BooleanFormatter/{index.32de0803.js → index.e7f0b76a.js} +1 -1
- package/components/formatters/{index.d16d2331.js → index.d911949d.js} +2 -2
- package/components/hook-form/RHFAutocomplete/{index.42df8eb4.js → index.aca6984f.js} +11 -9
- package/components/hook-form/RHFAutocompleteAsync/{index.0441524c.js → index.8511bcf8.js} +1 -1
- package/components/hook-form/RHFCheckbox/{index.c66147f7.js → index.0f45e6b0.js} +10 -9
- package/components/hook-form/RHFDateTime/{index.4698ca29.js → index.07412ef0.js} +10 -9
- package/components/hook-form/RHFPeriod/{index.f653934b.js → index.15b8f11e.js} +2 -2
- package/components/hook-form/RHFTextField/{index.1fa07688.js → index.94c8c59b.js} +3 -3
- package/components/hook-form/RHFUpload/{index.93c2dcb5.js → index.7ef1e124.js} +10 -9
- package/components/modal/{WindowBase.92ce9b8f.js → WindowBase.d485315d.js} +17 -12
- package/components/modal/{WindowConfirm.4c3d2cd7.js → WindowConfirm.3d9cd6e1.js} +18 -17
- package/components/modal/{index.1bd35bd5.js → index.c7e4beba.js} +15 -14
- package/components/mui_extended/Accordion/{index.5111314b.js → index.854f4c90.js} +3 -3
- package/components/mui_extended/Badge/classes/constants.d.ts +1 -1
- package/components/mui_extended/Badge/{index.cad260fe.js → index.8c2b8b66.js} +1 -1
- package/components/mui_extended/CheckBox/CheckBox.d.ts +1 -1
- package/components/mui_extended/{CheckBox.5f6c78b0.js → CheckBox.38abccd8.js} +5 -3
- package/components/mui_extended/IconButton/{index.a318316e.js → index.be111a34.js} +2 -12
- package/components/mui_extended/MenuActions/{index.f6bfdd40.js → index.b16e84c1.js} +26 -8
- package/components/mui_extended/MenuActions/types.d.ts +3 -0
- package/components/mui_extended/Pager/{index.da26e9d4.js → index.5b77fa4c.js} +84 -82
- package/components/mui_extended/Pager/subcomponents/CustomTablePagination/index.d.ts +5 -0
- package/components/mui_extended/Pager/subcomponents/CustomTablePagination/types.d.ts +1 -4
- package/components/mui_extended/Stack/Stack.d.ts +3 -0
- package/components/mui_extended/Stack/classes/constants.d.ts +1 -0
- package/components/mui_extended/Stack/classes/index.d.ts +6 -0
- package/components/mui_extended/Stack/classes/types.d.ts +6 -0
- package/components/mui_extended/Stack/index.0e53197c.js +39 -0
- package/components/mui_extended/Stack/index.d.ts +2 -0
- package/components/mui_extended/Stack/types.d.ts +2 -0
- package/components/mui_extended/Tab/{index.0989d15d.js → index.c1dc7bbf.js} +42 -9
- package/components/mui_extended/Tabs/Tabs.d.ts +3 -0
- package/components/mui_extended/Tabs/classes/constants.d.ts +1 -0
- package/components/mui_extended/Tabs/classes/index.d.ts +6 -0
- package/components/mui_extended/Tabs/classes/types.d.ts +6 -0
- package/components/mui_extended/Tabs/index.d.ts +1 -0
- package/components/mui_extended/index.d.ts +2 -0
- package/components/mui_extended/{index.813723c5.js → index.d1ee9a6a.js} +9 -8
- package/contexts/ModalContext/{index.577bf36b.js → index.1ea79d7e.js} +1 -1
- package/contexts/RHFormContext/{index.b9266262.js → index.e019f87d.js} +1 -1
- package/hooks/useModal/{index.7a07c208.js → index.c906706c.js} +1 -1
- package/index.js +81 -75
- package/package.json +1 -1
- package/{vendor.5365cc7e.js → vendor.f27b86c9.js} +51 -51
- package/components/GridLayout/subcomponents/SizeProvider/index.9c5e80b2.js +0 -65
- package/components/areas/components/AreasAdmin/index.7bfec13f.js +0 -487
- package/components/areas/components/index.654b08aa.js +0 -30
- package/components/areas/index.ec4f088c.js +0 -32
- /package/components/GridLayout/subcomponents/{SizeProvider → WidthProvider}/index.d.ts +0 -0
- /package/components/areas/components/AreasAdmin/subcomponents/{AreaChipMobile/subcomponents/PanelWindowPopUp → PanelWindowPopUp}/index.d.ts +0 -0
- /package/components/areas/components/AreasAdmin/subcomponents/{AreaChipMobile/subcomponents/PanelWindowPopUp → PanelWindowPopUp}/types.d.ts +0 -0
|
@@ -0,0 +1,767 @@
|
|
|
1
|
+
import { I as IconButton } from "../../../mui_extended/IconButton/index.be111a34.js";
|
|
2
|
+
import { u as useAreasStore } from "../../hooks/useAreas/index.4baec91c.js";
|
|
3
|
+
import { useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
4
|
+
import { useState, useRef, useMemo } from "react";
|
|
5
|
+
import * as Yup from "yup";
|
|
6
|
+
import { generateUtilityClasses, useTheme } from "@mui/material";
|
|
7
|
+
import "../../../mui_extended/Accordion/index.854f4c90.js";
|
|
8
|
+
import { I as Icon } from "../../../Icon/index.c3a579e7.js";
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
11
|
+
import { T as Typography } from "../../../mui_extended/Typography/index.443590d6.js";
|
|
12
|
+
import "../../../mui_extended/Avatar/index.75e6ed57.js";
|
|
13
|
+
import "react-router-dom";
|
|
14
|
+
import "@mui/material/Button";
|
|
15
|
+
import { B as Button } from "../../../mui_extended/Button/index.40af964e.js";
|
|
16
|
+
import "../../../mui_extended/CheckBox.38abccd8.js";
|
|
17
|
+
import "../../../mui_extended/Badge/index.8c2b8b66.js";
|
|
18
|
+
import "../../../Image/index.c18ebf5a.js";
|
|
19
|
+
import "@mui/lab";
|
|
20
|
+
import { M as MenuActions } from "../../../mui_extended/MenuActions/index.b16e84c1.js";
|
|
21
|
+
import { P as Popover } from "../../../mui_extended/Popover/index.9f35d0eb.js";
|
|
22
|
+
import "../../../mui_extended/Stack/index.0e53197c.js";
|
|
23
|
+
import "../../../mui_extended/Tab/index.c1dc7bbf.js";
|
|
24
|
+
import "../../../mui_extended/Pager/index.5b77fa4c.js";
|
|
25
|
+
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
26
|
+
import "../../../mui_extended/Tooltip/index.5a795dcd.js";
|
|
27
|
+
import { unstable_composeClasses } from "@mui/base";
|
|
28
|
+
import { g as getComponentUtilityClass } from "../../../../utils/index.c43a95f4.js";
|
|
29
|
+
import { A as AREAS_ADMIN_CLASS_NAME } from "../../constants.66529246.js";
|
|
30
|
+
import { I as ICONS } from "../../icons.8266ccc8.js";
|
|
31
|
+
import "../../contexts/DynamicMFParmsContext/index.1607c78e.js";
|
|
32
|
+
import "../../../../contexts/ModalContext/index.1ea79d7e.js";
|
|
33
|
+
import { R as RHFormProvider } from "../../../../contexts/RHFormContext/index.e019f87d.js";
|
|
34
|
+
import "react-hook-form";
|
|
35
|
+
import "../../../hook-form/RHFAutocomplete/index.aca6984f.js";
|
|
36
|
+
import "../../../HelperText/index.8b5911d1.js";
|
|
37
|
+
import "lodash/debounce";
|
|
38
|
+
import "../../../hook-form/RHFAutocompleteAsync/index.8511bcf8.js";
|
|
39
|
+
import "../../../hook-form/RHFCheckbox/index.0f45e6b0.js";
|
|
40
|
+
import "@mui/x-date-pickers";
|
|
41
|
+
import "../../../hook-form/RHFDateTime/index.07412ef0.js";
|
|
42
|
+
import { R as RHFTextField } from "../../../hook-form/RHFTextField/index.94c8c59b.js";
|
|
43
|
+
import "../../../hook-form/RHFPeriod/index.15b8f11e.js";
|
|
44
|
+
import "../../../Period/index.061c9b2f.js";
|
|
45
|
+
import { A as Actions } from "../../../CommonActions/components/Actions/index.c91c27f9.js";
|
|
46
|
+
import { A as ActionCancel } from "../../../CommonActions/components/ActionCancel/index.67b91376.js";
|
|
47
|
+
import { A as ActionIntro } from "../../../CommonActions/components/ActionIntro/index.53e7fe2b.js";
|
|
48
|
+
import "../../../../react-draggable.7abb5d0a.js";
|
|
49
|
+
import "../../../Resizeable/index.9a9c79a4.js";
|
|
50
|
+
import "../../../modal/index.c7e4beba.js";
|
|
51
|
+
import { shallow } from "zustand/shallow";
|
|
52
|
+
import { styled } from "@mui/material/styles";
|
|
53
|
+
import { S as ScrollBar } from "../../../ScrollBar/index.1247c1c5.js";
|
|
54
|
+
import { g as getAreasDictionary, D as DICCTIONARY } from "../../dictionary.afb7e3d9.js";
|
|
55
|
+
import TouchRipple from "@mui/material/ButtonBase/TouchRipple";
|
|
56
|
+
import "../AreasViewer/index.cacec884.js";
|
|
57
|
+
import "../../../LinearProgressIndeterminate/index.60dabc06.js";
|
|
58
|
+
import "../../contexts/AreasContext/index.6f56b1da.js";
|
|
59
|
+
import "../../contexts/WindowToolsMFContext/index.8f3e2a04.js";
|
|
60
|
+
import "zustand";
|
|
61
|
+
import "lodash/isString";
|
|
62
|
+
import "react-dropzone";
|
|
63
|
+
import "../../../hook-form/RHFUpload/index.7ef1e124.js";
|
|
64
|
+
import { u as useOnClickOutside } from "../../index.3088f99e.js";
|
|
65
|
+
const areasAdminClasses = generateUtilityClasses(AREAS_ADMIN_CLASS_NAME, [
|
|
66
|
+
"root",
|
|
67
|
+
"rootContent",
|
|
68
|
+
"areaChipRoot",
|
|
69
|
+
"areaChipTitle",
|
|
70
|
+
"areaChipDeleteButton",
|
|
71
|
+
"areasAddButton",
|
|
72
|
+
"areaContainerChipEditButton",
|
|
73
|
+
"areaContainerChips",
|
|
74
|
+
"areaContainerContentChips",
|
|
75
|
+
"areaContainerChipsIcon",
|
|
76
|
+
"areaEditPopover",
|
|
77
|
+
"areaChipMobileRoot",
|
|
78
|
+
"areaChipMobileIconContainer",
|
|
79
|
+
"areaIconLayer",
|
|
80
|
+
"areaIconLayerContent",
|
|
81
|
+
"areaChipEditButton",
|
|
82
|
+
"areasPopoverMobileOptions",
|
|
83
|
+
"areasPopoverListWindows",
|
|
84
|
+
"areasPopoverListWindowsIcon",
|
|
85
|
+
"selected",
|
|
86
|
+
"isMobile",
|
|
87
|
+
"disabled",
|
|
88
|
+
"isFocus"
|
|
89
|
+
], AREAS_ADMIN_CLASS_NAME);
|
|
90
|
+
const useAreasAdminUtilityClasses = (ownerState) => {
|
|
91
|
+
const slots = {
|
|
92
|
+
root: ["root", ownerState.status, ownerState.isMobile && "isMobile", ownerState.isSkeleton && "isSkeleton", ownerState.focus && "isFocus"],
|
|
93
|
+
rootContent: ["rootContent"],
|
|
94
|
+
areaChipRoot: ["areaChipRoot"],
|
|
95
|
+
areaIconLayer: ["areaIconLayer"],
|
|
96
|
+
areaContainerChipsIcon: ["areaContainerChipsIcon"],
|
|
97
|
+
areaContainerChips: ["areaContainerChips"],
|
|
98
|
+
areaContainerContentChips: ["areaContainerContentChips"],
|
|
99
|
+
areaEditPopover: ["areaEditPopover"],
|
|
100
|
+
areaChipMobileRoot: ["areaChipMobileRoot"],
|
|
101
|
+
areaChipMobileIconContainer: ["areaChipMobileIconContainer"],
|
|
102
|
+
areaChipTitle: ["areaChipTitle"],
|
|
103
|
+
areaContainerChipEditButton: ["areaContainerChipEditButton"],
|
|
104
|
+
areaChipDeleteButton: ["areaChipDeleteButton"],
|
|
105
|
+
areaChipEditButton: ["areaChipEditButton"],
|
|
106
|
+
areasAddButton: ["areasAddButton"],
|
|
107
|
+
areasPopoverMobileOptions: ["areasPopoverMobileOptions"],
|
|
108
|
+
areasPopoverListWindows: ["areasPopoverListWindows"],
|
|
109
|
+
areasPopoverListWindowsIcon: ["areasPopoverListWindowsIcon"]
|
|
110
|
+
};
|
|
111
|
+
return unstable_composeClasses(slots, getComponentUtilityClass(AREAS_ADMIN_CLASS_NAME), {});
|
|
112
|
+
};
|
|
113
|
+
styled("div")(() => ({
|
|
114
|
+
display: "flex",
|
|
115
|
+
flexDirection: "row",
|
|
116
|
+
border: "1px solid gray",
|
|
117
|
+
"&.active": {
|
|
118
|
+
border: "1px solid red"
|
|
119
|
+
}
|
|
120
|
+
}));
|
|
121
|
+
styled("div")(({
|
|
122
|
+
theme
|
|
123
|
+
}) => ({
|
|
124
|
+
height: "100%",
|
|
125
|
+
width: theme.spacing(1),
|
|
126
|
+
backgroundColor: theme.palette.background.default,
|
|
127
|
+
"&.active": {
|
|
128
|
+
backgroundColor: theme.palette.primary.main
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
const EditAreaHeader = styled("div")(({
|
|
132
|
+
theme
|
|
133
|
+
}) => ({
|
|
134
|
+
display: "flex",
|
|
135
|
+
width: "100%",
|
|
136
|
+
height: "25px",
|
|
137
|
+
borderBottom: "1px solid",
|
|
138
|
+
borderColor: theme.palette.state.default,
|
|
139
|
+
justifyContent: "space-between",
|
|
140
|
+
alignItems: "center"
|
|
141
|
+
}));
|
|
142
|
+
const ChipActionsMobile = (props) => {
|
|
143
|
+
const {
|
|
144
|
+
handlerOpenPopoverEditArea,
|
|
145
|
+
areaId
|
|
146
|
+
} = props;
|
|
147
|
+
const {
|
|
148
|
+
deleteArea
|
|
149
|
+
} = useAreasStore((state) => state.areasActions);
|
|
150
|
+
const {
|
|
151
|
+
setFocus
|
|
152
|
+
} = useAreasStore((state) => state.areaAdminActions, shallow);
|
|
153
|
+
const listAreas = useAreasStore((state) => state.areasIds, shallow);
|
|
154
|
+
const {
|
|
155
|
+
host_static_assets,
|
|
156
|
+
environment_assets
|
|
157
|
+
} = useEnvironment();
|
|
158
|
+
const {
|
|
159
|
+
getLabel
|
|
160
|
+
} = useModuleDictionary();
|
|
161
|
+
const menuActions = [{
|
|
162
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.EDIT_AREA}`,
|
|
163
|
+
onClick: handlerOpenPopoverEditArea,
|
|
164
|
+
label: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area))
|
|
165
|
+
}];
|
|
166
|
+
if (listAreas.length > 1) {
|
|
167
|
+
menuActions.push({
|
|
168
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
|
|
169
|
+
onClick: () => {
|
|
170
|
+
deleteArea(areaId);
|
|
171
|
+
setFocus(false);
|
|
172
|
+
},
|
|
173
|
+
label: getLabel(getAreasDictionary(DICCTIONARY.label_delete_area))
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return /* @__PURE__ */ jsx(MenuActions, {
|
|
177
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.SHOW_OPTIONS}`,
|
|
178
|
+
arrowType: "no-arrow",
|
|
179
|
+
marginTop: "12px",
|
|
180
|
+
anchorOrigin: {
|
|
181
|
+
vertical: "bottom",
|
|
182
|
+
horizontal: "right"
|
|
183
|
+
},
|
|
184
|
+
transformOrigin: {
|
|
185
|
+
vertical: "top",
|
|
186
|
+
horizontal: "right"
|
|
187
|
+
},
|
|
188
|
+
menuActions,
|
|
189
|
+
externalClose: () => setFocus(false)
|
|
190
|
+
});
|
|
191
|
+
};
|
|
192
|
+
const AreaChip = (props) => {
|
|
193
|
+
const {
|
|
194
|
+
areaId,
|
|
195
|
+
selected,
|
|
196
|
+
disabled,
|
|
197
|
+
setAnchorMenuAreas
|
|
198
|
+
} = props;
|
|
199
|
+
const {
|
|
200
|
+
host_static_assets,
|
|
201
|
+
environment_assets
|
|
202
|
+
} = useEnvironment();
|
|
203
|
+
const {
|
|
204
|
+
deleteArea,
|
|
205
|
+
selectArea,
|
|
206
|
+
editArea
|
|
207
|
+
} = useAreasStore((state) => state.areasActions);
|
|
208
|
+
const {
|
|
209
|
+
setFocus
|
|
210
|
+
} = useAreasStore((state) => state.areaAdminActions);
|
|
211
|
+
const areaName = useAreasStore((state) => state.hashAreas[areaId].name, shallow);
|
|
212
|
+
const listAreas = useAreasStore((state) => state.areasIds, shallow);
|
|
213
|
+
const [open, setOpen] = useState(false);
|
|
214
|
+
const {
|
|
215
|
+
getLabel
|
|
216
|
+
} = useModuleDictionary();
|
|
217
|
+
const isDesktop = useResponsiveDesktop();
|
|
218
|
+
const anchorRef = useRef(null);
|
|
219
|
+
const theme = useTheme();
|
|
220
|
+
const onClickDeleteArea = (e) => {
|
|
221
|
+
console.log("listAreas", listAreas);
|
|
222
|
+
if (listAreas.length > 1) {
|
|
223
|
+
e.stopPropagation();
|
|
224
|
+
setFocus(true);
|
|
225
|
+
deleteArea(areaId);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const onSubmit = (data) => {
|
|
229
|
+
editArea(areaId, data.inputEditArea);
|
|
230
|
+
setOpen(false);
|
|
231
|
+
setFocus(false);
|
|
232
|
+
};
|
|
233
|
+
const handlerOpenPopoverEditArea = (e) => {
|
|
234
|
+
e?.stopPropagation();
|
|
235
|
+
setFocus(true);
|
|
236
|
+
setOpen(true);
|
|
237
|
+
};
|
|
238
|
+
const initialValues = {
|
|
239
|
+
inputEditArea: areaName
|
|
240
|
+
};
|
|
241
|
+
const validationSchema = useMemo(() => Yup.object().shape({
|
|
242
|
+
inputEditArea: Yup.string().required(getLabel(getAreasDictionary(DICCTIONARY.validation_edit_area)))
|
|
243
|
+
}), [getLabel]);
|
|
244
|
+
const handlerOnClick = (e) => {
|
|
245
|
+
console.log("evento de handlerOnClick");
|
|
246
|
+
setAnchorMenuAreas && setAnchorMenuAreas(e.currentTarget);
|
|
247
|
+
selectArea(areaId);
|
|
248
|
+
};
|
|
249
|
+
const rippleRef = useRef(null);
|
|
250
|
+
const onRippleStart = (e) => {
|
|
251
|
+
if (rippleRef.current) {
|
|
252
|
+
rippleRef.current.start(e);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
const onRippleStop = (e) => {
|
|
256
|
+
if (rippleRef.current) {
|
|
257
|
+
rippleRef.current.stop(e);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
261
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
262
|
+
role: "presentation",
|
|
263
|
+
ref: anchorRef,
|
|
264
|
+
onMouseDown: onRippleStart,
|
|
265
|
+
onMouseUp: onRippleStop,
|
|
266
|
+
className: clsx(areasAdminClasses.areaChipRoot, selected ? areasAdminClasses.selected : null, disabled ? areasAdminClasses.disabled : null),
|
|
267
|
+
onClick: (e) => {
|
|
268
|
+
handlerOnClick(e);
|
|
269
|
+
},
|
|
270
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
271
|
+
className: areasAdminClasses.areaChipTitle,
|
|
272
|
+
children: areaName
|
|
273
|
+
}), isDesktop ? /* @__PURE__ */ jsxs("div", {
|
|
274
|
+
className: areasAdminClasses.areaContainerChipEditButton,
|
|
275
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
276
|
+
className: areasAdminClasses.areaChipEditButton,
|
|
277
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.EDIT_AREA}`,
|
|
278
|
+
size: "extraSmall",
|
|
279
|
+
onClick: (e) => {
|
|
280
|
+
handlerOpenPopoverEditArea(e);
|
|
281
|
+
}
|
|
282
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
283
|
+
className: areasAdminClasses.areaChipDeleteButton,
|
|
284
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
|
|
285
|
+
size: "extraSmall",
|
|
286
|
+
onClick: (e) => {
|
|
287
|
+
onClickDeleteArea(e);
|
|
288
|
+
}
|
|
289
|
+
})]
|
|
290
|
+
}) : /* @__PURE__ */ jsx(ChipActionsMobile, {
|
|
291
|
+
areaId,
|
|
292
|
+
handlerOpenPopoverEditArea
|
|
293
|
+
})]
|
|
294
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
295
|
+
onClick: (e) => {
|
|
296
|
+
e.stopPropagation();
|
|
297
|
+
},
|
|
298
|
+
children: /* @__PURE__ */ jsx(Popover, {
|
|
299
|
+
arrowType: "top-center",
|
|
300
|
+
open,
|
|
301
|
+
className: areasAdminClasses.areaEditPopover,
|
|
302
|
+
anchorEl: anchorRef.current,
|
|
303
|
+
anchorOrigin: {
|
|
304
|
+
vertical: "bottom",
|
|
305
|
+
horizontal: "center"
|
|
306
|
+
},
|
|
307
|
+
transformOrigin: {
|
|
308
|
+
vertical: "top",
|
|
309
|
+
horizontal: "center"
|
|
310
|
+
},
|
|
311
|
+
onClose: () => {
|
|
312
|
+
setFocus(false);
|
|
313
|
+
setOpen(false);
|
|
314
|
+
},
|
|
315
|
+
sx: {
|
|
316
|
+
mt: "10px",
|
|
317
|
+
...theme.components?.M4LAreasAdminEditPopover?.styleOverrides
|
|
318
|
+
},
|
|
319
|
+
children: /* @__PURE__ */ jsxs(RHFormProvider, {
|
|
320
|
+
onSubmit,
|
|
321
|
+
values: initialValues,
|
|
322
|
+
validationSchema,
|
|
323
|
+
children: [/* @__PURE__ */ jsxs(EditAreaHeader, {
|
|
324
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
325
|
+
children: getLabel(DICCTIONARY.label_edit_area)
|
|
326
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
327
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CLOSE}`,
|
|
328
|
+
size: "small",
|
|
329
|
+
onClick: () => {
|
|
330
|
+
setFocus(false);
|
|
331
|
+
setOpen(false);
|
|
332
|
+
}
|
|
333
|
+
})]
|
|
334
|
+
}), /* @__PURE__ */ jsx(RHFTextField, {
|
|
335
|
+
name: "inputEditArea",
|
|
336
|
+
skeletonWidth: "70%",
|
|
337
|
+
skeletonHeight: "18px",
|
|
338
|
+
sx: {
|
|
339
|
+
mt: "20px"
|
|
340
|
+
}
|
|
341
|
+
}), /* @__PURE__ */ jsxs(Actions, {
|
|
342
|
+
children: [/* @__PURE__ */ jsx(ActionCancel, {
|
|
343
|
+
onClick: () => {
|
|
344
|
+
setOpen(false);
|
|
345
|
+
setFocus(false);
|
|
346
|
+
},
|
|
347
|
+
variant: "outlined",
|
|
348
|
+
skeletonWidth: "100%"
|
|
349
|
+
}), /* @__PURE__ */ jsx(ActionIntro, {
|
|
350
|
+
skeletonWidth: "100%"
|
|
351
|
+
})]
|
|
352
|
+
})]
|
|
353
|
+
})
|
|
354
|
+
})
|
|
355
|
+
})]
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
AreaChip.displayName = "AreaButtons";
|
|
359
|
+
const AreasAdminRoot = styled("div")`
|
|
360
|
+
display: flex;
|
|
361
|
+
position: relative;
|
|
362
|
+
background-color: transparent;
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
//areaRoot
|
|
367
|
+
& .${areasAdminClasses.areaChipRoot} {
|
|
368
|
+
display: flex;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
${(props) => props.theme.components?.M4LAreasAdmin?.styleOverrides}
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
`;
|
|
376
|
+
const ChipMobile = (props) => {
|
|
377
|
+
const {
|
|
378
|
+
areaId,
|
|
379
|
+
selected,
|
|
380
|
+
disabled,
|
|
381
|
+
setAnchorMenuAreas
|
|
382
|
+
} = props;
|
|
383
|
+
const {
|
|
384
|
+
host_static_assets,
|
|
385
|
+
environment_assets
|
|
386
|
+
} = useEnvironment();
|
|
387
|
+
const {
|
|
388
|
+
deleteArea,
|
|
389
|
+
selectArea,
|
|
390
|
+
editArea
|
|
391
|
+
} = useAreasStore((state) => state.areasActions);
|
|
392
|
+
const {
|
|
393
|
+
setFocus
|
|
394
|
+
} = useAreasStore((state) => state.areaAdminActions);
|
|
395
|
+
const areaName = useAreasStore((state) => state.hashAreas[areaId].name, shallow);
|
|
396
|
+
const listAreas = useAreasStore((state) => state.areasIds, shallow);
|
|
397
|
+
const [open, setOpen] = useState(false);
|
|
398
|
+
const {
|
|
399
|
+
getLabel
|
|
400
|
+
} = useModuleDictionary();
|
|
401
|
+
const isDesktop = useResponsiveDesktop();
|
|
402
|
+
const anchorRef = useRef(null);
|
|
403
|
+
const theme = useTheme();
|
|
404
|
+
const onClickDeleteArea = (e) => {
|
|
405
|
+
console.log("listAreas", listAreas);
|
|
406
|
+
if (listAreas.length > 1) {
|
|
407
|
+
e.stopPropagation();
|
|
408
|
+
setFocus(true);
|
|
409
|
+
deleteArea(areaId);
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
const onSubmit = (data) => {
|
|
413
|
+
editArea(areaId, data.inputEditArea);
|
|
414
|
+
setOpen(false);
|
|
415
|
+
setFocus(false);
|
|
416
|
+
};
|
|
417
|
+
const handlerOpenPopoverEditArea = (e) => {
|
|
418
|
+
e?.stopPropagation();
|
|
419
|
+
setFocus(true);
|
|
420
|
+
setOpen(true);
|
|
421
|
+
};
|
|
422
|
+
const initialValues = {
|
|
423
|
+
inputEditArea: areaName
|
|
424
|
+
};
|
|
425
|
+
const validationSchema = useMemo(() => Yup.object().shape({
|
|
426
|
+
inputEditArea: Yup.string().required(getLabel(getAreasDictionary(DICCTIONARY.validation_edit_area)))
|
|
427
|
+
}), [getLabel]);
|
|
428
|
+
const handlerOnClick = (e) => {
|
|
429
|
+
console.log("evento de handlerOnClick");
|
|
430
|
+
setAnchorMenuAreas && setAnchorMenuAreas(e.currentTarget);
|
|
431
|
+
selectArea(areaId);
|
|
432
|
+
};
|
|
433
|
+
const rippleRef = useRef(null);
|
|
434
|
+
const onRippleStart = (e) => {
|
|
435
|
+
if (rippleRef.current) {
|
|
436
|
+
rippleRef.current.start(e);
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
const onRippleStop = (e) => {
|
|
440
|
+
if (rippleRef.current) {
|
|
441
|
+
rippleRef.current.stop(e);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
445
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
446
|
+
role: "presentation",
|
|
447
|
+
ref: anchorRef,
|
|
448
|
+
onMouseDown: onRippleStart,
|
|
449
|
+
onMouseUp: onRippleStop,
|
|
450
|
+
className: clsx(areasAdminClasses.areaChipRoot, selected ? areasAdminClasses.selected : null, disabled ? areasAdminClasses.disabled : null),
|
|
451
|
+
onClick: (e) => {
|
|
452
|
+
handlerOnClick(e);
|
|
453
|
+
},
|
|
454
|
+
children: [/* @__PURE__ */ jsx(TouchRipple, {
|
|
455
|
+
ref: rippleRef,
|
|
456
|
+
center: false,
|
|
457
|
+
style: {
|
|
458
|
+
position: "absolute",
|
|
459
|
+
inset: "0"
|
|
460
|
+
}
|
|
461
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
462
|
+
className: areasAdminClasses.areaChipTitle,
|
|
463
|
+
children: areaName
|
|
464
|
+
})]
|
|
465
|
+
}), isDesktop ? /* @__PURE__ */ jsxs("div", {
|
|
466
|
+
className: areasAdminClasses.areaContainerChipEditButton,
|
|
467
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
468
|
+
className: areasAdminClasses.areaChipEditButton,
|
|
469
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.EDIT_AREA}`,
|
|
470
|
+
size: "extraSmall",
|
|
471
|
+
onClick: (e) => {
|
|
472
|
+
handlerOpenPopoverEditArea(e);
|
|
473
|
+
}
|
|
474
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
475
|
+
className: areasAdminClasses.areaChipDeleteButton,
|
|
476
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
|
|
477
|
+
size: "extraSmall",
|
|
478
|
+
onClick: (e) => {
|
|
479
|
+
onClickDeleteArea(e);
|
|
480
|
+
}
|
|
481
|
+
})]
|
|
482
|
+
}) : /* @__PURE__ */ jsx(ChipActionsMobile, {
|
|
483
|
+
areaId,
|
|
484
|
+
handlerOpenPopoverEditArea
|
|
485
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
486
|
+
role: "presentation",
|
|
487
|
+
onClick: (e) => {
|
|
488
|
+
e.stopPropagation();
|
|
489
|
+
},
|
|
490
|
+
children: /* @__PURE__ */ jsx(Popover, {
|
|
491
|
+
arrowType: "top-center",
|
|
492
|
+
open,
|
|
493
|
+
className: areasAdminClasses.areaEditPopover,
|
|
494
|
+
anchorEl: anchorRef.current,
|
|
495
|
+
anchorOrigin: {
|
|
496
|
+
vertical: "bottom",
|
|
497
|
+
horizontal: "center"
|
|
498
|
+
},
|
|
499
|
+
transformOrigin: {
|
|
500
|
+
vertical: "top",
|
|
501
|
+
horizontal: "center"
|
|
502
|
+
},
|
|
503
|
+
onClose: () => {
|
|
504
|
+
setFocus(false);
|
|
505
|
+
setOpen(false);
|
|
506
|
+
},
|
|
507
|
+
sx: {
|
|
508
|
+
mt: "10px",
|
|
509
|
+
...theme.components?.M4LAreasAdminEditPopover?.styleOverrides
|
|
510
|
+
},
|
|
511
|
+
children: /* @__PURE__ */ jsxs(RHFormProvider, {
|
|
512
|
+
onSubmit,
|
|
513
|
+
values: initialValues,
|
|
514
|
+
validationSchema,
|
|
515
|
+
children: [/* @__PURE__ */ jsxs(EditAreaHeader, {
|
|
516
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
517
|
+
children: getLabel(DICCTIONARY.label_edit_area)
|
|
518
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
519
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CLOSE}`,
|
|
520
|
+
size: "small",
|
|
521
|
+
onClick: () => {
|
|
522
|
+
setFocus(false);
|
|
523
|
+
setOpen(false);
|
|
524
|
+
}
|
|
525
|
+
})]
|
|
526
|
+
}), /* @__PURE__ */ jsx(RHFTextField, {
|
|
527
|
+
name: "inputEditArea",
|
|
528
|
+
skeletonWidth: "70%",
|
|
529
|
+
skeletonHeight: "18px",
|
|
530
|
+
sx: {
|
|
531
|
+
mt: "20px"
|
|
532
|
+
}
|
|
533
|
+
}), /* @__PURE__ */ jsxs(Actions, {
|
|
534
|
+
children: [/* @__PURE__ */ jsx(ActionCancel, {
|
|
535
|
+
onClick: () => {
|
|
536
|
+
setOpen(false);
|
|
537
|
+
setFocus(false);
|
|
538
|
+
},
|
|
539
|
+
variant: "outlined",
|
|
540
|
+
skeletonWidth: "100%"
|
|
541
|
+
}), /* @__PURE__ */ jsx(ActionIntro, {
|
|
542
|
+
skeletonWidth: "100%"
|
|
543
|
+
})]
|
|
544
|
+
})]
|
|
545
|
+
})
|
|
546
|
+
})
|
|
547
|
+
})]
|
|
548
|
+
});
|
|
549
|
+
};
|
|
550
|
+
ChipMobile.displayName = "AreaButtons";
|
|
551
|
+
const AreaChipMobile = () => {
|
|
552
|
+
const areas = useAreasStore((state) => state.areasIds.map((a) => ({
|
|
553
|
+
id: a,
|
|
554
|
+
name: state.hashAreas[a].name
|
|
555
|
+
})), shallow);
|
|
556
|
+
const {
|
|
557
|
+
selectArea
|
|
558
|
+
} = useAreasStore((state) => state.areasActions);
|
|
559
|
+
const currentAreaId = useAreasStore((state) => state.currentAreaId, shallow);
|
|
560
|
+
const {
|
|
561
|
+
addArea
|
|
562
|
+
} = useAreasStore((state) => state.areasActions, shallow);
|
|
563
|
+
const {
|
|
564
|
+
setFocus
|
|
565
|
+
} = useAreasStore((state) => state.areaAdminActions, shallow);
|
|
566
|
+
const [anchorMenuAreas, setAnchorMenuAreas] = useState(null);
|
|
567
|
+
console.log("anchorMenuAreas change", anchorMenuAreas);
|
|
568
|
+
const {
|
|
569
|
+
getLabel
|
|
570
|
+
} = useModuleDictionary();
|
|
571
|
+
const theme = useTheme();
|
|
572
|
+
const currentArea = areas.find((area) => area.id === currentAreaId);
|
|
573
|
+
const {
|
|
574
|
+
host_static_assets,
|
|
575
|
+
environment_assets
|
|
576
|
+
} = useEnvironment();
|
|
577
|
+
const menuActions = useMemo(() => areas.filter((area) => area.id !== currentAreaId).map((area) => {
|
|
578
|
+
return {
|
|
579
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.LAYERS}`,
|
|
580
|
+
onClick: () => {
|
|
581
|
+
selectArea(area.id);
|
|
582
|
+
setFocus(false);
|
|
583
|
+
},
|
|
584
|
+
label: area.name
|
|
585
|
+
};
|
|
586
|
+
}), [areas, currentAreaId]);
|
|
587
|
+
const handlerSetAnchorMenuAreas = (element) => {
|
|
588
|
+
setFocus(false);
|
|
589
|
+
setAnchorMenuAreas(element);
|
|
590
|
+
};
|
|
591
|
+
console.log("menuActions areas", menuActions);
|
|
592
|
+
return /* @__PURE__ */ jsx("div", {
|
|
593
|
+
className: areasAdminClasses.areaChipMobileRoot,
|
|
594
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
595
|
+
className: areasAdminClasses.areaContainerContentChips,
|
|
596
|
+
children: [currentArea ? /* @__PURE__ */ jsx(ChipMobile, {
|
|
597
|
+
areaId: currentArea.id,
|
|
598
|
+
selected: true,
|
|
599
|
+
disabled: true,
|
|
600
|
+
setAnchorMenuAreas
|
|
601
|
+
}, currentArea.id) : null, menuActions.length >= 0 ? /* @__PURE__ */ jsx("div", {
|
|
602
|
+
className: areasAdminClasses.areaChipMobileIconContainer,
|
|
603
|
+
children: /* @__PURE__ */ jsx(MenuActions, {
|
|
604
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CHEVRON_DOWN}`,
|
|
605
|
+
arrowType: "no-arrow",
|
|
606
|
+
marginTop: "12px!important",
|
|
607
|
+
marginLeft: "14px!important",
|
|
608
|
+
anchorOrigin: {
|
|
609
|
+
vertical: "bottom",
|
|
610
|
+
horizontal: "right"
|
|
611
|
+
},
|
|
612
|
+
transformOrigin: {
|
|
613
|
+
vertical: "top",
|
|
614
|
+
horizontal: "right"
|
|
615
|
+
},
|
|
616
|
+
menuActions,
|
|
617
|
+
externalOpen: anchorMenuAreas,
|
|
618
|
+
externalClose: handlerSetAnchorMenuAreas,
|
|
619
|
+
className: areasAdminClasses.areasPopoverMobileOptions,
|
|
620
|
+
menuActionSx: theme.components?.M4LAreasAdminMobilePopoverOptions?.styleOverrides,
|
|
621
|
+
endListElement: /* @__PURE__ */ jsx(Button, {
|
|
622
|
+
onClick: () => {
|
|
623
|
+
addArea();
|
|
624
|
+
setAnchorMenuAreas(null);
|
|
625
|
+
},
|
|
626
|
+
variant: "outlined",
|
|
627
|
+
startIcon: /* @__PURE__ */ jsx(Icon, {
|
|
628
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.ADD_AREA}`
|
|
629
|
+
}),
|
|
630
|
+
children: getLabel(getAreasDictionary(DICCTIONARY.area_add_new))
|
|
631
|
+
})
|
|
632
|
+
})
|
|
633
|
+
}) : null]
|
|
634
|
+
})
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
const PanelWindowPopUp = (props) => {
|
|
638
|
+
const {
|
|
639
|
+
currentAreaId
|
|
640
|
+
} = props;
|
|
641
|
+
const {
|
|
642
|
+
host_static_assets,
|
|
643
|
+
environment_assets
|
|
644
|
+
} = useEnvironment();
|
|
645
|
+
const windowsLayouts = useAreasStore((state) => state.hashAreas[currentAreaId].layoutItemsIds.filter((li) => state.hashWindows[li].emergeType === "layout").map((lim) => {
|
|
646
|
+
const w = state.hashWindows[lim];
|
|
647
|
+
return {
|
|
648
|
+
i: w.windowId,
|
|
649
|
+
url_icon: w.url_icon,
|
|
650
|
+
title: w.title
|
|
651
|
+
};
|
|
652
|
+
}), shallow);
|
|
653
|
+
const theme = useTheme();
|
|
654
|
+
const {
|
|
655
|
+
maximizeLayout
|
|
656
|
+
} = useAreasStore((state) => state.areaActions);
|
|
657
|
+
const onTouched = (layoutId) => {
|
|
658
|
+
maximizeLayout(currentAreaId, layoutId);
|
|
659
|
+
};
|
|
660
|
+
const menuActions = windowsLayouts.map((element) => {
|
|
661
|
+
return {
|
|
662
|
+
onClick: () => onTouched(element.i),
|
|
663
|
+
label: element.title,
|
|
664
|
+
urlIcon: element.url_icon
|
|
665
|
+
};
|
|
666
|
+
});
|
|
667
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
668
|
+
children: menuActions.length > 0 ? /* @__PURE__ */ jsx(MenuActions, {
|
|
669
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.LAYERS}`,
|
|
670
|
+
arrowType: "no-arrow",
|
|
671
|
+
marginTop: "12px!important",
|
|
672
|
+
marginLeft: "14px!important",
|
|
673
|
+
anchorOrigin: {
|
|
674
|
+
vertical: "bottom",
|
|
675
|
+
horizontal: "right"
|
|
676
|
+
},
|
|
677
|
+
transformOrigin: {
|
|
678
|
+
vertical: "top",
|
|
679
|
+
horizontal: "right"
|
|
680
|
+
},
|
|
681
|
+
menuActions,
|
|
682
|
+
className: areasAdminClasses.areasPopoverListWindows,
|
|
683
|
+
iconButtonClassName: areasAdminClasses.areasPopoverListWindowsIcon,
|
|
684
|
+
menuActionSx: theme.components?.M4LAreasAdminMobilePopoverOptions?.styleOverrides
|
|
685
|
+
}) : null
|
|
686
|
+
});
|
|
687
|
+
};
|
|
688
|
+
function AreasAdmin() {
|
|
689
|
+
const areas = useAreasStore((state) => state.areasIds, shallow);
|
|
690
|
+
const currentArea = useAreasStore((state) => state.currentAreaId, shallow);
|
|
691
|
+
const status = useAreasStore((state) => state.ownerState.status);
|
|
692
|
+
const {
|
|
693
|
+
setFocus
|
|
694
|
+
} = useAreasStore((state) => state.areaAdminActions, shallow);
|
|
695
|
+
const classesRoot = useAreasStore((state) => state.adminClasses.root);
|
|
696
|
+
const areasLength = useAreasStore((state) => state.areasIds.length);
|
|
697
|
+
const isDesktop = useResponsiveDesktop();
|
|
698
|
+
const {
|
|
699
|
+
addArea
|
|
700
|
+
} = useAreasStore((state) => state.areasActions, shallow);
|
|
701
|
+
const maximizedId = useAreasStore((state) => state.hashAreas[currentArea] ? state.hashAreas[currentArea].maximizedId : false, shallow);
|
|
702
|
+
console.log("currentArea test", currentArea);
|
|
703
|
+
const {
|
|
704
|
+
host_static_assets,
|
|
705
|
+
environment_assets
|
|
706
|
+
} = useEnvironment();
|
|
707
|
+
const divRef = useRef(null);
|
|
708
|
+
const divRefOut = useRef(null);
|
|
709
|
+
const handleClickOutsideFn = () => {
|
|
710
|
+
setFocus(false);
|
|
711
|
+
};
|
|
712
|
+
useOnClickOutside(divRef, handleClickOutsideFn, divRefOut);
|
|
713
|
+
const rippleRef = useRef(null);
|
|
714
|
+
const onRippleStart = (e) => {
|
|
715
|
+
if (rippleRef.current) {
|
|
716
|
+
rippleRef.current.start(e);
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
const onRippleStop = (e) => {
|
|
720
|
+
if (rippleRef.current) {
|
|
721
|
+
rippleRef.current.stop(e);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
if (status !== "loaded") {
|
|
725
|
+
return null;
|
|
726
|
+
}
|
|
727
|
+
return /* @__PURE__ */ jsx(AreasAdminRoot, {
|
|
728
|
+
ref: divRefOut,
|
|
729
|
+
onMouseDown: onRippleStart,
|
|
730
|
+
onMouseUp: onRippleStop,
|
|
731
|
+
className: classesRoot,
|
|
732
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
733
|
+
ref: divRef,
|
|
734
|
+
className: areasAdminClasses.rootContent,
|
|
735
|
+
onClick: () => setFocus(true),
|
|
736
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
737
|
+
className: areasAdminClasses.areaContainerChipsIcon,
|
|
738
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
739
|
+
className: areasAdminClasses.areaContainerChips,
|
|
740
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
741
|
+
className: areasAdminClasses.areaContainerContentChips,
|
|
742
|
+
children: isDesktop ? /* @__PURE__ */ jsx(ScrollBar, {
|
|
743
|
+
children: /* @__PURE__ */ jsx(Fragment, {
|
|
744
|
+
children: areas.map((area) => /* @__PURE__ */ jsx(AreaChip, {
|
|
745
|
+
areaId: area,
|
|
746
|
+
selected: area === currentArea,
|
|
747
|
+
disabled: areasLength === 1
|
|
748
|
+
}, area))
|
|
749
|
+
})
|
|
750
|
+
}) : /* @__PURE__ */ jsx(AreaChipMobile, {})
|
|
751
|
+
})
|
|
752
|
+
})
|
|
753
|
+
}), isDesktop ? /* @__PURE__ */ jsx(IconButton, {
|
|
754
|
+
className: areasAdminClasses.areasAddButton,
|
|
755
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.ADD_AREA}`,
|
|
756
|
+
size: "small",
|
|
757
|
+
onClick: addArea
|
|
758
|
+
}) : null, !isDesktop && maximizedId ? /* @__PURE__ */ jsx(PanelWindowPopUp, {
|
|
759
|
+
currentAreaId: currentArea
|
|
760
|
+
}) : null]
|
|
761
|
+
})
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
export {
|
|
765
|
+
AreasAdmin as A,
|
|
766
|
+
useAreasAdminUtilityClasses as u
|
|
767
|
+
};
|