This commit is contained in:
rizrmd 2024-06-18 01:32:08 -07:00
parent 287786e548
commit 18d24c37b8
2 changed files with 23 additions and 1 deletions

View File

@ -3,6 +3,9 @@ import { parseGenField } from "lib/gen/utils";
import { on_load_rel } from "./on_load_rel";
import { gen_rel_many, getColumn } from "./gen-rel-many";
import get from "lodash.get";
import { getValueProp } from "./gen-rel";
import { genTableEdit } from "./gen-table-edit";
import { createId } from "@paralleldrive/cuid2";
export const generateField = async (
data: any,
@ -242,6 +245,25 @@ export const generateField = async (
value: result[e],
});
});
const res = (await genTableEdit(
item,
{
gen__table: data.rel__gen_table,
gen__fields: data.rel__gen_fields,
},
false
)) as any;
item.edit.setProp("child", {
mode: "jsx",
value: {
id: createId(),
name: "item",
type: "item",
edit: null as any,
childs: res,
},
});
await item.edit.commit();
}
};

View File

@ -41,7 +41,7 @@ export const generateRelation = async (
}
};
const getValueProp = (data: any) => {
export const getValueProp = (data: any) => {
let table = "" as string;
try {
table = eval(data);