@m4l/layouts 3.1.3 → 6.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-Bz3RUvvY.js +90 -0
- package/components/{index-JO7pb6aB.js → index-uQ5qk7MJ.js} +25 -10
- package/contexts/AuthContext/index-DARkRRM4.js +161 -0
- package/contexts/AuthContext/index.d.ts +5 -0
- package/contexts/AuthContext/types.d.ts +51 -0
- package/contexts/index-l0sNRNKZ.js +1 -0
- package/contexts/index.d.ts +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/useAuth/index-8hAi3guc.js +10 -0
- package/hooks/useAuth/index.d.ts +2 -0
- package/hooks/useMasterDetail/{index-B5SssPwx.js → index-D4QUQYYc.js} +1 -1
- package/hooks/useModule/{index-DN7ElPTv.js → index-FY5nsBmE.js} +1 -1
- package/index.d.ts +1 -0
- package/index.js +15 -10
- package/layouts/MasterDetailLayout/{index-1ni-37-Z.js → index-DeC4RoBs.js} +64 -69
- package/layouts/ModuleLayout/{index-r2ZbMqju.js → index-DAtDuh6s.js} +56 -24
- package/layouts/NoAuthModuleLayout/{index-DZtmX8iq.js → index-txgn4T5B.js} +177 -110
- package/m4l_layouts/types.d.ts +1 -0
- package/package.json +6 -6
- package/vite-env.d.ts +3 -3
- package/components/MFHostApp/index-DDl942hP.js +0 -63
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { unstable_HistoryRouter } from "react-router-dom";
|
|
2
|
+
import { EnvironmentProvider, HostToolsProvider, NetworkProvider, DomainCountryProvider } from "@m4l/core";
|
|
3
|
+
import { LocalesProvider, HostThemeProvider, ResponsiveContainerProvider, FormatterProvider } from "@m4l/graphics";
|
|
4
|
+
import { BaseModule, WindowToolsMFProvider, DynamicMFParmsProvider, AppearanceComponentProvider } from "@m4l/components";
|
|
5
|
+
import { useTheme } from "@mui/material";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { M as MFWindowsTitle } from "../index-uQ5qk7MJ.js";
|
|
8
|
+
function MFHostApp(props) {
|
|
9
|
+
const {
|
|
10
|
+
children,
|
|
11
|
+
currentLocale,
|
|
12
|
+
hostTheme,
|
|
13
|
+
environment,
|
|
14
|
+
hostTools,
|
|
15
|
+
axiosOperation,
|
|
16
|
+
formatters,
|
|
17
|
+
isAuth = true,
|
|
18
|
+
moduleId,
|
|
19
|
+
moduleNameField,
|
|
20
|
+
skeletonFlags,
|
|
21
|
+
privileges,
|
|
22
|
+
componentsDictionary,
|
|
23
|
+
dynamicMFStore,
|
|
24
|
+
windowTools,
|
|
25
|
+
observedDivRef,
|
|
26
|
+
isAddEditModule = false
|
|
27
|
+
} = props;
|
|
28
|
+
const {
|
|
29
|
+
generalSettings
|
|
30
|
+
} = useTheme();
|
|
31
|
+
return /* @__PURE__ */ jsx(EnvironmentProvider, {
|
|
32
|
+
...environment,
|
|
33
|
+
children: /* @__PURE__ */ jsx(HostToolsProvider, {
|
|
34
|
+
...hostTools,
|
|
35
|
+
children: /* @__PURE__ */ jsx(NetworkProvider, {
|
|
36
|
+
axiosOperation,
|
|
37
|
+
children: /* @__PURE__ */ jsx(LocalesProvider, {
|
|
38
|
+
isMicroFrontEnd: true,
|
|
39
|
+
localeHost: currentLocale,
|
|
40
|
+
children: /* @__PURE__ */ jsx(HostThemeProvider, {
|
|
41
|
+
isMicroFrontEnd: true,
|
|
42
|
+
...hostTheme,
|
|
43
|
+
isMobile: generalSettings?.isMobile,
|
|
44
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, {
|
|
45
|
+
observedDivRef,
|
|
46
|
+
children: /* @__PURE__ */ jsx(unstable_HistoryRouter, {
|
|
47
|
+
history: hostTools.history,
|
|
48
|
+
children: /* @__PURE__ */ jsx(DomainCountryProvider, {
|
|
49
|
+
isMicroFrontEnd: true,
|
|
50
|
+
id: dynamicMFStore?.getState().dynamicMFParameters?.id || 1,
|
|
51
|
+
currency: formatters.currencyFormatter.code,
|
|
52
|
+
currency_decimal_digits: formatters.currencyFormatter.decimalDigits,
|
|
53
|
+
decimal_symbol: formatters.numberFormatter.decimalSymbol,
|
|
54
|
+
thousands_symbol: formatters.numberFormatter.thousandsSymbol,
|
|
55
|
+
children: /* @__PURE__ */ jsx(BaseModule, {
|
|
56
|
+
isAuth,
|
|
57
|
+
moduleId,
|
|
58
|
+
moduleNameField,
|
|
59
|
+
componentsDictionary,
|
|
60
|
+
skeletonFlags,
|
|
61
|
+
privileges,
|
|
62
|
+
children: /* @__PURE__ */ jsx(FormatterProvider, {
|
|
63
|
+
isMicroFrontEnd: true,
|
|
64
|
+
...formatters,
|
|
65
|
+
children: /* @__PURE__ */ jsx(WindowToolsMFProvider, {
|
|
66
|
+
...windowTools,
|
|
67
|
+
children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, {
|
|
68
|
+
store: dynamicMFStore,
|
|
69
|
+
children: /* @__PURE__ */ jsx(MFWindowsTitle, {
|
|
70
|
+
isAddEditModule,
|
|
71
|
+
children: /* @__PURE__ */ jsx(AppearanceComponentProvider, {
|
|
72
|
+
children
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
MFHostApp as M
|
|
90
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { DomainCountryProvider } from "@m4l/core";
|
|
3
2
|
import { FormatterProvider, ResponsiveContainerProvider } from "@m4l/graphics";
|
|
4
3
|
import { BaseModule, useSetWindowsTitle } from "@m4l/components";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { Fragment } from "react";
|
|
6
6
|
function MFNoAuthApp(props) {
|
|
7
7
|
const {
|
|
@@ -22,22 +22,37 @@ function MFNoAuthApp(props) {
|
|
|
22
22
|
decimal_symbol: ".",
|
|
23
23
|
thousands_symbol: ","
|
|
24
24
|
};
|
|
25
|
-
return /* @__PURE__ */ jsx(DomainCountryProvider, {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
return /* @__PURE__ */ jsx(DomainCountryProvider, {
|
|
26
|
+
isMicroFrontEnd: true,
|
|
27
|
+
...domianCountry,
|
|
28
|
+
children: /* @__PURE__ */ jsx(BaseModule, {
|
|
28
29
|
isAuth,
|
|
29
30
|
moduleId,
|
|
30
31
|
moduleNameField,
|
|
31
32
|
componentsDictionary,
|
|
32
33
|
skeletonFlags,
|
|
33
34
|
privileges,
|
|
34
|
-
children: /* @__PURE__ */ jsx(FormatterProvider, {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
children: /* @__PURE__ */ jsx(FormatterProvider, {
|
|
36
|
+
isMicroFrontEnd: true,
|
|
37
|
+
...formatters,
|
|
38
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, {
|
|
39
|
+
observedDivRef,
|
|
40
|
+
children
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
});
|
|
37
45
|
}
|
|
38
|
-
function MFWindowsTitle({
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
function MFWindowsTitle({
|
|
47
|
+
isAddEditModule = false,
|
|
48
|
+
children
|
|
49
|
+
}) {
|
|
50
|
+
useSetWindowsTitle({
|
|
51
|
+
isAddEditModule
|
|
52
|
+
});
|
|
53
|
+
return /* @__PURE__ */ jsx(Fragment, {
|
|
54
|
+
children
|
|
55
|
+
});
|
|
41
56
|
}
|
|
42
57
|
export {
|
|
43
58
|
MFWindowsTitle as M,
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { createContext, useReducer, useEffect } from "react";
|
|
2
|
+
import { useHostTools, useNetwork, useEnvironment, useLocalStorageWithListener, EmitEvents, getLocalStorage, setLocalStorage } from "@m4l/core";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var EnumTypes = /* @__PURE__ */ ((EnumTypes2) => {
|
|
5
|
+
EnumTypes2["Initial"] = "INITIALIZE";
|
|
6
|
+
EnumTypes2["Login"] = "LOGIN";
|
|
7
|
+
EnumTypes2["Logout"] = "LOGOUT";
|
|
8
|
+
return EnumTypes2;
|
|
9
|
+
})(EnumTypes || {});
|
|
10
|
+
const initialState = {
|
|
11
|
+
isAuthenticated: false,
|
|
12
|
+
isInitialized: false,
|
|
13
|
+
user: null
|
|
14
|
+
};
|
|
15
|
+
const JWTReducer = (state, action) => {
|
|
16
|
+
switch (action.type) {
|
|
17
|
+
case "INITIALIZE":
|
|
18
|
+
return {
|
|
19
|
+
isAuthenticated: action.payload.isAuthenticated,
|
|
20
|
+
isInitialized: true,
|
|
21
|
+
user: action.payload.user
|
|
22
|
+
};
|
|
23
|
+
case "LOGIN":
|
|
24
|
+
return {
|
|
25
|
+
...state,
|
|
26
|
+
isAuthenticated: true,
|
|
27
|
+
user: action.payload.user
|
|
28
|
+
};
|
|
29
|
+
case "LOGOUT":
|
|
30
|
+
return {
|
|
31
|
+
...state,
|
|
32
|
+
isAuthenticated: false,
|
|
33
|
+
user: null
|
|
34
|
+
};
|
|
35
|
+
default:
|
|
36
|
+
return state;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const AuthContext = createContext(null);
|
|
40
|
+
function dispatchInitial(dispatch) {
|
|
41
|
+
dispatch({
|
|
42
|
+
type: EnumTypes.Initial,
|
|
43
|
+
payload: {
|
|
44
|
+
isAuthenticated: false,
|
|
45
|
+
user: null
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function AuthProvider(props) {
|
|
50
|
+
const {
|
|
51
|
+
children
|
|
52
|
+
} = props;
|
|
53
|
+
const [state, dispatch] = useReducer(JWTReducer, initialState);
|
|
54
|
+
const {
|
|
55
|
+
events_add_listener
|
|
56
|
+
} = useHostTools();
|
|
57
|
+
const {
|
|
58
|
+
networkOperation
|
|
59
|
+
} = useNetwork();
|
|
60
|
+
const {
|
|
61
|
+
domain_token
|
|
62
|
+
} = useEnvironment();
|
|
63
|
+
const [nextValSession, setNextValSession] = useLocalStorageWithListener(
|
|
64
|
+
//Variable para saber si ha cambiado la session en otro navegador
|
|
65
|
+
"vSession",
|
|
66
|
+
(/* @__PURE__ */ new Date()).getTime() + ""
|
|
67
|
+
);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
const initialize = async () => {
|
|
70
|
+
networkOperation({
|
|
71
|
+
method: "GET",
|
|
72
|
+
endPoint: `auth/login`,
|
|
73
|
+
parms: {
|
|
74
|
+
user_data: true
|
|
75
|
+
},
|
|
76
|
+
checkUnAuthorized: false
|
|
77
|
+
}).then((response) => {
|
|
78
|
+
dispatch({
|
|
79
|
+
type: EnumTypes.Initial,
|
|
80
|
+
payload: {
|
|
81
|
+
isAuthenticated: true,
|
|
82
|
+
user: response.user
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const useSaved = getLocalStorage("userData", {
|
|
86
|
+
email: response.user.email,
|
|
87
|
+
remember: true
|
|
88
|
+
});
|
|
89
|
+
if (useSaved?.email !== response.user.email) {
|
|
90
|
+
setLocalStorage("userData", {
|
|
91
|
+
email: response.user.email
|
|
92
|
+
}, true);
|
|
93
|
+
}
|
|
94
|
+
}).catch(() => {
|
|
95
|
+
dispatchInitial(dispatch);
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
initialize();
|
|
99
|
+
}, [nextValSession]);
|
|
100
|
+
const login = async (email, password, remember) => {
|
|
101
|
+
await networkOperation({
|
|
102
|
+
endPoint: `auth/login`,
|
|
103
|
+
method: "POST",
|
|
104
|
+
data: {
|
|
105
|
+
email,
|
|
106
|
+
password,
|
|
107
|
+
domain_token
|
|
108
|
+
}
|
|
109
|
+
}).then((response) => {
|
|
110
|
+
const user = response.data;
|
|
111
|
+
if (remember) {
|
|
112
|
+
setLocalStorage("userData", {
|
|
113
|
+
email,
|
|
114
|
+
remember
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
setLocalStorage("userData", {
|
|
118
|
+
email: "",
|
|
119
|
+
remember
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
dispatch({
|
|
123
|
+
type: EnumTypes.Login,
|
|
124
|
+
payload: {
|
|
125
|
+
user
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
setNextValSession((/* @__PURE__ */ new Date()).getTime() + "");
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
const logout = async (isAuthenticated) => {
|
|
132
|
+
if (isAuthenticated) {
|
|
133
|
+
await networkOperation({
|
|
134
|
+
endPoint: `auth/logout`,
|
|
135
|
+
method: "POST"
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
dispatch({
|
|
139
|
+
type: EnumTypes.Logout
|
|
140
|
+
});
|
|
141
|
+
setNextValSession((/* @__PURE__ */ new Date()).getTime() + "");
|
|
142
|
+
};
|
|
143
|
+
const onNetserviceUnautorized = () => {
|
|
144
|
+
logout(false);
|
|
145
|
+
};
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
events_add_listener(EmitEvents.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, onNetserviceUnautorized);
|
|
148
|
+
}, []);
|
|
149
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, {
|
|
150
|
+
value: {
|
|
151
|
+
...state,
|
|
152
|
+
login,
|
|
153
|
+
logout
|
|
154
|
+
},
|
|
155
|
+
children
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
export {
|
|
159
|
+
AuthContext as A,
|
|
160
|
+
AuthProvider as a
|
|
161
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AuthProviderProps, SessionContextType } from './types';
|
|
3
|
+
declare const AuthContext: import("react").Context<SessionContextType | null>;
|
|
4
|
+
declare function AuthProvider(props: AuthProviderProps): import("react").JSX.Element;
|
|
5
|
+
export { AuthContext, AuthProvider };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DomainCountry, Maybe } from '@m4l/core';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export declare enum EnumTypes {
|
|
4
|
+
Initial = "INITIALIZE",
|
|
5
|
+
Login = "LOGIN",
|
|
6
|
+
Logout = "LOGOUT"
|
|
7
|
+
}
|
|
8
|
+
export declare type AuthProviderProps = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare type ActionMap<M extends {
|
|
12
|
+
[index: string]: any;
|
|
13
|
+
}> = {
|
|
14
|
+
[Key in keyof M]: M[Key] extends undefined ? {
|
|
15
|
+
type: Key;
|
|
16
|
+
} : {
|
|
17
|
+
type: Key;
|
|
18
|
+
payload: M[Key];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare type SessionAuthPayload = {
|
|
22
|
+
[EnumTypes.Initial]: {
|
|
23
|
+
isAuthenticated: boolean;
|
|
24
|
+
user: AuthUser;
|
|
25
|
+
};
|
|
26
|
+
[EnumTypes.Login]: {
|
|
27
|
+
user: AuthUser;
|
|
28
|
+
};
|
|
29
|
+
[EnumTypes.Logout]: undefined;
|
|
30
|
+
};
|
|
31
|
+
export declare type SessionActions = ActionMap<SessionAuthPayload>[keyof ActionMap<SessionAuthPayload>];
|
|
32
|
+
export interface User {
|
|
33
|
+
email: string;
|
|
34
|
+
id: number;
|
|
35
|
+
first_name: string;
|
|
36
|
+
last_name: string;
|
|
37
|
+
account_id: number;
|
|
38
|
+
domain_country: DomainCountry;
|
|
39
|
+
avatar_url?: Maybe<string>;
|
|
40
|
+
user_type_id?: number;
|
|
41
|
+
}
|
|
42
|
+
export declare type AuthUser = Maybe<User>;
|
|
43
|
+
export declare type AuthState = {
|
|
44
|
+
isAuthenticated: boolean;
|
|
45
|
+
isInitialized: boolean;
|
|
46
|
+
user: AuthUser;
|
|
47
|
+
};
|
|
48
|
+
export interface SessionContextType extends AuthState {
|
|
49
|
+
login: (email: string, password: string, remember: boolean) => object | undefined;
|
|
50
|
+
logout: (isAuthenticated: boolean) => Promise<void>;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AuthContext';
|
package/hooks/index.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { A as AuthContext } from "../../contexts/AuthContext/index-DARkRRM4.js";
|
|
3
|
+
const useAuth = () => {
|
|
4
|
+
const context = useContext(AuthContext);
|
|
5
|
+
if (!context) throw new Error("Auth context must be use inside AuthProvider");
|
|
6
|
+
return context;
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
useAuth as u
|
|
10
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { M as MasterDetailContext } from "../../layouts/MasterDetailLayout/index-
|
|
2
|
+
import { M as MasterDetailContext } from "../../layouts/MasterDetailLayout/index-DeC4RoBs.js";
|
|
3
3
|
const useMasterDetail = () => useContext(MasterDetailContext);
|
|
4
4
|
export {
|
|
5
5
|
useMasterDetail as u
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from "react";
|
|
2
|
-
import { M as ModuleContext } from "../../layouts/ModuleLayout/index-
|
|
2
|
+
import { M as ModuleContext } from "../../layouts/ModuleLayout/index-DAtDuh6s.js";
|
|
3
3
|
const useModule = () => {
|
|
4
4
|
const context = useContext(ModuleContext);
|
|
5
5
|
if (!context) throw new Error("useModule context must be use inside ModuleContext");
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { a } from "./components/index-
|
|
2
|
-
import { M } from "./components/MFHostApp/index-
|
|
3
|
-
import { a as a2
|
|
4
|
-
import { a as a3, d
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { u
|
|
1
|
+
import { a } from "./components/index-uQ5qk7MJ.js";
|
|
2
|
+
import { M } from "./components/MFHostApp/index-Bz3RUvvY.js";
|
|
3
|
+
import { A, a as a2 } from "./contexts/AuthContext/index-DARkRRM4.js";
|
|
4
|
+
import { a as a3, d, g } from "./layouts/ModuleLayout/index-DAtDuh6s.js";
|
|
5
|
+
import { a as a4, d as d2, g as g2 } from "./layouts/MasterDetailLayout/index-DeC4RoBs.js";
|
|
6
|
+
import { N, d as d3, g as g3 } from "./layouts/NoAuthModuleLayout/index-txgn4T5B.js";
|
|
7
|
+
import { u } from "./hooks/useMasterDetail/index-D4QUQYYc.js";
|
|
8
|
+
import { u as u2 } from "./hooks/useAuth/index-8hAi3guc.js";
|
|
9
|
+
import { u as u3 } from "./hooks/useModule/index-FY5nsBmE.js";
|
|
8
10
|
export {
|
|
11
|
+
A as AuthContext,
|
|
12
|
+
a2 as AuthProvider,
|
|
9
13
|
M as MFHostApp,
|
|
10
14
|
a as MFNoAuthApp,
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
a4 as MasterDetailLayout,
|
|
16
|
+
a3 as ModuleLayout,
|
|
13
17
|
N as NoAuthModuleLayout,
|
|
14
18
|
d2 as defaultMasterDetailDictionary,
|
|
15
19
|
d as defaultModuleLayoutDictionary,
|
|
@@ -17,6 +21,7 @@ export {
|
|
|
17
21
|
g2 as getMasterDetailLayoutComponentsDictionary,
|
|
18
22
|
g as getModuleLayoutComponentsDictionary,
|
|
19
23
|
g3 as getNoAuthModuleLayoutComponentsDictionary,
|
|
24
|
+
u2 as useAuth,
|
|
20
25
|
u as useMasterDetail,
|
|
21
|
-
|
|
26
|
+
u3 as useModule
|
|
22
27
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { createContext, useState, useRef, useMemo, useCallback } from "react";
|
|
3
2
|
import { voidFunction, useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
4
3
|
import { WindowBase, SplitLayout } from "@m4l/components";
|
|
5
|
-
import { a as ModuleLayout, g as getModuleLayoutComponentsDictionary } from "../ModuleLayout/index-
|
|
4
|
+
import { a as ModuleLayout, g as getModuleLayoutComponentsDictionary } from "../ModuleLayout/index-DAtDuh6s.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
7
7
|
import { generateUtilityClasses, generateUtilityClass, styled } from "@mui/material";
|
|
8
8
|
import { unstable_composeClasses } from "@mui/base";
|
|
@@ -13,19 +13,19 @@ const initialState = {
|
|
|
13
13
|
};
|
|
14
14
|
const MasterDetailContext = createContext(initialState);
|
|
15
15
|
function MasterDetailProvider(props) {
|
|
16
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
children,
|
|
18
|
+
onClickViewDetail
|
|
19
|
+
} = props;
|
|
17
20
|
const [masterSelection, setMasterSelection] = useState(void 0);
|
|
18
|
-
return /* @__PURE__ */ jsx(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
children
|
|
27
|
-
}
|
|
28
|
-
);
|
|
21
|
+
return /* @__PURE__ */ jsx(MasterDetailContext.Provider, {
|
|
22
|
+
value: {
|
|
23
|
+
masterSelection,
|
|
24
|
+
onChangeMasterSelection: setMasterSelection,
|
|
25
|
+
onClickViewDetail
|
|
26
|
+
},
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
29
|
}
|
|
30
30
|
const componentName = "M4LMasterDetailLayout";
|
|
31
31
|
generateUtilityClasses(componentName, [
|
|
@@ -62,46 +62,44 @@ function MasterDetailLayout(props) {
|
|
|
62
62
|
version
|
|
63
63
|
// defaultDictionary,
|
|
64
64
|
} = props;
|
|
65
|
-
const {
|
|
65
|
+
const {
|
|
66
|
+
host_static_assets,
|
|
67
|
+
environment_assets
|
|
68
|
+
} = useEnvironment();
|
|
66
69
|
const [splitPosition, setSplitPosition] = useState("vertical");
|
|
67
70
|
const isDesktop = useResponsiveDesktop();
|
|
68
71
|
const moduleLayoutRef = useRef(null);
|
|
69
|
-
const {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
key: "none"
|
|
101
|
-
}
|
|
102
|
-
],
|
|
103
|
-
[getLabel, splitPosition]
|
|
104
|
-
);
|
|
72
|
+
const {
|
|
73
|
+
getLabel
|
|
74
|
+
} = useModuleDictionary();
|
|
75
|
+
const splitActions = useMemo(() => [{
|
|
76
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/masterdetaillayout/assets/icons/split_vertical.svg`,
|
|
77
|
+
onClick: () => onChangePostionInternal("vertical"),
|
|
78
|
+
visibility: "main",
|
|
79
|
+
label: getLabel("master_detail_layout.split_vertical"),
|
|
80
|
+
tag: "vertical",
|
|
81
|
+
className: "splitactions",
|
|
82
|
+
disabled: splitPosition === "vertical",
|
|
83
|
+
key: "vertical"
|
|
84
|
+
}, {
|
|
85
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/masterdetaillayout/assets/icons/split_horizontal.svg`,
|
|
86
|
+
onClick: () => onChangePostionInternal("horizontal"),
|
|
87
|
+
visibility: "main",
|
|
88
|
+
label: getLabel("master_detail_layout.split_horizontal"),
|
|
89
|
+
tag: "horizontal",
|
|
90
|
+
className: "splitactions",
|
|
91
|
+
disabled: splitPosition === "horizontal",
|
|
92
|
+
key: "horizontal"
|
|
93
|
+
}, {
|
|
94
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/masterdetaillayout/assets/icons/no_split.svg`,
|
|
95
|
+
onClick: () => onChangePostionInternal("none"),
|
|
96
|
+
visibility: "main",
|
|
97
|
+
label: getLabel("master_detail_layout.no_split"),
|
|
98
|
+
tag: "none",
|
|
99
|
+
className: "splitactions",
|
|
100
|
+
disabled: splitPosition === "none",
|
|
101
|
+
key: "none"
|
|
102
|
+
}], [getLabel, splitPosition]);
|
|
105
103
|
const onChangePostionInternal = useCallback((newPostion) => {
|
|
106
104
|
setSplitPosition(newPostion);
|
|
107
105
|
}, []);
|
|
@@ -120,30 +118,27 @@ function MasterDetailLayout(props) {
|
|
|
120
118
|
});
|
|
121
119
|
}, [detailComponent, getLabel]);
|
|
122
120
|
const finalModuleActions = useMemo(() => {
|
|
123
|
-
const actions = getTotalModuleActions(
|
|
124
|
-
splitActions,
|
|
125
|
-
moduleActions
|
|
126
|
-
);
|
|
121
|
+
const actions = getTotalModuleActions(splitActions, moduleActions);
|
|
127
122
|
return actions;
|
|
128
123
|
}, [splitActions, moduleActions]);
|
|
129
124
|
const classes = useMasterDetailLayoutUtilityClasses();
|
|
130
|
-
return /* @__PURE__ */ jsx(MasterDetailProvider, {
|
|
131
|
-
|
|
132
|
-
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
{
|
|
125
|
+
return /* @__PURE__ */ jsx(MasterDetailProvider, {
|
|
126
|
+
onClickViewDetail,
|
|
127
|
+
children: /* @__PURE__ */ jsx(MasterDetailLayoutRoot, {
|
|
128
|
+
className: classes.root,
|
|
129
|
+
children: /* @__PURE__ */ jsx(ModuleLayout, {
|
|
130
|
+
ref: moduleLayoutRef,
|
|
131
|
+
moduleId,
|
|
132
|
+
moduleActions: finalModuleActions,
|
|
133
|
+
version,
|
|
134
|
+
children: /* @__PURE__ */ jsx(SplitLayout, {
|
|
140
135
|
splitPosition: isDesktop ? splitPosition : "none",
|
|
141
136
|
firstPart: masterComponent,
|
|
142
137
|
secondPart: detailComponent
|
|
143
|
-
}
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
138
|
+
})
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
});
|
|
147
142
|
}
|
|
148
143
|
function getMasterDetailLayoutComponentsDictionary() {
|
|
149
144
|
return ["master_detail_layout"].concat(getModuleLayoutComponentsDictionary());
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { useModal, useWindowToolsMF, ModalProvider, getModalDialogComponentsDictionary } from "@m4l/components";
|
|
3
2
|
import { forwardRef, useRef, useImperativeHandle, createContext, useState, useMemo, useEffect } from "react";
|
|
4
3
|
import { styled } from "@mui/material/styles";
|
|
5
4
|
import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
|
|
6
5
|
import { unstable_composeClasses } from "@mui/base";
|
|
7
|
-
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
const InnerModuleRoot = styled("div")(({
|
|
8
|
+
theme
|
|
9
|
+
}) => ({
|
|
8
10
|
...theme.components?.M4LModuleLayout?.styleOverrides
|
|
9
11
|
}));
|
|
10
12
|
const componentName = "M4LModuleLayout";
|
|
@@ -28,25 +30,43 @@ const useModuleLayoutUtilityClasses = () => {
|
|
|
28
30
|
};
|
|
29
31
|
};
|
|
30
32
|
const InnerModule = forwardRef((props, ref) => {
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
+
const {
|
|
34
|
+
children
|
|
35
|
+
} = props;
|
|
36
|
+
const {
|
|
37
|
+
openModal
|
|
38
|
+
} = useModal();
|
|
33
39
|
const divRef = useRef(null);
|
|
34
40
|
useImperativeHandle(ref, () => ({
|
|
35
41
|
openModal,
|
|
36
42
|
current: divRef.current
|
|
37
43
|
}));
|
|
38
44
|
const classes = useModuleLayoutUtilityClasses();
|
|
39
|
-
return /* @__PURE__ */ jsx(InnerModuleRoot, {
|
|
45
|
+
return /* @__PURE__ */ jsx(InnerModuleRoot, {
|
|
46
|
+
className: classes.root,
|
|
47
|
+
ref: divRef,
|
|
48
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: classes.moduleContent,
|
|
50
|
+
children
|
|
51
|
+
})
|
|
52
|
+
});
|
|
40
53
|
});
|
|
41
54
|
InnerModule.displayName = "InnerModule";
|
|
42
55
|
const ModuleContext = createContext(null);
|
|
43
56
|
function ModuleProvider(props) {
|
|
44
|
-
const {
|
|
57
|
+
const {
|
|
58
|
+
children,
|
|
59
|
+
moduleActions,
|
|
60
|
+
moduleId,
|
|
61
|
+
version
|
|
62
|
+
} = props;
|
|
45
63
|
const [configOptions] = useState(() => ({
|
|
46
64
|
moduleId,
|
|
47
65
|
dictionary: void 0
|
|
48
66
|
}));
|
|
49
|
-
const {
|
|
67
|
+
const {
|
|
68
|
+
setActions
|
|
69
|
+
} = useWindowToolsMF();
|
|
50
70
|
const [dynamicActions, setDynamicActions] = useState([]);
|
|
51
71
|
const finalModuleActions = useMemo(() => {
|
|
52
72
|
return (moduleActions || []).concat(dynamicActions);
|
|
@@ -54,24 +74,26 @@ function ModuleProvider(props) {
|
|
|
54
74
|
useEffect(() => {
|
|
55
75
|
setActions(finalModuleActions, version);
|
|
56
76
|
}, [finalModuleActions]);
|
|
57
|
-
return /* @__PURE__ */ jsx(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
children
|
|
70
|
-
}
|
|
71
|
-
);
|
|
77
|
+
return /* @__PURE__ */ jsx(ModuleContext.Provider, {
|
|
78
|
+
value: {
|
|
79
|
+
// moduleActions: finalModuleActions,
|
|
80
|
+
// dynamicActions,
|
|
81
|
+
setDynamicActions,
|
|
82
|
+
moduleId: configOptions.moduleId
|
|
83
|
+
// moduleNameField: configOptions.moduleNameField,
|
|
84
|
+
// urlIcon: configOptions.urlIcon,
|
|
85
|
+
// breadcrumbLinks: configOptions.breadcrumbLinks,
|
|
86
|
+
},
|
|
87
|
+
children
|
|
88
|
+
});
|
|
72
89
|
}
|
|
73
90
|
const ModuleLayout = forwardRef((props, ref) => {
|
|
74
|
-
const {
|
|
91
|
+
const {
|
|
92
|
+
moduleId,
|
|
93
|
+
moduleActions,
|
|
94
|
+
version,
|
|
95
|
+
children
|
|
96
|
+
} = props;
|
|
75
97
|
const moduleRef = useRef(null);
|
|
76
98
|
const openModal = (modalOpenProps) => {
|
|
77
99
|
moduleRef.current?.openModal(modalOpenProps);
|
|
@@ -80,7 +102,17 @@ const ModuleLayout = forwardRef((props, ref) => {
|
|
|
80
102
|
openModal,
|
|
81
103
|
current: moduleRef.current
|
|
82
104
|
}));
|
|
83
|
-
return /* @__PURE__ */ jsx(ModuleProvider, {
|
|
105
|
+
return /* @__PURE__ */ jsx(ModuleProvider, {
|
|
106
|
+
moduleId,
|
|
107
|
+
moduleActions,
|
|
108
|
+
version,
|
|
109
|
+
children: /* @__PURE__ */ jsx(ModalProvider, {
|
|
110
|
+
children: /* @__PURE__ */ jsx(InnerModule, {
|
|
111
|
+
ref: moduleRef,
|
|
112
|
+
children
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
});
|
|
84
116
|
});
|
|
85
117
|
ModuleLayout.displayName = "ModuleLayout";
|
|
86
118
|
function getModuleLayoutComponentsDictionary() {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
1
|
import { useResponsiveDesktop, useLocales, ResponsiveContainerProvider } from "@m4l/graphics";
|
|
3
2
|
import { LanguagePopover, Image, Typography, Stack, ScrollBar, HelmetPage } from "@m4l/components";
|
|
4
3
|
import { styled } from "@mui/material";
|
|
5
4
|
import { useBase, useModuleDictionary, useDomain, useEnvironment, BaseProvider, FlagsProvider, ModuleDictionaryProvider, ModuleSkeletonProvider } from "@m4l/core";
|
|
6
5
|
import { styled as styled$1, alpha } from "@mui/material/styles";
|
|
7
|
-
|
|
6
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
7
|
+
const InnerModuleRoot = styled("div")(({
|
|
8
|
+
theme
|
|
9
|
+
}) => ({
|
|
8
10
|
display: "flex",
|
|
9
11
|
justifyContent: "center",
|
|
10
12
|
alignItems: "center",
|
|
11
13
|
height: "100vh",
|
|
12
14
|
padding: "20px",
|
|
13
|
-
backgroundColor: theme.vars.palette.background.
|
|
15
|
+
backgroundColor: theme.vars.palette.background.neutral,
|
|
14
16
|
[theme.breakpoints.down("md")]: {
|
|
15
17
|
padding: "0px"
|
|
16
18
|
}
|
|
@@ -18,7 +20,7 @@ const InnerModuleRoot = styled("div")(({ theme }) => ({
|
|
|
18
20
|
const DesktopContentRoot = styled$1("div")(({ theme }) => ({
|
|
19
21
|
display: "flex",
|
|
20
22
|
borderRadius: "16px",
|
|
21
|
-
backgroundColor: theme.vars.palette.background.
|
|
23
|
+
backgroundColor: theme.vars.palette.background.surface,
|
|
22
24
|
boxShadow: theme.vars.customShadows?.z4,
|
|
23
25
|
padding: "20px 0 20px 20px",
|
|
24
26
|
width: "100%",
|
|
@@ -49,7 +51,7 @@ const DesktopBanner = styled$1("div")(({ theme }) => ({
|
|
|
49
51
|
width: "100%",
|
|
50
52
|
maxWidth: "400px",
|
|
51
53
|
height: "100%",
|
|
52
|
-
backgroundColor: theme.vars.palette.primary
|
|
54
|
+
backgroundColor: theme.vars.palette.primary.focusActive,
|
|
53
55
|
boxShadow: theme.vars.customShadows?.z4,
|
|
54
56
|
padding: "0 60px",
|
|
55
57
|
gap: "40px",
|
|
@@ -71,7 +73,7 @@ const ContainerLogo$1 = styled$1("div")(({ theme }) => ({
|
|
|
71
73
|
width: "84px",
|
|
72
74
|
height: "84px",
|
|
73
75
|
borderRadius: "6px",
|
|
74
|
-
backgroundColor: theme.vars.palette.primary?.
|
|
76
|
+
backgroundColor: theme.vars.palette.primary?.focusActive,
|
|
75
77
|
justifyContent: "center",
|
|
76
78
|
alignItems: "center",
|
|
77
79
|
boxShadow: `0px 4px 8px ${alpha(theme.colorSchemes.finalTheme.palette.grey["700"] || "", 0.16)}`,
|
|
@@ -120,53 +122,84 @@ styled$1("div")(() => ({
|
|
|
120
122
|
alignItems: "center"
|
|
121
123
|
}));
|
|
122
124
|
const DesktopContent = () => {
|
|
123
|
-
const {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
125
|
+
const {
|
|
126
|
+
children,
|
|
127
|
+
companyLogoSmallUrl
|
|
128
|
+
} = useBase();
|
|
129
|
+
const {
|
|
130
|
+
getLabel
|
|
131
|
+
} = useModuleDictionary();
|
|
132
|
+
const {
|
|
133
|
+
name,
|
|
134
|
+
slogan
|
|
135
|
+
} = useDomain();
|
|
136
|
+
return /* @__PURE__ */ jsxs(DesktopContentRoot, {
|
|
137
|
+
children: [/* @__PURE__ */ jsx(LanguagePopover, {}), /* @__PURE__ */ jsxs(DesktopBanner, {
|
|
138
|
+
children: [/* @__PURE__ */ jsx(ContainerLogo$1, {
|
|
139
|
+
children: /* @__PURE__ */ jsx(Image, {
|
|
140
|
+
src: companyLogoSmallUrl,
|
|
141
|
+
ratio: "1:1",
|
|
142
|
+
width: "64px",
|
|
143
|
+
height: "64px"
|
|
144
|
+
})
|
|
145
|
+
}), /* @__PURE__ */ jsxs(CompanyName$1, {
|
|
146
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
147
|
+
variant: "subtitleDens",
|
|
148
|
+
skeletonWidth: "70%",
|
|
149
|
+
skeletonHeight: "24px",
|
|
150
|
+
children: name
|
|
151
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
152
|
+
variant: "paragraph",
|
|
153
|
+
skeletonWidth: "40%",
|
|
154
|
+
skeletonHeight: "20px",
|
|
155
|
+
children: getLabel("company_name_subtitle")
|
|
156
|
+
})]
|
|
157
|
+
}), /* @__PURE__ */ jsxs(CompanyLeyend, {
|
|
158
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
159
|
+
variant: "h5",
|
|
160
|
+
skeletonWidth: "50%",
|
|
161
|
+
skeletonHeight: "36px",
|
|
162
|
+
children: getLabel("module_leyend")
|
|
163
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
164
|
+
variant: "subtitle",
|
|
165
|
+
skeletonWidth: "80%",
|
|
166
|
+
skeletonHeight: "24px",
|
|
167
|
+
children: slogan
|
|
168
|
+
})]
|
|
169
|
+
})]
|
|
170
|
+
}), /* @__PURE__ */ jsx(WrapperFormContent$1, {
|
|
171
|
+
children: /* @__PURE__ */ jsxs(FormContent$1, {
|
|
172
|
+
children: [/* @__PURE__ */ jsxs(ContainerModuleName$1, {
|
|
173
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
174
|
+
variant: "h5",
|
|
175
|
+
skeletonWidth: "20%",
|
|
176
|
+
skeletonHeight: "36px",
|
|
177
|
+
children: getLabel("module_name")
|
|
178
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
153
179
|
variant: "paragraph",
|
|
154
180
|
skeletonWidth: "40%",
|
|
155
|
-
|
|
181
|
+
skeletonHeight: "20px",
|
|
156
182
|
children: getLabel("module_description")
|
|
157
|
-
}
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
183
|
+
})]
|
|
184
|
+
}), /* @__PURE__ */ jsx(Stack, {
|
|
185
|
+
direction: "column",
|
|
186
|
+
height: "auto",
|
|
187
|
+
children: /* @__PURE__ */ jsx(ScrollBar, {
|
|
188
|
+
children: /* @__PURE__ */ jsx(Fragment, {
|
|
189
|
+
children
|
|
190
|
+
})
|
|
191
|
+
})
|
|
192
|
+
})]
|
|
193
|
+
})
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
163
196
|
};
|
|
164
197
|
const MobileContentRoot = styled$1("div")(({ theme }) => ({
|
|
165
198
|
display: "flex",
|
|
166
199
|
flexDirection: "column",
|
|
167
200
|
width: "100%",
|
|
168
201
|
height: "100%",
|
|
169
|
-
backgroundColor: theme.vars.palette.background.
|
|
202
|
+
backgroundColor: theme.vars.palette.background.surface,
|
|
170
203
|
padding: "12px",
|
|
171
204
|
gap: "32px"
|
|
172
205
|
}));
|
|
@@ -176,7 +209,7 @@ const MobileBanner = styled$1("div")(({ theme }) => ({
|
|
|
176
209
|
padding: "12px",
|
|
177
210
|
gap: "20px",
|
|
178
211
|
width: "100%",
|
|
179
|
-
backgroundColor: theme.vars.palette.primary
|
|
212
|
+
backgroundColor: theme.vars.palette.primary.focusActive,
|
|
180
213
|
boxShadow: theme.customShadows?.z4,
|
|
181
214
|
position: "relative",
|
|
182
215
|
borderRadius: "8px",
|
|
@@ -213,7 +246,7 @@ const ContainerLogo = styled$1("div")(({ theme }) => ({
|
|
|
213
246
|
width: "52px",
|
|
214
247
|
height: "52px",
|
|
215
248
|
borderRadius: "6px",
|
|
216
|
-
backgroundColor: theme.vars.palette.primary?.
|
|
249
|
+
backgroundColor: theme.vars.palette.primary?.focusActive,
|
|
217
250
|
justifyContent: "center",
|
|
218
251
|
alignItems: "center",
|
|
219
252
|
boxShadow: `0px 4px 8px ${alpha(theme.colorSchemes.finalTheme.palette.grey["700"] || "", 0.16)}`,
|
|
@@ -248,48 +281,77 @@ const ContainerModuleName = styled$1("div")(() => ({
|
|
|
248
281
|
gap: "4px"
|
|
249
282
|
}));
|
|
250
283
|
const MobileContent = () => {
|
|
251
|
-
const {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
children
|
|
285
|
-
|
|
286
|
-
|
|
284
|
+
const {
|
|
285
|
+
children,
|
|
286
|
+
companyLogoSmallUrl
|
|
287
|
+
} = useBase();
|
|
288
|
+
const {
|
|
289
|
+
getLabel
|
|
290
|
+
} = useModuleDictionary();
|
|
291
|
+
const {
|
|
292
|
+
name
|
|
293
|
+
} = useDomain();
|
|
294
|
+
return /* @__PURE__ */ jsxs(MobileContentRoot, {
|
|
295
|
+
children: [/* @__PURE__ */ jsxs(MobileBanner, {
|
|
296
|
+
children: [/* @__PURE__ */ jsx(ContainerLogo, {
|
|
297
|
+
children: /* @__PURE__ */ jsx(Image, {
|
|
298
|
+
src: companyLogoSmallUrl,
|
|
299
|
+
ratio: "1:1",
|
|
300
|
+
width: "44px",
|
|
301
|
+
height: "44px"
|
|
302
|
+
})
|
|
303
|
+
}), /* @__PURE__ */ jsxs(CompanyName, {
|
|
304
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
305
|
+
variant: "subtitleDens",
|
|
306
|
+
skeletonWidth: "70%",
|
|
307
|
+
skeletonHeight: "24px",
|
|
308
|
+
children: name
|
|
309
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
310
|
+
variant: "paragraph",
|
|
311
|
+
skeletonWidth: "40%",
|
|
312
|
+
skeletonHeight: "20px",
|
|
313
|
+
children: getLabel("company_name_subtitle")
|
|
314
|
+
})]
|
|
315
|
+
}), /* @__PURE__ */ jsx(LanguagePopover, {})]
|
|
316
|
+
}), /* @__PURE__ */ jsx(WrapperFormContent, {
|
|
317
|
+
children: /* @__PURE__ */ jsx(ScrollBar, {
|
|
318
|
+
children: /* @__PURE__ */ jsxs(FormContent, {
|
|
319
|
+
children: [/* @__PURE__ */ jsxs(ContainerModuleName, {
|
|
320
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
321
|
+
variant: "h5",
|
|
322
|
+
skeletonWidth: "20%",
|
|
323
|
+
skeletonHeight: "36px",
|
|
324
|
+
children: getLabel("module_name")
|
|
325
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
326
|
+
variant: "paragraph",
|
|
327
|
+
skeletonWidth: "40%",
|
|
328
|
+
skeletonHeight: "20px",
|
|
329
|
+
children: getLabel("module_description")
|
|
330
|
+
})]
|
|
331
|
+
}), children]
|
|
332
|
+
})
|
|
333
|
+
})
|
|
334
|
+
})]
|
|
335
|
+
});
|
|
287
336
|
};
|
|
288
337
|
const InnerModule = () => {
|
|
289
|
-
const {
|
|
338
|
+
const {
|
|
339
|
+
getModuleLabel
|
|
340
|
+
} = useModuleDictionary();
|
|
290
341
|
const isDesktop = useResponsiveDesktop();
|
|
291
|
-
const {
|
|
292
|
-
|
|
342
|
+
const {
|
|
343
|
+
subtitle
|
|
344
|
+
} = useBase();
|
|
345
|
+
return /* @__PURE__ */ jsx(HelmetPage, {
|
|
346
|
+
title: getModuleLabel(),
|
|
347
|
+
subtitle,
|
|
348
|
+
children: /* @__PURE__ */ jsx(Fragment, {
|
|
349
|
+
children: /* @__PURE__ */ jsx(InnerModuleRoot, {
|
|
350
|
+
id: "modulerootnouth",
|
|
351
|
+
children: isDesktop ? /* @__PURE__ */ jsx(DesktopContent, {}) : /* @__PURE__ */ jsx(MobileContent, {})
|
|
352
|
+
})
|
|
353
|
+
})
|
|
354
|
+
});
|
|
293
355
|
};
|
|
294
356
|
const NoAuthModuleLayout = (props) => {
|
|
295
357
|
const {
|
|
@@ -305,7 +367,10 @@ const NoAuthModuleLayout = (props) => {
|
|
|
305
367
|
handleSetting,
|
|
306
368
|
observedDivRef
|
|
307
369
|
} = props;
|
|
308
|
-
const {
|
|
370
|
+
const {
|
|
371
|
+
host_static_assets,
|
|
372
|
+
environment_assets
|
|
373
|
+
} = useEnvironment();
|
|
309
374
|
const localeString = useLocales().currentLocale?.localeString;
|
|
310
375
|
const finalCompanyLogoNormalUrl = companyLogoNormalUrl || `${host_static_assets}/${environment_assets}/frontend/commons/assets/icons/logotipo_m4l.svg`;
|
|
311
376
|
const finalCompanyLogoSmallUrl = companyLogoSmallUrl || `${host_static_assets}/${environment_assets}/frontend/commons/assets/icons/isotipo_m4l.svg`;
|
|
@@ -314,30 +379,32 @@ const NoAuthModuleLayout = (props) => {
|
|
|
314
379
|
if (finalSkeletonFlags.findIndex((f) => f === "dictionary_loaded") < 0) {
|
|
315
380
|
finalSkeletonFlags.push("dictionary_loaded");
|
|
316
381
|
}
|
|
317
|
-
return /* @__PURE__ */ jsx(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
382
|
+
return /* @__PURE__ */ jsx(BaseProvider, {
|
|
383
|
+
value: {
|
|
384
|
+
subtitle,
|
|
385
|
+
companyLogoSmallUrl: finalCompanyLogoSmallUrl,
|
|
386
|
+
companyLogoNormalUrl: finalCompanyLogoNormalUrl,
|
|
387
|
+
moduleIlustrationUrl: finalIllustrationUrl,
|
|
388
|
+
children,
|
|
389
|
+
handleSetting
|
|
390
|
+
},
|
|
391
|
+
children: /* @__PURE__ */ jsx(FlagsProvider, {
|
|
392
|
+
children: /* @__PURE__ */ jsx(ModuleDictionaryProvider, {
|
|
393
|
+
isAuth: false,
|
|
394
|
+
moduleId,
|
|
395
|
+
moduleNameField,
|
|
396
|
+
componentsDictionary,
|
|
397
|
+
currentLang: localeString,
|
|
398
|
+
children: /* @__PURE__ */ jsx(ModuleSkeletonProvider, {
|
|
399
|
+
flags: finalSkeletonFlags,
|
|
400
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, {
|
|
401
|
+
observedDivRef,
|
|
402
|
+
children: /* @__PURE__ */ jsx(InnerModule, {})
|
|
403
|
+
})
|
|
404
|
+
})
|
|
405
|
+
})
|
|
406
|
+
})
|
|
407
|
+
});
|
|
341
408
|
};
|
|
342
409
|
function getNoAuthModuleLayoutComponentsDictionary() {
|
|
343
410
|
return ["no_auth_module_layout"];
|
package/m4l_layouts/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/layouts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
6
|
"private": false,
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@mui/material": "5.15.19"
|
|
9
|
-
"@m4l/core": "^2.0.0",
|
|
10
|
-
"@m4l/graphics": "^3.0.0",
|
|
11
|
-
"@m4l/styles": "^3.0.0"
|
|
8
|
+
"@mui/material": "5.15.19"
|
|
12
9
|
},
|
|
13
10
|
"peerDependencies": {
|
|
14
|
-
"@m4l/
|
|
11
|
+
"@m4l/core": "^2.0.0",
|
|
12
|
+
"@m4l/graphics": "^6.0.0",
|
|
13
|
+
"@m4l/styles": "^6.0.0",
|
|
14
|
+
"@m4l/components": "^6.0.0",
|
|
15
15
|
"@types/react": "^17.0.0 || ^18.0.0",
|
|
16
16
|
"@types/react-dom": "^17.0.0 || ^18.0.0",
|
|
17
17
|
"eventemitter3": "^4.0.7",
|
package/vite-env.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
/// <reference types="vitest" />
|
|
3
|
-
/// <reference types="vitest/importMeta" />
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
/// <reference types="vitest/importMeta" />
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { unstable_HistoryRouter } from "react-router-dom";
|
|
3
|
-
import { EnvironmentProvider, HostToolsProvider, NetworkProvider, DomainCountryProvider } from "@m4l/core";
|
|
4
|
-
import { LocalesProvider, HostThemeProvider, ResponsiveContainerProvider, FormatterProvider } from "@m4l/graphics";
|
|
5
|
-
import { BaseModule, WindowToolsMFProvider, DynamicMFParmsProvider, AppearanceComponentProvider } from "@m4l/components";
|
|
6
|
-
import { useTheme } from "@mui/material";
|
|
7
|
-
import { M as MFWindowsTitle } from "../index-JO7pb6aB.js";
|
|
8
|
-
function MFHostApp(props) {
|
|
9
|
-
const {
|
|
10
|
-
children,
|
|
11
|
-
currentLocale,
|
|
12
|
-
hostTheme,
|
|
13
|
-
environment,
|
|
14
|
-
hostTools,
|
|
15
|
-
axiosOperation,
|
|
16
|
-
formatters,
|
|
17
|
-
isAuth = true,
|
|
18
|
-
moduleId,
|
|
19
|
-
moduleNameField,
|
|
20
|
-
skeletonFlags,
|
|
21
|
-
privileges,
|
|
22
|
-
componentsDictionary,
|
|
23
|
-
dynamicMFStore,
|
|
24
|
-
windowTools,
|
|
25
|
-
observedDivRef,
|
|
26
|
-
isAddEditModule = false
|
|
27
|
-
} = props;
|
|
28
|
-
const { generalSettings } = useTheme();
|
|
29
|
-
return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: true, localeHost: currentLocale, children: /* @__PURE__ */ jsx(
|
|
30
|
-
HostThemeProvider,
|
|
31
|
-
{
|
|
32
|
-
isMicroFrontEnd: true,
|
|
33
|
-
...hostTheme,
|
|
34
|
-
isMobile: generalSettings?.isMobile,
|
|
35
|
-
children: /* @__PURE__ */ jsx(ResponsiveContainerProvider, { observedDivRef, children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history: hostTools.history, children: /* @__PURE__ */ jsx(
|
|
36
|
-
DomainCountryProvider,
|
|
37
|
-
{
|
|
38
|
-
isMicroFrontEnd: true,
|
|
39
|
-
id: dynamicMFStore?.getState().dynamicMFParameters?.id || 1,
|
|
40
|
-
currency: formatters.currencyFormatter.code,
|
|
41
|
-
currency_decimal_digits: formatters.currencyFormatter.decimalDigits,
|
|
42
|
-
decimal_symbol: formatters.numberFormatter.decimalSymbol,
|
|
43
|
-
thousands_symbol: formatters.numberFormatter.thousandsSymbol,
|
|
44
|
-
children: /* @__PURE__ */ jsx(
|
|
45
|
-
BaseModule,
|
|
46
|
-
{
|
|
47
|
-
isAuth,
|
|
48
|
-
moduleId,
|
|
49
|
-
moduleNameField,
|
|
50
|
-
componentsDictionary,
|
|
51
|
-
skeletonFlags,
|
|
52
|
-
privileges,
|
|
53
|
-
children: /* @__PURE__ */ jsx(FormatterProvider, { isMicroFrontEnd: true, ...formatters, children: /* @__PURE__ */ jsx(WindowToolsMFProvider, { ...windowTools, children: /* @__PURE__ */ jsx(DynamicMFParmsProvider, { store: dynamicMFStore, children: /* @__PURE__ */ jsx(MFWindowsTitle, { isAddEditModule, children: /* @__PURE__ */ jsx(AppearanceComponentProvider, { children }) }) }) }) })
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
) }) })
|
|
58
|
-
}
|
|
59
|
-
) }) }) }) });
|
|
60
|
-
}
|
|
61
|
-
export {
|
|
62
|
-
MFHostApp as M
|
|
63
|
-
};
|