@m4l/layouts 0.1.39 → 0.1.41
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/BaseModule/index.6309486a.js +24 -24
- package/components/MFHostApp/index.420c2626.js +58 -58
- package/components/MFIsolationApp/index.e36cf308.js +137 -117
- package/contexts/AuthContext/index.6f966215.js +118 -88
- package/hooks/index.33191825.js +4 -0
- package/hooks/useAuth/index.cb6a3420.js +7 -7
- package/hooks/useMasterDetail/index.be4908d9.js +6 -0
- package/hooks/useModule/index.b5f598b1.js +11 -0
- package/index.js +29 -27
- package/layouts/MasterDetailLayout/classes/constants.d.ts +1 -0
- package/layouts/MasterDetailLayout/classes/index.d.ts +6 -0
- package/layouts/MasterDetailLayout/classes/types.d.ts +6 -0
- package/layouts/MasterDetailLayout/index.fe6ac47b.js +163 -0
- package/layouts/MasterDetailLayout/styles.d.ts +2 -0
- package/layouts/ModuleLayout/classes/constants.d.ts +1 -0
- package/layouts/ModuleLayout/classes/index.d.ts +7 -0
- package/layouts/ModuleLayout/classes/types.d.ts +7 -0
- package/layouts/ModuleLayout/index.e7218171.js +122 -0
- package/layouts/ModuleLayout/subcomponents/InnerModule/styles.d.ts +1 -2
- package/layouts/NoAuthModuleLayout/index.2808fa44.js +379 -0
- package/layouts/index.96a3745e.js +8 -0
- package/layouts/index.d.ts +2 -2
- package/package.json +2 -1
- package/hooks/index.a0c767ed.js +0 -4
- package/hooks/useMasterDetail/index.927c0c26.js +0 -6
- package/hooks/useModule/index.edcd7b28.js +0 -11
- package/layouts/MasterDetailLayout/index.bca0fce5.js +0 -118
- package/layouts/ModuleLayout/index.850f7dcf.js +0 -103
- package/layouts/NoAuthModuleLayout/index.eabf38c1.js +0 -345
- package/layouts/index.07aacf57.js +0 -8
- /package/layouts/MasterDetailLayout/{index.d.ts → MasterDetailLayout.d.ts} +0 -0
- /package/layouts/ModuleLayout/{index.d.ts → ModuleLayout.d.ts} +0 -0
|
@@ -1,130 +1,160 @@
|
|
|
1
|
-
import { createContext
|
|
2
|
-
import { useHostTools
|
|
3
|
-
import { jsx
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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,
|
|
8
13
|
user: null
|
|
9
|
-
}
|
|
10
|
-
|
|
14
|
+
};
|
|
15
|
+
const JWTReducer = (state, action) => {
|
|
16
|
+
switch (action.type) {
|
|
11
17
|
case "INITIALIZE":
|
|
12
18
|
return {
|
|
13
|
-
isAuthenticated:
|
|
14
|
-
isInitialized:
|
|
15
|
-
user:
|
|
19
|
+
isAuthenticated: action.payload.isAuthenticated,
|
|
20
|
+
isInitialized: true,
|
|
21
|
+
user: action.payload.user
|
|
16
22
|
};
|
|
17
23
|
case "LOGIN":
|
|
18
24
|
return {
|
|
19
|
-
...
|
|
20
|
-
isAuthenticated:
|
|
21
|
-
user:
|
|
25
|
+
...state,
|
|
26
|
+
isAuthenticated: true,
|
|
27
|
+
user: action.payload.user
|
|
22
28
|
};
|
|
23
29
|
case "LOGOUT":
|
|
24
30
|
return {
|
|
25
|
-
...
|
|
26
|
-
isAuthenticated:
|
|
31
|
+
...state,
|
|
32
|
+
isAuthenticated: false,
|
|
27
33
|
user: null
|
|
28
34
|
};
|
|
29
35
|
default:
|
|
30
|
-
return
|
|
36
|
+
return state;
|
|
31
37
|
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
};
|
|
39
|
+
const AuthContext = createContext(null);
|
|
40
|
+
function dispatchInitial(dispatch) {
|
|
41
|
+
dispatch({
|
|
42
|
+
type: EnumTypes.Initial,
|
|
36
43
|
payload: {
|
|
37
|
-
isAuthenticated:
|
|
44
|
+
isAuthenticated: false,
|
|
38
45
|
user: null
|
|
39
46
|
}
|
|
40
47
|
});
|
|
41
48
|
}
|
|
42
|
-
function
|
|
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();
|
|
43
57
|
const {
|
|
44
|
-
|
|
45
|
-
} =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
domain_token: m
|
|
51
|
-
} = v(), [f, l] = N(
|
|
58
|
+
networkOperation
|
|
59
|
+
} = useNetwork();
|
|
60
|
+
const {
|
|
61
|
+
domain_token
|
|
62
|
+
} = useEnvironment();
|
|
63
|
+
const [nextValSession, setNextValSession] = useLocalStorageWithListener(
|
|
52
64
|
"vSession",
|
|
53
65
|
new Date().getTime() + ""
|
|
54
66
|
);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const initialize = async () => {
|
|
69
|
+
networkOperation({
|
|
58
70
|
method: "GET",
|
|
59
|
-
endPoint:
|
|
71
|
+
endPoint: `auth/login`,
|
|
60
72
|
parms: {
|
|
61
|
-
user_data:
|
|
73
|
+
user_data: true
|
|
62
74
|
},
|
|
63
|
-
checkUnAuthorized:
|
|
64
|
-
}).then((
|
|
65
|
-
|
|
66
|
-
type:
|
|
75
|
+
checkUnAuthorized: false
|
|
76
|
+
}).then((response) => {
|
|
77
|
+
dispatch({
|
|
78
|
+
type: EnumTypes.Initial,
|
|
67
79
|
payload: {
|
|
68
|
-
isAuthenticated:
|
|
69
|
-
user:
|
|
80
|
+
isAuthenticated: true,
|
|
81
|
+
user: response.user
|
|
70
82
|
}
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
});
|
|
84
|
+
const useSaved = getLocalStorage("userData", {
|
|
85
|
+
email: response.user.email,
|
|
86
|
+
remember: true
|
|
87
|
+
});
|
|
88
|
+
if (useSaved?.email !== response.user.email) {
|
|
89
|
+
setLocalStorage("userData", {
|
|
90
|
+
email: response.user.email
|
|
91
|
+
}, true);
|
|
92
|
+
}
|
|
77
93
|
}).catch(() => {
|
|
78
|
-
|
|
94
|
+
dispatchInitial(dispatch);
|
|
79
95
|
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
};
|
|
97
|
+
initialize();
|
|
98
|
+
}, [nextValSession]);
|
|
99
|
+
const login = async (email, password, remember) => {
|
|
100
|
+
await networkOperation({
|
|
101
|
+
endPoint: `auth/login`,
|
|
85
102
|
method: "POST",
|
|
86
103
|
data: {
|
|
87
|
-
email
|
|
88
|
-
password
|
|
89
|
-
domain_token
|
|
104
|
+
email,
|
|
105
|
+
password,
|
|
106
|
+
domain_token
|
|
107
|
+
}
|
|
108
|
+
}).then((response) => {
|
|
109
|
+
const user = response.data;
|
|
110
|
+
if (remember) {
|
|
111
|
+
setLocalStorage("userData", {
|
|
112
|
+
email,
|
|
113
|
+
remember
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
setLocalStorage("userData", {
|
|
117
|
+
email: "",
|
|
118
|
+
remember
|
|
119
|
+
});
|
|
90
120
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
o ? r("userData", {
|
|
94
|
-
email: i,
|
|
95
|
-
remember: o
|
|
96
|
-
}) : r("userData", {
|
|
97
|
-
email: "",
|
|
98
|
-
remember: o
|
|
99
|
-
}), s({
|
|
100
|
-
type: n.Login,
|
|
121
|
+
dispatch({
|
|
122
|
+
type: EnumTypes.Login,
|
|
101
123
|
payload: {
|
|
102
|
-
user
|
|
124
|
+
user
|
|
103
125
|
}
|
|
104
|
-
})
|
|
126
|
+
});
|
|
127
|
+
setNextValSession(new Date().getTime() + "");
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const logout = async (isAuthenticated) => {
|
|
131
|
+
if (isAuthenticated) {
|
|
132
|
+
await networkOperation({
|
|
133
|
+
endPoint: `auth/logout`,
|
|
134
|
+
method: "POST"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
dispatch({
|
|
138
|
+
type: EnumTypes.Logout
|
|
105
139
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}), s({
|
|
111
|
-
type: n.Logout
|
|
112
|
-
}), l(new Date().getTime() + "");
|
|
113
|
-
}, p = () => {
|
|
114
|
-
c(!1);
|
|
140
|
+
setNextValSession(new Date().getTime() + "");
|
|
141
|
+
};
|
|
142
|
+
const onNetserviceUnautorized = () => {
|
|
143
|
+
logout(false);
|
|
115
144
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}, [])
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
events_add_listener(EmitEvents.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, onNetserviceUnautorized);
|
|
147
|
+
}, []);
|
|
148
|
+
return /* @__PURE__ */ jsx(AuthContext.Provider, {
|
|
119
149
|
value: {
|
|
120
|
-
...
|
|
121
|
-
login
|
|
122
|
-
logout
|
|
150
|
+
...state,
|
|
151
|
+
login,
|
|
152
|
+
logout
|
|
123
153
|
},
|
|
124
|
-
children
|
|
154
|
+
children
|
|
125
155
|
});
|
|
126
156
|
}
|
|
127
157
|
export {
|
|
128
|
-
|
|
129
|
-
|
|
158
|
+
AuthProvider as A,
|
|
159
|
+
AuthContext as a
|
|
130
160
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useContext
|
|
2
|
-
import { a as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
if (!
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { a as AuthContext } from "../../contexts/AuthContext/index.6f966215.js";
|
|
3
|
+
const useAuth = () => {
|
|
4
|
+
const context = useContext(AuthContext);
|
|
5
|
+
if (!context)
|
|
6
6
|
throw new Error("Auth context must be use inside AuthProvider");
|
|
7
|
-
return
|
|
7
|
+
return context;
|
|
8
8
|
};
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
useAuth as u
|
|
11
11
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from "react";
|
|
2
|
+
import { M as ModuleContext } from "../../layouts/ModuleLayout/index.e7218171.js";
|
|
3
|
+
const useModule = () => {
|
|
4
|
+
const context = useContext(ModuleContext);
|
|
5
|
+
if (!context)
|
|
6
|
+
throw new Error("useModule context must be use inside ModuleContext");
|
|
7
|
+
return context;
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
useModule as u
|
|
11
|
+
};
|
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { M
|
|
2
|
-
import { M as
|
|
3
|
-
import { B
|
|
4
|
-
import { a
|
|
5
|
-
import { a as
|
|
6
|
-
import { a as
|
|
7
|
-
import { N
|
|
8
|
-
import { u
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as
|
|
1
|
+
import { M } from "./components/MFIsolationApp/index.e36cf308.js";
|
|
2
|
+
import { M as M2 } from "./components/MFHostApp/index.420c2626.js";
|
|
3
|
+
import { B } from "./components/BaseModule/index.6309486a.js";
|
|
4
|
+
import { a, A } from "./contexts/AuthContext/index.6f966215.js";
|
|
5
|
+
import { a as a2, d, g } from "./layouts/ModuleLayout/index.e7218171.js";
|
|
6
|
+
import { a as a3, d as d2, g as g2 } from "./layouts/MasterDetailLayout/index.fe6ac47b.js";
|
|
7
|
+
import { N, d as d3, g as g3 } from "./layouts/NoAuthModuleLayout/index.2808fa44.js";
|
|
8
|
+
import { u } from "./hooks/useMasterDetail/index.be4908d9.js";
|
|
9
|
+
import { u as u2 } from "./hooks/useAuth/index.cb6a3420.js";
|
|
10
|
+
import { u as u3 } from "./hooks/useModule/index.b5f598b1.js";
|
|
11
11
|
import "react";
|
|
12
12
|
import "react-router-dom";
|
|
13
13
|
import "react-toastify";
|
|
@@ -21,22 +21,24 @@ import "react/jsx-runtime";
|
|
|
21
21
|
import "nprogress";
|
|
22
22
|
import "@m4l/components";
|
|
23
23
|
import "@mui/material/styles";
|
|
24
|
+
import "@mui/material";
|
|
25
|
+
import "@mui/base";
|
|
24
26
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
a as AuthContext,
|
|
28
|
+
A as AuthProvider,
|
|
29
|
+
B as BaseModule,
|
|
30
|
+
M2 as MFHostApp,
|
|
31
|
+
M as MFIsolationApp,
|
|
32
|
+
a3 as MasterDetailLayout,
|
|
33
|
+
a2 as ModuleLayout,
|
|
34
|
+
N as NoAuthModuleLayout,
|
|
35
|
+
d2 as defaultMasterDetailDictionary,
|
|
36
|
+
d as defaultModuleLayoutDictionary,
|
|
37
|
+
d3 as defaultNoAuthModuleLayoutDictionary,
|
|
38
|
+
g2 as getMasterDetailLayoutComponentsDictionary,
|
|
39
|
+
g as getModuleLayoutComponentsDictionary,
|
|
40
|
+
g3 as getNoAuthModuleLayoutComponentsDictionary,
|
|
41
|
+
u2 as useAuth,
|
|
42
|
+
u as useMasterDetail,
|
|
43
|
+
u3 as useModule
|
|
42
44
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const componentName = "M4LMasterDetailLayout";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MasterDetailLayoutClassesType } from './types';
|
|
2
|
+
export declare const masterDetailLayoutClasses: MasterDetailLayoutClassesType;
|
|
3
|
+
export declare function getMasterDetailLayoutUtilityClass(slot: string): string;
|
|
4
|
+
export declare const useMasterDetailLayoutUtilityClasses: () => {
|
|
5
|
+
root: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useMasterDetailLayoutUtilityClasses } from ".";
|
|
2
|
+
export interface MasterDetailLayoutClassesType {
|
|
3
|
+
root: string;
|
|
4
|
+
}
|
|
5
|
+
export declare type MasterDetailLayoutClassesKey = keyof MasterDetailLayoutClassesType;
|
|
6
|
+
export declare type Classes = ReturnType<typeof useMasterDetailLayoutUtilityClasses>;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { createContext, useState, useRef, useMemo, useCallback } from "react";
|
|
2
|
+
import { voidFunction, useEnvironment, useModuleDictionary } from "@m4l/core";
|
|
3
|
+
import { WindowBase, SplitLayout } from "@m4l/components";
|
|
4
|
+
import { a as ModuleLayout, g as getModuleLayoutComponentsDictionary } from "../ModuleLayout/index.e7218171.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
7
|
+
import { generateUtilityClasses, generateUtilityClass, styled } from "@mui/material";
|
|
8
|
+
import { unstable_composeClasses } from "@mui/base";
|
|
9
|
+
const initialState = {
|
|
10
|
+
masterSelection: void 0,
|
|
11
|
+
onChangeMasterSelection: voidFunction
|
|
12
|
+
};
|
|
13
|
+
const MasterDetailContext = createContext(initialState);
|
|
14
|
+
function MasterDetailProvider(props) {
|
|
15
|
+
const {
|
|
16
|
+
children
|
|
17
|
+
} = props;
|
|
18
|
+
const [masterSelection, setMasterSelection] = useState(void 0);
|
|
19
|
+
return /* @__PURE__ */ jsx(MasterDetailContext.Provider, {
|
|
20
|
+
value: {
|
|
21
|
+
masterSelection,
|
|
22
|
+
onChangeMasterSelection: setMasterSelection
|
|
23
|
+
},
|
|
24
|
+
children
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
const componentName = "M4LMasterDetailLayout";
|
|
28
|
+
generateUtilityClasses(componentName, [
|
|
29
|
+
"root"
|
|
30
|
+
]);
|
|
31
|
+
function getMasterDetailLayoutUtilityClass(slot) {
|
|
32
|
+
return generateUtilityClass(componentName, slot);
|
|
33
|
+
}
|
|
34
|
+
const useMasterDetailLayoutUtilityClasses = () => {
|
|
35
|
+
const slots = {
|
|
36
|
+
root: ["root"]
|
|
37
|
+
};
|
|
38
|
+
const composedClasses = unstable_composeClasses(slots, getMasterDetailLayoutUtilityClass, {});
|
|
39
|
+
return {
|
|
40
|
+
...composedClasses
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const MasterDetailLayoutRoot = styled("div")(({ theme }) => ({
|
|
44
|
+
...theme.components?.M4LMasterDetailLayout?.styleOverrides
|
|
45
|
+
}));
|
|
46
|
+
function getTotalModuleActions(splitActions, moduleActions = [], viewDetailAction, isDesktop) {
|
|
47
|
+
let totalActions = isDesktop !== void 0 && isDesktop ? [...splitActions] : [viewDetailAction];
|
|
48
|
+
totalActions = moduleActions.concat(totalActions);
|
|
49
|
+
return totalActions;
|
|
50
|
+
}
|
|
51
|
+
function MasterDetailLayout(props) {
|
|
52
|
+
const {
|
|
53
|
+
moduleId,
|
|
54
|
+
masterComponent,
|
|
55
|
+
detailComponent,
|
|
56
|
+
moduleActions,
|
|
57
|
+
version
|
|
58
|
+
} = props;
|
|
59
|
+
const {
|
|
60
|
+
host_static_assets,
|
|
61
|
+
environment_assets
|
|
62
|
+
} = useEnvironment();
|
|
63
|
+
const [splitPosition, setSplitPosition] = useState("vertical");
|
|
64
|
+
const isDesktop = useResponsiveDesktop();
|
|
65
|
+
const moduleLayoutRef = useRef(null);
|
|
66
|
+
const {
|
|
67
|
+
getLabel
|
|
68
|
+
} = useModuleDictionary();
|
|
69
|
+
const splitActions = useMemo(() => [{
|
|
70
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/masterdetaillayout/assets/icons/split_vertical.svg`,
|
|
71
|
+
onClick: () => onChangePostionInternal("vertical"),
|
|
72
|
+
visibility: "main",
|
|
73
|
+
label: getLabel("master_detail_layout.split_vertical"),
|
|
74
|
+
tag: "vertical",
|
|
75
|
+
className: "splitactions",
|
|
76
|
+
disabled: splitPosition === "vertical",
|
|
77
|
+
key: "vertical"
|
|
78
|
+
}, {
|
|
79
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/masterdetaillayout/assets/icons/split_horizontal.svg`,
|
|
80
|
+
onClick: () => onChangePostionInternal("horizontal"),
|
|
81
|
+
visibility: "main",
|
|
82
|
+
label: getLabel("master_detail_layout.split_horizontal"),
|
|
83
|
+
tag: "horizontal",
|
|
84
|
+
className: "splitactions",
|
|
85
|
+
disabled: splitPosition === "horizontal",
|
|
86
|
+
key: "horizontal"
|
|
87
|
+
}, {
|
|
88
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/masterdetaillayout/assets/icons/no_split.svg`,
|
|
89
|
+
onClick: () => onChangePostionInternal("none"),
|
|
90
|
+
visibility: "main",
|
|
91
|
+
label: getLabel("master_detail_layout.no_split"),
|
|
92
|
+
tag: "none",
|
|
93
|
+
className: "splitactions",
|
|
94
|
+
disabled: splitPosition === "none",
|
|
95
|
+
key: "none"
|
|
96
|
+
}], [getLabel, splitPosition]);
|
|
97
|
+
const onChangePostionInternal = useCallback((newPostion) => {
|
|
98
|
+
setSplitPosition(newPostion);
|
|
99
|
+
}, []);
|
|
100
|
+
const onClickViewDetail = useCallback(() => {
|
|
101
|
+
moduleLayoutRef.current?.openModal({
|
|
102
|
+
initialWidth: 500,
|
|
103
|
+
initialHeigth: 680,
|
|
104
|
+
window: /* @__PURE__ */ jsx(
|
|
105
|
+
WindowBase,
|
|
106
|
+
{
|
|
107
|
+
title: getLabel("master_detail_layout.view_detail"),
|
|
108
|
+
children: typeof detailComponent === "function" ? detailComponent({}) : detailComponent
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
});
|
|
112
|
+
}, [detailComponent, getLabel]);
|
|
113
|
+
const viewDetailAction = useMemo(() => {
|
|
114
|
+
return {
|
|
115
|
+
urlIcon: `${host_static_assets}/${environment_assets}/frontend/components/masterdetaillayout/assets/icons/view_detail.svg`,
|
|
116
|
+
onClick: onClickViewDetail,
|
|
117
|
+
disabled: false,
|
|
118
|
+
visibility: "allways",
|
|
119
|
+
label: getLabel("master_detail_layout.view_detail"),
|
|
120
|
+
tag: "none",
|
|
121
|
+
className: "",
|
|
122
|
+
key: "detail"
|
|
123
|
+
};
|
|
124
|
+
}, [environment_assets, onClickViewDetail]);
|
|
125
|
+
const finalModuleActions = useMemo(() => {
|
|
126
|
+
const actions = getTotalModuleActions(splitActions, moduleActions, viewDetailAction, isDesktop);
|
|
127
|
+
return actions;
|
|
128
|
+
}, [splitActions, moduleActions, isDesktop, viewDetailAction]);
|
|
129
|
+
const classes = useMasterDetailLayoutUtilityClasses();
|
|
130
|
+
return /* @__PURE__ */ jsx(MasterDetailProvider, {
|
|
131
|
+
children: /* @__PURE__ */ jsx(MasterDetailLayoutRoot, {
|
|
132
|
+
className: classes.root,
|
|
133
|
+
children: /* @__PURE__ */ jsx(ModuleLayout, {
|
|
134
|
+
ref: moduleLayoutRef,
|
|
135
|
+
moduleId,
|
|
136
|
+
moduleActions: finalModuleActions,
|
|
137
|
+
version,
|
|
138
|
+
children: /* @__PURE__ */ jsx(SplitLayout, {
|
|
139
|
+
splitPosition: isDesktop ? splitPosition : "none",
|
|
140
|
+
firstPart: masterComponent,
|
|
141
|
+
secondPart: detailComponent
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function getMasterDetailLayoutComponentsDictionary() {
|
|
148
|
+
return ["master_detail_layout"].concat(getModuleLayoutComponentsDictionary());
|
|
149
|
+
}
|
|
150
|
+
const defaultMasterDetailDictionary = {
|
|
151
|
+
master_detail_layout: {
|
|
152
|
+
split_vertical: "Split vertically",
|
|
153
|
+
split_horizontal: "Split horizontally",
|
|
154
|
+
no_split: "No split",
|
|
155
|
+
view_detail: "View detail"
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
export {
|
|
159
|
+
MasterDetailContext as M,
|
|
160
|
+
MasterDetailLayout as a,
|
|
161
|
+
defaultMasterDetailDictionary as d,
|
|
162
|
+
getMasterDetailLayoutComponentsDictionary as g
|
|
163
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const MasterDetailLayoutRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const componentName = "M4LModuleLayout";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ModuleLayoutClassesType } from './types';
|
|
2
|
+
export declare const moduleLayoutClasses: ModuleLayoutClassesType;
|
|
3
|
+
export declare function getModuleLayoutUtilityClass(slot: string): string;
|
|
4
|
+
export declare const useModuleLayoutUtilityClasses: () => {
|
|
5
|
+
root: string;
|
|
6
|
+
moduleContent: string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useModuleLayoutUtilityClasses } from ".";
|
|
2
|
+
export interface ModuleLayoutClassesType {
|
|
3
|
+
root: string;
|
|
4
|
+
moduleContent: string;
|
|
5
|
+
}
|
|
6
|
+
export declare type ModuleLayoutClassesKey = keyof ModuleLayoutClassesType;
|
|
7
|
+
export declare type Classes = ReturnType<typeof useModuleLayoutUtilityClasses>;
|