@m4l/components 9.1.126 → 9.1.128

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 (81) hide show
  1. package/.storybook/constants.d.ts +1 -0
  2. package/.storybook/utils/getStylesColorsByMode.d.ts +4 -4
  3. package/@types/export.d.ts +0 -3
  4. package/components/LanguagePopover/LanguagePopover.d.ts +14 -7
  5. package/components/LanguagePopover/LanguagePopover.js +67 -134
  6. package/components/LanguagePopover/LanguagePopover.styles.d.ts +2 -0
  7. package/components/LanguagePopover/LanguagePopover.styles.js +19 -0
  8. package/components/LanguagePopover/constants.d.ts +1 -0
  9. package/components/LanguagePopover/constants.js +4 -0
  10. package/components/LanguagePopover/slots/LanguagePopoverEnum.d.ts +5 -0
  11. package/components/LanguagePopover/slots/LanguagePopoverEnum.js +9 -0
  12. package/components/LanguagePopover/slots/LanguagePopoverSlots.d.ts +5 -0
  13. package/components/LanguagePopover/slots/LanguagePopoverSlots.js +24 -0
  14. package/components/LanguagePopover/tests/LanguagePopover.test.d.ts +1 -0
  15. package/components/LanguagePopover/types.d.ts +17 -7
  16. package/components/MFIsolationApp/MFIsolationApp.js +4 -4
  17. package/components/MenuActions/MenuActions.js +23 -6
  18. package/components/MenuActions/MenuActions.styles.js +1 -1
  19. package/components/MenuActions/types.d.ts +6 -1
  20. package/components/ToastContainer/ToastContainer.styles.js +1 -1
  21. package/components/WindowBase/WindowBase.js +37 -36
  22. package/components/WindowBase/WindowBase.styles.js +14 -0
  23. package/components/WindowBase/slots/WindowBaseEnum.d.ts +2 -1
  24. package/components/WindowBase/slots/WindowBaseEnum.js +1 -0
  25. package/components/WindowBase/slots/WindowBaseSlots.d.ts +3 -0
  26. package/components/WindowBase/slots/WindowBaseSlots.js +9 -4
  27. package/components/{popups/components/PopupsViewer/subcomponents/Popup/subcomponents/EditionInfo/index.d.ts → WindowBase/subcomponents/EditionInfo/EditionInfo.d.ts} +1 -1
  28. package/components/{popups/components/PopupsViewer/subcomponents/Popup/subcomponents/EditionInfo/index.js → WindowBase/subcomponents/EditionInfo/EditionInfo.js} +4 -4
  29. package/components/WindowBase/subcomponents/EditionInfo/types.d.ts +2 -0
  30. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +1 -1
  31. package/components/WindowBase/types.d.ts +4 -0
  32. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/useHeaderActions.d.ts +1 -1
  33. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/useHeaderActions.js +7 -7
  34. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow/useWindow.js +10 -1
  35. package/components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.d.ts +3 -9
  36. package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.d.ts +2 -8
  37. package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.js +216 -131
  38. package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +75 -0
  39. package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups/helper.d.ts +28 -0
  40. package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups/helper.js +44 -0
  41. package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups/useHeaderActionsPopups.d.ts +21 -0
  42. package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups/useHeaderActionsPopups.js +157 -0
  43. package/components/popups/components/PopupsProvider/hooks/usePopops/usePopups.d.ts +28 -0
  44. package/components/popups/components/PopupsProvider/hooks/usePopops/usePopups.js +117 -0
  45. package/components/popups/components/PopupsProvider/tests/PopupsProvider.test.d.ts +1 -0
  46. package/components/popups/components/PopupsViewer/PopupsViewer.d.ts +27 -4
  47. package/components/popups/components/PopupsViewer/PopupsViewer.js +2 -3
  48. package/components/popups/components/PopupsViewer/PopupsViewer.styles.js +7 -10
  49. package/components/popups/components/PopupsViewer/constants.d.ts +1 -0
  50. package/components/popups/components/PopupsViewer/constants.js +3 -1
  51. package/components/popups/components/PopupsViewer/slots/popupsViewerSlots.d.ts +3 -3
  52. package/components/popups/components/PopupsViewer/slots/popupsViewerSlots.js +10 -15
  53. package/components/popups/components/PopupsViewer/slots/slots.d.ts +2 -2
  54. package/components/popups/components/PopupsViewer/slots/slots.js +1 -1
  55. package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +134 -0
  56. package/components/popups/components/PopupsViewer/tests/PopupsViewer.test.d.ts +1 -0
  57. package/components/popups/components/PopupsViewer/types.d.ts +2 -0
  58. package/index.js +8 -7
  59. package/mockServiceWorker.js +1 -1
  60. package/package.json +1 -1
  61. package/vendor.js +2 -1
  62. package/components/LanguagePopover/classes/constants.d.ts +0 -1
  63. package/components/LanguagePopover/classes/constants.js +0 -4
  64. package/components/LanguagePopover/classes/index.d.ts +0 -12
  65. package/components/LanguagePopover/classes/index.js +0 -33
  66. package/components/LanguagePopover/classes/types.d.ts +0 -8
  67. package/components/LanguagePopover/styles.d.ts +0 -5
  68. package/components/LanguagePopover/styles.js +0 -30
  69. package/components/LanguagePopover/tests/constants.d.ts +0 -1
  70. package/components/LanguagePopover/tests/constants.js +0 -4
  71. package/components/popups/components/PopupsViewer/stories/basic.stories.d.ts +0 -19
  72. package/components/popups/components/PopupsViewer/stories/constants.d.ts +0 -6
  73. package/components/popups/components/PopupsViewer/stories/dictionary.d.ts +0 -1
  74. package/components/popups/components/PopupsViewer/stories/subcomponents/PopupContentExample.d.ts +0 -4
  75. package/components/popups/components/PopupsViewer/stories/types.d.ts +0 -3
  76. package/components/popups/components/PopupsViewer/subcomponents/Popup/index.js +0 -68
  77. package/components/popups/components/PopupsViewer/subcomponents/Popup/subcomponents/EditionInfo/types.d.ts +0 -2
  78. package/components/popups/components/PopupsViewer/subcomponents/Popup/subcomponents/Header/index.d.ts +0 -5
  79. package/components/popups/components/PopupsViewer/subcomponents/Popup/subcomponents/Header/index.js +0 -53
  80. package/components/popups/components/PopupsViewer/subcomponents/Popup/subcomponents/Header/types.d.ts +0 -2
  81. /package/components/popups/components/PopupsViewer/subcomponents/Popup/{index.d.ts → Popup.d.ts} +0 -0
