@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.
Files changed (144) hide show
  1. package/components/AccountPopover/{index.62b1290b.js → index.f22ad364.js} +4 -4
  2. package/components/AppBar/{index.b48343d8.js → index.8d90ce87.js} +4 -4
  3. package/components/CommonActions/components/ActionCancel/index.609a78ca.js +12 -0
  4. package/components/CommonActions/components/ActionFormCancel/index.a1318eac.js +56 -0
  5. package/components/CommonActions/components/ActionFormIntro/index.34d569d1.js +33 -0
  6. package/components/CommonActions/components/ActionIntro/index.ebac0bc1.js +25 -0
  7. package/components/CommonActions/components/Actions/index.258bf919.js +71 -0
  8. package/components/DataGrid/constants.e334cd50.js +10 -0
  9. package/components/DataGrid/formatters/ColumnBooleanFormatter/index.7fb1ebaa.js +26 -0
  10. package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/index.0ee10612.js +22 -0
  11. package/components/DataGrid/formatters/ColumnDateFormatter/index.e00d0cf2.js +19 -0
  12. package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/index.dce9ada8.js +23 -0
  13. package/components/DataGrid/formatters/ColumnNestedValueFormatter/index.880e743b.js +14 -0
  14. package/components/DataGrid/formatters/ColumnPointsFormatter/index.226cc583.js +10 -0
  15. package/components/DataGrid/formatters/ColumnPriceFormatter/index.bf9d9e60.js +10 -0
  16. package/components/DataGrid/formatters/ColumnSetCheckFormatter/index.4045b2f2.js +36 -0
  17. package/components/DataGrid/formatters/ColumnUncertaintyFormatter/index.a87302d1.js +10 -0
  18. package/components/DataGrid/formatters/index.2c2f0ae4.js +1 -0
  19. package/components/DataGrid/index.68e19254.js +915 -0
  20. package/components/DataGrid/subcomponents/Actions/index.6b044e84.js +596 -0
  21. package/components/DataGrid/subcomponents/editors/TextEditor/index.3f0d9e28.js +76 -0
  22. package/components/DragResizeWindow/{index.8b3e79f7.js → index.a358789f.js} +6 -3
  23. package/components/DynamicFilter/constants.1dddd09c.js +31 -0
  24. package/components/DynamicFilter/dictionary.d28d39ef.js +51 -0
  25. package/components/DynamicFilter/helpers/{index.609b3915.js → index.11ed2896.js} +4 -4
  26. package/components/DynamicFilter/{index.0f04f223.js → index.056a99c7.js} +3 -3
  27. package/components/DynamicFilter/slots/{index.00b68384.js → index.82d7eaf2.js} +31 -31
  28. package/components/DynamicFilter/store/{index.85a2812f.js → index.9b5121d6.js} +2 -2
  29. package/components/DynamicFilter/subcomponents/{index.86c6fda2.js → index.778c93cc.js} +217 -15
  30. package/components/FieldLabel/{index.1577ac9c.js → index.6b6f708e.js} +4 -4
  31. package/components/GridLayout/{index.656840a5.js → index.68d907d4.js} +34 -11
  32. package/components/GridLayout/subcomponents/Griditem/{index.b23625d7.js → index.8955a794.js} +3 -4
  33. package/components/GridLayout/subcomponents/Responsive/{index.97505a31.js → index.45cecca2.js} +1 -2
  34. package/components/GridLayout/subcomponents/SizeProvider/{index.36cb4139.js → index.7050ac4f.js} +1 -1
  35. package/components/HelperText/{index.ebb53dac.js → index.09e80920.js} +1 -1
  36. package/components/Icon/{index.8ecfb193.js → index.83867398.js} +10 -26
  37. package/components/Image/{index.4a822ede.js → index.19aa7ff5.js} +3 -2
  38. package/components/LanguagePopover/index.921efd11.js +188 -0
  39. package/components/{mui_extended/LinearProgress/index.e9455b2e.js → LinearProgressIndeterminate/index.ea9c8518.js} +4 -9
  40. package/components/LoadingError/{index.9e829e8d.js → index.aee18b24.js} +11 -7
  41. package/components/MFLoader/{index.29f445e2.js → index.c975666e.js} +8 -4
  42. package/components/ModalDialog/{index.96c4aba3.js → index.0dd5af28.js} +14 -5
  43. package/components/NavLink/{index.9f5d5670.js → index.ad039baf.js} +3 -2
  44. package/components/NoItemSelected/{index.0ae9f28f.js → index.d10603d7.js} +13 -3
  45. package/components/ObjectLogs/{index.40c5047f.js → index.a3e42b21.js} +26 -8
  46. package/components/PDFViewer/{index.651cc4b6.js → index.35f68e67.js} +2 -2
  47. package/components/Page/{index.1d08818c.js → index.f4755eba.js} +18 -2
  48. package/components/PaperForm/{index.1a8b10d4.js → index.007ef4cf.js} +2 -2
  49. package/components/Period/{index.236971ae.js → index.9647181b.js} +15 -54
  50. package/components/PrintingSystem/{index.9fdae551.js → index.a69a9d85.js} +14 -15
  51. package/components/PrintingSystem/subcomponents/BodyNode/{index.794dbc69.js → index.528fcfbf.js} +1 -1
  52. package/components/PrintingSystem/subcomponents/ChartNode/{index.6bbf7d75.js → index.fbe87257.js} +1 -1
  53. package/components/PrintingSystem/subcomponents/DividerNode/{index.015a2212.js → index.f5adab1d.js} +1 -1
  54. package/components/PrintingSystem/subcomponents/FooterNode/{index.08eeb1d2.js → index.f42ca7dc.js} +1 -1
  55. package/components/PrintingSystem/subcomponents/GridNode/{index.23995699.js → index.041b9cff.js} +1 -1
  56. package/components/PrintingSystem/subcomponents/HeaderNode/{index.3fa36620.js → index.a8140332.js} +1 -1
  57. package/components/PrintingSystem/subcomponents/PaperNode/{index.8b7d43f4.js → index.aabde2bb.js} +1 -1
  58. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.9856c572.js → index.7f75ca46.js} +1 -1
  59. package/components/PrintingSystem/subcomponents/SectionNode/{index.89b3a4e0.js → index.61babb47.js} +1 -1
  60. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.dc6e9dc2.js → index.4d0e67a3.js} +1 -1
  61. package/components/PropertyValue/{index.646a7e8b.js → index.51faabb5.js} +7 -4
  62. package/components/Resizeable/{index.414ff687.js → index.4f75c0b5.js} +1 -1
  63. package/components/ScrollBar/{index.1e89bb44.js → index.21bc5025.js} +1 -1
  64. package/components/SideBar/{index.d221254d.js → index.4075c562.js} +36 -7
  65. package/components/SplitLayout/{index.7d9edf4e.js → index.15756f0f.js} +3 -1
  66. package/components/ToastContainer/{index.7f246bbd.js → index.2a7d304e.js} +3 -3
  67. package/components/animate/variants/index.7a912140.js +1 -0
  68. package/components/areas/components/AreasAdmin/index.325bac22.js +733 -0
  69. package/components/areas/components/AreasViewer/index.6e30ec72.js +1072 -0
  70. package/components/areas/components/index.558684b3.js +1 -0
  71. package/components/areas/constants.66529246.js +6 -0
  72. package/components/areas/contexts/AreasContext/{index.0815f278.js → index.3311cbf9.js} +6 -5
  73. package/components/areas/contexts/DynamicMFParmsContext/{index.37d1d444.js → index.3d9ad0ad.js} +2 -2
  74. package/components/areas/contexts/WindowToolsMFContext/{index.69d95c15.js → index.992ae7a3.js} +2 -2
  75. package/components/areas/contexts/index.24025b97.js +1 -0
  76. package/components/areas/dictionary.08cfc4c9.js +36 -0
  77. package/components/areas/hooks/index.d9dc1e21.js +1 -0
  78. package/components/areas/hooks/useAreas/{index.4039e30d.js → index.f81493ef.js} +1 -1
  79. package/components/areas/hooks/useDynamicMFParameters/{index.03ce6078.js → index.9e09e1e3.js} +1 -1
  80. package/components/areas/hooks/useWindowToolsMF/{index.09801b66.js → index.2fbae9dc.js} +1 -1
  81. package/components/areas/icons.8266ccc8.js +26 -0
  82. package/components/areas/index.4cc6a221.js +22 -0
  83. package/components/commercial/AppBarCommercial/index.cbd55cf8.js +28 -0
  84. package/components/commercial/SectionCommercial/index.d22ebbd5.js +57 -0
  85. package/components/commercial/TopBar/index.410fffa8.js +234 -0
  86. package/components/{HamburgerMenu/index.6c82741d.js → commercial/index.07638f52.js} +5 -3
  87. package/components/formatters/BooleanFormatter/index.cbf9cd6e.js +44 -0
  88. package/components/formatters/DateFormatter/index.2ef6f261.js +43 -0
  89. package/components/formatters/PointsFormatter/index.d8a4ee54.js +25 -0
  90. package/components/formatters/PriceFormatter/index.97f75b4b.js +35 -0
  91. package/components/formatters/UncertaintyFormatter/index.c3ffdebc.js +29 -0
  92. package/components/formatters/index.63a3e08e.js +117 -0
  93. package/components/hook-form/HelperError/{index.2ed03a3c.js → index.c0109d5b.js} +1 -1
  94. package/components/hook-form/RHFAutocomplete/index.2991d444.js +404 -0
  95. package/components/hook-form/RHFAutocompleteAsync/{index.69f5661d.js → index.d97c727b.js} +2 -3
  96. package/components/hook-form/RHFCheckbox/{index.13de27db.js → index.b57e3131.js} +4 -4
  97. package/components/hook-form/RHFColorPicker/{index.66004599.js → index.310f6ff0.js} +6 -6
  98. package/components/hook-form/RHFDateTime/{index.dfe07e18.js → index.5689a29f.js} +5 -5
  99. package/components/hook-form/RHFPeriod/{index.d852649b.js → index.019e61ae.js} +4 -4
  100. package/components/hook-form/RHFTextField/{index.d207efc1.js → index.10e57945.js} +6 -6
  101. package/components/hook-form/RHFUpload/{index.955a4ba5.js → index.7fd23b2a.js} +5 -5
  102. package/components/{mui_extended/Tab/index.37d588d6.js → maps/components/GpsTools/index.20f83559.js} +331 -645
  103. package/components/maps/{index.a1bf63f2.js → components/Map/index.c37f3304.js} +737 -28
  104. package/components/maps/index.13bb982c.js +7 -0
  105. package/components/modal/{WindowBase.390b0910.js → WindowBase.cfbb0c9e.js} +4 -4
  106. package/components/modal/{WindowConfirm.243e1bef.js → WindowConfirm.300bd34b.js} +10 -6
  107. package/components/modal/{index.5bce430d.js → index.81eb6def.js} +5 -1
  108. package/components/mui_extended/Accordion/{index.f7a17c83.js → index.0843a609.js} +5 -5
  109. package/components/mui_extended/Avatar/{index.12b96914.js → index.fb9ad158.js} +1 -1
  110. package/components/mui_extended/Badge/{index.4737c113.js → index.8beaeefc.js} +1 -1
  111. package/components/mui_extended/Button/{index.52852c42.js → index.d742e9ee.js} +6 -81
  112. package/components/mui_extended/{CheckBox/index.01218423.js → CheckBox.21c25705.js} +1 -1
  113. package/components/mui_extended/IconButton/{index.d5b273e6.js → index.b4532b85.js} +1 -1
  114. package/components/mui_extended/LinearProgress/index.4092bb69.js +9 -0
  115. package/components/mui_extended/MenuActions/index.eae97857.js +176 -0
  116. package/components/mui_extended/Pager/{index.8960227c.js → index.3926c835.js} +22 -40
  117. package/components/mui_extended/Popover/index.2348fc4f.js +143 -0
  118. package/components/mui_extended/Tab/index.e911930f.js +135 -0
  119. package/components/mui_extended/ToggleButton/{index.c441b949.js → index.b834f5f0.js} +1 -1
  120. package/components/mui_extended/ToggleIconButton/{index.8a84f25e.js → index.fcd5205c.js} +1 -1
  121. package/components/mui_extended/Typography/{index.463f613f.js → index.642798f1.js} +1 -1
  122. package/components/mui_extended/index.b606cd9d.js +1 -0
  123. package/components/popups/PopupsProvider/{index.d4caacc3.js → index.d7c9efce.js} +1 -1
  124. package/components/popups/PopupsViewer/{index.42312806.js → index.f3677ab1.js} +10 -6
  125. package/contexts/ModalContext/{index.5f77a463.js → index.ad1fb73b.js} +1 -1
  126. package/contexts/RHFormContext/{index.95ebabc9.js → index.bf3a2812.js} +6 -2
  127. package/hooks/useFormAddEdit/{index.ecb77e67.js → index.6d983cd8.js} +6 -2
  128. package/hooks/useModal/index.2003c854.js +11 -0
  129. package/hooks/useTab/index.8d1a6e63.js +12 -0
  130. package/index.js +328 -273
  131. package/package.json +1 -1
  132. package/{react-draggable.0cc9b257.js → react-draggable.1c1ba224.js} +1 -1
  133. package/{react-resizable.837c446d.js → react-resizable.a59c14f4.js} +2 -2
  134. package/test/constants_no_mock.86c553a9.js +4 -0
  135. package/test/{getNameDataTestId.aee44365.js → getNameDataTestId.0faeade8.js} +2 -2
  136. package/utils/{index.c64c2dd1.js → index.14912462.js} +1 -54
  137. package/components/CommonActions/index.19f39dca.js +0 -170
  138. package/components/areas/constants.0d3ba950.js +0 -289
  139. package/components/areas/dictionary.6168209a.js +0 -266
  140. package/components/areas/icons.504ec098.js +0 -83
  141. package/components/maps/components/GpsTools/index.01acaf3e.js +0 -251
  142. package/components/mui_extended/Popover/index.146ded9e.js +0 -1044
  143. package/hooks/useModal/index.d14c7e46.js +0 -67
  144. package/vendor.5b266106.js +0 -3952
