@m4l/components 0.1.63 → 0.1.65

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 (228) hide show
  1. package/@types/export.d.ts +9 -5
  2. package/components/CommonActions/components/ActionCancel/{index.2eb2c1e1.js → index.0f471356.js} +1 -1
  3. package/components/CommonActions/components/ActionFormCancel/{index.2864d574.js → index.4d2f599e.js} +16 -18
  4. package/components/CommonActions/components/ActionFormIntro/{index.e7f83ddd.js → index.0eed3ba3.js} +1 -1
  5. package/components/CommonActions/components/ActionIntro/{index.0d138cb3.js → index.41a598d6.js} +2 -2
  6. package/components/CommonActions/components/Actions/{index.433cd345.js → index.3b882471.js} +15 -18
  7. package/components/DataGrid/{index.42521a55.js → index.dc84293a.js} +32 -35
  8. package/components/DynamicFilter/{index.442bda79.js → index.abc697c7.js} +38 -46
  9. package/components/DynamicFilter/index.d.ts +1 -1
  10. package/components/HelperText/{index.3c07ca2a.js → index.1a24d41b.js} +10 -10
  11. package/components/Icon/{index.0f9b360e.js → index.6938827f.js} +2 -2
  12. package/components/Icon/tests/utils.d.ts +1 -1
  13. package/components/Image/{index.1a9c0327.js → index.674024d4.js} +1 -1
  14. package/components/LanguagePopover/{index.68de7176.js → index.47aa8119.js} +11 -11
  15. package/components/ModalDialog/{index.3efe049b.js → index.3db4480d.js} +5 -5
  16. package/components/NavLink/{index.ae9f1cc9.js → index.0d125c6b.js} +11 -11
  17. package/components/NoItemSelected/{index.7cfd7613.js → index.1aa96110.js} +1 -1
  18. package/components/ObjectLogs/{index.b50726fb.js → index.05788334.js} +18 -21
  19. package/components/PaperForm/{index.44bf4469.js → index.b3da0da3.js} +1 -1
  20. package/components/Period/{index.99feb99e.js → index.a1b7b4cc.js} +16 -19
  21. package/components/Resizeable/{index.b5d42efb.js → index.ee84ebc5.js} +3 -3
  22. package/components/SideBar/{index.011880b6.js → index.99ce4e06.js} +7 -7
  23. package/components/areas/components/AreasAdmin/classes/index.d.ts +5 -0
  24. package/components/areas/components/AreasAdmin/classes/types.d.ts +11 -0
  25. package/components/areas/components/AreasAdmin/index.46fab65b.js +135 -0
  26. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/types.d.ts +1 -1
  27. package/components/areas/components/AreasViewer/classes/index.d.ts +5 -0
  28. package/components/areas/components/AreasViewer/classes/types.d.ts +19 -0
  29. package/components/areas/components/AreasViewer/index.1aa4d12d.js +1972 -0
  30. package/components/areas/components/AreasViewer/index.d.ts +7 -0
  31. package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/contexts}/AreaContext/helper.d.ts +2 -2
  32. package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/contexts}/AreaContext/index.d.ts +3 -3
  33. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/store.d.ts +11 -0
  34. package/components/areas/{contexts/AreaContext/store.d.ts → components/AreasViewer/subcomponents/Area/contexts/AreaContext/types.d.ts} +29 -16
  35. package/components/areas/components/AreasViewer/subcomponents/Area/index.d.ts +12 -0
  36. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/GridLayout/index.d.ts +5 -0
  37. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/index.d.ts +6 -0
  38. package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/store.d.ts +8 -3
  39. package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/types.d.ts +1 -1
  40. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/index.d.ts +1 -1
  41. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/index.d.ts +1 -1
  42. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Component/index.d.ts +1 -1
  43. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/helper.d.ts +3 -0
  44. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/subcomponents/MainActions/index.d.ts +1 -0
  45. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/index.d.ts +1 -1
  46. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +8 -0
  47. package/components/areas/components/{WindowModal → AreasViewer/subcomponents/Area/subcomponents/WindowModal}/index.d.ts +1 -1
  48. package/components/areas/components/{WindowPopUp → AreasViewer/subcomponents/Area/subcomponents/WindowPopUp}/index.d.ts +1 -1
  49. package/components/areas/components/{Area → AreasViewer/subcomponents/Area}/types.d.ts +6 -11
  50. package/components/areas/components/index.9de77fae.js +12 -0
  51. package/components/areas/components/index.d.ts +4 -4
  52. package/components/areas/constants.d.ts +3 -0
  53. package/components/areas/contexts/AreasContext/{index.0792a8d1.js → index.b3b26965.js} +78 -44
  54. package/components/areas/contexts/AreasContext/index.d.ts +10 -4
  55. package/components/areas/contexts/AreasContext/store.d.ts +8 -29
  56. package/components/areas/contexts/AreasContext/types.d.ts +119 -0
  57. package/components/areas/contexts/WindowToolsMFContext/types.d.ts +3 -2
  58. package/components/areas/contexts/index.4ebef035.js +21 -0
  59. package/components/areas/dictionary.d.ts +9 -14
  60. package/components/areas/hooks/{index.f4d78492.js → index.ffb1009e.js} +3 -2
  61. package/components/areas/hooks/useArea/{index.d6263051.js → index.c7e4f3fc.js} +17 -3
  62. package/components/areas/hooks/useArea/index.d.ts +1 -1
  63. package/components/areas/hooks/useAreas/index.d.ts +1 -1
  64. package/components/areas/hooks/useDynamicMFParameters/{index.041a666b.js → index.9a25f88a.js} +1 -1
  65. package/components/areas/hooks/useWindow/index.d.ts +1 -1
  66. package/components/areas/icons.d.ts +8 -0
  67. package/components/areas/index.bfe6bf91.js +46 -0
  68. package/components/areas/index.d.ts +1 -0
  69. package/components/formatters/BooleanFormatter/{index.cd00c8e1.js → index.7b9e92f8.js} +1 -1
  70. package/components/formatters/{index.deae4701.js → index.01b027ad.js} +2 -2
  71. package/components/hook-form/RHFAutocomplete/{index.083e23c1.js → index.73d33896.js} +13 -12
  72. package/components/hook-form/RHFAutocomplete/test/constants.d.ts +1 -0
  73. package/components/hook-form/RHFAutocomplete/test/utils.d.ts +1 -1
  74. package/components/hook-form/RHFAutocompleteAsync/{index.ba751be9.js → index.21f4cb53.js} +2 -2
  75. package/components/hook-form/RHFCheckbox/{index.c19393b1.js → index.c3b1884b.js} +3 -3
  76. package/components/hook-form/RHFPeriod/{index.c0a80aeb.js → index.cc624bb3.js} +2 -2
  77. package/components/hook-form/RHFTextField/{index.97485ff2.js → index.15659666.js} +13 -13
  78. package/components/hook-form/RHFUpload/{index.798eb11d.js → index.ecf5c788.js} +1 -1
  79. package/components/index.d.ts +1 -3
  80. package/components/modal/{WindowBase.59f50553.js → WindowBase.1b0657de.js} +3 -3
  81. package/components/modal/{WindowConfirm.c1339cf8.js → WindowConfirm.60028bce.js} +18 -21
  82. package/components/modal/index.fde6acc3.js +27 -0
  83. package/components/mui_extended/Accordion/{index.b7487e37.js → index.95a1b021.js} +2 -2
  84. package/components/mui_extended/Button/{index.d9e0ae2e.js → index.e4c61b66.js} +3 -3
  85. package/components/mui_extended/IconButton/{index.be9c2ce5.js → index.78a489d3.js} +15 -11
  86. package/components/mui_extended/IconButton/types.d.ts +1 -1
  87. package/components/mui_extended/MenuActions/icons.d.ts +3 -0
  88. package/components/mui_extended/MenuActions/{index.ec654122.js → index.742a57d7.js} +21 -20
  89. package/components/mui_extended/MenuActions/types.d.ts +5 -6
  90. package/components/mui_extended/Pager/{index.9e123670.js → index.a44594e9.js} +5 -5
  91. package/components/mui_extended/Popover/{index.260aae81.js → index.e271e4f0.js} +1 -0
  92. package/components/mui_extended/Typography/{index.41b60a6b.js → index.86505aed.js} +1 -1
  93. package/components/mui_extended/index.61356a6a.js +19 -0
  94. package/contexts/ModalContext/{index.ae8041f3.js → index.bfc47ba9.js} +1 -1
  95. package/hooks/useModal/{index.5c159ed2.js → index.979ab2ea.js} +1 -1
  96. package/index.js +111 -116
  97. package/package.json +5 -6
  98. package/{react-draggable.1aa81436.js → react-draggable.d6441025.js} +1 -1
  99. package/{react-resizable.e86cb01e.js → react-resizable.79fb7404.js} +5 -4
  100. package/utils/{index.e199226a.js → index.64775c34.js} +32 -32
  101. package/{vendor.a15d263e.js → vendor.2d9f95b4.js} +50 -52
  102. package/components/AccountPopover/style.d.ts +0 -2
  103. package/components/AccountPopover/subcomponents/PopOver/styles.d.ts +0 -8
  104. package/components/AppBar/styles.d.ts +0 -2
  105. package/components/CommonActions/components/Actions/styles.d.ts +0 -2
  106. package/components/DataGrid/styles.d.ts +0 -3
  107. package/components/DataGrid/subcomponents/Actions/styles.d.ts +0 -2
  108. package/components/DataGrid/subcomponents/Actions/subcomponents/Density/styles.d.ts +0 -3
  109. package/components/DataGrid/subcomponents/Actions/subcomponents/Filter/styles.d.ts +0 -2
  110. package/components/DataGrid/subcomponents/Actions/subcomponents/RowsCount/styles.d.ts +0 -4
  111. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/styles.d.ts +0 -2
  112. package/components/DataGrid/subcomponents/Actions/subcomponents/Settings/subcomponents/ColumnsConfig/styles.d.ts +0 -8
  113. package/components/DataGrid/subcomponents/Table/styles.d.ts +0 -3
  114. package/components/DataGrid/subcomponents/Table/subcomponents/SkeletonFormatter/styles.d.ts +0 -2
  115. package/components/DataGrid/subcomponents/editors/TextEditor/index.d.ts +0 -6
  116. package/components/DynamicFilter/subcomponents/ApplyedFilters/styles.d.ts +0 -3
  117. package/components/DynamicFilter/subcomponents/ApplyedFilters/subcomponents/ApplyedFilter/styles.d.ts +0 -6
  118. package/components/DynamicFilter/subcomponents/ClearFilters/styles.d.ts +0 -3
  119. package/components/DynamicFilter/subcomponents/FilterButton/styles.d.ts +0 -3
  120. package/components/DynamicFilter/subcomponents/InnerForHooks/styles.d.ts +0 -3
  121. package/components/DynamicFilter/subcomponents/InputFilter/styles.d.ts +0 -2
  122. package/components/DynamicFilter/subcomponents/PopoverFilter/styles.d.ts +0 -3
  123. package/components/DynamicFilter/subcomponents/fieldstypes/BooleanFilter/styles.d.ts +0 -2
  124. package/components/DynamicFilter/subcomponents/fieldstypes/DateTimeFilter/styles.d.ts +0 -2
  125. package/components/DynamicFilter/subcomponents/fieldstypes/NumberFilter/styles.d.ts +0 -2
  126. package/components/DynamicFilter/subcomponents/fieldstypes/StringFilter/styles.d.ts +0 -2
  127. package/components/HelperText/styles.d.ts +0 -2
  128. package/components/Icon/styles.d.ts +0 -4
  129. package/components/Image/styles.d.ts +0 -3
  130. package/components/Image/subcomponents/LazyLoadComponent/styles.d.ts +0 -2
  131. package/components/Image/subcomponents/Skeleton/styles.d.ts +0 -2
  132. package/components/LanguagePopover/styles.d.ts +0 -6
  133. package/components/NavLink/styles.d.ts +0 -2
  134. package/components/NoItemSelected/styles.d.ts +0 -5
  135. package/components/ObjectLogs/components/DetailDialog/styles.d.ts +0 -3
  136. package/components/ObjectLogs/styles.d.ts +0 -4
  137. package/components/PaperForm/styles.d.ts +0 -7
  138. package/components/Period/styles.d.ts +0 -7
  139. package/components/PropertyValue/styles.d.ts +0 -6
  140. package/components/ResizeableWindow/styles.d.ts +0 -5
  141. package/components/ScrollBar/styles.d.ts +0 -8
  142. package/components/SideBar/styles.d.ts +0 -5
  143. package/components/SideBar/subcomponents/ContentDesktop/style.d.ts +0 -2
  144. package/components/SideBar/subcomponents/ContentDesktop/subcomponents/CollapseButton/styles.d.ts +0 -3
  145. package/components/SideBar/subcomponents/ContentGroups/styles.d.ts +0 -5
  146. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/styles.d.ts +0 -2
  147. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/ArrowIcon/styles.d.ts +0 -2
  148. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/styles.d.ts +0 -9
  149. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavItemRoot/subcomponents/NavItemRootContent/styles.d.ts +0 -3
  150. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/styles.d.ts +0 -2
  151. package/components/SideBar/subcomponents/ContentGroups/subcomponents/ItemListRoot/subcomponents/NavListSub/subcomponents/NavItemSub/subcomponents/NavItemSubContent/styles.d.ts +0 -22
  152. package/components/SideBar/subcomponents/ContentGroups/subcomponents/Skeleton/styles.d.ts +0 -5
  153. package/components/SideBar/subcomponents/ContentMobile/styles.d.ts +0 -3
  154. package/components/SplitLayout/styles.d.ts +0 -4
  155. package/components/animate/LoadingScreen/styles.d.ts +0 -3
  156. package/components/animate/PropagateLoader/syles.d.ts +0 -2
  157. package/components/areas/components/Area/index.d.ts +0 -5
  158. package/components/areas/components/Area/styles.d.ts +0 -6
  159. package/components/areas/components/AreasAdmin/index.51e28f63.js +0 -120
  160. package/components/areas/components/AreasAdmin/styles.d.ts +0 -2
  161. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/styles.d.ts +0 -3
  162. package/components/areas/components/AreasContainer/index.1e5e6e91.js +0 -37
  163. package/components/areas/components/AreasContainer/index.d.ts +0 -1
  164. package/components/areas/components/AreasContainer/styles.d.ts +0 -2
  165. package/components/areas/components/GridLayout/index.5bf8d5e4.js +0 -103
  166. package/components/areas/components/GridLayout/index.d.ts +0 -1
  167. package/components/areas/components/GridLayout/styles.d.ts +0 -7
  168. package/components/areas/components/Window/icons.d.ts +0 -3
  169. package/components/areas/components/Window/index.416a874f.js +0 -855
  170. package/components/areas/components/Window/styles.d.ts +0 -6
  171. package/components/areas/components/Window/subcomponents/InnerForHooks/styles.d.ts +0 -2
  172. package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/Header/styles.d.ts +0 -9
  173. package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/styles.d.ts +0 -2
  174. package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/styles.d.ts +0 -2
  175. package/components/areas/components/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +0 -8
  176. package/components/areas/components/WindowModal/styles.d.ts +0 -3
  177. package/components/areas/components/WindowPopUp/index.f053fca7.js +0 -118
  178. package/components/areas/components/WindowsPanel/index.d.ts +0 -1
  179. package/components/areas/components/WindowsPanel/styles.d.ts +0 -10
  180. package/components/areas/components/index.eace295a.js +0 -77
  181. package/components/areas/contexts/AreaContext/index.7890e58d.js +0 -509
  182. package/components/areas/contexts/AreaContext/types.d.ts +0 -20
  183. package/components/areas/contexts/index.2a915acf.js +0 -198
  184. package/components/areas/index.8fca0f8f.js +0 -20
  185. package/components/hook-form/RHFAutocomplete/styles.d.ts +0 -2
  186. package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/styles.d.ts +0 -2
  187. package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/styles.d.ts +0 -4
  188. package/components/hook-form/RHFAutocompleteAsync/styles.d.ts +0 -5
  189. package/components/hook-form/RHFCheckbox/styles.d.ts +0 -15
  190. package/components/hook-form/RHFCheckbox/subcomponents/Skeleton/styles.d.ts +0 -3
  191. package/components/hook-form/RHFDateTime/subcomponents/Skeleton/styles.d.ts +0 -2
  192. package/components/hook-form/RHFPeriod/styles.d.ts +0 -2
  193. package/components/hook-form/RHFTextField/styles.d.ts +0 -3
  194. package/components/hook-form/RHFTextField/subcomponents/Skeleton/styles.d.ts +0 -3
  195. package/components/hook-form/RHFTextFieldPassword/styles.d.ts +0 -2
  196. package/components/hook-form/RHFUpload/RHFUploadImage/styles.d.ts +0 -2
  197. package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/styles.d.ts +0 -12
  198. package/components/hook-form/RHFUpload/RHFUploadImage/subcomponents/UploadImage/subcomponents/Skeleton/styles.d.ts +0 -2
  199. package/components/modal/ModalDialog/styles.d.ts +0 -9
  200. package/components/modal/WindowBase/styles.d.ts +0 -2
  201. package/components/modal/WindowBase/subcomponents/Header/styles.d.ts +0 -6
  202. package/components/modal/WindowConfirm/subcomponents/MessageIlustration/styles.d.ts +0 -6
  203. package/components/modal/index.7a84f64d.js +0 -30
  204. package/components/mui_extended/Accordion/styles.d.ts +0 -4
  205. package/components/mui_extended/Button/styles.d.ts +0 -13
  206. package/components/mui_extended/IconButton/styles.d.ts +0 -2
  207. package/components/mui_extended/ImageButton/styles.d.ts +0 -2
  208. package/components/mui_extended/LoadingButton/styles.d.ts +0 -2
  209. package/components/mui_extended/MenuActions/styles.d.ts +0 -30
  210. package/components/mui_extended/Pager/components/PagerActions/styles.d.ts +0 -2
  211. package/components/mui_extended/Pager/styles.d.ts +0 -6
  212. package/components/mui_extended/Popover/styles.d.ts +0 -1
  213. package/components/mui_extended/Popover/subcomponts/ArrowIcon/index.d.ts +0 -3
  214. package/components/mui_extended/Tab/styles.d.ts +0 -2
  215. package/components/mui_extended/Typography/styles.d.ts +0 -2
  216. package/components/mui_extended/index.459cbd6c.js +0 -19
  217. package/contexts/RHFormContext/styles.d.ts +0 -2
  218. package/components/areas/components/{Area → AreasViewer/subcomponents/Area}/subcomponents/InnerForHooks/index.d.ts +0 -0
  219. package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/helper.d.ts +0 -0
  220. package/components/areas/{contexts → components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts}/WindowContext/index.d.ts +0 -0
  221. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Header/index.d.ts +0 -0
  222. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/Header/skeleton.d.ts +0 -0
  223. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/index.d.ts +0 -0
  224. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/index.d.ts +0 -0
  225. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/index.d.ts +0 -0
  226. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/types.d.ts +0 -0
  227. package/components/areas/components/{Window → AreasViewer/subcomponents/Area/subcomponents/Window}/subcomponents/InnerForHooks/subcomponents/MicroFrontend/subcomponents/MFLoader/subcomponents/LoadingMF/types.d.ts +0 -0
  228. package/components/areas/contexts/DynamicMFParmsContext/{index.c19cb8cc.js → index.5b3248df.js} +14 -14
