UNPKG

@porscheinformatik/clr-addons

Version:
66 lines (65 loc) 2.87 kB
import { AbstractControl, ValidatorFn, Validator } from '@angular/forms'; import * as i0 from "@angular/core"; export declare class ClrNumericFieldValidators { /** * @description * Validator that requires the control's value to be greater than or equal to the provided number. * The validator exists only as a function and not as a directive. * * @usageNotes * * ### Validate against a minimum of 3 * * ```typescript * const control = new FormControl(2, ClrNumericFieldValidators.min(3, '.', ',')); * * console.log(control.errors); // {min: {min: 3, actual: 2}} * ``` * * @returns A validator function that returns an error map with the * `min` property if the validation check fails, otherwise `null`. * */ static min(min: number, groupingSeparator?: string, decimalSeparator?: string): ValidatorFn; /** * @description * Validator that requires the control's value to be less than or equal to the provided number. * The validator exists only as a function and not as a directive. * * @usageNotes * * ### Validate against a maximum of 15 * * ```typescript * const control = new FormControl(16, ClrNumericFieldValidators.max(15, '.', ',')); * * console.log(control.errors); // {max: {max: 15, actual: 16}} * ``` * * @returns A validator function that returns an error map with the * `max` property if the validation check fails, otherwise `null`. * */ static max(max: number, groupingSeparator?: string, decimalSeparator?: string): ValidatorFn; private static parseInputString; } export declare class ClrMaxNumeric implements Validator { _max: number; _groupingSep: string; _decimalSep: string; validate(control: AbstractControl): { [key: string]: any; } | null; static ɵfac: i0.ɵɵFactoryDeclaration<ClrMaxNumeric, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<ClrMaxNumeric, "[clrMaxNumeric]", never, { "_max": { "alias": "clrMaxNumeric"; "required": false; }; "_groupingSep": { "alias": "clrGroupingSep"; "required": false; }; "_decimalSep": { "alias": "clrDecimalSep"; "required": false; }; }, {}, never, never, false, never>; } export declare class ClrMinNumeric implements Validator { _min: number; _groupingSep: string; _decimalSep: string; validate(control: AbstractControl): { [key: string]: any; } | null; static ɵfac: i0.ɵɵFactoryDeclaration<ClrMinNumeric, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<ClrMinNumeric, "[clrMinNumeric]", never, { "_min": { "alias": "clrMinNumeric"; "required": false; }; "_groupingSep": { "alias": "clrGroupingSep"; "required": false; }; "_decimalSep": { "alias": "clrDecimalSep"; "required": false; }; }, {}, never, never, false, never>; }