@m4l/components 0.1.69 → 0.1.70

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 (129) hide show
  1. package/@types/export.d.ts +7 -1
  2. package/components/CommonActions/components/ActionCancel/{index.e83053da.js → index.9d521b2a.js} +2 -2
  3. package/components/CommonActions/components/ActionFormCancel/{index.ca378b0a.js → index.4756457f.js} +25 -13
  4. package/components/CommonActions/components/ActionFormIntro/{index.fa2107df.js → index.40321b1b.js} +2 -2
  5. package/components/CommonActions/components/ActionIntro/{index.b8d5c8ee.js → index.1ba5b02b.js} +3 -3
  6. package/components/CommonActions/components/Actions/{index.1b2a0921.js → index.154d7cb6.js} +23 -13
  7. package/components/DataGrid/{index.75ea6038.js → index.2f4a0e64.js} +21 -19
  8. package/components/DynamicFilter/{index.aaeea668.js → index.789ab474.js} +36 -40
  9. package/components/HelperText/{index.742d547d.js → index.a69e9509.js} +8 -8
  10. package/components/Icon/{index.952f0635.js → index.caaed284.js} +2 -2
  11. package/components/Image/{index.f30f79f0.js → index.82a6cd46.js} +1 -1
  12. package/components/LanguagePopover/{index.526e544e.js → index.5af28b9e.js} +9 -9
  13. package/components/ModalDialog/{index.4d663d0a.js → index.cdfd1ae8.js} +5 -5
  14. package/components/NavLink/{index.92008184.js → index.251fcf0d.js} +9 -9
  15. package/components/NoItemSelected/{index.6f2952ab.js → index.3b9d16e3.js} +1 -1
  16. package/components/ObjectLogs/{index.d1eee18b.js → index.57ea68b3.js} +17 -15
  17. package/components/PaperForm/{index.e9db704b.js → index.d2d492ea.js} +1 -1
  18. package/components/Period/{index.3ff6f53b.js → index.fbf074d3.js} +24 -14
  19. package/components/Resizeable/{index.ff97422e.js → index.aafda79e.js} +1 -1
  20. package/components/SideBar/{index.365f64f0.js → index.3bc6a634.js} +10 -24
  21. package/components/areas/components/AreasAdmin/classes/types.d.ts +1 -0
  22. package/components/areas/components/AreasAdmin/subcomponents/AreaChip/types.d.ts +1 -0
  23. package/components/areas/components/AreasViewer/classes/types.d.ts +1 -0
  24. package/components/areas/components/AreasViewer/subcomponents/Area/index.d.ts +2 -2
  25. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/GridLayout/index.d.ts +2 -1
  26. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/GridLayout/types.d.ts +3 -0
  27. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/InnerForHooks/index.d.ts +2 -1
  28. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/InnerForHooks/types.d.ts +3 -0
  29. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/index.d.ts +2 -1
  30. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/types.d.ts +3 -0
  31. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/index.d.ts +1 -1
  32. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/styles.d.ts +2 -0
  33. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/index.d.ts +4 -0
  34. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/types.d.ts +9 -0
  35. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/helper.d.ts +3 -0
  36. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/index.d.ts +9 -0
  37. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/MainActions/index.d.ts +6 -0
  38. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/index.d.ts +4 -0
  39. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/index.d.ts +2 -2
  40. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/subcomponents/MFLoader/types.d.ts +8 -0
  41. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/types.d.ts +8 -0
  42. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/types.d.ts +2 -0
  43. package/components/areas/components/AreasViewer/subcomponents/Area/types.d.ts +4 -0
  44. package/components/areas/components/{index.ffb147c7.js → index.359c2b18.js} +443 -1069
  45. package/components/areas/components/index.d.ts +1 -1
  46. package/components/areas/contexts/AreasContext/helper.d.ts +59 -0
  47. package/components/areas/contexts/AreasContext/index.de8b4e78.js +1015 -0
  48. package/components/areas/contexts/AreasContext/store.d.ts +1 -2
  49. package/components/areas/contexts/AreasContext/types.d.ts +86 -13
  50. package/components/areas/contexts/DynamicMFParmsContext/index.1607c78e.js +42 -0
  51. package/components/areas/contexts/DynamicMFParmsContext/index.d.ts +8 -0
  52. package/components/areas/{components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts → contexts}/DynamicMFParmsContext/store.d.ts +3 -9
  53. package/components/areas/contexts/WindowToolsMFContext/index.8f3e2a04.js +20 -0
  54. package/components/areas/{components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts → contexts}/WindowToolsMFContext/types.d.ts +3 -2
  55. package/components/areas/contexts/index.771827bb.js +2 -0
  56. package/components/areas/contexts/index.d.ts +4 -4
  57. package/components/areas/dictionary.d.ts +1 -0
  58. package/components/areas/hooks/index.ae8d8631.js +13 -0
  59. package/components/areas/hooks/useArea/index.2adbe001.js +12 -0
  60. package/components/areas/hooks/useDynamicMFParameters/index.d.ts +3 -9
  61. package/components/areas/hooks/useDynamicMFParameters/{index.7ce7176f.js → index.e52c5392.js} +1 -1
  62. package/components/areas/hooks/useWindowToolsMF/index.d.ts +1 -1
  63. package/components/areas/icons.d.ts +3 -0
  64. package/components/areas/{index.20cbd7b7.js → index.8a58bcbf.js} +14 -8
  65. package/components/areas/types.d.ts +32 -23
  66. package/components/formatters/BooleanFormatter/{index.d5e21bdd.js → index.7eb0498c.js} +1 -1
  67. package/components/formatters/{index.650243bb.js → index.f6b9ed01.js} +2 -2
  68. package/components/hook-form/RHFAutocomplete/{index.21377a2c.js → index.09c400c3.js} +10 -10
  69. package/components/hook-form/RHFAutocompleteAsync/{index.8c7e0842.js → index.e8acff04.js} +2 -2
  70. package/components/hook-form/RHFCheckbox/{index.83902d07.js → index.70310f35.js} +3 -3
  71. package/components/hook-form/RHFDateTime/{index.166250d8.js → index.7b815072.js} +9 -9
  72. package/components/hook-form/RHFPeriod/{index.61baf76f.js → index.3c7d393c.js} +2 -2
  73. package/components/hook-form/RHFTextField/{index.55687a39.js → index.d4c39859.js} +6 -7
  74. package/components/hook-form/RHFUpload/{index.eb4d0dac.js → index.31044674.js} +1 -1
  75. package/components/modal/WindowBase/subcomponents/Header/types.d.ts +1 -1
  76. package/components/modal/WindowBase/types.d.ts +1 -0
  77. package/components/modal/{WindowBase.7ce0b21e.js → WindowBase.6a40a945.js} +28 -21
  78. package/components/modal/{WindowConfirm.7ae1326f.js → WindowConfirm.e21763cb.js} +17 -15
  79. package/components/modal/index.438777d9.js +34 -0
  80. package/components/mui_extended/Accordion/{index.51feece8.js → index.437bb3f8.js} +2 -2
  81. package/components/mui_extended/Button/{index.b34c8b68.js → index.f8ce9ccd.js} +3 -3
  82. package/components/mui_extended/IconButton/{index.917f0d3c.js → index.57824447.js} +1 -3
  83. package/components/mui_extended/MenuActions/{index.651dec44.js → index.37043326.js} +2 -2
  84. package/components/mui_extended/Pager/{index.e0663072.js → index.eeed3bd5.js} +1 -1
  85. package/components/mui_extended/Typography/{index.79e2b06f.js → index.b3c6e71c.js} +1 -1
  86. package/components/mui_extended/index.dacbb059.js +19 -0
  87. package/contexts/ModalContext/{index.76d5ccee.js → index.8e3cd7a8.js} +1 -1
  88. package/contexts/index.d.ts +1 -1
  89. package/hooks/useModal/{index.043e419b.js → index.d590f506.js} +1 -1
  90. package/index.js +96 -94
  91. package/package.json +3 -4
  92. package/{react-draggable.de1aac90.js → react-draggable.0d64c8b1.js} +1 -1
  93. package/{react-resizable.e0470767.js → react-resizable.8307e056.js} +2 -2
  94. package/utils/{index.b5c62ef0.js → index.a2312a73.js} +1 -1
  95. package/{vendor.6a33c6d2.js → vendor.8edaef93.js} +47 -45
  96. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/helper.d.ts +0 -39
  97. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/index.d.ts +0 -20
  98. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/store.d.ts +0 -11
  99. package/components/areas/components/AreasViewer/subcomponents/Area/contexts/AreaContext/types.d.ts +0 -82
  100. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/DynamicMFParmsContext/index.d.ts +0 -14
  101. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/helper.d.ts +0 -1
  102. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/index.d.ts +0 -13
  103. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/store.d.ts +0 -36
  104. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts/WindowContext/types.d.ts +0 -5
  105. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/index.d.ts +0 -4
  106. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Component/index.d.ts +0 -8
  107. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/helper.d.ts +0 -3
  108. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/index.d.ts +0 -2
  109. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/Header/subcomponents/MainActions/index.d.ts +0 -2
  110. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/index.d.ts +0 -4
  111. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/InnerForHooks/subcomponents/MicroFrontend/types.d.ts +0 -8
  112. package/components/areas/contexts/AreasContext/index.7c12b512.js +0 -230
  113. package/components/areas/contexts/index.1a823ffb.js +0 -2
  114. package/components/areas/hooks/index.d09ea7de.js +0 -26
  115. package/components/areas/hooks/useArea/index.3a0d4b8c.js +0 -34
  116. package/components/areas/hooks/useArea/index.d.ts +0 -11
  117. package/components/areas/hooks/useWindow/index.d.ts +0 -11
  118. package/components/modal/index.d6dcd1b1.js +0 -24
  119. package/components/mui_extended/index.8b30e8c8.js +0 -19
  120. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/Header → Header}/skeleton.d.ts +0 -0
  121. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/Header → Header}/styles.d.ts +0 -0
  122. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/index.d.ts +0 -0
  123. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/styles.d.ts +0 -0
  124. /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
  125. /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
  126. /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
  127. /package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/{InnerForHooks/subcomponents/MicroFrontend → MicroFrontend}/subcomponents/MFLoader/subcomponents/LoadingMF/types.d.ts +0 -0
  128. /package/components/areas/{components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts → contexts}/DynamicMFParmsContext/types.d.ts +0 -0
  129. /package/components/areas/{components/AreasViewer/subcomponents/Area/subcomponents/Window/contexts → contexts}/WindowToolsMFContext/index.d.ts +0 -0
