import { FormModelError } from './FormModel'; export type FormModelFieldType = 'text' | 'email' | 'password' | 'search' | 'number' | 'range' | 'color' | 'tel' | 'url' | 'date' | 'time' | 'datetime' | 'datetime-local' | 'week' | 'month' | 'file' | 'textarea' | 'select' | 'autocomplete' | 'checkbox' | 'switch' | 'radio' | 'radiobutton' | 'hidden' | string; export interface FormModelFieldOption { key?: string; value: any; label: string; } export type FormModelFieldValidationRules = string[] | Record>; export interface FormModelFieldTransformer { toModelValue(input: TOutput | TValue | undefined): TValue; toOutputValue(input: TValue | undefined): TOutput; } export interface FormModelFieldSchema { name?: string; label: string; type?: FormModelFieldType; value?: TValue; options?: FormModelFieldOption[] | (() => FormModelFieldOption[]); required?: boolean; validationRules?: FormModelFieldValidationRules; paths?: string[] | string[][]; transform?: FormModelFieldTransformer; } export interface FormModelField extends FormModelFieldSchema { name: Extract; type: FormModelFieldType; initialValue?: TValue; required: boolean; validationRules: FormModelFieldValidationRules; errors: FormModelError[]; }