import { ComputedRef, Ref, UnwrapRef } from 'vue'; import { MultiLangText } from '../model/CommonTypes'; import { FieldContext } from '../model/FieldContext'; export type ValidationError = { code: string; message: MultiLangText; }; export type ValidationPhase = 'input' | 'change' | 'blur' | 'form'; export type FieldValidationRule = (value: T, phase: ValidationPhase, fieldContext?: FieldContext) => Promise | ValidationError[] | undefined; export type FieldValidatorOption = { field?: Ref; disabled: Ref | ComputedRef; initialValue?: T; isValid?: (value: UnwrapRef | undefined, phase: ValidationPhase) => undefined | ValidationError[] | Promise; convertToValue?: (value: string | undefined) => UnwrapRef; convertFromValue?: (value: UnwrapRef) => string; }; export type FieldValidator = { stringValue: Ref; value: Ref | undefined>; valid: Ref; errors: Ref; touched: Ref; handleInput: (event: Event) => Promise; handleChange: (event: Event) => Promise; handleFocus: (event: Event) => void; handleBlur: (event: Event) => void; validateValue: (value: UnwrapRef, phase: ValidationPhase) => Promise; validate: (phase?: ValidationPhase) => Promise; clearErrors: () => void; getName: () => string; }; export declare const storeFieldValidator: (field: HTMLElement, validator: FieldValidator) => void; export declare const loadFieldValidator: (field: HTMLElement) => FieldValidator | undefined; export declare const findFieldValidatorElements: (element?: HTMLElement) => NodeListOf | undefined; export declare const validateField: (field: HTMLElement | string, phase?: ValidationPhase) => Promise; export declare const validateFields: (fields: (HTMLElement | string)[], phase?: ValidationPhase) => Promise; export declare const fieldValidator: (option: FieldValidatorOption) => FieldValidator; export declare const executeFieldValidationRule: (value: T, rules: FieldValidationRule[] | undefined, errors: ValidationError[], phase: ValidationPhase, fieldContext?: FieldContext) => Promise; export declare const executeRequiredValidation: (value: string | number | undefined, checkRequired: boolean, requiredMessage: MultiLangText | undefined, errors: ValidationError[]) => boolean; export declare const executeRegExpValidation: (value: string, regexp: string | undefined, message: MultiLangText | undefined, errors: ValidationError[]) => boolean; export declare const executeBetweenLengthValidation: (text: string, minLength: number | undefined, minLengthMessage: MultiLangText | undefined, maxLength: number | undefined, maxLengthMessage: MultiLangText | undefined, betweenLengthMessage: MultiLangText | undefined, errors: ValidationError[]) => boolean; export declare const executeBetweenValueValidation: (value: number, minValue: number | undefined, minValueMessage: MultiLangText | undefined, maxValue: number | undefined, maxValueMessage: MultiLangText | undefined, betweenValueMessage: MultiLangText | undefined, errors: ValidationError[]) => boolean; export declare const executeDateRangeValidation: (fromValue: string | undefined, toValue: string | undefined, validationMessage: MultiLangText | undefined, erros: ValidationError[]) => boolean;