UNPKG

@aofl/form-validate

Version:

Form validation mixin for AoflElement

74 lines (72 loc) 2.43 kB
/** * Exports the ValidationMixin and some commonly needed validations */ declare module "@aofl/form-validate" { /** * Tracks two properties of any class to be equal. * @returns True or false if the given value passes the * given regex test is valid. */ function compare(propPath: string, comparator: (...params: any[]) => any): (...params: any[]) => any; /** * Checks to see if a given value is all digits or not. */ function isAllDigits(value: string): boolean; /** * Tracks two properties of any class to be equal. * @returns True or false if the given value passes the * given regex test is valid. */ function isEqual(propPath: string): (...params: any[]) => any; /** * isRequired */ function isRequired(value: string): boolean; /** * Checks to see if the given value meets the minimum length given. * @param length - The min length */ function minLength(length: number): (...params: any[]) => any; /** * Checks to see if the given value meets the maximum length given. * @param length - The max length */ function maxLength(length: number): (...params: any[]) => any; /** * Tests if input matches the given pattern. * @returns True or false if the given value passes the * given regex test is valid. */ function pattern(regex: string | RegExp, flags: string): (...params: any[]) => any; /** * Creates an instance of ValidationFunction. */ class ValidationFunction { constructor(target: any, validatorFn: any, path: string); reset(): void; validate(): void; validateComplete: Promise; getKeys(): any[]; toString(): string; } function validationMixin(superClass: any): ValidationMixin; /** * Creates an instance of ValidationMixin. */ class ValidationMixin extends superClass { } /** * Creates an instance of ValidationProperty. */ class ValidationProperty { constructor(target: any, validators: any, _propName: string); reset(): void; readonly valid: boolean; readonly pending: boolean; readonly observed: boolean; validate(): void; readonly validateComplete: Promise; getKeys(): any[]; toString(): string; } }