@m4l/components 0.1.69 → 0.1.71

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 (141) hide show
  1. package/@types/export.d.ts +27 -1
  2. package/components/CommonActions/components/ActionCancel/{index.e83053da.js → index.ff90f2c0.js} +2 -2
  3. package/components/CommonActions/components/ActionFormCancel/{index.ca378b0a.js → index.392a17c0.js} +26 -13
  4. package/components/CommonActions/components/ActionFormIntro/{index.fa2107df.js → index.f88d8849.js} +2 -2
  5. package/components/CommonActions/components/ActionIntro/{index.b8d5c8ee.js → index.e31ab7e9.js} +3 -3
  6. package/components/CommonActions/components/Actions/{index.1b2a0921.js → index.6b7d480a.js} +24 -13
  7. package/components/DataGrid/{index.75ea6038.js → index.77ae9b4c.js} +23 -20
  8. package/components/DynamicFilter/{index.aaeea668.js → index.b2ba5167.js} +53 -108
  9. package/components/HelperText/{index.742d547d.js → index.d7b1b21a.js} +11 -10
  10. package/components/Icon/{index.952f0635.js → index.6f2a5618.js} +6 -4
  11. package/components/Icon/types.d.ts +1 -0
  12. package/components/Image/{index.f30f79f0.js → index.1e3b7ff6.js} +3 -3
  13. package/components/LanguagePopover/{index.526e544e.js → index.310e9a3a.js} +11 -11
  14. package/components/ModalDialog/{index.4d663d0a.js → index.598f9a86.js} +19 -5
  15. package/components/NavLink/{index.92008184.js → index.ac3778af.js} +12 -11
  16. package/components/NoItemSelected/{index.6f2952ab.js → index.3809e3d1.js} +1 -1
  17. package/components/ObjectLogs/{index.d1eee18b.js → index.949d3595.js} +18 -15
  18. package/components/PaperForm/{index.e9db704b.js → index.cf8af08b.js} +1 -1
  19. package/components/Period/{index.3ff6f53b.js → index.53ea0562.js} +25 -14
  20. package/components/Resizeable/{index.ff97422e.js → index.ff4ce7a4.js} +20 -6
  21. package/components/SideBar/{index.365f64f0.js → index.4daafbab.js} +59 -58
  22. package/components/SideBar/subcomponents/ContentMobile/subcomponents/Drawer.d.ts +3 -0
  23. package/components/SideBar/subcomponents/ContentMobile/subcomponents/types.d.ts +8 -0
  24. package/components/areas/components/AreasAdmin/classes/types.d.ts +1 -0
  25. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/styles.d.ts +4 -0
  26. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/types.d.ts +5 -0
  27. package/components/areas/components/AreasViewer/classes/index.d.ts +1 -1
  28. package/components/areas/components/AreasViewer/classes/types.d.ts +3 -0
  29. package/components/areas/components/AreasViewer/subcomponents/Area/index.d.ts +2 -2
  30. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/GridLayout/index.d.ts +2 -1
  31. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/GridLayout/types.d.ts +3 -0
  32. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/InnerForHooks/index.d.ts +2 -1
  33. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/InnerForHooks/types.d.ts +3 -0
  34. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/index.d.ts +2 -1
  35. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/types.d.ts +3 -0
  36. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/index.d.ts +1 -1
  37. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/styles.d.ts +2 -0
  38. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/index.d.ts +4 -0
  39. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/types.d.ts +9 -0
  40. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/helper.d.ts +3 -0
  41. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/index.d.ts +9 -0
  42. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/MainActions/index.d.ts +6 -0
  43. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/index.d.ts +4 -0
  44. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/index.d.ts +2 -2
  45. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/subcomponents/MFLoader/types.d.ts +8 -0
  46. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/types.d.ts +8 -0
  47. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/types.d.ts +2 -0
  48. package/components/areas/components/AreasViewer/subcomponents/Area/types.d.ts +4 -0
  49. package/components/areas/components/{index.ffb147c7.js → index.31f39977.js} +601 -1034
  50. package/components/areas/components/index.d.ts +1 -1
  51. package/components/areas/contexts/AreasContext/helper.d.ts +59 -0
  52. package/components/areas/contexts/AreasContext/index.e14d6799.js +1030 -0
  53. package/components/areas/contexts/AreasContext/store.d.ts +1 -2
  54. package/components/areas/contexts/AreasContext/types.d.ts +91 -13
  55. package/components/areas/contexts/DynamicMFParmsContext/index.1607c78e.js +42 -0
  56. package/components/areas/contexts/DynamicMFParmsContext/index.d.ts +8 -0
  57. package/components/areas/{components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts → contexts}/DynamicMFParmsContext/store.d.ts +3 -9
  58. package/components/areas/contexts/WindowToolsMFContext/index.8f3e2a04.js +20 -0
  59. package/components/areas/{components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts → contexts}/WindowToolsMFContext/types.d.ts +3 -2
  60. package/components/areas/contexts/index.5ba05323.js +2 -0
  61. package/components/areas/contexts/index.d.ts +4 -4
  62. package/components/areas/dictionary.d.ts +3 -0
  63. package/components/areas/hooks/index.ae8d8631.js +13 -0
  64. package/components/areas/hooks/useArea/index.c135e0cf.js +12 -0
  65. package/components/areas/hooks/useDynamicMFParameters/index.d.ts +3 -9
  66. package/components/areas/hooks/useDynamicMFParameters/{index.7ce7176f.js → index.e52c5392.js} +1 -1
  67. package/components/areas/hooks/useWindowToolsMF/index.d.ts +1 -1
  68. package/components/areas/icons.d.ts +5 -0
  69. package/components/areas/{index.20cbd7b7.js → index.bd29b1db.js} +21 -9
  70. package/components/areas/types.d.ts +32 -23
  71. package/components/formatters/BooleanFormatter/{index.d5e21bdd.js → index.99c7fe49.js} +1 -1
  72. package/components/formatters/{index.650243bb.js → index.1a92006b.js} +3 -2
  73. package/components/hook-form/RHFAutocomplete/{index.21377a2c.js → index.c4ba070a.js} +12 -11
  74. package/components/hook-form/RHFAutocompleteAsync/{index.8c7e0842.js → index.a63f3704.js} +2 -2
  75. package/components/hook-form/RHFCheckbox/{index.83902d07.js → index.9055f88d.js} +3 -3
  76. package/components/hook-form/RHFDateTime/{index.166250d8.js → index.2cb94a66.js} +10 -10
  77. package/components/hook-form/RHFPeriod/{index.61baf76f.js → index.14dcf762.js} +2 -2
  78. package/components/hook-form/RHFTextField/{index.55687a39.js → index.7ce2b16e.js} +7 -7
  79. package/components/hook-form/RHFUpload/{index.eb4d0dac.js → index.c57a43f8.js} +1 -1
  80. package/components/modal/WindowBase/subcomponents/Header/types.d.ts +1 -1
  81. package/components/modal/WindowBase/types.d.ts +1 -0
  82. package/components/modal/{WindowBase.7ce0b21e.js → WindowBase.32d35d71.js} +28 -21
  83. package/components/modal/{WindowConfirm.7ae1326f.js → WindowConfirm.70bcbb69.js} +18 -15
  84. package/components/modal/index.ef3aa9ac.js +35 -0
  85. package/components/mui_extended/Accordion/{index.51feece8.js → index.44e96bb8.js} +2 -2
  86. package/components/mui_extended/Button/{index.b34c8b68.js → index.ec6525e0.js} +6 -4
  87. package/components/mui_extended/Button/types.d.ts +2 -0
  88. package/components/mui_extended/IconButton/{index.917f0d3c.js → index.7aab3e04.js} +7 -5
  89. package/components/mui_extended/MenuActions/{index.651dec44.js → index.bff47c06.js} +3 -3
  90. package/components/mui_extended/Pager/{index.e0663072.js → index.907d5801.js} +1 -1
  91. package/components/mui_extended/Popover/{index.226f247e.js → index.9f35d0eb.js} +1 -3
  92. package/components/mui_extended/Popover/types.d.ts +6 -2
  93. package/components/mui_extended/Typography/{index.79e2b06f.js → index.d5e0f69f.js} +1 -1
  94. package/components/mui_extended/index.1f766f93.js +20 -0
  95. package/contexts/ModalContext/{index.76d5ccee.js → index.fca184e2.js} +1 -1
  96. package/contexts/index.d.ts +1 -1
  97. package/hooks/useModal/{index.043e419b.js → index.9b244379.js} +1 -1
  98. package/index.js +101 -99
  99. package/package.json +5 -4
  100. package/{react-draggable.de1aac90.js → react-draggable.29f78f6d.js} +1 -1
  101. package/{react-resizable.e0470767.js → react-resizable.baf54eb2.js} +3 -3
  102. package/utils/{index.b5c62ef0.js → index.ee16888d.js} +1 -1
  103. package/{vendor.6a33c6d2.js → vendor.619c3533.js} +50 -48
  104. package/components/DynamicFilter/subcomponents/fieldstypes/BooleanFilter/styles.d.ts +0 -2
  105. package/components/DynamicFilter/subcomponents/fieldstypes/DateTimeFilter/styles.d.ts +0 -2
  106. package/components/DynamicFilter/subcomponents/fieldstypes/NumberFilter/styles.d.ts +0 -2
  107. package/components/DynamicFilter/subcomponents/fieldstypes/StringFilter/styles.d.ts +0 -2
  108. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/helper.d.ts +0 -39
  109. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/index.d.ts +0 -20
  110. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/store.d.ts +0 -11
  111. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/types.d.ts +0 -82
  112. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/DynamicMFParmsContext/index.d.ts +0 -14
  113. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/helper.d.ts +0 -1
  114. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/index.d.ts +0 -13
  115. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/store.d.ts +0 -36
  116. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/types.d.ts +0 -5
  117. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/index.d.ts +0 -4
  118. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Component/index.d.ts +0 -8
  119. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/helper.d.ts +0 -3
  120. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/index.d.ts +0 -2
  121. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/subcomponents/MainActions/index.d.ts +0 -2
  122. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/index.d.ts +0 -4
  123. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +0 -8
  124. package/components/areas/contexts/AreasContext/index.7c12b512.js +0 -230
  125. package/components/areas/contexts/index.1a823ffb.js +0 -2
  126. package/components/areas/hooks/index.d09ea7de.js +0 -26
  127. package/components/areas/hooks/useArea/index.3a0d4b8c.js +0 -34
  128. package/components/areas/hooks/useArea/index.d.ts +0 -11
  129. package/components/areas/hooks/useWindow/index.d.ts +0 -11
  130. package/components/modal/index.d6dcd1b1.js +0 -24
  131. package/components/mui_extended/index.8b30e8c8.js +0 -19
  132. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/Header → Header}/skeleton.d.ts +0 -0
  133. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/Header → Header}/styles.d.ts +0 -0
  134. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/index.d.ts +0 -0
  135. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/styles.d.ts +0 -0
  136. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/index.d.ts +0 -0
  137. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/styles.d.ts +0 -0
  138. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/subcomponents/NotFound/types.d.ts +0 -0
  139. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/types.d.ts +0 -0
  140. /package/components/areas/{components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts → contexts}/DynamicMFParmsContext/types.d.ts +0 -0
  141. /package/components/areas/{components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts → contexts}/WindowToolsMFContext/index.d.ts +0 -0
@@ -1,83 +1,84 @@
1
- import { I as IconButton } from "../../mui_extended/IconButton/index.917f0d3c.js";
2
- import { u as useAreasStore, a as useArea, b as useAreas, c as useAreaStore } from "../hooks/useArea/index.3a0d4b8c.js";
3
- import { useEnvironment, useNetwork, useModuleDictionary, useModuleSkeleton, useHostTools, axiosOperation } from "@m4l/core";
1
+ import { I as IconButton } from "../../mui_extended/IconButton/index.7aab3e04.js";
2
+ import { u as useAreasStore } from "../hooks/useArea/index.c135e0cf.js";
3
+ import { useEnvironment, useModuleDictionary, useModuleSkeleton, useNetwork, useHostTools, axiosOperation } from "@m4l/core";
4
4
  import { shallow } from "zustand/shallow";
