import * as i0 from '@angular/core'; import { EventEmitter, AfterViewInit, ElementRef, QueryList } from '@angular/core'; import * as rxjs from 'rxjs'; import { InputControlDirective, CustomFormControl } from '@odx/angular/cdk/custom-form-control'; import { DateRange, DateFilter } from '@odx/angular/components/calendar'; import { DropdownDirective } from '@odx/angular/components/dropdown'; import { Position } from '@odx/angular/utils'; import * as i1 from '@odx/angular'; import { ReadonlyController } from '@odx/angular'; import * as i2 from 'ngx-mask'; import { NgxMaskDirective } from 'ngx-mask'; import { FormControl } from '@angular/forms'; /** * Enhances an input element to support date range picking, applying an input mask for date formatting * and managing focus events. This directive is typically used within a date range picker to provide * consistent and configurable input behavior. Extends the `InputControlDirective` to provide form control. * Has host directive `WithTabIndex` to manage the tab index attribute of the input element. * * @see {InputControlDirective} */ declare class DaterangepickerInputControlDirective extends InputControlDirective { protected readonly readonlyController: ReadonlyController | null; protected readonly config: { inputDateOrder: string; inputDateSeparator: string; }; readonly ngxMaskDirective: NgxMaskDirective; /** * Emits an event when the input gains or loses focus, facilitating external event handling. * * @emits {boolean} - Indicates whether the input is focused. */ focused: EventEmitter; /** * Converts the current input value to a Date object based on the configuration's date format. * * @returns {Date | null} The parsed date object or null if the input does not represent a valid date. */ get valueAsDate(): Date | null; /** * Provides the placeholder text for the input, typically the date format in uppercase. * * @returns {string} The placeholder text for the input. */ get placeholder(): string; protected handleFocusIn(): void; protected handleFocusOut(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * A component for selecting a date range, integrated with dropdowns and input fields for start and end dates. * It supports custom configurations for minimum, maximum dates, and date filters. The component also handles * the dropdown's behavior for date selection and applies date formats automatically based on configuration. * The component extends the `CustomFormControl` class to provide form control functionality. * * @see {CustomFormControl} */ declare class DaterangepickerComponent extends CustomFormControl implements AfterViewInit { protected readonly takeUntilDestroyed: () => rxjs.MonoTypeOperatorFunction; protected readonly config: { inputDateOrder: string; inputDateSeparator: string; }; readonly element: ElementRef; /** * Indicates whether the dropdown part of the date range picker is open. * * @type {boolean} */ get isOpen(): boolean; /** * Represents today's date, used for default selections and validations. * * @type {Date} */ today: Date; /** * A function that defines additional rules for disabled dates within the picker. * * @type {DateFilter | null} * @default null * * @example * ```ts * // Disables all Wednesdays in the picker. * const filterFn: DateFilter = (date: Date) => date.getDay() !== 3; * ``` */ filterFn: DateFilter | null; /** * The earliest date that can be selected in the picker. * * @type {Date | null} * @default null */ minDate: Date | null; /** * The latest date that can be selected in the picker. * * @type {Date | null} * @default null */ maxDate: Date | null; /** * Position of the dropdown relative to the input fields. * * @type {Position} * @default Position.BOTTOM */ dropdownPosition: Position; /** * When set to true, the select will display a reset button. * * @type {boolean} * @default false */ clearable: i0.InputSignalWithTransform; /** * Emits the selected date range when it changes. * * @emits {DateRange} */ selectedChange: EventEmitter; /** * Emits on every calendar click, including partial selections (`end: null` until the range is completed). * * @emits {DateRange} */ rangeInputChange: i0.OutputEmitterRef; /** * Directive managing the dropdown functionality. * * @type {DropdownDirective} */ dropdown: DropdownDirective; /** * Reference to the element triggering the dropdown. * * @type {ElementRef} */ dropdownTriggerElement: ElementRef; /** * Query list of the input controls within the date range picker. * * @type {QueryList} */ dateFields: QueryList; /** * Reference to the element mirroring the start date input field. * * @type {ElementRef} */ startDateMirror: ElementRef; /** * Reference to the element mirroring the end date input field. * * @type {ElementRef} */ endDateMirror: ElementRef; /** * The input control for the start date. * * @type {DaterangepickerInputControlDirective | undefined} */ get startDateField(): DaterangepickerInputControlDirective | undefined; /** * The input control for the end date. * * @type {DaterangepickerInputControlDirective | undefined} */ get endDateField(): DaterangepickerInputControlDirective | undefined; constructor(); ngAfterViewInit(): void; /** * Selects a date range, updates the form value, and emits the selected range. * * @param {DateRange | null} value - The date range to select. */ selectDateRange(value: DateRange | null): void; /** * Resets the daterangepicker's value to an empty date range (both start and end as null). */ reset(): void; /** * @internal * Writes a new value to the element. * Part of the ControlValueAccessor interface. * @param {DateRange | null} value - The new date range value. */ writeValue(value: DateRange | null): void; /** * Opens the date range picker dropdown. * * @param {KeyboardEvent} event */ openDaterangepicker(event?: Event): void; protected isEmpty(value: DateRange | null): boolean; protected updateInternalValue(value: DateRange): void; protected handleDateFieldChanges(): void; protected updateWidth(target: DaterangepickerInputControlDirective | undefined, source: ElementRef, value?: string): void; protected handleDateFieldFocus(): void; private updateStartDateField; private updateEndDateField; private updateInputFields; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * A validation directive to be used with date range picker controls. This validator ensures that the date range * selected is valid, meaning the start date must occur on or before the end date. If the date range is invalid, * this validator will provide a validation error that can be used to display an appropriate message or to style * the form control. * * The validator is designed to be used with form controls that manage `DateRange` objects in Angular forms. */ declare class DaterangepickerRangeValidator { /** * Performs the validation check on the form control's value. * * @param {FormControl} control - The form control instance associated with the date range input. * @returns {ValidationErrors | null} An object expressing validation errors if the range is invalid, * or null if the range is valid. The object returned in case of a validation error is `{ invalidRange: true }`. */ validate({ value }: FormControl): false | { invalidRange: boolean; } | null; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * A validation directive to ensure that both start and end dates are provided for a date range picker. * This validator is essential for forms where the date range is a required field. It checks that both the * start and end date values exist in the date range object. If one or both dates are missing, it flags the * form control as having a validation error. */ declare class DaterangepickerRequiredValidator { /** * Validates the form control associated with the date range input. * Checks if both start and end dates are present. If either is missing, it returns a validation error. * * @param {FormControl} control - The form control instance that contains the date range value. * @returns {ValidationErrors | null} An object expressing validation errors if the range is incomplete, * or null if the range is fully specified. If validation fails, the object returned is `{ required: true }`. */ validate({ value }: FormControl): false | { required: boolean; }; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class DaterangepickerModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } export { DaterangepickerComponent, DaterangepickerInputControlDirective, DaterangepickerModule, DaterangepickerRangeValidator, DaterangepickerRequiredValidator };