From 5cdb3ab853a4fa44b505a5d901c86203c9ef9d21 Mon Sep 17 00:00:00 2001 From: rizky Date: Fri, 19 Jul 2024 01:30:54 -0700 Subject: [PATCH] fix --- comps/form/gen/gen-form.ts | 59 +++++++++++++++++++------------------- comps/md/gen/md-gen.ts | 4 +-- comps/md/gen/md-list.ts | 2 +- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/comps/form/gen/gen-form.ts b/comps/form/gen/gen-form.ts index 120be5c..cbacaab 100755 --- a/comps/form/gen/gen-form.ts +++ b/comps/form/gen/gen-form.ts @@ -443,45 +443,46 @@ type IForm = { form: any; error: Record; fm: FMLocal } align: "top-left", }, }; + const child_body = createItem({ + name: "item", + ...body_prop, + childs: [ + createItem({ + adv: { + js: '
\n {children}\n
', + jsBuilt: + 'render(/* @__PURE__ */ React.createElement("div", { ...props, className: cx(props.className, "form-fields") }, children));\n', + }, + dim: { + w: "full", + h: "full", + wUnit: "px", + hUnit: "px", + }, + name: "fields", + layout: { + dir: "row", + align: "top-left", + gap: 0, + wrap: "flex-nowrap", + }, + childs: child_fields, + }), + submit, + ].filter((e) => e), + }); if (commit) { Object.keys(result).map((e) => { item.edit.setProp(e, result[e]); }); item.edit.setProp("body", { mode: "jsx", - value: createItem({ - name: "item", - ...body_prop, - childs: [ - createItem({ - adv: { - js: '
\n {children}\n
', - jsBuilt: - 'render(/* @__PURE__ */ React.createElement("div", { ...props, className: cx(props.className, "form-fields") }, children));\n', - }, - dim: { - w: "full", - h: "full", - wUnit: "px", - hUnit: "px", - }, - name: "fields", - layout: { - dir: "row", - align: "top-left", - gap: 0, - wrap: "flex-nowrap", - }, - childs: child_fields, - }), - submit, - ].filter((e) => e), - }), + value: child_body, }); await item.edit.commit(); } else { set(data, "body.value", { ...data.body?.value, ...body_prop }); - set(data, "body.value.childs", child_fields); + set(data, "body.value.childs", child_body.childs); Object.keys(result).map((e) => { set(data, e, result[e]); }); diff --git a/comps/md/gen/md-gen.ts b/comps/md/gen/md-gen.ts index c9f09ce..f12d2f2 100755 --- a/comps/md/gen/md-gen.ts +++ b/comps/md/gen/md-gen.ts @@ -1,6 +1,6 @@ import { GenFn } from "lib/gen/utils"; import { generateMDForm } from "./md-form"; -import { generateList } from "./md-list"; +import { generateMDList } from "./md-list"; const w = window as any; export const generateMasterDetail: GenFn<{ @@ -20,7 +20,7 @@ export const generateMasterDetail: GenFn<{ } } catch (e) {} - await generateList(arg, data, false); + await generateMDList(arg, data, false); await generateMDForm(arg, data, false); await item.edit.commit(); }; diff --git a/comps/md/gen/md-list.ts b/comps/md/gen/md-list.ts index bea739a..047440e 100755 --- a/comps/md/gen/md-list.ts +++ b/comps/md/gen/md-list.ts @@ -3,7 +3,7 @@ import { createItem } from "lib/gen/utils"; import get from "lodash.get"; import { generateTableList } from "./gen-table-list"; -export const generateList = async ( +export const generateMDList = async ( arg: { item: PrasiItem; table: string; fields: any }, data: any, commit: boolean