@m4l/layouts 0.1.22 → 0.1.25

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 (146) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.cjs +118 -0
  3. package/.gitignore +23 -0
  4. package/.gitlab-ci.yml +16 -0
  5. package/.prettierignore +3 -0
  6. package/.prettierrc.json +26 -0
  7. package/.vscode/settings.json +50 -0
  8. package/dist/components/BaseModule/index.6309486a.js +33 -0
  9. package/dist/components/BaseModule/index.d.ts +4 -0
  10. package/dist/components/BaseModule/types.d.ts +9 -0
  11. package/dist/components/MFHostApp/index.1700d13a.js +69 -0
  12. package/{components → dist/components}/MFHostApp/types.d.ts +3 -7
  13. package/dist/components/MFIsolationApp/index.b21e5671.js +151 -0
  14. package/dist/components/MFIsolationApp/types.d.ts +11 -0
  15. package/dist/components/index.d.ts +4 -0
  16. package/dist/components/index.deb4e7ac.js +6 -0
  17. package/{contexts → dist/contexts}/AuthContext/types.d.ts +1 -1
  18. package/dist/contexts/index.b46a2699.js +1 -0
  19. package/dist/hooks/index.2022a179.js +4 -0
  20. package/{hooks/useMasterDetail/index.8e9e900b.js → dist/hooks/useMasterDetail/index.1b024fd5.js} +1 -1
  21. package/{hooks/useModule/index.096d7d13.js → dist/hooks/useModule/index.6ff7d08a.js} +1 -1
  22. package/dist/index.js +41 -0
  23. package/dist/layouts/MasterDetailLayout/index.3da0ffda.js +104 -0
  24. package/{layouts → dist/layouts}/ModuleLayout/contexts/ModuleContext/types.d.ts +2 -7
  25. package/dist/layouts/ModuleLayout/index.a76397df.js +101 -0
  26. package/dist/layouts/ModuleLayout/types.d.ts +15 -0
  27. package/dist/layouts/index.014e41ba.js +8 -0
  28. package/{layouts → dist/layouts}/index.d.ts +0 -1
  29. package/dist/package.json +36 -0
  30. package/package.json +57 -12
  31. package/src/@types/index.ts +8 -0
  32. package/src/components/BaseModule/index.tsx +59 -0
  33. package/src/components/BaseModule/types.ts +12 -0
  34. package/src/components/MFHostApp/index.tsx +95 -0
  35. package/src/components/MFHostApp/types.ts +16 -0
  36. package/src/components/MFIsolationApp/index.tsx +164 -0
  37. package/src/components/MFIsolationApp/subcomponents/MFAuthApp/index.tsx +98 -0
  38. package/src/components/MFIsolationApp/subcomponents/MFAuthApp/types.ts +7 -0
  39. package/src/components/MFIsolationApp/types.ts +12 -0
  40. package/src/components/index.ts +5 -0
  41. package/src/contexts/AuthContext/index.tsx +189 -0
  42. package/src/contexts/AuthContext/types.ts +65 -0
  43. package/src/contexts/index.ts +1 -0
  44. package/src/hooks/index.ts +5 -0
  45. package/src/hooks/useAuth/index.ts +12 -0
  46. package/src/hooks/useMasterDetail/index.ts +6 -0
  47. package/src/hooks/useModule/index.ts +13 -0
  48. package/src/index.ts +7 -0
  49. package/src/layouts/MasterDetailLayout/components/ButtonDetail/index.tsx +38 -0
  50. package/src/layouts/MasterDetailLayout/contexts/MasterDetailContext/index.tsx +34 -0
  51. package/src/layouts/MasterDetailLayout/contexts/MasterDetailContext/types.ts +19 -0
  52. package/src/layouts/MasterDetailLayout/dicctionary.ts +20 -0
  53. package/src/layouts/MasterDetailLayout/index.tsx +165 -0
  54. package/src/layouts/MasterDetailLayout/types.ts +11 -0
  55. package/src/layouts/ModuleLayout/contexts/ModuleContext/index.tsx +56 -0
  56. package/src/layouts/ModuleLayout/contexts/ModuleContext/types.ts +23 -0
  57. package/src/layouts/ModuleLayout/dicctionary.ts +11 -0
  58. package/src/layouts/ModuleLayout/index.tsx +59 -0
  59. package/src/layouts/ModuleLayout/subcomponents/InnerModule/index.tsx +35 -0
  60. package/src/layouts/ModuleLayout/subcomponents/InnerModule/styles.tsx +31 -0
  61. package/src/layouts/ModuleLayout/subcomponents/InnerModule/types.ts +11 -0
  62. package/src/layouts/ModuleLayout/types.ts +31 -0
  63. package/src/layouts/NoAuthModuleLayout/dicctionary.ts +9 -0
  64. package/src/layouts/NoAuthModuleLayout/index.tsx +85 -0
  65. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/index.tsx +43 -0
  66. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/styles.tsx +6 -0
  67. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/index.tsx +14 -0
  68. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/styles.tsx +7 -0
  69. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/AppBar/index.tsx +25 -0
  70. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/AppBar/styles.tsx +11 -0
  71. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/index.tsx +17 -0
  72. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/styles.tsx +19 -0
  73. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/subcomponents/NameDescription/index.tsx +25 -0
  74. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/subcomponents/NameDescription/styles.tsx +8 -0
  75. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/types.ts +5 -0
  76. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/types.ts +5 -0
  77. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/LogoLeyend/index.tsx +28 -0
  78. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/LogoLeyend/styles.tsx +16 -0
  79. package/src/layouts/NoAuthModuleLayout/subcomponents/InnerModule/types.ts +5 -0
  80. package/src/layouts/NoAuthModuleLayout/types.ts +22 -0
  81. package/src/layouts/index.ts +8 -0
  82. package/src/test/setup.ts +1 -0
  83. package/src/test/utils.tsx +20 -0
  84. package/src/vite-env.d.ts +3 -0
  85. package/tsconfig.json +29 -0
  86. package/tsconfig.node.json +8 -0
  87. package/vite.config.ts +172 -0
  88. package/components/MFHostApp/index.b3c15ec3.js +0 -52
  89. package/components/MFIsolationApp/index.28f538a3.js +0 -106
  90. package/components/MFIsolationApp/types.d.ts +0 -10
  91. package/components/index.d.ts +0 -3
  92. package/index.js +0 -38
  93. package/layouts/MasterDetailLayout/components/ButtonDetail/index.d.ts +0 -3
  94. package/layouts/MasterDetailLayout/index.71de0dc7.js +0 -141
  95. package/layouts/ModuleLayout/index.842072c5.js +0 -348
  96. package/layouts/ModuleLayout/subcomponents/InnerModule/subcomponents/Header/index.d.ts +0 -2
  97. package/layouts/ModuleLayout/subcomponents/InnerModule/subcomponents/Header/skeleton.d.ts +0 -2
  98. package/layouts/ModuleLayout/subcomponents/InnerModule/subcomponents/Header/styles.d.ts +0 -8
  99. package/layouts/ModuleLayout/subcomponents/InnerModule/subcomponents/Header/types.d.ts +0 -2
  100. package/layouts/ModuleLayout/types.d.ts +0 -29
  101. package/node_modules.26043cf4.js +0 -1601
  102. package/vendor.95e38403.js +0 -20
  103. /package/{components → dist/components}/MFHostApp/index.d.ts +0 -0
  104. /package/{components → dist/components}/MFIsolationApp/index.d.ts +0 -0
  105. /package/{components → dist/components}/MFIsolationApp/subcomponents/MFAuthApp/index.d.ts +0 -0
  106. /package/{components → dist/components}/MFIsolationApp/subcomponents/MFAuthApp/types.d.ts +0 -0
  107. /package/{contexts → dist/contexts}/AuthContext/index.6f966215.js +0 -0
  108. /package/{contexts → dist/contexts}/AuthContext/index.d.ts +0 -0
  109. /package/{contexts → dist/contexts}/index.d.ts +0 -0
  110. /package/{hooks → dist/hooks}/index.d.ts +0 -0
  111. /package/{hooks → dist/hooks}/useAuth/index.cb6a3420.js +0 -0
  112. /package/{hooks → dist/hooks}/useAuth/index.d.ts +0 -0
  113. /package/{hooks → dist/hooks}/useMasterDetail/index.d.ts +0 -0
  114. /package/{hooks → dist/hooks}/useModule/index.d.ts +0 -0
  115. /package/{index.d.ts → dist/index.d.ts} +0 -0
  116. /package/{layouts → dist/layouts}/MasterDetailLayout/contexts/MasterDetailContext/index.d.ts +0 -0
  117. /package/{layouts → dist/layouts}/MasterDetailLayout/contexts/MasterDetailContext/types.d.ts +0 -0
  118. /package/{layouts → dist/layouts}/MasterDetailLayout/dicctionary.d.ts +0 -0
  119. /package/{layouts → dist/layouts}/MasterDetailLayout/index.d.ts +0 -0
  120. /package/{layouts → dist/layouts}/MasterDetailLayout/types.d.ts +0 -0
  121. /package/{layouts → dist/layouts}/ModuleLayout/contexts/ModuleContext/index.d.ts +0 -0
  122. /package/{layouts → dist/layouts}/ModuleLayout/dicctionary.d.ts +0 -0
  123. /package/{layouts → dist/layouts}/ModuleLayout/index.d.ts +0 -0
  124. /package/{layouts → dist/layouts}/ModuleLayout/subcomponents/InnerModule/index.d.ts +0 -0
  125. /package/{layouts → dist/layouts}/ModuleLayout/subcomponents/InnerModule/styles.d.ts +0 -0
  126. /package/{layouts → dist/layouts}/ModuleLayout/subcomponents/InnerModule/types.d.ts +0 -0
  127. /package/{layouts → dist/layouts}/NoAuthModuleLayout/dicctionary.d.ts +0 -0
  128. /package/{layouts → dist/layouts}/NoAuthModuleLayout/index.5d1098ef.js +0 -0
  129. /package/{layouts → dist/layouts}/NoAuthModuleLayout/index.d.ts +0 -0
  130. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/index.d.ts +0 -0
  131. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/styles.d.ts +0 -0
  132. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/index.d.ts +0 -0
  133. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/styles.d.ts +0 -0
  134. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/AppBar/index.d.ts +0 -0
  135. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/AppBar/styles.d.ts +0 -0
  136. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/index.d.ts +0 -0
  137. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/styles.d.ts +0 -0
  138. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/subcomponents/NameDescription/index.d.ts +0 -0
  139. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/subcomponents/NameDescription/styles.d.ts +0 -0
  140. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/subcomponents/Form/types.d.ts +0 -0
  141. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/AppBarForm/types.d.ts +0 -0
  142. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/LogoLeyend/index.d.ts +0 -0
  143. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/subcomponents/LogoLeyend/styles.d.ts +0 -0
  144. /package/{layouts → dist/layouts}/NoAuthModuleLayout/subcomponents/InnerModule/types.d.ts +0 -0
  145. /package/{layouts → dist/layouts}/NoAuthModuleLayout/types.d.ts +0 -0
  146. /package/{vite-env.d.ts → dist/vite-env.d.ts} +0 -0
