fix field

This commit is contained in:
rizky 2024-07-30 20:06:14 -07:00
parent dcc7a39a37
commit b2b34659c6
3 changed files with 24 additions and 19 deletions

View File

@ -101,7 +101,7 @@ export const newField = async (
type: "date", type: "date",
ext__show_label: show ? "y" : "n", ext__show_label: show ? "y" : "n",
ext__required: field.optional ? "n" : "y", ext__required: field.optional ? "n" : "y",
sub_type: "datetime", sub_type: "date",
child: { child: {
childs: [], childs: [],
}, },

View File

@ -12,6 +12,7 @@ export const generateField = async (
commit: boolean commit: boolean
) => { ) => {
let fieldType = getString(data.sub_type.value) as string; let fieldType = getString(data.sub_type.value) as string;
let table = getString(data.rel__gen_table.value) as string; let table = getString(data.rel__gen_table.value) as string;
const raw_fields = JSON.parse(data.rel__gen_fields.value) as ( const raw_fields = JSON.parse(data.rel__gen_fields.value) as (
| string | string

View File

@ -54,6 +54,9 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
} }
} }
if (should_load) { if (should_load) {
if (!on_load) {
console.error("Form on_load is empty. Please re-generate the form.");
} else {
const on_load_result = on_load({ fm }); const on_load_result = on_load({ fm });
let result = undefined; let result = undefined;
if ( if (
@ -79,6 +82,7 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
} }
} }
} }
}
fm.internal.reload.done.map((e) => e()); fm.internal.reload.done.map((e) => e());
setTimeout(() => { setTimeout(() => {