import { AfterViewInit, ChangeDetectorRef, ComponentFactoryResolver, ElementRef, EventEmitter, Injector, NgZone, OnChanges, OnDestroy, OnInit, ViewContainerRef } from '@angular/core'; import { Observable, Subject } from 'rxjs'; import { BooleanInput } from '../util/boolean-property'; import { UsaCalendar, UsaCalendarHeader } from './calendar/calendar'; import { UsaCalendarUserEvent, UsaCalendarCellClassFunction } from './calendar/calendar-body'; import { DateAdapter } from './dateadapter/date-adapter'; import { UsaDateRangeSelectionStrategy } from './date-range-selection-strategy'; import { DateRange, ExtractDateTypeFromSelection, UsaDateSelectionModel } from './date-selection-model'; import { DateFilterFn } from './date-picker-input-base'; import * as i0 from "@angular/core"; /** Possible positions for the datePicker dropdown along the X axis. */ export type DatePickerDropdownPositionX = 'start' | 'end'; /** Possible positions for the datePicker dropdown along the Y axis. */ export type DatePickerDropdownPositionY = 'above' | 'below'; export interface UsaDatePickerControl { getStartValue(): D | null; min: D | null; max: D | null; disabled: boolean; dateFilter: DateFilterFn; getConnectedOverlayOrigin(): ElementRef; getOverlayLabelId(): string | null; stateChanges: Observable; } /** A datePicker that can be attached to a {@link UsaDatePickerControl}. */ export interface UsaDatePickerPanel, S, D = ExtractDateTypeFromSelection> { /** Stream that emits whenever the date picker is closed. */ closedStream: EventEmitter; /** The input element the datePicker is associated with. */ datePickerInput: C; /** Whether the datePicker pop-up should be disabled. */ disabled: boolean; /** The id for the datePicker's calendar. */ id: string; /** Whether the datePicker is open. */ opened: boolean; /** Stream that emits whenever the date picker is opened. */ openedStream: EventEmitter; /** Emits when the datePicker's state changes. */ stateChanges: Subject; /** Opens the date picker. */ open(): void; /** Closes the date picker */ close(): void; /** Register an input with the datePicker. */ registerInput(input: C): UsaDateSelectionModel; } /** * Component used as the content for the datePicker display. We use this instead of using * UsaCalendar directly as the content so we can control the initial focus. This also gives us a * place to put additional features of the display that are not part of the calendar itself in the * future. (e.g. confirmation buttons). * @docs-private */ export declare class UsaDatePickerContent> implements OnInit, AfterViewInit, OnDestroy { private _changeDetectorRef; private _globalModel; private _dateAdapter; private _zone; private _el; private _rangeSelectionStrategy; private _subscriptions; private _model; /** Reference to the internal calendar component. */ _calendar: UsaCalendar; /** Reference to the datePicker that created the overlay. */ datePicker: UsaDatePickerBase; /** Start of the comparison range. */ comparisonStart: D | null; /** End of the comparison range. */ comparisonEnd: D | null; /** Whether the datePicker is above or below the input. */ _isAbove: boolean; /** Text for the close button. */ _closeButtonText: string; /** Whether the close button currently has focus. */ _closeButtonFocused: boolean; /** Keeps track of last click and indicates whether it was inside the calender or outside */ private wasInside; clickInside(): void; clickout(): void; onKeydownHandler(event: KeyboardEvent): void; constructor(_changeDetectorRef: ChangeDetectorRef, _globalModel: UsaDateSelectionModel, _dateAdapter: DateAdapter, _zone: NgZone, _el: ElementRef, _rangeSelectionStrategy: UsaDateRangeSelectionStrategy); ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; _handleUserSelection(event: UsaCalendarUserEvent): void; _getSelected(): D | DateRange; /** Applies the current pending selection to the global model. */ _applyPendingSelection(): void; static ɵfac: i0.ɵɵFactoryDeclaration, [null, null, null, null, null, { optional: true; }]>; static ɵcmp: i0.ɵɵComponentDeclaration, "usa-date-picker-content", ["usaDatePickerContent"], {}, {}, never, never, false, never>; } /** Base class for a datePicker. */ export declare abstract class UsaDatePickerBase, S, D = ExtractDateTypeFromSelection> implements UsaDatePickerPanel, OnDestroy, OnChanges { private _injector; private _vcr; private _cfr; private _el; private _dateAdapter; private _model; private _inputStateChanges; /** An input indicating the type of the custom header component for the calendar, if set. */ calendarHeaderComponent: UsaCalendarHeader; /** The date to open the calendar to initially. */ get startAt(): D | null; set startAt(value: D | null); private _startAt; /** The view that the calendar should start in. */ startView: 'month' | 'year' | 'multi-year'; /** Whether the datePicker pop-up should be disabled. */ get disabled(): boolean; set disabled(value: boolean); private _disabled; /** * Whether to restore focus to the datePicker input when the calendar is closed. * Note that automatic focus restoration is an accessibility feature and it is recommended that * you provide your own equivalent, if you decide to turn it off. */ get restoreFocus(): boolean; set restoreFocus(value: boolean); private _restoreFocus; /** * Emits selected year in multiyear view. * This doesn't imply a change on the selected date. */ readonly yearSelected: EventEmitter; /** * Emits selected month in year view. * This doesn't imply a change on the selected date. */ readonly monthSelected: EventEmitter; /** Function that can be used to add custom CSS classes to dates. */ dateClass: UsaCalendarCellClassFunction; /** Emits when the datePicker has been opened. */ readonly openedStream: EventEmitter; /** Emits when the datePicker has been closed. */ readonly closedStream: EventEmitter; /** * Classes to be passed to the date picker panel. * Supports string and string array values, similar to `ngClass`. */ get panelClass(): string | string[]; set panelClass(value: string | string[]); private _panelClass; /** Whether the calendar is open. */ get opened(): boolean; set opened(value: boolean); private _opened; /** The id for the datePicker calendar. */ id: string; /** The minimum selectable date. */ _getMinDate(): D | null; /** The maximum selectable date. */ _getMaxDate(): D | null; _getDateFilter(): DateFilterFn; /** Reference to the component instance rendered in the overlay. */ private _componentRef; /** The element that was focused before the datepicker was opened. */ private _focusedElementBeforeOpen; /** The input element this datePicker is associated with. */ datePickerInput: C; /** Emits when the datePicker's state changes. */ readonly stateChanges: Subject; constructor(_dialog: any, _injector: Injector, _vcr: ViewContainerRef, _cfr: ComponentFactoryResolver, _el: ElementRef, _dateAdapter: DateAdapter, /** * @deprecated No longer being used. To be removed. * @breaking-change 13.0.0 */ _document: any, _model: UsaDateSelectionModel); ngOnChanges(): void; ngOnDestroy(): void; /** Selects the given date */ select(date: D): void; /** Emits the selected year in multiyear view */ _selectYear(normalizedYear: D): void; /** Emits selected month in year view */ _selectMonth(normalizedMonth: D): void; /** * Register an input with this datePicker. * @param input The datePicker input to register with this datePicker. * @returns Selection model that the input should hook itself up to. */ registerInput(input: C): UsaDateSelectionModel; /** Open the calendar. */ open(): void; /** Close the calendar. */ close(): void; /** Applies the current pending selection on the overlay to the model. */ _applyPendingSelection(): void; /** Forwards relevant values from the datePicker to the datePicker content inside the overlay. */ protected _forwardContentValues(instance: UsaDatePickerContent): void; /** Opens the overlay with the calendar. */ private _openOverlay; /** Destroys the current overlay. */ private _destroyOverlay; /** * Finds closest ancestor element with the given class * @param element - The element to start searching from - this element will be exempt from the search * @param cls - The class string to search for * @returns Either root element if not found or the queried element */ private findAncestor; static ngAcceptInputType_disabled: BooleanInput; static ngAcceptInputType_opened: BooleanInput; static ngAcceptInputType_restoreFocus: BooleanInput; static ɵfac: i0.ɵɵFactoryDeclaration, [null, null, null, null, null, { optional: true; }, { optional: true; }, null]>; static ɵdir: i0.ɵɵDirectiveDeclaration, never, never, { "calendarHeaderComponent": { "alias": "calendarHeaderComponent"; "required": false; }; "startAt": { "alias": "startAt"; "required": false; }; "startView": { "alias": "startView"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; }; "dateClass": { "alias": "dateClass"; "required": false; }; "panelClass": { "alias": "panelClass"; "required": false; }; "opened": { "alias": "opened"; "required": false; }; }, { "yearSelected": "yearSelected"; "monthSelected": "monthSelected"; "openedStream": "opened"; "closedStream": "closed"; }, never, never, false, never>; }