@m4l/components 9.3.22 → 9.3.24-JT04112025.beta.1
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.
- package/components/CommonActions/components/ActionFormCancel/ActionFormCancel.js +17 -8
- package/components/CommonActions/components/ActionFormCancel/types.d.ts +9 -0
- package/components/DataGrid/contexts/DataGridContext/index.js +12 -7
- package/components/DataGrid/formatters/ColumnIconFormatter/index.d.ts +1 -0
- package/components/DataGrid/index.d.ts +1 -1
- package/components/DataGrid/tests/helpers/types.d.ts +1 -0
- package/components/DataGrid/types.d.ts +2 -0
- package/components/DynamicFilter/helpers/formatToInitialFilters.js +3 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +11 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +16 -4
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +11 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +21 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +18 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +5 -3
- package/components/Label/Label.js +1 -1
- package/components/PaperForm/PaperForm.js +1 -1
- package/components/PaperForm/components/Header.js +9 -7
- package/components/PaperForm/styles.js +9 -4
- package/components/PaperForm/types.d.ts +3 -2
- package/components/Stepper/Stepper.styles.js +2 -0
- package/components/Stepper/dictionary.js +0 -1
- package/components/Stepper/subcomponents/StepArea/hooks/useStepArea.d.ts +13 -0
- package/components/Stepper/subcomponents/StepArea/hooks/useStepArea.js +111 -0
- package/components/Stepper/subcomponents/StepArea/hooks/useVisibileSteps.d.ts +8 -0
- package/components/Stepper/subcomponents/StepArea/hooks/useVisibileSteps.js +79 -0
- package/components/Stepper/subcomponents/StepArea/index.js +7 -115
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.d.ts +2 -2
- package/components/Stepper/subcomponents/StepperButtons/StepperCancelButton/index.js +3 -53
- package/components/Stepper/subcomponents/StepperButtons/StepperNextButton/index.js +3 -2
- package/components/Stepper/subcomponents/StepperButtons/StepperPrevButton/index.js +3 -2
- package/components/Stepper/subcomponents/StepperButtons/StepperSubmitButton/index.js +24 -5
- package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/hooks/useIsStepVisible.d.ts +8 -0
- package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/hooks/useIsStepVisible.js +93 -0
- package/components/Stepper/subcomponents/StepperContent/subcomponents/Step/index.js +2 -51
- package/components/Stepper/types.d.ts +4 -0
- package/components/ToastContainer/ToastContainer.js +1 -0
- package/components/ToastContainer/constants.d.ts +1 -1
- package/components/ToastContainer/constants.js +1 -1
- package/components/WindowBase/contexts/WindowToolsMFContext/WindowToolsMFContext.js +47 -3
- package/components/WindowBase/contexts/WindowToolsMFContext/types.d.ts +1 -1
- package/components/WindowBase/subcomponents/Component/index.d.ts +12 -1
- package/components/WindowBase/subcomponents/Component/index.js +56 -2
- package/components/WindowBase/subcomponents/Component/types.d.ts +1 -0
- package/components/WindowBase/types.d.ts +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +1 -0
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +1 -1
- package/components/areas/contexts/AreasContext/store.js +5 -1
- package/components/areas/contexts/AreasContext/types.d.ts +1 -1
- package/components/hook-form/RHFormContext/styles.js +2 -1
- package/components/mui_extended/CircularProgress/types.d.ts +1 -1
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.js +5 -1
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +1 -1
- package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +2 -4
- package/components/popups/components/PopupsProvider/hooks/usePopups.js +19 -7
- package/components/popups/components/PopupsViewer/PopupsViewer.js +1 -1
- package/components/popups/components/PopupsViewer/PopupsViewer.styles.js +1 -1
- package/components/popups/components/PopupsViewer/subcomponents/Popup/Popup.js +32 -21
- package/index.js +60 -58
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const TOAST_KEY_COMPONENT = "M4LToastContainer";
|
|
2
|
-
export declare const DEFAULT_CLOSE_TIME =
|
|
2
|
+
export declare const DEFAULT_CLOSE_TIME = 10000;
|
|
3
3
|
export declare const ICONS_PATH = "frontend/components/toast/assets/icons";
|
|
4
4
|
export declare const TOAST_NATIVE_STYLES: {
|
|
5
5
|
'&': {
|
|
@@ -1,9 +1,53 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import React, { createContext } from "react";
|
|
2
|
+
import React, { createContext, useMemo } from "react";
|
|
3
3
|
const WindowToolsMFContext = createContext(null);
|
|
4
4
|
function WindowToolsMFProvider(props) {
|
|
5
|
-
const {
|
|
6
|
-
|
|
5
|
+
const {
|
|
6
|
+
children,
|
|
7
|
+
getCookie,
|
|
8
|
+
getWindowId,
|
|
9
|
+
getCookies,
|
|
10
|
+
setActions,
|
|
11
|
+
setCookie,
|
|
12
|
+
startProgress,
|
|
13
|
+
stopProgress,
|
|
14
|
+
toast,
|
|
15
|
+
close,
|
|
16
|
+
setFnQueryClose,
|
|
17
|
+
setWindowTitle,
|
|
18
|
+
setWindowSubTitle,
|
|
19
|
+
setWindowEditionInfo
|
|
20
|
+
} = props;
|
|
21
|
+
const value = useMemo(() => ({
|
|
22
|
+
getCookie,
|
|
23
|
+
getWindowId,
|
|
24
|
+
getCookies,
|
|
25
|
+
setActions,
|
|
26
|
+
setCookie,
|
|
27
|
+
startProgress,
|
|
28
|
+
stopProgress,
|
|
29
|
+
toast,
|
|
30
|
+
close,
|
|
31
|
+
setFnQueryClose,
|
|
32
|
+
setWindowTitle,
|
|
33
|
+
setWindowSubTitle,
|
|
34
|
+
setWindowEditionInfo
|
|
35
|
+
}), [
|
|
36
|
+
getCookie,
|
|
37
|
+
getWindowId,
|
|
38
|
+
getCookies,
|
|
39
|
+
setActions,
|
|
40
|
+
setCookie,
|
|
41
|
+
startProgress,
|
|
42
|
+
stopProgress,
|
|
43
|
+
toast,
|
|
44
|
+
close,
|
|
45
|
+
setFnQueryClose,
|
|
46
|
+
setWindowTitle,
|
|
47
|
+
setWindowSubTitle,
|
|
48
|
+
setWindowEditionInfo
|
|
49
|
+
]);
|
|
50
|
+
return /* @__PURE__ */ jsx(WindowToolsMFContext.Provider, { value, children });
|
|
7
51
|
}
|
|
8
52
|
const MemonizedWindowToolsMFContext = React.memo(WindowToolsMFProvider);
|
|
9
53
|
export {
|
|
@@ -53,7 +53,7 @@ export interface WindowToolsMF {
|
|
|
53
53
|
/**
|
|
54
54
|
* Método para cerrar la ventana actual.
|
|
55
55
|
*/
|
|
56
|
-
close: () => void;
|
|
56
|
+
close: (useFnQueryClose?: boolean) => void;
|
|
57
57
|
/**
|
|
58
58
|
* Método para establecer la función de consulta de cierre de la ventana.
|
|
59
59
|
* @param fnQueryClose La función de consulta de cierre de la ventana que se desea establecer.
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ComponentProps } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* Componente encargado de renderizar el componente de la ventana.
|
|
4
|
+
* Componente encargado de renderizar el componente de la ventana con transición y loader.
|
|
5
|
+
* Usa useTransition para priorizar el loader y mantener la UI responsive durante el renderizado pesado.
|
|
6
|
+
*
|
|
7
|
+
* ## Flujo de renderizado:
|
|
8
|
+
* 1. Monta con shouldRender=false, isPending=false → muestra nada (o loader inicial)
|
|
9
|
+
* 2. useEffect ejecuta: startTransition(() => setShouldRender(true))
|
|
10
|
+
* 3. React marca la actualización como "no urgente" e inmediatamente isPending=true → muestra loader
|
|
11
|
+
* 4. React procesa el cambio de shouldRender: useMemo se re-ejecuta y crea el componente pesado
|
|
12
|
+
* 5. Cuando termina TODO el trabajo de render: isPending=false → muestra componente con fade in
|
|
13
|
+
*
|
|
14
|
+
* La clave es que React mantiene isPending=true durante TODO el tiempo que tarde en procesar
|
|
15
|
+
* la actualización de estado y el render que causa (incluyendo el useMemo pesado).
|
|
5
16
|
*/
|
|
6
17
|
export declare const WindowBaseComponent: (props: ComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
18
|
export declare const MemonizedComponent: React.MemoExoticComponent<(props: ComponentProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,11 +1,65 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useTransition, useState, useRef, useMemo, createElement, useEffect } from "react";
|
|
3
3
|
import { a as WindowContainerComponentStyled } from "../../slots/WindowBaseSlots.js";
|
|
4
|
+
import { P as PropagateLoaderSpinner } from "../../../extended/React-Spinners/PropagateLoaderSpinner/PropagateLoaderSpinner.js";
|
|
4
5
|
import { a as WindowToolsMFProvider } from "../../contexts/WindowToolsMFContext/WindowToolsMFContext.js";
|
|
5
6
|
import { a as DynamicMFParmsProvider } from "../../contexts/DynamicMFParmsContext/DynamicMFParmsContext.js";
|
|
6
7
|
const WindowBaseComponent = (props) => {
|
|
7
8
|
const { component, dynamicMFStore, windowTools, componentProps, emergeType } = props;
|
|
8
|
-
|
|
9
|
+
const [isPending, startTransition] = useTransition();
|
|
10
|
+
const [shouldRender, setShouldRender] = useState(false);
|
|
11
|
+
const mountTimeRef = useRef(performance.now());
|
|
12
|
+
const renderedComponent = useMemo(() => {
|
|
13
|
+
if (!shouldRender) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const renderStartTime = performance.now();
|
|
17
|
+
const component_result = typeof component === "function" ? createElement(component, componentProps) : component;
|
|
18
|
+
const renderTime = performance.now() - renderStartTime;
|
|
19
|
+
if (process.env.NODE_ENV === "development" && renderTime > 100) {
|
|
20
|
+
console.warn(`⚠️ WindowBase component rendering took ${renderTime.toFixed(2)}ms`);
|
|
21
|
+
}
|
|
22
|
+
return component_result;
|
|
23
|
+
}, [shouldRender, component, componentProps]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
startTransition(() => {
|
|
26
|
+
setShouldRender(true);
|
|
27
|
+
});
|
|
28
|
+
const timer = setTimeout(() => {
|
|
29
|
+
const totalTime = performance.now() - mountTimeRef.current;
|
|
30
|
+
if (process.env.NODE_ENV === "development" && totalTime > 500) {
|
|
31
|
+
console.warn(`⏱️ WindowBase total mount time: ${totalTime.toFixed(2)}ms`);
|
|
32
|
+
}
|
|
33
|
+
}, 0);
|
|
34
|
+
return () => clearTimeout(timer);
|
|
35
|
+
}, []);
|
|
36
|
+
return /* @__PURE__ */ jsx(WindowToolsMFProvider, { ...windowTools, children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, { store: dynamicMFStore, children: /* @__PURE__ */ jsx(
|
|
37
|
+
WindowContainerComponentStyled,
|
|
38
|
+
{
|
|
39
|
+
ownerState: { emergeType },
|
|
40
|
+
children: isPending ? (
|
|
41
|
+
// Mientras isPending=true, mostrar solo el loader
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
style: {
|
|
46
|
+
position: "absolute",
|
|
47
|
+
display: "flex",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
width: "100%",
|
|
51
|
+
height: "100%",
|
|
52
|
+
zIndex: 1e3
|
|
53
|
+
},
|
|
54
|
+
children: /* @__PURE__ */ jsx(PropagateLoaderSpinner, {})
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
) : (
|
|
58
|
+
// Cuando isPending=false, mostrar componente con fade in
|
|
59
|
+
renderedComponent
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
) }) });
|
|
9
63
|
};
|
|
10
64
|
React.memo(WindowBaseComponent);
|
|
11
65
|
export {
|
|
@@ -3,6 +3,7 @@ import { DynamicMFStore } from '../../contexts/DynamicMFParmsContext/store';
|
|
|
3
3
|
import { JSX_REACT_NODE } from '../../../WindowBase/types';
|
|
4
4
|
import { EmergeType } from '../../../areas/types';
|
|
5
5
|
export interface ComponentProps {
|
|
6
|
+
id: string;
|
|
6
7
|
emergeType: EmergeType;
|
|
7
8
|
windowTools: WindowToolsMF;
|
|
8
9
|
dynamicMFStore: DynamicMFStore;
|
|
@@ -16,7 +16,7 @@ export type WindowOptions = {
|
|
|
16
16
|
*/
|
|
17
17
|
allowPersistCookies: boolean;
|
|
18
18
|
};
|
|
19
|
-
export type JSX_REACT_NODE = ((props?: any) => JSX.Element) |
|
|
19
|
+
export type JSX_REACT_NODE = ((props?: any) => JSX.Element) | JSX.Element;
|
|
20
20
|
/**
|
|
21
21
|
* Tipo que representa el tipo de ventana: microfrontend o componente.
|
|
22
22
|
*/
|
|
@@ -68,7 +68,7 @@ const useWindow = (windowId, areaId) => {
|
|
|
68
68
|
getCookie: (id) => getCookie(windowId, id),
|
|
69
69
|
getCookies: (type) => getCookies(windowId, type),
|
|
70
70
|
setCookie: (id, type, cookie) => setCookie(windowId, id, type, cookie),
|
|
71
|
-
close: () => close(windowId),
|
|
71
|
+
close: (useFnQueryClose = true) => close(windowId, useFnQueryClose),
|
|
72
72
|
startProgress: () => startProgress(windowId),
|
|
73
73
|
stopProgress: () => stopProgress(windowId),
|
|
74
74
|
setFnQueryClose: (fnQueryClose) => setFnQueryClose(windowId, fnQueryClose),
|
|
@@ -721,9 +721,13 @@ const createAreasStore = (initProps, storeDevtoolsEnabled = false) => {
|
|
|
721
721
|
/**
|
|
722
722
|
* close window
|
|
723
723
|
*/
|
|
724
|
-
close: (windowId) => {
|
|
724
|
+
close: (windowId, useFnQueryClose = true) => {
|
|
725
725
|
const hW = get().hashWindows[windowId];
|
|
726
726
|
if (hW) {
|
|
727
|
+
if (hW.fnQueryClose && useFnQueryClose) {
|
|
728
|
+
hW.fnQueryClose();
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
727
731
|
const onClose = hW.onClose;
|
|
728
732
|
if (onClose) {
|
|
729
733
|
onClose(hW.windowId);
|
|
@@ -285,7 +285,7 @@ export interface AreasStoreStateWithActions extends AreasStoreState {
|
|
|
285
285
|
getCookie: (windowId: string, id: string) => Record<string, any> | undefined;
|
|
286
286
|
getCookies: (windowId: string, type: CookieType) => Record<string, any>;
|
|
287
287
|
setCookie: (windowId: string, id: string, type: CookieType, cookie: Record<string, any>) => void;
|
|
288
|
-
close: (windowId: string) => void;
|
|
288
|
+
close: (windowId: string, useFnQueryClose?: boolean) => void;
|
|
289
289
|
startProgress: (windowId: string) => void;
|
|
290
290
|
stopProgress: (windowId: string) => void;
|
|
291
291
|
loadCookiesFromApi: (windowId: string) => void;
|
|
@@ -17,7 +17,7 @@ export interface CircularProgressProps extends Omit<MUICircularProgressProps, 'c
|
|
|
17
17
|
* Este debe ser un valor de la paleta de colores personalizada (`ComponentPalletColor`),
|
|
18
18
|
* restringido actualmente al color `primary`.
|
|
19
19
|
*/
|
|
20
|
-
color?:
|
|
20
|
+
color?: ComponentPalletColor;
|
|
21
21
|
/**
|
|
22
22
|
* Tamaño del componente.
|
|
23
23
|
* Solo se aceptan los valores `small` y `medium`, que representan tamaños predefinidos.
|
|
@@ -262,10 +262,14 @@ const createPopupsStore = (initProps, storeDevtoolsEnabled = false) => {
|
|
|
262
262
|
/**
|
|
263
263
|
* closePopup: Cierra un popup
|
|
264
264
|
*/
|
|
265
|
-
close: (popupId) => {
|
|
265
|
+
close: (popupId, useFnQueryClose = true) => {
|
|
266
266
|
if (!get().hashPopups[popupId]) {
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
|
+
if (get().hashPopups[popupId].fnQueryClose && useFnQueryClose) {
|
|
270
|
+
get().hashPopups[popupId].fnQueryClose?.();
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
269
273
|
set((state) => {
|
|
270
274
|
state.hashPopups[popupId].status = "closing";
|
|
271
275
|
});
|
|
@@ -296,7 +296,7 @@ export interface PopupsProviderStoreStateWithActions extends PopupsProviderStore
|
|
|
296
296
|
/**
|
|
297
297
|
* pasa el status a closing para que las las transiciones se ejecuten.
|
|
298
298
|
*/
|
|
299
|
-
close: (popupId: string) => void;
|
|
299
|
+
close: (popupId: string, useFnQueryClose?: boolean) => void;
|
|
300
300
|
/**
|
|
301
301
|
* Modifica un popup espeficio
|
|
302
302
|
*/
|
|
@@ -5,9 +5,6 @@ import { WindowToolsMF } from '../../../../WindowBase/contexts';
|
|
|
5
5
|
* Este hook encapsula la lógica relacionada con el estado y las funciones necesarias
|
|
6
6
|
* para el componente Popup. Retorna un objeto con el estado, las acciones y las herramientas
|
|
7
7
|
* de la ventana popup.
|
|
8
|
-
* @param {string} areaId - Identificador del área.
|
|
9
|
-
* @param {string} popupId - Identificador del popup.
|
|
10
|
-
* @returns {Object} Objeto con estado, acciones y herramientas del popup.
|
|
11
8
|
*/
|
|
12
9
|
export declare const usePopups: (popupId: string) => {
|
|
13
10
|
winType: "component" | "microfrontend";
|
|
@@ -17,7 +14,8 @@ export declare const usePopups: (popupId: string) => {
|
|
|
17
14
|
iconUrl: string;
|
|
18
15
|
selected: boolean;
|
|
19
16
|
mfProps: import('../../../../MFLoader/types').MFBaseProps | undefined;
|
|
20
|
-
component: import('../../../../WindowBase').JSX_REACT_NODE;
|
|
17
|
+
component: import('../../../../WindowBase').JSX_REACT_NODE | undefined;
|
|
18
|
+
componentProps: Record<string, any> | undefined;
|
|
21
19
|
loading: boolean | undefined;
|
|
22
20
|
status: import('../../PopupsViewer/types').PopupStatus;
|
|
23
21
|
version: string | undefined;
|
|
@@ -43,6 +43,10 @@ const usePopups = (popupId) => {
|
|
|
43
43
|
(state) => state.hashPopups[popupId].winType === "component" ? state.hashPopups[popupId].component : void 0,
|
|
44
44
|
shallow
|
|
45
45
|
);
|
|
46
|
+
const componentProps = usePopupsStore(
|
|
47
|
+
(state) => state.hashPopups[popupId].winType === "component" ? state.hashPopups[popupId].componentProps : void 0,
|
|
48
|
+
shallow
|
|
49
|
+
);
|
|
46
50
|
const selectedPopupId = usePopupsStore(
|
|
47
51
|
(state) => state.hashGroups[state.hashPopups[popupId].groupId].selectedPopupId,
|
|
48
52
|
shallow
|
|
@@ -65,16 +69,21 @@ const usePopups = (popupId) => {
|
|
|
65
69
|
setActions: (newActions, newVersion, newBuildTime) => {
|
|
66
70
|
setActions(popupId, newActions, newVersion, newBuildTime);
|
|
67
71
|
},
|
|
72
|
+
/**
|
|
73
|
+
* TODO: Implementar
|
|
74
|
+
*/
|
|
68
75
|
getCookie: () => {
|
|
69
|
-
|
|
76
|
+
return void 0;
|
|
70
77
|
},
|
|
78
|
+
/**
|
|
79
|
+
* TODO: Implementar
|
|
80
|
+
*/
|
|
71
81
|
getCookies: () => {
|
|
72
|
-
|
|
82
|
+
return {};
|
|
73
83
|
},
|
|
74
|
-
setCookie: (
|
|
75
|
-
throw new Error(`setCookie not implemented: ${key}, ${value}`);
|
|
84
|
+
setCookie: (_key, _value) => {
|
|
76
85
|
},
|
|
77
|
-
close: () => close(popupId),
|
|
86
|
+
close: (useFnQueryClose = true) => close(popupId, useFnQueryClose),
|
|
78
87
|
startProgress: () => startProgress(popupId),
|
|
79
88
|
stopProgress: () => stopProgress(popupId),
|
|
80
89
|
setFnQueryClose: (fnQueryClose) => setFnQueryClose(popupId, fnQueryClose),
|
|
@@ -89,7 +98,6 @@ const usePopups = (popupId) => {
|
|
|
89
98
|
}),
|
|
90
99
|
[
|
|
91
100
|
popupId,
|
|
92
|
-
buildTime,
|
|
93
101
|
setActions,
|
|
94
102
|
//getCookie,
|
|
95
103
|
//getCookies,
|
|
@@ -97,7 +105,10 @@ const usePopups = (popupId) => {
|
|
|
97
105
|
close,
|
|
98
106
|
startProgress,
|
|
99
107
|
stopProgress,
|
|
100
|
-
setFnQueryClose
|
|
108
|
+
setFnQueryClose,
|
|
109
|
+
update,
|
|
110
|
+
hide,
|
|
111
|
+
show
|
|
101
112
|
]
|
|
102
113
|
);
|
|
103
114
|
const memoizedActions = useHeaderActionsPopups({
|
|
@@ -112,6 +123,7 @@ const usePopups = (popupId) => {
|
|
|
112
123
|
selected: selectedPopupId === popupId,
|
|
113
124
|
mfProps,
|
|
114
125
|
component,
|
|
126
|
+
componentProps,
|
|
115
127
|
loading,
|
|
116
128
|
status,
|
|
117
129
|
version,
|
|
@@ -33,7 +33,7 @@ const PopupsViewer = (props) => {
|
|
|
33
33
|
return /* @__PURE__ */ jsx(
|
|
34
34
|
CSSTransition,
|
|
35
35
|
{
|
|
36
|
-
timeout: { appear: 0, enter:
|
|
36
|
+
timeout: { appear: 0, enter: 0, exit: 0 },
|
|
37
37
|
nodeRef: popupRefsMap.current[id],
|
|
38
38
|
unmountOnExit: true,
|
|
39
39
|
onEntered: () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useRef, useEffect } from "react";
|
|
2
|
+
import { forwardRef, useRef, useEffect, useMemo } from "react";
|
|
3
3
|
import { shallow } from "zustand/shallow";
|
|
4
4
|
import { u as usePopupsStore } from "../../../PopupsProvider/hooks/usePopupsStore.js";
|
|
5
5
|
import { P as PopupDragWindowRootStyled } from "../../slots/popupsViewerSlots.js";
|
|
@@ -9,10 +9,11 @@ import { a as POPUPS_VIEWER_CLASS_NAME } from "../../constants.js";
|
|
|
9
9
|
import { a as getNameDataTestId } from "../../../../../../test/getNameDataTestId.js";
|
|
10
10
|
import { M as MemonizedWindowBaseMicroFrontend } from "../../../../../WindowBase/subcomponents/MicroFrontend/MicroFrontend.js";
|
|
11
11
|
import { W as WindowBaseComponent } from "../../../../../WindowBase/subcomponents/Component/index.js";
|
|
12
|
+
import { d as deepShallow } from "../../../../../../utils/deepShallow.js";
|
|
12
13
|
import { W as WindowBase } from "../../../../../WindowBase/WindowBase.js";
|
|
13
14
|
const Popup = forwardRef((props, ref) => {
|
|
14
15
|
const { popupId, containerElement, containerSize, style, onResizeStart, onResizeStop, onDragStart, onDragStop, loggedUser } = props;
|
|
15
|
-
const popup = usePopupsStore((state) => state.hashPopups[popupId],
|
|
16
|
+
const popup = usePopupsStore((state) => state.hashPopups[popupId], deepShallow);
|
|
16
17
|
const { bringPopupOnFront } = usePopupsStore((state) => state.popupsActions, shallow);
|
|
17
18
|
const { close } = usePopupsStore((state) => state.popupActions, shallow);
|
|
18
19
|
const refHandler = useRef(null);
|
|
@@ -32,6 +33,7 @@ const Popup = forwardRef((props, ref) => {
|
|
|
32
33
|
windowTools,
|
|
33
34
|
mfProps,
|
|
34
35
|
component,
|
|
36
|
+
componentProps,
|
|
35
37
|
//onTouch,
|
|
36
38
|
memoizedActions,
|
|
37
39
|
loading,
|
|
@@ -75,6 +77,33 @@ const Popup = forwardRef((props, ref) => {
|
|
|
75
77
|
refHandler.current?.ensureVisible();
|
|
76
78
|
}
|
|
77
79
|
}, [popup.enforceVisibleCount, popupId]);
|
|
80
|
+
const memoComponent = useMemo(() => {
|
|
81
|
+
if (winType === "microfrontend") {
|
|
82
|
+
return /* @__PURE__ */ jsx(
|
|
83
|
+
MemonizedWindowBaseMicroFrontend,
|
|
84
|
+
{
|
|
85
|
+
emergeType: "popup",
|
|
86
|
+
moduleId,
|
|
87
|
+
dynamicMFStore,
|
|
88
|
+
windowTools,
|
|
89
|
+
loggedUser,
|
|
90
|
+
...mfProps ?? { debugPort: 0, prefix: "" }
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
} else {
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
WindowBaseComponent,
|
|
96
|
+
{
|
|
97
|
+
id: popupId,
|
|
98
|
+
emergeType: "popup",
|
|
99
|
+
dynamicMFStore,
|
|
100
|
+
windowTools,
|
|
101
|
+
component,
|
|
102
|
+
componentProps
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}, [winType, component, componentProps, moduleId, dynamicMFStore, windowTools, loggedUser, mfProps, popupId]);
|
|
78
107
|
if (!popup) {
|
|
79
108
|
return null;
|
|
80
109
|
}
|
|
@@ -126,25 +155,7 @@ const Popup = forwardRef((props, ref) => {
|
|
|
126
155
|
"root"
|
|
127
156
|
)
|
|
128
157
|
} : {},
|
|
129
|
-
children:
|
|
130
|
-
MemonizedWindowBaseMicroFrontend,
|
|
131
|
-
{
|
|
132
|
-
emergeType: "popup",
|
|
133
|
-
moduleId,
|
|
134
|
-
dynamicMFStore,
|
|
135
|
-
windowTools,
|
|
136
|
-
loggedUser,
|
|
137
|
-
...mfProps ?? { debugPort: 0, prefix: "" }
|
|
138
|
-
}
|
|
139
|
-
) : /* @__PURE__ */ jsx(
|
|
140
|
-
WindowBaseComponent,
|
|
141
|
-
{
|
|
142
|
-
emergeType: "popup",
|
|
143
|
-
dynamicMFStore,
|
|
144
|
-
windowTools,
|
|
145
|
-
component
|
|
146
|
-
}
|
|
147
|
-
)
|
|
158
|
+
children: memoComponent
|
|
148
159
|
}
|
|
149
160
|
)
|
|
150
161
|
}
|