@@ -0,0 +1,157 @@
1
+ import { useMemo } from "react";
2
+ import { useEnvironment, useModuleDictionary } from "@m4l/core";
3
+ import { u as usePopupsStore } from "../usePopupsStore/index.js";
4
+ import { shallow } from "zustand/shallow";
5
+ import { useResponsiveDesktop } from "@m4l/graphics";
6
+ import { I as ICONS } from "../../../../../areas/icons.js";
7
+ import { g as getMainActions } from "../../../../../areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/helper.js";
8
+ import { g as getMenuActionsForPopups } from "./helper.js";
9
+ import { g as getAreasDictionary, A as AREAS_DICCTIONARY } from "../../../../../areas/dictionary.js";
10
+ const useHeaderActionsPopups = ({
11
+ popupId,
12
+ menuActions = []
13
+ }) => {
14
+ const { host_static_assets, environment_assets } = useEnvironment();
15
+ const { getLabel } = useModuleDictionary();
16
+ const isDesktop = useResponsiveDesktop();
17
+ const urlPrefix = `${host_static_assets}/${environment_assets}`;
18
+ const moduleActions = usePopupsStore(
19
+ (state) => state.hashPopups[popupId]?.moduleActions || [],
20
+ shallow
21
+ );
22
+ const mainActions = useMemo(() => {
23
+ return getMainActions(isDesktop, moduleActions).map((action) => ({
24
+ ...action,
25
+ place: "left",
26
+ iconUrl: action.iconUrl || "",
27
+ label: action.label || ""
28
+ }));
29
+ }, [isDesktop, moduleActions]);
30
+ const windowOptions = usePopupsStore(
31
+ (state) => state.hashPopups[popupId]?.windowOptions,
32
+ shallow
33
+ );
34
+ const menuActionsInside = useMemo(() => {
35
+ return getMenuActionsForPopups({
36
+ popupId,
37
+ isDesktop,
38
+ moduleActions,
39
+ urlPrefix,
40
+ saveModuleCookies: () => {
41
+ throw new Error("Not implemented");
42
+ },
43
+ resetModuleCookies: () => {
44
+ throw new Error("Not implemented");
45
+ },
46
+ windowOptions: {
47
+ allowPersistCookies: false
48
+ },
49
+ getLabel
50
+ }).map((action) => ({
51
+ ...action,
52
+ place: "inside",
53
+ iconUrl: action.iconUrl || "",
54
+ label: action.label || ""
55
+ }));
56
+ }, [
57
+ popupId,
58
+ isDesktop,
59
+ moduleActions,
60
+ urlPrefix,
61
+ windowOptions,
62
+ getLabel
63
+ ]);
64
+ const predefActions = useMemo(() => {
65
+ const groups = {
66
+ left: [],
67
+ inside: [],
68
+ right: []
69
+ };
70
+ menuActions.forEach((action) => {
71
+ if (action.place === "left") {
72
+ groups.left.push(action);
73
+ } else if (action.place === "inside") {
74
+ groups.inside.push(action);
75
+ } else if (action.place === "right") {
76
+ groups.right.push(action);
77
+ }
78
+ });
79
+ return groups;
80
+ }, [menuActions]);
81
+ const collapsed = usePopupsStore(
82
+ (state) => state.hashPopups[popupId]?.collapsed || false,
83
+ shallow
84
+ );
85
+ const maximized = usePopupsStore(
86
+ (state) => state.hashPopups[popupId]?.maximized || false,
87
+ shallow
88
+ );
89
+ const { colapseLayoutItem: collapsePopup, unColapseLayoutItem: uncollapsePopup } = usePopupsStore(
90
+ (state) => state.popupsActions,
91
+ shallow
92
+ );
93
+ const headerRightActions = useMemo(() => {
94
+ const actions = [];
95
+ actions.push({
96
+ place: "right",
97
+ key: "maximize",
98
+ iconUrl: maximized ? `${host_static_assets}/${environment_assets}/frontend/components/popups/assets/icons/${ICONS.NORMALIZE}` : `${host_static_assets}/${environment_assets}/frontend/components/popups/assets/icons/${ICONS.MAXIMIZE}`,
99
+ label: maximized ? getLabel(getAreasDictionary(AREAS_DICCTIONARY.label_minimize_window)) : getLabel(getAreasDictionary(AREAS_DICCTIONARY.label_maximize_window))
100
+ /**
101
+ *
102
+ */
103
+ // onClick: () => {
104
+ // if (maximized) {
105
+ // normalizePopup(windowId);
106
+ // } else {
107
+ // maximizePopup(windowId);
108
+ // }
109
+ // },
110
+ // disabled: false,
111
+ });
112
+ if (!maximized) {
113
+ actions.push({
114
+ place: "right",
115
+ key: "collapseToggle",
116
+ iconUrl: !collapsed ? `${host_static_assets}/${environment_assets}/frontend/components/popups/assets/icons/${ICONS.COLAPSE}` : `${host_static_assets}/${environment_assets}/frontend/components/popups/assets/icons/${ICONS.UNCOLPASE}`,
117
+ label: !collapsed ? getLabel(getAreasDictionary(AREAS_DICCTIONARY.label_collapse_window)) : getLabel(getAreasDictionary(AREAS_DICCTIONARY.label_uncollapse_window)),
118
+ /**
119
+ * Función que se ejecuta al hacer clic en la acción.
120
+ */
121
+ onClick: () => {
122
+ if (collapsed) {
123
+ uncollapsePopup(popupId);
124
+ } else {
125
+ collapsePopup(popupId);
126
+ }
127
+ },
128
+ disabled: false
129
+ });
130
+ }
131
+ return actions;
132
+ }, [
133
+ collapsed,
134
+ maximized,
135
+ host_static_assets,
136
+ environment_assets,
137
+ getLabel,
138
+ popupId,
139
+ collapsePopup,
140
+ uncollapsePopup
141
+ //normalizePopup,
142
+ //maximizePopup,
143
+ ]);
144
+ console.log(headerRightActions);
145
+ const combinedInsideActions = useMemo(() => {
146
+ return [...menuActionsInside, ...predefActions.inside];
147
+ }, [menuActionsInside, predefActions.inside]);
148
+ return {
149
+ leftActions: [...mainActions, ...predefActions.left],
150
+ menuActions: combinedInsideActions,
151
+ rightActions: []
152
+ // rightActions: [...predefActions.right, ...headerRightActions],
153
+ };
154
+ };
155
+ export {
156
+ useHeaderActionsPopups as u
157
+ };
@@ -0,0 +1,28 @@
1
+ import { WindowToolsMF } from '../../../../../areas';
2
+ import { WindowBaseAction } from '../../../../../WindowBase';
3
+ interface UsePopupsReturn {
4
+ moduleId: string;
5
+ winType: any;
6
+ title: string | undefined;
7
+ iconUrl?: string;
8
+ loading?: boolean;
9
+ mfProps: any;
10
+ component: any;
11
+ status: string;
12
+ dynamicMFStore: any;
13
+ windowTools: WindowToolsMF;
14
+ memoizedActions: WindowBaseAction[];
15
+ version?: string;
16
+ }
17
+ /**
18
+ * Hook usePopups
19
+ *
20
+ * Este hook encapsula la lógica relacionada con el estado y las funciones necesarias
21
+ * para el componente Popup. Retorna un objeto con el estado, las acciones y las herramientas
22
+ * de la ventana popup.
23
+ * @param {string} areaId - Identificador del área.
24
+ * @param {string} popupId - Identificador del popup.
25
+ * @returns {Object} Objeto con estado, acciones y herramientas del popup.
26
+ */
27
+ export declare const usePopups: (popupId: string) => UsePopupsReturn;
28
+ export {};
@@ -0,0 +1,117 @@
1
+ import { useMemo } from "react";
2
+ import { shallow } from "zustand/shallow";
3
+ import { u as usePopupsStore } from "../usePopupsStore/index.js";
4
+ import { u as useHeaderActionsPopups } from "../useHeaderActionsPopups/useHeaderActionsPopups.js";
5
+ import { c as createToaster } from "../../../../../ToastContainer/helpers/toaster.js";
6
+ const usePopups = (popupId) => {
7
+ const [
8
+ winType,
9
+ title,
10
+ iconUrl,
11
+ status,
12
+ dynamicMFStore,
13
+ loading,
14
+ version
15
+ ] = usePopupsStore(
16
+ (state) => {
17
+ const popupData = state.hashPopups[popupId];
18
+ return [
19
+ popupData?.winType,
20
+ popupData?.title,
21
+ popupData?.iconUrl,
22
+ popupData?.status,
23
+ popupData?.dynamicMFStore,
24
+ popupData?.loading || false,
25
+ popupData?.version
26
+ ];
27
+ },
28
+ shallow
29
+ );
30
+ const mfProps = usePopupsStore(
31
+ (state) => state.hashPopups[popupId]?.mfProps,
32
+ shallow
33
+ );
34
+ const component = usePopupsStore(
35
+ (state) => state.hashPopups[popupId]?.component,
36
+ shallow
37
+ );
38
+ const {
39
+ setActions,
40
+ closePopup,
41
+ startProgress,
42
+ stopProgress,
43
+ setFnQueryClose,
44
+ setPopupTitle
45
+ } = usePopupsStore((state) => state.popupsActions, shallow);
46
+ const windowTools = useMemo(
47
+ () => ({
48
+ getWindowId: () => popupId,
49
+ setActions: (newActions) => {
50
+ setActions(popupId, newActions, version);
51
+ },
52
+ getCookie: () => {
53
+ throw new Error("getCookie not implemented");
54
+ },
55
+ getCookies: () => {
56
+ throw new Error("getCookies not implemented");
57
+ },
58
+ setCookie: (key, value) => {
59
+ throw new Error(`setCookie not implemented: ${key}, ${value}`);
60
+ },
61
+ close: () => closePopup(popupId),
62
+ startProgress: () => startProgress(popupId),
63
+ stopProgress: () => stopProgress(popupId),
64
+ setFnQueryClose: (fnQueryClose) => setFnQueryClose(popupId, fnQueryClose),
65
+ toast: createToaster(popupId),
66
+ setWindowTitle: (newTitle) => setPopupTitle(popupId, newTitle),
67
+ setEditionInfo: (editionInfo) => {
68
+ throw new Error(`setEditionInfo not implemented: ${editionInfo}`);
69
+ },
70
+ hide: () => {
71
+ throw new Error("hide not implemented");
72
+ },
73
+ show: () => {
74
+ throw new Error("show not implemented");
75
+ }
76
+ }),
77
+ [
78
+ popupId,
79
+ version,
80
+ setActions,
81
+ //getCookie,
82
+ //getCookies,
83
+ //setCookie,
84
+ closePopup,
85
+ startProgress,
86
+ stopProgress,
87
+ setFnQueryClose,
88
+ setPopupTitle
89
+ ]
90
+ );
91
+ const { leftActions, menuActions, rightActions } = useHeaderActionsPopups({
92
+ popupId,
93
+ menuActions: []
94
+ });
95
+ const memoizedActions = useMemo(() => {
96
+ return [...leftActions, ...menuActions, ...rightActions];
97
+ }, [leftActions, menuActions, rightActions]);
98
+ return {
99
+ moduleId: popupId,
100
+ winType,
101
+ title,
102
+ iconUrl,
103
+ //selected,
104
+ mfProps,
105
+ component,
106
+ loading,
107
+ status,
108
+ version,
109
+ dynamicMFStore,
110
+ windowTools,
111
+ //onTouch,
112
+ memoizedActions
113
+ };
114
+ };
115
+ export {
116
+ usePopups as u
117
+ };
@@ -1,7 +1,30 @@
1
1
  /**
2
- * Visor de popups
3
- * - Los popus desplegados depende del store proporcionado por PoupsProvider.
4
- * - Utiliza la librería de tranciones para animar la apertura y cierre de los popups
5
- * - Los popups utilizan el componente DragResizeWindow para poder ser movidos y redimensionados
2
+ * Componente PopupsViewer
3
+ *
4
+ * Este componente se encarga de visualizar y gestionar la animación y el ciclo de vida de
5
+ * los popups en la aplicación. Utiliza la librería `react-transition-group` para manejar las
6
+ * transiciones de entrada y salida de los popups, y `zustand` para gestionar el estado global de
7
+ * los popups.
8
+ *
9
+ * ### Funcionamiento:
10
+ *
11
+ * - **Estado de popups:**
12
+ * Se obtienen los identificadores de los popups activos desde el store mediante `usePopupsStore`,
13
+ * filtrando aquellos popups cuyo estado no sea `'closing'`. Además, se obtiene el valor de `baseZindex`
14
+ * para establecer la jerarquía de apilamiento (z-index) de los popups.
15
+ *
16
+ * - **Contenedor:**
17
+ * Se recupera el elemento contenedor a través del método `getContainer` del store. Si el contenedor o su tamaño
18
+ * no están disponibles, el componente retorna `null` y no se renderiza nada.
19
+ *
20
+ * - **Animaciones:**
21
+ * Cada popup se envuelve en un componente `CSSTransition` para gestionar las animaciones. Se definen
22
+ * las clases CSS correspondientes para la animación de entrada (por ejemplo, 'fade-enter', 'fade-enter-active', etc.).
23
+ * Cuando finaliza la animación de salida, se ejecuta la función `removePopup` para eliminar el popup del estado.
24
+ *
25
+ * - **Renderizado:**
26
+ * Los popups se renderizan dentro de un `TransitionGroup` que gestiona la secuencia de aparición y salida de
27
+ * cada popup. El componente `Popup` recibe propiedades como `popupId`, el contenedor y su tamaño, lo que permite
28
+ * que cada popup se posicione correctamente en la pantalla.
6
29
  */
