import { MaybeRef } from '../utils'; import { PropType, ComputedRef, Ref } from 'vue'; export type TValidationResult = string | boolean; export type TValidationRule = TValidationResult | PromiseLike | ((value: any) => TValidationResult) | ((value: any) => PromiseLike); export type TValidationOn = typeof allowedValidationOn[number]; export interface IValidationProps { disabled: boolean; error: boolean; errorMessages: string | string[]; focused: boolean; maxErrors: string | number; name: string | undefined; label: string | undefined; readonly: boolean; rules: TValidationRule[]; modelValue: any; validateOn?: TValidationOn; validationValue: any; hideMessages: boolean; } export interface IUseValidation { errorMessages: ComputedRef; isDisabled: ComputedRef; isReadonly: ComputedRef; isDirty: ComputedRef; isPure: Ref; isValid: ComputedRef; isValidating: Ref; validate: () => Promise; reset: () => void; resetValidation: () => void; validationClasses: ComputedRef>; } export declare const allowedValidationOn: readonly ["blur", "input", "submit"]; export declare const makeValidationProps: (defaults?: Defaults | undefined) => import('../utils').AppendDefault<{ /** * Состояние ошибки */ error: { type: PropType; default: boolean; }; /** * Сообщения об ошибках */ errorMessages: { type: PropType; default: () => never[]; }; /** * Максимально количество выводимых ошибок */ maxErrors: { type: PropType; default: number; }; /** * Имя поля */ name: { type: PropType; default: undefined; }; /** * Правила валидации */ rules: { type: PropType; default: () => never[]; }; /** * Значение модели */ modelValue: { type: PropType; default: null; }; /** * Событие для валидации */ validateOn: { type: PropType; default: string; available: readonly ["blur", "input", "submit"]; validator: (value: TValidationOn) => boolean; }; /** * Значение для валидации */ validationValue: { type: PropType; default: undefined; }; /** * Убирает слот для сообщений об ошибках */ hideMessages: { type: PropType; default: boolean; }; }, Defaults>; export declare function useValidation(props: IValidationProps, name: string, id?: MaybeRef): IUseValidation;