49 lines
1.0 KiB
TypeScript
Executable File
49 lines
1.0 KiB
TypeScript
Executable File
import { MDLocal, MDProps, MDRef } from "./typings";
|
||
|
||
export const editorMDInit = (md: MDLocal, mdr: MDRef, arg: MDProps) => {
|
||
const {
|
||
mode,
|
||
show_head,
|
||
tab_mode,
|
||
editor_tab,
|
||
gen_fields,
|
||
gen_table,
|
||
on_init,
|
||
} = arg;
|
||
md.props.mode = mode;
|
||
md.props.show_head = show_head;
|
||
md.props.tab_mode = tab_mode;
|
||
md.props.editor_tab = editor_tab;
|
||
md.props.gen_fields = gen_fields;
|
||
md.props.gen_table = gen_table;
|
||
md.props.on_init = on_init;
|
||
|
||
if (
|
||
!mdr.master ||
|
||
(mdr.master && mdr.master.edit.childs[0].childs.length === 0)
|
||
) {
|
||
md.breadcrumb = [
|
||
{
|
||
label: (
|
||
<>
|
||
⚠️ Master Detail is not ready
|
||
<br />
|
||
<div
|
||
className={css`
|
||
font-size: 12px;
|
||
font-weight: normal;
|
||
`}
|
||
>
|
||
Please generate master detail props first
|
||
</div>
|
||
</>
|
||
),
|
||
},
|
||
];
|
||
md.status = "unready";
|
||
} else {
|
||
md.breadcrumb = [];
|
||
md.status = "ready";
|
||
}
|
||
};
|