@@ -1,83 +1,82 @@
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.57824447.js";
2
+ import { u as useAreasStore } from "../hooks/useArea/index.2adbe001.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, I as ICONS, g as getAreasDictionary } from "../index.8a58bcbf.js";
6
+ import { I as Icon } from "../../Icon/index.caaed284.js";
7
7
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
8
- import React__default, { createContext, useRef, useEffect, useMemo, useState, useCallback } from "react";
8
+ import React__default, { useMemo, useState, useRef, useCallback, useEffect } from "react";
9
9
  import { generateUtilityClasses, Skeleton, styled as styled$1, Typography as Typography$1, Dialog } from "@mui/material";
10
10
  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";
11
+ import "zustand";
12
+ import { R as ROW_HEIGTH_GRIDLAYOUT, M as MARGIN_GRIDLAYOUT, C as CONTAINER_PADDING_GRIDLAYOUT, T as THROTTLE_RESIZE_TIME } from "../contexts/AreasContext/index.de8b4e78.js";
13
+ import "../../mui_extended/Accordion/index.437bb3f8.js";
14
14
  import "../../mui_extended/Avatar/index.fe06afd7.js";
15
15
  import "react-router-dom";
16
16
  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";
17
+ import { B as Button } from "../../mui_extended/Button/index.f8ce9ccd.js";
18
+ import { I as Image } from "../../Image/index.82a6cd46.js";
19
19
  import "@mui/lab";
20
- import { T as Typography } from "../../mui_extended/Typography/index.79e2b06f.js";
20
+ import { T as Typography } from "../../mui_extended/Typography/index.b3c6e71c.js";
21
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";
22
+ import { M as MenuActions } from "../../mui_extended/MenuActions/index.37043326.js";
23
+ import "../../mui_extended/Pager/index.eeed3bd5.js";
24
24
  import "../../mui_extended/Tab/index.e0653a0a.js";
25
25
  import { unstable_composeClasses } from "@mui/base";
26
- import { g as getComponentUtilityClass } from "../../../utils/index.b5c62ef0.js";
26
+ import { g as getComponentUtilityClass } from "../../../utils/index.a2312a73.js";
27
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";
31
- import debounce from "lodash/debounce";
32
- import cloneDeep from "lodash.clonedeep";
33
- import { useResponsiveDesktop, useFirstRender, useHostTheme, useFormatter, useLocales } from "@m4l/graphics";
28
+ import { r as react_resizable_css } from "../../../react-resizable.8307e056.js";
34
29
  import { WidthProvider, Responsive } from "react-grid-layout";
35
30
  import { m } from "framer-motion";
36
31
  import "../../animate/LoadingScreen/index.1d0c4307.js";
37
32
  import "../../animate/PropagateLoader/index.be5b02c3.js";
33
+ import { W as WindowToolsMFProvider } from "../contexts/WindowToolsMFContext/index.8f3e2a04.js";
34
+ import { D as DynamicMFParmsProvider } from "../contexts/DynamicMFParmsContext/index.1607c78e.js";
38
35
  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";
