@m4l/components 9.2.53 → 9.2.54-beta.2

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 (27) hide show
  1. package/components/ToastContainer/ToastContainer.styles.js +2 -8
  2. package/components/WindowBase/WindowBase.js +2 -0
  3. package/components/WindowBase/contexts/WindowToolsMFContext/types.d.ts +2 -1
  4. package/components/WindowBase/index.d.ts +1 -1
  5. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.d.ts +0 -26
  6. package/components/WindowBase/subcomponents/Header/HeaderWindowBase.js +29 -38
  7. package/components/WindowBase/subcomponents/Header/types.d.ts +1 -1
  8. package/components/WindowBase/subcomponents/Header/useButtonActions.d.ts +5 -0
  9. package/components/WindowBase/subcomponents/Header/useButtonActions.js +36 -0
  10. package/components/WindowBase/subcomponents/MemoizedIconButton/MemoizedIconButton.d.ts +1 -1
  11. package/components/WindowBase/subcomponents/MemoizedIconButton/MemoizedIconButton.js +1 -1
  12. package/components/WindowBase/subcomponents/MemoizedIconButton/types.d.ts +4 -0
  13. package/components/WindowBase/types.d.ts +32 -37
  14. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/Window.js +2 -0
  15. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.d.ts +1 -0
  16. package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/Window/hooks/useWindow.js +8 -3
  17. package/components/areas/contexts/AreasContext/store.js +2 -1
  18. package/components/areas/contexts/AreasContext/types.d.ts +1 -1
  19. package/components/areas/types.d.ts +4 -0
  20. package/components/hook-form/RHFAutocompleteAsync/tests/common.d.ts +4 -2
  21. package/components/mui_extended/Autocomplete/hooks/useValuesAndHandlers.js +11 -1
  22. package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.js +2 -1
  23. package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +6 -2
  24. package/components/popups/components/PopupsProvider/hooks/useHeaderActionsPopups.js +1 -3
  25. package/components/popups/components/PopupsProvider/hooks/usePopups.d.ts +1 -0
  26. package/components/popups/components/PopupsProvider/hooks/usePopups.js +5 -2
  27. package/package.json +1 -1
