@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
@@ -1,158 +1,243 @@
1
1
  import { createStore } from "zustand";
2
- import { devtools } from "zustand/middleware";
3
2
  import { immer } from "zustand/middleware/immer";
4
3
  import cloneDeep from "lodash-es/cloneDeep";
4
+ import { c as createDynamicMFStore } from "../../../../../areas/contexts/DynamicMFParmsContext/store.js";
5
5
  const createPopupsStore = (initProps) => {
6
6
  const startProps = {
7
7
  currentZindex: initProps.baseZindex,
8
8
  popupsIds: [],
9
9
  hashPopups: {},
10
+ windowActions: {
11
+ setActions: []
12
+ //getCookie: () => undefined,
13
+ //setCookie: () => {},
14
+ //saveModuleCookies: () => {},
15
+ //resetModuleCookies: () => {},
16
+ },
10
17
  getContainer: initProps.getContainerElement,
11
18
  ...initProps
12
19
  };
13
20
  return createStore(
14
- devtools(
15
- immer((set, get) => ({
16
- ...startProps,
17
- popupsActions: {
18
- /**
19
- * TODO: Documentar
20
- */
21
- init: (initialPopups) => {
22
- set((state) => {
23
- let maxZindex = state.baseZindex;
24
- for (let index = 0; index < initialPopups.length; index++) {
25
- state.hashPopups[initialPopups[index].popupId] = cloneDeep(initialPopups[index]);
26
- state.popupsIds.push(initialPopups[index].popupId);
27
- if (initialPopups[index].zIndex > maxZindex) {
28
- maxZindex = initialPopups[index].zIndex;
29
- }
21
+ immer((set, get) => ({
22
+ ...startProps,
23
+ popupsActions: {
24
+ /**
25
+ * init: Inicializa los popups
26
+ */
27
+ init: (initialPopups) => {
28
+ set((state) => {
29
+ let maxZindex = state.baseZindex;
30
+ for (let index = 0; index < initialPopups.length; index++) {
31
+ const popupData = cloneDeep(initialPopups[index]);
32
+ if (!popupData.dynamicMFStore && popupData.dynamicParams) {
33
+ popupData.dynamicMFStore = createDynamicMFStore({
34
+ dynamicMFParameters: popupData.dynamicParams,
35
+ windowId: popupData.popupId
36
+ });
37
+ }
38
+ state.hashPopups[initialPopups[index].popupId] = {
39
+ ...popupData,
40
+ component: popupData.functionComponent
41
+ };
42
+ state.popupsIds.push(initialPopups[index].popupId);
43
+ if (initialPopups[index].zIndex > maxZindex) {
44
+ maxZindex = initialPopups[index].zIndex;
30
45
  }
31
- state.currentZindex = maxZindex + 1;
32
- });
33
- },
34
- /**
35
- * TODO: Documentar
36
- */
37
- addPopup: (popupProps, options) => {
38
- if (get().hashPopups[popupProps.popupId]) {
39
- throw new Error(`Poupup with id ${popupProps.popupId} already exists`);
40
46
  }
41
- if (options?.closeOthers) {
42
- set((state) => {
43
- state.popupsIds.forEach((popupId) => {
44
- state.hashPopups[popupId].status = "closing";
45
- });
46
- state.hashPopups[popupProps.popupId] = {
47
- ...popupProps,
48
- status: "init",
49
- zIndex: state.currentZindex
50
- };
51
- state.popupsIds.push(popupProps.popupId);
52
- state.currentZindex = state.currentZindex + 1;
47
+ state.currentZindex = maxZindex + 1;
48
+ });
49
+ },
50
+ /**
51
+ * addPopup: Añade un popup
52
+ */
53
+ addPopup: (popupProps, options) => {
54
+ if (get().hashPopups[popupProps.popupId]) {
55
+ throw new Error(`Poupup with id ${popupProps.popupId} already exists`);
56
+ }
57
+ if (options?.closeOthers) {
58
+ set((state) => {
59
+ state.popupsIds.forEach((popupId) => {
60
+ state.hashPopups[popupId].status = "closing";
53
61
  });
62
+ state.hashPopups[popupProps.popupId] = {
63
+ ...popupProps,
64
+ status: "init",
65
+ zIndex: state.currentZindex
66
+ };
67
+ state.popupsIds.push(popupProps.popupId);
68
+ state.currentZindex = state.currentZindex + 1;
69
+ });
70
+ } else {
71
+ set((state) => {
72
+ state.hashPopups[popupProps.popupId] = {
73
+ ...popupProps,
74
+ status: "init",
75
+ zIndex: state.currentZindex
76
+ };
77
+ state.popupsIds.push(popupProps.popupId);
78
+ state.currentZindex = state.currentZindex + 1;
79
+ });
80
+ }
81
+ },
82
+ /**
83
+ * removePopup: Elimina un popup
84
+ */
85
+ removePopup: (popupId) => {
86
+ if (!get().hashPopups[popupId]) {
87
+ return;
88
+ }
89
+ set((state) => {
90
+ state.popupsIds.splice(state.popupsIds.indexOf(popupId), 1);
91
+ delete state.hashPopups[popupId];
92
+ if (state.popupsIds.length === 0) {
93
+ state.currentZindex = state.baseZindex;
54
94
  } else {
55
- set((state) => {
56
- state.hashPopups[popupProps.popupId] = {
57
- ...popupProps,
58
- status: "init",
59
- zIndex: state.currentZindex
60
- };
61
- state.popupsIds.push(popupProps.popupId);
62
- state.currentZindex = state.currentZindex + 1;
63
- });
95
+ state.currentZindex = state.currentZindex - 1;
64
96
  }
65
- },
66
- /**
67
- * TODO: Documentar
68
- */
69
- removePopup: (popupId) => {
70
- if (!get().hashPopups[popupId]) {
71
- return;
97
+ });
98
+ },
99
+ /**
100
+ * closePopup: Cierra un popup
101
+ */
102
+ closePopup: (popupId) => {
103
+ if (!get().hashPopups[popupId]) {
104
+ return;
105
+ }
106
+ set((state) => {
107
+ state.hashPopups[popupId].status = "closing";
108
+ });
109
+ },
110
+ /**
111
+ * updatePopup: Actualiza un popup
112
+ */
113
+ updatePopup: (popupId, popupProps) => {
114
+ if (!get().hashPopups[popupId]) {
115
+ return;
116
+ }
117
+ set((state) => {
118
+ state.hashPopups[popupId] = { ...state.hashPopups[popupId], ...popupProps };
119
+ });
120
+ },
121
+ /**
122
+ * showPopup: Muestra un popup
123
+ */
124
+ showPopup: (popupId) => {
125
+ if (!get().hashPopups[popupId]) {
126
+ return;
127
+ }
128
+ set((state) => {
129
+ state.hashPopups[popupId].status = "init";
130
+ });
131
+ },
132
+ /**
133
+ * hidePopup: Oculta un popup
134
+ */
135
+ hidePopup: (popupId) => {
136
+ if (!get().hashPopups[popupId]) {
137
+ return;
138
+ }
139
+ set((state) => {
140
+ state.hashPopups[popupId].status = "hidden";
141
+ });
142
+ },
143
+ /**
144
+ * setActions: Establece las acciones del popup
145
+ */
146
+ setActions: (popupId, actions, version) => {
147
+ set((state) => {
148
+ if (state.hashPopups[popupId]) {
149
+ state.hashPopups[popupId].moduleActions = actions;
150
+ state.hashPopups[popupId].version = version;
72
151
  }
73
- set((state) => {
74
- state.popupsIds.splice(state.popupsIds.indexOf(popupId), 1);
75
- delete state.hashPopups[popupId];
76
- if (state.popupsIds.length === 0) {
77
- state.currentZindex = state.baseZindex;
78
- } else {
79
- state.currentZindex = state.currentZindex - 1;
80
- }
81
- });
82
- },
83
- /**
84
- * TODO: Documentar
85
- */
86
- closePopup: (popupId) => {
87
- if (!get().hashPopups[popupId]) {
88
- return;
152
+ });
153
+ },
154
+ /**
155
+ * setPopupOnTop: Establece el popup con mayor zindex
156
+ */
157
+ setPopupOnFront: (popupId) => {
158
+ if (!get().hashPopups[popupId]) {
159
+ return;
160
+ }
161
+ set((state) => {
162
+ const maxIndex = state.popupsIds.reduce((max, _pId, cIndex) => {
163
+ return state.hashPopups[state.popupsIds[cIndex]].zIndex > max ? state.hashPopups[state.popupsIds[cIndex]].zIndex : max;
164
+ }, state.hashPopups[state.popupsIds[0]].zIndex);
165
+ if (state.hashPopups[popupId].zIndex !== maxIndex) {
166
+ state.hashPopups[popupId].zIndex = state.currentZindex;
167
+ state.currentZindex = state.currentZindex + 1;
89
168
  }
90
- set((state) => {
91
- state.hashPopups[popupId].status = "closing";
92
- });
93
- },
94
- /**
95
- * TODO: Documentar
96
- */
97
- updatePopup: (popupId, popupProps) => {
98
- if (!get().hashPopups[popupId]) {
99
- return;
169
+ });
170
+ },
171
+ /**
172
+ * setHandlerGetLabel: Establece el manejador de etiquetas
173
+ */
174
+ setHandlerGetLabel: (newHandler) => {
175
+ set((state) => {
176
+ state.getLabel = newHandler;
177
+ });
178
+ },
179
+ /**
180
+ * startProgress: Marca el popup como cargando (loading: true)
181
+ */
182
+ startProgress: (popupId) => {
183
+ set((state) => {
184
+ if (state.hashPopups[popupId]) {
185
+ state.hashPopups[popupId].loading = true;
100
186
  }
101
- set((state) => {
102
- state.hashPopups[popupId] = { ...state.hashPopups[popupId], ...popupProps };
103
- });
104
- },
105
- /**
106
- * TODO: Documentar
107
- */
108
- showPopup: (popupId) => {
109
- if (!get().hashPopups[popupId]) {
110
- return;
187
+ });
188
+ },
189
+ /**
190
+ * stopProgress: Marca el popup como finalizado (loading: false)
191
+ */
192
+ stopProgress: (popupId) => {
193
+ set((state) => {
194
+ if (state.hashPopups[popupId]) {
195
+ state.hashPopups[popupId].loading = false;
111
196
  }
112
- set((state) => {
113
- state.hashPopups[popupId].status = "init";
114
- });
115
- },
116
- /**
117
- * TODO: Documentar
118
- */
119
- hidePopup: (popupId) => {
120
- if (!get().hashPopups[popupId]) {
121
- return;
197
+ });
198
+ },
199
+ /**
200
+ * setFnQueryClose: Establece la función de cierre de la consulta
201
+ */
202
+ setFnQueryClose: (popupId, fn) => {
203
+ set((state) => {
204
+ if (state.hashPopups[popupId]) {
205
+ state.hashPopups[popupId].fnQueryClose = fn;
122
206
  }
123
- set((state) => {
124
- state.hashPopups[popupId].status = "hidden";
125
- });
126
- },
127
- /**
128
- * TODO: Documentar
129
- */
130
- setPopupOnFront: (popupId) => {
131
- if (!get().hashPopups[popupId]) {
132
- return;
207
+ });
208
+ },
209
+ /**
210
+ * setPopupTitle: Establece el título del popup
211
+ */
212
+ setPopupTitle: (popupId, title) => {
213
+ set((state) => {
214
+ if (state.hashPopups[popupId]) {
215
+ state.hashPopups[popupId].title = title;
133
216
  }
134
- set((state) => {
135
- const maxIndex = state.popupsIds.reduce((max, _pId, cIndex) => {
136
- return state.hashPopups[state.popupsIds[cIndex]].zIndex > max ? state.hashPopups[state.popupsIds[cIndex]].zIndex : max;
137
- }, state.hashPopups[state.popupsIds[0]].zIndex);
138
- if (state.hashPopups[popupId].zIndex !== maxIndex) {
139
- state.hashPopups[popupId].zIndex = state.currentZindex;
140
- state.currentZindex = state.currentZindex + 1;
141
- }
142
- });
143
- },
144
- /**
145
- * TODO: Documentar
146
- */
147
- setHandlerGetLabel: (newHandler) => {
148
- set((state) => {
149
- state.getLabel = newHandler;
150
- });
151
- }
217
+ });
218
+ },
219
+ /**
220
+ * unColapseLayoutItem
221
+ */
222
+ unColapseLayoutItem: (popupId) => {
223
+ set((state) => {
224
+ if (state.hashPopups[popupId]) {
225
+ state.hashPopups[popupId].collapsed = false;
226
+ }
227
+ });
228
+ },
229
+ /**
230
+ * colapseLayoutItem
231
+ */
232
+ colapseLayoutItem: (popupId) => {
233
+ set((state) => {
234
+ if (state.hashPopups[popupId]) {
235
+ state.hashPopups[popupId].collapsed = true;
236
+ }
237
+ });
152
238
  }
153
- })),
154
- { name: `Popups store: ${initProps.storeId}` }
155
- )
239
+ }
240
+ }))
156
241
  );
157
242
  };
158
243
  export {
@@ -2,6 +2,7 @@ import { GetLabelType } from '@m4l/core';
2
2
  import { ReactNode } from 'react';
3
3
  import { DragResizeWindowProps } from '../../../../../DragResizeWindow/types';
4
4
  import { PopupStatus } from '../../../PopupsViewer/types';
5
+ import { AreaWindowAction, MFBaseProps } from '../../../../../../../src/components/areas/types';
5
6
  export type PopupVariantType = 'normal' | 'small' | 'large';
6
7
  export interface PopupStoreProps extends Pick<DragResizeWindowProps, 'bounds' | 'defaultPosition'> {
7
8
  /**
@@ -58,6 +59,65 @@ export interface PopupStoreProps extends Pick<DragResizeWindowProps, 'bounds' |
58
59
  * "onMouseDown" Evento nativo del Draggable, para tomar acciones externamente
59
60
  */
60
61
  onMouseDown?: (e: MouseEvent) => void;
62
+ /**
63
+ * "mfProps" Propiedades de la ventana padre
64
+ */
65
+ mfProps?: MFBaseProps;
66
+ /**
67
+ * "winType" Tipo de ventana
68
+ */
69
+ winType?: 'microfrontend' | 'component';
70
+ /**
71
+ * "loading" Indica si el popup está cargando
72
+ */
73
+ loading?: boolean;
74
+ /**
75
+ * "actions" Acciones de la ventana
76
+ */
77
+ actions?: AreaWindowAction[];
78
+ /**
79
+ * "version" Versión de la ventana
80
+ */
81
+ version?: string;
82
+ /**
83
+ * "progress" Indica si el popup está en progreso
84
+ */
85
+ progress?: boolean;
86
+ /**
87
+ * "fnQueryClose" Función de cierre de la consulta
88
+ */
89
+ fnQueryClose?: (...args: any[]) => void;
90
+ /**
91
+ * "dynamicMFStore" Almacén de microfrontends din
92
+ */
93
+ dynamicMFStore?: Record<string, any>;
94
+ /**
95
+ * "emergeType" Tipo de emergencia
96
+ */
97
+ /**
98
+ * dynamic params
99
+ */
100
+ dynamicParams?: Record<string, any>;
101
+ /**
102
+ * "moduleActions" Acciones del módulo
103
+ */
104
+ moduleActions?: AreaWindowAction[];
105
+ /**
106
+ * "windowTools" Herramientas de la ventana
107
+ */
108
+ windowOptions?: Record<string, any>;
109
+ /**
110
+ * "collapsed" Indica si el popup está colapsado
111
+ */
112
+ collapsed?: boolean;
113
+ /**
114
+ * "maximized" Indica si el popup está maximizado
115
+ */
116
+ maximized?: boolean;
117
+ /**
118
+ * "component" Componente que se va a mostrar en el popup.
119
+ */
120
+ component?: React.FC<Record<string, any>>;
61
121
  }
62
122
  /**
63
123
  * Interface que define el store del componente (variables y funciones )
@@ -92,6 +152,8 @@ export interface PopupsStore {
92
152
  * "getLabel" funcion que usará para traducir las etiquetas de diccionario
93
153
  */
94
154
  getContainer: () => HTMLElement;
155
+ dynamicMFStore?: Record<string, any>;
156
+ windowActions: Record<string, AreaWindowAction[]>;
95
157
  }
96
158
  export type OpenPopupOptions = {
97
159
  /**
@@ -108,6 +170,8 @@ export interface PopupsStateWithActions extends PopupsStore {
108
170
  /**
109
171
  * Agrega una un poupup nuevo al hash de popups y al array de ids,
110
172
  */
173
+ unColapseLayoutItem: (popupId: string) => void;
174
+ colapseLayoutItem: (popupId: string) => void;
111
175
  addPopup: (popupProps: Omit<PopupStoreProps, 'status' | 'zIndex'>, options?: OpenPopupOptions) => void;
112
176
  /**
113
177
  * Remueve el poupup del hash de poups y de arrays de ids
@@ -140,6 +204,17 @@ export interface PopupsStateWithActions extends PopupsStore {
140
204
  * @returns void
141
205
  */
142
206
  setHandlerGetLabel: (newHandler: GetLabelType) => void;
207
+ /**
208
+ * setFnQueryClose: Establece la función de cierre del popup
209
+ */
210
+ setFnQueryClose: (popupId: string, fn: () => void) => void;
211
+ /**
212
+ * setPopupTitle: Establece el título del popup
213
+ */
214
+ setPopupTitle: (popupId: string, title: string) => void;
215
+ startProgress: (popupId: string) => void;
216
+ stopProgress: (popupId: string) => void;
217
+ setActions: (popupId: string, actions: AreaWindowAction[], version?: string) => void;
143
218
  };
144
219
  }
145
220
  export type DefaultPopupsStoreProps = PopupsStore;
@@ -0,0 +1,28 @@
1
+ import { GetLabelType } from '@m4l/core';
2
+ import { AreaWindowAction, WindowOptions } from '../../../../../../../src/components/areas/types';
3
+ /**
4
+ * Obtiene las acciones principales para un popup.
5
+ * @param isDesktop Indica si se está en un dispositivo de escritorio.
6
+ * @param moduleActions Acciones definidas para el módulo.
7
+ * @returns Array de acciones principales.
8
+ */
9
+ export declare function getMainActionsForPopups(isDesktop: boolean | undefined, moduleActions: AreaWindowAction[]): AreaWindowAction[];
10
+ type GetMenuActionsForPopupsType = {
11
+ popupId: string;
12
+ isDesktop?: boolean;
13
+ moduleActions: AreaWindowAction[];
14
+ urlPrefix: string;
15
+ version?: string;
16
+ windowOptions?: WindowOptions;
17
+ getLabel: GetLabelType;
18
+ saveModuleCookies: (wd: string) => void;
19
+ resetModuleCookies: (wd: string) => void;
20
+ };
21
+ /**
22
+ * Obtiene las acciones del menú para un popup.
23
+ * A diferencia del helper para áreas, aquí no se agregan acciones relacionadas con cookies.
24
+ * @param options Objeto con las opciones para construir las acciones.
25
+ * @returns Array de acciones para el menú.
26
+ */
27
+ export declare function getMenuActionsForPopups(options: GetMenuActionsForPopupsType): AreaWindowAction[];
28
+ export {};
@@ -0,0 +1,44 @@
1
+ import { g as getAreasDictionary, A as AREAS_DICCTIONARY } from "../../../../../areas/dictionary.js";
2
+ import { I as ICONS } from "../../../../../areas/icons.js";
3
+ function getMenuActionsForPopups(options) {
4
+ const {
5
+ popupId,
6
+ isDesktop,
7
+ moduleActions,
8
+ urlPrefix,
9
+ saveModuleCookies,
10
+ resetModuleCookies,
11
+ getLabel,
12
+ windowOptions = { allowPersistCookies: false }
13
+ } = options;
14
+ let menuActions = [...moduleActions.filter((action) => action.visibility !== "allways")];
15
+ if (isDesktop !== void 0 && isDesktop) {
16
+ menuActions = menuActions.filter((action) => action.visibility === "normal");
17
+ }
18
+ if (windowOptions.allowPersistCookies) {
19
+ const saveCookiesAction = {
20
+ type: "menuItem",
21
+ startIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.SAVE_COOKIES}`,
22
+ onClick: () => saveModuleCookies(popupId),
23
+ disabled: false,
24
+ visibility: "normal",
25
+ label: getLabel(getAreasDictionary(AREAS_DICCTIONARY.label_persist_module_cookies)),
26
+ key: "save_cookies"
27
+ };
28
+ menuActions.push(saveCookiesAction);
29
+ const resetCookiesAction = {
30
+ type: "menuItem",
31
+ startIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.RESET_COOKIES}`,
32
+ onClick: () => resetModuleCookies(popupId),
33
+ disabled: false,
34
+ visibility: "normal",
35
+ label: getLabel(getAreasDictionary(AREAS_DICCTIONARY.label_reset_module_cookies)),
36
+ key: "reset_cookes"
37
+ };
38
+ menuActions.push(resetCookiesAction);
39
+ }
40
+ return menuActions;
41
+ }
42
+ export {
43
+ getMenuActionsForPopups as g
44
+ };
@@ -0,0 +1,21 @@
1
+ import { WindowBaseAction } from '../../../../../../../src/components/WindowBase';
2
+ interface UseHeaderActionsPopupsParams {
3
+ /** Identificador de la ventana (popup) */
4
+ popupId: string;
5
+ /** Acciones adicionales a incluir en el menú del header */
6
+ menuActions?: WindowBaseAction[];
7
+ }
8
+ /**
9
+ * Hook useHeaderActionsPopups
10
+ *
11
+ * Este hook configura las acciones del header para un popup utilizando el store de popups,
12
+ * el diccionario e íconos propios y helpers para construir las acciones "main" e "inside".
13
+ * @param {UseHeaderActionsPopupsParams} params - Parámetros que incluyen el popupId y, opcionalmente, acciones adicionales.
14
+ * @returns Objeto con leftActions, menuActions y rightActions.
15
+ */
16
+ export declare const useHeaderActionsPopups: ({ popupId, menuActions, }: UseHeaderActionsPopupsParams) => {
17
+ leftActions: WindowBaseAction[];
18
+ menuActions: WindowBaseAction[];
19
+ rightActions: WindowBaseAction[];
20
+ };
21
+ export {};