diff --git a/comps/form/base/BaseForm.tsx b/comps/form/base/BaseForm.tsx index 6a036bf..4f8067c 100755 --- a/comps/form/base/BaseForm.tsx +++ b/comps/form/base/BaseForm.tsx @@ -1,7 +1,7 @@ import { ReactNode, useCallback, useEffect, useState } from "react"; import { BaseFormLocal, default_base_form_local } from "./types"; import { useLocal } from "lib/utils/use-local"; -import { FieldLocal, FieldProp } from "../typings"; +import { FieldLocal, FieldProp, fieldType } from "../typings"; export type BaseFormProps = { data: T; @@ -47,6 +47,8 @@ export const BaseForm = >( }; form.createField = (arg) => { + if (form.fields[arg.name]) return form.fields[arg.name]; + const prop: FieldLocal = { name: arg.name, label: typeof arg.label !== "undefined" ? arg.label : arg.name, @@ -54,6 +56,7 @@ export const BaseForm = >( width: "auto", prefix: arg.prefix, } as any; + form.fields[arg.name] = prop; return prop; }; diff --git a/comps/form/base/types.ts b/comps/form/base/types.ts index f669444..8cbc0bf 100755 --- a/comps/form/base/types.ts +++ b/comps/form/base/types.ts @@ -8,6 +8,7 @@ export const default_base_form_local = { width: 0, }, fm: null as null | FMLocal, + fields: {} as Record, }; type CreateFieldArg = { diff --git a/comps/form/field/type/TypeInput.tsx b/comps/form/field/type/TypeInput.tsx index e41ffa6..186ecf1 100755 --- a/comps/form/field/type/TypeInput.tsx +++ b/comps/form/field/type/TypeInput.tsx @@ -200,7 +200,6 @@ export const FieldTypeInput: FC<{ field.render(); }} /> - {arg.sub_type === "password" && (