fix
This commit is contained in:
parent
248ceada52
commit
5d0056e394
|
|
@ -147,67 +147,67 @@ export const generateForm = async (
|
||||||
walkGenForm(new_body, existing_childs as any);
|
walkGenForm(new_body, existing_childs as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
const prop_item = propFromItem(item);
|
// const prop_item = propFromItem(item);
|
||||||
const current_body = prop_item?.body?.value as IItem;
|
// const current_body = prop_item?.body?.value as IItem;
|
||||||
|
|
||||||
if (current_body) {
|
// if (current_body) {
|
||||||
const mapping = mapCompItemTree(new_body, {
|
// const mapping = mapCompItemTree(new_body, {
|
||||||
shouldAdd({ item }) {
|
// shouldAdd({ item }) {
|
||||||
if (item.component?.props?.sub_type?.value === "table-edit")
|
// if (item.component?.props?.sub_type?.value === "table-edit")
|
||||||
return "add-skip-children";
|
// return "add-skip-children";
|
||||||
|
|
||||||
return "add";
|
// return "add";
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
reduceItemMapping(current_body, mapping, (old_item, new_item) => {
|
// reduceItemMapping(current_body, mapping, (old_item, new_item) => {
|
||||||
const pold = propFromItem(old_item);
|
// const pold = propFromItem(old_item);
|
||||||
const pnew = propFromItem(new_item);
|
// const pnew = propFromItem(new_item);
|
||||||
|
|
||||||
let result = old_item;
|
// let result = old_item;
|
||||||
if (
|
// if (
|
||||||
result.component &&
|
// result.component &&
|
||||||
result.component?.id === "32550d01-42a3-4b15-a04a-2c2d5c3c8e67"
|
// result.component?.id === "32550d01-42a3-4b15-a04a-2c2d5c3c8e67"
|
||||||
) {
|
// ) {
|
||||||
if (pold.type.value !== pnew.type.value) {
|
// if (pold.type.value !== pnew.type.value) {
|
||||||
result = new_item;
|
// result = new_item;
|
||||||
} else if (pold.sub_type.value !== pnew.sub_type.value) {
|
// } else if (pold.sub_type.value !== pnew.sub_type.value) {
|
||||||
result = new_item;
|
// result = new_item;
|
||||||
}
|
// }
|
||||||
|
|
||||||
copyProps(old_item, new_item, [
|
// copyProps(old_item, new_item, [
|
||||||
"placeholder",
|
// "placeholder",
|
||||||
"label",
|
// "label",
|
||||||
"link__url",
|
// "link__url",
|
||||||
"ext__width",
|
// "ext__width",
|
||||||
"opt__load_trigger",
|
// "opt__load_trigger",
|
||||||
"ext__on_change",
|
// "ext__on_change",
|
||||||
"ext__description",
|
// "ext__description",
|
||||||
"ext__show_label",
|
// "ext__show_label",
|
||||||
"ext__disabled",
|
// "ext__disabled",
|
||||||
"ext__prefix",
|
// "ext__prefix",
|
||||||
"ext__suffix",
|
// "ext__suffix",
|
||||||
]);
|
// ]);
|
||||||
}
|
// }
|
||||||
|
|
||||||
return result;
|
// return result;
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (
|
// if (
|
||||||
mapping["32550d01-42a3-4b15-a04a-2c2d5c3c8e67"] &&
|
// mapping["32550d01-42a3-4b15-a04a-2c2d5c3c8e67"] &&
|
||||||
Object.keys(mapping["32550d01-42a3-4b15-a04a-2c2d5c3c8e67"]).length > 0
|
// Object.keys(mapping["32550d01-42a3-4b15-a04a-2c2d5c3c8e67"]).length > 0
|
||||||
) {
|
// ) {
|
||||||
for (const val of Object.values(
|
// for (const val of Object.values(
|
||||||
mapping["32550d01-42a3-4b15-a04a-2c2d5c3c8e67"]
|
// mapping["32550d01-42a3-4b15-a04a-2c2d5c3c8e67"]
|
||||||
)) {
|
// )) {
|
||||||
current_body.childs?.[0]?.childs.push(val);
|
// current_body.childs?.[0]?.childs.push(val);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (current_body?.childs?.length > 0) {
|
// if (current_body?.childs?.length > 0) {
|
||||||
new_body = current_body;
|
// new_body = current_body;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (commit) {
|
if (commit) {
|
||||||
Object.keys(result).map((e) => {
|
Object.keys(result).map((e) => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
import { formatName, GenFn } from "lib/gen/utils";
|
import { formatName, GenFn } from "lib/gen/utils";
|
||||||
import { generateMDForm } from "./md-form";
|
import { generateMDForm } from "./md-form";
|
||||||
import { generateMDList } from "./md-list";
|
import { generateMDList } from "./md-list";
|
||||||
|
import { getValueProp } from "lib/comps/form/gen/gen-rel";
|
||||||
|
import { getProp } from "lib/utils/get-prop";
|
||||||
|
import { propFromItem } from "lib/utils/diff-gen";
|
||||||
const w = window as any;
|
const w = window as any;
|
||||||
export const generateMasterDetail: GenFn<{
|
export const generateMasterDetail: GenFn<{
|
||||||
item: PrasiItem;
|
item: PrasiItem;
|
||||||
|
|
@ -21,6 +24,14 @@ export const generateMasterDetail: GenFn<{
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
if (!arg.fields && data?.gen_fields?.valueBuilt) {
|
||||||
|
eval(`arg.fields = ${data.gen_fields.valueBuilt}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!arg.table && data?.gen_table?.valueBuilt) {
|
||||||
|
eval(`arg.table = ${data.gen_table.valueBuilt}`);
|
||||||
|
}
|
||||||
|
|
||||||
await generateMDList(arg, data, false);
|
await generateMDList(arg, data, false);
|
||||||
await generateMDForm(arg, data, false);
|
await generateMDForm(arg, data, false);
|
||||||
await item.edit.commit();
|
await item.edit.commit();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue