design-angular-kit
Version:
Un toolkit Angular conforme alle linee guida di design per i servizi web della PA
70 lines (69 loc) • 2.5 kB
TypeScript
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
export declare class ItValidators {
static SpecialCharacterPattern: string;
/**
* Static pattern validator with custom error
* @param regex
* @param error
*/
static customPattern(regex: RegExp, error: ValidationErrors): ValidatorFn;
/**
* Set Validator if the condition is satisfied
* @param validator the validator to apply if the condition is true
* @param condition the condition
*/
static conditional(validator: ValidatorFn, condition: (control: AbstractControl) => boolean): ValidatorFn;
/**
* Check whether our password and confirm password are a match
* @param control
* @param passwordControlName the password formControlName
* @param confirmControlName the confirmPassword formControlName
*/
static passwordMatch(control: AbstractControl, passwordControlName?: string, confirmControlName?: string): AbstractControl | null;
/**
* Password validator
* @param minLength minimum password length - default 10
* @param hasNumber check whether the entered password has a number - default true
* @param hasCapitalCase check whether the entered password has upper case letter - default true
* @param hasSmallCase check whether the entered password has a lower-case letter - default true
* @param hasSpecialCharacters check whether the entered password has a special character - default true
* @param required the field is required - default true
*/
static password(minLength?: number, hasNumber?: boolean, hasCapitalCase?: boolean, hasSmallCase?: boolean, hasSpecialCharacters?: boolean, required?: boolean): ValidatorFn;
/**
* Email validator
*/
static get email(): ValidatorFn;
/**
* Phone number validator
*/
static get tel(): ValidatorFn;
/**
* URL validator
*/
static get url(): ValidatorFn;
/**
* Italian Tax Code validator
*/
static get taxCode(): ValidatorFn;
/**
* VAT Number validator
*/
static get vatNumber(): ValidatorFn;
/**
* Italian Postal Code validator (CAP)
*/
static get cap(): ValidatorFn;
/**
* IBAN validator
*/
static get iban(): ValidatorFn;
/**
* Italian plate validator
*/
static get plate(): ValidatorFn;
/**
* Check if value is a valid RegExp
*/
static get regExp(): ValidatorFn;
}