36
+ import "../../hook-form/RHFAutocomplete/index.09c400c3.js";
37
+ import "../../HelperText/index.a69e9509.js";
38
+ import debounce from "lodash/debounce";
39
+ import "../../hook-form/RHFAutocompleteAsync/index.e8acff04.js";
40
+ import "../../hook-form/RHFCheckbox/index.70310f35.js";
43
41
  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";
42
+ import "../../hook-form/RHFDateTime/index.7b815072.js";
43
+ import { useResponsiveDesktop, useHostTheme, useFormatter, useLocales, useFirstRender, useResizeObserver } from "@m4l/graphics";
44
+ import "../../hook-form/RHFTextField/index.d4c39859.js";
45
+ import "../../hook-form/RHFPeriod/index.3c7d393c.js";
46
+ import "../../Period/index.fbf074d3.js";
47
+ import "../../CommonActions/components/Actions/index.154d7cb6.js";
48
+ import "../../../contexts/ModalContext/index.8e3cd7a8.js";
49
+ import { c as cjs } from "../../../react-draggable.0d64c8b1.js";
50
+ import "../../ModalDialog/index.cdfd1ae8.js";
51
+ import { R as ResizeableWindow } from "../../Resizeable/index.aafda79e.js";
52
+ import "../../modal/WindowConfirm.e21763cb.js";
53
+ import "../../modal/WindowBase.6a40a945.js";
55
54
  import "lodash/isString";
56
55
  import "react-dropzone";
57
- import "../../hook-form/RHFUpload/index.eb4d0dac.js";
58
- import "../../DataGrid/index.75ea6038.js";
56
+ import "../../hook-form/RHFUpload/index.31044674.js";
57
+ import "../../DataGrid/index.2f4a0e64.js";
59
58
  import "react-dnd";
60
59
  import "react-dnd-html5-backend";
61
- import "../../DynamicFilter/index.aaeea668.js";
60
+ import "../../DynamicFilter/index.789ab474.js";
62
61
  import "../../ScrollBar/index.bbe48f4d.js";
63
62
  import "yup";
64
63
  import "@hookform/resolvers/yup";
65
64
  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";
65
+ import "../../LanguagePopover/index.5af28b9e.js";
66
+ import "../../NavLink/index.251fcf0d.js";
67
+ import "../../NoItemSelected/index.3b9d16e3.js";
68
+ import "../../ObjectLogs/index.57ea68b3.js";
71
69
  import "../../../react-json-view.57125fcf.js";
72
- import "../../PaperForm/index.e9db704b.js";
70
+ import "../../PaperForm/index.d2d492ea.js";
73
71
  import "../../Page/index.4237c241.js";
74
72
  import "../../PropertyValue/index.dfcfe1ba.js";
75
73
  import "../../../react-splitter-layout.8b1655c8.js";
76
74
  import "../../SplitLayout/index.5a8355d8.js";
77
- import "../../SideBar/index.365f64f0.js";
78
- import { a as useWindow, b as useWindowStore } from "../hooks/index.d09ea7de.js";
75
+ import "../../SideBar/index.3bc6a634.js";
76
+ import { D as DraggableWindow } from "../../../vendor.8edaef93.js";
79
77
  import { L as LinearProgress } from "../../mui_extended/LinearProgress/index.c92b9ba9.js";
80
78
  import { v as varBounce } from "../../animate/variants/bounce.784aaaaa.js";
