@porscheinformatik/clr-addons
Version:
Addon components for Clarity Angular
31 lines (30 loc) • 1.64 kB
TypeScript
import { AbstractControl, ValidationErrors, Validator } from '@angular/forms';
import { NullableDaterange } from '../interfaces/daterange.interface';
import { NullableTimerange } from '../interfaces/timerange.interface';
import * as i0 from "@angular/core";
/**
* Validator for daterangepicker to validate that 'from' date is before 'to' date.
* Otherwise will throw `fromIsAfterTo` validation error.
*
* This validator is applied automatically on ClrDaterangepickerDirective.
* Or when set manually with `clrDaterangeOrder` attribute.
*
* Validator is active by default when applied. It can be disabled with: `[clrDaterangeOrder]="false"`
*/
export declare class ClrDaterangeOrderValidator implements Validator {
/** Validation error name. */
static readonly validationErrorName = "fromIsAfterTo";
private _active;
/**
* 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 | NullableTimerange, any>): ValidationErrors | null;
static ɵfac: i0.ɵɵFactoryDeclaration<ClrDaterangeOrderValidator, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<ClrDaterangeOrderValidator, "[clrDaterangepicker], [clrDaterangeOrder]", never, { "active": { "alias": "clrDaterangeOrder"; "required": false; }; }, {}, never, never, false, never>;
}