@@ -1,4 +1,3 @@
1
- import { a as getHeightSizeStyles } from "../../utils/getSizeStyles/getSizeStyles.js";
2
1
  const toastStyles = {
3
2
  /** Root del componente ToastContainer */
4
3
  root: ({ theme, ownerState }) => ({
@@ -139,16 +138,11 @@ const toastStyles = {
139
138
  gap: theme.vars.size.baseSpacings.sp1
140
139
  }),
141
140
  /** 🗣️ Header del ToastContainer 🗣️ */
142
- messageHeader: ({ theme, ownerState }) => ({
141
+ messageHeader: ({ theme }) => ({
143
142
  width: "100%",
144
143
  display: "flex",
145
144
  gap: theme.vars.size.baseSpacings.sp1,
146
- alignItems: "center",
147
- ...getHeightSizeStyles(
148
- theme.generalSettings.isMobile,
149
- ownerState.size || "medium",
150
- "container"
151
- )
145
+ alignItems: "center"
152
146
  }),
153
147
  /** 🔠 Titulo del Header 🔠 */
154
148
  messageTitle: () => ({
@@ -17,6 +17,7 @@ const WindowBase = (props) => {
17
17
  selected = false,
18
18
  variant = "outlined",
19
19
  version,
20
+ buildTime,
20
21
  dataTestId,
21
22
  onClose,
22
23
  className,
@@ -46,6 +47,7 @@ const WindowBase = (props) => {
46
47
  {
47
48
  ...getPropDataTestId(WINDOW_BASE_KEY_COMPONENT, WindowBaseSlots.headerContentWindowBase, dataTestId),
48
49
  version,
50
+ buildTime,
49
51
  size,
50
52
  selected,
51
53
  onClose,
@@ -27,8 +27,9 @@ export interface WindowToolsMF {
27
27
  * Método para establecer las acciones de ventana para el área actual.
28
28
  * @param newActions Las nuevas acciones de ventana que se desean establecer.
29
29
  * @param version (Opcional) La versión de las acciones de ventana.
30
+ * @param buildTime (Opcional) El buildTime del Microfrontend.
30
31
  */
31
- setActions: (newActions: ModuleAction[], version?: string) => void;
32
+ setActions: (newActions: ModuleAction[], version?: string, buildTime?: string) => void;
32
33
  /**
33
34
  * Método para establecer una cookie específica.
34
35
  * @param id El ID de la cookie que se desea establecer.
@@ -4,4 +4,4 @@ export * from './hooks/useDynamicMFParameters';
4
4
  export * from './contexts/WindowToolsMFContext';
5
5
  export * from './contexts/DynamicMFParmsContext';
6
6
  export type { WindowToolsMFContextProps } from './contexts/WindowToolsMFContext/types';
7
- export type { ModuleAction } from './types';
7
+ export type { ModuleAction, GroupActionMenuItem, ModuleActionGroup } from './types';
@@ -11,31 +11,5 @@ import { WindowBaseOwnerState } from '../../types';
11
11
  * - Display the header for a `WindowBase` component.
12
12
  * - Provides flexibility to add a title, subtitle, icon, version label, and menu actions.
13
13
  * - Visually supports a selected state (`selected`) for a distinct appearance when the window is active.
14
- *
15
- * ### Props:
16
- * - `title` (string): The title to be displayed in the header.
17
- * - `subTitle` (string, optional): The subtitle displayed below the title.
18
- * - `onClose` (VoidFunction, optional): Callback executed when the close button is clicked.
19
- * - `urlIcon` (string, optional): The URL for the icon to be shown in the header.
20
- * - `menuActions` (MenuAction[], optional): List of actions for the header's dropdown menu.
21
- * - `size` ('small' | 'medium' | 'large', optional): Defines the header size, default is `medium`.
22
- * - `color` ('default', optional): Base color of the header, default is `default`.
23
- * - `selected` (boolean, optional): Indicates if the window is selected. Modifies visual appearance when active.
24
- * - `version` (string, optional): Version label to be displayed in the header.
25
- *
26
- * ### Example Usage:
27
- * ```tsx
28
- * <HeaderWindowBase
29
- * title="My Window"
30
- * subTitle="Additional Details"
31
- * onClose={() => console.log('Closing window')}
32
- * iconUrl="https://example.com/icon.png"
33
- * menuActions={[
34
- * { label: 'Action 1', onClick: () => console.log('Action 1 selected') },
35
- * { label: 'Action 2', onClick: () => console.log('Action 2 selected') },
36
- * ]}
37
- * selected={true}
38
- * />
39
- * ```
40
14
  */
41
15
  export declare const HeaderWindowBase: (props: HeaderProps & WindowBaseOwnerState) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,12 @@
1
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useEnvironment } from "@m4l/core";
3
3
  import { useState, useEffect, useMemo } from "react";
4
4
  import { I as ICONS } from "../../icons.js";
5
5
  import { d as dragResizeWindowRNDClasses } from "../../../DragResizeWindowRND/classes/index.js";
6
6
  import { I as IconButton } from "../../../mui_extended/IconButton/IconButton.js";
7
7
  import { deepEqual } from "fast-equals";
8
- import { M as MemoizedIconButton } from "../MemoizedIconButton/MemoizedIconButton.js";
8
+ import { useFormatter } from "@m4l/graphics";
9
+ import { u as useButtonActions } from "./useButtonActions.js";
9
10
  import { H as HeaderWindowComponentStyled, c as HeaderContentStyled, I as IconWindowStyled, T as TitleWindowStyled, S as SubtitleContainerStyled, P as PointStyled, d as PointIconStyled, e as SubtitleWindowStyled, f as IconsWrapperStyled, M as MenuActionsWindowsStyled } from "../../slots/WindowBaseSlots.js";
10
11
  const HeaderWindowBase = (props) => {
11
12
  const {
@@ -16,10 +17,12 @@ const HeaderWindowBase = (props) => {
16
17
  size,
17
18
  selected,
18
19
  version,
20
+ buildTime,
19
21
  variant,
20
22
  actions = []
21
23
  } = props;
22
24
  const { host_static_assets, environment_assets } = useEnvironment();
25
+ const { dateFormatter } = useFormatter();
23
26
  const [leftActions, setLeftActions] = useState(() => actions.filter((action) => action.place === "left"));
24
27
  const [rightActions, setRightActions] = useState(() => actions.filter((action) => action.place === "right"));
25
28
  const [insideActions, setInsideActions] = useState(() => actions.filter((action) => action.place === "inside"));
@@ -52,58 +55,46 @@ const HeaderWindowBase = (props) => {
52
55
  }, [actions]);
53
56
  const menuActions = useMemo(() => {
54
57
  const memoizedActions = [
55
- ...insideActions.map((action) => ({
56
- type: "menuItem",
57
- startIcon: action.iconUrl,
58
- label: action.label,
59
- onClick: action.onClick,
60
- disabled: action.disabled
61
- }))
58
+ ...insideActions.map((action) => {
59
+ if (action.type === "groupActions") {
60
+ return action.actions.map((groupAction) => ({
61
+ type: "menuItem",
62
+ startIcon: groupAction.iconUrl,
63
+ label: groupAction.label,
64
+ onClick: groupAction.onClick,
65
+ disabled: groupAction.disabled,
66
+ checkable: true,
67
+ checked: groupAction.key === action.selectedActionKey
68
+ }));
69
+ }
70
+ return {
71
+ type: "menuItem",
72
+ startIcon: action.iconUrl,
73
+ label: action.label,
74
+ onClick: action.onClick,
75
+ disabled: action.disabled
76
+ };
77
+ }).flat()
62
78
  ];
63
79
  if (version) {
64
80
  memoizedActions.push({
65
81
  type: "menuItem",
66
82
  startIcon: `${host_static_assets}/${environment_assets}/frontend/components/menu_actions/assets/icons/${ICONS.VERSION}`,
67
- label: version,
83
+ label: buildTime ? `${version} - ${dateFormatter.formatDate(new Date(buildTime), dateFormatter.datetimeFormat)}` : version,
68
84
  onClick: () => {
69
85
  },
70
86
  disabled: true
71
87
  });
72
88
  }
73
89
  return memoizedActions;
74
- }, [insideActions, version, host_static_assets, environment_assets]);
90
+ }, [insideActions, version, host_static_assets, environment_assets, buildTime, dateFormatter]);
75
91
  const ownerState = {
76
92
  selected,
77
93
  variant,
78
94
  size
79
95
  };
80
- const IconButtonLeftActions = useMemo(() => /* @__PURE__ */ jsx(Fragment, { children: leftActions.map((action) => /* @__PURE__ */ jsx(
81
- MemoizedIconButton,
82
- {
83
- iconUrl: action.iconUrl,
84
- label: action.label,
85
- disabled: action.disabled,
86
- onClick: action.onClick || (() => {
87
- })
88
- },
89
- action.key
90
- )) }), [leftActions]);
91
- const IconButtonRightActions = useMemo(() => {
92
- if (rightActions.length === 0) {
93
- return null;
94
- }
95
- return /* @__PURE__ */ jsx(Fragment, { children: rightActions.map((action) => /* @__PURE__ */ jsx(
96
- MemoizedIconButton,
97
- {
98
- iconUrl: action.iconUrl,
99
- label: action.label,
100
- disabled: action.disabled,
101
- onClick: action.onClick || (() => {
102
- })
103
- },
104
- action.key
105
- )) });
106
- }, [rightActions]);
96
+ const IconButtonLeftActions = useButtonActions(leftActions);
97
+ const IconButtonRightActions = useButtonActions(rightActions);
107
98
  return /* @__PURE__ */ jsxs(HeaderWindowComponentStyled, { className: dragResizeWindowRNDClasses.draggableHandle, ownerState, children: [
108
99
  /* @__PURE__ */ jsxs(HeaderContentStyled, { ownerState, children: [
109
100
  iconUrl && /* @__PURE__ */ jsx(IconWindowStyled, { size, ownerState, src: iconUrl, "aria-label": "main icon" }),
@@ -32,7 +32,7 @@ import { WindowBaseAction, WindowBaseProps } from '../../types';
32
32
  * - `selected` modifies the visual appearance to indicate the selected state.
33
33
  * @see WindowBaseProps - General properties for the window base.
34
34
  */
35
- export type HeaderProps = Pick<WindowBaseProps, 'title' | 'subTitle' | 'iconUrl' | 'onClose' | 'version' | 'selected' | 'variant'> & {
35
+ export type HeaderProps = Pick<WindowBaseProps, 'title' | 'subTitle' | 'iconUrl' | 'onClose' | 'version' | 'selected' | 'variant' | 'buildTime'> & {
36
36
  actions?: WindowBaseAction[];
37
37
  };
38
38
  /**
@@ -0,0 +1,5 @@
1
+ import { WindowBaseAction } from '../../types';
2
+ /**
3
+ * `useButtonActions` Devuelve un componente de iconos para los botones de la cabecera, manejando los grupos de iconos
4
+ */
5
+ export declare const useButtonActions: (actions: WindowBaseAction[]) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ import { jsx, Fragment } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { M as MemoizedIconButton } from "../MemoizedIconButton/MemoizedIconButton.js";
4
+ const useButtonActions = (actions) => {
5
+ const MemoActions = useMemo(() => /* @__PURE__ */ jsx(Fragment, { children: actions.map((action) => {
6
+ if (action.type === "groupActions") {
7
+ return /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "row", gap: "8px" }, children: action.actions.map((groupAction) => /* @__PURE__ */ jsx(
8
+ MemoizedIconButton,
9
+ {
10
+ iconUrl: groupAction.iconUrl,
11
+ label: groupAction.label,
12
+ disabled: groupAction.disabled,
13
+ selected: groupAction.key === action.selectedActionKey,
14
+ onClick: groupAction.onClick || (() => {
15
+ })
16
+ },
17
+ groupAction.key
18
+ )) }, action.key);
19
+ }
20
+ return /* @__PURE__ */ jsx(
21
+ MemoizedIconButton,
22
+ {
23
+ iconUrl: action.iconUrl,
24
+ label: action.label,
25
+ disabled: action.disabled,
26
+ onClick: action.onClick || (() => {
27
+ })
28
+ },
29
+ action.key
30
+ );
31
+ }) }), [actions]);
32
+ return MemoActions;
33
+ };
34
+ export {
35
+ useButtonActions as u
36
+ };
@@ -6,5 +6,5 @@ import { MemoizedIconButtonProps } from './types';
6
6
  * This component renders an `IconButton` with an icon and tooltip.
7
7
  * It is memoized to avoid unnecessary re-renders when the props do not change.
8
8
  */
9
- declare const MemoizedIconButton: React.MemoExoticComponent<({ iconUrl, label, disabled, onClick }: MemoizedIconButtonProps) => import("react/jsx-runtime").JSX.Element>;
9
+ declare const MemoizedIconButton: React.MemoExoticComponent<({ iconUrl, label, disabled, onClick, selected }: MemoizedIconButtonProps) => import("react/jsx-runtime").JSX.Element>;
10
10
  export default MemoizedIconButton;
@@ -2,7 +2,7 @@ import { jsx } from "react/jsx-runtime";
2
2
  import React from "react";
3
3
  import { I as IconButton } from "../../../mui_extended/IconButton/IconButton.js";
4
4
  const MemoizedIconButton = React.memo(
5
- ({ iconUrl, label, disabled, onClick }) => /* @__PURE__ */ jsx(IconButton, { role: "button", "aria-label": label, tooltip: label, icon: iconUrl, disabled, onClick })
5
+ ({ iconUrl, label, disabled, onClick, selected }) => /* @__PURE__ */ jsx(IconButton, { role: "button", "aria-label": label, tooltip: label, icon: iconUrl, disabled, onClick, selected })
6
6
  );
7
7
  export {
8
8
  MemoizedIconButton as M
@@ -18,4 +18,8 @@ export interface MemoizedIconButtonProps {
18
18
  * Callback function executed when the button is clicked.
19
19
  */
20
20
  onClick: () => void;
21
+ /**
22
+ * Whether the button is selected.
23
+ */
24
+ selected?: boolean;
21
25
  }
@@ -26,7 +26,8 @@ export type WinType = 'microfrontend' | 'component';
26
26
  * normal: Se muestra inside del menu.
27
27
  */
28
28
  export type WindowActionType = 'main' | 'allways' | 'normal';
29
- export interface ModuleAction extends Pick<MenuItemAction, 'label' | 'selected' | 'color' | 'disabled' | 'checkable' | 'checked' | 'onClick'> {
29
+ export interface BaseModuleAction {
30
+ type?: 'menuItem' | 'groupActions';
30
31
  /**
31
32
  * Tipo de visibilidad de la acción de ventana.
32
33
  *
@@ -40,55 +41,44 @@ export interface ModuleAction extends Pick<MenuItemAction, 'label' | 'selected'
40
41
  * Etiqueta opcional para la acción de ventana.
41
42
  */
42
43
  tag?: any;
44
+ }
45
+ export type ModuleMenuItemAction = Pick<MenuItemAction, 'label' | 'selected' | 'color' | 'disabled' | 'checkable' | 'checked' | 'onClick'> & {
46
+ /**
47
+ * Icono opcional para la acción de ventana.
48
+ */
49
+ iconUrl: string;
43
50
  /**
44
51
  * Clase CSS opcional para la acción de ventana.
45
52
  */
46
53
  className?: string;
54
+ };
55
+ export interface ModuleActionMenuItem extends BaseModuleAction, ModuleMenuItemAction {
56
+ type?: 'menuItem';
57
+ }
58
+ export type GroupActionMenuItem<T extends string = string> = ModuleMenuItemAction & {
59
+ key: T;
60
+ };
61
+ export interface ModuleActionGroup<T extends string = string> extends BaseModuleAction {
62
+ type: 'groupActions';
47
63
  /**
48
- * Icono opcional para la acción de ventana.
64
+ * Clave de la acción seleccionada.
49
65
  */
50
- iconUrl: string;
66
+ selectedActionKey: T;
67
+ /**
68
+ * Lista de acciones del grupo.
69
+ */
70
+ actions: Array<GroupActionMenuItem<T>>;
51
71
  }
72
+ export type ModuleAction = ModuleActionMenuItem | ModuleActionGroup;
73
+ export type WindowBaseModuleAction = Omit<ModuleActionMenuItem, 'visibility'> | Omit<ModuleActionGroup, 'visibility'>;
52
74
  /**
53
75
  * Type representing a single action in the `WindowBase` component.
54
76
  */
55
- export interface WindowBaseAction extends Pick<ModuleAction, 'label' | 'selected' | 'color' | 'disabled' | 'checkable' | 'checked' | 'onClick' | 'key' | 'iconUrl'> {
77
+ export type WindowBaseAction = WindowBaseModuleAction & {
56
78
  place: 'left' | 'right' | 'inside';
57
- }
79
+ };
58
80
  /**
59
81
  * Interface representing the main properties of the `WindowBase` component.
60
- *
61
- * Defines the structure and functionality of the component, including its title, subtitle, content,
62
- * icon URL, menu actions, visual configurations, and other related attributes.
63
- * title (required) - The main title of the window.
64
- * subTitle (optional) - Subtitle for the window.
65
- * children (required) - Content to be rendered inside the window.
66
- * urlIcon (optional) - URL for the icon displayed in the header.
67
- * variant (optional) - Visual style of the window, with values `'outlined'` or `'text'`.
68
- * size (optional) - Size of the window: `'small'` or `'medium'`.
69
- * color (optional) - Theme color of the window, restricted to `'default'`.
70
- * selected (optional) - Indicates if the window is selected.
71
- * version (optional) - Component version (e.g., `1.0.0`).
72
- * dataTestId (optional) - Identifier for automated testing.
73
- * onClose (optional) - Function executed when the window is closed.
74
- *
75
- * ### Example:
76
- * ```typescript
77
- * const windowProps: WindowBaseProps = {
78
- * title: 'Main Window',
79
- * subTitle: 'Details',
80
- * children: <div>Window Content</div>,
81
- * urlIcon: 'https://example.com/icon.png',
82
- * variant: 'outlined',
83
- * menuActions: [{ label: 'Action 1', onClick: () => console.log('Action 1') }],
84
- * size: 'medium',
85
- * color: 'default',
86
- * selected: true,
87
- * version: '1.0.0',
88
- * dataTestId: 'main-window',
89
- * onClose: () => console.log('Cancel Clicked'),
90
- * };
91
- * ```
92
82
  */
93
83
  export interface WindowBaseProps {
94
84
  /**
@@ -135,6 +125,11 @@ export interface WindowBaseProps {
135
125
  * Useful for displaying version information (e.g., `1.0.0`) in the header or footer.
136
126
  */
137
127
  version?: string;
128
+ /**
129
+ * The build time for the window. si se proporcionana mostrá la versión y la fecha de compilación.
130
+ *
131
+ */
132
+ buildTime?: string;
138
133
  /**
139
134
  * A unique identifier for automated testing.
140
135
  * Provides a `data-testid` attribute for querying this component in tests.
@@ -16,6 +16,7 @@ const Window = (props) => {
16
16
  title,
17
17
  iconUrl,
18
18
  version,
19
+ buildTime,
19
20
  moduleCount,
20
21
  selected,
21
22
  mfProps,
@@ -39,6 +40,7 @@ const Window = (props) => {
39
40
  isLoading: loading,
40
41
  onClose: () => windowTools.close(),
41
42
  version,
43
+ buildTime,
42
44
  actions: memoizedActions,
43
45
  windowId,
44
46
  selected,
@@ -16,6 +16,7 @@ export declare const useWindow: (windowId: string, areaId?: string) => {
16
16
  title: string;
17
17
  iconUrl: string;
18
18
  version: string | undefined;
19
+ buildTime: string | undefined;
19
20
  moduleCount: number | undefined;
20
21
  selected: boolean;
21
22
  mfProps: any;
@@ -5,7 +5,7 @@ import { u as useHeaderActions } from "./useHeaderActions.js";
5
5
  import { u as usePopupsStore } from "../../../../../../../../popups/components/PopupsProvider/hooks/usePopupsStore.js";
6
6
  import { c as createToaster } from "../../../../../../../../ToastContainer/helpers/toaster.js";
7
7
  const useWindow = (windowId, areaId) => {
8
- const [emergeType, moduleId, winType, title, iconUrl, version, moduleCount, selected, loading, status, dynamicMFStore] = useAreasStore((state) => {
8
+ const [emergeType, moduleId, winType, title, iconUrl, version, buildTime, moduleCount, selected, loading, status, dynamicMFStore] = useAreasStore((state) => {
9
9
  const window = state.hashWindows[windowId];
10
10
  const selected2 = areaId ? state.hashAreas[areaId]?.currentLayoutId === windowId : false;
11
11
  return [
@@ -15,6 +15,7 @@ const useWindow = (windowId, areaId) => {
15
15
  window?.title,
16
16
  window?.iconUrl,
17
17
  window?.version,
18
+ window?.buildTime,
18
19
  window?.moduleCount,
19
20
  selected2,
20
21
  window?.loading,
@@ -39,8 +40,11 @@ const useWindow = (windowId, areaId) => {
39
40
  const windowTools = useMemo(
40
41
  () => ({
41
42
  getWindowId: () => windowId,
42
- setActions: (newActions, newVersion) => {
43
- setActions(windowId, newActions, newVersion);
43
+ /**
44
+ * Actualizar las acciones de la ventana
45
+ */
46
+ setActions: (newActions, newVersion, newBuildTime) => {
47
+ setActions(windowId, newActions, newVersion, newBuildTime);
44
48
  },
45
49
  getCookie: (id) => getCookie(windowId, id),
46
50
  getCookies: (type) => getCookies(windowId, type),
@@ -82,6 +86,7 @@ const useWindow = (windowId, areaId) => {
82
86
  title,
83
87
  iconUrl,
84
88
  version,
89
+ buildTime,
85
90
  moduleCount,
86
91
  selected,
87
92
  mfProps,
@@ -667,11 +667,12 @@ const createAreasStore = (initProps, storeDevtoolsEnabled = false) => {
667
667
  /**
668
668
  * setActions
669
669
  */
670
- setActions: (windowId, newActions, version) => {
670
+ setActions: (windowId, newActions, version, buildTime) => {
671
671
  set((state) => {
672
672
  if (state.hashWindows[windowId]) {
673
673
  state.hashWindows[windowId].moduleActions = cloneDeep(newActions);
674
674
  state.hashWindows[windowId].version = version;
675
+ state.hashWindows[windowId].buildTime = buildTime;
675
676
  }
676
677
  });
677
678
  },
@@ -281,7 +281,7 @@ export interface AreasStoreStateWithActions extends AreasStoreState {
281
281
  loadWindowsFromApi: (areaId: string) => void;
282
282
  };
283
283
  windowActions: {
284
- setActions: (windowId: string, newActions: ModuleAction[], version?: string) => void;
284
+ setActions: (windowId: string, newActions: ModuleAction[], version?: string, buildTime?: string) => void;
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;
@@ -43,6 +43,10 @@ export type WindowState = {
43
43
  * version del Microfrontend, esta version es actualizada normalmente por el ModuleLayout del microfrontend
44
44
  */
45
45
  version?: string;
46
+ /**
47
+ * buildTime del Microfrontend, esta buildTime es actualizada normalmente por el ModuleLayout del microfrontend
48
+ */
49
+ buildTime?: string;
46
50
  /**
47
51
  * Acciones del módulo.
48
52
  */
@@ -2,6 +2,7 @@ import { RHFAutocompleteAsyncProps } from '../types';
2
2
  import { renderMaterialUI } from '../../../../test';
3
3
  import { FieldValues } from 'react-hook-form';
4
4
  export declare const FIELD_NAME = "rhf-autocomplete-async";
5
+ export declare const FIELD_NAME_AFTER_TIME_SELECTED = "rhf-autocomplete-async-after-time-selected";
5
6
  export declare const FIELD_NAME_PRESELECTED = "rhf-autocomplete-async-preselected";
6
7
  export declare const FIELD_NAME_PRESELECTED_NOT_IN_OPTIONS = "rhf-autocomplete-async-preselected-not-in-options";
7
8
  export declare const FIELD_NAME_PRESELECTED_MULTIPLE = "rhf-autocomplete-async-preselected-multiple";
@@ -11,6 +12,7 @@ export interface OptionsTests {
11
12
  name: string;
12
13
  }
13
14
  export declare const mockItems: OptionsTests[];
15
+ export declare const mockItemAfterTimeSelected: OptionsTests;
14
16
  export declare const mockItemPreselected: OptionsTests;
15
17
  export declare const mockItemPreselectedMultiple: OptionsTests[];
16
18
  export declare const mockItemPreselectedNotInOptions: OptionsTests;
@@ -34,8 +36,8 @@ export declare const onChangeFilterParms: (newValue: string) => {
34
36
  /**
35
37
  * Renderiza el componente con el contexto de EnvironmentProvider y RHFormProvider.
36
38
  */
37
- export declare const renderWithContexts: (ui: React.ReactElement, initialValuesFormContext?: FieldValues, validationSchema?: any) => ReturnType<typeof renderMaterialUI>;
39
+ export declare const renderWithContexts: (ui: React.ReactElement, initialValuesFormContext?: FieldValues, validationSchema?: any, withFormChangeAuto?: boolean) => ReturnType<typeof renderMaterialUI>;
38
40
  /**
39
41
  * Renders the RHFAutocompleteAsync component with the provided props.
40
42
  */
41
- export declare const renderRHFAutocompleteAsync: (fieldName: string, overrideProps?: Partial<RHFAutocompleteAsyncProps<OptionsTests>>) => ReturnType<typeof renderMaterialUI>;
43
+ export declare const renderRHFAutocompleteAsync: (fieldName: string, overrideProps?: Partial<RHFAutocompleteAsyncProps<OptionsTests>>, initialValuesFormContext?: FieldValues, validationSchema?: any, withFormChangeAuto?: boolean) => ReturnType<typeof renderMaterialUI>;
@@ -1,4 +1,5 @@
1
- import { useState, useRef, useCallback, useEffect } from "react";
1
+ import { useState, useRef, useEffect, useCallback } from "react";
2
+ import { deepEqual } from "fast-equals";
2
3
  function useValuesAndHandlers(props) {
3
4
  const {
4
5
  getOptionLabel,
@@ -19,6 +20,15 @@ function useValuesAndHandlers(props) {
19
20
  const [selectedValue, setSelectedValue] = useState(
20
21
  value || (multiple ? [] : null)
21
22
  );
23
+ const refValue = useRef(selectedValue);
24
+ useEffect(() => {
25
+ if (deepEqual(refValue.current, value)) {
26
+ return;
27
+ }
28
+ const newValue = value || (multiple ? [] : null);
29
+ refValue.current = newValue;
30
+ setSelectedValue(newValue);
31
+ }, [multiple, value]);
22
32
  const isOptionEqualToValueLocal = useCallback(
23
33
  (option, val) => {
24
34
  if (val === null || val === void 0) {
@@ -273,11 +273,12 @@ const createPopupsStore = (initProps, storeDevtoolsEnabled = false) => {
273
273
  /**
274
274
  * setActions: Establece las acciones del popup
275
275
  */
276
- setActions: (popupId, actions, version) => {
276
+ setActions: (popupId, actions, version, buildTime) => {
277
277
  set((state) => {
278
278
  if (state.hashPopups[popupId]) {
279
279
  state.hashPopups[popupId].moduleActions = actions;
280
280
  state.hashPopups[popupId].version = version;
281
+ state.hashPopups[popupId].buildTime = buildTime;
281
282
  }
282
283
  });
283
284
  },
@@ -73,9 +73,13 @@ export interface PopupStorePropsBase extends PartialExcept<Pick<DragResizeWindow
73
73
  */
74
74
  moduleActions?: ModuleAction[];
75
75
  /**
76
- * "version" Versión de la ventana
76
+ * "version" Versión del Microfrontend
77
77
  */
78
78
  version?: string;
79
+ /**
80
+ * "buildTime" BuildTime del Microfrontend
81
+ */
82
+ buildTime?: string;
79
83
  /**
80
84
  * "fnQueryClose" Función de cierre de la consulta
81
85
  */
@@ -312,7 +316,7 @@ export interface PopupsProviderStoreStateWithActions extends PopupsProviderStore
312
316
  /**
313
317
  * setActions: Establece las acciones del popup
314
318
  */
315
- setActions: (popupId: string, actions: ModuleAction[], version?: string) => void;
319
+ setActions: (popupId: string, actions: ModuleAction[], version?: string, buildTime?: string) => void;
316
320
  };
317
321
  }
318
322
  export type DefaultPopupsStoreProps = PopupsProviderStoreState;
@@ -18,9 +18,7 @@ const useHeaderActionsPopups = ({
18
18
  const leftActions = useMemo(() => {
19
19
  return getLeftActions(isMobile, moduleActions).map((action) => ({
20
20
  ...action,
21
- place: "left",
22
- iconUrl: action.iconUrl || "",
23
- label: action.label || ""
21
+ place: "left"
24
22
  }));
25
23
  }, [isMobile, moduleActions]);
26
24
  const windowOptions = usePopupsStore(
@@ -21,6 +21,7 @@ export declare const usePopups: (popupId: string) => {
21
21
  loading: boolean | undefined;
22
22
  status: import('../../PopupsViewer/types').PopupStatus;
23
23
  version: string | undefined;
24
+ buildTime: string | undefined;
24
25
  dynamicMFStore: Omit<import('zustand').StoreApi<import('../../../../WindowBase/contexts/DynamicMFParmsContext/store').DynamicMFStateWithActions>, "setState"> & {
25
26
  setState(nextStateOrUpdater: import('../../../../WindowBase/contexts/DynamicMFParmsContext/store').DynamicMFStateWithActions | Partial<import('../../../../WindowBase/contexts/DynamicMFParmsContext/store').DynamicMFStateWithActions> | ((state: import('immer/dist/internal').WritableDraft<import('../../../../WindowBase/contexts/DynamicMFParmsContext/store').DynamicMFStateWithActions>) => void), shouldReplace?: boolean | undefined): void;
26
27
  };
@@ -13,6 +13,7 @@ const usePopups = (popupId) => {
13
13
  dynamicMFStore,
14
14
  loading,
15
15
  version,
16
+ buildTime,
16
17
  subTitle,
17
18
  editionInfo,
18
19
  zIndex,
@@ -61,8 +62,8 @@ const usePopups = (popupId) => {
61
62
  const windowTools = useMemo(
62
63
  () => ({
63
64
  getWindowId: () => popupId,
64
- setActions: (newActions, newVersion) => {
65
- setActions(popupId, newActions, newVersion);
65
+ setActions: (newActions, newVersion, newBuildTime) => {
66
+ setActions(popupId, newActions, newVersion, newBuildTime);
66
67
  },
67
68
  getCookie: () => {
68
69
  throw new Error("getCookie not implemented");
@@ -88,6 +89,7 @@ const usePopups = (popupId) => {
88
89
  [
89
90
  popupId,
90
91
  version,
92
+ buildTime,
91
93
  setActions,
92
94
  //getCookie,
93
95
  //getCookies,
@@ -113,6 +115,7 @@ const usePopups = (popupId) => {
113
115
  loading,
114
116
  status,
115
117
  version,
118
+ buildTime,
116
119
  dynamicMFStore,
117
120
  windowTools,
118
121
  //onTouch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.2.53",
3
+ "version": "9.2.54-beta.2",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {