@m4l/layouts 0.0.19 → 0.0.20
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/dist/layouts/MasterDetailLayout/contexts/MasterDetailContext/types.d.ts +0 -2
- package/dist/layouts/MasterDetailLayout/index.js +6 -13
- package/dist/layouts/MasterDetailLayout/types.d.ts +0 -1
- package/dist/layouts/ModuleLayout/index.js +1 -1
- package/dist/layouts/ModuleLayout/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4,8 +4,6 @@ export interface MasterDetailContextStateProps {
|
|
|
4
4
|
masterSelection?: MasterSelecion;
|
|
5
5
|
}
|
|
6
6
|
export interface MasterDetailProviderProps {
|
|
7
|
-
masterSelection: MasterSelecion;
|
|
8
|
-
setMasterSelection: (newMasterSelecion: MasterSelecion) => void;
|
|
9
7
|
children: ReactNode;
|
|
10
8
|
}
|
|
11
9
|
export interface MasterDetailContextProps extends MasterDetailContextStateProps {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext,
|
|
1
|
+
import { createContext, useState, useRef, useCallback, useMemo } from "react";
|
|
2
2
|
import { voidFunction, useEnvironment } from "@m4l/core";
|
|
3
3
|
import { SplitLayout } from "@m4l/components";
|
|
4
4
|
import { g as getModuleLayoutComponentsDictionary, a as ModuleLayout } from "../ModuleLayout/index.js";
|
|
@@ -24,17 +24,13 @@ const initialState = {
|
|
|
24
24
|
const MasterDetailContext = createContext(initialState);
|
|
25
25
|
function MasterDetailProvider(props) {
|
|
26
26
|
const {
|
|
27
|
-
children
|
|
28
|
-
masterSelection,
|
|
29
|
-
setMasterSelection
|
|
27
|
+
children
|
|
30
28
|
} = props;
|
|
31
|
-
const
|
|
32
|
-
setMasterSelection(newMasterSelection);
|
|
33
|
-
}, [setMasterSelection]);
|
|
29
|
+
const [masterSelection, setMasterSelection] = useState(void 0);
|
|
34
30
|
return /* @__PURE__ */ jsx(MasterDetailContext.Provider, {
|
|
35
31
|
value: {
|
|
36
32
|
masterSelection,
|
|
37
|
-
onChangeMasterSelection
|
|
33
|
+
onChangeMasterSelection: setMasterSelection
|
|
38
34
|
},
|
|
39
35
|
children
|
|
40
36
|
});
|
|
@@ -64,7 +60,7 @@ function MasterDetailLayout(props) {
|
|
|
64
60
|
moduleId,
|
|
65
61
|
moduleNameField,
|
|
66
62
|
detailComponent,
|
|
67
|
-
|
|
63
|
+
moduleActions,
|
|
68
64
|
urlIcon,
|
|
69
65
|
masterComponent,
|
|
70
66
|
componentsDictionary,
|
|
@@ -78,7 +74,6 @@ function MasterDetailLayout(props) {
|
|
|
78
74
|
const [splitPosition, setSplitPosition] = useState("vertical");
|
|
79
75
|
const isDesktop = useResponsiveDesktop();
|
|
80
76
|
const moduleLayoutRef = useRef(null);
|
|
81
|
-
const [masterSelection, setMasterSelection] = useState(void 0);
|
|
82
77
|
const onChangePostionInternal = (newPostion) => {
|
|
83
78
|
const newSplitActions = [...initialSplitActions];
|
|
84
79
|
for (let i = 0; i < newSplitActions.length; i++) {
|
|
@@ -143,14 +138,12 @@ function MasterDetailLayout(props) {
|
|
|
143
138
|
}, [splitActions, moduleActions, isDesktop, viewDetailAction]);
|
|
144
139
|
const finalComponentsDictionary = useMemo(() => componentsDictionary.concat(getMasterDetailLayoutComponentsDictionary()), [componentsDictionary]);
|
|
145
140
|
return /* @__PURE__ */ jsx(MasterDetailProvider, {
|
|
146
|
-
masterSelection,
|
|
147
|
-
setMasterSelection,
|
|
148
141
|
children: /* @__PURE__ */ jsx(ModuleLayout, {
|
|
149
142
|
ref: moduleLayoutRef,
|
|
150
143
|
moduleId,
|
|
151
144
|
moduleNameField,
|
|
152
145
|
urlIcon,
|
|
153
|
-
|
|
146
|
+
moduleActions: finalModuleActions,
|
|
154
147
|
privileges,
|
|
155
148
|
componentsDictionary: finalComponentsDictionary,
|
|
156
149
|
breadcrumbLinks,
|
|
@@ -6,5 +6,4 @@ export interface ContainerProps {
|
|
|
6
6
|
export interface MasterDetailLayoutProps extends Omit<ModuleLayoutProps, 'children'> {
|
|
7
7
|
masterComponent: ((props?: any) => JSX.Element) | ReactNode;
|
|
8
8
|
detailComponent: ((props?: any) => JSX.Element) | ReactNode;
|
|
9
|
-
onChangeSelected?: (row: any[]) => void;
|
|
10
9
|
}
|
|
@@ -21,7 +21,7 @@ export interface ModuleLayoutProps extends HeaderProps {
|
|
|
21
21
|
moduleNameField?: string;
|
|
22
22
|
privileges: string[];
|
|
23
23
|
breadcrumbLinks: TLink[];
|
|
24
|
-
|
|
24
|
+
moduleActions: ModuleAction[];
|
|
25
25
|
componentsDictionary: string[];
|
|
26
26
|
children: ReactNode;
|
|
27
27
|
}
|