@m4l/components 9.1.98 → 9.1.99

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 (31) hide show
  1. package/components/WindowBase/WindowBase.d.ts +1 -1
  2. package/components/WindowBase/WindowBase.js +2 -0
  3. package/components/WindowBase/types.d.ts +24 -1
  4. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/index.d.ts +4 -0
  5. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/InnerForHooks/index.d.ts +4 -0
  6. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/InnerForHooks/index.js +4 -10
  7. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/useHeaderActions.d.ts +32 -0
  8. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useHeaderActions/useHeaderActions.js +163 -0
  9. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow/useWindow.d.ts +35 -0
  10. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow/useWindow.js +88 -0
  11. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/index.d.ts +14 -1
  12. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/index.js +47 -113
  13. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/helper.d.ts +12 -8
  14. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/helper.js +3 -16
  15. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/index.d.ts +1 -1
  16. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/types.d.ts +7 -1
  17. package/components/areas/contexts/AreasContext/helpers/generateModuleCount.d.ts +4 -0
  18. package/components/areas/contexts/AreasContext/helpers/helper.d.ts +36 -0
  19. package/components/areas/contexts/AreasContext/index.d.ts +2 -2
  20. package/components/areas/contexts/AreasContext/store.d.ts +1 -1
  21. package/components/areas/contexts/AreasContext/store.js +37 -33
  22. package/components/areas/contexts/AreasContext/types.d.ts +53 -2
  23. package/components/areas/types.d.ts +7 -1
  24. package/package.json +1 -1
  25. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/PanelWindows/index.js +0 -99
  26. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/styles.js +0 -69
  27. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/index.js +0 -154
  28. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/MainActions/index.js +0 -44
  29. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/WindowHeaderSkeleton/index.js +0 -57
  30. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/WindowPopUpsList/index.d.ts +0 -9
  31. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/subcomponents/Header/subcomponents/WindowPopUpsList/types.d.ts +0 -2
@@ -1,101 +1,46 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React, { useMemo, useEffect } from "react";
3
- import clsx from "clsx";
4
- import { u as useAreasStore } from "../../../../../../hooks/useAreas/index.js";
5
- import { a as areasViewerClasses } from "../../../../classes/index.js";
6
- import { shallow } from "zustand/shallow";
7
- import { H as Header } from "./subcomponents/Header/index.js";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import React from "react";
8
3
  import { M as MemonizedMicroFrontend } from "./subcomponents/MicroFrontend/index.js";
9
4
  import { C as Component } from "./subcomponents/Component/index.js";
10
- import { W as WindowRoot } from "./styles.js";
11
5
  import { T as TEST_PROP_ID } from "../../../../../../../../test/constants_no_mock.js";
12
6
  import { a as getNameDataTestId } from "../../../../../../../../test/getNameDataTestId.js";
13
7
  import { a as AREAS_VIEWER_CLASS_NAME } from "../../../../../../constants.js";
