import { FC, isValidElement } from "react"; import { FieldLoading } from "../../ui/field-loading"; import { FMLocal, FieldLocal, FieldProp } from "../typings"; import { FieldTypeInput, PropTypeInput } from "./type/TypeInput"; import { MultiOption } from "./type/TypeMultiOption"; import { SingleOption } from "./type/TypeSingleOption"; const modify = { timeout: null as any, }; export const FieldInput: FC<{ field: FieldLocal; fm: FMLocal; PassProp: any; child: any; _item: PrasiItem; arg: FieldProp; }> = ({ field, fm, arg }) => { // return <>> 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: any = typeof arg.type === "function" ? arg.type() : arg.type; // tipe field let custom = <>>; if (field.type === "custom") { let res = arg.custom?.() || <>>; if (isValidElement(res)) custom = res; else { let f = res as any; if (typeof f.type === "string") { type_field = f.type as any; arg.sub_type = f.sub_type as any; } } } if(type_field === "multi-option" && arg.sub_type === "table-edit"){ return <>{arg.child}> } return (