@@ -0,0 +1,104 @@
1
+ import { createContext as D, useState as p, useRef as A, useCallback as $, useMemo as g } from "react";
2
+ import { voidFunction as k, useEnvironment as w } from "@m4l/core";
3
+ import { SplitLayout as P } from "@m4l/components";
4
+ import { a as z, g as I } from "../ModuleLayout/index.a76397df.js";
5
+ import { jsx as c } from "react/jsx-runtime";
6
+ import { useResponsiveDesktop as L } from "@m4l/graphics";
7
+ const F = {
8
+ masterSelection: void 0,
9
+ onChangeMasterSelection: k
10
+ }, N = D(F);
11
+ function x(o) {
12
+ const {
13
+ children: e
14
+ } = o, [s, t] = p(void 0);
15
+ return /* @__PURE__ */ c(N.Provider, {
16
+ value: {
17
+ masterSelection: s,
18
+ onChangeMasterSelection: t
19
+ },
20
+ children: e
21
+ });
22
+ }
23
+ function R(o, e, s, t) {
24
+ let i = t !== void 0 && t ? [...o] : [s];
25
+ return i = e.concat(i), i;
26
+ }
27
+ function G(o) {
28
+ const {
29
+ moduleId: e,
30
+ masterComponent: s,
31
+ detailComponent: t,
32
+ moduleActions: i
33
+ } = o, {
34
+ host_static_assets: r,
35
+ environment_assets: n
36
+ } = w(), [C, h] = p("vertical"), d = L(), M = A(null), u = (m) => {
37
+ const a = [...y];
38
+ for (let l = 0; l < a.length; l++)
39
+ a[l].disabled = !1, a[l].tag === m && (a[l].disabled = !0);
40
+ S(a), h(m);
41
+ }, y = [{
42
+ urlIcon: `${r}/${n}/frontend/components/masterdetaillayout/assets/icons/split_vertical.svg`,
43
+ onClick: () => u("vertical"),
44
+ disabled: !0,
45
+ visibility: "main",
46
+ dictionaryField: "master_detail_layout.split_vertical",
47
+ tag: "vertical",
48
+ className: "splitactions"
49
+ }, {
50
+ urlIcon: `${r}/${n}/frontend/components/masterdetaillayout/assets/icons/split_horizontal.svg`,
51
+ onClick: () => u("horizontal"),
52
+ disabled: !1,
53
+ visibility: "main",
54
+ dictionaryField: "master_detail_layout.split_horizontal",
55
+ tag: "horizontal",
56
+ className: "splitactions"
57
+ }, {
58
+ urlIcon: `${r}/${n}/frontend/components/masterdetaillayout/assets/icons/no_split.svg`,
59
+ onClick: () => u("none"),
60
+ disabled: !1,
61
+ visibility: "main",
62
+ dictionaryField: "master_detail_layout.no_split",
63
+ tag: "none",
64
+ className: "splitactions"
65
+ }], v = $(() => {
66
+ }, [t]), _ = g(() => ({
67
+ urlIcon: `${r}/${n}/frontend/components/masterdetaillayout/assets/icons/view_detail.svg`,
68
+ onClick: v,
69
+ disabled: !1,
70
+ visibility: "allways",
71
+ dictionaryField: "master_detail_layout.view_detail",
72
+ tag: "none",
73
+ className: ""
74
+ }), [n, v]), [f, S] = p(y), b = g(() => R(f, i, _, d), [f, i, d, _]);
75
+ return /* @__PURE__ */ c(x, {
76
+ children: /* @__PURE__ */ c(z, {
77
+ ref: M,
78
+ moduleId: e,
79
+ moduleActions: b,
80
+ children: /* @__PURE__ */ c(P, {
81
+ splitPosition: d ? C : "none",
82
+ firstPart: s,
83
+ secondPart: t
84
+ })
85
+ })
86
+ });
87
+ }
88
+ function H() {
89
+ return ["master_detail_layout"].concat(I());
90
+ }
91
+ const J = {
92
+ master_detail_layout: {
93
+ split_vertical: "Split vertically",
94
+ split_horizontal: "Split horizontally",
95
+ no_split: "No split",
96
+ view_detail: "View detail"
97
+ }
98
+ };
99
+ export {
100
+ N as M,
101
+ G as a,
102
+ J as d,
103
+ H as g
104
+ };
@@ -1,18 +1,13 @@
1
- import type { TLink } from '@m4l/components';
1
+ import { ModuleAction } from '@m4l/components';
2
2
  import type { ReactNode } from 'react';
