diff --git a/comps/md/utils/md-hash.ts b/comps/md/utils/md-hash.ts index 2f77e21..e5dc1d0 100755 --- a/comps/md/utils/md-hash.ts +++ b/comps/md/utils/md-hash.ts @@ -8,6 +8,7 @@ export const masterDetailParseHash = (md: MDLocal) => { md.params.hash = {}; md.params.tabs = {}; + let has_detail = false; for (const h of raw_hash.split("#")) { if (h) { if (h.includes("=")) { @@ -15,6 +16,9 @@ export const masterDetailParseHash = (md: MDLocal) => { if (tab_name && tab_val) { md.params.hash[tab_name] = tab_val; } + if (tab_name === md.name) { + has_detail = true; + } } else if (h.includes("~")) { const [tab_name, tab_val] = h.split("~"); if (tab_name && tab_val) { @@ -24,6 +28,10 @@ export const masterDetailParseHash = (md: MDLocal) => { } } + if (!has_detail) { + md.selected = null; + } + md.params.links = md.params.links.filter((e) => e); const parsed_link = parseLink(); @@ -69,9 +77,15 @@ export const masterDetailApplyParams = (md: MDLocal) => { delete md.params.hash[md.name]; } + let has_detail = false; for (const [k, v] of Object.entries(md.params.hash)) { + if (k === md.name) { + has_detail = true; + } + hash += `#${k}=${v}`; } + for (const [k, v] of Object.entries(md.params.tabs)) { hash += `#${k}~${v}`; } @@ -79,16 +93,20 @@ export const masterDetailApplyParams = (md: MDLocal) => { if (!isEditor) { location.hash = hash; } - if(!isEditor){ - if(md.props.tab_mode === "v-tab" || md.props.tab_mode === "h-tab"){ - try{ - if(row && md?.childs?.form?.fm && md?.childs?.form?.fm?.status === "ready" && md.selected?.id){ + + if (!isEditor) { + if (md.props.tab_mode === "v-tab" || md.props.tab_mode === "h-tab") { + try { + if ( + row && + md?.childs?.form?.fm && + md?.childs?.form?.fm?.status === "ready" && + md.selected?.id + ) { md.childs.form.fm.reload(); // console.log("MASUK???") } - }catch(ex){ - - } + } catch (ex) {} } } }; diff --git a/comps/sheet/sheet.tsx b/comps/sheet/sheet.tsx index 1ec7fc1..3de1c1a 100755 --- a/comps/sheet/sheet.tsx +++ b/comps/sheet/sheet.tsx @@ -53,7 +53,6 @@ export const SheetCn: FC<{ local.render(); } } else { - console.log(typeof onInit) if (typeof onInit === "function") { onInit({ data: local, diff --git a/exports.tsx b/exports.tsx index 07f24b7..316bae7 100755 --- a/exports.tsx +++ b/exports.tsx @@ -20,9 +20,9 @@ export const Typeahead = lazify( ); /** Master - Detail - List - Form */ -// export const MasterDetail = lazify( -// async () => (await import("lib/comps/md/MasterDetail")).MasterDetail -// ); +export const MasterDetail = lazify( + async () => (await import("lib/comps/md/MasterDetail")).MasterDetail +); export const MDRenderMaster = lazify( async () => (await import("lib/comps/md/parts/MDMaster")).MDRenderMaster ); diff --git a/utils/override-nav.ts b/utils/override-nav.ts index 1e34e36..7d97479 100755 --- a/utils/override-nav.ts +++ b/utils/override-nav.ts @@ -3,7 +3,7 @@ import { hashSum } from "lib/utils/hash-sum"; import { getPathname } from "lib/utils/pathname"; const w = window as any; - + export const overrideNav = (arg?: { local?: any }) => { if (isEditor) return; if (!w.prasi_menu || arg?.local) {