checkpoint

This commit is contained in:
rizky 2024-11-03 21:49:12 -07:00
parent 61845dc62b
commit d580b6ccad
4 changed files with 29 additions and 12 deletions

View File

@ -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) {}
}
}
};

View File

@ -53,7 +53,6 @@ export const SheetCn: FC<{
local.render();
}
} else {
console.log(typeof onInit)
if (typeof onInit === "function") {
onInit({
data: local,

View File

@ -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
);

View File

@ -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) {