@m4l/layouts 0.0.18 → 0.0.21
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 +22 -26
- 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 {
|
|
@@ -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
|
-
};
|
|
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++) {
|
|
@@ -142,23 +137,24 @@ function MasterDetailLayout(props) {
|
|
|
142
137
|
return actions;
|
|
143
138
|
}, [splitActions, moduleActions, isDesktop, viewDetailAction]);
|
|
144
139
|
const finalComponentsDictionary = useMemo(() => componentsDictionary.concat(getMasterDetailLayoutComponentsDictionary()), [componentsDictionary]);
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
140
|
+
const memonizedSplit = useMemo(() => {
|
|
141
|
+
return /* @__PURE__ */ jsx(SplitLayout, {
|
|
142
|
+
splitPosition: isDesktop ? splitPosition : "none",
|
|
143
|
+
firstPart: masterComponent,
|
|
144
|
+
secondPart: detailComponent
|
|
145
|
+
});
|
|
146
|
+
}, [isDesktop, splitPosition, masterComponent, detailComponent]);
|
|
147
|
+
return /* @__PURE__ */ jsx(ModuleLayout, {
|
|
148
|
+
ref: moduleLayoutRef,
|
|
149
|
+
moduleId,
|
|
150
|
+
moduleNameField,
|
|
151
|
+
urlIcon,
|
|
152
|
+
moduleActions: finalModuleActions,
|
|
153
|
+
privileges,
|
|
154
|
+
componentsDictionary: finalComponentsDictionary,
|
|
155
|
+
breadcrumbLinks,
|
|
156
|
+
children: /* @__PURE__ */ jsx(MasterDetailProvider, {
|
|
157
|
+
children: memonizedSplit
|
|
162
158
|
})
|
|
163
159
|
});
|
|
164
160
|
}
|
|
@@ -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
|
}
|