UNPKG

@circe/core

Version:

Circe Components for Angular :: Core Services and Tools

30 lines (29 loc) 1.6 kB
import { FormArray, FormControl, ValidationErrors, ValidatorFn } from '@angular/forms'; import dayjs from 'dayjs'; export declare type CustomErrorKeys = 'repeated' | 'arrayOnlyNumber' | 'arrayOnlyInteger' | 'arrayOnlyFloat' | 'arrayRequired' | 'arrayPattern'; export interface CustomErrorMessages { [key: string]: string; } export declare type CustomError = { [key in CustomErrorKeys]?: string; }; export interface CustomErrorRepeatedValues { repeatedValues: string; } export declare class CustomValidationService { static readonly customMessages: CustomErrorMessages; constructor(); static arrayRepeatedValues(control: FormArray | FormControl): CustomError | null; static arrayMinValues(minItems: number): ValidatorFn; static arrayMaxValues(maxItems: number): ValidatorFn; static arrayOnlyNumberValues(control: FormArray | FormControl): CustomError | null; static arrayOnlyIntegerValues(control: FormArray | FormControl): CustomError | null; static arrayRequired(control: FormArray | FormControl): CustomError | null; static arrayPattern(pattern: string): ValidatorFn; static dateValidator(c: FormControl): ValidationErrors; static dateRequiredValidator(c: FormControl): ValidationErrors; static dateDisableBeforeCurrentDayValidator(c: FormControl): ValidationErrors; static dateDisableAfterCurrentDayValidator(c: FormControl): ValidationErrors; static dateMinDateValidator(minDate: string | number | Date | dayjs.Dayjs): ValidatorFn; static dateMaxDateValidator(maxDate: string | number | Date | dayjs.Dayjs): ValidatorFn; }