@m4l/layouts 1.0.5 → 2.0.0
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/MFHostApp/{index.401a303e.js → index.6286a793.js} +1 -2
- package/components/MFHostApp/types.d.ts +1 -2
- package/components/MFNoAuthApp/types.d.ts +1 -2
- package/components/{index.7006a30d.js → index.56bd7864.js} +1 -1
- package/components/index.d.ts +0 -3
- package/contexts/AuthContext/{index.6f966215.js → index.59755369.js} +2 -2
- package/hooks/useAuth/{index.cb6a3420.js → index.ae68bf71.js} +1 -1
- package/index.js +12 -22
- package/package.json +2 -2
- package/components/BaseModule/index.8ff0193e.js +0 -39
- package/components/BaseModule/index.d.ts +0 -4
- package/components/BaseModule/types.d.ts +0 -10
- package/components/MFIsolationApp/index.d.ts +0 -4
- package/components/MFIsolationApp/index.e733d368.js +0 -181
- package/components/MFIsolationApp/subcomponents/MFAuthApp/index.d.ts +0 -4
- package/components/MFIsolationApp/subcomponents/MFAuthApp/types.d.ts +0 -6
- package/components/MFIsolationApp/types.d.ts +0 -14
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { unstable_HistoryRouter } from "react-router-dom";
|
|
2
2
|
import { EnvironmentProvider, HostToolsProvider, NetworkProvider, DomainCountryProvider } from "@m4l/core";
|
|
3
3
|
import { LocalesProvider, HostThemeProvider, ResponsiveContainerProvider, FormatterProvider } from "@m4l/graphics";
|
|
4
|
-
import { WindowToolsMFProvider, DynamicMFParmsProvider } from "@m4l/components";
|
|
5
|
-
import { B as BaseModule } from "../BaseModule/index.8ff0193e.js";
|
|
4
|
+
import { BaseModule, WindowToolsMFProvider, DynamicMFParmsProvider } from "@m4l/components";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
function MFHostApp(props) {
|
|
8
7
|
const {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { AxiosOperation, EnvironmentType, HostToolsType } from '@m4l/core';
|
|
2
2
|
import { Formatters, LocaleType } from '@m4l/graphics';
|
|
3
|
-
import { DynamicMFStore, WindowToolsMF } from '@m4l/components';
|
|
4
|
-
import { BaseModuleProps } from '../BaseModule/types';
|
|
3
|
+
import { DynamicMFStore, WindowToolsMF, BaseModuleProps } from '@m4l/components';
|
|
5
4
|
import { HostThemeType } from '@m4l/graphics';
|
|
6
5
|
export interface ByHostProps {
|
|
7
6
|
environment: EnvironmentType;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Formatters } from '@m4l/graphics';
|
|
2
|
-
import { WindowToolsMF } from '@m4l/components';
|
|
3
|
-
import { BaseModuleProps } from '../BaseModule/types';
|
|
2
|
+
import { WindowToolsMF, BaseModuleProps } from '@m4l/components';
|
|
4
3
|
export interface ByHostProps {
|
|
5
4
|
formatters: Formatters;
|
|
6
5
|
windowTools: WindowToolsMF;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DomainCountryProvider } from "@m4l/core";
|
|
2
2
|
import { FormatterProvider, ResponsiveContainerProvider } from "@m4l/graphics";
|
|
3
|
-
import {
|
|
3
|
+
import { BaseModule } from "@m4l/components";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
function MFNoAuthApp(props) {
|
|
6
6
|
const {
|
package/components/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export { MFIsolationApp } from './MFIsolationApp';
|
|
2
1
|
export { MFNoAuthApp } from './MFNoAuthApp';
|
|
3
2
|
export { MFHostApp } from './MFHostApp';
|
|
4
|
-
export { BaseModule } from './BaseModule';
|
|
5
3
|
export type { ByHostProps } from './MFHostApp/types';
|
|
6
|
-
export type { BaseModuleProps } from './BaseModule/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { A as AuthContext } from "../../contexts/AuthContext/index.59755369.js";
|
|
3
3
|
const useAuth = () => {
|
|
4
4
|
const context = useContext(AuthContext);
|
|
5
5
|
if (!context)
|
package/index.js
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
import { M } from "./components/
|
|
2
|
-
import { M as M2 } from "./components/index.
|
|
3
|
-
import {
|
|
4
|
-
import { B } from "./components/BaseModule/index.8ff0193e.js";
|
|
5
|
-
import { a, A } from "./contexts/AuthContext/index.6f966215.js";
|
|
1
|
+
import { M } from "./components/index.56bd7864.js";
|
|
2
|
+
import { M as M2 } from "./components/MFHostApp/index.6286a793.js";
|
|
3
|
+
import { A, a } from "./contexts/AuthContext/index.59755369.js";
|
|
6
4
|
import { a as a2, d, g } from "./layouts/ModuleLayout/index.e7218171.js";
|
|
7
5
|
import { a as a3, d as d2, g as g2 } from "./layouts/MasterDetailLayout/index.748f7ada.js";
|
|
8
6
|
import { N, d as d3, g as g3 } from "./layouts/NoAuthModuleLayout/index.83cd3ea3.js";
|
|
9
7
|
import { u } from "./hooks/useMasterDetail/index.d45f2a86.js";
|
|
10
|
-
import { u as u2 } from "./hooks/useAuth/index.
|
|
8
|
+
import { u as u2 } from "./hooks/useAuth/index.ae68bf71.js";
|
|
11
9
|
import { u as u3 } from "./hooks/useModule/index.b5f598b1.js";
|
|
12
|
-
import "react";
|
|
13
|
-
import "react-router-dom";
|
|
14
|
-
import "react-toastify";
|
|
15
|
-
import "@m4l/graphics";
|
|
16
10
|
import "@m4l/core";
|
|
17
|
-
import "
|
|
18
|
-
import "eventemitter3";
|
|
19
|
-
import "date-fns";
|
|
20
|
-
import "@m4l/styles";
|
|
21
|
-
import "react/jsx-runtime";
|
|
22
|
-
import "nprogress";
|
|
11
|
+
import "@m4l/graphics";
|
|
23
12
|
import "@m4l/components";
|
|
13
|
+
import "react/jsx-runtime";
|
|
14
|
+
import "react-router-dom";
|
|
15
|
+
import "react";
|
|
24
16
|
import "@mui/material/styles";
|
|
25
17
|
import "@mui/material";
|
|
26
18
|
import "@mui/base";
|
|
27
19
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
M as MFIsolationApp,
|
|
33
|
-
M2 as MFNoAuthApp,
|
|
20
|
+
A as AuthContext,
|
|
21
|
+
a as AuthProvider,
|
|
22
|
+
M2 as MFHostApp,
|
|
23
|
+
M as MFNoAuthApp,
|
|
34
24
|
a3 as MasterDetailLayout,
|
|
35
25
|
a2 as ModuleLayout,
|
|
36
26
|
N as NoAuthModuleLayout,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/layouts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
6
|
"private": false,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"nprogress": "^0.2.0",
|
|
20
20
|
"react": "^17.0.0 || ^18.0.0",
|
|
21
21
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
22
|
-
"react-toastify": "
|
|
22
|
+
"react-toastify": "10.0.5"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"*"
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { ModalProvider } from "@m4l/components";
|
|
2
|
-
import { FlagsProvider, ModuleDictionaryProvider, ModuleSkeletonProvider, ModulePrivilegesProvider } from "@m4l/core";
|
|
3
|
-
import { useLocales } from "@m4l/graphics";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
function BaseModule(props) {
|
|
6
|
-
const {
|
|
7
|
-
children,
|
|
8
|
-
isAuth = true,
|
|
9
|
-
moduleId,
|
|
10
|
-
moduleNameField,
|
|
11
|
-
skeletonFlags,
|
|
12
|
-
privileges,
|
|
13
|
-
componentsDictionary
|
|
14
|
-
} = props;
|
|
15
|
-
const localeString = useLocales().currentLocale?.localeString;
|
|
16
|
-
return /* @__PURE__ */ jsx(FlagsProvider, {
|
|
17
|
-
children: /* @__PURE__ */ jsx(ModuleDictionaryProvider, {
|
|
18
|
-
isAuth,
|
|
19
|
-
moduleId,
|
|
20
|
-
moduleNameField,
|
|
21
|
-
componentsDictionary,
|
|
22
|
-
currentLang: localeString,
|
|
23
|
-
children: /* @__PURE__ */ jsx(ModuleSkeletonProvider, {
|
|
24
|
-
flags: skeletonFlags,
|
|
25
|
-
children: isAuth ? /* @__PURE__ */ jsx(ModulePrivilegesProvider, {
|
|
26
|
-
queryPrivileges: privileges,
|
|
27
|
-
children: /* @__PURE__ */ jsx(ModalProvider, {
|
|
28
|
-
children
|
|
29
|
-
})
|
|
30
|
-
}) : /* @__PURE__ */ jsx(ModalProvider, {
|
|
31
|
-
children
|
|
32
|
-
})
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
BaseModule as B
|
|
39
|
-
};
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useCallback } from "react";
|
|
2
|
-
import { unstable_HistoryRouter } from "react-router-dom";
|
|
3
|
-
import { ToastContainer, toast } from "react-toastify";
|
|
4
|
-
import { HostThemeProvider, FormatterProvider, LocalesProvider, getLocaleFromNetwork, ResponsiveContainerProvider } from "@m4l/graphics";
|
|
5
|
-
import { A as AuthProvider } from "../../contexts/AuthContext/index.6f966215.js";
|
|
6
|
-
import { DomainCountryProvider, EnvironmentProvider, HostToolsProvider, NetworkProvider, axiosOperation } from "@m4l/core";
|
|
7
|
-
import { createBrowserHistory } from "history";
|
|
8
|
-
import EventEmitter from "eventemitter3";
|
|
9
|
-
import { format } from "date-fns";
|
|
10
|
-
import { defaultThemeOptions, fnComponentsOverrides } from "@m4l/styles";
|
|
11
|
-
import { u as useAuth } from "../../hooks/useAuth/index.cb6a3420.js";
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import NProgress from "nprogress";
|
|
14
|
-
import { B as BaseModule } from "../BaseModule/index.8ff0193e.js";
|
|
15
|
-
import { AreasProvider } from "@m4l/components";
|
|
16
|
-
function MFAuthApp(props) {
|
|
17
|
-
const {
|
|
18
|
-
children,
|
|
19
|
-
user,
|
|
20
|
-
pwd
|
|
21
|
-
} = props;
|
|
22
|
-
const {
|
|
23
|
-
isAuthenticated,
|
|
24
|
-
isInitialized,
|
|
25
|
-
login,
|
|
26
|
-
user: authUser
|
|
27
|
-
} = useAuth();
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
if (isInitialized && isAuthenticated === false) {
|
|
30
|
-
login(user, pwd, false);
|
|
31
|
-
}
|
|
32
|
-
}, [isInitialized, isAuthenticated]);
|
|
33
|
-
if (!isAuthenticated)
|
|
34
|
-
return /* @__PURE__ */ jsx("div", {
|
|
35
|
-
children: "Pendiente x atenticar"
|
|
36
|
-
});
|
|
37
|
-
const domianCountry = {
|
|
38
|
-
id: 1,
|
|
39
|
-
currency: "USD",
|
|
40
|
-
currency_decimal_digits: 2,
|
|
41
|
-
decimal_symbol: ".",
|
|
42
|
-
thousands_symbol: ","
|
|
43
|
-
};
|
|
44
|
-
if (authUser?.domain_country) {
|
|
45
|
-
domianCountry.id = authUser?.domain_country.id ?? domianCountry.id;
|
|
46
|
-
domianCountry.currency = authUser?.domain_country.currency ?? domianCountry.currency;
|
|
47
|
-
domianCountry.currency_decimal_digits = authUser?.domain_country.currency_decimal_digits ?? domianCountry.currency_decimal_digits;
|
|
48
|
-
domianCountry.decimal_symbol = authUser?.domain_country.decimal_symbol ?? domianCountry.decimal_symbol;
|
|
49
|
-
domianCountry.thousands_symbol = authUser?.domain_country?.thousands_symbol ?? domianCountry.thousands_symbol;
|
|
50
|
-
}
|
|
51
|
-
return /* @__PURE__ */ jsxs(HostThemeProvider, {
|
|
52
|
-
hostThemeOptions: defaultThemeOptions,
|
|
53
|
-
fnComponentsOverrides,
|
|
54
|
-
isMicroFrontEnd: true,
|
|
55
|
-
children: [/* @__PURE__ */ jsx(ToastContainer, {}), /* @__PURE__ */ jsx(DomainCountryProvider, {
|
|
56
|
-
...domianCountry,
|
|
57
|
-
isMicroFrontEnd: false,
|
|
58
|
-
children: /* @__PURE__ */ jsx(FormatterProvider, {
|
|
59
|
-
isMicroFrontEnd: false,
|
|
60
|
-
dateFormatter: {
|
|
61
|
-
formatDate: format
|
|
62
|
-
},
|
|
63
|
-
currencyFormatter: {
|
|
64
|
-
code: domianCountry.currency,
|
|
65
|
-
decimalDigits: domianCountry.currency_decimal_digits
|
|
66
|
-
},
|
|
67
|
-
children
|
|
68
|
-
})
|
|
69
|
-
})]
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const history = createBrowserHistory({
|
|
73
|
-
window
|
|
74
|
-
});
|
|
75
|
-
function MFIsolationApp(props) {
|
|
76
|
-
const {
|
|
77
|
-
children,
|
|
78
|
-
user,
|
|
79
|
-
pwd,
|
|
80
|
-
database = "domain",
|
|
81
|
-
host_api_local,
|
|
82
|
-
host_api_remote,
|
|
83
|
-
host_static_assets,
|
|
84
|
-
environment_assets,
|
|
85
|
-
moduleId,
|
|
86
|
-
skeletonFlags,
|
|
87
|
-
moduleNameField,
|
|
88
|
-
privileges,
|
|
89
|
-
componentsDictionary,
|
|
90
|
-
onLoad,
|
|
91
|
-
activeAreasNetwork = false,
|
|
92
|
-
activeCookiesFromNetwork = false,
|
|
93
|
-
observedDivRef
|
|
94
|
-
} = props;
|
|
95
|
-
const eventEmitter = useMemo(() => new EventEmitter(), []);
|
|
96
|
-
const events_add_listener = useCallback((eventName, handler) => {
|
|
97
|
-
eventEmitter.on(eventName, handler);
|
|
98
|
-
}, [eventEmitter]);
|
|
99
|
-
const events_remove_listener = useCallback((eventName, handler) => {
|
|
100
|
-
if (handler === null) {
|
|
101
|
-
eventEmitter.removeListener(eventName);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
eventEmitter.removeListener(eventName, handler);
|
|
105
|
-
}, [eventEmitter]);
|
|
106
|
-
const events_emit = useCallback((eventName, arg) => {
|
|
107
|
-
eventEmitter.emit(eventName, arg);
|
|
108
|
-
}, [eventEmitter]);
|
|
109
|
-
const startProgress = () => {
|
|
110
|
-
NProgress.configure({
|
|
111
|
-
showSpinner: true
|
|
112
|
-
});
|
|
113
|
-
NProgress.start();
|
|
114
|
-
};
|
|
115
|
-
const stopProgress = () => {
|
|
116
|
-
NProgress.done();
|
|
117
|
-
};
|
|
118
|
-
const environment = useMemo(() => ({
|
|
119
|
-
host: "",
|
|
120
|
-
isLocalhost: true,
|
|
121
|
-
domain_token: "lab1",
|
|
122
|
-
database,
|
|
123
|
-
host_api_local,
|
|
124
|
-
host_api_remote,
|
|
125
|
-
host_static_assets,
|
|
126
|
-
environment_assets
|
|
127
|
-
}), []);
|
|
128
|
-
const hostTools = useMemo(() => ({
|
|
129
|
-
history,
|
|
130
|
-
toast,
|
|
131
|
-
startProgress,
|
|
132
|
-
stopProgress,
|
|
133
|
-
events_add_listener,
|
|
134
|
-
events_remove_listener,
|
|
135
|
-
events_emit
|
|
136
|
-
}), []);
|
|
137
|
-
return /* @__PURE__ */ jsx(EnvironmentProvider, {
|
|
138
|
-
...environment,
|
|
139
|
-
children: /* @__PURE__ */ jsx(HostToolsProvider, {
|
|
140
|
-
...hostTools,
|
|
141
|
-
children: /* @__PURE__ */ jsx(NetworkProvider, {
|
|
142
|
-
axiosOperation,
|
|
143
|
-
children: /* @__PURE__ */ jsx(unstable_HistoryRouter, {
|
|
144
|
-
history,
|
|
145
|
-
children: /* @__PURE__ */ jsx(LocalesProvider, {
|
|
146
|
-
isMicroFrontEnd: false,
|
|
147
|
-
getLocaleFromNetwork,
|
|
148
|
-
children: /* @__PURE__ */ jsx(AuthProvider, {
|
|
149
|
-
children: /* @__PURE__ */ jsx(MFAuthApp, {
|
|
150
|
-
user,
|
|
151
|
-
pwd,
|
|
152
|
-
children: /* @__PURE__ */ jsx(BaseModule, {
|
|
153
|
-
moduleId,
|
|
154
|
-
privileges,
|
|
155
|
-
skeletonFlags,
|
|
156
|
-
componentsDictionary,
|
|
157
|
-
moduleNameField,
|
|
158
|
-
children: /* @__PURE__ */ jsx(AreasProvider, {
|
|
159
|
-
onLoad,
|
|
160
|
-
loadAreasFromNetwork: activeAreasNetwork,
|
|
161
|
-
loadCookiesFromNetwork: activeCookiesFromNetwork,
|
|
162
|
-
onSelectLayout: (modId) => {
|
|
163
|
-
console.log("onSelectLayout", modId);
|
|
164
|
-
},
|
|
165
|
-
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, {
|
|
166
|
-
observedDivRef,
|
|
167
|
-
children
|
|
168
|
-
})
|
|
169
|
-
})
|
|
170
|
-
})
|
|
171
|
-
})
|
|
172
|
-
})
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
})
|
|
176
|
-
})
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
export {
|
|
180
|
-
MFIsolationApp as M
|
|
181
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseModuleProps } from '../BaseModule/types';
|
|
2
|
-
export declare type MFIsolationAppProps = BaseModuleProps & {
|
|
3
|
-
user: string;
|
|
4
|
-
pwd: string;
|
|
5
|
-
host_api_local: string;
|
|
6
|
-
database?: string;
|
|
7
|
-
host_api_remote: string;
|
|
8
|
-
host_static_assets: string;
|
|
9
|
-
environment_assets: string;
|
|
10
|
-
onLoad: () => void;
|
|
11
|
-
activeAreasNetwork?: boolean;
|
|
12
|
-
activeCookiesFromNetwork?: boolean;
|
|
13
|
-
observedDivRef: Element | Text | null;
|
|
14
|
-
};
|