import { ReactNode } from "react"; import { FMLocal, FieldLocal, FieldProp } from "../typings"; import { Label } from "../field/Label"; import { FieldLoading } from "../../ui/field-loading"; export const BaseField = (prop: { field: FieldLocal; fm: FMLocal; arg: FieldProp; children: (arg: { field: FieldLocal; fm: FMLocal; arg: FieldProp; }) => ReactNode; }) => { const { field, fm, arg } = prop; const w = field.width; const mode = fm.props.label_mode; const prefix = typeof field.prefix === "function" ? field.prefix() : typeof field.prefix === "string" ? field.prefix : null; const suffix = typeof field.suffix === "function" ? field.suffix() : typeof field.suffix === "string" ? field.prefix : null; const name = field.name; const errors = fm.error.get(name); let type_field = typeof arg.type === "function" ? arg.type() : arg.type; // tipe field return (