@m4l/layouts 0.1.39 → 0.1.40
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/useAuth/index.cb6a3420.js +7 -7
- package/hooks/useMasterDetail/index.927c0c26.js +4 -4
- package/hooks/useModule/index.edcd7b28.js +7 -7
- package/index.js +27 -27
- package/layouts/MasterDetailLayout/index.bca0fce5.js +96 -78
- package/layouts/ModuleLayout/index.850f7dcf.js +79 -64
- package/layouts/NoAuthModuleLayout/index.eabf38c1.js +179 -146
- package/package.json +2 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useModal
|
|
2
|
-
import { forwardRef
|
|
3
|
-
import { styled
|
|
4
|
-
import { jsx
|
|
5
|
-
const
|
|
1
|
+
import { useModal, useWindowToolsMF, ModalProvider, getModalDialogComponentsDictionary } from "@m4l/components";
|
|
2
|
+
import { forwardRef, useRef, useImperativeHandle, createContext, useState, useMemo, useEffect } from "react";
|
|
3
|
+
import { styled } from "@mui/material/styles";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
const WrapperInnerModule = styled("div")(() => ({
|
|
6
6
|
display: "flex",
|
|
7
7
|
flexDirection: "column",
|
|
8
8
|
position: "absolute",
|
|
@@ -12,92 +12,107 @@ const D = M("div")(() => ({
|
|
|
12
12
|
top: "0px",
|
|
13
13
|
bottom: "0px",
|
|
14
14
|
overflow: "hidden"
|
|
15
|
-
}))
|
|
16
|
-
|
|
15
|
+
}));
|
|
16
|
+
const ModuleContent = styled("div")(({
|
|
17
|
+
theme
|
|
17
18
|
}) => ({
|
|
18
19
|
display: "flex",
|
|
19
20
|
position: "relative",
|
|
20
|
-
marginTop:
|
|
21
|
+
marginTop: theme.spacing(1),
|
|
21
22
|
justifyContent: "center",
|
|
22
23
|
flexGrow: "1",
|
|
23
24
|
overflow: "hidden"
|
|
24
|
-
}))
|
|
25
|
+
}));
|
|
26
|
+
const InnerModule = forwardRef((props, ref) => {
|
|
25
27
|
const {
|
|
26
|
-
children
|
|
27
|
-
} =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
children
|
|
29
|
+
} = props;
|
|
30
|
+
const {
|
|
31
|
+
openModal
|
|
32
|
+
} = useModal();
|
|
33
|
+
const divRef = useRef(null);
|
|
34
|
+
useImperativeHandle(ref, () => ({
|
|
35
|
+
openModal,
|
|
36
|
+
current: divRef.current
|
|
37
|
+
}));
|
|
38
|
+
return /* @__PURE__ */ jsx(WrapperInnerModule, {
|
|
34
39
|
id: "WrapperInnerModule",
|
|
35
40
|
className: "m4l_module_layout",
|
|
36
|
-
ref:
|
|
37
|
-
children: /* @__PURE__ */
|
|
41
|
+
ref: divRef,
|
|
42
|
+
children: /* @__PURE__ */ jsx(ModuleContent, {
|
|
38
43
|
id: "ModuleContent",
|
|
39
|
-
children
|
|
44
|
+
children
|
|
40
45
|
})
|
|
41
46
|
});
|
|
42
47
|
});
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
function
|
|
48
|
+
InnerModule.displayName = "InnerModule";
|
|
49
|
+
const ModuleContext = createContext(null);
|
|
50
|
+
function ModuleProvider(props) {
|
|
46
51
|
const {
|
|
47
|
-
children
|
|
48
|
-
moduleActions
|
|
49
|
-
moduleId
|
|
50
|
-
version
|
|
51
|
-
} =
|
|
52
|
-
|
|
52
|
+
children,
|
|
53
|
+
moduleActions,
|
|
54
|
+
moduleId,
|
|
55
|
+
version
|
|
56
|
+
} = props;
|
|
57
|
+
const [configOptions] = useState(() => ({
|
|
58
|
+
moduleId,
|
|
53
59
|
dictionary: void 0
|
|
54
|
-
}))
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
}));
|
|
61
|
+
const {
|
|
62
|
+
setActions
|
|
63
|
+
} = useWindowToolsMF();
|
|
64
|
+
const [dynamicActions, setDynamicActions] = useState([]);
|
|
65
|
+
const finalModuleActions = useMemo(() => {
|
|
66
|
+
return (moduleActions || []).concat(dynamicActions);
|
|
67
|
+
}, [moduleActions, dynamicActions]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
setActions(finalModuleActions, version);
|
|
70
|
+
}, [finalModuleActions]);
|
|
71
|
+
return /* @__PURE__ */ jsx(ModuleContext.Provider, {
|
|
60
72
|
value: {
|
|
61
|
-
setDynamicActions
|
|
62
|
-
moduleId:
|
|
73
|
+
setDynamicActions,
|
|
74
|
+
moduleId: configOptions.moduleId
|
|
63
75
|
},
|
|
64
|
-
children
|
|
76
|
+
children
|
|
65
77
|
});
|
|
66
78
|
}
|
|
67
|
-
const
|
|
79
|
+
const ModuleLayout = forwardRef((props, ref) => {
|
|
68
80
|
const {
|
|
69
|
-
moduleId
|
|
70
|
-
moduleActions
|
|
71
|
-
version
|
|
72
|
-
children
|
|
73
|
-
} =
|
|
74
|
-
|
|
81
|
+
moduleId,
|
|
82
|
+
moduleActions,
|
|
83
|
+
version,
|
|
84
|
+
children
|
|
85
|
+
} = props;
|
|
86
|
+
const moduleRef = useRef(null);
|
|
87
|
+
const openModal = (modalOpenProps) => {
|
|
88
|
+
moduleRef.current?.openModal(modalOpenProps);
|
|
75
89
|
};
|
|
76
|
-
|
|
77
|
-
openModal
|
|
78
|
-
current:
|
|
79
|
-
}))
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
useImperativeHandle(ref, () => ({
|
|
91
|
+
openModal,
|
|
92
|
+
current: moduleRef.current
|
|
93
|
+
}));
|
|
94
|
+
return /* @__PURE__ */ jsx(ModuleProvider, {
|
|
95
|
+
moduleId,
|
|
96
|
+
moduleActions,
|
|
97
|
+
version,
|
|
98
|
+
children: /* @__PURE__ */ jsx(ModalProvider, {
|
|
99
|
+
children: /* @__PURE__ */ jsx(InnerModule, {
|
|
100
|
+
ref: moduleRef,
|
|
101
|
+
children
|
|
87
102
|
})
|
|
88
103
|
})
|
|
89
104
|
});
|
|
90
105
|
});
|
|
91
|
-
|
|
92
|
-
function
|
|
93
|
-
return ["module_layout"].concat(
|
|
106
|
+
ModuleLayout.displayName = "ModuleLayout";
|
|
107
|
+
function getModuleLayoutComponentsDictionary() {
|
|
108
|
+
return ["module_layout"].concat(getModalDialogComponentsDictionary());
|
|
94
109
|
}
|
|
95
|
-
const
|
|
110
|
+
const defaultModuleLayoutDictionary = {
|
|
96
111
|
module_layout: {}
|
|
97
112
|
};
|
|
98
113
|
export {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
114
|
+
ModuleContext as M,
|
|
115
|
+
ModuleLayout as a,
|
|
116
|
+
defaultModuleLayoutDictionary as d,
|
|
117
|
+
getModuleLayoutComponentsDictionary as g
|
|
103
118
|
};
|