14
- import { c as createToaster } from "../../../../../../../ToastContainer/helpers/toaster.js";
15
- import { T as ToastContainer } from "../../../../../../../ToastContainer/ToastContainer.js";
8
+ import { u as useWindow } from "./hooks/useWindow/useWindow.js";
9
+ import { W as WindowBase } from "../../../../../../../WindowBase/WindowBase.js";
16
10
  const Window = (props) => {
17
11
  const { areaId, windowId } = props;
18
- const [emergeType, moduleId, winType] = useAreasStore((state) => {
19
- return [
20
- state.hashWindows[windowId]?.emergeType,
21
- state.hashWindows[windowId]?.moduleId,
22
- state.hashWindows[windowId]?.winType
23
- ];
24
- }, shallow);
25
- const selected = useAreasStore((state) => {
26
- return emergeType === "layout" ? state.hashAreas[areaId]?.currentLayoutId : state.hashAreas[areaId]?.currentPopUpId;
27
- }) === windowId;
28
- const mfProps = useAreasStore((state) => state.hashWindows[windowId]?.mfProps, shallow);
29
- const component = useAreasStore(
30
- (state) => state.hashWindows[windowId]?.component,
31
- shallow
32
- );
33
- const loading = useAreasStore((state) => state.hashWindows[windowId]?.loading, shallow);
34
- const status = useAreasStore((state) => state.hashWindows[windowId]?.status, shallow);
35
- const dynamicMFStore = useAreasStore(
36
- (state) => state.hashWindows[windowId]?.dynamicMFStore,
37
- shallow
38
- );
39
12
  const {
40
- setActions,
41
- getCookie,
42
- getCookies,
43
- setCookie,
44
- close,
45
- startProgress,
46
- stopProgress,
47
- setFnQueryClose,
48
- setWindowTitle
49
- } = useAreasStore((state) => state.windowActions, shallow);
50
- const { selectLayout } = useAreasStore((state) => state.areaActions, shallow);
51
- const { loadCookiesFromApi } = useAreasStore((state) => state.windowActions, shallow);
52
- const onTouch = () => {
53
- if (!selected) {
54
- selectLayout(areaId, props.windowId);
55
- }
56
- };
57
- const windowTools = useMemo(
58
- () => ({
59
- getWindowId: () => windowId,
60
- setActions: (newActions, version) => {
61
- setActions(windowId, newActions, version);
62
- },
63
- getCookie: (id) => getCookie(windowId, id),
64
- getCookies: (type) => getCookies(windowId, type),
65
- setCookie: (id, type, cookie) => {
66
- setCookie(windowId, id, type, cookie);
67
- },
68
- close: () => close(windowId),
69
- startProgress: () => startProgress(windowId),
70
- stopProgress: () => stopProgress(windowId),
71
- setFnQueryClose: (fnQueryClose) => {
72
- setFnQueryClose(windowId, fnQueryClose);
73
- },
74
- toast: createToaster(windowId),
75
- setWindowTitle: (title) => setWindowTitle(windowId, title)
76
- }),
77
- // eslint-disable-next-line react-hooks/exhaustive-deps
78
- []
79
- );
80
- useEffect(() => {
81
- if (status === "init") {
82
- loadCookiesFromApi(windowId);
83
- }
84
- }, [status]);
13
+ emergeType,
14
+ moduleId,
15
+ winType,
16
+ title,
17
+ iconUrl,
18
+ version,
19
+ moduleCount,
20
+ selected,
21
+ mfProps,
22
+ component,
23
+ loading,
24
+ status,
25
+ dynamicMFStore,
26
+ windowTools,
27
+ onTouch,
28
+ memoizedActions
29
+ } = useWindow(areaId, windowId);
85
30
  if (status === void 0) {
86
31
  return null;
87
32
  }