5
- import { A as AREAS_VIEWER_CLASS_NAME, a as AREAS_ADMIN_CLASS_NAME, I as ICONS, g as getAreasDictionary } from "../index.20cbd7b7.js";
6
- import { I as Icon } from "../../Icon/index.952f0635.js";
5
+ import { A as AREAS_VIEWER_CLASS_NAME, a as AREAS_ADMIN_CLASS_NAME, g as getAreasDictionary, I as ICONS, D as DICCTIONARY } from "../index.bd29b1db.js";
6
+ import { I as Icon } from "../../Icon/index.6f2a5618.js";
7
+ import { S as ScrollBar } from "../../ScrollBar/index.bbe48f4d.js";
7
8
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
8
- import React__default, { createContext, useRef, useEffect, useMemo, useState, useCallback } from "react";
9
+ import React__default, { useState, useRef, useMemo, useCallback, useEffect } from "react";
9
10
  import { generateUtilityClasses, Skeleton, styled as styled$1, Typography as Typography$1, Dialog } from "@mui/material";
10
11
  import clsx from "clsx";
11
- import { createStore, useStore } from "zustand";
12
- import "../contexts/AreasContext/index.7c12b512.js";
13
- import "../../mui_extended/Accordion/index.51feece8.js";
12
+ import { useResponsiveDesktop, useHostTheme, useFormatter, useLocales, useFirstRender, useResizeObserver } from "@m4l/graphics";
13
+ import "zustand";
14
+ import { R as ROW_HEIGTH_GRIDLAYOUT, M as MARGIN_GRIDLAYOUT, C as CONTAINER_PADDING_GRIDLAYOUT, T as THROTTLE_RESIZE_TIME } from "../contexts/AreasContext/index.e14d6799.js";
15
+ import * as Yup from "yup";
16
+ import "../../mui_extended/Accordion/index.44e96bb8.js";
14
17
  import "../../mui_extended/Avatar/index.fe06afd7.js";
15
18
  import "react-router-dom";
16
19
  import "@mui/material/Button";
17
- import { B as Button } from "../../mui_extended/Button/index.b34c8b68.js";
18
- import { I as Image } from "../../Image/index.f30f79f0.js";
20
+ import { B as Button } from "../../mui_extended/Button/index.ec6525e0.js";
21
+ import { I as Image } from "../../Image/index.1e3b7ff6.js";
19
22
  import "@mui/lab";
20
- import { T as Typography } from "../../mui_extended/Typography/index.79e2b06f.js";
21
- import "../../mui_extended/Popover/index.226f247e.js";
22
- import { M as MenuActions } from "../../mui_extended/MenuActions/index.651dec44.js";
23
- import "../../mui_extended/Pager/index.e0663072.js";
23
+ import { T as Typography } from "../../mui_extended/Typography/index.d5e0f69f.js";
24
+ import { P as Popover } from "../../mui_extended/Popover/index.9f35d0eb.js";
25
+ import { M as MenuActions } from "../../mui_extended/MenuActions/index.bff47c06.js";
26
+ import "../../mui_extended/Pager/index.907d5801.js";
24
27
  import "../../mui_extended/Tab/index.e0653a0a.js";
25
28
  import { unstable_composeClasses } from "@mui/base";
26
- import { g as getComponentUtilityClass } from "../../../utils/index.b5c62ef0.js";
27
- import { styled } from "@mui/material/styles";
28
- import { r as react_resizable_css } from "../../../react-resizable.e0470767.js";
29
- import { immer } from "zustand/middleware/immer";
30
- import { devtools } from "zustand/middleware";
29
+ import { g as getComponentUtilityClass } from "../../../utils/index.ee16888d.js";
30
+ import { D as DynamicMFParmsProvider } from "../contexts/DynamicMFParmsContext/index.1607c78e.js";
31
+ import "../../../contexts/ModalContext/index.fca184e2.js";
32
+ import { R as RHFormProvider } from "../../../contexts/RHFormContext/index.a7511399.js";
33
+ import "react-hook-form";
34
+ import "../../hook-form/RHFAutocomplete/index.c4ba070a.js";
35
+ import "../../HelperText/index.d7b1b21a.js";
31
36
  import debounce from "lodash/debounce";
32
- import cloneDeep from "lodash.clonedeep";
33
- import { useResponsiveDesktop, useFirstRender, useHostTheme, useFormatter, useLocales } from "@m4l/graphics";
37
+ import "../../hook-form/RHFAutocompleteAsync/index.a63f3704.js";
38
+ import "../../hook-form/RHFCheckbox/index.9055f88d.js";
39
+ import "@mui/x-date-pickers";
40
+ import "../../hook-form/RHFDateTime/index.2cb94a66.js";
41
+ import { R as RHFTextField } from "../../hook-form/RHFTextField/index.7ce2b16e.js";
42
+ import "../../hook-form/RHFPeriod/index.14dcf762.js";
43
+ import "../../Period/index.53ea0562.js";
44
+ import { A as Actions } from "../../CommonActions/components/Actions/index.6b7d480a.js";
45
+ import { A as ActionCancel } from "../../CommonActions/components/ActionCancel/index.ff90f2c0.js";
46
+ import { A as ActionIntro } from "../../CommonActions/components/ActionIntro/index.e31ab7e9.js";
47
+ import { c as cjs } from "../../../react-draggable.29f78f6d.js";
48
+ import "../../ModalDialog/index.598f9a86.js";
49
+ import { R as ResizeableWindow } from "../../Resizeable/index.ff4ce7a4.js";
50
+ import "../../modal/WindowConfirm.70bcbb69.js";
51
+ import "../../modal/WindowBase.32d35d71.js";
52
+ import { styled } from "@mui/material/styles";
53
+ import { r as react_resizable_css } from "../../../react-resizable.baf54eb2.js";
34
54
  import { WidthProvider, Responsive } from "react-grid-layout";
35
55
  import { m } from "framer-motion";
36
56
  import "../../animate/LoadingScreen/index.1d0c4307.js";
37
57
  import "../../animate/PropagateLoader/index.be5b02c3.js";
38
- import "react-hook-form";
39
- import "../../hook-form/RHFAutocomplete/index.21377a2c.js";
40
- import "../../HelperText/index.742d547d.js";
41
- import "../../hook-form/RHFAutocompleteAsync/index.8c7e0842.js";
42
- import "../../hook-form/RHFCheckbox/index.83902d07.js";
43
- import "@mui/x-date-pickers";
44
- import "../../hook-form/RHFDateTime/index.166250d8.js";
45
- import "../../hook-form/RHFTextField/index.55687a39.js";
46
- import "../../hook-form/RHFPeriod/index.61baf76f.js";
47
- import "../../Period/index.3ff6f53b.js";
48
- import "../../CommonActions/components/Actions/index.1b2a0921.js";
49
- import "../../../contexts/ModalContext/index.76d5ccee.js";
50
- import { c as cjs } from "../../../react-draggable.de1aac90.js";
51
- import "../../ModalDialog/index.4d663d0a.js";
52
- import { R as ResizeableWindow } from "../../Resizeable/index.ff97422e.js";
53
- import "../../modal/WindowConfirm.7ae1326f.js";
54
- import "../../modal/WindowBase.7ce0b21e.js";
58
+ import { W as WindowToolsMFProvider } from "../contexts/WindowToolsMFContext/index.8f3e2a04.js";
55
59
  import "lodash/isString";
56
60
  import "react-dropzone";
57
- import "../../hook-form/RHFUpload/index.eb4d0dac.js";
58
- import "../../DataGrid/index.75ea6038.js";
61
+ import "../../hook-form/RHFUpload/index.c57a43f8.js";
62
+ import "../../DataGrid/index.77ae9b4c.js";
59
63
  import "react-dnd";
60
64
  import "react-dnd-html5-backend";
61
- import "../../DynamicFilter/index.aaeea668.js";
62
- import "../../ScrollBar/index.bbe48f4d.js";
63
- import "yup";
65
+ import "../../DynamicFilter/index.b2ba5167.js";
64
66
  import "@hookform/resolvers/yup";
65
- import "../../../contexts/RHFormContext/index.a7511399.js";
66
- import { D as DraggableWindow } from "../../../vendor.6a33c6d2.js";
67
- import "../../LanguagePopover/index.526e544e.js";
68
- import "../../NavLink/index.92008184.js";
69
- import "../../NoItemSelected/index.6f2952ab.js";
70
- import "../../ObjectLogs/index.d1eee18b.js";
67
+ import "../../LanguagePopover/index.310e9a3a.js";
68
+ import "../../NavLink/index.ac3778af.js";
69
+ import "../../NoItemSelected/index.3809e3d1.js";
70
+ import "../../ObjectLogs/index.949d3595.js";
71
71
  import "../../../react-json-view.57125fcf.js";
72
- import "../../PaperForm/index.e9db704b.js";
72
+ import "../../PaperForm/index.cf8af08b.js";
73
73
  import "../../Page/index.4237c241.js";
74
74
  import "../../PropertyValue/index.dfcfe1ba.js";
75
75
  import "../../../react-splitter-layout.8b1655c8.js";
76
76
  import "../../SplitLayout/index.5a8355d8.js";
77
- import "../../SideBar/index.365f64f0.js";
78
- import { a as useWindow, b as useWindowStore } from "../hooks/index.d09ea7de.js";
77
+ import "../../SideBar/index.4daafbab.js";
78
+ import { D as DraggableWindow } from "../../../vendor.619c3533.js";
79
79
  import { L as LinearProgress } from "../../mui_extended/LinearProgress/index.c92b9ba9.js";
80
80
  import { v as varBounce } from "../../animate/variants/bounce.784aaaaa.js";