3
- import { ModuleAction } from '../../types';
4
3
  export interface ModuleLayoutContextStateProps {
5
- urlIcon: string;
6
4
  moduleId: string;
7
- moduleNameField: string;
8
- breadcrumbLinks: TLink[];
9
5
  }
10
6
  export interface ModuleLayoutProviderProps extends Omit<ModuleLayoutContextStateProps, 'init'> {
11
7
  children: ReactNode;
12
- initialModuleActions: ModuleAction[];
8
+ moduleActions: ModuleAction[];
13
9
  }
14
10
  export interface ModuleLayoutContextProps extends ModuleLayoutContextStateProps {
15
11
  moduleActions: ModuleAction[];
16
- dynamicActions: ModuleAction[];
17
12
  setDynamicActions: (dynamicActions: ModuleAction[]) => void;
18
13
  }
@@ -0,0 +1,101 @@
1
+ import { useModal as y, useDynamicMFParameters as x, ModalProvider as v, getModalDialogComponentsDictionary as g } from "@m4l/components";
2
+ import { forwardRef as a, useRef as m, useImperativeHandle as p, createContext as h, useState as s, useMemo as I, useEffect as A } from "react";
3
+ import { styled as f } from "@mui/material/styles";
4
+ import { jsx as t } from "react/jsx-runtime";
5
+ const C = f("div")(() => ({
6
+ display: "flex",
7
+ flexDirection: "column",
8
+ position: "absolute",
9
+ margin: "0px 12px 12px 12px",
10
+ left: "0px",
11
+ right: "0px",
12
+ top: "0px",
13
+ bottom: "0px",
14
+ overflow: "hidden"
15
+ })), D = f("div")(({
16
+ theme: o
17
+ }) => ({
18
+ display: "flex",
19
+ position: "relative",
20
+ marginTop: o.spacing(1),
21
+ justifyContent: "center",
22
+ flexGrow: "1",
23
+ overflow: "hidden"
24
+ })), M = a((o, l) => {
25
+ const {
26
+ children: e
27
+ } = o, {
28
+ openModal: r
29
+ } = y(), n = m(null);
30
+ return p(l, () => ({
31
+ openModal: r,
32
+ current: n.current
33
+ })), /* @__PURE__ */ t(C, {
34
+ id: "WrapperInnerModule",
35
+ className: "m4l_module_layout",
36
+ ref: n,
37
+ children: /* @__PURE__ */ t(D, {
38
+ id: "ModuleContent",
39
+ children: e
40
+ })
41
+ });
42
+ });
43
+ M.displayName = "InnerModule";
44
+ const P = h(null);
45
+ function w(o) {
46
+ const {
47
+ children: l,
48
+ moduleActions: e,
49
+ moduleId: r
50
+ } = o, [n] = s(() => ({
51
+ moduleId: r,
52
+ dictionary: void 0
53
+ })), {
54
+ setModuleActions: d
55
+ } = x(), [i, c] = s([]), u = I(() => e.concat(i), [e, i]);
56
+ return A(() => {
57
+ console.log("useEffect ModuleProvider", u), d(u);
58
+ }, [u]), /* @__PURE__ */ t(P.Provider, {
59
+ value: {
60
+ moduleActions: u,
61
+ setDynamicActions: c,
62
+ moduleId: n.moduleId
63
+ },
64
+ children: l
65
+ });
66
+ }
67
+ const L = a((o, l) => {
68
+ const {
69
+ moduleId: e,
70
+ moduleActions: r,
71
+ children: n
72
+ } = o, d = m(null), i = (c) => {
73
+ d.current?.openModal(c);
74
+ };
75
+ return p(l, () => ({
76
+ openModal: i,
77
+ current: d.current
78
+ })), /* @__PURE__ */ t(w, {
79
+ moduleId: e,
80
+ moduleActions: r,
81
+ children: /* @__PURE__ */ t(v, {
82
+ children: /* @__PURE__ */ t(M, {
83
+ ref: d,
84
+ children: n
85
+ })
86
+ })
87
+ });
88
+ });
89
+ L.displayName = "ModuleLayout";
90
+ function j() {
91
+ return ["module_layout"].concat(g());
92
+ }
93
+ const E = {
94
+ module_layout: {}
95
+ };
96
+ export {
97
+ P as M,
98
+ L as a,
99
+ E as d,
100
+ j as g
101
+ };
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ModalOpenOptions, ModuleAction } from '@m4l/components';
3
+ import type { ModuleRef } from './subcomponents/InnerModule/types';
4
+ export interface ContainerProps {
5
+ vertical: boolean;
6
+ }
7
+ export declare type ModuleLayoutRef = {
8
+ openModal: (modalOpenProps: ModalOpenOptions) => void;
9
+ current: ModuleRef | null;
10
+ };
11
+ export interface ModuleLayoutProps {
12
+ moduleId: string;
13
+ moduleActions: ModuleAction[];
14
+ children: ReactNode;
15
+ }
@@ -0,0 +1,8 @@
1
+ import "./ModuleLayout/index.a76397df.js";
2
+ import "@m4l/components";
3
+ import "react";
4
+ import "@m4l/core";
5
+ import "./MasterDetailLayout/index.3da0ffda.js";
6
+ import "@m4l/graphics";
7
+ import "react/jsx-runtime";
8
+ import "./NoAuthModuleLayout/index.5d1098ef.js";
@@ -4,4 +4,3 @@ export { MasterDetailLayout } from './MasterDetailLayout';
4
4
  export * from './MasterDetailLayout/dicctionary';