88
33
  return /* @__PURE__ */ jsx(
89
- WindowRoot,
34
+ WindowBase,
90
35
  {
91
- role: "presentation",
92
- className: clsx(
93
- areasViewerClasses.windowRoot,
94
- selected ? areasViewerClasses.selectedWindow : null,
95
- loading ? areasViewerClasses.loading : null,
96
- emergeType === "popup" ? areasViewerClasses.windowPopupRoot : null,
97
- emergeType === "modal" ? areasViewerClasses.windowModalRoot : null
98
- ),
36
+ title: `${title}${moduleCount ? `:${moduleCount}` : null}`,
37
+ iconUrl,
38
+ isLoading: loading,
39
+ onClose: () => windowTools.close(),
40
+ version,
41
+ actions: memoizedActions,
42
+ windowId,
43
+ selected,
99
44
  onMouseDown: onTouch,
100
45
  ...process.env.NODE_ENV !== "production" ? {
101
46
  [TEST_PROP_ID]: getNameDataTestId(
@@ -104,34 +49,23 @@ const Window = (props) => {
104
49
  `${emergeType}`
105
50
  )
106
51
  } : {},
107
- children: /* @__PURE__ */ jsxs("div", { className: areasViewerClasses.windowRootContainer, children: [
108
- /* @__PURE__ */ jsx(Header, { areaId, windowId, emergeType }),
109
- /* @__PURE__ */ jsx(ToastContainer, { fixed: false, position: "top-center", containerId: windowId }),
110
- /* @__PURE__ */ jsxs("div", { className: clsx(areasViewerClasses.windowContent), children: [
111
- status === "init" ? (
112
- /* validar uso */
113
- /* Todo: Validar agregar nuevo componente de carga. */
114
- /* @__PURE__ */ jsx(Fragment, { children: "Cargando..." })
115
- ) : null,
116
- status === "loaded" ? winType === "microfrontend" ? /* @__PURE__ */ jsx(
117
- MemonizedMicroFrontend,
118
- {
119
- moduleId,
120
- dynamicMFStore,
121
- windowTools,
122
- ...mfProps
123
- }
124
- ) : /* @__PURE__ */ jsx(
125
- Component,
126
- {
127
- moduleId,
128
- dynamicMFStore,
129
- windowTools,
130
- component
131
- }
132
- ) : null
133
- ] })
134
- ] })
52
+ children: status === "loaded" ? winType === "microfrontend" ? /* @__PURE__ */ jsx(
53
+ MemonizedMicroFrontend,
54
+ {
55
+ moduleId,
56
+ dynamicMFStore,
57
+ windowTools,
58
+ ...mfProps
59
+ }
60
+ ) : /* @__PURE__ */ jsx(
61
+ Component,
62
+ {
63
+ moduleId,
64
+ dynamicMFStore,
65
+ windowTools,
66
+ component
67
+ }
68
+ ) : null
135
69
  }
136
70
  );
137
71
  };
@@ -3,36 +3,40 @@ import { AreaWindowAction, WindowOptions } from '../../../../../../../../types';
3
3
  /**
4
4
  * TODO: Documentar
5
5
  * @updatedUser cesar - automatic
6
- * @updatedAt 2025-01-31 11:37:44 - automatic
6
+ * @updatedAt 2025-02-06 11:13:10 - automatic
7
+ * @createdAt 2025-02-06 11:13:09 - automatic
8
+ * @author cesar - automatic
9
+ * @updatedUser cesar - automatic
10
+ * @updatedAt 2025-02-06 11:13:10 - automatic
7
11
  * @createdAt 2025-01-31 11:37:43 - automatic
8
12
  * @author cesar - automatic
9
13
  * @updatedUser cesar - automatic
10
- * @updatedAt 2025-01-31 11:37:44 - automatic
14
+ * @updatedAt 2025-02-06 11:13:10 - automatic
11
15
  * @createdAt 2025-01-31 11:36:54 - automatic
12
16
  * @author cesar - automatic
13
17
  * @updatedUser cesar - automatic
14
- * @updatedAt 2025-01-31 11:37:44 - automatic
18
+ * @updatedAt 2025-02-06 11:13:10 - automatic
15
19
  * @createdAt 2025-01-31 11:36:15 - automatic
16
20
  * @author cesar - automatic
17
21
  * @updatedUser cesar - automatic
18
- * @updatedAt 2025-01-31 11:37:44 - automatic
22
+ * @updatedAt 2025-02-06 11:13:10 - automatic
19
23
  * @createdAt 2025-01-31 11:35:35 - automatic
20
24
  * @author cesar - automatic
21
25
  * @updatedUser cesar - automatic
22
- * @updatedAt 2025-01-31 11:37:44 - automatic
26
+ * @updatedAt 2025-02-06 11:13:10 - automatic
23
27
  * @createdAt 2025-01-31 11:34:36 - automatic
24
28
  * @author cesar - automatic
25
29
  * @updatedUser cesar - automatic
26
- * @updatedAt 2025-01-31 11:37:44 - automatic
30
+ * @updatedAt 2025-02-06 11:13:10 - automatic
27
31
  * @createdAt 2025-01-21 14:45:38 - automatic
28
32
  * @author cesar - automatic
29
33
  * @updatedUser cesar - automatic
30
- * @updatedAt 2025-01-31 11:37:44 - automatic
34
+ * @updatedAt 2025-02-06 11:13:10 - automatic
31
35
  * @createdAt 2025-01-18 21:23:13 - automatic
32
36
  * @author cesar - automatic
33
37
  * @author cesar - automatic
34
38
  * @createdAt 2025-01-18 21:23:13 - automatic
35
- * @updatedAt 2025-01-31 11:37:44 - automatic
39
+ * @updatedAt 2025-02-06 11:13:10 - automatic
36
40
  * @updatedUser cesar - automatic
37
41
  */
