@m4l/layouts 9.3.0 → 9.3.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.
@@ -17,6 +17,7 @@ function MasterDetailLayout(props) {
17
17
  detailComponent,
18
18
  moduleActions,
19
19
  version,
20
+ buildTime,
20
21
  splitPosition
21
22
  } = props;
22
23
  const { host_static_assets, environment_assets } = useEnvironment();
@@ -28,39 +29,41 @@ function MasterDetailLayout(props) {
28
29
  setSplitPositionState(newPostion);
29
30
  }, []);
30
31
  const splitActions = useMemo(
31
- () => [
32
- {
33
- iconUrl: `${host_static_assets}/${environment_assets}/${icons.splitVertical}`,
34
- onClick: () => onChangePostionInternal("vertical"),
35
- visibility: "main",
36
- label: getLabel(dictionary.LABEL_SPLIT_VERTICAL),
37
- tag: "vertical",
38
- className: "splitactions",
39
- disabled: splitPositionState === "vertical",
40
- key: "vertical"
41
- },
42
- {
43
- iconUrl: `${host_static_assets}/${environment_assets}/${icons.splitHorizontal}`,
44
- onClick: () => onChangePostionInternal("horizontal"),
45
- visibility: "main",
46
- label: getLabel(dictionary.LABEL_SPLIT_HORIZONTAL),
47
- tag: "horizontal",
48
- className: "splitactions",
49
- disabled: splitPositionState === "horizontal",
50
- key: "horizontal"
51
- },
52
- {
53
- iconUrl: `${host_static_assets}/${environment_assets}/${icons.noSplit}`,
54
- onClick: () => onChangePostionInternal("none"),
55
- visibility: "main",
56
- label: getLabel(dictionary.LABEL_NO_SPLIT),
57
- tag: "none",
58
- className: "splitactions",
59
- disabled: splitPositionState === "none",
60
- key: "none"
32
+ () => {
33
+ if (isMobile) {
34
+ return [];
61
35
  }
62
- ],
63
- [getLabel, splitPositionState, environment_assets, host_static_assets, onChangePostionInternal]
36
+ return [
37
+ {
38
+ iconUrl: `${host_static_assets}/${environment_assets}/${icons.splitVertical}`,
39
+ onClick: () => onChangePostionInternal("vertical"),
40
+ label: getLabel(dictionary.LABEL_SPLIT_VERTICAL),
41
+ className: "splitactions",
42
+ checkable: true,
43
+ checked: splitPositionState === "vertical",
44
+ key: "vertical"
45
+ },
46
+ {
47
+ iconUrl: `${host_static_assets}/${environment_assets}/${icons.splitHorizontal}`,
48
+ onClick: () => onChangePostionInternal("horizontal"),
49
+ label: getLabel(dictionary.LABEL_SPLIT_HORIZONTAL),
50
+ className: "splitactions",
51
+ checkable: true,
52
+ checked: splitPositionState === "horizontal",
53
+ key: "horizontal"
54
+ },
55
+ {
56
+ iconUrl: `${host_static_assets}/${environment_assets}/${icons.noSplit}`,
57
+ onClick: () => onChangePostionInternal("none"),
58
+ label: getLabel(dictionary.LABEL_NO_SPLIT),
59
+ className: "splitactions",
60
+ checkable: true,
61
+ checked: splitPositionState === "none",
62
+ key: "none"
63
+ }
64
+ ];
65
+ },
66
+ [isMobile, host_static_assets, environment_assets, getLabel, splitPositionState, onChangePostionInternal]
64
67
  );
65
68
  const onClickViewDetail = useCallback(() => {
66
69
  moduleLayoutRef.current?.openModal({
@@ -80,11 +83,12 @@ function MasterDetailLayout(props) {
80
83
  }, [detailComponent, getLabel]);
81
84
  const finalModuleActions = useMemo(() => {
82
85
  const actions = getTotalModuleActions(
86
+ splitPositionState,
83
87
  splitActions,
84
88
  moduleActions
85
89
  );
86
90
  return actions;
87
- }, [splitActions, moduleActions]);
91
+ }, [splitActions, moduleActions, splitPositionState]);
88
92
  const classRoot = getComponentSlotRoot(MASTER_DETAIL_LAYOUT_PREFIX);
89
93
  return /* @__PURE__ */ jsx(MasterDetailProvider, { onClickViewDetail, children: /* @__PURE__ */ jsx(MasterDetailLayoutRootStyled, { className: classRoot, children: /* @__PURE__ */ jsx(
90
94
  ModuleLayout,
@@ -93,6 +97,7 @@ function MasterDetailLayout(props) {
93
97
  moduleId,
94
98
  moduleActions: finalModuleActions,
95
99
  version,
100
+ buildTime,
96
101
  children: /* @__PURE__ */ jsx(
97
102
  SplitLayout,
98
103
  {
@@ -1,5 +1,5 @@
1
- import { ModuleAction } from '@m4l/components';
1
+ import { ModuleAction, GroupActionMenuItem } from '@m4l/components';
2
2
  /**
3
3
  * Obtiene las acciones totales del modulo
4
4
  */
5
- export declare function getTotalModuleActions(splitActions: ModuleAction[], moduleActions?: ModuleAction[]): ModuleAction[];
5
+ export declare function getTotalModuleActions(selectedActionKey: string, splitActions: GroupActionMenuItem[], moduleActions?: ModuleAction[]): ModuleAction[];
@@ -1,6 +1,13 @@
1
- function getTotalModuleActions(splitActions, moduleActions = []) {
2
- let totalActions = [...splitActions];
3
- totalActions = moduleActions.concat(totalActions);
1
+ function getTotalModuleActions(selectedActionKey, splitActions, moduleActions = []) {
2
+ let totalActions = [];
3
+ const groupAction = {
4
+ type: "groupActions",
5
+ actions: splitActions,
6
+ key: "splitActions",
7
+ selectedActionKey,
8
+ visibility: "main"
9
+ };
10
+ totalActions = moduleActions.concat(groupAction);
4
11
  return totalActions;
5
12
  }
6
13
  export {
@@ -4,7 +4,7 @@ import { forwardRef, useRef, useImperativeHandle } from "react";
4
4
  import { B as BaseModuleLayout } from "./subcomponents/BaseModuleLayout/index.js";
5
5
  import { a as ModuleProvider } from "./contexts/ModuleContext/index.js";
6
6
  const ModuleLayout = forwardRef((props, ref) => {
7
- const { moduleId, moduleActions, version, children } = props;
7
+ const { moduleId, moduleActions, version, children, buildTime } = props;
8
8
  const moduleRef = useRef(null);
9
9
  const closeModal = () => {
10
10
  moduleRef.current?.closeModal();
@@ -17,7 +17,16 @@ const ModuleLayout = forwardRef((props, ref) => {
17
17
  closeModal,
18
18
  current: moduleRef.current
19
19
  }));
20
- return /* @__PURE__ */ jsx(ModuleProvider, { moduleId, moduleActions, version, children: /* @__PURE__ */ jsx(ModalProvider, { children: /* @__PURE__ */ jsx(BaseModuleLayout, { ref: moduleRef, children }) }) });
20
+ return /* @__PURE__ */ jsx(
21
+ ModuleProvider,
22
+ {
23
+ moduleId,
24
+ moduleActions,
25
+ version,
26
+ buildTime,
27
+ children: /* @__PURE__ */ jsx(ModalProvider, { children: /* @__PURE__ */ jsx(BaseModuleLayout, { ref: moduleRef, children }) })
28
+ }
29
+ );
21
30
  });
22
31
  export {
23
32
  ModuleLayout as M
@@ -4,7 +4,7 @@ import { createContext, useRef, useEffect } from "react";
4
4
  import { c as createModuleLayoutStore } from "./store.js";
5
5
  const ModuleContext = createContext(null);
6
6
  function ModuleProvider(props) {
7
- const { children, moduleActions, moduleId, version } = props;
7
+ const { children, moduleActions, moduleId, version, buildTime } = props;
8
8
  const { setActions } = useWindowToolsMF();
9
9
  const moduleLayoutStoreRef = useRef();
10
10
  useEffect(() => {
@@ -17,6 +17,7 @@ function ModuleProvider(props) {
17
17
  moduleActions,
18
18
  moduleId,
19
19
  version,
20
+ buildTime,
20
21
  setActions
21
22
  });
22
23
  moduleLayoutStoreRef.current.getState().init();
@@ -10,7 +10,7 @@ const createDevtools = (immerMiddlewere, config) => {
10
10
  return immerMiddlewere;
11
11
  };
12
12
  const createModuleLayoutStore = (initProps, storeDevtoolsEnabled = false) => {
13
- const { moduleActions, moduleId, version, setActions } = initProps;
13
+ const { moduleActions, moduleId, version, setActions, buildTime } = initProps;
14
14
  const startProps = {
15
15
  configOptions: {
16
16
  moduleId
@@ -18,7 +18,8 @@ const createModuleLayoutStore = (initProps, storeDevtoolsEnabled = false) => {
18
18
  dynamicActions: [],
19
19
  finalModuleActions: [],
20
20
  moduleActions: [],
21
- version
21
+ version,
22
+ buildTime
22
23
  };
23
24
  return create(
24
25
  createDevtools(
@@ -40,7 +41,7 @@ const createModuleLayoutStore = (initProps, storeDevtoolsEnabled = false) => {
40
41
  const actionsConcatenated = (moduleActions || []).concat(dynamicActions);
41
42
  state.dynamicActions = dynamicActions;
42
43
  state.finalModuleActions = actionsConcatenated;
43
- setActions(actionsConcatenated, state.version);
44
+ setActions(actionsConcatenated, state.version, state.buildTime);
44
45
  });
45
46
  },
46
47
  /**
@@ -51,7 +52,7 @@ const createModuleLayoutStore = (initProps, storeDevtoolsEnabled = false) => {
51
52
  const actionsConcatenated = newModuleActions.concat(state.dynamicActions);
52
53
  state.moduleActions = moduleActions;
53
54
  state.finalModuleActions = actionsConcatenated;
54
- setActions(actionsConcatenated, state.version);
55
+ setActions(actionsConcatenated, state.version, state.buildTime);
55
56
  });
56
57
  }
57
58
  })),
@@ -5,7 +5,9 @@ export interface ModuleLayoutContextStateProps {
5
5
  }
6
6
  export interface ModuleLayoutProviderProps extends Omit<ModuleLayoutContextStateProps, 'init'> {
7
7
  children: ReactNode;
8
- version: string;
8
+ /**
9
+ * "moduleActions" acciones del módulo
10
+ */
9
11
  moduleActions?: ModuleAction[];
10
12
  /**
11
13
  * "storeId" identificador del store
@@ -15,6 +17,14 @@ export interface ModuleLayoutProviderProps extends Omit<ModuleLayoutContextState
15
17
  * "storeDevtoolsEnabled" determina si se debe usar devtools para el store
16
18
  */
17
19
  storeDevtoolsEnabled?: boolean;
20
+ /**
21
+ * "version" versión del módulo
22
+ */
23
+ version: string;
24
+ /**
25
+ * "buildTime" fecha de compilación del módulo
26
+ */
27
+ buildTime?: string;
18
28
  }
19
29
  export interface ModuleLayoutContextProps extends ModuleLayoutContextStateProps {
20
30
  setDynamicActions: (dynamicActions: ModuleAction[]) => void;
@@ -40,6 +50,10 @@ export interface ModuleLayoutState extends Pick<ModuleLayoutProviderProps, 'stor
40
50
  * "version" Versión del módulo
41
51
  */
42
52
  version: string;
53
+ /**
54
+ * "buildTime" fecha de compilación del módulo
55
+ */
56
+ buildTime?: string;
43
57
  }
44
58
  export interface ModuleLayoutStateWithActions extends ModuleLayoutState {
45
59
  /**
@@ -55,4 +69,4 @@ export interface ModuleLayoutStateWithActions extends ModuleLayoutState {
55
69
  */
56
70
  updateModuleActions: (moduleActions: ModuleAction[]) => void;
57
71
  }
58
- export type InitialModuleLayoutStoreProps = Pick<ModuleLayoutState, 'moduleActions' | 'version' | 'storeId'> & Pick<WindowToolsMF, 'setActions'> & ModuleLayoutContextStateProps;
72
+ export type InitialModuleLayoutStoreProps = Pick<ModuleLayoutState, 'moduleActions' | 'version' | 'storeId' | 'buildTime'> & Pick<WindowToolsMF, 'setActions'> & ModuleLayoutContextStateProps;
@@ -18,6 +18,7 @@ export interface ModuleLayoutProps {
18
18
  moduleActions?: ModuleAction[];
19
19
  children: ReactNode;
20
20
  version: string;
21
+ buildTime?: string;
21
22
  }
22
23
  export type ModuleLayoutSlotsType = keyof typeof ModuleLayoutSlots;
23
24
  export type ModuleLayoutStyles = OverridesStyleRules<ModuleLayoutSlotsType, typeof MODULE_LAYOUT_KEY, Theme>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/layouts",
3
- "version": "9.3.0",
3
+ "version": "9.3.1",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team ",
6
6
  "lint-staged": {