@@ -0,0 +1,1072 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { generateUtilityClasses, styled, Skeleton, Dialog } from "@mui/material";
3
+ import { unstable_composeClasses } from "@mui/base";
4
+ import { g as getComponentUtilityClass } from "../../../../utils/index.14912462.js";
5
+ import { a as AREAS_VIEWER_CLASS_NAME } from "../../constants.66529246.js";
6
+ import { shallow } from "zustand/shallow";
7
+ import React__default, { useMemo, useEffect } from "react";
8
+ import clsx from "clsx";
9
+ import { u as useAreasStore } from "../../hooks/useAreas/index.f81493ef.js";
10
+ import { useModuleDictionary, useEnvironment, useModuleSkeleton } from "@m4l/core";
11
+ import { a as MemonizedMenuActions } from "../../../mui_extended/MenuActions/index.eae97857.js";
12
+ import { useResponsiveDesktop } from "@m4l/graphics";
13
+ import { I as ICONS } from "../../icons.8266ccc8.js";
14
+ import { g as getAreasDictionary, D as DICCTIONARY } from "../../dictionary.08cfc4c9.js";
15
+ import { I as IconButton } from "../../../mui_extended/IconButton/index.b4532b85.js";
16
+ import { L as LinearProgressIndeterminate } from "../../../LinearProgressIndeterminate/index.ea9c8518.js";
17
+ import { I as Icon } from "../../../Icon/index.83867398.js";
18
+ import { T as Typography } from "../../../mui_extended/Typography/index.642798f1.js";
19
+ import { M as MFLoader } from "../../../MFLoader/index.c975666e.js";
20
+ import { W as WindowToolsMFProvider } from "../../contexts/WindowToolsMFContext/index.992ae7a3.js";
21
+ import { D as DynamicMFParmsProvider } from "../../contexts/DynamicMFParmsContext/index.3d9ad0ad.js";
22
+ import { L as LinearProgress } from "../../../mui_extended/LinearProgress/index.4092bb69.js";
23
+ import { T as TEST_PROP_ID } from "../../../../test/constants_no_mock.86c553a9.js";
24
+ import { g as getNameDataTestId } from "../../../../test/getNameDataTestId.0faeade8.js";
25
+ import { R as RESPONSIVE_COLAPSED_HEIGHTS, a as RESPONSIVE_ROW_HEIGHTS, M as MARGIN_GRIDLAYOUT, P as PADDING_GRIDLAYOUT } from "../../contexts/AreasContext/index.3311cbf9.js";
26
+ import { w as withSizeProvider } from "../../../GridLayout/subcomponents/SizeProvider/index.7050ac4f.js";
27
+ import { R as Responsive } from "../../../GridLayout/subcomponents/Responsive/index.45cecca2.js";
28
+ import { useLocation } from "react-router-dom";
29
+ import { L as LoadingError } from "../../../LoadingError/index.aee18b24.js";
30
+ import { styled as styled$1 } from "@mui/material/styles";
31
+ import { c as cjs } from "../../../../react-draggable.1c1ba224.js";
32
+ import { R as ResizeableWindow } from "../../../Resizeable/index.4f75c0b5.js";
33
+ const areasViewerClasses = generateUtilityClasses(
34
+ AREAS_VIEWER_CLASS_NAME,
35
+ [
36
+ "root",
37
+ "areaRoot",
38
+ "areaGridLayoutPanelContainer",
39
+ "areaGridLayout",
40
+ "areaGridLayoutPopupsContainer",
41
+ "areasWindowPopUpList",
42
+ "windowRoot",
43
+ "windowHeader",
44
+ "windowHeaderContent",
45
+ "windowHeaderTitle",
46
+ "windowHeaderMainActions",
47
+ "windowHeaderCancelHandle",
48
+ "windowContent",
49
+ "windowPopupRoot",
50
+ "windowModalRoot",
51
+ "windowLinearProgressRoot",
52
+ "windowLinearProgressBar",
53
+ "windowRootContainer",
54
+ "windowToastiesContainer",
55
+ "windowToastiesContainerTostys",
56
+ "windowToastyContainer",
57
+ "windowToastyMeesageButtonsContainer",
58
+ "windowToastyMessage",
59
+ "windowToastyButtonsContainer",
60
+ "windowToastyPin",
61
+ "windowToastyClose",
62
+ "panelWindowsRoot",
63
+ "panelWindowsButtonContainer",
64
+ "containerLinearProgress",
65
+ "resizeHandle",
66
+ "loaderContainer",
67
+ "containerComponent",
68
+ "selected",
69
+ "colapsed",
70
+ "selectedWindow",
71
+ "isMobile",
72
+ "loading",
73
+ "pinIn",
74
+ "success",
75
+ "info",
76
+ "warning",
77
+ "error"
78
+ ],
79
+ AREAS_VIEWER_CLASS_NAME
80
+ );
81
+ const useAreasViewerUtilityClasses = (ownerState) => {
82
+ const slots = {
83
+ root: [
84
+ "root",
85
+ ownerState.status,
86
+ ownerState.isMobile && "isMobile",
87
+ ownerState.isSkeleton && "isSkeleton"
88
+ ],
89
+ areaRoot: ["areaRoot"],
90
+ areasLoadingErrorRoot: ["areasLoadingErrorRoot"],
91
+ areasLoadingErrorLoading: ["areasLoadingErrorLoading"],
92
+ areasLoadingError: ["areasLoadingError"],
93
+ areasLoadingErrorIcon: ["areasLoadingErrorIcon"],
94
+ areasLoadingErrorTitle: ["areasLoadingErrorTitle"],
95
+ areasLoadingErrorDescription: ["areasLoadingErrorDescription"],
96
+ areasLoadingErrorDivider: ["areasLoadingErrorDivider"],
97
+ areaGridLayoutPanelContainer: ["areaGridLayoutPanelContainer"],
98
+ areaGridLayout: ["areaGridLayout"],
99
+ areaGridLayoutPopupsContainer: ["areaGridLayoutPopupsContainer"],
100
+ areasWindowPopUpList: ["areasWindowPopUpList"],
101
+ windowRoot: ["windowRoot"],
102
+ windowRootContainer: ["windowRootContainer"],
103
+ windowHeader: ["windowHeader"],
104
+ windowHeaderTitle: ["windowHeaderTitle"],
105
+ windowHeaderMainActions: ["windowHeaderMainActions"],
106
+ windowHeaderCancelHandle: ["windowHeaderCancelHandle"],
107
+ windowContent: ["windowContent"],
108
+ windowLinearProgressRoot: ["windowLinearProgressRoot"],
109
+ windowLinearProgressBar: ["windowLinearProgressBar"],
110
+ windowPopupRoot: ["windowPopupRoot"],
111
+ windowModalRoot: ["windowModalRoot"],
112
+ selectedWindow: ["selectedWindow"],
113
+ windowToastiesContainer: ["windowToastiesContainer"],
114
+ windowToastiesContainerTostys: ["windowToastiesContainerTostys"],
115
+ windowToastyContainer: ["windowToastiesContainer"],
116
+ windowToastyMeesageButtonsContainer: ["windowToastyMeesageButtonsContainer"],
117
+ windowToastyMessage: ["windowToastyMessage"],
118
+ windowToastyButtonsContainer: ["windowToastyButtonsContainer"],
119
+ windowToastyPin: ["windowToastyPin"],
120
+ windowToastyClose: ["windowToastyClose"],
121
+ panelWindowsRoot: ["panelWindowsRoot"],
122
+ panelWindowsButtonContainer: ["panelWindowsButtonContainer"],
123
+ resizeHandle: ["resizeHandle"],
124
+ loaderContainer: ["loaderContainer"],
125
+ containerComponent: ["containerComponent"]
126
+ };
127
+ return unstable_composeClasses(slots, getComponentUtilityClass(AREAS_VIEWER_CLASS_NAME), {});
128
+ };
129
+ const react_resizable_css = {};
130
+ const AreasViewerRoot = styled("div")`
131
+ /* display: flex; */
132
+ width: 100%;
133
+ height: 100%;
134
+ overflow: hidden;
135
+ /* flex-grow: 1; */
136
+ position: relative;
137
+
138
+ //areaRoot
139
+ & .${areasViewerClasses.areaRoot} {
140
+ display: none;
141
+ position: absolute;
142
+ /* flex-grow: 1; */
143
+ flex-direction: row;
144
+ inset: 0;
145
+ /* width: 100%; */
146
+ overflow: hidden;
147
+ justify-content: top;
148
+ align-items: flex-start;
149
+
150
+ visibility: hidden;
151
+ }
152
+
153
+ & .${areasViewerClasses.areaRoot}.${areasViewerClasses.selected} {
154
+ display: block;
155
+ visibility: visible;
156
+ }
157
+
158
+ &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaRoot} {
159
+ }
160
+
161
+ // areaGridLayoutPanelContainer
162
+ & .${areasViewerClasses.areaGridLayoutPanelContainer} {
163
+ display: flex;
164
+ flex-direction: row;
165
+ height: 100%;
166
+ width: 100%;
167
+ overflow: hidden;
168
+ }
169
+ &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaGridLayoutPanelContainer} {
170
+ flex-direction: column-reverse;
171
+ }
172
+ // areaGridLayout
173
+ & .${areasViewerClasses.areaGridLayout} {
174
+ height: 100% !important;
175
+ overflow: auto;
176
+ flex-grow: 1;
177
+ }
178
+ &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaGridLayout} {
179
+ flex-direction: column-reverse;
180
+ height: unset;
181
+ width: 100%;
182
+ }
183
+ // areaGridLayoutPopupsContainer
184
+ & .${areasViewerClasses.areaGridLayoutPopupsContainer} {
185
+ z-index: 1; //Garantizar q el contenedor de los popus este por encima de los layouts
186
+ // // ' .react-draggable': {
187
+ // // position: 'absolute',
188
+ // // },
189
+ }
190
+
191
+ // PanelWindowsRoot
192
+ & .${areasViewerClasses.panelWindowsRoot} {
193
+ display: flex;
194
+ flex-direction: column;
195
+ position: relative;
196
+ }
197
+ &.${areasViewerClasses.isMobile} .${areasViewerClasses.panelWindowsRoot} {
198
+ flex-direction: row;
199
+ }
200
+
201
+ // windowRoot
202
+ & .${areasViewerClasses.windowRoot} {
203
+ inset: 0;
204
+ position: absolute;
205
+ display: flex;
206
+ flex-direction: column;
207
+ /* height: 100%; */
208
+ /* width: 100%; */
209
+ overflow: hidden;
210
+ border: 1px solid gray;
211
+
212
+ background-color: ${(props) => props.theme.vars.palette.background.default};
213
+ padding: ${(props) => props.theme.spacing(0)};
214
+ }
215
+
216
+ & .${areasViewerClasses.windowRoot}.${areasViewerClasses.selected} {
217
+ border-top: 1px solid green;
218
+ }
219
+ // windowHeaderTitle
220
+ & .${areasViewerClasses.windowHeaderTitle} {
221
+ width: 100%;
222
+ max-width: 100%;
223
+ overflow: hidden;
224
+ white-space: nowrap;
225
+ color: ${(props) => props.theme.vars.palette.text.primary};
226
+ text-overflow: ellipsis;
227
+ }
228
+ // windowHeaderMainActions
229
+ & .${areasViewerClasses.windowHeaderMainActions} {
230
+ display: flex;
231
+
232
+ gap: 4px;
233
+ }
234
+
235
+ // windowHeaderMainActions
236
+ & .${areasViewerClasses.windowContent} {
237
+ flex-grow: 1;
238
+ position: relative;
239
+ }
240
+
241
+ // windowModalRoot
242
+ & .${areasViewerClasses.windowModalRoot} {
243
+ padding: 16px;
244
+ }
245
+
246
+ ${react_resizable_css}
247
+
248
+ ${(props) => props.theme.components?.M4LAreasViewer?.styleOverrides}
249
+ `;
250
+ function WindowHeaderSkeleton(props) {
251
+ const { colapsed } = props;
252
+ return /* @__PURE__ */ jsx("div", { className: clsx(areasViewerClasses.windowHeader), children: /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowHeaderContent, children: [
253
+ /* @__PURE__ */ jsx(
254
+ Skeleton,
255
+ {
256
+ variant: "circular",
257
+ sx: { margin: "0 5px", minWidth: "18px", minHeight: "18px" }
258
+ }
259
+ ),
260
+ /* @__PURE__ */ jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: 80, height: 16 }) }),
261
+ /* @__PURE__ */ jsx("div", { className: areasViewerClasses.windowHeaderCancelHandle, children: !colapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
262
+ /* @__PURE__ */ jsx(
263
+ Skeleton,
264
+ {
265
+ variant: "circular",
266
+ sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
267
+ }
268
+ ),
269
+ /* @__PURE__ */ jsx(
270
+ Skeleton,
271
+ {
272
+ variant: "circular",
273
+ sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
274
+ }
275
+ ),
276
+ /* @__PURE__ */ jsx(
277
+ Skeleton,
278
+ {
279
+ variant: "circular",
280
+ sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
281
+ }
282
+ )
283
+ ] }) }),
284
+ /* @__PURE__ */ jsx(
285
+ Skeleton,
286
+ {
287
+ variant: "circular",
288
+ sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
289
+ }
290
+ ),
291
+ /* @__PURE__ */ jsx(
292
+ Skeleton,
293
+ {
294
+ variant: "circular",
295
+ sx: { margin: "0 5px", minWidth: "16px", minHeight: "16px" }
296
+ }
297
+ )
298
+ ] }) });
299
+ }
300
+ function getMainActions(isDesktop, moduleActions) {
301
+ let mainActions = [];
302
+ if (isDesktop !== void 0 && isDesktop) {
303
+ mainActions = mainActions.concat(moduleActions.filter((action) => action.visibility === "main"));
304
+ }
305
+ mainActions = mainActions.concat(moduleActions.filter((action) => action.visibility === "allways"));
306
+ return mainActions;
307
+ }
308
+ function getMenuActions(options) {
309
+ const {
310
+ windowId,
311
+ isDesktop,
312
+ moduleActions,
313
+ urlPrefix,
314
+ saveModuleCookies,
315
+ resetModuleCookies,
316
+ version,
317
+ windowOptions = { allowPersistCookies: false },
318
+ getLabel
319
+ } = options;
320
+ let menuActions = [...moduleActions.filter((action) => action.visibility !== "allways")];
321
+ if (isDesktop !== void 0 && isDesktop) {
322
+ menuActions = menuActions.filter((action) => action.visibility === "normal");
323
+ }
324
+ if (windowOptions.allowPersistCookies) {
325
+ const saveCookiesAction = {
326
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.SAVE_COOKIES}`,
327
+ onClick: () => saveModuleCookies(windowId),
328
+ disabled: false,
329
+ visibility: "normal",
330
+ label: getLabel(getAreasDictionary(DICCTIONARY.label_persist_module_cookies)),
331
+ key: "save_cookies"
332
+ };
333
+ menuActions.push(saveCookiesAction);
334
+ const resetCookiesAction = {
335
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.RESET_COOKIES}`,
336
+ onClick: () => resetModuleCookies(windowId),
337
+ disabled: false,
338
+ visibility: "normal",
339
+ label: getLabel(getAreasDictionary(DICCTIONARY.label_reset_module_cookies)),
340
+ key: "reset_cookes"
341
+ };
342
+ menuActions.push(resetCookiesAction);
343
+ }
344
+ if (version) {
345
+ const versionAction = {
346
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.VERSION}`,
347
+ onClick: () => {
348
+ },
349
+ disabled: true,
350
+ visibility: "normal",
351
+ label: version,
352
+ key: "version"
353
+ };
354
+ menuActions.push(versionAction);
355
+ }
356
+ return menuActions;
357
+ }
358
+ function MainActions(props) {
359
+ const { windowId } = props;
360
+ const moduleActions = useAreasStore((state) => {
361
+ const window = state.hashWindows[windowId];
362
+ return window?.moduleActions || [];
363
+ }, shallow);
364
+ const { getLabel } = useModuleDictionary();
365
+ const isDesktop = useResponsiveDesktop();
366
+ const mainActions = useMemo(() => {
367
+ return getMainActions(isDesktop, moduleActions);
368
+ }, [moduleActions, isDesktop]);
369
+ return /* @__PURE__ */ jsx("div", { className: areasViewerClasses.windowHeaderMainActions, children: mainActions.map((mainAction) => {
370
+ const tooltip = mainAction.label !== void 0 ? mainAction.label : getLabel(mainAction.dictionaryId || "");
371
+ const onClick = (e) => {
372
+ mainAction.onClick(e);
373
+ e.stopPropagation();
374
+ };
375
+ return /* @__PURE__ */ jsx(
376
+ IconButton,
377
+ {
378
+ src: mainAction.urlIcon || "",
379
+ className: clsx(mainAction.className, "m4l_draggableCancel"),
380
+ onClick,
381
+ "aria-label": mainAction.label,
382
+ disabled: mainAction.disabled,
383
+ tooltip
384
+ },
385
+ mainAction.key
386
+ );
387
+ }) });
388
+ }
389
+ function Header(props) {
390
+ const { areaId, windowId, emergeType } = props;
391
+ const [url_icon, title, moduleActions, onClose, version, windowOptions, fnQueryClose] = useAreasStore((state) => {
392
+ const window = state.hashWindows[windowId];
393
+ return [
394
+ window.url_icon,
395
+ window.title,
396
+ window.moduleActions,
397
+ window.onClose,
398
+ window.version,
399
+ window.windowOptions,
400
+ window.fnQueryClose
401
+ ];
402
+ }, shallow);
403
+ const { saveModuleCookies, resetModuleCookies } = useAreasStore(
404
+ (state) => state.windowActions,
405
+ shallow
406
+ );
407
+ const maximizedId = useAreasStore((state) => state.hashAreas[areaId].maximizedId, shallow);
408
+ const colapsed = useAreasStore((state) => {
409
+ const currentBreakpoint = state.hashAreas[areaId].currentBreakpoint;
410
+ if (currentBreakpoint) {
411
+ return state.hashAreas[areaId].layouts[currentBreakpoint].find((li) => li.i === windowId)?.colapsed;
412
+ }
413
+ return false;
414
+ }, shallow);
415
+ const { maximizeLayout, normalizeLayouts, colapseLayoutItem, unColapseLayoutItem } = useAreasStore((state) => state.areaActions, shallow);
416
+ const { host_static_assets, environment_assets } = useEnvironment();
417
+ const isDesktop = useResponsiveDesktop();
418
+ const isSkeleton = useModuleSkeleton();
419
+ const { getLabel } = useModuleDictionary();
420
+ const urlPrefix = `${host_static_assets}/${environment_assets}`;
421
+ const menuActions = useMemo(() => {
422
+ return getMenuActions({
423
+ windowId,
424
+ isDesktop,
425
+ moduleActions,
426
+ urlPrefix,
427
+ saveModuleCookies,
428
+ resetModuleCookies,
429
+ version,
430
+ windowOptions,
431
+ getLabel
432
+ });
433
+ }, [moduleActions, isDesktop]);
434
+ const onCloseLocal = () => {
435
+ const fnClose = fnQueryClose || onClose;
436
+ fnClose && fnClose(windowId);
437
+ };
438
+ const maxNormalize = (e) => {
439
+ if (maximizedId === windowId) {
440
+ normalizeLayouts(areaId);
441
+ } else {
442
+ maximizeLayout(areaId, windowId);
443
+ }
444
+ e.stopPropagation();
445
+ };
446
+ const colapedToggle = (e) => {
447
+ if (!colapsed) {
448
+ colapseLayoutItem(areaId, windowId);
449
+ } else {
450
+ unColapseLayoutItem(areaId, windowId);
451
+ }
452
+ e.stopPropagation();
453
+ };
454
+ if (isSkeleton) {
455
+ return /* @__PURE__ */ jsx(WindowHeaderSkeleton, {});
456
+ }
457
+ return /* @__PURE__ */ jsxs("div", { className: clsx(areasViewerClasses.windowHeader, "m4l_draggable_handle"), children: [
458
+ /* @__PURE__ */ jsx(LinearProgressIndeterminate, {}),
459
+ /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowHeaderContent, children: [
460
+ /* @__PURE__ */ jsx(Icon, { src: url_icon, size: "medium" }),
461
+ /* @__PURE__ */ jsx(Typography, { className: areasViewerClasses.windowHeaderTitle, variant: "h5", children: `${title}` }),
462
+ /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowHeaderCancelHandle, children: [
463
+ !colapsed && /* @__PURE__ */ jsx(MainActions, { windowId }),
464
+ !colapsed && menuActions.length > 0 && /* @__PURE__ */ jsx(
465
+ MemonizedMenuActions,
466
+ {
467
+ arrowType: "no-arrow",
468
+ marginTop: "12px!important",
469
+ marginLeft: "14px!important",
470
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
471
+ transformOrigin: { vertical: "top", horizontal: "right" },
472
+ menuActions,
473
+ toolTip: getLabel(getAreasDictionary(DICCTIONARY.label_module_actions))
474
+ }
475
+ ),
476
+ !colapsed && (emergeType === "layout" || emergeType === "popup") && /* @__PURE__ */ jsx(
477
+ IconButton,
478
+ {
479
+ className: "m4l_draggableCancel",
480
+ onClick: maxNormalize,
481
+ "aria-label": "click",
482
+ src: maximizedId === windowId ? `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.NORMALIZE}` : `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.MAXIMIZE}`,
483
+ tooltip: getLabel(
484
+ getAreasDictionary(
485
+ maximizedId === windowId ? DICCTIONARY.label_minimize_window : DICCTIONARY.label_maximize_window
486
+ )
487
+ )
488
+ }
489
+ ),
490
+ !maximizedId && (emergeType === "layout" || emergeType === "popup") && /* @__PURE__ */ jsx(
491
+ IconButton,
492
+ {
493
+ className: "m4l_draggableCancel",
494
+ onClick: colapedToggle,
495
+ "aria-label": "click",
496
+ src: !colapsed ? `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.COLAPSE}` : `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.UNCOLPASE}`,
497
+ tooltip: getLabel(
498
+ getAreasDictionary(
499
+ !colapsed ? DICCTIONARY.label_collapse_window : DICCTIONARY.label_uncollapse_window
500
+ )
501
+ )
502
+ }
503
+ ),
504
+ onClose && /* @__PURE__ */ jsx(
505
+ IconButton,
506
+ {
507
+ className: "m4l_draggableCancel",
508
+ onPointerDown: onCloseLocal,
509
+ "aria-label": "click",
510
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CLOSE}`,
511
+ tooltip: getLabel(getAreasDictionary(DICCTIONARY.label_close_window))
512
+ }
513
+ )
514
+ ] })
515
+ ] })
516
+ ] });
517
+ }
518
+ const MicroFrontend = (props) => {
519
+ return /* @__PURE__ */ jsx(MFLoader, { ...props });
520
+ };
521
+ const MemonizedMicroFrontend = React__default.memo(MicroFrontend);
522
+ const Component = (props) => {
523
+ const { component, dynamicMFStore, windowTools } = props;
524
+ return /* @__PURE__ */ jsx(WindowToolsMFProvider, { ...windowTools, children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, { store: dynamicMFStore, children: /* @__PURE__ */ jsx("div", { className: areasViewerClasses.containerComponent, children: typeof component === "function" ? component({ windowTools, dynamicMFStore }) : component }) }) });
525
+ };
526
+ React__default.memo(Component);
527
+ const WindowRoot = styled("div")`
528
+ inset: 0;
529
+ position: absolute;
530
+ display: flex;
531
+ flex-direction: column;
532
+ /* height: 100%; */
533
+ /* width: 100%; */
534
+ overflow: hidden;
535
+ border: 1px solid gray;
536
+
537
+ background-color: ${(props) => props.theme.vars.palette.background.default};
538
+ padding: ${(props) => props.theme.spacing(0)};
539
+ &.${areasViewerClasses.selected} {
540
+ border-top: 1px solid green;
541
+ }
542
+
543
+ // windowHeader
544
+ /*
545
+ &.${areasViewerClasses.loading} .${areasViewerClasses.windowHeader} {
546
+ border-bottom: 2px solid red !important;
547
+ }
548
+ */
549
+ // windowHeaderTitle
550
+ & .${areasViewerClasses.windowHeaderTitle} {
551
+ width: 100%;
552
+ max-width: 100%;
553
+ overflow: hidden;
554
+ white-space: nowrap;
555
+ color: ${(props) => props.theme.vars.palette.text.primary};
556
+ text-overflow: ellipsis;
557
+ }
558
+
559
+ & .${areasViewerClasses.windowHeaderCancelHandle} {
560
+ display: flex;
561
+ cursor: default;
562
+ }
563
+
564
+ // windowHeaderMainActions
565
+ & .${areasViewerClasses.windowHeaderMainActions} {
566
+ display: flex;
567
+
568
+ gap: 4px;
569
+ }
570
+
571
+ // windowHeaderMainActions
572
+ & .${areasViewerClasses.windowContent} {
573
+ flex-grow: 1;
574
+ position: relative;
575
+ }
576
+
577
+ & .${areasViewerClasses.windowContent}.${areasViewerClasses.colapsed} {
578
+ display: none !important;
579
+ }
580
+ // windowModalRoot
581
+ & .${areasViewerClasses.windowModalRoot} {
582
+ padding: 16px;
583
+ }
584
+
585
+ // windowToastiesContainer
586
+ & .${areasViewerClasses.windowToastiesContainer} {
587
+ padding: 4px;
588
+ }
589
+
590
+ // windowToastyContainer
591
+ & .${areasViewerClasses.windowToastyContainer} {
592
+ display: flex;
593
+ flex-direction: column;
594
+ }
595
+ // windowToastyContainer
596
+ & .${areasViewerClasses.windowToastyContainer}.${areasViewerClasses.success} {
597
+ background-color: ${(props) => props.theme.vars.palette.success.main};
598
+ }
599
+
600
+ // windowToastyMeesageButtonsContainer
601
+ & .${areasViewerClasses.windowToastyMeesageButtonsContainer} {
602
+ display: flex;
603
+ }
604
+ & .MuiLinearProgress-root {
605
+ width: 100%;
606
+ }
607
+
608
+ // windowToastyMessage
609
+ & .${areasViewerClasses.windowToastyMessage} {
610
+ flex-grow: 1;
611
+ }
612
+
613
+ // windowToastyContainer
614
+ & .${areasViewerClasses.windowToastyPin}.${areasViewerClasses.pinIn} {
615
+ border: 1px solid red;
616
+ }
617
+
618
+ ${(props) => props.theme.components?.M4LAreasViewerWindow?.styleOverrides}
619
+ `;
620
+ function Toasty(props) {
621
+ const { windowId, toastyId } = props;
622
+ const toasty = useAreasStore(
623
+ (state) => state.hashWindows[windowId].hashToasties[toastyId],
624
+ shallow
625
+ );
626
+ const { pinToast: pinToasty, closeToast: closeToasty } = useAreasStore(
627
+ (state) => state.windowActions,
628
+ shallow
629
+ );
630
+ const { host_static_assets, environment_assets } = useEnvironment();
631
+ return /* @__PURE__ */ jsx(
632
+ "div",
633
+ {
634
+ className: clsx(areasViewerClasses.windowToastyContainer, areasViewerClasses[toasty.type]),
635
+ children: /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowToastyMeesageButtonsContainer, children: [
636
+ /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowToastyMessage, children: [
637
+ toasty.timer ? /* @__PURE__ */ jsx(LinearProgress, { variant: "determinate", value: toasty.percentExecuted }) : null,
638
+ toasty.message
639
+ ] }),
640
+ /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowToastyButtonsContainer, children: [
641
+ /* @__PURE__ */ jsx(
642
+ IconButton,
643
+ {
644
+ className: clsx(
645
+ areasViewerClasses.windowToastyPin,
646
+ toasty.timer ? null : areasViewerClasses.pinIn
647
+ ),
648
+ onClick: () => {
649
+ pinToasty(windowId, toastyId);
650
+ },
651
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.TOASTY_PIN}`
652
+ }
653
+ ),
654
+ /* @__PURE__ */ jsx(
655
+ IconButton,
656
+ {
657
+ className: areasViewerClasses.windowToastyClose,
658
+ onClick: () => {
659
+ closeToasty(windowId, toastyId);
660
+ },
661
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.TOASTY_CLOSE}`
662
+ }
663
+ )
664
+ ] })
665
+ ] })
666
+ }
667
+ );
668
+ }
669
+ function Toasties(props) {
670
+ const { windowId } = props;
671
+ const tosties = useAreasStore((state) => state.hashWindows[windowId].toasties, shallow);
672
+ if (tosties.length === 0) {
673
+ return null;
674
+ }
675
+ return /* @__PURE__ */ jsx("div", { className: areasViewerClasses.windowToastiesContainer, children: /* @__PURE__ */ jsx("div", { className: areasViewerClasses.windowToastiesContainerTostys, children: tosties.map((t) => {
676
+ return /* @__PURE__ */ jsx(Toasty, { windowId, toastyId: t.id }, t.id);
677
+ }) }) });
678
+ }
679
+ const Window = (props) => {
680
+ const { areaId, windowId } = props;
681
+ const [emergeType, moduleId, winType] = useAreasStore((state) => {
682
+ return [
683
+ state.hashWindows[windowId]?.emergeType,
684
+ state.hashWindows[windowId]?.moduleId,
685
+ state.hashWindows[windowId]?.winType
686
+ ];
687
+ }, shallow);
688
+ const selected = useAreasStore((state) => {
689
+ return emergeType === "layout" ? state.hashAreas[areaId]?.currentLayoutId : state.hashAreas[areaId]?.currentPopUpId;
690
+ }) === windowId;
691
+ const mfProps = useAreasStore((state) => state.hashWindows[windowId]?.mfProps, shallow);
692
+ const component = useAreasStore(
693
+ (state) => state.hashWindows[windowId]?.component,
694
+ shallow
695
+ );
696
+ const loading = useAreasStore((state) => state.hashWindows[windowId]?.loading, shallow);
697
+ const status = useAreasStore((state) => state.hashWindows[windowId]?.status, shallow);
698
+ const dynamicMFStore = useAreasStore(
699
+ (state) => state.hashWindows[windowId]?.dynamicMFStore,
700
+ shallow
701
+ );
702
+ const {
703
+ setActions,
704
+ getCookie,
705
+ getCookies,
706
+ setCookie,
707
+ close,
708
+ startProgress,
709
+ stopProgress,
710
+ toast,
711
+ setFnQueryClose
712
+ } = useAreasStore((state) => state.windowActions, shallow);
713
+ const { selectLayout } = useAreasStore((state) => state.areaActions, shallow);
714
+ const { loadCookiesFromApi } = useAreasStore((state) => state.windowActions, shallow);
715
+ const onTouch = () => {
716
+ if (!selected) {
717
+ selectLayout(areaId, props.windowId);
718
+ }
719
+ };
720
+ const windowTools = useMemo(
721
+ () => ({
722
+ getWindowId: () => windowId,
723
+ setActions: (newActions, version) => {
724
+ setActions(windowId, newActions, version);
725
+ },
726
+ getCookie: (id) => getCookie(windowId, id),
727
+ getCookies: (type) => getCookies(windowId, type),
728
+ setCookie: (id, type, cookie) => {
729
+ setCookie(windowId, id, type, cookie);
730
+ },
731
+ close: () => close(windowId),
732
+ startProgress: () => startProgress(windowId),
733
+ stopProgress: () => stopProgress(windowId),
734
+ setFnQueryClose: (fnQueryClose) => {
735
+ setFnQueryClose(windowId, fnQueryClose);
736
+ },
737
+ toast: (toastyOptions) => {
738
+ toast(windowId, toastyOptions);
739
+ }
740
+ }),
741
+ []
742
+ );
743
+ useEffect(() => {
744
+ if (status === "init") {
745
+ loadCookiesFromApi(windowId);
746
+ }
747
+ }, [status]);
748
+ if (status === void 0) {
749
+ return null;
750
+ }
751
+ return /* @__PURE__ */ jsx(
752
+ WindowRoot,
753
+ {
754
+ role: "presentation",
755
+ className: clsx(
756
+ areasViewerClasses.windowRoot,
757
+ selected ? areasViewerClasses.selectedWindow : null,
758
+ loading ? areasViewerClasses.loading : null,
759
+ emergeType === "popup" ? areasViewerClasses.windowPopupRoot : null,
760
+ emergeType === "modal" ? areasViewerClasses.windowModalRoot : null
761
+ ),
762
+ onMouseDown: onTouch,
763
+ ...process.env.NODE_ENV !== "production" ? {
764
+ [TEST_PROP_ID]: getNameDataTestId(
765
+ AREAS_VIEWER_CLASS_NAME,
766
+ "windowRoot",
767
+ `${emergeType}`
768
+ )
769
+ } : {},
770
+ children: /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowRootContainer, children: [
771
+ /* @__PURE__ */ jsx(Header, { areaId, windowId, emergeType }),
772
+ /* @__PURE__ */ jsx(Toasties, { windowId }),
773
+ /* @__PURE__ */ jsxs(
774
+ "div",
775
+ {
776
+ className: clsx(
777
+ areasViewerClasses.windowContent
778
+ ),
779
+ children: [
780
+ status === "init" ? /* @__PURE__ */ jsx(Fragment, { children: "Cargando..." }) : null,
781
+ status === "loaded" ? winType === "microfrontend" ? /* @__PURE__ */ jsx(
782
+ MemonizedMicroFrontend,
783
+ {
784
+ moduleId,
785
+ dynamicMFStore,
786
+ windowTools,
787
+ ...mfProps
788
+ }
789
+ ) : /* @__PURE__ */ jsx(
790
+ Component,
791
+ {
792
+ moduleId,
793
+ dynamicMFStore,
794
+ windowTools,
795
+ component
796
+ }
797
+ ) : null
798
+ ]
799
+ }
800
+ )
801
+ ] })
802
+ }
803
+ );
804
+ };
805
+ React__default.memo(Window);
806
+ const ResizeHandle = React__default.forwardRef(
807
+ (props, ref) => {
808
+ const { handleAxis, ...restProps } = props;
809
+ return /* @__PURE__ */ jsx(
810
+ "div",
811
+ {
812
+ ref,
813
+ className: clsx(
814
+ `react-resizable-handle react-resizable-handle-${handleAxis}`,
815
+ areasViewerClasses.resizeHandle
816
+ ),
817
+ ...restProps
818
+ }
819
+ );
820
+ }
821
+ );
822
+ const ResponsiveGridLayout = withSizeProvider(Responsive);
823
+ const AreaGridLayout = (props) => {
824
+ const { areaId } = props;
825
+ const hashLayoutItems = useAreasStore((state) => state.hashAreas[areaId].layoutItemsIds, shallow);
826
+ const layouts = useAreasStore((state) => state.hashAreas[areaId].layouts, shallow);
827
+ const breakpoints = useAreasStore((state) => state.hashAreas[areaId].breakpoints, shallow);
828
+ const maximizedId = useAreasStore((state) => state.hashAreas[areaId].maximizedId, shallow);
829
+ const cols = useAreasStore((state) => state.hashAreas[areaId].cols, shallow);
830
+ const { onBreakpointsLayoutsChange, onContainerChange } = useAreasStore(
831
+ (state) => state.areaActions,
832
+ shallow
833
+ );
834
+ return /* @__PURE__ */ jsx(
835
+ ResponsiveGridLayout,
836
+ {
837
+ autoSize: false,
838
+ compactType: "vertical",
839
+ measureBeforeMount: true,
840
+ resizeHandles: ["nw", "se"],
841
+ className: clsx(
842
+ areasViewerClasses.areaGridLayout,
843
+ `${areasViewerClasses.areaGridLayout}-${areaId}`
844
+ ),
845
+ layouts,
846
+ onLayoutChange: (layout, newLayouts) => onBreakpointsLayoutsChange(areaId, layout, newLayouts),
847
+ draggableHandle: ".m4l_draggable_handle",
848
+ draggableCancel: `.${areasViewerClasses.windowHeaderCancelHandle}`,
849
+ layoutItemRender: (p) => {
850
+ if (hashLayoutItems.indexOf(p.i) === -1) {
851
+ return /* @__PURE__ */ jsx(Fragment, {});
852
+ }
853
+ if (p.type === "placeholder") {
854
+ return /* @__PURE__ */ jsx("div", {});
855
+ }
856
+ return /* @__PURE__ */ jsx(Window, { windowId: p.i, areaId });
857
+ },
858
+ breakpoints,
859
+ colapsedHeight: RESPONSIVE_COLAPSED_HEIGHTS,
860
+ rowHeight: RESPONSIVE_ROW_HEIGHTS,
861
+ cols,
862
+ containerMargin: [MARGIN_GRIDLAYOUT, MARGIN_GRIDLAYOUT],
863
+ containerPadding: [PADDING_GRIDLAYOUT, PADDING_GRIDLAYOUT],
864
+ onContainerChange: (e) => {
865
+ onContainerChange(areaId, e);
866
+ },
867
+ preventCollision: false,
868
+ maximizeId: maximizedId,
869
+ resizeHandle: /* @__PURE__ */ jsx(ResizeHandle, {})
870
+ }
871
+ );
872
+ };
873
+ const PanelWindows = (props) => {
874
+ const { areaId } = props;
875
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
876
+ const maximizedId = useAreasStore((state) => state.hashAreas[areaId].maximizedId);
877
+ const maximizedIdParent = useAreasStore(
878
+ (state) => state.hashWindows[maximizedId || ""]?.parentLayoutId || void 0
879
+ );
880
+ const hashLayoutItems = useAreasStore(
881
+ (state) => state.hashAreas[areaId].layoutItemsIds.filter((itemId) => state.hashWindows[itemId].emergeType === "layout").map((key) => ({
882
+ i: key,
883
+ url_icon: state.hashWindows[key].url_icon,
884
+ title: state.hashWindows[key].title,
885
+ moduleId: state.hashWindows[key].moduleId,
886
+ emergeType: state.hashWindows[key].emergeType,
887
+ windowId: state.hashWindows[key].windowId
888
+ })),
889
+ shallow
890
+ );
891
+ const { maximizeLayout } = useAreasStore((state) => state.areaActions);
892
+ const onTouched = (layoutId) => {
893
+ maximizeLayout(areaId, layoutId);
894
+ };
895
+ const location = useLocation();
896
+ const searchParams = new URLSearchParams(location.search);
897
+ const currentParam = searchParams.get("module");
898
+ if (status === "loaded") {
899
+ if (!maximizedId || hashLayoutItems.length < 2) {
900
+ return null;
901
+ }
902
+ return /* @__PURE__ */ jsx("div", { className: areasViewerClasses.panelWindowsRoot, children: hashLayoutItems.map((kl) => {
903
+ return /* @__PURE__ */ jsx(
904
+ "div",
905
+ {
906
+ className: clsx(
907
+ areasViewerClasses.panelWindowsButtonContainer,
908
+ maximizedId === kl.i && kl.emergeType !== "popup" || maximizedIdParent === kl.windowId && kl.moduleId === currentParam ? areasViewerClasses.selected : null
909
+ ),
910
+ children: /* @__PURE__ */ jsx(
911
+ IconButton,
912
+ {
913
+ src: kl.url_icon,
914
+ size: "small",
915
+ onClick: () => onTouched(kl.i),
916
+ tooltip: maximizedId !== kl.i ? kl.title : void 0
917
+ }
918
+ )
919
+ },
920
+ kl.i
921
+ );
922
+ }) });
923
+ } else {
924
+ return null;
925
+ }
926
+ };
927
+ const InnerForHooks = (props) => {
928
+ const { areaId } = props;
929
+ const isDesktop = useResponsiveDesktop();
930
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
931
+ return /* @__PURE__ */ jsxs(
932
+ "div",
933
+ {
934
+ className: clsx(
935
+ areasViewerClasses.areaGridLayoutPanelContainer,
936
+ `${areasViewerClasses.areaGridLayoutPanelContainer}-${areaId}`
937
+ ),
938
+ children: [
939
+ status === "loaded" ? /* @__PURE__ */ jsx(AreaGridLayout, { areaId }) : /* @__PURE__ */ jsx(LoadingError, { status, action: () => {
940
+ } }),
941
+ isDesktop ? /* @__PURE__ */ jsx(PanelWindows, { areaId }) : null
942
+ ]
943
+ }
944
+ );
945
+ };
946
+ const Area = (props) => {
947
+ const { selected, areaId } = props;
948
+ const classesAreaRoot = useAreasStore((state) => state.viwerClasses.areaRoot);
949
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
950
+ if (status === "init") {
951
+ return null;
952
+ }
953
+ return /* @__PURE__ */ jsx(
954
+ "div",
955
+ {
956
+ className: clsx(
957
+ classesAreaRoot,
958
+ selected ? areasViewerClasses.selected : null,
959
+ status === "loading" ? areasViewerClasses.loading : null
960
+ ),
961
+ children: /* @__PURE__ */ jsx(InnerForHooks, { areaId })
962
+ }
963
+ );
964
+ };
965
+ Area.displayName = "Area";
966
+ styled$1("div")(({ theme }) => ({
967
+ display: "flex",
968
+ flexDirection: "column",
969
+ height: "100%",
970
+ overflow: "hidden",
971
+ padding: theme.spacing(3)
972
+ }));
973
+ const WrapperWindowModal = styled$1(Dialog)(({ theme }) => ({
974
+ hola: 1,
975
+ backgroundColor: theme.vars.palette.background.paper,
976
+ "& .MuiDialog-container": {},
977
+ "&.m4l_selected": {
978
+ borderTop: "1px solid green"
979
+ },
980
+ ...theme.components?.M4LAreasViewerModal?.styleOverrides
981
+ }));
982
+ const WindowModal = (props) => {
983
+ const { windowId } = props;
984
+ const { onClose } = useAreasStore((state) => state.hashWindowsModals[windowId]);
985
+ const { host_static_assets, environment_assets } = useEnvironment();
986
+ const isDesktop = useResponsiveDesktop();
987
+ const DragabblePaperComponent = (_props) => {
988
+ return /* @__PURE__ */ jsx(
989
+ cjs.exports,
990
+ {
991
+ handle: ".m4l_draggable_handle",
992
+ bounds: "parent",
993
+ children: /* @__PURE__ */ jsx(
994
+ ResizeableWindow,
995
+ {
996
+ width: props.windowProps?.width || 400,
997
+ height: props.windowProps?.height || 300,
998
+ handle: (resizeHandle, ref) => /* @__PURE__ */ jsx("div", { ref, children: /* @__PURE__ */ jsx(
999
+ Icon,
1000
+ {
1001
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.RESIZE}`,
1002
+ className: `custom-handle custom-handle-${resizeHandle}`
1003
+ }
1004
+ ) }, resizeHandle),
1005
+ children: /* @__PURE__ */ jsx(Window, { ...props })
1006
+ }
1007
+ )
1008
+ }
1009
+ );
1010
+ };
1011
+ function PaperComponent(_props) {
1012
+ return /* @__PURE__ */ jsx(Window, { ...props });
1013
+ }
1014
+ return /* @__PURE__ */ jsx(
1015
+ WrapperWindowModal,
1016
+ {
1017
+ className: areasViewerClasses.windowModalRoot,
1018
+ open: true,
1019
+ scroll: "paper",
1020
+ onKeyDown: (event) => {
1021
+ if (event.key === "Escape") {
1022
+ onClose && onClose(windowId);
1023
+ }
1024
+ },
1025
+ "aria-labelledby": "child-modal-title",
1026
+ "aria-describedby": "child-modal-description",
1027
+ PaperComponent: isDesktop ? DragabblePaperComponent : PaperComponent,
1028
+ maxWidth: false,
1029
+ fullWidth: !isDesktop,
1030
+ fullScreen: false,
1031
+ disableEnforceFocus: true
1032
+ }
1033
+ );
1034
+ };
1035
+ const MemonizedWindowModal = React__default.memo(WindowModal);
1036
+ function AreasViewer() {
1037
+ const areas = useAreasStore((state) => state.areasIds, shallow);
1038
+ const windowsModals = useAreasStore((state) => state.windowsModals);
1039
+ const hashWindowsModals = useAreasStore((state) => state.hashWindowsModals);
1040
+ const currentArea = useAreasStore((state) => state.currentAreaId);
1041
+ const status = useAreasStore((state) => state.ownerState.status);
1042
+ const classesRoot = useAreasStore((state) => state.viwerClasses.root);
1043
+ const { init } = useAreasStore((state) => state.areasActions);
1044
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1045
+ /* @__PURE__ */ jsx(
1046
+ AreasViewerRoot,
1047
+ {
1048
+ className: classesRoot,
1049
+ ...process.env.NODE_ENV !== "production" ? {
1050
+ [TEST_PROP_ID]: getNameDataTestId(
1051
+ AREAS_VIEWER_CLASS_NAME,
1052
+ "root",
1053
+ ""
1054
+ )
1055
+ } : {},
1056
+ children: status === "loaded" ? areas.map((area) => {
1057
+ return /* @__PURE__ */ jsx(Area, { areaId: area, selected: currentArea === area }, area);
1058
+ }) : /* @__PURE__ */ jsx(LoadingError, { status, action: () => init() })
1059
+ }
1060
+ ),
1061
+ windowsModals.map((wm) => {
1062
+ if (hashWindowsModals[wm]) {
1063
+ return /* @__PURE__ */ jsx(MemonizedWindowModal, { ...hashWindowsModals[wm] }, wm);
1064
+ }
1065
+ return null;
1066
+ })
1067
+ ] });
1068
+ }
1069
+ export {
1070
+ AreasViewer as A,
1071
+ useAreasViewerUtilityClasses as u
1072
+ };