import { FC, useEffect } from "react"; import { FieldProp } from "../typings"; import { useField } from "../utils/use-field"; import { validate } from "../utils/validate"; import { FieldInput } from "./FieldInput"; import { Label } from "./Label"; export const Field: FC = (arg) => { const { fm } = arg; const field = useField(arg); const mode = fm.props.label_mode; const w = field.width; useEffect(() => { validate(field, fm); fm.events.on_change(field.name, fm.data[field.name]); fm.render(); }, [fm.data[field.name]]); if (field.status === "init" && !isEditor) return null; const errors = fm.error.get(field.name); const props = { ...arg.props }; delete props.className; return (