81
+ import { throttle } from "lodash";
81
82
  const areasViewerClasses = generateUtilityClasses(AREAS_VIEWER_CLASS_NAME, [
82
83
  "root",
83
84
  "areaRoot",
@@ -91,10 +92,13 @@ const areasViewerClasses = generateUtilityClasses(AREAS_VIEWER_CLASS_NAME, [
91
92
  "windowContent",
92
93
  "windowPopupRoot",
93
94
  "windowModalRoot",
95
+ "windowRootContainer",
94
96
  "panelWindowsRoot",
95
97
  "panelWindowsButtonContainer",
96
98
  "selected",
97
- "isMobile"
99
+ "selectedWindow",
100
+ "isMobile",
101
+ "loading"
98
102
  ], AREAS_VIEWER_CLASS_NAME);
99
103
  const useAreasViewerUtilityClasses = (ownerState) => {
100
104
  const slots = {
@@ -104,12 +108,14 @@ const useAreasViewerUtilityClasses = (ownerState) => {
104
108
  areaGridLayout: ["areaGridLayout"],
105
109
  areaGridLayoutPopupsContainer: ["areaGridLayoutPopupsContainer"],
106
110
  windowRoot: ["windowRoot"],
111
+ windowRootContainer: ["windowRootContainer"],
107
112
  windowHeader: ["windowHeader"],
108
113
  windowHeaderTitle: ["windowHeaderTitle"],
109
114
  windowHeaderMainActions: ["windowHeaderMainActions"],
110
115
  windowContent: ["windowContent"],
111
116
  windowPopupRoot: ["windowPopupRoot"],
112
117
  windowModalRoot: ["windowModalRoot"],
118
+ selectedWindow: ["selectedWindow"],
113
119
  panelWindowsRoot: ["panelWindowsRoot"],
114
120
  panelWindowsButtonContainer: ["panelWindowsButtonContainer"]
115
121
  };
@@ -120,12 +126,13 @@ const areasAdminClasses = generateUtilityClasses(AREAS_ADMIN_CLASS_NAME, [
120
126
  "areaChipRoot",
121
127
  "areaChipTitle",
122
128
  "areaChipDeleteButton",
123
- "areaChipEditButton",
124
129
  "areasAddButton",
125
130
  "areaContainerChips",
126
131
  "areaIconLayer",
132
+ "areaChipEditButton",
127
133
  "selected",
128
- "isMobile"
134
+ "isMobile",
135
+ "disabled"
129
136
  ], AREAS_ADMIN_CLASS_NAME);
130
137
  const useAreasAdminUtilityClasses = (ownerState) => {
131
138
  const slots = {
@@ -140,11 +147,41 @@ const useAreasAdminUtilityClasses = (ownerState) => {
140
147
  };
141
148
  return unstable_composeClasses(slots, getComponentUtilityClass(AREAS_ADMIN_CLASS_NAME), {});
142
149
  };
150
+ styled("div")(() => ({
151
+ display: "flex",
152
+ flexDirection: "row",
153
+ border: "1px solid gray",
154
+ "&.active": {
155
+ border: "1px solid red"
156
+ }
157
+ }));
158
+ styled("div")(({
159
+ theme
160
+ }) => ({
161
+ height: "100%",
162
+ width: theme.spacing(1),
163
+ backgroundColor: theme.palette.background.default,
164
+ "&.active": {
165
+ backgroundColor: theme.palette.primary.main
166
+ }
167
+ }));
168
+ const EditAreaHeader = styled("div")(({
169
+ theme
170
+ }) => ({
171
+ display: "flex",
172
+ width: "100%",
173
+ height: "25px",
174
+ borderBottom: "1px solid",
175
+ borderColor: theme.palette.state.default,
176
+ justifyContent: "space-between",
177
+ alignItems: "center"
178
+ }));
143
179
  const AreaChip = (props) => {
144
180
  const {
145
181
  areaId,
146
182
  selected,
147
- areaName
183
+ areaName,
184
+ disabled
148
185
  } = props;
149
186
  const {
150
187
  host_static_assets,
@@ -152,26 +189,102 @@ const AreaChip = (props) => {
152
189
  } = useEnvironment();
153
190
  const {
154
191
  deleteArea,
155
- selectArea
156
- } = useAreasStore((state) => state.actions);
192
+ selectArea,
193
+ editArea
194
+ } = useAreasStore((state) => state.areasActions);
195
+ const [open, setOpen] = useState(false);
196
+ const {
197
+ getLabel
198
+ } = useModuleDictionary();
199
+ const anchorRef = useRef(null);
157
200
  const onClickDeleteArea = (e) => {
158
201
  e.stopPropagation();
159
202
  deleteArea(areaId);
160
203
  };
204
+ const onSubmit = (data) => {
205
+ console.log("data areachip", data);
206
+ editArea(areaId, data.inputEditArea);
207
+ setOpen(false);
208
+ };
209
+ const handlerOpenPopover = () => {
210
+ setOpen(true);
211
+ };
212
+ const initialValues = {
213
+ inputEditArea: areaName
214
+ };
215
+ const validationSchema = useMemo(() => Yup.object().shape({
216
+ inputEditArea: Yup.string().required(getLabel(getAreasDictionary("validation_edit_area")))
217
+ }), [getLabel]);
161
218
  return /* @__PURE__ */ jsxs("div", {
162
219
  role: "presentation",
163
- className: clsx(areasAdminClasses.areaChipRoot, selected ? areasAdminClasses.selected : null),
220
+ className: clsx(areasAdminClasses.areaChipRoot, selected ? areasAdminClasses.selected : null, disabled ? areasAdminClasses.disabled : null),
164
221
  onClick: () => {
165
222
  selectArea(areaId);
166
223
  },
167
- children: [/* @__PURE__ */ jsx("span", {
224
+ ref: anchorRef,
225
+ children: [/* @__PURE__ */ jsx("div", {
168
226
  className: areasAdminClasses.areaChipTitle,
169
227
  children: areaName
170
- }), /* @__PURE__ */ jsx(IconButton, {
171
- className: areasAdminClasses.areaChipDeleteButton,
172
- src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
173
- size: "small",
174
- onClick: onClickDeleteArea
228
+ }), /* @__PURE__ */ jsxs("div", {
229
+ style: {
230
+ display: "flex"
231
+ },
232
+ children: [/* @__PURE__ */ jsx(IconButton, {
233
+ className: areasAdminClasses.areaChipEditButton,
234
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.EDIT_AREA}`,
235
+ size: "extraSmall",
236
+ onClick: handlerOpenPopover
237
+ }), /* @__PURE__ */ jsx(IconButton, {
238
+ className: areasAdminClasses.areaChipDeleteButton,
239
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
240
+ size: "extraSmall",
241
+ onClick: onClickDeleteArea
242
+ })]
243
+ }), /* @__PURE__ */ jsx(Popover, {
244
+ arrowType: "top-center",
245
+ open,
246
+ anchorEl: anchorRef.current,
247
+ anchorOrigin: {
248
+ vertical: "bottom",
249
+ horizontal: "center"
250
+ },
251
+ transformOrigin: {
252
+ vertical: "top",
253
+ horizontal: "center"
254
+ },
255
+ onClose: () => setOpen(false),
256
+ sx: {
257
+ mt: "10px"
258
+ },
259
+ children: /* @__PURE__ */ jsxs(RHFormProvider, {
260
+ onSubmit,
261
+ values: initialValues,
262
+ validationSchema,
263
+ children: [/* @__PURE__ */ jsxs(EditAreaHeader, {
264
+ children: [/* @__PURE__ */ jsx(Typography, {
265
+ children: getLabel(getAreasDictionary(DICCTIONARY.label_edit_area))
266
+ }), /* @__PURE__ */ jsx(IconButton, {
267
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.CLOSE}`,
268
+ size: "small",
269
+ onClick: () => setOpen(false)
270
+ })]
271
+ }), /* @__PURE__ */ jsx(RHFTextField, {
272
+ name: "inputEditArea",
273
+ skeletonWidth: "70%",
274
+ skeletonHeight: "18px",
275
+ sx: {
276
+ mt: "20px"
277
+ }
278
+ }), /* @__PURE__ */ jsxs(Actions, {
279
+ children: [/* @__PURE__ */ jsx(ActionCancel, {
280
+ onClick: () => setOpen(false),
281
+ variant: "outlined",
282
+ skeletonWidth: "100%"
283
+ }), /* @__PURE__ */ jsx(ActionIntro, {
284
+ skeletonWidth: "100%"
285
+ })]
286
+ })]
287
+ })
175
288
  })]
176
289
  });
177
290
  };
@@ -185,12 +298,6 @@ const AreasAdminRoot = styled("div")`
185
298
  display: flex;
186
299
  }
187
300
 
188
- & .${areasAdminClasses.areaChipRoot}.${areasAdminClasses.selected}::before {
189
- content: "";
190
- background-color: ${(props) => props.theme.palette.primary.main};
191
- height: 100%;
192
- width: 8px;
193
- }
194
301
 
195
302
  ${(props) => props.theme.components?.M4LAreasAdmin?.styleOverrides}
196
303
 
@@ -198,17 +305,18 @@ const AreasAdminRoot = styled("div")`
198
305
  `;
199
306
  function AreasAdmin() {
200
307
  const areas = useAreasStore((state) => state.areas, shallow);
201
- const currentArea = useAreasStore((state) => state.currentArea, shallow);
308
+ const currentArea = useAreasStore((state) => state.currentAreaId, shallow);
202
309
  const status = useAreasStore((state) => state.ownerState.status);
203
310
  const classesRoot = useAreasStore((state) => state.adminClasses.root);
311
+ const areasLength = useAreasStore((state) => state.areas.length);
204
312
  const {
205
313
  addArea
206
- } = useAreasStore((state) => state.actions, shallow);
314
+ } = useAreasStore((state) => state.areasActions, shallow);
207
315
  const {
208
316
  host_static_assets,
209
317
  environment_assets
210
318
  } = useEnvironment();
211
- console.log("Render AreasAdmin", status, areas);
319
+ console.log("Render AreasAdmin", areas);
212
320
  if (status !== "loaded") {
213
321
  return null;
214
322
  }
@@ -221,11 +329,16 @@ function AreasAdmin() {
221
329
  })
222
330
  }), /* @__PURE__ */ jsx("div", {
223
331
  className: areasAdminClasses.areaContainerChips,
224
- children: areas.map((area) => /* @__PURE__ */ jsx(AreaChip, {
225
- areaId: area.id,
226
- selected: area.id === currentArea,
227
- areaName: area.name
228
- }, area.id))
332
+ children: /* @__PURE__ */ jsx(ScrollBar, {
333
+ children: /* @__PURE__ */ jsx(Fragment, {
334
+ children: areas.map((area) => /* @__PURE__ */ jsx(AreaChip, {
335
+ areaId: area.id,
336
+ selected: area.id === currentArea,
337
+ areaName: area.name,
338
+ disabled: areasLength === 1
339
+ }, area.id))
340
+ })
341
+ })
229
342
  }), /* @__PURE__ */ jsx(IconButton, {
230
343
  className: areasAdminClasses.areasAddButton,
231
344
  src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.ADD_AREA}`,
@@ -235,15 +348,12 @@ function AreasAdmin() {
235
348
  });
236
349
  }
237
350
  const AreasViewerRoot = styled("div")`
238
-
239
351
  /* display: flex; */
240
352
  width: 100%;
241
353
  height: 100%;
242
354
  overflow: hidden;
243
355
  /* flex-grow: 1; */
244
356
  position: relative;
245
-
246
-
247
357
 
248
358
  //areaRoot
249
359
  & .${areasViewerClasses.areaRoot} {
@@ -266,7 +376,6 @@ const AreasViewerRoot = styled("div")`
266
376
  }
267
377
 
268
378
  &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaRoot} {
269
-
270
379
  }
271
380
 
272
381
  // areaGridLayoutPanelContainer
@@ -282,7 +391,7 @@ const AreasViewerRoot = styled("div")`
282
391
  }
283
392
  // areaGridLayout
284
393
  & .${areasViewerClasses.areaGridLayout} {
285
- height: 100%!important;
394
+ height: 100% !important;
286
395
  overflow: auto;
287
396
  flex-grow: 1;
288
397
  }
@@ -308,9 +417,6 @@ const AreasViewerRoot = styled("div")`
308
417
  &.${areasViewerClasses.isMobile} .${areasViewerClasses.panelWindowsRoot} {
309
418
  flex-direction: row;
310
419
  }
311
- & .${areasViewerClasses.panelWindowsButtonContainer}.${areasViewerClasses.selected} {
312
- border: 1px solid red;
313
- }
314
420
 
315
421
  // windowRoot
316
422
  & .${areasViewerClasses.windowRoot} {
@@ -342,7 +448,7 @@ const AreasViewerRoot = styled("div")`
342
448
  justify-content: end;
343
449
  min-height: ${(props) => props.theme.spacing(5)} ;
344
450
 
345
- border-bottom: 1px solid ${(props) => props.theme.palette.divider},
451
+ border-bottom: 1px solid ${(props) => props.theme.palette.divider};
346
452
  overflow: hidden;
347
453
  cursor: move;
348
454
  height: 60px;
@@ -379,10 +485,10 @@ const AreasViewerRoot = styled("div")`
379
485
  }
380
486
 
381
487
  // windowModalRoot
