import { FormComponent } from './types'; /** As of version 4 the default sort order of enums is the order in which they are defined. https://github.com/UselessPickles/ts-enum-util/issues/7#issuecomment-475499821 */ export declare enum ValidatorNames { required = "required", max = "max", maxlength = "maxlength", min = "min", minlength = "minlength", pattern = "pattern" } export interface Validator { errorMessage?: string; validate: (htmlInput: T) => boolean; } export interface ValidatorEntry { name: string; customErrorMessage?: string; options?: boolean | string; } export declare const defaultErrorMessagesConfig: { [k in ValidatorNames]?: (options?: ValidatorEntry['options']) => string; }; /** reducer callback: iterates through validators and returns the first one that fails it's validate function */ export declare const combineValidators: (v1: Validator, v2: Validator) => Validator; /** creates a list of ValidatorEntry objects from the ValidatorNames enum that exist on the component class example: [ {name: 'required}, {name: 'min', options: '5'} ] */ export declare const composeValidatorList: (componentClass: FormComponent) => ValidatorEntry[]; export declare const defaultValidator: () => Validator; export declare const getValidator: (list: Array) => Validator; export declare const initializeValidators: (componentClass: FormComponent) => Validator; export declare const isRequiredValidator: (customErrorMessage?: string) => Validator; export declare const maxlengthValidator: (customErrorMessage: string, options: ValidatorEntry['options']) => Validator; export declare const minlengthValidator: (customErrorMessage: string, options: ValidatorEntry['options']) => Validator; export declare const patternValidator: (customErrorMessage: string) => Validator; export declare const validatorFactory: (validatorEntry: ValidatorEntry) => Validator;