79
+ import { throttle } from "lodash";
81
80
  const areasViewerClasses = generateUtilityClasses(AREAS_VIEWER_CLASS_NAME, [
82
81
  "root",
83
82
  "areaRoot",
@@ -94,7 +93,8 @@ const areasViewerClasses = generateUtilityClasses(AREAS_VIEWER_CLASS_NAME, [
94
93
  "panelWindowsRoot",
95
94
  "panelWindowsButtonContainer",
96
95
  "selected",
97
- "isMobile"
96
+ "isMobile",
97
+ "loading"
98
98
  ], AREAS_VIEWER_CLASS_NAME);
99
99
  const useAreasViewerUtilityClasses = (ownerState) => {
100
100
  const slots = {
@@ -125,7 +125,8 @@ const areasAdminClasses = generateUtilityClasses(AREAS_ADMIN_CLASS_NAME, [
125
125
  "areaContainerChips",
126
126
  "areaIconLayer",
127
127
  "selected",
128
- "isMobile"
128
+ "isMobile",
129
+ "disabled"
129
130
  ], AREAS_ADMIN_CLASS_NAME);
130
131
  const useAreasAdminUtilityClasses = (ownerState) => {
131
132
  const slots = {
@@ -144,7 +145,8 @@ const AreaChip = (props) => {
144
145
  const {
145
146
  areaId,
146
147
  selected,
147
- areaName
148
+ areaName,
149
+ disabled
148
150
  } = props;
149
151
  const {
150
152
  host_static_assets,
@@ -153,14 +155,14 @@ const AreaChip = (props) => {
153
155
  const {
154
156
  deleteArea,
155
157
  selectArea
156
- } = useAreasStore((state) => state.actions);
158
+ } = useAreasStore((state) => state.areasActions);
157
159
  const onClickDeleteArea = (e) => {
158
160
  e.stopPropagation();
159
161
  deleteArea(areaId);
160
162
  };
161
163
  return /* @__PURE__ */ jsxs("div", {
162
164
  role: "presentation",
163
- className: clsx(areasAdminClasses.areaChipRoot, selected ? areasAdminClasses.selected : null),
165
+ className: clsx(areasAdminClasses.areaChipRoot, selected ? areasAdminClasses.selected : null, disabled ? areasAdminClasses.disabled : null),
164
166
  onClick: () => {
165
167
  selectArea(areaId);
166
168
  },
@@ -171,6 +173,7 @@ const AreaChip = (props) => {
171
173
  className: areasAdminClasses.areaChipDeleteButton,
172
174
  src: `${host_static_assets}/${environment_assets}/frontend/components/areas/assets/icons/${ICONS.DELETE_AREA}`,
173
175
  size: "small",
176
+ disabled,
174
177
  onClick: onClickDeleteArea
175
178
  })]
176
179
  });
@@ -198,17 +201,18 @@ const AreasAdminRoot = styled("div")`
198
201
  `;
199
202
  function AreasAdmin() {
200
203
  const areas = useAreasStore((state) => state.areas, shallow);
201
- const currentArea = useAreasStore((state) => state.currentArea, shallow);
204
+ const currentArea = useAreasStore((state) => state.currentAreaId, shallow);
202
205
  const status = useAreasStore((state) => state.ownerState.status);
203
206
  const classesRoot = useAreasStore((state) => state.adminClasses.root);
207
+ const areasLength = useAreasStore((state) => state.areas.length);
204
208
  const {
205
209
  addArea
206
- } = useAreasStore((state) => state.actions, shallow);
210
+ } = useAreasStore((state) => state.areasActions, shallow);
207
211
  const {
208
212
  host_static_assets,
209
213
  environment_assets
210
214
  } = useEnvironment();
211
- console.log("Render AreasAdmin", status, areas);
215
+ console.log("Render AreasAdmin", areas);
212
216
  if (status !== "loaded") {
213
217
  return null;
214
218
  }
@@ -224,7 +228,8 @@ function AreasAdmin() {
224
228
  children: areas.map((area) => /* @__PURE__ */ jsx(AreaChip, {
225
229
  areaId: area.id,
226
230
  selected: area.id === currentArea,
227
- areaName: area.name
231
+ areaName: area.name,
232
+ disabled: areasLength === 1
228
233
  }, area.id))
229
234
  }), /* @__PURE__ */ jsx(IconButton, {
230
235
  className: areasAdminClasses.areasAddButton,
@@ -235,15 +240,12 @@ function AreasAdmin() {
235
240
  });
236
241
  }
237
242
  const AreasViewerRoot = styled("div")`
238
-
239
243
  /* display: flex; */
240
244
  width: 100%;
241
245
  height: 100%;
242
246
  overflow: hidden;
243
247
  /* flex-grow: 1; */
244
248
  position: relative;
245
-
246
-
247
249
 
248
250
  //areaRoot
249
251
  & .${areasViewerClasses.areaRoot} {
@@ -266,7 +268,6 @@ const AreasViewerRoot = styled("div")`
266
268
  }
267
269
 
268
270
  &.${areasViewerClasses.isMobile} .${areasViewerClasses.areaRoot} {
269
-
270
271
  }
271
272
 
272
273
  // areaGridLayoutPanelContainer
@@ -282,7 +283,7 @@ const AreasViewerRoot = styled("div")`
282
283
  }
283
284
  // areaGridLayout
284
285
  & .${areasViewerClasses.areaGridLayout} {
285
- height: 100%!important;
286
+ height: 100% !important;
286
287
  overflow: auto;
287
288
  flex-grow: 1;
288
289
  }
@@ -313,76 +314,12 @@ const AreasViewerRoot = styled("div")`
313
314
  }
314
315
 
315
316
  // windowRoot
316
- & .${areasViewerClasses.windowRoot} {
317
- inset:0;
318
- position: absolute;
319
- display: flex;
320
- flex-direction: column;
321
- /* height: 100%; */
322
- /* width: 100%; */
323
- overflow: hidden;
324
- border: 1px solid gray;
325
-
326
- background-color: ${(props) => props.theme.palette.background.default};
327
- padding: ${(props) => props.theme.spacing(0)};
328
- }
329
-
330
- & .${areasViewerClasses.windowRoot}.${areasViewerClasses.selected} {
331
- border-top: 1px solid green;
332
- }
333
- // windowHeader
334
- & .${areasViewerClasses.windowHeader} {
335
- display: flex;
336
- gap: 4px;
337
-
338
- align-items: center;
339
- position: relative;
340
-
341
- padding: 8px;
342
- justify-content: end;
343
- min-height: ${(props) => props.theme.spacing(5)} ;
344
-
345
- border-bottom: 1px solid ${(props) => props.theme.palette.divider},
346
- overflow: hidden;
347
- cursor: move;
348
- height: 60px;
349
-
350
-
351
-
352
- > span: {
353
- margin-right: 12px;
354
- }
355
- }
356
- // windowHeaderTitle
357
- & .${areasViewerClasses.windowHeaderTitle} {
358
- width: 100%;
359
- max-width: 100%;
360
- overflow: hidden;
361
- white-space: nowrap;
362
- color: ${(props) => props.theme.palette.text.primary};
363
- margin-left: 12px;
364
- margin-right: 24px;
365
- text-overflow: ellipsis;
366
- }
367
- // windowHeaderMainActions
368
- & .${areasViewerClasses.windowHeaderMainActions} {
369
- display: flex;
370
-
371
- gap: 4px;
372
- }
373
-
374
-
375
- // windowHeaderMainActions
376
- & .${areasViewerClasses.windowContent} {
377
- flex-grow: 1;
378
- position: relative;
379
- }
380
317
 
381
318
  // windowModalRoot
382
- & .${areasViewerClasses.windowModalRoot} .${areasViewerClasses.windowRoot}{
319
+ & .${areasViewerClasses.windowModalRoot} {
383
320
  padding: 16px;
384
321
  }
385
-
322
+
386
323
  .react-grid-layout {
387
324
  position: relative;
388
325
  transition: height 200ms ease;
@@ -393,7 +330,7 @@ const AreasViewerRoot = styled("div")`
393
330
  }
394
331
  .react-grid-item img {
395
332
  pointer-events: none;
396
- user-select: none;
333
+ user-select: none;
397
334
  }
398
335
  .react-grid-item.cssTransforms {
399
336
  transition-property: transform;
@@ -432,7 +369,7 @@ const AreasViewerRoot = styled("div")`
432
369
  }
433
370
 
434
371
  .react-grid-item > .react-resizable-handle::after {
435
- content: "";
372
+ content: '';
436
373
  position: absolute;
437
374
  right: 3px;
438
375
  bottom: 3px;
@@ -498,747 +435,10 @@ const AreasViewerRoot = styled("div")`
498
435
  transform: rotate(45deg);
499
436
  }
500
437
 
501
-
502
438
  ${react_resizable_css}
503
439
 
504
-
505
440
  ${(props) => props.theme.components?.M4LAreasViewer?.styleOverrides}
506
-
507
-
508
441
  `;
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
442
  styled("div")(({
1243
443
  theme
1244
444
  }) => ({
@@ -1429,24 +629,32 @@ function getMainActions(isDesktop, moduleActions) {
1429
629
  );
1430
630
  return mainActions;
1431
631
  }
1432
- function getMenuActions(isDesktop, moduleActions, urlPrefix, saveModuleCookies, version) {
632
+ function getMenuActions(windowId, isDesktop, moduleActions, urlPrefix, saveModuleCookies, resetModuleCookies, version) {
1433
633
  let menuActions = [...moduleActions.filter((action) => action.visibility !== "allways")];
1434
634
  if (isDesktop !== void 0 && isDesktop) {
1435
635
  menuActions = menuActions.filter((action) => action.visibility === "normal");
1436
636
  }
1437
- console.log("getMenuActions", version);
1438
- const savePropsAction = {
1439
- urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/split_vertical.svg`,
1440
- onClick: () => saveModuleCookies,
637
+ const saveCookiesAction = {
638
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.SAVE_COOKIES}`,
639
+ onClick: () => saveModuleCookies(windowId),
1441
640
  disabled: false,
1442
641
  visibility: "normal",
1443
642
  dictionaryId: getAreasDictionary("label_persist_module_cookies"),
1444
- key: "save_props"
643
+ key: "save_cookies"
644
+ };
645
+ menuActions.push(saveCookiesAction);
646
+ const resetCookiesAction = {
647
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.RESET_COOKIES}`,
648
+ onClick: () => resetModuleCookies(windowId),
649
+ disabled: false,
650
+ visibility: "normal",
651
+ dictionaryId: getAreasDictionary("label_reset_module_cookies"),
652
+ key: "reset_cookes"
1445
653
  };
1446
- menuActions.push(savePropsAction);
654
+ menuActions.push(resetCookiesAction);
1447
655
  if (version) {
1448
656
  const versionAction = {
1449
- urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/version.svg`,
657
+ urlIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.VERSION}`,
1450
658
  onClick: () => {
1451
659
  },
1452
660
  disabled: true,
@@ -1458,8 +666,14 @@ function getMenuActions(isDesktop, moduleActions, urlPrefix, saveModuleCookies,
1458
666
  }
1459
667
  return menuActions;
1460
668
  }
1461
- function MainActions() {
1462
- const [moduleActions] = useWindowStore((state) => [state.moduleActions], shallow);
669
+ function MainActions(props) {
670
+ const {
671
+ windowId
672
+ } = props;
673
+ const moduleActions = useAreasStore((state) => {
674
+ const window2 = state.hashWindows[windowId];
675
+ return window2?.moduleActions || [];
676
+ }, shallow);
1463
677
  const {
1464
678
  getLabel
1465
679
  } = useModuleDictionary();
@@ -1482,17 +696,24 @@ function MainActions() {
1482
696
  })
1483
697
  });
1484
698
  }
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);
699
+ function Header(props) {
1487
700
  const {
1488
- saveModuleCookies
1489
- } = useWindowStore((state) => state.internalActions);
1490
- const emergeType = useWindowStore((state) => state.emergeType);
1491
- const maximizedId = useAreaStore((state) => state.singleId);
701
+ areaId,
702
+ windowId,
703
+ emergeType
704
+ } = props;
705
+ const [url_icon, title, moduleActions, onClose, version, singleId] = useAreasStore((state) => {
706
+ const window2 = state.hashWindows[windowId];
707
+ return [window2.url_icon, window2.title, window2.moduleActions, window2.onClose, window2.version, state.hashAreas[areaId].singleId];
708
+ }, shallow);
709
+ const {
710
+ saveModuleCookies,
711
+ resetModuleCookies
712
+ } = useAreasStore((state) => state.windowActions, shallow);
1492
713
  const {
1493
714
  maximizeLayout,
1494
715
  normalizeLayouts
1495
- } = useAreaStore((state) => state.actions, shallow);
716
+ } = useAreasStore((state) => state.areaActions, shallow);
1496
717
  const {
1497
718
  host_static_assets,
1498
719
  environment_assets
@@ -1501,16 +722,16 @@ function Header() {
1501
722
  const isSkeleton = useModuleSkeleton();
1502
723
  const urlPrefix = `${host_static_assets}/${environment_assets}`;
1503
724
  const menuActions = useMemo(() => {
1504
- return getMenuActions(isDesktop, moduleActions, urlPrefix, saveModuleCookies, version);
725
+ return getMenuActions(windowId, isDesktop, moduleActions, urlPrefix, saveModuleCookies, resetModuleCookies, version);
1505
726
  }, [moduleActions, isDesktop]);
1506
727
  const onCloseLocal = () => {
1507
- onClose && onClose(container_id);
728
+ onClose && onClose(windowId);
1508
729
  };
1509
730
  const maxNormalize = () => {
1510
- if (maximizedId) {
1511
- normalizeLayouts();
731
+ if (singleId) {
732
+ normalizeLayouts(areaId);
1512
733
  } else {
1513
- maximizeLayout(container_id);
734
+ maximizeLayout(areaId, windowId);
1514
735
  }
1515
736
  };
1516
737
  if (isSkeleton) {
@@ -1525,10 +746,12 @@ function Header() {
1525
746
  className: areasViewerClasses.windowHeaderTitle,
1526
747
  variant: "h5",
1527
748
  children: `${title}`
1528
- }), /* @__PURE__ */ jsx(MainActions, {}), isDesktop && emergeType === "layout" && /* @__PURE__ */ jsx(IconButton, {
749
+ }), /* @__PURE__ */ jsx(MainActions, {
750
+ windowId
751
+ }), isDesktop && emergeType === "layout" && /* @__PURE__ */ jsx(IconButton, {
1529
752
  onClick: maxNormalize,
1530
753
  "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}`
754
+ 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
755
  }), menuActions.length > 0 && /* @__PURE__ */ jsx(MenuActions, {
1533
756
  arrowType: "no-arrow",
1534
757
  marginTop: "12px!important",
@@ -1795,7 +1018,11 @@ function MFLoader(props) {
1795
1018
  }, [divScript]);
1796
1019
  return /* @__PURE__ */ jsxs(Fragment, {
1797
1020
  children: [/* @__PURE__ */ jsx("div", {
1798
- id: divScript.divContainerId
1021
+ id: divScript.divContainerId,
1022
+ style: {
1023
+ width: "100%",
1024
+ height: "100%"
1025
+ }
1799
1026
  }), isLoading ? /* @__PURE__ */ jsx(LoadingMF, {
1800
1027
  loadingProgress: networkProgress,
1801
1028
  setNetworkRefresh
@@ -1807,84 +1034,195 @@ MFLoader.defaultProps = {
1807
1034
  window
1808
1035
  };
1809
1036
  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
1037
  return /* @__PURE__ */ jsx(MFLoader, {
1814
- ...props,
1815
- moduleId,
1816
- dynamicMFStore,
1817
- windowTools: {
1818
- ...actions
1819
- }
1038
+ ...props
1820
1039
  });
1821
1040
  };
1822
- React__default.memo(MicroFrontend);
1823
- const InnerForHooks$1 = (props) => {
1041
+ const MemonizedMicroFrontend = React__default.memo(MicroFrontend);
1042
+ const Component = (props) => {
1824
1043
  const {
1825
- winType
1044
+ component,
1045
+ dynamicMFStore,
1046
+ windowTools
1826
1047
  } = 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
- })]
1048
+ return /* @__PURE__ */ jsx(WindowToolsMFProvider, {
1049
+ ...windowTools,
1050
+ children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, {
1051
+ store: dynamicMFStore,
1052
+ children: typeof component === "function" ? component() : component
1053
+ })
1840
1054
  });
1841
1055
  };
1842
- React__default.memo(InnerForHooks$1);
1056
+ React__default.memo(Component);
1057
+ const WindowRoot = styled("div")`
1058
+
1059
+ inset:0;
1060
+ position: absolute;
1061
+ display: flex;
1062
+ flex-direction: column;
1063
+ /* height: 100%; */
1064
+ /* width: 100%; */
1065
+ overflow: hidden;
1066
+ border: 1px solid gray;
1067
+
1068
+ background-color: ${(props) => props.theme.palette.background.default};
1069
+ padding: ${(props) => props.theme.spacing(0)};
1070
+ &.${areasViewerClasses.selected} {
1071
+ border-top: 1px solid green;
1072
+ }
1073
+ &.${areasViewerClasses.loading} {
1074
+ border-left: 2px solid red;
1075
+ }
1076
+ // windowHeader
1077
+ & .${areasViewerClasses.windowHeader} {
1078
+ display: flex;
1079
+ gap: 4px;
1080
+
1081
+ align-items: center;
1082
+ position: relative;
1083
+
1084
+ padding: 8px;
1085
+ justify-content: end;
1086
+ min-height: ${(props) => props.theme.spacing(5)} ;
1087
+
1088
+ border-bottom: 1px solid ${(props) => props.theme.palette.divider},
1089
+ overflow: hidden;
1090
+ cursor: move;
1091
+ height: 60px;
1092
+
1093
+
1094
+
1095
+ > span: {
1096
+ margin-right: 12px;
1097
+ }
1098
+ }
1099
+ // windowHeaderTitle
1100
+ & .${areasViewerClasses.windowHeaderTitle} {
1101
+ width: 100%;
1102
+ max-width: 100%;
1103
+ overflow: hidden;
1104
+ white-space: nowrap;
1105
+ color: ${(props) => props.theme.palette.text.primary};
1106
+ margin-left: 12px;
1107
+ margin-right: 24px;
1108
+ text-overflow: ellipsis;
1109
+ }
1110
+ // windowHeaderMainActions
1111
+ & .${areasViewerClasses.windowHeaderMainActions} {
1112
+ display: flex;
1113
+
1114
+ gap: 4px;
1115
+ }
1116
+
1117
+
1118
+ // windowHeaderMainActions
1119
+ & .${areasViewerClasses.windowContent} {
1120
+ flex-grow: 1;
1121
+ position: relative;
1122
+ }
1123
+
1124
+ // windowModalRoot
1125
+ & .${areasViewerClasses.windowModalRoot} {
1126
+ padding: 16px;
1127
+ }
1128
+
1129
+ ${(props) => props.theme.components?.M4LAreasViewerWindow?.styleOverrides}
1130
+
1131
+
1132
+ `;
1843
1133
  const Window = (props) => {
1844
1134
  const {
1845
- emergeType
1135
+ emergeType,
1136
+ windowId,
1137
+ moduleId,
1138
+ areaId
1846
1139
  } = props;
1847
- const selected = useAreaStore((state) => emergeType === "layout" ? state.currentLayoutId : state.currentPopUpId) === props.windowId;
1140
+ const selected = useAreasStore((state) => emergeType === "layout" ? state.hashAreas[areaId].currentLayoutId : state.hashAreas[areaId].currentPopUpId) === windowId;
1141
+ const wd = useAreasStore((state) => state.hashWindows[windowId], shallow);
1142
+ const {
1143
+ setActions,
1144
+ getCookie,
1145
+ getCookies,
1146
+ setCookie,
1147
+ close,
1148
+ setLoading
1149
+ } = useAreasStore((state) => state.windowActions, shallow);
1848
1150
  const {
1849
1151
  selectWindowPopUp,
1850
1152
  selectWindowLayout
1851
- } = useAreaStore((state) => state.actions);
1153
+ } = useAreasStore((state) => state.areaActions);
1154
+ const {
1155
+ loadCookiesFromApi
1156
+ } = useAreasStore((state) => state.windowActions);
1852
1157
  const onTouch = () => {
1853
1158
  if (!selected) {
1854
1159
  if (emergeType === "popup") {
1855
- selectWindowPopUp(props.windowId);
1160
+ selectWindowPopUp(areaId, props.windowId);
1856
1161
  } else if (emergeType === "layout") {
1857
- selectWindowLayout(props.windowId);
1162
+ selectWindowLayout(areaId, props.windowId);
1858
1163
  }
1859
1164
  }
1860
1165
  };
1861
- return /* @__PURE__ */ jsx("div", {
1166
+ const windowTools = useMemo(() => ({
1167
+ getWindowId: () => windowId,
1168
+ setActions: (newActions, version) => {
1169
+ setActions(windowId, newActions, version);
1170
+ },
1171
+ getCookie: (id) => getCookie(windowId, id),
1172
+ getCookies: (type) => getCookies(windowId, type),
1173
+ setCookie: (id, type, cookie) => {
1174
+ setCookie(windowId, id, type, cookie);
1175
+ },
1176
+ close: () => close(windowId),
1177
+ setLoading: (isLoading) => {
1178
+ setLoading(windowId, isLoading);
1179
+ }
1180
+ }), []);
1181
+ useEffect(() => {
1182
+ loadCookiesFromApi(windowId);
1183
+ }, []);
1184
+ return /* @__PURE__ */ jsxs(WindowRoot, {
1862
1185
  role: "presentation",
1863
- className: clsx(areasViewerClasses.windowRoot, selected ? areasViewerClasses.selected : null),
1186
+ className: clsx(areasViewerClasses.windowRoot, selected ? areasViewerClasses.selected : null, wd.loading ? areasViewerClasses.loading : null),
1864
1187
  onMouseDown: onTouch,
1865
- children: /* @__PURE__ */ jsx(WindowMFProvider, {
1866
- ...props,
1867
- children: /* @__PURE__ */ jsx(InnerForHooks$1, {
1868
- ...props
1188
+ children: [/* @__PURE__ */ jsx(Header, {
1189
+ areaId,
1190
+ windowId,
1191
+ emergeType
1192
+ }), /* @__PURE__ */ jsx("div", {
1193
+ className: areasViewerClasses.windowContent,
1194
+ children: wd.status === "init" ? /* @__PURE__ */ jsx("div", {
1195
+ children: "BRUCE cargando"
1196
+ }) : wd.winType === "microfrontend" ? /* @__PURE__ */ jsx(MemonizedMicroFrontend, {
1197
+ moduleId,
1198
+ dynamicMFStore: wd.dynamicMFStore,
1199
+ windowTools,
1200
+ ...wd.mfProps
1201
+ }) : /* @__PURE__ */ jsx(Component, {
1202
+ moduleId,
1203
+ dynamicMFStore: wd.dynamicMFStore,
1204
+ windowTools,
1205
+ component: wd.component
1869
1206
  })
1870
- })
1207
+ })]
1871
1208
  });
1872
1209
  };
1873
1210
  const MemonizedWindow = React__default.memo(Window);
1874
1211
  const WindowPopUp = (props) => {
1875
1212
  const {
1213
+ areaId,
1876
1214
  windowProps,
1877
1215
  windowId
1878
1216
  } = props;
1879
1217
  const {
1880
1218
  selectWindowPopUp
1881
- } = useAreaStore((store) => store.actions);
1882
- const selectedPopUpId = useAreaStore((store) => store.currentPopUpId);
1883
- const zIndex = useAreaStore((store) => store.hashWindowsPopups[props.windowId].zIndex);
1219
+ } = useAreasStore((store) => store.areaActions);
1220
+ const selectedPopUpId = useAreasStore((store) => store.hashAreas[areaId].currentPopUpId);
1221
+ const zIndex = useAreasStore((store) => store.hashAreas[areaId].hashWindowsPopups[props.windowId].zIndex);
1884
1222
  const isSelected = props.windowId === selectedPopUpId;
1885
1223
  const onTouch = () => {
1886
1224
  if (!isSelected) {
1887
- selectWindowPopUp(props.windowId);
1225
+ selectWindowPopUp(areaId, props.windowId);
1888
1226
  }
1889
1227
  };
1890
1228
  return /* @__PURE__ */ jsx(DraggableWindow, {
@@ -1909,105 +1247,51 @@ const WindowPopUp = (props) => {
1909
1247
  });
1910
1248
  };
1911
1249
  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
1250
  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);
1251
+ const GridLayout = (props) => {
1252
+ const {
1253
+ areaId
1254
+ } = props;
1255
+ const windowsLayouts = useAreasStore((state) => state.hashAreas[areaId].windowsLayouts, shallow);
1256
+ const hashWindowsPopups = useAreasStore((state) => state.hashAreas[areaId].hashWindowsPopups, shallow);
1257
+ const hashWindowsLayouts = useAreasStore((state) => state.hashAreas[areaId].hashWindowsLayouts, shallow);
1258
+ const breakPointsLayouts = useAreasStore((state) => state.hashAreas[areaId].breakPointsLayouts, shallow);
1259
+ const windowsPopUps = useAreasStore((state) => state.hashAreas[areaId].windowsPopUps, shallow);
1260
+ const breakpoints = useAreasStore((state) => state.hashAreas[areaId].breakpoints, shallow);
1261
+ const viewMode = useAreasStore((state) => state.hashAreas[areaId].viewMode, shallow);
1262
+ const cols = useAreasStore((state) => state.hashAreas[areaId].cols, shallow);
1984
1263
  const {
1985
1264
  onBreakpointsLayoutsChange
1986
- } = useAreaStore((state) => state.actions);
1265
+ } = useAreasStore((state) => state.areaActions, shallow);
1987
1266
  function onBreakpointChange(_newBreakpoint, _newCols) {
1988
1267
  }
1989
1268
  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, {
1269
+ setTimeout(() => {
1270
+ window.dispatchEvent(new Event("resize"));
1271
+ }, 100);
1272
+ }, [viewMode, windowsLayouts]);
1273
+ return /* @__PURE__ */ jsxs(
1274
+ ResponsiveGridLayout,
1275
+ {
1995
1276
  autoSize: false,
1996
1277
  compactType: "vertical",
1997
1278
  measureBeforeMount: true,
1998
1279
  resizeHandles: ["nw", "se"],
1999
- className: areasViewerClasses.areaGridLayout,
1280
+ className: clsx(areasViewerClasses.areaGridLayout, `${areasViewerClasses.areaGridLayout}-${areaId}`),
2000
1281
  layouts: breakPointsLayouts,
2001
- onLayoutChange: onBreakpointsLayoutsChange,
1282
+ onLayoutChange: (currentLayouts, newAllLayouts) => onBreakpointsLayoutsChange(areaId, currentLayouts, newAllLayouts),
2002
1283
  onBreakpointChange,
2003
1284
  breakpoints,
2004
1285
  cols,
2005
1286
  rowHeight: ROW_HEIGTH_GRIDLAYOUT,
2006
- margin: [5, 5],
1287
+ margin: [MARGIN_GRIDLAYOUT, MARGIN_GRIDLAYOUT],
2007
1288
  containerPadding: [CONTAINER_PADDING_GRIDLAYOUT, CONTAINER_PADDING_GRIDLAYOUT],
2008
1289
  draggableHandle: ".m4l_draggable_handle",
2009
- isBounded: false,
1290
+ onWidthChange: () => {
1291
+ console.log("onWidthChange", areaId);
1292
+ },
2010
1293
  preventCollision: false,
1294
+ verticalCompact: true,
2011
1295
  children: [/* @__PURE__ */ jsx("div", {
2012
1296
  className: areasViewerClasses.areaGridLayoutPopupsContainer,
2013
1297
  "data-grid": {
@@ -2032,7 +1316,7 @@ const GridLayout = () => {
2032
1316
  }
2033
1317
  return null;
2034
1318
  })
2035
- }, "none"), gridLayouts.map((l) => {
1319
+ }, "none"), windowsLayouts.map((l) => {
2036
1320
  if (hashWindowsLayouts[l.i]) {
2037
1321
  return /* @__PURE__ */ jsx("div", {
2038
1322
  children: /* @__PURE__ */ jsx(MemonizedWindow, {
@@ -2042,40 +1326,31 @@ const GridLayout = () => {
2042
1326
  }
2043
1327
  return null;
2044
1328
  })]
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
- }
1329
+ }
1330
+ );
2059
1331
  };
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);
1332
+ const PanelWindows = (props) => {
1333
+ const {
1334
+ areaId
1335
+ } = props;
1336
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
1337
+ const mode = useAreasStore((state) => state.hashAreas[areaId].viewMode);
1338
+ const singleId = useAreasStore((state) => state.hashAreas[areaId].singleId);
1339
+ const windowsLayouts = useAreasStore((state) => state.hashAreas[areaId].windowsLayouts, shallow);
1340
+ const hashWindowsLayouts = useAreasStore((state) => state.hashAreas[areaId].hashWindowsLayouts, shallow);
2066
1341
  const {
2067
1342
  maximizeLayout
2068
- } = useAreaStore((state) => state.actions);
1343
+ } = useAreasStore((state) => state.areaActions);
2069
1344
  const onTouched = (layoutId) => {
2070
- maximizeLayout(layoutId);
1345
+ maximizeLayout(areaId, layoutId);
2071
1346
  };
2072
1347
  if (status === "loaded") {
2073
- if (mode !== "single" || gridLayouts.length < 2) {
1348
+ if (mode !== "single" || windowsLayouts.length < 2) {
2074
1349
  return null;
2075
1350
  }
2076
1351
  return /* @__PURE__ */ jsx("div", {
2077
1352
  className: areasViewerClasses.panelWindowsRoot,
2078
- children: gridLayouts.map((l) => {
1353
+ children: windowsLayouts.map((l) => {
2079
1354
  return /* @__PURE__ */ jsx("div", {
2080
1355
  className: clsx(areasViewerClasses.panelWindowsButtonContainer, singleId === l.i ? areasViewerClasses.selected : null),
2081
1356
  children: /* @__PURE__ */ jsx(IconButton, {
@@ -2090,51 +1365,150 @@ const PanelWindows = () => {
2090
1365
  return null;
2091
1366
  }
2092
1367
  };
1368
+ const InnerForHooks = (props) => {
1369
+ const {
1370
+ areaId
1371
+ } = props;
1372
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
1373
+ return /* @__PURE__ */ jsxs("div", {
1374
+ className: clsx(areasViewerClasses.areaGridLayoutPanelContainer, `${areasViewerClasses.areaGridLayoutPanelContainer}-${areaId}`),
1375
+ children: [
1376
+ status === "loaded" ? /* @__PURE__ */ jsx(GridLayout, {
1377
+ areaId
1378
+ }) : /* @__PURE__ */ jsx("div", {
1379
+ children: "Loading.. Intentar si falla."
1380
+ }),
1381
+ /* @__PURE__ */ jsx(PanelWindows, {
1382
+ areaId
1383
+ })
1384
+ ]
1385
+ });
1386
+ };
2093
1387
  const Area = (props) => {
2094
1388
  const {
2095
- selected
1389
+ selected,
1390
+ areaId
2096
1391
  } = props;
2097
1392
  const classesAreaRoot = useAreasStore((state) => state.viwerClasses.areaRoot);
1393
+ const status = useAreasStore((state) => state.hashAreas[areaId].status);
1394
+ const {
1395
+ resizeMaximixedLayout
1396
+ } = useAreasStore((state) => state.areaActions, shallow);
1397
+ const throttleResizeMaximixedLayout = throttle(() => {
1398
+ console.log("throttleResizeMaximixedLayout", areaId);
1399
+ resizeMaximixedLayout(areaId);
1400
+ }, THROTTLE_RESIZE_TIME, {
1401
+ leading: false
1402
+ });
1403
+ const onResize = useCallback((_target) => {
1404
+ throttleResizeMaximixedLayout();
1405
+ }, []);
1406
+ const ref = useResizeObserver(onResize);
1407
+ if (status === "init") {
1408
+ return null;
1409
+ }
2098
1410
  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
- })
1411
+ className: clsx(classesAreaRoot, selected ? areasViewerClasses.selected : null, status === "loading" ? areasViewerClasses.loading : null),
1412
+ ref,
1413
+ children: /* @__PURE__ */ jsx(InnerForHooks, {
1414
+ areaId
2106
1415
  })
2107
1416
  });
2108
1417
  };
2109
1418
  Area.displayName = "Area";
1419
+ styled("div")(({ theme }) => ({
1420
+ display: "flex",
1421
+ flexDirection: "column",
1422
+ height: "100%",
1423
+ overflow: "hidden",
1424
+ padding: theme.spacing(3)
1425
+ }));
1426
+ const WrapperWindowModal = styled(Dialog)(({ theme }) => ({
1427
+ hola: 1,
1428
+ backgroundColor: theme.palette.background.paper,
1429
+ "& .MuiDialog-container": {},
1430
+ "&.m4l_selected": {
1431
+ borderTop: "1px solid green"
1432
+ },
1433
+ ...theme.components?.M4LAreasViewerModal?.styleOverrides
1434
+ }));
1435
+ const WindowModal = (props) => {
1436
+ const {
1437
+ windowId
1438
+ } = props;
1439
+ const {
1440
+ onClose
1441
+ } = useAreasStore((state) => state.hashWindowsModals[windowId]);
1442
+ const isDesktop = useResponsiveDesktop();
1443
+ const DragabblePaperComponent = (_props) => {
1444
+ return /* @__PURE__ */ jsx(cjs.exports, {
1445
+ handle: ".m4l_draggable_handle",
1446
+ bounds: "parent",
1447
+ children: /* @__PURE__ */ jsx(ResizeableWindow, {
1448
+ width: props.windowProps?.width || 400,
1449
+ height: props.windowProps?.height || 300,
1450
+ children: /* @__PURE__ */ jsx(Window, {
1451
+ ...props
1452
+ })
1453
+ })
1454
+ });
1455
+ };
1456
+ function PaperComponent(_props) {
1457
+ return /* @__PURE__ */ jsx(Window, {
1458
+ ...props
1459
+ });
1460
+ }
1461
+ return /* @__PURE__ */ jsx(WrapperWindowModal, {
1462
+ className: areasViewerClasses.windowModalRoot,
1463
+ open: true,
1464
+ scroll: "paper",
1465
+ onKeyDown: (event) => {
1466
+ if (event.key === "Escape") {
1467
+ onClose && onClose(windowId);
1468
+ }
1469
+ },
1470
+ "aria-labelledby": "child-modal-title",
1471
+ "aria-describedby": "child-modal-description",
1472
+ PaperComponent: isDesktop ? DragabblePaperComponent : PaperComponent,
1473
+ maxWidth: false,
1474
+ fullWidth: !isDesktop,
1475
+ fullScreen: false,
1476
+ disableEnforceFocus: true
1477
+ });
1478
+ };
1479
+ const MemonizedWindowModal = React__default.memo(WindowModal);
2110
1480
  function AreasViewer() {
2111
- const areas = useAreasStore((state) => state.areas);
2112
- const currentArea = useAreasStore((state) => state.currentArea);
1481
+ const areas = useAreasStore((state) => state.areas, shallow);
1482
+ const windowsModals = useAreasStore((state) => state.windowsModals);
1483
+ const hashWindowsModals = useAreasStore((state) => state.hashWindowsModals);
1484
+ const currentArea = useAreasStore((state) => state.currentAreaId);
2113
1485
  const status = useAreasStore((state) => state.ownerState.status);
2114
1486
  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
- })
1487
+ return /* @__PURE__ */ jsxs(Fragment, {
1488
+ children: [/* @__PURE__ */ jsx(AreasViewerRoot, {
1489
+ className: classesRoot,
1490
+ children: status === "loaded" ? areas.map((area) => {
1491
+ return /* @__PURE__ */ jsx(Area, {
1492
+ areaId: area.id,
1493
+ selected: currentArea === area.id
1494
+ }, area.id);
1495
+ }) : /* @__PURE__ */ jsx(Fragment, {
1496
+ children: "Bruce cargando"
1497
+ })
1498
+ }), windowsModals.map((wm) => {
1499
+ if (hashWindowsModals[wm]) {
1500
+ return /* @__PURE__ */ jsx(MemonizedWindowModal, {
1501
+ ...hashWindowsModals[wm]
1502
+ }, wm);
1503
+ }
1504
+ return null;
1505
+ })]
2126
1506
  });
2127
1507
  }
2128
1508
  export {
2129
- AreaContext as A,
2130
- DynamicMFParmsContext as D,
2131
- MemonizedDynamicMFParmsProvider as M,
2132
- WindowContext as W,
1509
+ AreasAdmin as A,
2133
1510
  useAreasAdminUtilityClasses as a,
2134
- WindowToolsMFContext as b,
2135
- AreasAdmin as c,
2136
- AreasViewer as d,
2137
- WindowToolsMFProvider as e,
2138
- DynamicMFParmsProvider as f,
1511
+ areasViewerClasses as b,
1512
+ AreasViewer as c,
2139
1513
  useAreasViewerUtilityClasses as u
2140
1514
  };