diff --git a/comps/form/gen/fields.ts b/comps/form/gen/fields.ts index c12179c..aa5f4fc 100755 --- a/comps/form/gen/fields.ts +++ b/comps/form/gen/fields.ts @@ -22,7 +22,12 @@ export type GFCol = { }; export const newField = async ( field: GFCol, - opt: { parent_table: string; value: Array; on_change?: string }, + opt: { + parent_table: string; + value: Array; + on_change?: string; + is_from_table_edit?: boolean; + }, show_label: boolean ) => { let show = typeof show_label === "boolean" ? show_label : true; diff --git a/comps/form/gen/gen-form.ts b/comps/form/gen/gen-form.ts index 82150aa..439b4ee 100755 --- a/comps/form/gen/gen-form.ts +++ b/comps/form/gen/gen-form.ts @@ -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; diff --git a/comps/form/gen/gen-table-edit.ts b/comps/form/gen/gen-table-edit.ts index 2838fc3..b12203a 100755 --- a/comps/form/gen/gen-table-edit.ts +++ b/comps/form/gen/gen-table-edit.ts @@ -46,6 +46,7 @@ export const genTableEdit = async ( parent_table: table, value, on_change: `() => { ext_fm.change(); }`, + is_from_table_edit: true }, false ); diff --git a/utils/prasi-events.ts b/utils/prasi-events.ts index bb9def9..b6cd93d 100755 --- a/utils/prasi-events.ts +++ b/utils/prasi-events.ts @@ -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) => {},