@doku-dev/doku-fragment
Version:
A new Angular UI library that moving away from Bootstrap and built from scratch.
55 lines (54 loc) • 1.84 kB
TypeScript
import { AbstractControl, ValidationErrors } from '@angular/forms';
export declare class DokuValidators {
/**
* Validator that requires the control's value pass a safe string validation test.
*
* @usageNotes
*
* ### Validate that the field matches a valid DOKU safe string pattern
*
* ```typescript
* const control = new FormControl('bad$', DokuValidators.safeString);
*
* console.log(control.errors); // {safeString: true}
* ```
*
* @returns An error map with the `safeString` property
* if the validation check fails, otherwise `null`.
*/
static safeString(control: AbstractControl): ValidationErrors | null;
/**
* Validator that requires the control's value pass an email validation test.
*
* @usageNotes
*
* ### Validate that the field matches a valid DOKU email pattern
*
* ```typescript
* const control = new FormControl('bad@', DokuValidators.email);
*
* console.log(control.errors); // {email: true}
* ```
*
* @returns An error map with the `email` property
* if the validation check fails, otherwise `null`.
*/
static email(control: AbstractControl): ValidationErrors | null;
/**
* Validator that requires the control's value pass an hexadecimal color validation test.
*
* @usageNotes
*
* ### Validate that the field matches a valid DOKU hex color pattern
*
* ```typescript
* const control = new FormControl('#1234', DokuValidators.hexColor);
*
* console.log(control.errors); // {hexColor: true}
* ```
*
* @returns An error map with the `hexColor` property
* if the validation check fails, otherwise `null`.
*/
static hexColor(control: AbstractControl): ValidationErrors | null;
}