fix header
This commit is contained in:
parent
b1e40bf2ed
commit
01e65b4858
|
|
@ -7,6 +7,7 @@ import { formError } from "./error";
|
|||
import { toast } from "lib/comps/ui/toast";
|
||||
import { Button } from "lib/comps/ui/button";
|
||||
import { MDLocal } from "lib/comps/md/utils/typings";
|
||||
import { masterDetailApplyParams } from "lib/comps/md/utils/md-hash";
|
||||
|
||||
export const formInit = (fm: FMLocal, props: FMProps) => {
|
||||
for (const [k, v] of Object.entries(props)) {
|
||||
|
|
@ -57,6 +58,7 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
|
|||
size={"xs"}
|
||||
className="c-cursor-pointer"
|
||||
onClick={() => {
|
||||
const md = fm.deps.md as MDLocal;
|
||||
toast.dismiss();
|
||||
md.selected = null;
|
||||
md.tab.active = "master";
|
||||
|
|
@ -74,14 +76,14 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
|
|||
size={"xs"}
|
||||
className="c-cursor-pointer"
|
||||
onClick={() => {
|
||||
const md = fm.deps.md as MDLocal;
|
||||
toast.dismiss();
|
||||
for (const k of Object.keys(md.selected)) {
|
||||
delete md.selected[k];
|
||||
}
|
||||
md.tab.active = "detail";
|
||||
|
||||
md.params.hash[md.name] = "+";
|
||||
md.selected = {};
|
||||
md.internal.reset_detail = true;
|
||||
md.tab.active = "detail";
|
||||
md.params.apply();
|
||||
md.render();
|
||||
}}
|
||||
>
|
||||
<div className="c-px-1">{opt.addNewText}</div> <Plus size={18} />
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ export const MasterDetail: FC<MDProps> = (arg) => {
|
|||
active: "",
|
||||
list: [],
|
||||
},
|
||||
internal: { action_should_refresh: false },
|
||||
internal: { action_should_refresh: false, reset_detail: false },
|
||||
childs: {},
|
||||
props: {
|
||||
mode,
|
||||
|
|
|
|||
|
|
@ -13,9 +13,15 @@ export const should_show_tab = (md: MDLocal) => {
|
|||
};
|
||||
|
||||
export const MDDetail: FC<{ md: MDLocal; mdr: MDRef }> = ({ md, mdr }) => {
|
||||
const local = useLocal({ selected: "", synced: false });
|
||||
const detail = md.childs[md.tab.active];
|
||||
const PassProp = mdr.PassProp;
|
||||
|
||||
if (md.internal.reset_detail) {
|
||||
md.internal.reset_detail = false;
|
||||
md.render();
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!detail) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,5 +15,6 @@ export const MDHeader: FC<{ md: MDLocal; mdr: MDRef }> = ({ md, mdr }) => {
|
|||
md.header.breadcrumb = [...prefix, ...md.header.master.breadcrumb()];
|
||||
}
|
||||
|
||||
if (md.internal.reset_detail) return null;
|
||||
return <PassProp md={md}>{head}</PassProp>;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export type MDLocalInternal = {
|
|||
active: string;
|
||||
list: string[];
|
||||
};
|
||||
internal: { action_should_refresh: boolean };
|
||||
internal: { action_should_refresh: boolean; reset_detail: boolean };
|
||||
master: {
|
||||
reload: (arg?: { toast: boolean }) => void;
|
||||
render: () => void;
|
||||
|
|
|
|||
Loading…
Reference in New Issue