382
- & .${areasViewerClasses.windowModalRoot} .${areasViewerClasses.windowRoot}{
488
+ & .${areasViewerClasses.windowModalRoot} {
383
489
  padding: 16px;
384
490
  }
385
-
491
+
386
492
  .react-grid-layout {
387
493
  position: relative;
388
494
  transition: height 200ms ease;
@@ -393,7 +499,7 @@ const AreasViewerRoot = styled("div")`
393
499
  }
394
500
  .react-grid-item img {
395
501
  pointer-events: none;
396
- user-select: none;
502
+ user-select: none;
397
503
  }
398
504
  .react-grid-item.cssTransforms {
399
505
  transition-property: transform;
@@ -432,7 +538,7 @@ const AreasViewerRoot = styled("div")`
432
538
  }
433
539
 
434
540
  .react-grid-item > .react-resizable-handle::after {
435
- content: "";
541
+ content: '';
436
542
  position: absolute;
437
543
  right: 3px;
438
544
  bottom: 3px;
@@ -498,747 +604,10 @@ const AreasViewerRoot = styled("div")`
498
604
  transform: rotate(45deg);
499
605
  }
500
606
 
501
-
502
607
  ${react_resizable_css}
503
608
 
504
-
505
609
  ${(props) => props.theme.components?.M4LAreasViewer?.styleOverrides}
506
-
507
-
508
610
  `;
509
- const ROW_HEIGTH_GRIDLAYOUT = 100;
510
- const CONTAINER_PADDING_GRIDLAYOUT = 3;
511
- const DEBOUCED_SAVE_TIME = 500;
512
- const COOKIE_BREAKPOINT_LAYOUTS = "layoutPros";
513
- const COOKIE_WINDOWS = "windows";
514
- const NORMALIZED_BREAKPOINTS = { lg: 1200, md: 996, sm: 768, xs: 480, xxs: 0 };
515
- const NORMALIZED_COLS = { lg: 24, md: 20, sm: 12, xs: 8, xxs: 2 };
516
- const MAXIMIZED_COLS = { lg: 24, md: 20, sm: 12, xs: 8, xxs: 2 };
517
- const getParmsFromValue = (key, data) => {
518
- try {
519
- if (Array.isArray(data)) {
520
- let ob = data.find((f) => f.id === key);
521
- if (ob) {
522
- ob = JSON.parse(ob.value);
523
- }
524
- return ob;
525
- }
526
- } catch (error) {
527
- }
528
- return void 0;
529
- };
530
- function setAddBreakPoints(state, newLayout) {
531
- const layoutsBreakPoints = state.breakpointsLayouts;
532
- const beforeMaximizebreakpointsLayouts = state.beforeMaximizebreakpointsLayouts;
533
- for (const key in layoutsBreakPoints) {
534
- const layoutBreakpoint = layoutsBreakPoints[key];
535
- layoutBreakpoint.push(newLayout);
536
- }
537
- if (state.viewMode === "single") {
538
- for (const key in beforeMaximizebreakpointsLayouts) {
539
- const beforeLayoutBreakpoint = beforeMaximizebreakpointsLayouts[key];
540
- beforeLayoutBreakpoint.push(newLayout);
541
- }
542
- }
543
- return layoutsBreakPoints;
544
- }
545
- function setBreakPointsMaximized(state, layoutId) {
546
- const layoutsBreakPoints = state.breakpointsLayouts;
547
- const container = document.getElementsByClassName(`${areasViewerClasses.areaRoot}`)[0];
548
- console.log(`Setting breakpoints`, container);
549
- if (container) {
550
- const clientHeight = container.clientHeight;
551
- for (const key in layoutsBreakPoints) {
552
- const layoutBreakpoint = layoutsBreakPoints[key];
553
- const cols = key in MAXIMIZED_COLS ? MAXIMIZED_COLS[key] : 1;
554
- const heigth_by_rowheigth = clientHeight / (ROW_HEIGTH_GRIDLAYOUT + 2 * CONTAINER_PADDING_GRIDLAYOUT);
555
- for (let index = 0; index < layoutBreakpoint.length; index++) {
556
- const l = layoutBreakpoint[index];
557
- if (l.i === layoutId) {
558
- l.x = 0;
559
- l.y = 0;
560
- l.h = heigth_by_rowheigth;
561
- l.w = cols;
562
- l.minW = 0;
563
- l.maxW = cols;
564
- l.minH = 0;
565
- l.maxH = heigth_by_rowheigth;
566
- l.isResizable = false;
567
- l.isDraggable = false;
568
- } else {
569
- l.x = 0;
570
- l.y = 1;
571
- l.h = 0;
572
- l.w = 0;
573
- l.minW = 0;
574
- l.maxW = 0;
575
- l.minH = 0;
576
- l.maxH = 0;
577
- }
578
- l.isResizable = false;
579
- l.isDraggable = false;
580
- }
581
- }
582
- }
583
- return layoutsBreakPoints;
584
- }
585
- function getDataFromResponse(data, state) {
586
- const newBreakPointsLayouts = getParmsFromValue(COOKIE_BREAKPOINT_LAYOUTS, data);
587
- const windows = getParmsFromValue(COOKIE_WINDOWS, data);
588
- const newGridLayouts = [];
589
- const newHashWindowLayouts = {};
590
- if (windows) {
591
- for (const key in windows) {
592
- const element = windows[key];
593
- if (element && element["layoutProps"] && element["mfProps"] && element["emergeType"] === "layout" && element["winType"] === "microfrontend") {
594
- element["layoutProps"].i = key;
595
- newGridLayouts.push(element["layoutProps"]);
596
- newHashWindowLayouts[key] = {
597
- ...element,
598
- windowId: key,
599
- emergeType: "layout",
600
- onClose: state.actions.closeWindowLayout
601
- };
602
- }
603
- }
604
- }
605
- return {
606
- newBreakPointsLayouts,
607
- newGridLayouts,
608
- newHashWindowLayouts
609
- };
610
- }
611
- const createAreaStore = (initProps) => {
612
- const startProps = {
613
- zPopUpIndex: 999,
614
- status: "init",
615
- breakpointsLayouts: {},
616
- beforeMaximizebreakpointsLayouts: {},
617
- gridLayouts: [],
618
- windowModal: null,
619
- windowsPopUps: [],
620
- hashWindowsPopups: {},
621
- hashWindowsLayouts: {},
622
- currentLayoutId: "",
623
- currentPopUpId: "",
624
- viewMode: initProps.isDesktop ? "multiple" : "single",
625
- breakpoints: NORMALIZED_BREAKPOINTS,
626
- cols: NORMALIZED_COLS,
627
- ...initProps
628
- };
629
- return createStore(
630
- devtools(
631
- immer((set, get) => ({
632
- ...startProps,
633
- actions: {
634
- addWindow: (newWindowProps) => {
635
- const windowId = `${get().id}_window_${new Date().getTime()}_${(Math.random() * 1e3).toFixed(0)}`;
636
- console.log("addWindow", newWindowProps.emergeType);
637
- if (newWindowProps.emergeType === "layout") {
638
- get().actions.addWindowLayout(windowId, newWindowProps);
639
- } else if (newWindowProps.emergeType === "popup") {
640
- get().actions.addWindowPopUp(windowId, newWindowProps);
641
- } else if (newWindowProps.emergeType === "modal") {
642
- get().actions.addWindowModal(windowId, newWindowProps);
643
- }
644
- },
645
- closeWindowModal: () => {
646
- set((state) => {
647
- state.windowModal = void 0;
648
- });
649
- },
650
- addWindowModal: (container_id, newWindowModalProps) => {
651
- set((state) => {
652
- state.windowModal = { ...newWindowModalProps, windowId: container_id };
653
- });
654
- },
655
- closeWindowPopUp: (removePopUpId) => {
656
- set((state) => {
657
- const removeIndex = state.windowsPopUps.findIndex(
658
- (wpId) => wpId === removePopUpId
659
- );
660
- if (removeIndex > -1) {
661
- state.windowsPopUps.splice(removeIndex, 1);
662
- }
663
- delete state.hashWindowsPopups[removePopUpId];
664
- });
665
- },
666
- addWindowPopUp: (windowId, newWindowPopupProps) => {
667
- let popUpId = windowId;
668
- set((state) => {
669
- if (newWindowPopupProps.replaceMeId) {
670
- for (const key in state.hashWindowsPopups) {
671
- const WindoPopUp = state.hashWindowsPopups[key];
672
- if (WindoPopUp.replaceMeId === newWindowPopupProps.replaceMeId) {
673
- popUpId = key;
674
- state.hashWindowsPopups[key].dynamicParams = newWindowPopupProps.dynamicParams;
675
- break;
676
- }
677
- }
678
- }
679
- if (popUpId === windowId) {
680
- state.windowsPopUps.push(windowId);
681
- state.hashWindowsPopups[windowId] = {
682
- ...newWindowPopupProps,
683
- emergeType: "popup",
684
- windowId,
685
- onClose: get().actions.closeWindowPopUp,
686
- zIndex: state.zPopUpIndex
687
- };
688
- state.currentPopUpId = windowId;
689
- }
690
- });
691
- get().actions.selectWindowPopUp(popUpId);
692
- },
693
- closeWindowLayout: (removeLayoutId) => {
694
- set((state) => {
695
- const removeIndex = state.gridLayouts.findIndex(
696
- (gl) => gl.i === removeLayoutId
697
- );
698
- if (removeIndex > -1) {
699
- state.gridLayouts.splice(removeIndex, 1);
700
- }
701
- delete state.hashWindowsLayouts[removeLayoutId];
702
- });
703
- get().actions.saveLayouts();
704
- if (get().singleId === removeLayoutId) {
705
- get().actions.maximizeLayout();
706
- }
707
- },
708
- addWindowLayout: (windowId, newWindow) => {
709
- const newLayout = {
710
- ...newWindow.layoutProps,
711
- i: windowId,
712
- isDraggable: true,
713
- isResizable: true,
714
- winType: newWindow.winType
715
- };
716
- set((state) => {
717
- state.gridLayouts.push(newLayout);
718
- state.hashWindowsLayouts[windowId] = {
719
- ...newWindow,
720
- windowId,
721
- emergeType: "layout",
722
- onClose: get().actions.closeWindowLayout
723
- };
724
- setAddBreakPoints(state, newLayout);
725
- });
726
- get().actions.selectWindowLayout(windowId);
727
- if (get().viewMode === "single") {
728
- get().actions.maximizeLayout(windowId);
729
- }
730
- get().actions.saveLayouts();
731
- get().actions.bouncedSaveBreakpointsLayouts();
732
- },
733
- saveLayouts: () => {
734
- let nrKeys = 0;
735
- const saveObjetc = {};
736
- for (const key in get().hashWindowsLayouts) {
737
- const element = get().hashWindowsLayouts[key];
738
- if (element.winType === "microfrontend") {
739
- const newElement = { ...element };
740
- delete newElement.onClose;
741
- delete newElement.devCookies;
742
- saveObjetc[key] = newElement;
743
- nrKeys++;
744
- }
745
- }
746
- if (nrKeys > 0) {
747
- get().networkOperation({
748
- method: "PUT",
749
- endPoint: `cookies/${get().id}/${COOKIE_WINDOWS}`,
750
- data: {
751
- value: JSON.stringify(saveObjetc)
752
- },
753
- toastSuccess: false,
754
- toastError: false
755
- });
756
- } else {
757
- get().networkOperation({
758
- method: "DELETE",
759
- endPoint: `cookies`,
760
- data: { f: [{ n: "container_id", o: "c", o1: get().id }] },
761
- toastSuccess: false,
762
- toastError: false
763
- });
764
- }
765
- },
766
- bouncedSaveBreakpointsLayouts: debounce(
767
- () => {
768
- const purgedLayouts = {
769
- ...get().viewMode === "multiple" ? get().breakpointsLayouts : get().beforeMaximizebreakpointsLayouts
770
- };
771
- const finalLayouts = {};
772
- for (const key in purgedLayouts) {
773
- const element = purgedLayouts[key];
774
- purgedLayouts[key] = element.filter((l) => {
775
- if (l.i === "none") {
776
- return false;
777
- }
778
- if (get().hashWindowsLayouts[l.i]) {
779
- return true;
780
- }
781
- return false;
782
- });
783
- if (purgedLayouts[key].length > 0) {
784
- finalLayouts[key] = purgedLayouts[key];
785
- }
786
- }
787
- if (Object.keys(finalLayouts).length > 0) {
788
- get().networkOperation({
789
- method: "PUT",
790
- endPoint: `cookies/${get().id}/${COOKIE_BREAKPOINT_LAYOUTS}`,
791
- data: {
792
- value: JSON.stringify(finalLayouts)
793
- },
794
- toastSuccess: false,
795
- toastError: false
796
- });
797
- }
798
- },
799
- DEBOUCED_SAVE_TIME
800
- ),
801
- onBreakpointsLayoutsChange: (_currentLayouts, newAllLayouts) => {
802
- set((state) => {
803
- state.breakpointsLayouts = newAllLayouts;
804
- });
805
- if (!get().singleId) {
806
- get().actions.bouncedSaveBreakpointsLayouts();
807
- }
808
- },
809
- selectWindowLayout: (layoutId) => {
810
- set((state) => {
811
- state.currentLayoutId = layoutId;
812
- if (state.currentPopUpId !== "" && state.hashWindowsPopups[state.currentPopUpId]) {
813
- const windowPopup = state.hashWindowsPopups[state.currentPopUpId];
814
- if (windowPopup.parentLayoutId !== layoutId) {
815
- state.currentPopUpId = "";
816
- }
817
- }
818
- });
819
- },
820
- selectWindowPopUp: (popUpId) => {
821
- set((state) => {
822
- state.zPopUpIndex++;
823
- state.currentPopUpId = popUpId;
824
- state.zPopUpIndex++;
825
- state.currentPopUpId = popUpId;
826
- state.hashWindowsPopups[popUpId].zIndex = state.zPopUpIndex;
827
- if (state.hashWindowsPopups[popUpId].parentLayoutId && state.hashWindowsPopups[popUpId].parentLayoutId !== "") {
828
- state.currentLayoutId = state.hashWindowsPopups[popUpId].parentLayoutId;
829
- } else {
830
- state.currentLayoutId = "";
831
- }
832
- });
833
- setTimeout(() => {
834
- const container = document.getElementsByClassName(
835
- `${areasViewerClasses.areaGridLayoutPanelContainer}-${get().id}`
836
- )[0];
837
- const element = document.getElementsByClassName(
838
- `${areasViewerClasses.windowPopupRoot}-${popUpId}`
839
- )[0];
840
- if (element && container) {
841
- const { top, left } = element.getBoundingClientRect();
842
- const { top: containerTop, left: containerLeft } = container.getBoundingClientRect();
843
- container.scrollTop = container.scrollTop + top - containerTop;
844
- container.scrollLeft = container.scrollLeft + left - containerLeft;
845
- }
846
- }, 100);
847
- },
848
- maximizeLayout: (layoutId) => {
849
- let finalLayoutId = layoutId;
850
- set((state) => {
851
- if (state.viewMode === "multiple") {
852
- state.beforeMaximizebreakpointsLayouts = cloneDeep(
853
- state.breakpointsLayouts
854
- );
855
- }
856
- if (!finalLayoutId) {
857
- if (state.gridLayouts.length > 0) {
858
- finalLayoutId = state.gridLayouts[0].i;
859
- }
860
- }
861
- state.viewMode = "single";
862
- state.singleId = finalLayoutId;
863
- setBreakPointsMaximized(state, finalLayoutId);
864
- });
865
- if (finalLayoutId) {
866
- get().actions.selectWindowLayout(finalLayoutId);
867
- }
868
- },
869
- normalizeLayouts: () => {
870
- set((state) => {
871
- if (!state.isDesktop)
872
- return;
873
- if (state.isDesktop && state.viewMode === "single") {
874
- state.viewMode = "multiple";
875
- state.singleId = void 0;
876
- state.breakpointsLayouts = state.beforeMaximizebreakpointsLayouts;
877
- }
878
- });
879
- }
880
- },
881
- internalActions: {
882
- loadFromApi: () => {
883
- if (get().status !== "init") {
884
- return;
885
- }
886
- if (!get().loadAreasFromNetwork || !get().loadWindows) {
887
- set((state) => {
888
- state.status = "loaded";
889
- });
890
- return;
891
- }
892
- get().networkOperation({
893
- method: "GET",
894
- endPoint: `cookies`,
895
- parms: { f: [{ n: "container_id", o: "e", o1: get().id }] },
896
- toastSuccess: false,
897
- toastError: false
898
- }).then((response) => {
899
- set((state) => {
900
- const {
901
- newBreakPointsLayouts,
902
- newGridLayouts,
903
- newHashWindowLayouts
904
- } = getDataFromResponse(response.data, state);
905
- if (state.viewMode === "multiple") {
906
- state.breakpointsLayouts = newBreakPointsLayouts;
907
- } else {
908
- state.breakpointsLayouts = newBreakPointsLayouts;
909
- state.beforeMaximizebreakpointsLayouts = newBreakPointsLayouts;
910
- }
911
- state.gridLayouts = newGridLayouts;
912
- state.hashWindowsLayouts = newHashWindowLayouts;
913
- state.status = "loaded";
914
- });
915
- console.log("loadFromApi", get().viewMode);
916
- if (get().viewMode === "single") {
917
- get().actions.maximizeLayout();
918
- }
919
- }).catch((_response) => {
920
- set((state) => {
921
- state.status = "loaded";
922
- });
923
- });
924
- },
925
- changeDesktopBreakpoint: (isDesktop) => {
926
- const previousState = get().isDesktop;
927
- set((state) => {
928
- state.isDesktop = isDesktop;
929
- });
930
- if (previousState != isDesktop) {
931
- if (isDesktop) {
932
- get().actions.normalizeLayouts();
933
- } else {
934
- if (get().viewMode === "multiple") {
935
- if (get().gridLayouts.length > 0) {
936
- get().actions.maximizeLayout(get().gridLayouts[0].i);
937
- }
938
- }
939
- }
940
- }
941
- }
942
- }
943
- })),
944
- { name: `Area state ${initProps.id}` }
945
- )
946
- );
947
- };
948
- const AreaContext = createContext(null);
949
- const AreaProvider = (props) => {
950
- const {
951
- children,
952
- id,
953
- selected: active,
954
- loadWindows = true
955
- } = props;
956
- const [loadAreasFromNetwork, loadCookiesFromNetwork] = useAreasStore((state) => [state.loadAreasFromNetwork, state.loadCookiesFromNetwork], shallow);
957
- const {
958
- setAreaLink
959
- } = useAreasStore((state) => state.internalActions);
960
- const isDesktop = useResponsiveDesktop();
961
- const isFirstRender = useFirstRender([isDesktop]);
962
- const {
963
- networkOperation
964
- } = useNetwork();
965
- const areaStoreRef = useRef();
966
- if (!areaStoreRef.current) {
967
- areaStoreRef.current = createAreaStore({
968
- id,
969
- networkOperation,
970
- loadAreasFromNetwork,
971
- loadCookiesFromNetwork,
972
- loadWindows,
973
- isDesktop: !!isDesktop
974
- });
975
- }
976
- const {
977
- loadFromApi,
978
- changeDesktopBreakpoint
979
- } = useStore(areaStoreRef.current, (state) => state.internalActions, shallow);
980
- const status = useStore(areaStoreRef.current, (state) => state.status, shallow);
981
- useEffect(() => {
982
- if (!isFirstRender) {
983
- changeDesktopBreakpoint(!!isDesktop);
984
- }
985
- }, [isDesktop]);
986
- useEffect(() => {
987
- if (areaStoreRef.current) {
988
- setAreaLink(id, areaStoreRef.current);
989
- }
990
- return () => {
991
- };
992
- }, []);
993
- useEffect(() => {
994
- if (active && status === "init") {
995
- loadFromApi();
996
- }
997
- }, [active]);
998
- return /* @__PURE__ */ jsx(AreaContext.Provider, {
999
- value: areaStoreRef.current,
1000
- children
1001
- });
1002
- };
1003
- if (process.env.NODE_ENV !== "production") {
1004
- AreaProvider.displayName = "AreaProvider";
1005
- }
1006
- React__default.memo(AreaProvider);
1007
- const WindowToolsMFContext = createContext(null);
1008
- function WindowToolsMFProvider(props) {
1009
- const {
1010
- children,
1011
- ...other
1012
- } = props;
1013
- return /* @__PURE__ */ jsx(WindowToolsMFContext.Provider, {
1014
- value: {
1015
- ...other
1016
- },
1017
- children
1018
- });
1019
- }
1020
- React__default.memo(WindowToolsMFProvider);
1021
- const DynamicMFParmsContext = createContext(null);
1022
- function DynamicMFParmsProvider(props) {
1023
- const {
1024
- children,
1025
- store
1026
- } = props;
1027
- return /* @__PURE__ */ jsx(DynamicMFParmsContext.Provider, {
1028
- value: store,
1029
- children
1030
- });
1031
- }
1032
- const MemonizedDynamicMFParmsProvider = React__default.memo(DynamicMFParmsProvider);
1033
- const createDynamicMFStore = (initProps) => {
1034
- const startProps = {
1035
- ...initProps
1036
- };
1037
- return createStore(
1038
- devtools(
1039
- immer((set, _get) => ({
1040
- ...startProps,
1041
- actions: {
1042
- changeData: (newDynamicMFState) => {
1043
- set((state) => {
1044
- state.dynamicMFParameters = newDynamicMFState;
1045
- });
1046
- }
1047
- }
1048
- })),
1049
- { name: `dyamic store ${initProps.windowId}` }
1050
- )
1051
- );
1052
- };
1053
- function getCookiesContainer(data, containerId) {
1054
- const cookies = {};
1055
- try {
1056
- if (Array.isArray(data)) {
1057
- for (let i = 0; i < data.length; i++) {
1058
- if (data[i]?.container_id === containerId && data[i]?.id) {
1059
- cookies[data[i]?.id] = JSON.parse(data[i].value);
1060
- }
1061
- }
1062
- }
1063
- } catch (error) {
1064
- }
1065
- return cookies;
1066
- }
1067
- const createWindowStore = (initProps) => {
1068
- const startProps = {
1069
- status: "init",
1070
- moduleActions: [],
1071
- cookies: initProps.devCookies || { moduleCookies: {}, windowCookies: {} },
1072
- ...initProps
1073
- };
1074
- delete startProps.devCookies;
1075
- return createStore(
1076
- devtools(
1077
- immer((set, get, _api) => ({
1078
- ...startProps,
1079
- actions: {
1080
- setActions: (newActions, version) => {
1081
- set((state) => {
1082
- state.moduleActions = cloneDeep(newActions);
1083
- state.version = version;
1084
- console.log("LLEGO Version", version);
1085
- });
1086
- },
1087
- close: () => {
1088
- const onClose = get().onClose;
1089
- if (onClose) {
1090
- onClose(get().windowId);
1091
- }
1092
- },
1093
- getWindowId: () => {
1094
- return get().windowId;
1095
- },
1096
- getCookie: (id) => {
1097
- return get().cookies.windowCookies[id] || get().cookies.moduleCookies[id];
1098
- },
1099
- getCookies: (type) => {
1100
- if (type === "window") {
1101
- return get().cookies.windowCookies;
1102
- } else {
1103
- return get().cookies.moduleCookies;
1104
- }
1105
- },
1106
- setCookie: (id, type, cookie) => {
1107
- get().networkOperation({
1108
- method: "PUT",
1109
- endPoint: `cookies/${type === "module" ? get().moduleId : get().windowId}/${id}`,
1110
- data: {
1111
- value: JSON.stringify(cookie)
1112
- },
1113
- toastSuccess: false,
1114
- toastError: false
1115
- });
1116
- set((state) => {
1117
- if (type === "window") {
1118
- state.cookies.windowCookies[id] = cookie;
1119
- } else {
1120
- state.cookies.moduleCookies[id] = cookie;
1121
- }
1122
- });
1123
- }
1124
- },
1125
- internalActions: {
1126
- loadCookiesFromApi: () => {
1127
- if (get().status === "init") {
1128
- get().networkOperation({
1129
- method: "GET",
1130
- endPoint: `cookies`,
1131
- parms: {
1132
- f: [
1133
- { n: "container_id", o: "e", o1: get().windowId },
1134
- { n: "container_id", o: "e", o1: get().moduleId }
1135
- ]
1136
- },
1137
- toastSuccess: false,
1138
- toastError: false
1139
- }).then((response) => {
1140
- set((state) => {
1141
- state.cookies.moduleCookies = getCookiesContainer(
1142
- response.data,
1143
- state.moduleId
1144
- );
1145
- state.cookies.windowCookies = getCookiesContainer(
1146
- response.data,
1147
- state.windowId
1148
- );
1149
- state.status = "loaded";
1150
- });
1151
- }).catch((_response) => {
1152
- set((state) => {
1153
- state.status = "loaded";
1154
- });
1155
- });
1156
- }
1157
- },
1158
- saveModuleCookies: () => {
1159
- for (const key in get().cookies.windowCookies) {
1160
- const cookie = get().cookies.windowCookies[key];
1161
- get().networkOperation({
1162
- method: "PUT",
1163
- endPoint: `cookies/${get().moduleId}/${key}`,
1164
- data: {
1165
- value: JSON.stringify(cookie)
1166
- },
1167
- toastSuccess: false,
1168
- toastError: false
1169
- });
1170
- }
1171
- }
1172
- }
1173
- })),
1174
- {
1175
- name: `window store ${initProps.windowId}`,
1176
- store: `window dev store ${initProps.windowId}`,
1177
- trace: true
1178
- }
1179
- )
1180
- );
1181
- };
1182
- const WindowContext = createContext(null);
1183
- function WindowMFProvider(props) {
1184
- const {
1185
- children,
1186
- ...other
1187
- } = props;
1188
- const {
1189
- networkOperation
1190
- } = useNetwork();
1191
- const windowStoreRef = useRef();
1192
- const dynamicMFStoreRef = useRef();
1193
- const areaStore = useArea();
1194
- const areasStore = useAreas();
1195
- if (!dynamicMFStoreRef.current) {
1196
- dynamicMFStoreRef.current = createDynamicMFStore({
1197
- dynamicMFParameters: props.dynamicParams,
1198
- windowId: props.windowId
1199
- });
1200
- }
1201
- if (!windowStoreRef.current) {
1202
- windowStoreRef.current = createWindowStore({
1203
- ...other,
1204
- dynamicMFStore: dynamicMFStoreRef.current,
1205
- networkOperation,
1206
- areaStore,
1207
- areasStore
1208
- });
1209
- }
1210
- useEffect(() => {
1211
- windowStoreRef.current?.getState().internalActions.loadCookiesFromApi();
1212
- return () => {
1213
- console.debug("useEffect cleanUP WindowMFProvider", props.windowId, windowStoreRef.current);
1214
- };
1215
- }, []);
1216
- useEffect(() => {
1217
- if (windowStoreRef.current?.getState().status === "loaded") {
1218
- dynamicMFStoreRef.current?.getState().actions.changeData(props.dynamicParams);
1219
- }
1220
- }, [props.dynamicParams]);
1221
- return /* @__PURE__ */ jsx(WindowContext.Provider, {
1222
- value: windowStoreRef.current,
1223
- children
1224
- });
1225
- }
1226
- const Component = (props) => {
1227
- const {
1228
- component
1229
- } = props;
1230
- const store = useWindow();
1231
- const dynamicMFStore = useWindowStore((state) => state.dynamicMFStore);
1232
- const actions = useWindowStore((state) => state.actions, shallow);
1233
- return /* @__PURE__ */ jsx(WindowToolsMFProvider, {
1234
- ...actions,
1235
- children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, {
1236
- store: dynamicMFStore,
1237
- children: typeof component === "function" ? component(store) : component
1238
- })
1239
- });
1240
- };
1241
- React__default.memo(Component);
1242
611
  styled("div")(({
1243
612
  theme
1244
613
  }) => ({
@@ -1429,24 +798,32 @@ function getMainActions(isDesktop, moduleActions) {
1429
798
  );
1430
799
  return mainActions;
1431
800
  }
1432
- function getMenuActions(isDesktop, moduleActions, urlPrefix, saveModuleCookies, version) {
801
+ function getMenuActions(windowId, isDesktop, moduleActions, urlPrefix, saveModuleCookies, resetModuleCookies, version) {
1433
802
  let menuActions = [...moduleActions.filter((action) => action.visibility !== "allways")];
1434
803
  if (isDesktop !== void 0 && isDesktop) {
1435
804
  menuActions = menuActions.filter((action) => action.visibility === "normal");
1436
805
  }
1437
- console.log("getMenuActions", version);
1438
- const savePropsAction = {
1439
- urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/split_vertical.svg`,
1440
- onClick: () => saveModuleCookies,
806
+ const saveCookiesAction = {
807
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.SAVE_COOKIES}`,
808
+ onClick: () => saveModuleCookies(windowId),
1441
809
  disabled: false,
1442
810
  visibility: "normal",
1443
811
  dictionaryId: getAreasDictionary("label_persist_module_cookies"),
1444
- key: "save_props"
812
+ key: "save_cookies"
1445
813
  };
1446
- menuActions.push(savePropsAction);
814
+ menuActions.push(saveCookiesAction);
815
+ const resetCookiesAction = {
816
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.RESET_COOKIES}`,
817
+ onClick: () => resetModuleCookies(windowId),
818
+ disabled: false,
819
+ visibility: "normal",
820
+ dictionaryId: getAreasDictionary("label_reset_module_cookies"),
821
+ key: "reset_cookes"
822
+ };
823
+ menuActions.push(resetCookiesAction);
1447
824
  if (version) {
1448
825
  const versionAction = {
1449
- urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/version.svg`,
826
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.VERSION}`,
1450
827
  onClick: () => {
1451
828
  },
1452
829
  disabled: true,
@@ -1458,8 +835,14 @@ function getMenuActions(isDesktop, moduleActions, urlPrefix, saveModuleCookies,
1458
835
  }
1459
836
  return menuActions;
1460
837
  }
1461
- function MainActions() {
1462
- const [moduleActions] = useWindowStore((state) => [state.moduleActions], shallow);
838
+ function MainActions(props) {
839
+ const {
840
+ windowId
841
+ } = props;
842
+ const moduleActions = useAreasStore((state) => {
843
+ const window2 = state.hashWindows[windowId];
844
+ return window2?.moduleActions || [];
845
+ }, shallow);
1463
846
  const {
1464
847
  getLabel
1465
848
  } = useModuleDictionary();
@@ -1482,17 +865,24 @@ function MainActions() {
1482
865
  })
1483
866
  });
1484
867
  }
1485
- function Header() {
1486
- 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);
868
+ function Header(props) {
1487
869
  const {
1488
- saveModuleCookies
1489
- } = useWindowStore((state) => state.internalActions);
1490
- const emergeType = useWindowStore((state) => state.emergeType);
1491
- const maximizedId = useAreaStore((state) => state.singleId);
870
+ areaId,
871
+ windowId,
872
+ emergeType
873
+ } = props;
874
+ const [url_icon, title, moduleActions, onClose, version, singleId] = useAreasStore((state) => {
875
+ const window2 = state.hashWindows[windowId];
876
+ return [window2.url_icon, window2.title, window2.moduleActions, window2.onClose, window2.version, state.hashAreas[areaId].singleId];
877
+ }, shallow);
878
+ const {
879
+ saveModuleCookies,
880
+ resetModuleCookies
881
+ } = useAreasStore((state) => state.windowActions, shallow);
1492
882
  const {
1493
883
  maximizeLayout,
1494
884
  normalizeLayouts
1495
- } = useAreaStore((state) => state.actions, shallow);
885
+ } = useAreasStore((state) => state.areaActions, shallow);
1496
886
  const {
1497
887
  host_static_assets,
1498
888
  environment_assets
@@ -1501,16 +891,16 @@ function Header() {
1501
891
  const isSkeleton = useModuleSkeleton();
1502
892
  const urlPrefix = `${host_static_assets}/${environment_assets}`;
1503
893
  const menuActions = useMemo(() => {
1504
- return getMenuActions(isDesktop, moduleActions, urlPrefix, saveModuleCookies, version);
894
+ return getMenuActions(windowId, isDesktop, moduleActions, urlPrefix, saveModuleCookies, resetModuleCookies, version);
1505
895
  }, [moduleActions, isDesktop]);
1506
896
  const onCloseLocal = () => {
1507
- onClose && onClose(container_id);
897
+ onClose && onClose(windowId);
1508
898
  };
1509
899
  const maxNormalize = () => {
1510
- if (maximizedId) {
1511
- normalizeLayouts();
900
+ if (singleId) {
901
+ normalizeLayouts(areaId);
1512
902
  } else {
1513
- maximizeLayout(container_id);
903
+ maximizeLayout(areaId, windowId);
1514
904
  }
1515
905
  };
1516
906
  if (isSkeleton) {
@@ -1525,10 +915,12 @@ function Header() {
1525
915
  className: areasViewerClasses.windowHeaderTitle,
1526
916
  variant: "h5",
1527
917
  children: `${title}`
1528
- }), /* @__PURE__ */ jsx(MainActions, {}), isDesktop && emergeType === "layout" && /* @__PURE__ */ jsx(IconButton, {
918
+ }), /* @__PURE__ */ jsx(MainActions, {
919
+ windowId
920
+ }), isDesktop && emergeType === "layout" && /* @__PURE__ */ jsx(IconButton, {
1529
921
  onClick: maxNormalize,
1530
922
  "aria-label": "click",
1531
- 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}`
923
+ src: singleId ? `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.NORMALIZE}` : `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.MAXIMIZE}`
1532
924
  }), menuActions.length > 0 && /* @__PURE__ */ jsx(MenuActions, {
1533
925
  arrowType: "no-arrow",
1534
926
  marginTop: "12px!important",
@@ -1551,7 +943,8 @@ function Header() {
1551
943
  }
1552
944
  const WrapperLinearProgress = styled$1("div")(() => ({
1553
945
  width: "70%",
1554
- margin: "auto auto"
946
+ margin: "auto auto",
947
+ position: "absolute"
1555
948
  }));
1556
949
  const WrapperFallBackNotFound = styled$1("div")(({
1557
950
  theme
@@ -1795,7 +1188,11 @@ function MFLoader(props) {
1795
1188
  }, [divScript]);
1796
1189
  return /* @__PURE__ */ jsxs(Fragment, {
1797
1190
  children: [/* @__PURE__ */ jsx("div", {
1798
- id: divScript.divContainerId
1191
+ id: divScript.divContainerId,
1192
+ style: {
1193
+ width: "100%",
1194
+ height: "100%"
1195
+ }
1799
1196
  }), isLoading ? /* @__PURE__ */ jsx(LoadingMF, {
1800
1197
  loadingProgress: networkProgress,
1801
1198
  setNetworkRefresh
@@ -1807,84 +1204,199 @@ MFLoader.defaultProps = {
1807
1204
  window
1808
1205
  };
1809
1206
  const MicroFrontend = (props) => {
1810
- const dynamicMFStore = useWindowStore((state) => state.dynamicMFStore, shallow);
1811
- const moduleId = useWindowStore((state) => state.moduleId, shallow);
1812
- const actions = useWindowStore((state) => state.actions, shallow);
1813
1207
  return /* @__PURE__ */ jsx(MFLoader, {
1814
- ...props,
1815
- moduleId,
1816
- dynamicMFStore,
1817
- windowTools: {
1818
- ...actions
1819
- }
1208
+ ...props
1820
1209
  });
1821
1210
  };
1822
- React__default.memo(MicroFrontend);
1823
- const InnerForHooks$1 = (props) => {
1211
+ const MemonizedMicroFrontend = React__default.memo(MicroFrontend);
1212
+ const Component = (props) => {
1824
1213
  const {
1825
- winType
1214
+ component,
1215
+ dynamicMFStore,
1216
+ windowTools
1826
1217
  } = props;
1827
- const status = useWindowStore((state) => state.status);
1828
- if (status !== "loaded") {
1829
- return null;
1830
- }
1831
- return /* @__PURE__ */ jsxs(Fragment, {
1832
- children: [/* @__PURE__ */ jsx(Header, {}), /* @__PURE__ */ jsx("div", {
1833
- className: areasViewerClasses.windowContent,
1834
- children: winType === "microfrontend" ? /* @__PURE__ */ jsx(MicroFrontend, {
1835
- ...props.mfProps
1836
- }) : /* @__PURE__ */ jsx(Component, {
1837
- component: props.component
1838
- })
1839
- })]
1218
+ return /* @__PURE__ */ jsx(WindowToolsMFProvider, {
1219
+ ...windowTools,
1220
+ children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, {
1221
+ store: dynamicMFStore,
1222
+ children: typeof component === "function" ? component() : component
1223
+ })
1840
1224
  });
1841
1225
  };
1842
- React__default.memo(InnerForHooks$1);
1226
+ React__default.memo(Component);
1227
+ const WindowRoot = styled("div")`
1228
+
1229
+ inset:0;
1230
+ position: absolute;
1231
+ display: flex;
1232
+ flex-direction: column;
1233
+ /* height: 100%; */
1234
+ /* width: 100%; */
1235
+ overflow: hidden;
1236
+ border: 1px solid gray;
1237
+
1238
+ background-color: ${(props) => props.theme.palette.background.default};
1239
+ padding: ${(props) => props.theme.spacing(0)};
1240
+ &.${areasViewerClasses.selected} {
1241
+ border-top: 1px solid green;
1242
+ }
1243
+ &.${areasViewerClasses.loading} {
1244
+ border-left: 2px solid red;
1245
+ }
1246
+ // windowHeader
1247
+ & .${areasViewerClasses.windowHeader} {
1248
+ display: flex;
1249
+ gap: 4px;
1250
+
1251
+ align-items: center;
1252
+ position: relative;
1253
+
1254
+ padding: 8px;
1255
+ justify-content: end;
1256
+ min-height: ${(props) => props.theme.spacing(5)} ;
1257
+
1258
+ border-bottom: 1px solid ${(props) => props.theme.palette.divider},
1259
+ overflow: hidden;
1260
+ cursor: move;
1261
+ height: 60px;
1262
+
1263
+
1264
+
1265
+ > span: {
1266
+ margin-right: 12px;
1267
+ }
1268
+ }
1269
+ // windowHeaderTitle
1270
+ & .${areasViewerClasses.windowHeaderTitle} {
1271
+ width: 100%;
1272
+ max-width: 100%;
1273
+ overflow: hidden;
1274
+ white-space: nowrap;
1275
+ color: ${(props) => props.theme.palette.text.primary};
1276
+ margin-left: 12px;
1277
+ margin-right: 24px;
1278
+ text-overflow: ellipsis;
1279
+ }
1280
+ // windowHeaderMainActions
1281
+ & .${areasViewerClasses.windowHeaderMainActions} {
1282
+ display: flex;
1283
+
1284
+ gap: 4px;
1285
+ }
1286
+
1287
+
1288
+ // windowHeaderMainActions
1289
+ & .${areasViewerClasses.windowContent} {
1290
+ flex-grow: 1;
1291
+ position: relative;
1292
+ }
1293
+
1294
+ // windowModalRoot
1295
+ & .${areasViewerClasses.windowModalRoot} {
1296
+ padding: 16px;
1297
+ }
1298
+
1299
+ ${(props) => props.theme.components?.M4LAreasViewerWindow?.styleOverrides}
1300
+
1301
+
1302
+ `;
1843
1303
  const Window = (props) => {
1844
1304
  const {
1845
- emergeType
1305
+ emergeType,
1306
+ windowId,
1307
+ moduleId,
1308
+ areaId
1846
1309
  } = props;
1847
- const selected = useAreaStore((state) => emergeType === "layout" ? state.currentLayoutId : state.currentPopUpId) === props.windowId;
1310
+ const selected = useAreasStore((state) => emergeType === "layout" ? state.hashAreas[areaId].currentLayoutId : state.hashAreas[areaId].currentPopUpId) === windowId;
1311
+ const wd = useAreasStore((state) => state.hashWindows[windowId], shallow);
1312
+ const {
1313
+ setActions,
1314
+ getCookie,
1315
+ getCookies,
1316
+ setCookie,
1317
+ close,
1318
+ setLoading
1319
+ } = useAreasStore((state) => state.windowActions, shallow);
1848
1320
  const {
1849
1321
  selectWindowPopUp,
1850
1322
  selectWindowLayout
1851
- } = useAreaStore((state) => state.actions);
1323
+ } = useAreasStore((state) => state.areaActions);
1324
+ const {
1325
+ loadCookiesFromApi
1326
+ } = useAreasStore((state) => state.windowActions);
1852
1327
  const onTouch = () => {
1853
1328
  if (!selected) {
1854
1329
  if (emergeType === "popup") {
1855
- selectWindowPopUp(props.windowId);
1330
+ selectWindowPopUp(areaId, props.windowId);
1856
1331
  } else if (emergeType === "layout") {
1857
- selectWindowLayout(props.windowId);
1332
+ selectWindowLayout(areaId, props.windowId);
1858
1333
  }
1859
1334
  }
1860
1335
  };
1861
- return /* @__PURE__ */ jsx("div", {
1336
+ const windowTools = useMemo(() => ({
1337
+ getWindowId: () => windowId,
1338
+ setActions: (newActions, version) => {
1339
+ setActions(windowId, newActions, version);
1340
+ },
1341
+ getCookie: (id) => getCookie(windowId, id),
1342
+ getCookies: (type) => getCookies(windowId, type),
1343
+ setCookie: (id, type, cookie) => {
1344
+ setCookie(windowId, id, type, cookie);
1345
+ },
1346
+ close: () => close(windowId),
1347
+ setLoading: (isLoading) => {
1348
+ setLoading(windowId, isLoading);
1349
+ }
1350
+ }), []);
1351
+ useEffect(() => {
1352
+ loadCookiesFromApi(windowId);
1353
+ }, []);
1354
+ return /* @__PURE__ */ jsxs(WindowRoot, {
1862
1355
  role: "presentation",
1863
- className: clsx(areasViewerClasses.windowRoot, selected ? areasViewerClasses.selected : null),
1356
+ className: clsx(areasViewerClasses.windowRoot, selected ? areasViewerClasses.selectedWindow : null, wd.loading ? areasViewerClasses.loading : null),
1864
1357
  onMouseDown: onTouch,
1865
- children: /* @__PURE__ */ jsx(WindowMFProvider, {
1866
- ...props,
1867
- children: /* @__PURE__ */ jsx(InnerForHooks$1, {
1868
- ...props
1358
+ children: [/* @__PURE__ */ jsx(Header, {
1359
+ areaId,
1360
+ windowId,
1361
+ emergeType
1362
+ }), /* @__PURE__ */ jsx("div", {
1363
+ className: areasViewerClasses.windowContent,
1364
+ children: wd.status === "init" ? /* @__PURE__ */ jsx("div", {
1365
+ children: "BRUCE cargando"
1366
+ }) : wd.winType === "microfrontend" ? /* @__PURE__ */ jsx(MemonizedMicroFrontend, {
1367
+ moduleId,
1368
+ dynamicMFStore: wd.dynamicMFStore,
1369
+ windowTools,
1370
+ ...wd.mfProps
1371
+ }) : /* @__PURE__ */ jsx(Component, {
1372
+ moduleId,
1373
+ dynamicMFStore: wd.dynamicMFStore,
1374
+ windowTools,
1375
+ component: wd.component
1869
1376
  })
1870
- })
1377
+ })]
1871
1378
  });
1872
1379
  };
1873
1380
  const MemonizedWindow = React__default.memo(Window);
1874
1381
  const WindowPopUp = (props) => {
1875
1382
  const {
1383
+ areaId,
1876
1384
  windowProps,
1877
1385
  windowId
1878
1386
  } = props;
1387
+ const {
1388
+ host_static_assets,
1389
+ environment_assets
1390
+ } = useEnvironment();
1879
1391
  const {
1880
1392
  selectWindowPopUp
1881
- } = useAreaStore((store) => store.actions);
1882
- const selectedPopUpId = useAreaStore((store) => store.currentPopUpId);
1883
- const zIndex = useAreaStore((store) => store.hashWindowsPopups[props.windowId].zIndex);
1393
+ } = useAreasStore((store) => store.areaActions);
1394
+ const selectedPopUpId = useAreasStore((store) => store.hashAreas[areaId].currentPopUpId);
1395
+ const zIndex = useAreasStore((store) => store.hashAreas[areaId].hashWindowsPopups[props.windowId].zIndex);
1884
1396
  const isSelected = props.windowId === selectedPopUpId;
1885
1397
  const onTouch = () => {
1886
1398
  if (!isSelected) {
1887
- selectWindowPopUp(props.windowId);
1399
+ selectWindowPopUp(areaId, props.windowId);
1888
1400
  }
1889
1401
  };
1890
1402
  return /* @__PURE__ */ jsx(DraggableWindow, {
@@ -1902,6 +1414,13 @@ const WindowPopUp = (props) => {
1902
1414
  onResizeStart: () => {
1903
1415
  onTouch();
1904
1416
  },
1417
+ handle: (resizeHandle, ref) => /* @__PURE__ */ jsx("div", {
1418
+ ref,
1419
+ children: /* @__PURE__ */ jsx(Icon, {
1420
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.RESIZE}`,
1421
+ className: `custom-handle custom-handle-${resizeHandle}`
1422
+ })
1423
+ }, resizeHandle),
1905
1424
  children: /* @__PURE__ */ jsx(Window, {
1906
1425
  ...props
1907
1426
  })
@@ -1909,105 +1428,51 @@ const WindowPopUp = (props) => {
1909
1428
  });
1910
1429
  };
1911
1430
  const MemonizedWindowPopUp = React__default.memo(WindowPopUp);
1912
- styled("div")(({ theme }) => ({
1913
- display: "flex",
1914
- flexDirection: "column",
1915
- height: "100%",
1916
- overflow: "hidden",
1917
- padding: theme.spacing(3)
1918
- }));
1919
- const WrapperWindowModal = styled(Dialog)(() => ({
1920
- "& .MuiDialog-container": {},
1921
- "&.m4l_selected": {
1922
- borderTop: "1px solid green"
1923
- }
1924
- }));
1925
- const WindowModal = (props) => {
1926
- const {
1927
- closeWindowModal
1928
- } = useAreaStore((state) => state.actions);
1929
- const isDesktop = useResponsiveDesktop();
1930
- const onClose = () => {
1931
- closeWindowModal();
1932
- };
1933
- const DragabblePaperComponent = (_props) => {
1934
- return /* @__PURE__ */ jsx(cjs.exports, {
1935
- handle: ".m4l_draggable_handle",
1936
- bounds: "parent",
1937
- children: /* @__PURE__ */ jsx(ResizeableWindow, {
1938
- className: areasViewerClasses.windowModalRoot,
1939
- width: props.width,
1940
- height: props.height,
1941
- children: /* @__PURE__ */ jsx(Window, {
1942
- ...props,
1943
- onClose
1944
- })
1945
- })
1946
- });
1947
- };
1948
- function PaperComponent(_props) {
1949
- return /* @__PURE__ */ jsx(Window, {
1950
- ...props,
1951
- onClose
1952
- });
1953
- }
1954
- return /* @__PURE__ */ jsx(WrapperWindowModal, {
1955
- open: true,
1956
- disablePortal: true,
1957
- scroll: "paper",
1958
- onKeyDown: (event) => {
1959
- if (event.key === "Escape") {
1960
- onClose();
1961
- }
1962
- },
1963
- "aria-labelledby": "child-modal-title",
1964
- "aria-describedby": "child-modal-description",
1965
- PaperComponent: isDesktop ? DragabblePaperComponent : PaperComponent,
1966
- maxWidth: false,
1967
- fullWidth: !isDesktop,
1968
- fullScreen: false,
1969
- disableEnforceFocus: true
1970
- });
1971
- };
1972
- const MemonizedWindowModal = React__default.memo(WindowModal);
1973
1431
  const ResponsiveGridLayout = WidthProvider(Responsive);
1974
- const GridLayout = () => {
1975
- const gridLayouts = useAreaStore((state) => state.gridLayouts, shallow);
1976
- const hashWindowsPopups = useAreaStore((state) => state.hashWindowsPopups, shallow);
1977
- const hashWindowsLayouts = useAreaStore((state) => state.hashWindowsLayouts, shallow);
1978
- const breakPointsLayouts = useAreaStore((state) => state.breakpointsLayouts, shallow);
1979
- const windowsPopUps = useAreaStore((state) => state.windowsPopUps, shallow);
1980
- const windowModal = useAreaStore((state) => state.windowModal, shallow);
1981
- const breakpoints = useAreaStore((state) => state.breakpoints, shallow);
1982
- const viewMode = useAreaStore((state) => state.viewMode, shallow);
1983
- const cols = useAreaStore((state) => state.cols, shallow);
1432
+ const GridLayout = (props) => {
1433
+ const {
1434
+ areaId
1435
+ } = props;
1436
+ const windowsLayouts = useAreasStore((state) => state.hashAreas[areaId].windowsLayouts, shallow);
1437
+ const hashWindowsPopups = useAreasStore((state) => state.hashAreas[areaId].hashWindowsPopups, shallow);
1438
+ const hashWindowsLayouts = useAreasStore((state) => state.hashAreas[areaId].hashWindowsLayouts, shallow);
1439
+ const breakPointsLayouts = useAreasStore((state) => state.hashAreas[areaId].breakPointsLayouts, shallow);
1440
+ const windowsPopUps = useAreasStore((state) => state.hashAreas[areaId].windowsPopUps, shallow);
1441
+ const breakpoints = useAreasStore((state) => state.hashAreas[areaId].breakpoints, shallow);
1442
+ const viewMode = useAreasStore((state) => state.hashAreas[areaId].viewMode, shallow);
1443
+ const cols = useAreasStore((state) => state.hashAreas[areaId].cols, shallow);
1984
1444
  const {
1985
1445
  onBreakpointsLayoutsChange
1986
- } = useAreaStore((state) => state.actions);
1446
+ } = useAreasStore((state) => state.areaActions, shallow);
1987
1447
  function onBreakpointChange(_newBreakpoint, _newCols) {
1988
1448
  }
1989
1449
  useEffect(() => {
1990
- console.log("ResponsiveGridLayout resize");
1991
- window.dispatchEvent(new Event("resize"));
1992
- }, [viewMode, gridLayouts]);
1993
- return /* @__PURE__ */ jsxs(Fragment, {
1994
- children: [/* @__PURE__ */ jsxs(ResponsiveGridLayout, {
1450
+ setTimeout(() => {
1451
+ window.dispatchEvent(new Event("resize"));
1452
+ }, 100);
1453
+ }, [viewMode, windowsLayouts]);
1454
+ return /* @__PURE__ */ jsxs(
1455
+ ResponsiveGridLayout,
1456
+ {
1995
1457
  autoSize: false,
1996
1458
  compactType: "vertical",
1997
1459
  measureBeforeMount: true,
1998
1460
  resizeHandles: ["nw", "se"],
1999
- className: areasViewerClasses.areaGridLayout,
1461
+ className: clsx(areasViewerClasses.areaGridLayout, `${areasViewerClasses.areaGridLayout}-${areaId}`),
2000
1462
  layouts: breakPointsLayouts,
2001
- onLayoutChange: onBreakpointsLayoutsChange,
1463
+ onLayoutChange: (currentLayouts, newAllLayouts) => onBreakpointsLayoutsChange(areaId, currentLayouts, newAllLayouts),
2002
1464
  onBreakpointChange,
2003
1465
  breakpoints,
2004
1466
  cols,
2005
1467
  rowHeight: ROW_HEIGTH_GRIDLAYOUT,
2006
- margin: [5, 5],
1468
+ margin: [MARGIN_GRIDLAYOUT, MARGIN_GRIDLAYOUT],
2007
1469
  containerPadding: [CONTAINER_PADDING_GRIDLAYOUT, CONTAINER_PADDING_GRIDLAYOUT],
2008
1470
  draggableHandle: ".m4l_draggable_handle",
2009
- isBounded: false,
1471
+ onWidthChange: () => {
1472
+ console.log("onWidthChange", areaId);
1473
+ },
2010
1474
  preventCollision: false,
1475
+ verticalCompact: true,
2011
1476
  children: [/* @__PURE__ */ jsx("div", {
2012
1477
  className: areasViewerClasses.areaGridLayoutPopupsContainer,
2013
1478
  "data-grid": {
@@ -2032,7 +1497,7 @@ const GridLayout = () => {
2032
1497
  }
2033
1498
  return null;
2034
1499
  })
2035
- }, "none"), gridLayouts.map((l) => {
1500
+ }, "none"), windowsLayouts.map((l) => {
2036
1501
  if (hashWindowsLayouts[l.i]) {
2037
1502
  return /* @__PURE__ */ jsx("div", {
2038
1503
  children: /* @__PURE__ */ jsx(MemonizedWindow, {
@@ -2042,40 +1507,31 @@ const GridLayout = () => {
2042
1507
  }
2043
1508
  return null;
2044
1509
  })]
2045
- }), windowModal && /* @__PURE__ */ jsx(MemonizedWindowModal, {
2046
- ...windowModal
2047
- })]
2048
- });
2049
- };
2050
- const InnerForHooks = () => {
2051
- const status = useAreaStore((state) => state.status);
2052
- if (status === "loaded") {
2053
- return /* @__PURE__ */ jsx(GridLayout, {});
2054
- } else {
2055
- return /* @__PURE__ */ jsx("div", {
2056
- children: "Loading.. Intentar si falla."
2057
- });
2058
- }
1510
+ }
1511
+ );
2059
1512
  };
2060
- const PanelWindows = () => {
2061
- const status = useAreaStore((state) => state.status);
2062
- const mode = useAreaStore((state) => state.viewMode);
2063
- const singleId = useAreaStore((state) => state.singleId);
2064
- const gridLayouts = useAreaStore((state) => state.gridLayouts, shallow);
2065
- const hashWindowsLayouts = useAreaStore((state) => state.hashWindowsLayouts, shallow);
1513
+ const PanelWindows = (props) => {
1514
+ const {
1515
+ areaId
1516
+ } = props;
1517
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
1518
+ const mode = useAreasStore((state) => state.hashAreas[areaId].viewMode);
1519
+ const singleId = useAreasStore((state) => state.hashAreas[areaId].singleId);
1520
+ const windowsLayouts = useAreasStore((state) => state.hashAreas[areaId].windowsLayouts, shallow);
1521
+ const hashWindowsLayouts = useAreasStore((state) => state.hashAreas[areaId].hashWindowsLayouts, shallow);
2066
1522
  const {
2067
1523
  maximizeLayout
2068
- } = useAreaStore((state) => state.actions);
1524
+ } = useAreasStore((state) => state.areaActions);
2069
1525
  const onTouched = (layoutId) => {
2070
- maximizeLayout(layoutId);
1526
+ maximizeLayout(areaId, layoutId);
2071
1527
  };
2072
1528
  if (status === "loaded") {
2073
- if (mode !== "single" || gridLayouts.length < 2) {
1529
+ if (mode !== "single" || windowsLayouts.length < 2) {
2074
1530
  return null;
2075
1531
  }
2076
1532
  return /* @__PURE__ */ jsx("div", {
2077
1533
  className: areasViewerClasses.panelWindowsRoot,
2078
- children: gridLayouts.map((l) => {
1534
+ children: windowsLayouts.map((l) => {
2079
1535
  return /* @__PURE__ */ jsx("div", {
2080
1536
  className: clsx(areasViewerClasses.panelWindowsButtonContainer, singleId === l.i ? areasViewerClasses.selected : null),
2081
1537
  children: /* @__PURE__ */ jsx(IconButton, {
@@ -2090,51 +1546,162 @@ const PanelWindows = () => {
2090
1546
  return null;
2091
1547
  }
2092
1548
  };
1549
+ const InnerForHooks = (props) => {
1550
+ const {
1551
+ areaId
1552
+ } = props;
1553
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
1554
+ return /* @__PURE__ */ jsxs("div", {
1555
+ className: clsx(areasViewerClasses.areaGridLayoutPanelContainer, `${areasViewerClasses.areaGridLayoutPanelContainer}-${areaId}`),
1556
+ children: [
1557
+ status === "loaded" ? /* @__PURE__ */ jsx(GridLayout, {
1558
+ areaId
1559
+ }) : /* @__PURE__ */ jsx("div", {
1560
+ children: "Loading.. Intentar si falla."
1561
+ }),
1562
+ /* @__PURE__ */ jsx(PanelWindows, {
1563
+ areaId
1564
+ })
1565
+ ]
1566
+ });
1567
+ };
2093
1568
  const Area = (props) => {
2094
1569
  const {
2095
- selected
1570
+ selected,
1571
+ areaId
2096
1572
  } = props;
2097
1573
  const classesAreaRoot = useAreasStore((state) => state.viwerClasses.areaRoot);
1574
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
1575
+ const {
1576
+ resizeMaximixedLayout
1577
+ } = useAreasStore((state) => state.areaActions, shallow);
1578
+ const throttleResizeMaximixedLayout = throttle(() => {
1579
+ console.log("throttleResizeMaximixedLayout", areaId);
1580
+ resizeMaximixedLayout(areaId);
1581
+ }, THROTTLE_RESIZE_TIME, {
1582
+ leading: false
1583
+ });
1584
+ const onResize = useCallback((_target) => {
1585
+ throttleResizeMaximixedLayout();
1586
+ }, []);
1587
+ const ref = useResizeObserver(onResize);
1588
+ if (status === "init") {
1589
+ return null;
1590
+ }
2098
1591
  return /* @__PURE__ */ jsx("div", {
2099
- className: clsx(classesAreaRoot, selected ? areasViewerClasses.selected : null),
2100
- children: /* @__PURE__ */ jsx(AreaProvider, {
2101
- ...props,
2102
- children: /* @__PURE__ */ jsxs("div", {
2103
- className: clsx(areasViewerClasses.areaGridLayoutPanelContainer, `${areasViewerClasses.areaGridLayoutPanelContainer}-${props.id}`),
2104
- children: [/* @__PURE__ */ jsx(InnerForHooks, {}), /* @__PURE__ */ jsx(PanelWindows, {})]
2105
- })
1592
+ className: clsx(classesAreaRoot, selected ? areasViewerClasses.selected : null, status === "loading" ? areasViewerClasses.loading : null),
1593
+ ref,
1594
+ children: /* @__PURE__ */ jsx(InnerForHooks, {
1595
+ areaId
2106
1596
  })
2107
1597
  });
2108
1598
  };
2109
1599
  Area.displayName = "Area";
1600
+ styled("div")(({ theme }) => ({
1601
+ display: "flex",
1602
+ flexDirection: "column",
1603
+ height: "100%",
1604
+ overflow: "hidden",
1605
+ padding: theme.spacing(3)
1606
+ }));
1607
+ const WrapperWindowModal = styled(Dialog)(({ theme }) => ({
1608
+ hola: 1,
1609
+ backgroundColor: theme.palette.background.paper,
1610
+ "& .MuiDialog-container": {},
1611
+ "&.m4l_selected": {
1612
+ borderTop: "1px solid green"
1613
+ },
1614
+ ...theme.components?.M4LAreasViewerModal?.styleOverrides
1615
+ }));
1616
+ const WindowModal = (props) => {
1617
+ const {
1618
+ windowId
1619
+ } = props;
1620
+ const {
1621
+ onClose
1622
+ } = useAreasStore((state) => state.hashWindowsModals[windowId]);
1623
+ const {
1624
+ host_static_assets,
1625
+ environment_assets
1626
+ } = useEnvironment();
1627
+ const isDesktop = useResponsiveDesktop();
1628
+ const DragabblePaperComponent = (_props) => {
1629
+ return /* @__PURE__ */ jsx(cjs.exports, {
1630
+ handle: ".m4l_draggable_handle",
1631
+ bounds: "parent",
1632
+ children: /* @__PURE__ */ jsx(ResizeableWindow, {
1633
+ width: props.windowProps?.width || 400,
1634
+ height: props.windowProps?.height || 300,
1635
+ className: areasViewerClasses.windowModalRoot,
1636
+ handle: (resizeHandle, ref) => /* @__PURE__ */ jsx("div", {
1637
+ ref,
1638
+ children: /* @__PURE__ */ jsx(Icon, {
1639
+ src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.RESIZE}`,
1640
+ className: `custom-handle custom-handle-${resizeHandle}`
1641
+ })
1642
+ }, resizeHandle),
1643
+ children: /* @__PURE__ */ jsx(Window, {
1644
+ ...props
1645
+ })
1646
+ })
1647
+ });
1648
+ };
1649
+ function PaperComponent(_props) {
1650
+ return /* @__PURE__ */ jsx(Window, {
1651
+ ...props
1652
+ });
1653
+ }
1654
+ return /* @__PURE__ */ jsx(WrapperWindowModal, {
1655
+ className: areasViewerClasses.windowModalRoot,
1656
+ open: true,
1657
+ scroll: "paper",
1658
+ onKeyDown: (event) => {
1659
+ if (event.key === "Escape") {
1660
+ onClose && onClose(windowId);
1661
+ }
1662
+ },
1663
+ "aria-labelledby": "child-modal-title",
1664
+ "aria-describedby": "child-modal-description",
1665
+ PaperComponent: isDesktop ? DragabblePaperComponent : PaperComponent,
1666
+ maxWidth: false,
1667
+ fullWidth: !isDesktop,
1668
+ fullScreen: false,
1669
+ disableEnforceFocus: true
1670
+ });
1671
+ };
1672
+ const MemonizedWindowModal = React__default.memo(WindowModal);
2110
1673
  function AreasViewer() {
2111
- const areas = useAreasStore((state) => state.areas);
2112
- const currentArea = useAreasStore((state) => state.currentArea);
1674
+ const areas = useAreasStore((state) => state.areas, shallow);
1675
+ const windowsModals = useAreasStore((state) => state.windowsModals);
1676
+ const hashWindowsModals = useAreasStore((state) => state.hashWindowsModals);
1677
+ const currentArea = useAreasStore((state) => state.currentAreaId);
2113
1678
  const status = useAreasStore((state) => state.ownerState.status);
2114
1679
  const classesRoot = useAreasStore((state) => state.viwerClasses.root);
2115
- return /* @__PURE__ */ jsx(AreasViewerRoot, {
2116
- className: classesRoot,
2117
- children: status === "loaded" ? areas.map((area) => {
2118
- return /* @__PURE__ */ jsx(Area, {
2119
- id: area.id,
2120
- selected: currentArea === area.id,
2121
- loadWindows: area.loadWindows
2122
- }, area.id);
2123
- }) : /* @__PURE__ */ jsx(Fragment, {
2124
- children: "Bruce cargando"
2125
- })
1680
+ return /* @__PURE__ */ jsxs(Fragment, {
1681
+ children: [/* @__PURE__ */ jsx(AreasViewerRoot, {
1682
+ className: classesRoot,
1683
+ children: status === "loaded" ? areas.map((area) => {
1684
+ return /* @__PURE__ */ jsx(Area, {
1685
+ areaId: area.id,
1686
+ selected: currentArea === area.id
1687
+ }, area.id);
1688
+ }) : /* @__PURE__ */ jsx(Fragment, {
1689
+ children: "Bruce cargando"
1690
+ })
1691
+ }), windowsModals.map((wm) => {
1692
+ if (hashWindowsModals[wm]) {
1693
+ return /* @__PURE__ */ jsx(MemonizedWindowModal, {
1694
+ ...hashWindowsModals[wm]
1695
+ }, wm);
1696
+ }
1697
+ return null;
1698
+ })]
2126
1699
  });
2127
1700
  }
2128
1701
  export {
2129
- AreaContext as A,
2130
- DynamicMFParmsContext as D,
2131
- MemonizedDynamicMFParmsProvider as M,
2132
- WindowContext as W,
1702
+ AreasAdmin as A,
2133
1703
  useAreasAdminUtilityClasses as a,
2134
- WindowToolsMFContext as b,
2135
- AreasAdmin as c,
2136
- AreasViewer as d,
2137
- WindowToolsMFProvider as e,
2138
- DynamicMFParmsProvider as f,
1704
+ areasViewerClasses as b,
1705
+ AreasViewer as c,
2139
1706
  useAreasViewerUtilityClasses as u
2140
1707
  };