import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; export declare class CustomValidators { /** * Validates that the control value contains only numeric characters (0-9). * Empty values are considered valid. * * @param control The form control to validate * @returns ValidationErrors with {number: true} if invalid, null if valid * @example * this.formGroup = this.fb.group({ * age: ['', [Validators.required, CustomValidators.onlyNumber]] * }); */ static onlyNumber(control: AbstractControl): ValidationErrors | null; /** * Validates that the control value is not composed of only whitespace characters. * Empty values are considered valid. * * @param control The form control to validate * @returns ValidationErrors with {whiteSpaceLine: true} if invalid, null if valid * @example * this.formGroup = this.fb.group({ * description: ['', [Validators.required, CustomValidators.hasWhiteSpaceLine]] * }); */ static hasWhiteSpaceLine(control: AbstractControl): ValidationErrors | null; /** * Validates that the control value exists within a provided list of valid values. * Empty values are considered valid. * * @param datalist Array of valid values to check against * @param customError Optional custom error key to return instead of the default that is 'valueNoExist' * If set to 'none', no error message will be returned. * @returns A validator function that returns an error object if invalid, empty object if valid * @example * const allowedCities = ['New York', 'London', 'Tokyo']; * this.formGroup = this.fb.group({ * city: ['', [Validators.required, CustomValidators.introducedValueExists(allowedCities)]] * }); */ static introducedValueExists(datalist: any[], customError?: string): ValidatorFn; /** * Validates that the control value does not start with a whitespace character. * * @param control The form control to validate * @returns ValidationErrors with {leadingWhiteSpaceLine: true} if invalid, null if valid * @example * this.formGroup = this.fb.group({ * username: ['', [Validators.required, CustomValidators.hasLeadingWhiteSpace]] * }); */ static hasLeadingWhiteSpace(control: AbstractControl): ValidationErrors | null; /** * Validates that the control value does not end with a whitespace character. * * @param control The form control to validate * @returns ValidationErrors with {trailingWhiteSpaceLine: true} if invalid, null if valid * @example * this.formGroup = this.fb.group({ * password: ['', [Validators.required, CustomValidators.hasTrailingWhiteSpace]] * }); */ static hasTrailingWhiteSpace(control: AbstractControl): ValidationErrors | null; /** * Validates that the size of the control value in bytes does not exceed the specified maximum. * Useful for validating file sizes or input lengths in bytes rather than characters. * * @param maxLength Maximum allowed size in bytes * @returns A validator function that returns {maxlength: true} if size exceeds limit * @example * // Validate that a file input doesn't exceed 5MB * this.formGroup = this.fb.group({ * fileUpload: ['', [Validators.required, CustomValidators.maxByte(1024)]] * }); */ static maxByte(maxLength: number): ValidatorFn; }