38
42
  export declare function getMainActions(isDesktop: boolean | undefined, moduleActions: AreaWindowAction[]): AreaWindowAction[];
@@ -16,7 +16,7 @@ function getMenuActions(options) {
16
16
  urlPrefix,
17
17
  saveModuleCookies,
18
18
  resetModuleCookies,
19
- version,
19
+ //version,
20
20
  windowOptions = { allowPersistCookies: false },
21
21
  getLabel
22
22
  } = options;
@@ -48,22 +48,9 @@ function getMenuActions(options) {
48
48
  };
49
49
  menuActions.push(resetCookiesAction);
50
50
  }
51
- if (version) {
52
- const versionAction = {
53
- type: "menuItem",
54
- startIcon: `${urlPrefix}/frontend/components/areas/assets/icons/${ICONS.VERSION}`,
55
- onClick: () => {
56
- },
57
- disabled: true,
58
- visibility: "normal",
59
- label: version,
60
- key: "version"
61
- };
62
- menuActions.push(versionAction);
63
- }
64
51
  return menuActions;
65
52
  }
66
53
  export {
67
- getMainActions as a,
68
- getMenuActions as g
54
+ getMenuActions as a,
55
+ getMainActions as g
69
56
  };
@@ -3,7 +3,7 @@ import { HeaderProps } from './types';
3
3
  * TODO: Documentar
4
4
  * @author Andrés Quintero - automatic
5
5
  * @createdAt 2024-12-27 08:27:31 - automatic
6
- * @updatedAt 2025-01-31 11:37:44 - automatic
6
+ * @updatedAt 2025-02-07 08:26:22 - automatic
7
7
  * @updatedUser cesar - automatic
8
8
  */