7
30
  export declare const PopupsViewer: () => import("react/jsx-runtime").JSX.Element | null;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { TransitionGroup, CSSTransition } from "react-transition-group";
3
3
  import { shallow } from "zustand/shallow";
4
- import { P as Popup } from "./subcomponents/Popup/index.js";
4
+ import { P as Popup } from "./subcomponents/Popup/Popup.js";
5
5
  import { u as usePopupsStore } from "../PopupsProvider/hooks/usePopupsStore/index.js";
6
6
  import { u as useSizeContainer } from "../../../../hooks/useSizeContainer/index.js";
7
7
  import { R as RootStyled } from "./slots/popupsViewerSlots.js";
@@ -27,8 +27,6 @@ const PopupsViewer = () => {
27
27
  removePopup(id);
28
28
  },
29
29
  classNames: {
30
- // appear: 'fade-appear', // Clases para la animación de aparición
31
- // appearActive: 'fade-appear-active',
32
30
  enter: "fade-enter",
33
31
  // Clases para la animación de entrada
34
32
  enterActive: "fade-enter-active",
@@ -37,6 +35,7 @@ const PopupsViewer = () => {
37
35
  children: /* @__PURE__ */ jsx(
38
36
  Popup,
39
37
  {
38
+ "data-testid": "popup",
40
39
  popupId: id,
41
40
  containerElement,
42
41
  containerSize
@@ -97,16 +97,6 @@ const popupsViewerStyles = {
97
97
  flexDirection: "column",
98
98
  overflow: "hidden"
99
99
  }),
100
- /**
101
- * TODO: Documentar
102
- */
103
- pDWContentEditionInfo: () => ({
104
- display: "flex",
105
- justifyContent: "flex-end",
106
- "& .M4LIcon-root": {
107
- paddingRight: "8px"
108
- }
109
- }),
110
100
  /**
111
101
  * TODO: Documentar
112
102
  */
@@ -115,6 +105,13 @@ const popupsViewerStyles = {
115
105
  display: "flex",
116
106
  position: "relative",
117
107
  overflow: "auto"
108
+ }),
109
+ /**
110
+ * TODO: Documentar
111
+ */
112
+ windowBaseContent: ({ theme, ownerState }) => ({
113
+ width: "100%",
114
+ height: ownerState.collapsed ? `${theme.vars.size.baseSpacings["sp10-5"]}` : "100%"
118
115
  })
119
116
  };
120
117
  export {
@@ -1,5 +1,6 @@
1
1
  export declare const COMPONENT_TEST_ID = "M4LPopupsViewer";
2
2
  export declare const POPUPS_VIEWER_KEY_COMPONENT = "M4LPopupsViewer";
3
+ export declare const POPUPS_VIEWER_CLASS_NAME = "M4LPopupsViewer";
3
4
  export declare const EARTH_RADIO = 6378137;
4
5
  export declare const DN = 500;
5
6
  export declare const DE = 500;
@@ -1,4 +1,6 @@
1
1
  const POPUPS_VIEWER_KEY_COMPONENT = "M4LPopupsViewer";
2
+ const POPUPS_VIEWER_CLASS_NAME = "M4LPopupsViewer";
2
3
  export {
3
- POPUPS_VIEWER_KEY_COMPONENT as P
4
+ POPUPS_VIEWER_KEY_COMPONENT as P,
5
+ POPUPS_VIEWER_CLASS_NAME as a
4
6
  };
@@ -4,6 +4,9 @@ export declare const RootStyled: import('@emotion/styled').StyledComponent<impor
4
4
  export declare const PopupDragWindowRootStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../../DragResizeWindow/types').DragResizeWindowProps & import('react').RefAttributes<HTMLDivElement>, keyof import('react').RefAttributes<HTMLDivElement> | keyof import('../../../../DragResizeWindow/types').DragResizeWindowProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown> & {
5
5
  ownerState: Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown>;
6
6
  }, {}, {}>;
7
+ export declare const WindowBaseContentStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown> & {
8
+ ownerState: Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown>;
9
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
7
10
  export declare const PopupHeaderContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown> & {
8
11
  ownerState: Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown>;
9
12
  }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
@@ -13,9 +16,6 @@ export declare const PopupHeaderTitleStyled: import('@emotion/styled').StyledCom
13
16
  export declare const PopupHeaderSubTitleStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown> & {
14
17
  ownerState: Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown>;
15
18
  }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, keyof import('react').ClassAttributes<HTMLSpanElement> | keyof import('react').HTMLAttributes<HTMLSpanElement>>, {}>;
16
- export declare const PopupContentEditionInfoStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown> & {
17
- ownerState: Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown>;
18
- }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
19
19
  export declare const PopupContentRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown> & {
20
20
  ownerState: Partial<import('../types').PopupsViewerOwnerState> & Record<string, unknown>;
21
21
  }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
@@ -10,37 +10,32 @@ const PopupDragWindowRootStyled = styled(DragResizeWindow, {
10
10
  name: POPUPS_VIEWER_KEY_COMPONENT,
11
11
  slot: PopupViewerSlots.popupDragWindowRoot
12
12
  })(popupsViewerStyles?.popupDragWindowRoot);
13
- const PopupHeaderContainerStyled = styled("div", {
13
+ const WindowBaseContentStyled = styled("div", {
14
+ name: POPUPS_VIEWER_KEY_COMPONENT,
15
+ slot: PopupViewerSlots.windowBaseContent
16
+ })(popupsViewerStyles?.windowBaseContent);
17
+ styled("div", {
14
18
  name: POPUPS_VIEWER_KEY_COMPONENT,
15
19
  slot: PopupViewerSlots.pDWHeaderContainer
16
20
  })(popupsViewerStyles?.pDWHeaderContainer);
17
- const PopupHeaderTitleStyled = styled("span", {
21
+ styled("span", {
18
22
  name: POPUPS_VIEWER_KEY_COMPONENT,
19
23
  slot: PopupViewerSlots.pDWHeaderTitle
20
24
  })(popupsViewerStyles?.pDWHeaderTitle);
21
- const PopupHeaderSubTitleStyled = styled("span", {
25
+ styled("span", {
22
26
  name: POPUPS_VIEWER_KEY_COMPONENT,
23
27
  slot: PopupViewerSlots.pDWHeaderSubTitle
24
28
  })(popupsViewerStyles?.pDWHeaderSubTitle);
25
- const PopupContentEditionInfoStyled = styled("div", {
26
- name: POPUPS_VIEWER_KEY_COMPONENT,
27
- slot: PopupViewerSlots.pDWContentEditionInfo
28
- })(popupsViewerStyles?.pDWContentEditionInfo);
29
- const PopupContentRootStyled = styled("div", {
29
+ styled("div", {
30
30
  name: POPUPS_VIEWER_KEY_COMPONENT,
31
31
  slot: PopupViewerSlots.pDWContentRoot
32
32
  })(popupsViewerStyles?.pDWContentRoot);
33
- const PopupContentWrapperStyled = styled("div", {
33
+ styled("div", {
34
34
  name: POPUPS_VIEWER_KEY_COMPONENT,
35
35
  slot: PopupViewerSlots.pDWContentWrapper
36
36
  })(popupsViewerStyles?.pDWContentWrapper);
37
37
  export {
38
38
  PopupDragWindowRootStyled as P,
39
39
  RootStyled as R,
40
- PopupContentRootStyled as a,
41
- PopupContentWrapperStyled as b,
42
- PopupContentEditionInfoStyled as c,
43
- PopupHeaderContainerStyled as d,
44
- PopupHeaderTitleStyled as e,
45
- PopupHeaderSubTitleStyled as f
40
+ WindowBaseContentStyled as W
46
41
  };
@@ -5,6 +5,6 @@ export declare enum PopupViewerSlots {
5
5
  pDWHeaderTitle = "pDWHeaderTitle",
6
6
  pDWHeaderSubTitle = "pDWHeaderSubTitle",
7
7
  pDWContentRoot = "pDWContentRoot",
8
- pDWContentEditionInfo = "pDWContentEditionInfo",
9
- pDWContentWrapper = "pDWContentWrapper"
8
+ pDWContentWrapper = "pDWContentWrapper",
9
+ windowBaseContent = "windowBaseContent"
10
10
  }
@@ -5,8 +5,8 @@ var PopupViewerSlots = /* @__PURE__ */ ((PopupViewerSlots2) => {
5
5
  PopupViewerSlots2["pDWHeaderTitle"] = "pDWHeaderTitle";
6
6
  PopupViewerSlots2["pDWHeaderSubTitle"] = "pDWHeaderSubTitle";
7
7
  PopupViewerSlots2["pDWContentRoot"] = "pDWContentRoot";
8
- PopupViewerSlots2["pDWContentEditionInfo"] = "pDWContentEditionInfo";
9
8
  PopupViewerSlots2["pDWContentWrapper"] = "pDWContentWrapper";
9
+ PopupViewerSlots2["windowBaseContent"] = "windowBaseContent";
10
10
  return PopupViewerSlots2;
11
11
  })(PopupViewerSlots || {});
12
12
  export {
@@ -0,0 +1,134 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ import { shallow } from "zustand/shallow";
4
+ import { u as usePopupsStore } from "../../../PopupsProvider/hooks/usePopupsStore/index.js";
5
+ import { P as PopupDragWindowRootStyled, W as WindowBaseContentStyled } from "../../slots/popupsViewerSlots.js";
6
+ import { M as MemonizedMicroFrontend } from "../../../../../areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/MicroFrontend/MicroFrontend.js";
7
+ import { C as Component } from "../../../../../areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Component/index.js";
8
+ import { u as usePopups } from "../../../PopupsProvider/hooks/usePopops/usePopups.js";
9
+ import { T as TEST_PROP_ID } from "../../../../../../test/constants_no_mock.js";
10
+ import { a as POPUPS_VIEWER_CLASS_NAME } from "../../constants.js";
11
+ import { a as getNameDataTestId } from "../../../../../../test/getNameDataTestId.js";
12
+ import { W as WindowBase } from "../../../../../WindowBase/WindowBase.js";
13
+ const Popup = forwardRef((props, ref) => {
14
+ const { popupId, containerElement, containerSize, style } = props;
15
+ const popup = usePopupsStore((state) => state.hashPopups[popupId], shallow);
16
+ const { setPopupOnFront: setPopupOnTop } = usePopupsStore((state) => state.popupsActions, shallow);
17
+ const { closePopup } = usePopupsStore((state) => state.popupsActions, shallow);
18
+ const { collapsed, maximized } = usePopupsStore(
19
+ (state) => ({
20
+ collapsed: state.hashPopups[popupId]?.collapsed || false,
21
+ maximized: state.hashPopups[popupId]?.maximized || false
22
+ }),
23
+ shallow
24
+ );
25
+ const {
26
+ moduleId,
27
+ winType,
28
+ title,
29
+ iconUrl,
30
+ dynamicMFStore,
31
+ windowTools,
32
+ mfProps,
33
+ component,
34
+ //onTouch,
35
+ memoizedActions,
36
+ loading,
37
+ version
38
+ } = usePopups(popupId);
39
+ const {
40
+ status,
41
+ subTitle,
42
+ editionInfo,
43
+ zIndex,
44
+ variant = "normal",
45
+ draggable = true,
46
+ resizable = true,
47
+ defaultPosition,
48
+ bounds,
49
+ onMouseDown,
50
+ ...others
51
+ } = popup || {};
52
+ const ownerState = {
53
+ status,
54
+ variant,
55
+ subTitle,
56
+ editionInfo,
57
+ zIndex,
58
+ collapsed,
59
+ maximized
60
+ };
61
+ const onMouseDownLocal = (e) => {
62
+ setPopupOnTop(popupId);
63
+ if (onMouseDown) {
64
+ onMouseDown(e);
65
+ }
66
+ };
67
+ if (!popup) {
68
+ return null;
69
+ }
70
+ return /* @__PURE__ */ jsx(
71
+ PopupDragWindowRootStyled,
72
+ {
73
+ ownerState,
74
+ ref,
75
+ hidden: popup.status === "hidden",
76
+ onMouseDown: onMouseDownLocal,
77
+ containerElement,
78
+ containerSize,
79
+ bounds,
80
+ draggable,
81
+ resizeable: resizable,
82
+ defaultPosition,
83
+ style: { ...style, zIndex },
84
+ ...others,
85
+ children: /* @__PURE__ */ jsx(
86
+ WindowBaseContentStyled,
87
+ {
88
+ ownerState,
89
+ children: /* @__PURE__ */ jsx(
90
+ WindowBase,
91
+ {
92
+ ...others,
93
+ version,
94
+ onClose: () => closePopup(popupId),
95
+ title: title ?? "",
96
+ subTitle,
97
+ iconUrl,
98
+ editionInfo,
99
+ actions: memoizedActions,
100
+ isLoading: loading,
101
+ windowId: popupId,
102
+ ...process.env.NODE_ENV !== "production" ? {
103
+ [TEST_PROP_ID]: getNameDataTestId(
104
+ POPUPS_VIEWER_CLASS_NAME,
105
+ "root"
106
+ )
107
+ } : {},
108
+ children: winType === "microfrontend" ? /* @__PURE__ */ jsx(
109
+ MemonizedMicroFrontend,
110
+ {
111
+ moduleId,
112
+ dynamicMFStore,
113
+ windowTools,
114
+ ...mfProps
115
+ }
116
+ ) : /* @__PURE__ */ jsx(
117
+ Component,
118
+ {
119
+ moduleId,
120
+ dynamicMFStore,
121
+ windowTools,
122
+ component
123
+ }
124
+ )
125
+ }
126
+ )
127
+ }
128
+ )
129
+ }
130
+ );
131
+ });
132
+ export {
133
+ Popup as P
134
+ };
@@ -11,6 +11,8 @@ export interface PopupOwnerState extends Pick<PopupStoreProps, 'status' | 'subTi
11
11
  * "isMobile" cuando el navegador está corriendo en dispositivo móvil
12
12
  */
13
13
  isMobile?: boolean;
14
+ collapsed?: boolean;
15
+ maximized?: boolean;
14
16
  }
15
17
  export interface PopupsViewerOwnerState extends Pick<PopupsStore, 'baseZindex'>, PopupOwnerState {
16
18
  }