5
5
  export { NoAuthModuleLayout } from './NoAuthModuleLayout';
6
6
  export * from './NoAuthModuleLayout/dicctionary';
7
- export type { ModuleAction } from '../layouts/ModuleLayout/types';
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@m4l/layouts",
3
+ "version": "0.1.25",
4
+ "license": "UNLICENSED",
5
+ "dependencies": {
6
+ "@m4l/components": "*",
7
+ "@m4l/core": "*",
8
+ "@m4l/graphics": "*"
9
+ },
10
+ "peerDependencies": {
11
+ "@types/react": "^17.0.0 || ^18.0.0",
12
+ "@types/react-dom": "^17.0.0 || ^18.0.0",
13
+ "eventemitter3": "^4.0.7",
14
+ "history": "5.3.0",
15
+ "nprogress": "^0.2.0",
16
+ "react": "^17.0.0 || ^18.0.0",
17
+ "react-dom": "^17.0.0 || ^18.0.0",
18
+ "react-toastify": "9.0.5"
19
+ },
20
+ "files": [
21
+ "*"
22
+ ],
23
+ "source": "src/index.ts",
24
+ "main": "./index.js",
25
+ "module": "./index.js",
26
+ "type": "module",
27
+ "types": "./index.d.ts",
28
+ "sideEffects": false,
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "engines": {
33
+ "node": ">=12.0.0"
34
+ },
35
+ "private": false
36
+ }
package/package.json CHANGED
@@ -1,35 +1,80 @@
1
1
  {
2
2
  "name": "@m4l/layouts",
3
- "version": "0.1.22",
3
+ "version": "0.1.25",
4
4
  "license": "UNLICENSED",
5
+ "scripts": {
6
+ "typescript": "tsc",
7
+ "build:package": "node ../../scripts/buildpackage.js",
8
+ "build": "tsc && vite build",
9
+ "build:monorepo": "tsc && vite build && yarn build:package",
10
+ "release:monorepo": "yarn build:monorepo && npm publish ./dist",
11
+ "lint": "npx eslint src",
12
+ "lint:fix": "npm run lint -- --fix",
13
+ "prettier": "npx prettier src --check",
14
+ "prettier:fix": "npm run prettier -- --write",
15
+ "format": "npm run prettier:fix && npm run lint:fix",
16
+ "coverage": "vitest run --coverage"
17
+ },
5
18
  "dependencies": {
6
19
  "@m4l/components": "*",
7
20
  "@m4l/core": "*",
8
- "@m4l/graphics": "*",
9
- "react-router-dom": "6.3.0",
10
- "react-toastify": "9.0.5",
11
- "simplebar": "5.3.8"
21
+ "@m4l/graphics": "*"
12
22
  },
13
23
  "peerDependencies": {
14
24
  "@types/react": "^17.0.0 || ^18.0.0",
15
25
  "@types/react-dom": "^17.0.0 || ^18.0.0",
26
+ "eventemitter3": "^4.0.7",
27
+ "history": "5.3.0",
28
+ "nprogress": "^0.2.0",
16
29
  "react": "^17.0.0 || ^18.0.0",
17
- "react-dom": "^17.0.0 || ^18.0.0"
30
+ "react-dom": "^17.0.0 || ^18.0.0",
31
+ "react-toastify": "9.0.5"
32
+ },
33
+ "devDependencies": {
34
+ "@emotion/react": "^11.5.0",
35
+ "@emotion/styled": "^11.3.0",
36
+ "@testing-library/dom": "^8.17.1",
37
+ "@testing-library/react": "^13.3.0",
38
+ "@testing-library/user-event": "^14.2.1",
39
+ "@types/node": "^16.7.10",
40
+ "@types/react": "^18.0.0",
41
+ "@types/react-dom": "^18.0.0",
42
+ "@typescript-eslint/eslint-plugin": "5.27.1",
43
+ "@typescript-eslint/parser": "5.27.1",
44
+ "@vitejs/plugin-react": "1.3.2",
45
+ "eslint": "8.17.0",
46
+ "eslint-config-prettier": "8.5.0",
47
+ "eslint-import-resolver-alias": "1.1.2",
48
+ "eslint-plugin-import": "2.26.0",
49
+ "eslint-plugin-jsx-a11y": "6.5.1",
50
+ "eslint-plugin-prettier": "4.0.0",
51
+ "eslint-plugin-react": "7.30.0",
52
+ "eslint-plugin-react-hooks": "4.5.0",
53
+ "eslint-plugin-unused-imports": "2.0.0",
54
+ "eventemitter3": "^4.0.7",
55
+ "history": "5.3.0",
56
+ "nprogress": "^0.2.0",
57
+ "prettier": "2.6.2",
58
+ "react": "^18.0.0",
59
+ "rollup": "2.79.0",
60
+ "typescript": "4.6.3",
61
+ "vite": "3.1.0",
62
+ "vite-plugin-dts": "1.2.0",
63
+ "vitest": "^0.23.4"
18
64
  },
19
65
  "files": [
20
66
  "*"
21
67
  ],
22
68
  "source": "src/index.ts",
23
- "main": "./index.js",
24
- "module": "./index.js",
69
+ "main": "./dist/index.js",
70
+ "module": "./dist/index.js",
25
71
  "type": "module",
26
- "types": "./index.d.ts",
72
+ "types": "./src/index.ts",
27
73
  "sideEffects": false,
28
74
  "publishConfig": {
29
75
  "access": "public"
30
76
  },
31
77
  "engines": {
32
78
  "node": ">=12.0.0"
33
- },
34
- "private": false
35
- }
79
+ }
80
+ }
@@ -0,0 +1,8 @@
1
+ import { NewWindow } from '@m4l/components';
2
+ import { EmitEvents } from '@m4l/core';
3
+
4
+ declare module '@m4l/core' {
5
+ interface EmmitEventsGuard {
6
+ [EmitEvents.EMMIT_EVENT_HOST_EMERGE_WINDOW]: NewWindow;
7
+ }
8
+ }
@@ -0,0 +1,59 @@
1
+ // react
2
+
3
+ //m4l
4
+
5
+ import { ModalProvider } from '@m4l/components';
6
+ import {
7
+ FlagsProvider,
8
+ ModuleDictionaryProvider,
9
+ ModulePrivilegesProvider,
10
+ ModuleSkeletonProvider,
11
+ } from '@m4l/core';
12
+ // external components
13
+
14
+ // mui
15
+ // internal components
16
+ // hooks /providers
17
+
18
+ // sub comoponents
19
+
20
+ // types
21
+ import { BaseModuleProps } from './types';
22
+ // network
23
+
24
+ // config
25
+
26
+ // utils
27
+
28
+ // css
29
+
30
+ export function BaseModule(props: BaseModuleProps) {
31
+ const {
32
+ children,
33
+
34
+ moduleId,
35
+ moduleNameField,
36
+ skeletonFlags,
37
+ privileges,
38
+ componentsDictionary,
39
+ } = props;
40
+
41
+ return (
42
+ <FlagsProvider>
43
+ <ModuleDictionaryProvider
44
+ isAuth={true}
45
+ moduleId={moduleId}
46
+ moduleNameField={moduleNameField}
47
+ componentsDictionary={componentsDictionary}
48
+ >
49
+ <ModuleSkeletonProvider flags={skeletonFlags}>
50
+ <ModulePrivilegesProvider queryPrivileges={privileges}>
51
+ <ModalProvider>{children}</ModalProvider>
52
+ </ModulePrivilegesProvider>
53
+ </ModuleSkeletonProvider>
54
+ </ModuleDictionaryProvider>
55
+ </FlagsProvider>
56
+ );
57
+ }
58
+
59
+ export default BaseModule;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export type BaseModuleProps = {
4
+ //Parametros del modulo
5
+ moduleId: string;
6
+ skeletonFlags: string[];
7
+ moduleNameField?: string;
8
+ privileges: string[];
9
+ componentsDictionary: string[];
10
+
11
+ children: ReactNode;
12
+ };
@@ -0,0 +1,95 @@
1
+ // react
2
+ import { unstable_HistoryRouter as HistoryRouter } from 'react-router-dom';
3
+
4
+ //m4l
5
+ import {
6
+ DomainCountryProvider,
7
+ EnvironmentProvider,
8
+ HostToolsProvider,
9
+ NetworkProvider,
10
+ } from '@m4l/core';
11
+ import { FormatterProvider, HostThemeProvider, LocalesProvider } from '@m4l/graphics';
12
+
13
+ // external components
14
+
15
+ // mui
16
+
17
+ // internal components
18
+
19
+ // hooks /providers
20
+
21
+ // sub comoponents
22
+
23
+ // types
24
+
25
+ // network
26
+
27
+ // config
28
+
29
+ // utils
30
+
31
+ // css
32
+
33
+ import { MFHostAppProps } from './types';
34
+
35
+ import BaseModule from '../BaseModule';
36
+ import { DynamicMFParmsProvider } from '@m4l/components';
37
+
38
+ export function MFHostApp(props: MFHostAppProps) {
39
+ const {
40
+ children,
41
+ currentLocale,
42
+ hostTheme,
43
+ environment,
44
+ hostTools,
45
+ axiosOperation,
46
+ formatters,
47
+ dynamicMFParameters,
48
+ moduleId,
49
+ moduleNameField,
50
+ skeletonFlags,
51
+ privileges,
52
+ componentsDictionary,
53
+ } = props;
54
+
55
+ return (
56
+ <EnvironmentProvider {...environment}>
57
+ <HostToolsProvider {...hostTools}>
58
+ <NetworkProvider axiosOperation={axiosOperation}>
59
+ <LocalesProvider isMicroFrontEnd localeHost={currentLocale}>
60
+ <HostThemeProvider isMicroFrontEnd={true} {...hostTheme}>
61
+ <HistoryRouter history={hostTools.history}>
62
+ <DomainCountryProvider
63
+ isMicroFrontEnd
64
+ id={dynamicMFParameters?.id || 1}
65
+ currency={formatters.currencyFormatter.code}
66
+ currency_decimal_digits={
67
+ formatters.currencyFormatter.decimalDigits
68
+ }
69
+ decimal_symbol={formatters.numberFormatter.decimalSymbol}
70
+ thousands_symbol={formatters.numberFormatter.thousandsSymbol}
71
+ >
72
+ <BaseModule
73
+ moduleId={moduleId}
74
+ moduleNameField={moduleNameField}
75
+ componentsDictionary={componentsDictionary}
76
+ skeletonFlags={skeletonFlags}
77
+ privileges={privileges}
78
+ >
79
+ <FormatterProvider isMicroFrontEnd {...formatters}>
80
+ <DynamicMFParmsProvider {...dynamicMFParameters}>
81
+ {children}
82
+ </DynamicMFParmsProvider>
83
+ </FormatterProvider>
84
+ </BaseModule>
85
+ </DomainCountryProvider>
86
+ </HistoryRouter>
87
+ </HostThemeProvider>
88
+ </LocalesProvider>
89
+ </NetworkProvider>
90
+ </HostToolsProvider>
91
+ </EnvironmentProvider>
92
+ );
93
+ }
94
+
95
+ export default MFHostApp;
@@ -0,0 +1,16 @@
1
+ import type { AxiosOperation, EnvironmentType, HostToolsType } from '@m4l/core';
2
+ import { Formatters, HostThemeType, LocaleType } from '@m4l/graphics';
3
+ import { DynamicMFParameters } from '@m4l/components';
4
+ import { BaseModuleProps } from '../BaseModule/types';
5
+
6
+ export interface ByHostProps {
7
+ environment: EnvironmentType;
8
+ hostTools: HostToolsType;
9
+ hostTheme: HostThemeType;
10
+ currentLocale: LocaleType;
11
+ axiosOperation: AxiosOperation;
12
+ formatters: Formatters;
13
+ dynamicMFParameters: DynamicMFParameters;
14
+ }
15
+
16
+ export type MFHostAppProps = ByHostProps & BaseModuleProps;