@@ -0,0 +1,1972 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { r as react_resizable_css } from "../../../../react-resizable.79fb7404.js";
3
+ import { generateUtilityClasses, Skeleton, styled as styled$1, Typography as Typography$1, Dialog } from "@mui/material";
4
+ import { unstable_composeClasses } from "@mui/base";
5
+ import { g as getComponentUtilityClass } from "../../../../utils/index.64775c34.js";
6
+ import { a as AREAS_VIEWER_CLASS_NAME, g as getAreasDictionary, I as ICONS } from "../../index.bfe6bf91.js";
7
+ import React__default, { createContext, useRef, useEffect, useMemo, useState, useCallback } from "react";
8
+ import { shallow } from "zustand/shallow";
9
+ import { useNetwork, useModuleDictionary, useEnvironment, useModuleSkeleton, useHostTools, axiosOperation } from "@m4l/core";
10
+ import { createStore, useStore } from "zustand";
11
+ import { immer } from "zustand/middleware/immer";
12
+ import { devtools } from "zustand/middleware";
13
+ import debounce from "lodash/debounce";
14
+ import cloneDeep from "lodash.clonedeep";
15
+ import { u as useAreasStore, a as useArea, b as useAreas, c as useAreaStore } from "../../hooks/useArea/index.c7e4f3fc.js";
16
+ import { useResponsiveDesktop, useFirstRender, useHostTheme, useFormatter, useLocales } from "@m4l/graphics";
17
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
18
+ import { WidthProvider, Responsive } from "react-grid-layout";
19
+ import { I as Icon } from "../../../Icon/index.6938827f.js";
20
+ import { m } from "framer-motion";
21
+ import "react-router-dom";
22
+ import "../../../animate/LoadingScreen/index.1d0c4307.js";
23
+ import "../../../animate/PropagateLoader/index.be5b02c3.js";
24
+ import { I as IconButton } from "../../../mui_extended/IconButton/index.78a489d3.js";
25
+ import clsx from "clsx";
26
+ import "../../contexts/AreasContext/index.b3b26965.js";
27
+ import "../AreasAdmin/index.46fab65b.js";
28
+ import { W as WindowToolsMFProvider } from "../../contexts/index.4ebef035.js";
29
+ import { c as createDynamicMFStore, D as DynamicMFParmsProvider } from "../../contexts/DynamicMFParmsContext/index.5b3248df.js";
30
+ import "react-hook-form";
31
+ import "../../../hook-form/RHFAutocomplete/index.73d33896.js";
32
+ import { I as Image } from "../../../Image/index.674024d4.js";
33
+ import { T as Typography } from "../../../mui_extended/Typography/index.86505aed.js";
34
+ import "../../../mui_extended/Accordion/index.95a1b021.js";
35
+ import "../../../mui_extended/Avatar/index.fe06afd7.js";
36
+ import "@mui/material/Button";
37
+ import { B as Button } from "../../../mui_extended/Button/index.e4c61b66.js";
38
+ import "@mui/lab";
39
+ import "../../../mui_extended/Popover/index.e271e4f0.js";
40
+ import { M as MenuActions } from "../../../mui_extended/MenuActions/index.742a57d7.js";
41
+ import "../../../mui_extended/Pager/index.a44594e9.js";
42
+ import "../../../mui_extended/Tab/index.e0653a0a.js";
43
+ import "../../../HelperText/index.1a24d41b.js";
44
+ import "../../../hook-form/RHFAutocompleteAsync/index.21f4cb53.js";
45
+ import "../../../hook-form/RHFCheckbox/index.c3b1884b.js";
46
+ import "@mui/x-date-pickers";
47
+ import "../../../hook-form/RHFDateTime/index.6c129ce4.js";
48
+ import "../../../hook-form/RHFTextField/index.15659666.js";
49
+ import "../../../hook-form/RHFPeriod/index.cc624bb3.js";
50
+ import "../../../Period/index.a1b7b4cc.js";
51
+ import "../../../CommonActions/components/Actions/index.3b882471.js";
52
+ import "../../../../contexts/ModalContext/index.bfc47ba9.js";
53
+ import { c as cjs } from "../../../../react-draggable.d6441025.js";
54
+ import "../../../ModalDialog/index.3db4480d.js";
55
+ import { R as ResizeableWindow } from "../../../Resizeable/index.ee84ebc5.js";
56
+ import "../../../modal/WindowConfirm.60028bce.js";
57
+ import "../../../modal/WindowBase.1b0657de.js";
58
+ import "lodash/isString";
59
+ import "react-dropzone";
60
+ import "../../../hook-form/RHFUpload/index.ecf5c788.js";
61
+ import "../../../DataGrid/index.dc84293a.js";
62
+ import "react-dnd";
63
+ import "react-dnd-html5-backend";
64
+ import "../../../DynamicFilter/index.abc697c7.js";
65
+ import "../../../ScrollBar/index.bbe48f4d.js";
66
+ import "yup";
67
+ import "@hookform/resolvers/yup";
68
+ import "../../../../contexts/RHFormContext/index.a7511399.js";
69
+ import { D as DraggableWindow } from "../../../../vendor.2d9f95b4.js";
70
+ import "../../../LanguagePopover/index.47aa8119.js";
71
+ import "../../../NavLink/index.0d125c6b.js";
72
+ import "../../../NoItemSelected/index.1aa96110.js";
73
+ import "../../../ObjectLogs/index.05788334.js";
74
+ import "../../../../react-json-view.57125fcf.js";
75
+ import "../../../PaperForm/index.b3da0da3.js";
76
+ import "../../../Page/index.4237c241.js";
77
+ import "../../../PropertyValue/index.dfcfe1ba.js";
78
+ import "../../../../react-splitter-layout.8b1655c8.js";
79
+ import "../../../SplitLayout/index.5a8355d8.js";
80
+ import "../../../SideBar/index.99ce4e06.js";
81
+ import { a as useWindow, b as useWindowStore } from "../../hooks/index.ffb1009e.js";
82
+ import { L as LinearProgress } from "../../../mui_extended/LinearProgress/index.c92b9ba9.js";
83
+ import { v as varBounce } from "../../../animate/variants/bounce.784aaaaa.js";
84
+ const areasViewerClasses = generateUtilityClasses(AREAS_VIEWER_CLASS_NAME, [
85
+ "root",
86
+ "areaRoot",
87
+ "areaGridLayoutPanelContainer",
88
+ "areaGridLayout",
89
+ "areaGridLayoutPopupsContainer",
90
+ "windowRoot",
91
+ "windowHeader",
92
+ "windowHeaderTitle",
93
+ "windowHeaderMainActions",
94
+ "windowContent",
95
+ "windowPopupRoot",
96
+ "windowModalRoot",
97
+ "panelWindowsRoot",
98
+ "panelWindowsButtonContainer",
99
+ "selected",
100
+ "isMobile"
101
+ ], AREAS_VIEWER_CLASS_NAME);
102
+ const useAreasViewerUtilityClasses = (ownerState) => {
103
+ const slots = {
104
+ root: ["root", ownerState.status, ownerState.isMobile && "isMobile", ownerState.isSkeleton && "isSkeleton"],
105
+ areaRoot: ["areaRoot"],
106
+ areaGridLayoutPanelContainer: ["areaGridLayoutPanelContainer"],
107
+ areaGridLayout: ["areaGridLayout"],
108
+ areaGridLayoutPopupsContainer: ["areaGridLayoutPopupsContainer"],
109
+ windowRoot: ["windowRoot"],
110
+ windowHeader: ["windowHeader"],
111
+ windowHeaderTitle: ["windowHeaderTitle"],
112
+ windowHeaderMainActions: ["windowHeaderMainActions"],
113
+ windowContent: ["windowContent"],
114
+ windowPopupRoot: ["windowPopupRoot"],
115
+ windowModalRoot: ["windowModalRoot"],
116
+ panelWindowsRoot: ["panelWindowsRoot"],
117
+ panelWindowsButtonContainer: ["panelWindowsButtonContainer"]
118
+ };
119
+ return unstable_composeClasses(slots, getComponentUtilityClass(AREAS_VIEWER_CLASS_NAME), {});
120
+ };
121
+ const ROW_HEIGTH_GRIDLAYOUT = 100;
122
+ const CONTAINER_PADDING_GRIDLAYOUT = 3;
123
+ const DEBOUCED_SAVE_TIME = 500;
124
+ const COOKIE_BREAKPOINT_LAYOUTS = "layoutPros";
125
+ const COOKIE_WINDOWS = "windows";
126
+ const NORMALIZED_BREAKPOINTS = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 };
127
+ const NORMALIZED_COLS = { lg: 24, md: 20, sm: 12, xs: 8, xxs: 2 };
128
+ const MAXIMIZED_COLS = { lg: 24, md: 20, sm: 12, xs: 8, xxs: 2 };
129
+ const getParmsFromValue = (key, data) => {
130
+ try {
131
+ if (Array.isArray(data)) {
132
+ let ob = data.find((f) => f.id === key);
133
+ if (ob) {
134
+ ob = JSON.parse(ob.value);
135
+ }
136
+ return ob;
137
+ }
138
+ } catch (error) {
139
+ }
140
+ return void 0;
141
+ };
142
+ function setAddBreakPoints(state, newLayout) {
143
+ const layoutsBreakPoints = state.breakpointsLayouts;
144
+ const beforeMaximizebreakpointsLayouts = state.beforeMaximizebreakpointsLayouts;
145
+ for (const key in layoutsBreakPoints) {
146
+ const layoutBreakpoint = layoutsBreakPoints[key];
147
+ layoutBreakpoint.push(newLayout);
148
+ }
149
+ if (state.viewMode === "single") {
150
+ for (const key in beforeMaximizebreakpointsLayouts) {
151
+ const beforeLayoutBreakpoint = beforeMaximizebreakpointsLayouts[key];
152
+ beforeLayoutBreakpoint.push(newLayout);
153
+ }
154
+ }
155
+ return layoutsBreakPoints;
156
+ }
157
+ function setBreakPointsMaximized(state, layoutId) {
158
+ const layoutsBreakPoints = state.breakpointsLayouts;
159
+ const container = document.getElementsByClassName(`${areasViewerClasses.areaRoot}`)[0];
160
+ console.log(`Setting breakpoints`, container);
161
+ if (container) {
162
+ const clientHeight = container.clientHeight;
163
+ for (const key in layoutsBreakPoints) {
164
+ const layoutBreakpoint = layoutsBreakPoints[key];
165
+ const cols = key in MAXIMIZED_COLS ? MAXIMIZED_COLS[key] : 1;
166
+ const heigth_by_rowheigth = clientHeight / (ROW_HEIGTH_GRIDLAYOUT + 2 * CONTAINER_PADDING_GRIDLAYOUT);
167
+ for (let index = 0; index < layoutBreakpoint.length; index++) {
168
+ const l = layoutBreakpoint[index];
169
+ if (l.i === layoutId) {
170
+ l.x = 0;
171
+ l.y = 0;
172
+ l.h = heigth_by_rowheigth;
173
+ l.w = cols;
174
+ l.minW = 0;
175
+ l.maxW = cols;
176
+ l.minH = 0;
177
+ l.maxH = heigth_by_rowheigth;
178
+ l.isResizable = false;
179
+ l.isDraggable = false;
180
+ } else {
181
+ l.x = 0;
182
+ l.y = 1;
183
+ l.h = 0;
184
+ l.w = 0;
185
+ l.minW = 0;
186
+ l.maxW = 0;
187
+ l.minH = 0;
188
+ l.maxH = 0;
189
+ }
190
+ l.isResizable = false;
191
+ l.isDraggable = false;
192
+ }
193
+ }
194
+ }
195
+ return layoutsBreakPoints;
196
+ }
197
+ function getDataFromResponse(data, state) {
198
+ const newBreakPointsLayouts = getParmsFromValue(COOKIE_BREAKPOINT_LAYOUTS, data);
199
+ const windows = getParmsFromValue(COOKIE_WINDOWS, data);
200
+ const newGridLayouts = [];
201
+ const newHashWindowLayouts = {};
202
+ if (windows) {
203
+ for (const key in windows) {
204
+ const element = windows[key];
205
+ if (element && element["layoutProps"] && element["mfProps"] && element["emergeType"] === "layout" && element["winType"] === "microfrontend") {
206
+ element["layoutProps"].i = key;
207
+ newGridLayouts.push(element["layoutProps"]);
208
+ newHashWindowLayouts[key] = {
209
+ ...element,
210
+ windowId: key,
211
+ emergeType: "layout",
212
+ onClose: state.actions.closeWindowLayout
213
+ };
214
+ }
215
+ }
216
+ }
217
+ return {
218
+ newBreakPointsLayouts,
219
+ newGridLayouts,
220
+ newHashWindowLayouts
221
+ };
222
+ }
223
+ const createAreaStore = (initProps) => {
224
+ const startProps = {
225
+ zPopUpIndex: 999,
226
+ status: "init",
227
+ breakpointsLayouts: {},
228
+ beforeMaximizebreakpointsLayouts: {},
229
+ gridLayouts: [],
230
+ windowModal: null,
231
+ windowsPopUps: [],
232
+ hashWindowsPopups: {},
233
+ hashWindowsLayouts: {},
234
+ currentLayoutId: "",
235
+ currentPopUpId: "",
236
+ viewMode: initProps.isDesktop ? "multiple" : "single",
237
+ breakpoints: NORMALIZED_BREAKPOINTS,
238
+ cols: NORMALIZED_COLS,
239
+ ...initProps
240
+ };
241
+ return createStore(
242
+ devtools(
243
+ immer((set, get) => ({
244
+ ...startProps,
245
+ actions: {
246
+ addWindow: (newWindowProps) => {
247
+ const windowId = `${get().id}_window_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
248
+ console.log("addWindow", newWindowProps.emergeType);
249
+ if (newWindowProps.emergeType === "layout") {
250
+ get().actions.addWindowLayout(windowId, newWindowProps);
251
+ } else if (newWindowProps.emergeType === "popup") {
252
+ get().actions.addWindowPopUp(windowId, newWindowProps);
253
+ } else if (newWindowProps.emergeType === "modal") {
254
+ get().actions.addWindowModal(windowId, newWindowProps);
255
+ }
256
+ },
257
+ closeWindowModal: () => {
258
+ set((state) => {
259
+ state.windowModal = void 0;
260
+ });
261
+ },
262
+ addWindowModal: (container_id, newWindowModalProps) => {
263
+ set((state) => {
264
+ state.windowModal = { ...newWindowModalProps, windowId: container_id };
265
+ });
266
+ },
267
+ closeWindowPopUp: (removePopUpId) => {
268
+ set((state) => {
269
+ const removeIndex = state.windowsPopUps.findIndex(
270
+ (wpId) => wpId === removePopUpId
271
+ );
272
+ if (removeIndex > -1) {
273
+ state.windowsPopUps.splice(removeIndex, 1);
274
+ }
275
+ delete state.hashWindowsPopups[removePopUpId];
276
+ });
277
+ },
278
+ addWindowPopUp: (windowId, newWindowPopupProps) => {
279
+ let popUpId = windowId;
280
+ set((state) => {
281
+ if (newWindowPopupProps.replaceMeId) {
282
+ for (const key in state.hashWindowsPopups) {
283
+ const WindoPopUp = state.hashWindowsPopups[key];
284
+ if (WindoPopUp.replaceMeId === newWindowPopupProps.replaceMeId) {
285
+ popUpId = key;
286
+ state.hashWindowsPopups[key].dynamicParams = newWindowPopupProps.dynamicParams;
287
+ break;
288
+ }
289
+ }
290
+ }
291
+ if (popUpId === windowId) {
292
+ state.windowsPopUps.push(windowId);
293
+ state.hashWindowsPopups[windowId] = {
294
+ ...newWindowPopupProps,
295
+ emergeType: "popup",
296
+ windowId,
297
+ onClose: get().actions.closeWindowPopUp,
298
+ zIndex: state.zPopUpIndex
299
+ };
300
+ state.currentPopUpId = windowId;
301
+ }
302
+ });
303
+ get().actions.selectWindowPopUp(popUpId);
304
+ },
305
+ closeWindowLayout: (removeLayoutId) => {
306
+ set((state) => {
307
+ const removeIndex = state.gridLayouts.findIndex(
308
+ (gl) => gl.i === removeLayoutId
309
+ );
310
+ if (removeIndex > -1) {
311
+ state.gridLayouts.splice(removeIndex, 1);
312
+ }
313
+ delete state.hashWindowsLayouts[removeLayoutId];
314
+ });
315
+ get().actions.saveLayouts();
316
+ if (get().singleId === removeLayoutId) {
317
+ get().actions.maximizeLayout();
318
+ }
319
+ },
320
+ addWindowLayout: (windowId, newWindow) => {
321
+ const newLayout = {
322
+ ...newWindow.layoutProps,
323
+ i: windowId,
324
+ isDraggable: true,
325
+ isResizable: true,
326
+ winType: newWindow.winType
327
+ };
328
+ set((state) => {
329
+ state.gridLayouts.push(newLayout);
330
+ state.hashWindowsLayouts[windowId] = {
331
+ ...newWindow,
332
+ windowId,
333
+ emergeType: "layout",
334
+ onClose: get().actions.closeWindowLayout
335
+ };
336
+ setAddBreakPoints(state, newLayout);
337
+ });
338
+ get().actions.selectWindowLayout(windowId);
339
+ if (get().viewMode === "single") {
340
+ get().actions.maximizeLayout(windowId);
341
+ }
342
+ get().actions.saveLayouts();
343
+ get().actions.bouncedSaveBreakpointsLayouts();
344
+ },
345
+ saveLayouts: () => {
346
+ let nrKeys = 0;
347
+ const saveObjetc = {};
348
+ for (const key in get().hashWindowsLayouts) {
349
+ const element = get().hashWindowsLayouts[key];
350
+ if (element.winType === "microfrontend") {
351
+ const newElement = { ...element };
352
+ delete newElement.onClose;
353
+ delete newElement.devCookies;
354
+ saveObjetc[key] = newElement;
355
+ nrKeys++;
356
+ }
357
+ }
358
+ if (nrKeys > 0) {
359
+ get().networkOperation({
360
+ method: "PUT",
361
+ endPoint: `cookies/${get().id}/${COOKIE_WINDOWS}`,
362
+ data: {
363
+ value: JSON.stringify(saveObjetc)
364
+ },
365
+ toastSuccess: false,
366
+ toastError: false
367
+ });
368
+ } else {
369
+ get().networkOperation({
370
+ method: "DELETE",
371
+ endPoint: `cookies`,
372
+ data: { f: [{ n: "container_id", o: "c", o1: get().id }] },
373
+ toastSuccess: false,
374
+ toastError: false
375
+ });
376
+ }
377
+ },
378
+ bouncedSaveBreakpointsLayouts: debounce(
379
+ () => {
380
+ const purgedLayouts = {
381
+ ...get().viewMode === "multiple" ? get().breakpointsLayouts : get().beforeMaximizebreakpointsLayouts
382
+ };
383
+ const finalLayouts = {};
384
+ for (const key in purgedLayouts) {
385
+ const element = purgedLayouts[key];
386
+ purgedLayouts[key] = element.filter((l) => {
387
+ if (l.i === "none") {
388
+ return false;
389
+ }
390
+ if (get().hashWindowsLayouts[l.i]) {
391
+ return true;
392
+ }
393
+ return false;
394
+ });
395
+ if (purgedLayouts[key].length > 0) {
396
+ finalLayouts[key] = purgedLayouts[key];
397
+ }
398
+ }
399
+ if (Object.keys(finalLayouts).length > 0) {
400
+ get().networkOperation({
401
+ method: "PUT",
402
+ endPoint: `cookies/${get().id}/${COOKIE_BREAKPOINT_LAYOUTS}`,
403
+ data: {
404
+ value: JSON.stringify(finalLayouts)
405
+ },
406
+ toastSuccess: false,
407
+ toastError: false
408
+ });
409
+ }
410
+ },
411
+ DEBOUCED_SAVE_TIME
412
+ ),
413
+ onBreakpointsLayoutsChange: (_currentLayouts, newAllLayouts) => {
414
+ set((state) => {
415
+ state.breakpointsLayouts = newAllLayouts;
416
+ });
417
+ if (!get().singleId) {
418
+ get().actions.bouncedSaveBreakpointsLayouts();
419
+ }
420
+ },
421
+ selectWindowLayout: (layoutId) => {
422
+ set((state) => {
423
+ state.currentLayoutId = layoutId;
424
+ if (state.currentPopUpId !== "" && state.hashWindowsPopups[state.currentPopUpId]) {
425
+ const windowPopup = state.hashWindowsPopups[state.currentPopUpId];
426
+ if (windowPopup.parentLayoutId !== layoutId) {
427
+ state.currentPopUpId = "";
428
+ }
429
+ }
430
+ });
431
+ },
432
+ selectWindowPopUp: (popUpId) => {
433
+ set((state) => {
434
+ state.zPopUpIndex++;
435
+ state.currentPopUpId = popUpId;
436
+ state.zPopUpIndex++;
437
+ state.currentPopUpId = popUpId;
438
+ state.hashWindowsPopups[popUpId].zIndex = state.zPopUpIndex;
439
+ if (state.hashWindowsPopups[popUpId].parentLayoutId && state.hashWindowsPopups[popUpId].parentLayoutId !== "") {
440
+ state.currentLayoutId = state.hashWindowsPopups[popUpId].parentLayoutId;
441
+ } else {
442
+ state.currentLayoutId = "";
443
+ }
444
+ });
445
+ setTimeout(() => {
446
+ const container = document.getElementsByClassName(
447
+ `${areasViewerClasses.areaGridLayoutPanelContainer}-${get().id}`
448
+ )[0];
449
+ const element = document.getElementsByClassName(
450
+ `${areasViewerClasses.windowPopupRoot}-${popUpId}`
451
+ )[0];
452
+ if (element && container) {
453
+ const { top, left } = element.getBoundingClientRect();
454
+ const { top: containerTop, left: containerLeft } = container.getBoundingClientRect();
455
+ container.scrollTop = container.scrollTop + top - containerTop;
456
+ container.scrollLeft = container.scrollLeft + left - containerLeft;
457
+ }
458
+ }, 100);
459
+ },
460
+ maximizeLayout: (layoutId) => {
461
+ let finalLayoutId = layoutId;
462
+ set((state) => {
463
+ if (state.viewMode === "multiple") {
464
+ state.beforeMaximizebreakpointsLayouts = cloneDeep(
465
+ state.breakpointsLayouts
466
+ );
467
+ }
468
+ if (!finalLayoutId) {
469
+ if (state.gridLayouts.length > 0) {
470
+ finalLayoutId = state.gridLayouts[0].i;
471
+ }
472
+ }
473
+ state.viewMode = "single";
474
+ state.singleId = finalLayoutId;
475
+ setBreakPointsMaximized(state, finalLayoutId);
476
+ });
477
+ if (finalLayoutId) {
478
+ get().actions.selectWindowLayout(finalLayoutId);
479
+ }
480
+ },
481
+ normalizeLayouts: () => {
482
+ set((state) => {
483
+ if (!state.isDesktop)
484
+ return;
485
+ if (state.isDesktop && state.viewMode === "single") {
486
+ state.viewMode = "multiple";
487
+ state.singleId = void 0;
488
+ state.breakpointsLayouts = state.beforeMaximizebreakpointsLayouts;
489
+ }
490
+ });
491
+ }
492
+ },
493
+ internalActions: {
494
+ loadFromApi: () => {
495
+ if (get().status !== "init") {
496
+ return;
497
+ }
498
+ if (!get().loadAreasFromNetwork || !get().loadWindows) {
499
+ set((state) => {
500
+ state.status = "loaded";
501
+ });
502
+ return;
503
+ }
504
+ get().networkOperation({
505
+ method: "GET",
506
+ endPoint: `cookies`,
507
+ parms: { f: [{ n: "container_id", o: "e", o1: get().id }] },
508
+ toastSuccess: false,
509
+ toastError: false
510
+ }).then((response) => {
511
+ set((state) => {
512
+ const {
513
+ newBreakPointsLayouts,
514
+ newGridLayouts,
515
+ newHashWindowLayouts
516
+ } = getDataFromResponse(response.data, state);
517
+ if (state.viewMode === "multiple") {
518
+ state.breakpointsLayouts = newBreakPointsLayouts;
519
+ } else {
520
+ state.breakpointsLayouts = newBreakPointsLayouts;
521
+ state.beforeMaximizebreakpointsLayouts = newBreakPointsLayouts;
522
+ }
523
+ state.gridLayouts = newGridLayouts;
524
+ state.hashWindowsLayouts = newHashWindowLayouts;
525
+ state.status = "loaded";
526
+ });
527
+ console.log("loadFromApi", get().viewMode);
528
+ if (get().viewMode === "single") {
529
+ get().actions.maximizeLayout();
530
+ }
531
+ }).catch((_response) => {
532
+ set((state) => {
533
+ state.status = "loaded";
534
+ });
535
+ });
536
+ },
537
+ changeDesktopBreakpoint: (isDesktop) => {
538
+ const previousState = get().isDesktop;
539
+ set((state) => {
540
+ state.isDesktop = isDesktop;
541
+ });
542
+ if (previousState != isDesktop) {
543
+ if (isDesktop) {
544
+ get().actions.normalizeLayouts();
545
+ } else {
546
+ if (get().viewMode === "multiple") {
547
+ if (get().gridLayouts.length > 0) {
548
+ get().actions.maximizeLayout(get().gridLayouts[0].i);
549
+ }
550
+ }
551
+ }
552
+ }
553
+ }
554
+ }
555
+ })),
556
+ { name: `Area state ${initProps.id}` }
557
+ )
558
+ );
559
+ };
560
+ const AreaContext = createContext(null);
561
+ const AreaProvider = (props) => {
562
+ const {
563
+ children,
564
+ id,
565
+ selected: active,
566
+ loadWindows = true
567
+ } = props;
568
+ const [loadAreasFromNetwork, loadCookiesFromNetwork] = useAreasStore((state) => [state.loadAreasFromNetwork, state.loadCookiesFromNetwork], shallow);
569
+ const {
570
+ setAreaLink
571
+ } = useAreasStore((state) => state.internalActions);
572
+ const isDesktop = useResponsiveDesktop();
573
+ const isFirstRender = useFirstRender([isDesktop]);
574
+ const {
575
+ networkOperation
576
+ } = useNetwork();
577
+ const areaStoreRef = useRef();
578
+ if (!areaStoreRef.current) {
579
+ areaStoreRef.current = createAreaStore({
580
+ id,
581
+ networkOperation,
582
+ loadAreasFromNetwork,
583
+ loadCookiesFromNetwork,
584
+ loadWindows,
585
+ isDesktop: !!isDesktop
586
+ });
587
+ }
588
+ const {
589
+ loadFromApi,
590
+ changeDesktopBreakpoint
591
+ } = useStore(areaStoreRef.current, (state) => state.internalActions, shallow);
592
+ const status = useStore(areaStoreRef.current, (state) => state.status, shallow);
593
+ useEffect(() => {
594
+ if (!isFirstRender) {
595
+ changeDesktopBreakpoint(!!isDesktop);
596
+ }
597
+ }, [isDesktop]);
598
+ useEffect(() => {
599
+ if (areaStoreRef.current) {
600
+ setAreaLink(id, areaStoreRef.current);
601
+ }
602
+ return () => {
603
+ };
604
+ }, []);
605
+ useEffect(() => {
606
+ if (active && status === "init") {
607
+ loadFromApi();
608
+ }
609
+ }, [active]);
610
+ return /* @__PURE__ */ jsx(AreaContext.Provider, {
611
+ value: areaStoreRef.current,
612
+ children
613
+ });
614
+ };
615
+ if (process.env.NODE_ENV !== "production") {
616
+ AreaProvider.displayName = "AreaProvider";
617
+ }
618
+ React__default.memo(AreaProvider);
619
+ function getCookiesContainer(data, containerId) {
620
+ const cookies = {};
621
+ try {
622
+ if (Array.isArray(data)) {
623
+ for (let i = 0; i < data.length; i++) {
624
+ if (data[i]?.container_id === containerId && data[i]?.id) {
625
+ cookies[data[i]?.id] = JSON.parse(data[i].value);
626
+ }
627
+ }
628
+ }
629
+ } catch (error) {
630
+ }
631
+ return cookies;
632
+ }
633
+ const createWindowStore = (initProps) => {
634
+ const startProps = {
635
+ status: "init",
636
+ moduleActions: [],
637
+ cookies: initProps.devCookies || { moduleCookies: {}, windowCookies: {} },
638
+ ...initProps
639
+ };
640
+ delete startProps.devCookies;
641
+ return createStore(
642
+ devtools(
643
+ immer((set, get, _api) => ({
644
+ ...startProps,
645
+ actions: {
646
+ setActions: (newActions, version) => {
647
+ set((state) => {
648
+ state.moduleActions = cloneDeep(newActions);
649
+ state.version = version;
650
+ console.log("LLEGO Version", version);
651
+ });
652
+ },
653
+ close: () => {
654
+ const onClose = get().onClose;
655
+ if (onClose) {
656
+ onClose(get().windowId);
657
+ }
658
+ },
659
+ getWindowId: () => {
660
+ return get().windowId;
661
+ },
662
+ getCookie: (id) => {
663
+ return get().cookies.windowCookies[id] || get().cookies.moduleCookies[id];
664
+ },
665
+ getCookies: (type) => {
666
+ if (type === "window") {
667
+ return get().cookies.windowCookies;
668
+ } else {
669
+ return get().cookies.moduleCookies;
670
+ }
671
+ },
672
+ setCookie: (id, type, cookie) => {
673
+ get().networkOperation({
674
+ method: "PUT",
675
+ endPoint: `cookies/${type === "module" ? get().moduleId : get().windowId}/${id}`,
676
+ data: {
677
+ value: JSON.stringify(cookie)
678
+ },
679
+ toastSuccess: false,
680
+ toastError: false
681
+ });
682
+ set((state) => {
683
+ if (type === "window") {
684
+ state.cookies.windowCookies[id] = cookie;
685
+ } else {
686
+ state.cookies.moduleCookies[id] = cookie;
687
+ }
688
+ });
689
+ }
690
+ },
691
+ internalActions: {
692
+ loadCookiesFromApi: () => {
693
+ if (get().status === "init") {
694
+ get().networkOperation({
695
+ method: "GET",
696
+ endPoint: `cookies`,
697
+ parms: {
698
+ f: [
699
+ { n: "container_id", o: "e", o1: get().windowId },
700
+ { n: "container_id", o: "e", o1: get().moduleId }
701
+ ]
702
+ },
703
+ toastSuccess: false,
704
+ toastError: false
705
+ }).then((response) => {
706
+ set((state) => {
707
+ state.cookies.moduleCookies = getCookiesContainer(
708
+ response.data,
709
+ state.moduleId
710
+ );
711
+ state.cookies.windowCookies = getCookiesContainer(
712
+ response.data,
713
+ state.windowId
714
+ );
715
+ state.status = "loaded";
716
+ });
717
+ }).catch((_response) => {
718
+ set((state) => {
719
+ state.status = "loaded";
720
+ });
721
+ });
722
+ }
723
+ },
724
+ saveModuleCookies: () => {
725
+ for (const key in get().cookies.windowCookies) {
726
+ const cookie = get().cookies.windowCookies[key];
727
+ get().networkOperation({
728
+ method: "PUT",
729
+ endPoint: `cookies/${get().moduleId}/${key}`,
730
+ data: {
731
+ value: JSON.stringify(cookie)
732
+ },
733
+ toastSuccess: false,
734
+ toastError: false
735
+ });
736
+ }
737
+ }
738
+ }
739
+ })),
740
+ {
741
+ name: `window store ${initProps.windowId}`,
742
+ store: `window dev store ${initProps.windowId}`,
743
+ trace: true
744
+ }
745
+ )
746
+ );
747
+ };
748
+ const WindowContext = createContext(null);
749
+ function WindowMFProvider(props) {
750
+ const {
751
+ children,
752
+ ...other
753
+ } = props;
754
+ const {
755
+ networkOperation
756
+ } = useNetwork();
757
+ const windowStoreRef = useRef();
758
+ const dynamicMFStoreRef = useRef();
759
+ const areaStore = useArea();
760
+ const areasStore = useAreas();
761
+ if (!dynamicMFStoreRef.current) {
762
+ dynamicMFStoreRef.current = createDynamicMFStore({
763
+ dynamicMFParameters: props.dynamicParams,
764
+ windowId: props.windowId
765
+ });
766
+ }
767
+ if (!windowStoreRef.current) {
768
+ windowStoreRef.current = createWindowStore({
769
+ ...other,
770
+ dynamicMFStore: dynamicMFStoreRef.current,
771
+ networkOperation,
772
+ areaStore,
773
+ areasStore
774
+ });
775
+ }
776
+ useEffect(() => {
777
+ windowStoreRef.current?.getState().internalActions.loadCookiesFromApi();
778
+ return () => {
779
+ console.debug("useEffect cleanUP WindowMFProvider", props.windowId, windowStoreRef.current);
780
+ };
781
+ }, []);
782
+ useEffect(() => {
783
+ if (windowStoreRef.current?.getState().status === "loaded") {
784
+ dynamicMFStoreRef.current?.getState().actions.changeData(props.dynamicParams);
785
+ }
786
+ }, [props.dynamicParams]);
787
+ return /* @__PURE__ */ jsx(WindowContext.Provider, {
788
+ value: windowStoreRef.current,
789
+ children
790
+ });
791
+ }
792
+ const Component = (props) => {
793
+ const {
794
+ component
795
+ } = props;
796
+ const store = useWindow();
797
+ const dynamicMFStore = useWindowStore((state) => state.dynamicMFStore);
798
+ const actions = useWindowStore((state) => state.actions, shallow);
799
+ return /* @__PURE__ */ jsx(WindowToolsMFProvider, {
800
+ ...actions,
801
+ children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, {
802
+ store: dynamicMFStore,
803
+ children: typeof component === "function" ? component(store) : component
804
+ })
805
+ });
806
+ };
807
+ React__default.memo(Component);
808
+ styled("div")(({
809
+ theme
810
+ }) => ({
811
+ display: "flex",
812
+ alignItems: "center",
813
+ position: "relative",
814
+ justifyContent: "space-between",
815
+ minHeight: theme.spacing(5),
816
+ borderBottom: `1px solid ${theme.palette.divider}`,
817
+ overflow: "hidden",
818
+ cursor: "move",
819
+ height: "60px",
820
+ " > span": {
821
+ marginRight: "12px"
822
+ },
823
+ "& > h5": {
824
+ paddingRight: theme.spacing(3),
825
+ borderRight: `1px solid ${theme.palette.divider}`
826
+ },
827
+ " > nav": {
828
+ marginRight: "12px",
829
+ flexGrow: 1
830
+ },
831
+ "& .splitactions.Mui-disabled": {
832
+ color: theme.palette.primary.main
833
+ },
834
+ "& svg ": {
835
+ width: "20px",
836
+ height: "20px"
837
+ }
838
+ }));
839
+ styled("div")(({
840
+ theme
841
+ }) => ({
842
+ display: "flex",
843
+ alignItems: "center",
844
+ position: "relative",
845
+ borderBottom: `1px solid ${theme.palette.divider}`,
846
+ height: "60px",
847
+ minHeight: "60px",
848
+ " > span": {
849
+ marginRight: "12px"
850
+ },
851
+ "& > h5": {
852
+ paddingRight: theme.spacing(3),
853
+ borderRight: `1px solid ${theme.palette.divider}`
854
+ },
855
+ " > nav": {
856
+ marginRight: "12px",
857
+ flexGrow: 1
858
+ },
859
+ "& .splitactions.Mui-disabled": {
860
+ color: theme.palette.primary.main
861
+ },
862
+ "& svg ": {
863
+ width: "20px",
864
+ height: "20px"
865
+ }
866
+ }));
867
+ const Wrapper = styled("div")(({
868
+ theme
869
+ }) => ({
870
+ display: "flex",
871
+ justifyContent: "space-between",
872
+ padding: `0 0`,
873
+ borderBottom: `1px solid ${theme.palette.divider}`,
874
+ minHeight: "60px"
875
+ }));
876
+ const ModuleTitleContent = styled("div")(({
877
+ theme
878
+ }) => ({
879
+ display: "grid",
880
+ gridTemplateColumns: "auto",
881
+ gridGap: theme.spacing(1.75),
882
+ alignItems: "center",
883
+ width: "auto",
884
+ height: "auto",
885
+ [theme.breakpoints.up("sm")]: {
886
+ gridTemplateColumns: "repeat(3, auto)"
887
+ }
888
+ }));
889
+ const ModuleTitle = styled("div")(({
890
+ theme
891
+ }) => ({
892
+ display: "grid",
893
+ gridTemplateColumns: `${theme.spacing(3)} auto`,
894
+ gridGap: theme.spacing(2),
895
+ alignItems: "center",
896
+ width: "auto",
897
+ height: "auto"
898
+ }));
899
+ const Separator = styled("div")(({
900
+ theme
901
+ }) => ({
902
+ display: "none",
903
+ alignItems: "center",
904
+ width: "1px",
905
+ background: theme.palette.divider,
906
+ height: "100%",
907
+ margin: `0 ${theme.spacing(2)}`,
908
+ [theme.breakpoints.up("sm")]: {
909
+ display: "flex"
910
+ }
911
+ }));
912
+ const Breadcrumbs = styled("div")(({
913
+ theme
914
+ }) => ({
915
+ display: "grid",
916
+ alignItems: "center",
917
+ gridTemplateColumns: `repeat(3, auto)`,
918
+ gridGap: theme.spacing(2)
919
+ }));
920
+ const ModuleActions = styled("div")(({
921
+ theme
922
+ }) => ({
923
+ display: "grid",
924
+ gridTemplateColumns: "auto",
925
+ alignItems: "center",
926
+ width: "auto",
927
+ height: "auto",
928
+ [theme.breakpoints.up("sm")]: {
929
+ gridTemplateColumns: `repeat(3, ${theme.spacing(3)})`,
930
+ gridGap: theme.spacing(2)
931
+ }
932
+ }));
933
+ function SKTModuleHeader() {
934
+ const isDesktop = useResponsiveDesktop();
935
+ return /* @__PURE__ */ jsxs(Wrapper, {
936
+ id: "HeaderSkeleton",
937
+ children: [/* @__PURE__ */ jsxs(ModuleTitleContent, {
938
+ children: [/* @__PURE__ */ jsxs(ModuleTitle, {
939
+ children: [/* @__PURE__ */ jsx(Skeleton, {
940
+ variant: "circular",
941
+ width: 24,
942
+ height: 24
943
+ }), /* @__PURE__ */ jsx(Skeleton, {
944
+ variant: "text",
945
+ width: 120,
946
+ height: 14
947
+ })]
948
+ }), /* @__PURE__ */ jsx(Separator, {}), /* @__PURE__ */ jsxs(Breadcrumbs, {
949
+ children: [/* @__PURE__ */ jsx(Skeleton, {
950
+ variant: "text",
951
+ width: 68,
952
+ height: 14
953
+ }), /* @__PURE__ */ jsx(Skeleton, {
954
+ variant: "circular",
955
+ width: 4,
956
+ height: 4
957
+ }), /* @__PURE__ */ jsx(Skeleton, {
958
+ variant: "text",
959
+ width: 68,
960
+ height: 14
961
+ })]
962
+ })]
963
+ }), /* @__PURE__ */ jsx(ModuleActions, {
964
+ children: isDesktop ? /* @__PURE__ */ jsxs(Fragment, {
965
+ children: [/* @__PURE__ */ jsx(Skeleton, {
966
+ variant: "circular",
967
+ width: 24,
968
+ height: 24
969
+ }), /* @__PURE__ */ jsx(Skeleton, {
970
+ variant: "circular",
971
+ width: 24,
972
+ height: 24
973
+ }), /* @__PURE__ */ jsx(Skeleton, {
974
+ variant: "circular",
975
+ width: 24,
976
+ height: 24
977
+ })]
978
+ }) : /* @__PURE__ */ jsx(Skeleton, {
979
+ variant: "circular",
980
+ width: 24,
981
+ height: 24
982
+ })
983
+ })]
984
+ });
985
+ }
986
+ function getMainActions(isDesktop, moduleActions) {
987
+ let mainActions = [];
988
+ if (isDesktop !== void 0 && isDesktop) {
989
+ mainActions = mainActions.concat(
990
+ moduleActions.filter((action) => action.visibility === "main")
991
+ );
992
+ }
993
+ mainActions = mainActions.concat(
994
+ moduleActions.filter((action) => action.visibility === "allways")
995
+ );
996
+ return mainActions;
997
+ }
998
+ function getMenuActions(isDesktop, moduleActions, urlPrefix, saveModuleCookies, version) {
999
+ let menuActions = [...moduleActions.filter((action) => action.visibility !== "allways")];
1000
+ if (isDesktop !== void 0 && isDesktop) {
1001
+ menuActions = menuActions.filter((action) => action.visibility === "normal");
1002
+ }
1003
+ console.log("getMenuActions", version);
1004
+ const savePropsAction = {
1005
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/split_vertical.svg`,
1006
+ onClick: () => saveModuleCookies,
1007
+ disabled: false,
1008
+ visibility: "normal",
1009
+ dictionaryId: getAreasDictionary("label_persist_module_cookies"),
1010
+ key: "save_props"
1011
+ };
1012
+ menuActions.push(savePropsAction);
1013
+ if (version) {
1014
+ const versionAction = {
1015
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/version.svg`,
1016
+ onClick: () => {
1017
+ },
1018
+ disabled: true,
1019
+ visibility: "normal",
1020
+ label: version,
1021
+ key: "version"
1022
+ };
1023
+ menuActions.push(versionAction);
1024
+ }
1025
+ return menuActions;
1026
+ }
1027
+ function MainActions() {
1028
+ const [moduleActions] = useWindowStore((state) => [state.moduleActions], shallow);
1029
+ const {
1030
+ getLabel
1031
+ } = useModuleDictionary();
1032
+ const isDesktop = useResponsiveDesktop();
1033
+ const mainActions = useMemo(() => {
1034
+ return getMainActions(isDesktop, moduleActions);
1035
+ }, [moduleActions, isDesktop]);
1036
+ return /* @__PURE__ */ jsx("div", {
1037
+ className: areasViewerClasses.windowHeaderMainActions,
1038
+ children: mainActions.map((mainAction) => {
1039
+ const tooltip = mainAction.label !== void 0 ? mainAction.label : getLabel(mainAction.dictionaryId || "");
1040
+ return /* @__PURE__ */ jsx(IconButton, {
1041
+ src: mainAction.urlIcon,
1042
+ className: mainAction.className,
1043
+ onClick: mainAction.onClick,
1044
+ "aria-label": mainAction.label,
1045
+ disabled: mainAction.disabled,
1046
+ tooltip
1047
+ }, mainAction.key);
1048
+ })
1049
+ });
1050
+ }
1051
+ function Header() {
1052
+ const [url_icon, title, moduleActions, onClose, container_id, version] = useWindowStore((state) => [state.url_icon, state.title, state.moduleActions, state.onClose, state.windowId, state.version], shallow);
1053
+ const {
1054
+ saveModuleCookies
1055
+ } = useWindowStore((state) => state.internalActions);
1056
+ const emergeType = useWindowStore((state) => state.emergeType);
1057
+ const maximizedId = useAreaStore((state) => state.singleId);
1058
+ const {
1059
+ maximizeLayout,
1060
+ normalizeLayouts
1061
+ } = useAreaStore((state) => state.actions, shallow);
1062
+ const {
1063
+ host_static_assets,
1064
+ environment_assets
1065
+ } = useEnvironment();
1066
+ const isDesktop = useResponsiveDesktop();
1067
+ const isSkeleton = useModuleSkeleton();
1068
+ const urlPrefix = `${host_static_assets}/${environment_assets}`;
1069
+ const menuActions = useMemo(() => {
1070
+ return getMenuActions(isDesktop, moduleActions, urlPrefix, saveModuleCookies, version);
1071
+ }, [moduleActions, isDesktop]);
1072
+ const onCloseLocal = () => {
1073
+ onClose && onClose(container_id);
1074
+ };
1075
+ const maxNormalize = () => {
1076
+ if (maximizedId) {
1077
+ normalizeLayouts();
1078
+ } else {
1079
+ maximizeLayout(container_id);
1080
+ }
1081
+ };
1082
+ if (isSkeleton) {
1083
+ return /* @__PURE__ */ jsx(SKTModuleHeader, {});
1084
+ }
1085
+ return /* @__PURE__ */ jsxs("div", {
1086
+ className: clsx(areasViewerClasses.windowHeader, "m4l_draggable_handle"),
1087
+ children: [/* @__PURE__ */ jsx(Icon, {
1088
+ src: url_icon,
1089
+ size: "medium"
1090
+ }), /* @__PURE__ */ jsx(Typography, {
1091
+ className: areasViewerClasses.windowHeaderTitle,
1092
+ variant: "h5",
1093
+ children: `${title}`
1094
+ }), /* @__PURE__ */ jsx(MainActions, {}), isDesktop && emergeType === "layout" && /* @__PURE__ */ jsx(IconButton, {
1095
+ onClick: maxNormalize,
1096
+ "aria-label": "click",
1097
+ src: maximizedId ? `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.NORMALIZE}` : `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.MAXIMIZE}`
1098
+ }), menuActions.length > 0 && /* @__PURE__ */ jsx(MenuActions, {
1099
+ arrowType: "no-arrow",
1100
+ marginTop: "12px!important",
1101
+ marginLeft: "14px!important",
1102
+ anchorOrigin: {
1103
+ vertical: "bottom",
1104
+ horizontal: "right"
1105
+ },
1106
+ transformOrigin: {
1107
+ vertical: "top",
1108
+ horizontal: "right"
1109
+ },
1110
+ menuActions
1111
+ }), onClose && /* @__PURE__ */ jsx(IconButton, {
1112
+ onClick: onCloseLocal,
1113
+ "aria-label": "click",
1114
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CLOSE}`
1115
+ })]
1116
+ });
1117
+ }
1118
+ const WrapperLinearProgress = styled$1("div")(() => ({
1119
+ width: "70%",
1120
+ margin: "auto auto"
1121
+ }));
1122
+ const WrapperFallBackNotFound = styled$1("div")(({
1123
+ theme
1124
+ }) => ({
1125
+ width: "100%",
1126
+ height: "100%",
1127
+ display: "flex",
1128
+ flexDirection: "column",
1129
+ justifyContent: "center",
1130
+ alignItems: "center",
1131
+ gap: theme.spacing(3)
1132
+ }));
1133
+ function FallBackNotFound(props) {
1134
+ const {
1135
+ setNetworkRefresh
1136
+ } = props;
1137
+ const {
1138
+ getLabel
1139
+ } = useModuleDictionary();
1140
+ const {
1141
+ host_static_assets,
1142
+ environment_assets
1143
+ } = useEnvironment();
1144
+ const handlerClick = () => {
1145
+ setNetworkRefresh((prop) => !prop);
1146
+ };
1147
+ return /* @__PURE__ */ jsxs(WrapperFallBackNotFound, {
1148
+ children: [/* @__PURE__ */ jsx(m.div, {
1149
+ variants: varBounce().in,
1150
+ children: /* @__PURE__ */ jsx(Typography$1, {
1151
+ variant: "h3",
1152
+ paragraph: true,
1153
+ children: getLabel("loading_mf_title")
1154
+ })
1155
+ }), /* @__PURE__ */ jsx(Typography$1, {
1156
+ sx: {
1157
+ color: "text.secondary"
1158
+ },
1159
+ children: getLabel("loading_mf_description")
1160
+ }), /* @__PURE__ */ jsx(m.div, {
1161
+ variants: varBounce().in,
1162
+ children: /* @__PURE__ */ jsx(Image, {
1163
+ src: `${host_static_assets}/${environment_assets}/frontend/domain/host/commons/assets/img/illustration_noauth.png`,
1164
+ ratio: "1:1"
1165
+ })
1166
+ }), /* @__PURE__ */ jsx(Button, {
1167
+ size: "medium",
1168
+ variant: "contained",
1169
+ onClick: handlerClick,
1170
+ children: getLabel("loading_mf_intro")
1171
+ })]
1172
+ });
1173
+ }
1174
+ const LoadingMF = (props) => {
1175
+ const {
1176
+ loadingProgress,
1177
+ setNetworkRefresh
1178
+ } = props;
1179
+ if (loadingProgress !== -1) {
1180
+ return /* @__PURE__ */ jsx(WrapperLinearProgress, {
1181
+ id: "WrapperLinearProgress",
1182
+ children: /* @__PURE__ */ jsx(LinearProgress, {
1183
+ variant: "determinate",
1184
+ value: loadingProgress
1185
+ })
1186
+ });
1187
+ }
1188
+ return /* @__PURE__ */ jsx(FallBackNotFound, {
1189
+ setNetworkRefresh
1190
+ });
1191
+ };
1192
+ function getDivScritId(prefix, moduleId) {
1193
+ const rotational_id = `${Math.round(new Date().getTime() / 1e3)}_rnd_${Math.round(Math.random() * 1e3)}`;
1194
+ return {
1195
+ divContainerId: `container_${prefix}_${moduleId}_${rotational_id}`,
1196
+ scriptId: `script_${moduleId}_${rotational_id}`,
1197
+ moduleId
1198
+ };
1199
+ }
1200
+ function MFLoader(props) {
1201
+ const {
1202
+ prefix,
1203
+ moduleId,
1204
+ cache = true,
1205
+ debug_port,
1206
+ dynamicMFStore,
1207
+ windowTools
1208
+ } = props;
1209
+ const {
1210
+ hostThemeOptions,
1211
+ fnComponentsOverrides
1212
+ } = useHostTheme();
1213
+ const {
1214
+ networkOperation
1215
+ } = useNetwork();
1216
+ const environment = useEnvironment();
1217
+ const hostTools = useHostTools();
1218
+ const formatter = useFormatter();
1219
+ const [isLoading, setIsLoading] = useState(true);
1220
+ const [networkProgress, setNetworkProgress] = useState(-1);
1221
+ const [_networkRefresh, setNetworkRefresh] = useState(false);
1222
+ const {
1223
+ currentLocale
1224
+ } = useLocales();
1225
+ const [divScript, setDivScript] = useState(getDivScritId(prefix, moduleId));
1226
+ const refTime = useRef(0);
1227
+ const isFirstRender = useFirstRender([moduleId]);
1228
+ const final_host = environment.isLocalhost ? `https://localhost:${debug_port}` : `https://${window.location.host}/mf/${moduleId}`;
1229
+ function cleanUp(dScript) {
1230
+ try {
1231
+ if (window[`unmount_${prefix}_${dScript.moduleId}`]) {
1232
+ window[`unmount_${prefix}_${dScript.moduleId}`](dScript.divContainerId);
1233
+ }
1234
+ } catch (error) {
1235
+ }
1236
+ if (!cache) {
1237
+ const script = document.getElementById(dScript.scriptId);
1238
+ if (script) {
1239
+ try {
1240
+ document.head.removeChild(script);
1241
+ delete window[`render_${prefix}_${dScript.moduleId}`];
1242
+ delete window[`unmount_${prefix}_${dScript.moduleId}`];
1243
+ } catch (error) {
1244
+ }
1245
+ }
1246
+ }
1247
+ }
1248
+ const renderMicroFrontend = useCallback((newDScript) => {
1249
+ try {
1250
+ setIsLoading(false);
1251
+ window[`render_${prefix}_${newDScript.moduleId}`](newDScript.divContainerId, environment, hostTools, currentLocale, {
1252
+ hostThemeOptions,
1253
+ fnComponentsOverrides
1254
+ }, axiosOperation, formatter, dynamicMFStore, windowTools);
1255
+ } catch (error) {
1256
+ }
1257
+ }, [hostThemeOptions, currentLocale, formatter]);
1258
+ const debouncedSetDivScript = useCallback(debounce((newName) => {
1259
+ const newDivScript = getDivScritId(prefix, newName);
1260
+ if (newName !== divScript.moduleId) {
1261
+ setDivScript({
1262
+ ...newDivScript
1263
+ });
1264
+ }
1265
+ }, 200), [divScript]);
1266
+ useEffect(() => {
1267
+ if (!isFirstRender) {
1268
+ debouncedSetDivScript(moduleId + "");
1269
+ if (moduleId !== divScript.moduleId)
1270
+ ;
1271
+ }
1272
+ return () => {
1273
+ };
1274
+ }, [moduleId]);
1275
+ useEffect(() => {
1276
+ setIsLoading(true);
1277
+ let mounted = true;
1278
+ const controller = new AbortController();
1279
+ const dsScript = {
1280
+ ...divScript
1281
+ };
1282
+ const loadIfNotLoaded = async () => {
1283
+ if (!window[`render_${prefix}_${moduleId}`]) {
1284
+ let urlFile = "";
1285
+ setNetworkProgress(0);
1286
+ const manifest = await fetch(`${final_host}/manifest.json?rnd=${Math.random()}`).then((res) => res.json()).catch(() => {
1287
+ console.debug("Error fetching manifest", `${final_host}/manifest.json`);
1288
+ return void 0;
1289
+ });
1290
+ if (!manifest) {
1291
+ return;
1292
+ }
1293
+ setNetworkProgress(10);
1294
+ if (mounted) {
1295
+ urlFile = `${final_host}/${manifest["src/index.tsx"]["file"]}?rnd=${Math.random()}`;
1296
+ refTime.current = 0;
1297
+ await networkOperation({
1298
+ method: "GET",
1299
+ endPoint: urlFile,
1300
+ isRemote: !environment.isLocalhost,
1301
+ headers: {
1302
+ "Content-Type": "application/json"
1303
+ },
1304
+ onDownloadProgress: (progressEvent) => {
1305
+ let percentCompleted = 0;
1306
+ try {
1307
+ if (progressEvent.lengthComputable) {
1308
+ percentCompleted = 10 + Math.round(progressEvent.loaded * 90 / progressEvent.total);
1309
+ } else {
1310
+ if (refTime.current === 0) {
1311
+ refTime.current = new Date().getTime();
1312
+ }
1313
+ percentCompleted = 10 + progressEvent.loaded / 15e5 * 90;
1314
+ if (percentCompleted > 95)
1315
+ percentCompleted = 95;
1316
+ }
1317
+ } catch (error) {
1318
+ }
1319
+ if (mounted) {
1320
+ setNetworkProgress(percentCompleted);
1321
+ }
1322
+ },
1323
+ isExternalUrl: true,
1324
+ responseType: "text",
1325
+ signal: controller.signal
1326
+ }).then(() => {
1327
+ if (mounted) {
1328
+ setNetworkProgress(100);
1329
+ }
1330
+ }).catch(() => {
1331
+ });
1332
+ if (mounted) {
1333
+ const script = document.createElement("script");
1334
+ script.id = divScript.scriptId;
1335
+ script.crossOrigin = "";
1336
+ script.type = "module";
1337
+ script.src = urlFile || "";
1338
+ script.onload = () => {
1339
+ if (mounted) {
1340
+ console.debug("Script loaded", new Date().getTime());
1341
+ setNetworkProgress(100);
1342
+ renderMicroFrontend(dsScript);
1343
+ }
1344
+ };
1345
+ document.head.appendChild(script);
1346
+ console.debug("Script appened", new Date().getTime());
1347
+ }
1348
+ }
1349
+ } else {
1350
+ if (mounted) {
1351
+ renderMicroFrontend(dsScript);
1352
+ }
1353
+ }
1354
+ };
1355
+ loadIfNotLoaded();
1356
+ return () => {
1357
+ mounted = false;
1358
+ controller.abort();
1359
+ cleanUp(dsScript);
1360
+ };
1361
+ }, [divScript]);
1362
+ return /* @__PURE__ */ jsxs(Fragment, {
1363
+ children: [/* @__PURE__ */ jsx("div", {
1364
+ id: divScript.divContainerId
1365
+ }), isLoading ? /* @__PURE__ */ jsx(LoadingMF, {
1366
+ loadingProgress: networkProgress,
1367
+ setNetworkRefresh
1368
+ }) : null]
1369
+ });
1370
+ }
1371
+ MFLoader.defaultProps = {
1372
+ document,
1373
+ window
1374
+ };
1375
+ const MicroFrontend = (props) => {
1376
+ const dynamicMFStore = useWindowStore((state) => state.dynamicMFStore, shallow);
1377
+ const moduleId = useWindowStore((state) => state.moduleId, shallow);
1378
+ const actions = useWindowStore((state) => state.actions, shallow);
1379
+ return /* @__PURE__ */ jsx(MFLoader, {
1380
+ ...props,
1381
+ moduleId,
1382
+ dynamicMFStore,
1383
+ windowTools: {
1384
+ ...actions
1385
+ }
1386
+ });
1387
+ };
1388
+ React__default.memo(MicroFrontend);
1389
+ const InnerForHooks$1 = (props) => {
1390
+ const {
1391
+ winType
1392
+ } = props;
1393
+ const status = useWindowStore((state) => state.status);
1394
+ if (status !== "loaded") {
1395
+ return null;
1396
+ }
1397
+ return /* @__PURE__ */ jsxs(Fragment, {
1398
+ children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsx("div", {
1399
+ className: areasViewerClasses.windowContent,
1400
+ children: winType === "microfrontend" ? /* @__PURE__ */ jsx(MicroFrontend, {
1401
+ ...props.mfProps
1402
+ }) : /* @__PURE__ */ jsx(Component, {
1403
+ component: props.component
1404
+ })
1405
+ })]
1406
+ });
1407
+ };
1408
+ React__default.memo(InnerForHooks$1);
1409
+ const Window = (props) => {
1410
+ const {
1411
+ emergeType
1412
+ } = props;
1413
+ const selected = useAreaStore((state) => emergeType === "layout" ? state.currentLayoutId : state.currentPopUpId) === props.windowId;
1414
+ const {
1415
+ selectWindowPopUp,
1416
+ selectWindowLayout
1417
+ } = useAreaStore((state) => state.actions);
1418
+ const onTouch = () => {
1419
+ if (!selected) {
1420
+ if (emergeType === "popup") {
1421
+ selectWindowPopUp(props.windowId);
1422
+ } else if (emergeType === "layout") {
1423
+ selectWindowLayout(props.windowId);
1424
+ }
1425
+ }
1426
+ };
1427
+ return /* @__PURE__ */ jsx("div", {
1428
+ role: "presentation",
1429
+ className: clsx(areasViewerClasses.windowRoot, selected ? areasViewerClasses.selected : null),
1430
+ onMouseDown: onTouch,
1431
+ children: /* @__PURE__ */ jsx(WindowMFProvider, {
1432
+ ...props,
1433
+ children: /* @__PURE__ */ jsx(InnerForHooks$1, {
1434
+ ...props
1435
+ })
1436
+ })
1437
+ });
1438
+ };
1439
+ const MemonizedWindow = React__default.memo(Window);
1440
+ const WindowPopUp = (props) => {
1441
+ const {
1442
+ windowProps,
1443
+ windowId
1444
+ } = props;
1445
+ const {
1446
+ selectWindowPopUp
1447
+ } = useAreaStore((store) => store.actions);
1448
+ const selectedPopUpId = useAreaStore((store) => store.currentPopUpId);
1449
+ const zIndex = useAreaStore((store) => store.hashWindowsPopups[props.windowId].zIndex);
1450
+ const isSelected = props.windowId === selectedPopUpId;
1451
+ const onTouch = () => {
1452
+ if (!isSelected) {
1453
+ selectWindowPopUp(props.windowId);
1454
+ }
1455
+ };
1456
+ return /* @__PURE__ */ jsx(DraggableWindow, {
1457
+ handle: ".m4l_draggable_handle",
1458
+ cancel: "",
1459
+ defaultPosition: windowProps,
1460
+ children: /* @__PURE__ */ jsx(ResizeableWindow, {
1461
+ className: clsx(areasViewerClasses.windowPopupRoot, `${areasViewerClasses.windowPopupRoot}-${windowId}`),
1462
+ width: windowProps.width,
1463
+ height: windowProps.height,
1464
+ style: {
1465
+ zIndex,
1466
+ position: "absolute"
1467
+ },
1468
+ onResizeStart: () => {
1469
+ onTouch();
1470
+ },
1471
+ children: /* @__PURE__ */ jsx(Window, {
1472
+ ...props
1473
+ })
1474
+ })
1475
+ });
1476
+ };
1477
+ const MemonizedWindowPopUp = React__default.memo(WindowPopUp);
1478
+ styled("div")(({ theme }) => ({
1479
+ display: "flex",
1480
+ flexDirection: "column",
1481
+ height: "100%",
1482
+ overflow: "hidden",
1483
+ padding: theme.spacing(3)
1484
+ }));
1485
+ const WrapperWindowModal = styled(Dialog)(() => ({
1486
+ "& .MuiDialog-container": {},
1487
+ "&.m4l_selected": {
1488
+ borderTop: "1px solid green"
1489
+ }
1490
+ }));
1491
+ const WindowModal = (props) => {
1492
+ const {
1493
+ closeWindowModal
1494
+ } = useAreaStore((state) => state.actions);
1495
+ const isDesktop = useResponsiveDesktop();
1496
+ const onClose = () => {
1497
+ closeWindowModal();
1498
+ };
1499
+ const DragabblePaperComponent = (_props) => {
1500
+ return /* @__PURE__ */ jsx(cjs.exports, {
1501
+ handle: ".m4l_draggable_handle",
1502
+ bounds: "parent",
1503
+ children: /* @__PURE__ */ jsx(ResizeableWindow, {
1504
+ className: areasViewerClasses.windowModalRoot,
1505
+ width: props.width,
1506
+ height: props.height,
1507
+ children: /* @__PURE__ */ jsx(Window, {
1508
+ ...props,
1509
+ onClose
1510
+ })
1511
+ })
1512
+ });
1513
+ };
1514
+ function PaperComponent(_props) {
1515
+ return /* @__PURE__ */ jsx(Window, {
1516
+ ...props,
1517
+ onClose
1518
+ });
1519
+ }
1520
+ return /* @__PURE__ */ jsx(WrapperWindowModal, {
1521
+ open: true,
1522
+ disablePortal: true,
1523
+ scroll: "paper",
1524
+ onKeyDown: (event) => {
1525
+ if (event.key === "Escape") {
1526
+ onClose();
1527
+ }
1528
+ },
1529
+ "aria-labelledby": "child-modal-title",
1530
+ "aria-describedby": "child-modal-description",
1531
+ PaperComponent: isDesktop ? DragabblePaperComponent : PaperComponent,
1532
+ maxWidth: false,
1533
+ fullWidth: !isDesktop,
1534
+ fullScreen: false,
1535
+ disableEnforceFocus: true
1536
+ });
1537
+ };
1538
+ const MemonizedWindowModal = React__default.memo(WindowModal);
1539
+ const ResponsiveGridLayout = WidthProvider(Responsive);
1540
+ const GridLayout = () => {
1541
+ const gridLayouts = useAreaStore((state) => state.gridLayouts, shallow);
1542
+ const hashWindowsPopups = useAreaStore((state) => state.hashWindowsPopups, shallow);
1543
+ const hashWindowsLayouts = useAreaStore((state) => state.hashWindowsLayouts, shallow);
1544
+ const breakPointsLayouts = useAreaStore((state) => state.breakpointsLayouts, shallow);
1545
+ const windowsPopUps = useAreaStore((state) => state.windowsPopUps, shallow);
1546
+ const windowModal = useAreaStore((state) => state.windowModal, shallow);
1547
+ const breakpoints = useAreaStore((state) => state.breakpoints, shallow);
1548
+ const viewMode = useAreaStore((state) => state.viewMode, shallow);
1549
+ const cols = useAreaStore((state) => state.cols, shallow);
1550
+ const {
1551
+ onBreakpointsLayoutsChange
1552
+ } = useAreaStore((state) => state.actions);
1553
+ function onBreakpointChange(_newBreakpoint, _newCols) {
1554
+ }
1555
+ useEffect(() => {
1556
+ console.log("ResponsiveGridLayout resize");
1557
+ window.dispatchEvent(new Event("resize"));
1558
+ }, [viewMode, gridLayouts]);
1559
+ return /* @__PURE__ */ jsxs(Fragment, {
1560
+ children: [/* @__PURE__ */ jsxs(ResponsiveGridLayout, {
1561
+ autoSize: false,
1562
+ compactType: "vertical",
1563
+ measureBeforeMount: true,
1564
+ resizeHandles: ["nw", "se"],
1565
+ className: areasViewerClasses.areaGridLayout,
1566
+ layouts: breakPointsLayouts,
1567
+ onLayoutChange: onBreakpointsLayoutsChange,
1568
+ onBreakpointChange,
1569
+ breakpoints,
1570
+ cols,
1571
+ rowHeight: ROW_HEIGTH_GRIDLAYOUT,
1572
+ margin: [5, 5],
1573
+ containerPadding: [CONTAINER_PADDING_GRIDLAYOUT, CONTAINER_PADDING_GRIDLAYOUT],
1574
+ draggableHandle: ".m4l_draggable_handle",
1575
+ isBounded: false,
1576
+ preventCollision: false,
1577
+ children: [/* @__PURE__ */ jsx("div", {
1578
+ className: areasViewerClasses.areaGridLayoutPopupsContainer,
1579
+ "data-grid": {
1580
+ i: "none",
1581
+ x: 0,
1582
+ y: 0,
1583
+ w: 0,
1584
+ h: 0,
1585
+ maxW: 0,
1586
+ maxH: 0,
1587
+ minW: 0,
1588
+ minH: 0,
1589
+ static: true,
1590
+ isDraggable: false,
1591
+ isResizable: false
1592
+ },
1593
+ children: windowsPopUps.map((wp) => {
1594
+ if (hashWindowsPopups[wp]) {
1595
+ return /* @__PURE__ */ jsx(MemonizedWindowPopUp, {
1596
+ ...hashWindowsPopups[wp]
1597
+ }, hashWindowsPopups[wp].windowId);
1598
+ }
1599
+ return null;
1600
+ })
1601
+ }, "none"), gridLayouts.map((l) => {
1602
+ if (hashWindowsLayouts[l.i]) {
1603
+ return /* @__PURE__ */ jsx("div", {
1604
+ children: /* @__PURE__ */ jsx(MemonizedWindow, {
1605
+ ...hashWindowsLayouts[l.i]
1606
+ })
1607
+ }, l.i);
1608
+ }
1609
+ return null;
1610
+ })]
1611
+ }), windowModal && /* @__PURE__ */ jsx(MemonizedWindowModal, {
1612
+ ...windowModal
1613
+ })]
1614
+ });
1615
+ };
1616
+ const InnerForHooks = () => {
1617
+ const status = useAreaStore((state) => state.status);
1618
+ if (status === "loaded") {
1619
+ return /* @__PURE__ */ jsx(GridLayout, {});
1620
+ } else {
1621
+ return /* @__PURE__ */ jsx("div", {
1622
+ children: "Loading.. Intentar si falla."
1623
+ });
1624
+ }
1625
+ };
1626
+ const PanelWindows = () => {
1627
+ const status = useAreaStore((state) => state.status);
1628
+ const mode = useAreaStore((state) => state.viewMode);
1629
+ const singleId = useAreaStore((state) => state.singleId);
1630
+ const gridLayouts = useAreaStore((state) => state.gridLayouts, shallow);
1631
+ const hashWindowsLayouts = useAreaStore((state) => state.hashWindowsLayouts, shallow);
1632
+ const {
1633
+ maximizeLayout
1634
+ } = useAreaStore((state) => state.actions);
1635
+ const onTouched = (layoutId) => {
1636
+ maximizeLayout(layoutId);
1637
+ };
1638
+ if (status === "loaded") {
1639
+ if (mode !== "single" || gridLayouts.length < 2) {
1640
+ return null;
1641
+ }
1642
+ return /* @__PURE__ */ jsx("div", {
1643
+ className: areasViewerClasses.panelWindowsRoot,
1644
+ children: gridLayouts.map((l) => {
1645
+ return /* @__PURE__ */ jsx("div", {
1646
+ className: clsx(areasViewerClasses.panelWindowsButtonContainer, singleId === l.i ? areasViewerClasses.selected : null),
1647
+ children: /* @__PURE__ */ jsx(IconButton, {
1648
+ src: hashWindowsLayouts[l.i].url_icon,
1649
+ size: "small",
1650
+ onClick: () => onTouched(l.i)
1651
+ })
1652
+ }, l.i);
1653
+ })
1654
+ });
1655
+ } else {
1656
+ return null;
1657
+ }
1658
+ };
1659
+ const Area = (props) => {
1660
+ const {
1661
+ selected
1662
+ } = props;
1663
+ const classesAreaRoot = useAreasStore((state) => state.viwerClasses.areaRoot);
1664
+ return /* @__PURE__ */ jsx("div", {
1665
+ className: clsx(classesAreaRoot, selected ? areasViewerClasses.selected : null),
1666
+ children: /* @__PURE__ */ jsx(AreaProvider, {
1667
+ ...props,
1668
+ children: /* @__PURE__ */ jsxs("div", {
1669
+ className: clsx(areasViewerClasses.areaGridLayoutPanelContainer, `${areasViewerClasses.areaGridLayoutPanelContainer}-${props.id}`),
1670
+ children: [/* @__PURE__ */ jsx(InnerForHooks, {}), /* @__PURE__ */ jsx(PanelWindows, {})]
1671
+ })
1672
+ })
1673
+ });
1674
+ };
1675
+ Area.displayName = "Area";
1676
+ const AreasViewerRoot = styled("div")`
1677
+
1678
+ /* display: flex; */
1679
+ width: 100%;
1680
+ height: 100%;
1681
+ overflow: hidden;
1682
+ /* flex-grow: 1; */
1683
+ position: relative;
1684
+
1685
+
1686
+
1687
+ //areaRoot
1688
+ & .${areasViewerClasses.areaRoot} {
1689
+ display: none;
1690
+ position: absolute;
1691
+ /* flex-grow: 1; */
1692
+ flex-direction: row;
1693
+ inset: 0;
1694
+ /* width: 100%; */
1695
+ overflow: hidden;
1696
+ justify-content: top;
1697
+ align-items: flex-start;
1698
+
1699
+ visibility: hidden;
1700
+ }
1701
+
1702
+ & .${areasViewerClasses.areaRoot}.${areasViewerClasses.selected} {
1703
+ display: block;
1704
+ visibility: visible;
1705
+ }
1706
+
1707
+ &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaRoot} {
1708
+
1709
+ }
1710
+
1711
+ // areaGridLayoutPanelContainer
1712
+ & .${areasViewerClasses.areaGridLayoutPanelContainer} {
1713
+ display: flex;
1714
+ flex-direction: row;
1715
+ height: 100%;
1716
+ width: 100%;
1717
+ overflow: hidden;
1718
+ }
1719
+ &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaGridLayoutPanelContainer} {
1720
+ flex-direction: column-reverse;
1721
+ }
1722
+ // areaGridLayout
1723
+ & .${areasViewerClasses.areaGridLayout} {
1724
+ height: 100%!important;
1725
+ overflow: auto;
1726
+ flex-grow: 1;
1727
+ }
1728
+ &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaGridLayout} {
1729
+ flex-direction: column-reverse;
1730
+ height: unset;
1731
+ width: 100%;
1732
+ }
1733
+ // areaGridLayoutPopupsContainer
1734
+ & .${areasViewerClasses.areaGridLayoutPopupsContainer} {
1735
+ z-index: 1; //Garantizar q el contenedor de los popus este por encima de los layouts
1736
+ // // ' .react-draggable': {
1737
+ // // position: 'absolute',
1738
+ // // },
1739
+ }
1740
+
1741
+ // PanelWindowsRoot
1742
+ & .${areasViewerClasses.panelWindowsRoot} {
1743
+ display: flex;
1744
+ flex-direction: column;
1745
+ position: relative;
1746
+ }
1747
+ &.${areasViewerClasses.isMobile} .${areasViewerClasses.panelWindowsRoot} {
1748
+ flex-direction: row;
1749
+ }
1750
+ & .${areasViewerClasses.panelWindowsButtonContainer}.${areasViewerClasses.selected} {
1751
+ border: 1px solid red;
1752
+ }
1753
+
1754
+ // windowRoot
1755
+ & .${areasViewerClasses.windowRoot} {
1756
+ inset:0;
1757
+ position: absolute;
1758
+ display: flex;
1759
+ flex-direction: column;
1760
+ /* height: 100%; */
1761
+ /* width: 100%; */
1762
+ overflow: hidden;
1763
+ border: 1px solid gray;
1764
+
1765
+ background-color: ${(props) => props.theme.palette.background.default};
1766
+ padding: ${(props) => props.theme.spacing(0)};
1767
+ }
1768
+
1769
+ & .${areasViewerClasses.windowRoot}.${areasViewerClasses.selected} {
1770
+ border-top: 1px solid green;
1771
+ }
1772
+ // windowHeader
1773
+ & .${areasViewerClasses.windowHeader} {
1774
+ display: flex;
1775
+ gap: 4px;
1776
+
1777
+ align-items: center;
1778
+ position: relative;
1779
+
1780
+ padding: 8px;
1781
+ justify-content: end;
1782
+ min-height: ${(props) => props.theme.spacing(5)} ;
1783
+
1784
+ border-bottom: 1px solid ${(props) => props.theme.palette.divider},
1785
+ overflow: hidden;
1786
+ cursor: move;
1787
+ height: 60px;
1788
+
1789
+
1790
+
1791
+ > span: {
1792
+ margin-right: 12px;
1793
+ }
1794
+ }
1795
+ // windowHeaderTitle
1796
+ & .${areasViewerClasses.windowHeaderTitle} {
1797
+ width: 100%;
1798
+ max-width: 100%;
1799
+ overflow: hidden;
1800
+ white-space: nowrap;
1801
+ color: ${(props) => props.theme.palette.text.primary};
1802
+ margin-left: 12px;
1803
+ margin-right: 24px;
1804
+ text-overflow: ellipsis;
1805
+ }
1806
+ // windowHeaderMainActions
1807
+ & .${areasViewerClasses.windowHeaderMainActions} {
1808
+ display: flex;
1809
+
1810
+ gap: 4px;
1811
+ }
1812
+
1813
+
1814
+ // windowHeaderMainActions
1815
+ & .${areasViewerClasses.windowContent} {
1816
+ flex-grow: 1;
1817
+ position: relative;
1818
+ }
1819
+
1820
+ // windowModalRoot
1821
+ & .${areasViewerClasses.windowModalRoot} .${areasViewerClasses.windowRoot}{
1822
+ padding: 16px;
1823
+ }
1824
+
1825
+ .react-grid-layout {
1826
+ position: relative;
1827
+ transition: height 200ms ease;
1828
+ }
1829
+ .react-grid-item {
1830
+ transition: all 200ms ease;
1831
+ transition-property: left, top;
1832
+ }
1833
+ .react-grid-item img {
1834
+ pointer-events: none;
1835
+ user-select: none;
1836
+ }
1837
+ .react-grid-item.cssTransforms {
1838
+ transition-property: transform;
1839
+ }
1840
+ .react-grid-item.resizing {
1841
+ z-index: 1;
1842
+ will-change: width, height;
1843
+ }
1844
+
1845
+ .react-grid-item.react-draggable-dragging {
1846
+ transition: none;
1847
+ z-index: 3;
1848
+ will-change: transform;
1849
+ }
1850
+
1851
+ .react-grid-item.dropping {
1852
+ visibility: hidden;
1853
+ }
1854
+
1855
+ .react-grid-item.react-grid-placeholder {
1856
+ background: green;
1857
+ opacity: 0.2;
1858
+ transition-duration: 100ms;
1859
+ z-index: 2;
1860
+ -webkit-user-select: none;
1861
+ -moz-user-select: none;
1862
+ -ms-user-select: none;
1863
+ -o-user-select: none;
1864
+ user-select: none;
1865
+ }
1866
+
1867
+ .react-grid-item > .react-resizable-handle {
1868
+ position: absolute;
1869
+ width: 20px;
1870
+ height: 20px;
1871
+ }
1872
+
1873
+ .react-grid-item > .react-resizable-handle::after {
1874
+ content: "";
1875
+ position: absolute;
1876
+ right: 3px;
1877
+ bottom: 3px;
1878
+ width: 5px;
1879
+ height: 5px;
1880
+ border-right: 2px solid rgba(0, 0, 0, 0.4);
1881
+ border-bottom: 2px solid rgba(0, 0, 0, 0.4);
1882
+ }
1883
+
1884
+ .react-resizable-hide > .react-resizable-handle {
1885
+ display: none;
1886
+ }
1887
+
1888
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-sw {
1889
+ bottom: 0;
1890
+ left: 0;
1891
+ cursor: sw-resize;
1892
+ transform: rotate(90deg);
1893
+ }
1894
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-se {
1895
+ bottom: 0;
1896
+ right: 0;
1897
+ cursor: se-resize;
1898
+ }
1899
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-nw {
1900
+ top: 0;
1901
+ left: 0;
1902
+ cursor: nw-resize;
1903
+ transform: rotate(180deg);
1904
+ }
1905
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-ne {
1906
+ top: 0;
1907
+ right: 0;
1908
+ cursor: ne-resize;
1909
+ transform: rotate(270deg);
1910
+ }
1911
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-w,
1912
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-e {
1913
+ top: 50%;
1914
+ margin-top: -10px;
1915
+ cursor: ew-resize;
1916
+ }
1917
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-w {
1918
+ left: 0;
1919
+ transform: rotate(135deg);
1920
+ }
1921
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-e {
1922
+ right: 0;
1923
+ transform: rotate(315deg);
1924
+ }
1925
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-n,
1926
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-s {
1927
+ left: 50%;
1928
+ margin-left: -10px;
1929
+ cursor: ns-resize;
1930
+ }
1931
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-n {
1932
+ top: 0;
1933
+ transform: rotate(225deg);
1934
+ }
1935
+ .react-grid-item > .react-resizable-handle.react-resizable-handle-s {
1936
+ bottom: 0;
1937
+ transform: rotate(45deg);
1938
+ }
1939
+
1940
+
1941
+ ${react_resizable_css}
1942
+
1943
+
1944
+ ${(props) => props.theme.components?.M4LAreasViewer}
1945
+
1946
+
1947
+ `;
1948
+ function AreasViewer() {
1949
+ const areas = useAreasStore((state) => state.areas);
1950
+ const currentArea = useAreasStore((state) => state.currentArea);
1951
+ const status = useAreasStore((state) => state.ownerState.status);
1952
+ const classesRoot = useAreasStore((state) => state.viwerClasses.root);
1953
+ return /* @__PURE__ */ jsx(AreasViewerRoot, {
1954
+ className: classesRoot,
1955
+ children: status === "loaded" ? areas.map((area) => {
1956
+ return /* @__PURE__ */ jsx(Area, {
1957
+ id: area.id,
1958
+ selected: currentArea === area.id,
1959
+ loadWindows: area.loadWindows
1960
+ }, area.id);
1961
+ }) : /* @__PURE__ */ jsx(Fragment, {
1962
+ children: "Bruce cargando"
1963
+ })
1964
+ });
1965
+ }
1966
+ export {
1967
+ AreaContext as A,
1968
+ WindowContext as W,
1969
+ Area as a,
1970
+ AreasViewer as b,
1971
+ useAreasViewerUtilityClasses as u
1972
+ };