UNPKG

@porscheinformatik/clr-addons

Version:
33 lines (32 loc) 1.72 kB
import { AbstractControl, ValidationErrors, Validator } from '@angular/forms'; import { NullableDaterange } from '../interfaces/daterange.interface'; import { DaterangeService } from '../providers/daterange.service'; import * as i0 from "@angular/core"; /** * Validator for daterangepicker to validate that 'from' date is not before 'min' value. * Otherwise will throw corresponding `min` validation error. * * Validator is applied to the ClrDaterangepickerDirective with `min` attribute. * Or when set manually with `clrDaterangeMin` attribute. * * Validator is active by default when applied. It can be disabled with: `[clrDaterangeMin]="false"` */ export declare class ClrDaterangeMinValidator implements Validator { private readonly daterangeService; /** Validation error name. */ static readonly validationErrorName = "min"; private _active; constructor(daterangeService: DaterangeService); /** * Disable validator by setting value to `false`. */ set active(active: boolean | string | undefined | null); /** * Validator method. Method that performs synchronous validation against the provided control. * @param control - The control to validate against. * @returns A map of validation errors if validation fails, otherwise null. */ validate(control: AbstractControl<NullableDaterange, any>): ValidationErrors | null; static ɵfac: i0.ɵɵFactoryDeclaration<ClrDaterangeMinValidator, [{ optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<ClrDaterangeMinValidator, "[clrDaterangepicker][min], [clrDaterangeMin]", never, { "active": { "alias": "clrDaterangeMin"; "required": false; }; }, {}, never, never, false, never>; }