9
9
  export declare function Header(props: HeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,8 @@
1
+ import { WindowBaseAction } from '../../../../../../../../../src/components/WindowBase';
1
2
  import { WindowBaseProps } from '../../../../../../types';
2
- export type WindowProps = Pick<WindowBaseProps, 'windowId' | 'areaId'>;
3
+ export interface WindowProps extends Pick<WindowBaseProps, 'windowId' | 'areaId'> {
4
+ /**
5
+ * Acciones que se mostrarán en el header
6
+ */
7
+ actions?: WindowBaseAction[];
8
+ }
@@ -5,5 +5,9 @@ import { WindowStateProps } from '../../../types';
5
5
  * y genera un number que representa el 'moduleCount' de la ventana.
6
6
  * @param hashWindows
7
7
  * @returns number con el número de módulos repetidos en una mista area
8
+ * @author cesar - automatic
9
+ * @createdAt 2025-02-07 08:26:22 - automatic
10
+ * @updatedAt 2025-02-07 08:26:22 - automatic
11
+ * @updatedUser cesar - automatic
8
12
  */
9
13
  export declare const generateModuleCount: (areaId: string, moduleId: string, hashWindows: Record<string, WindowStateProps>) => number;
@@ -54,15 +54,51 @@ export declare const DEFAULT_AREA: Omit<Area, 'id' | 'name' | 'viewMode'>;
54
54
  * si "loadAreasFromNetwork" esta en true, agrega al backend el área de trabajo
55
55
  * @param state
56
56
  * @returns
57
+ * @author cesar - automatic
58
+ * @createdAt 2025-02-07 08:26:22 - automatic
59
+ * @updatedAt 2025-02-07 08:26:22 - automatic
60
+ * @updatedUser cesar - automatic
57
61
  */
58
62
  export declare const addArea: (state: WritableDraft<AreasStateWithActions>) => string;
59
63
  /**
60
64
  * Actualiza la clases basado en owner state
61
65
  * @param state immer State
66
+ * @author cesar - automatic
67
+ * @createdAt 2025-02-07 08:26:22 - automatic
68
+ * @updatedAt 2025-02-07 08:26:22 - automatic
69
+ * @updatedUser cesar - automatic
62
70
  */
63
71
  export declare const updateOwnerStateClasses: (state: WritableDraft<AreasStateWithActions>) => void;
64
72
  /**
65
73
  * TODO: Documentar
74
+ * @updatedUser cesar - automatic
75
+ * @updatedUser cesar - automatic
76
+ * @updatedUser cesar - automatic
77
+ * @updatedUser cesar - automatic
78
+ * @updatedUser cesar - automatic
79
+ * @updatedUser cesar - automatic
80
+ * @updatedAt 2025-02-07 08:26:22 - automatic
81
+ * @updatedAt 2025-02-07 08:26:22 - automatic
82
+ * @updatedAt 2025-02-07 08:26:22 - automatic
83
+ * @updatedAt 2025-02-07 08:26:22 - automatic
84
+ * @updatedAt 2025-02-07 08:26:22 - automatic
85
+ * @updatedAt 2025-02-07 08:26:22 - automatic
86
+ * @createdAt 2025-02-07 08:26:22 - automatic
87
+ * @createdAt 2025-02-07 08:26:22 - automatic
88
+ * @createdAt 2025-02-07 08:26:22 - automatic
89
+ * @createdAt 2025-02-07 08:26:22 - automatic
90
+ * @createdAt 2025-02-07 08:26:22 - automatic
91
+ * @createdAt 2025-02-07 08:26:22 - automatic
92
+ * @author cesar - automatic
93
+ * @author cesar - automatic
94
+ * @author cesar - automatic
95
+ * @author cesar - automatic
96
+ * @author cesar - automatic
97
+ * @author cesar - automatic
98
+ * @author cesar - automatic
99
+ * @createdAt 2025-02-07 08:26:22 - automatic
100
+ * @updatedAt 2025-02-07 08:26:22 - automatic
101
+ * @updatedUser cesar - automatic
66
102
  */
67
103
  export declare const getCurrentArea: (state: WritableDraft<AreasStateWithActions> | AreasStateWithActions) => Area;
68
104
  /**
@@ -19,8 +19,8 @@ declare const AreasContext: import('react').Context<(Omit<Omit<import('zustand')
19
19
  * TODO: Documentar
20
20
  * @author Andrés Quintero - automatic
21
21
  * @createdAt 2024-12-30 14:36:06 - automatic
22
- * @updatedAt 2024-12-30 14:36:09 - automatic
23
- * @updatedUser Andrés Quintero - automatic
22
+ * @updatedAt 2025-02-07 08:26:22 - automatic
23
+ * @updatedUser cesar - automatic
24
24
  */
25
25
  declare function AreasProvider(props: AreasProviderProps): import("react/jsx-runtime").JSX.Element;
26
26
  export { AreasProvider, AreasContext };
@@ -5,7 +5,7 @@ import { AreasStateWithActions, InitialAreasStoreProps } from './types';
5
5
  * @returns
6
6
  * @author Bruce Escobar - automatic
7
7
  * @createdAt 2024-10-22 09:41:31 - automatic
8
- * @updatedAt 2025-01-29 16:33:53 - automatic
8
+ * @updatedAt 2025-02-07 08:26:22 - automatic
9
9
  * @updatedUser cesar - automatic
10
10
  */
11
11
  export declare const createAreasStore: (initProps: InitialAreasStoreProps) => Omit<Omit<import('zustand').StoreApi<AreasStateWithActions>, "setState"> & {