This commit is contained in:
rizky 2024-07-25 02:32:10 -07:00
parent 9e35d38f13
commit c9e591fac3
4 changed files with 13 additions and 2 deletions

View File

@ -22,7 +22,12 @@ export type GFCol = {
};
export const newField = async (
field: GFCol,
opt: { parent_table: string; value: Array<string>; on_change?: string },
opt: {
parent_table: string;
value: Array<string>;
on_change?: string;
is_from_table_edit?: boolean;
},
show_label: boolean
) => {
let show = typeof show_label === "boolean" ? show_label : true;

View File

@ -68,7 +68,11 @@ export const generateForm = async (
if (["has-one", "has-many"].includes(item.type)) {
value = get(item, "value.checked") as any;
}
const field = await newField(item, { parent_table: table, value }, true);
const field = await newField(
item,
{ parent_table: table, value, is_from_table_edit: false },
true
);
child_fields.push(field);
}
let submit = null;

View File

@ -46,6 +46,7 @@ export const genTableEdit = async (
parent_table: table,
value,
on_change: `() => { ext_fm.change(); }`,
is_from_table_edit: true
},
false
);

View File

@ -8,6 +8,7 @@ const events = {
form: {
where: async (fm: FMLocal, where: any) => {},
before_save: async (fm: FMLocal, record: any) => {},
relation_before_save: async (table: string, record: any) => {},
after_save: async (fm: FMLocal, record: any) => {},
before_load: async (fm: FMLocal) => {},
after_load: async (fm: FMLocal) => {},