import { ComputedRef, Ref, SetupContext, UnwrapRef } from 'vue'; import type { RuleItem, ValidateError, ValidateFieldsError } from 'async-validator'; import { FormItemProps, FormProps, FormEmits, FormItemProp, FormLabelWidthContext } from '../components'; import type { Arrayable } from '../utils'; import type { ComponentSize } from './use-size'; export interface FormItemRule extends RuleItem { trigger?: Arrayable; } export declare type FormRules = Partial>>; export declare type FormValidationResult = Promise; export declare type FormValidateCallback = (isValid: boolean, invalidFields?: ValidateFieldsError) => void; export interface FormValidateFailure { errors: ValidateError[] | null; fields: ValidateFieldsError; } export interface FzFormItemContext extends FormItemProps { $el?: HTMLDivElement; size?: ComponentSize; validateState: string; isGroup: boolean; labelId: string; inputIds: string[]; addInputId: (id: string) => void; removeInputId: (id: string) => void; validate: (trigger: string, callback?: FormValidateCallback) => FormValidationResult; resetField: () => void; clearValidate: () => void; } export declare type FzFormContext = FormProps & UnwrapRef & { emit: SetupContext['emit']; addField: (field: FzFormItemContext) => void; removeField: (field: FzFormItemContext) => void; resetFields: (props?: Arrayable) => void; clearValidate: (props?: Arrayable) => void; validateField: (props?: Arrayable, callback?: FormValidateCallback) => FormValidationResult; }; export declare const useForm: () => { form: FzFormContext | undefined; formItem: FzFormItemContext | undefined; }; export declare type IUseFormItemInputCommonProps = { id?: string; label?: string | number | boolean | Record; }; export declare const useFormItemInputId: (props: Partial, { formItemContext, disableIdGeneration, disableIdManagement, }: { formItemContext?: FzFormItemContext | undefined; disableIdGeneration?: Ref | ComputedRef | undefined; disableIdManagement?: Ref | ComputedRef | undefined; }) => { isLabeledByFormItem: ComputedRef; inputId: Ref; };