UNPKG

@angular/material

Version:
1,079 lines (1,023 loc) 86.1 kB
import { _AbstractConstructor } from '@angular/material/core'; import { AbstractControl } from '@angular/forms'; import { AfterContentInit } from '@angular/core'; import { AfterViewChecked } from '@angular/core'; import { AfterViewInit } from '@angular/core'; import { AnimationTriggerMetadata } from '@angular/animations'; import { BooleanInput } from '@angular/cdk/coercion'; import { CanColor } from '@angular/material/core'; import { CanUpdateErrorState } from '@angular/material/core'; import { ChangeDetectorRef } from '@angular/core'; import { ComponentType } from '@angular/cdk/portal'; import { _Constructor } from '@angular/material/core'; import { ControlContainer } from '@angular/forms'; import { ControlValueAccessor } from '@angular/forms'; import { DateAdapter } from '@angular/material/core'; import { Directionality } from '@angular/cdk/bidi'; import { DoCheck } from '@angular/core'; import { ElementRef } from '@angular/core'; import { ErrorStateMatcher } from '@angular/material/core'; import { EventEmitter } from '@angular/core'; import { FactoryProvider } from '@angular/core'; import { FocusOrigin } from '@angular/cdk/a11y'; import { FormGroupDirective } from '@angular/forms'; import * as i0 from '@angular/core'; import * as i14 from '@angular/common'; import * as i15 from '@angular/material/button'; import * as i16 from '@angular/cdk/overlay'; import * as i17 from '@angular/cdk/a11y'; import * as i18 from '@angular/cdk/portal'; import * as i19 from '@angular/material/core'; import * as i20 from '@angular/cdk/scrolling'; import { InjectionToken } from '@angular/core'; import { Injector } from '@angular/core'; import { MatButton } from '@angular/material/button'; import { MatDateFormats } from '@angular/material/core'; import { MatFormField } from '@angular/material/form-field'; import { MatFormFieldControl } from '@angular/material/form-field'; import { NgControl } from '@angular/forms'; import { NgForm } from '@angular/forms'; import { NgZone } from '@angular/core'; import { Observable } from 'rxjs'; import { OnChanges } from '@angular/core'; import { OnDestroy } from '@angular/core'; import { OnInit } from '@angular/core'; import { Overlay } from '@angular/cdk/overlay'; import { Portal } from '@angular/cdk/portal'; import { ScrollStrategy } from '@angular/cdk/overlay'; import { SimpleChanges } from '@angular/core'; import { Subject } from 'rxjs'; import { TemplatePortal } from '@angular/cdk/portal'; import { TemplateRef } from '@angular/core'; import { ThemePalette } from '@angular/material/core'; import { ValidationErrors } from '@angular/forms'; import { Validator } from '@angular/forms'; import { ValidatorFn } from '@angular/forms'; import { ViewContainerRef } from '@angular/core'; /** Function that can be used to filter out dates from a calendar. */ export declare type DateFilterFn<D> = (date: D | null) => boolean; /** Possible positions for the datepicker dropdown along the X axis. */ export declare type DatepickerDropdownPositionX = 'start' | 'end'; /** Possible positions for the datepicker dropdown along the Y axis. */ export declare type DatepickerDropdownPositionY = 'above' | 'below'; /** A class representing a range of dates. */ export declare class DateRange<D> { /** The start date of the range. */ readonly start: D | null; /** The end date of the range. */ readonly end: D | null; /** * Ensures that objects with a `start` and `end` property can't be assigned to a variable that * expects a `DateRange` */ private _disableStructuralEquivalency; constructor( /** The start date of the range. */ start: D | null, /** The end date of the range. */ end: D | null); } /** * Event emitted by the date selection model when its selection changes. * @docs-private */ export declare interface DateSelectionModelChange<S> { /** New value for the selection. */ selection: S; /** Object that triggered the change. */ source: unknown; /** Previous value */ oldValue?: S; } /** Provides the default date range selection behavior. */ export declare class DefaultMatCalendarRangeStrategy<D> implements MatDateRangeSelectionStrategy<D> { private _dateAdapter; constructor(_dateAdapter: DateAdapter<D>); selectionFinished(date: D, currentRange: DateRange<D>): DateRange<D>; createPreview(activeDate: D | null, currentRange: DateRange<D>): DateRange<D>; static ɵfac: i0.ɵɵFactoryDeclaration<DefaultMatCalendarRangeStrategy<any>, never>; static ɵprov: i0.ɵɵInjectableDeclaration<DefaultMatCalendarRangeStrategy<any>>; } /** * Conditionally picks the date type, if a DateRange is passed in. * @docs-private */ export declare type ExtractDateTypeFromSelection<T> = T extends DateRange<infer D> ? D : NonNullable<T>; /** * When the multi-year view is first opened, the active year will be in view. * So we compute how many years are between the active year and the *slot* where our * "startingYear" will render when paged into view. */ declare function getActiveOffset<D>(dateAdapter: DateAdapter<D>, activeDate: D, minDate: D | null, maxDate: D | null): number; declare namespace i1 { export { MatCalendarView, MatCalendarHeader, MatCalendar } } declare namespace i10 { export { MatDateRangeInput } } declare namespace i11 { export { MatDateRangeInputParent, MAT_DATE_RANGE_INPUT_PARENT, MatStartDate, MatEndDate } } declare namespace i12 { export { MatDateRangePickerInput, MatDateRangePicker } } declare namespace i13 { export { MatDatepickerApply, MatDatepickerCancel, MatDatepickerActions } } declare namespace i2 { export { MatCalendarCellCssClasses, MatCalendarCellClassFunction, MatCalendarCell, MatCalendarUserEvent, MatCalendarBody } } declare namespace i3 { export { MatDatepicker } } declare namespace i4 { export { MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY, MAT_DATEPICKER_SCROLL_STRATEGY, DatepickerDropdownPositionX, DatepickerDropdownPositionY, MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MatDatepickerContent, MatDatepickerControl, MatDatepickerPanel, MatDatepickerBase } } declare namespace i5 { export { MAT_DATEPICKER_VALUE_ACCESSOR, MAT_DATEPICKER_VALIDATORS, MatDatepickerInput } } declare namespace i6 { export { MatDatepickerToggleIcon, MatDatepickerToggle } } declare namespace i7 { export { MatMonthView } } declare namespace i8 { export { MatYearView } } declare namespace i9 { export { isSameMultiYearView, getActiveOffset, yearsPerPage, yearsPerRow, MatMultiYearView } } declare function isSameMultiYearView<D>(dateAdapter: DateAdapter<D>, date1: D, date2: D, minDate: D | null, maxDate: D | null): boolean; /** * Used to provide the date range input wrapper component * to the parts without circular dependencies. */ declare const MAT_DATE_RANGE_INPUT_PARENT: InjectionToken<MatDateRangeInputParent<unknown>>; /** Injection token used to customize the date range selection behavior. */ export declare const MAT_DATE_RANGE_SELECTION_STRATEGY: InjectionToken<MatDateRangeSelectionStrategy<any>>; /** Injection token that determines the scroll handling while the calendar is open. */ export declare const MAT_DATEPICKER_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>; /** @docs-private */ export declare function MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY(overlay: Overlay): () => ScrollStrategy; /** @docs-private */ export declare const MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER: { provide: InjectionToken<() => ScrollStrategy>; deps: (typeof Overlay)[]; useFactory: typeof MAT_DATEPICKER_SCROLL_STRATEGY_FACTORY; }; /** @docs-private */ export declare const MAT_DATEPICKER_VALIDATORS: any; /** @docs-private */ export declare const MAT_DATEPICKER_VALUE_ACCESSOR: any; /** @docs-private */ export declare function MAT_RANGE_DATE_SELECTION_MODEL_FACTORY(parent: MatSingleDateSelectionModel<unknown>, adapter: DateAdapter<unknown>): MatSingleDateSelectionModel<unknown>; /** * Used to provide a range selection model to a component. * @docs-private */ export declare const MAT_RANGE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider; /** @docs-private */ export declare function MAT_SINGLE_DATE_SELECTION_MODEL_FACTORY(parent: MatSingleDateSelectionModel<unknown>, adapter: DateAdapter<unknown>): MatSingleDateSelectionModel<unknown>; /** * Used to provide a single selection model to a component. * @docs-private */ export declare const MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER: FactoryProvider; /** A calendar that is used as part of the datepicker. */ export declare class MatCalendar<D> implements AfterContentInit, AfterViewChecked, OnDestroy, OnChanges { private _dateAdapter; private _dateFormats; private _changeDetectorRef; /** An input indicating the type of the header component, if set. */ headerComponent: ComponentType<any>; /** A portal containing the header component type for this calendar. */ _calendarHeaderPortal: Portal<any>; private _intlChanges; /** * Used for scheduling that focus should be moved to the active cell on the next tick. * We need to schedule it, rather than do it immediately, because we have to wait * for Angular to re-evaluate the view children. */ private _moveFocusOnNextTick; /** A date representing the period (month or year) to start the calendar in. */ get startAt(): D | null; set startAt(value: D | null); private _startAt; /** Whether the calendar should be started in month or year view. */ startView: MatCalendarView; /** The currently selected date. */ get selected(): DateRange<D> | D | null; set selected(value: DateRange<D> | D | null); private _selected; /** The minimum selectable date. */ get minDate(): D | null; set minDate(value: D | null); private _minDate; /** The maximum selectable date. */ get maxDate(): D | null; set maxDate(value: D | null); private _maxDate; /** Function used to filter which dates are selectable. */ dateFilter: (date: D) => boolean; /** Function that can be used to add custom CSS classes to dates. */ dateClass: MatCalendarCellClassFunction<D>; /** Start of the comparison range. */ comparisonStart: D | null; /** End of the comparison range. */ comparisonEnd: D | null; /** Emits when the currently selected date changes. */ readonly selectedChange: EventEmitter<D | null>; /** * Emits the year chosen in multiyear view. * This doesn't imply a change on the selected date. */ readonly yearSelected: EventEmitter<D>; /** * Emits the month chosen in year view. * This doesn't imply a change on the selected date. */ readonly monthSelected: EventEmitter<D>; /** * Emits when the current view changes. */ readonly viewChanged: EventEmitter<MatCalendarView>; /** Emits when any date is selected. */ readonly _userSelection: EventEmitter<MatCalendarUserEvent<D | null>>; /** Reference to the current month view component. */ monthView: MatMonthView<D>; /** Reference to the current year view component. */ yearView: MatYearView<D>; /** Reference to the current multi-year view component. */ multiYearView: MatMultiYearView<D>; /** * The current active date. This determines which time period is shown and which date is * highlighted when using keyboard navigation. */ get activeDate(): D; set activeDate(value: D); private _clampedActiveDate; /** Whether the calendar is in month view. */ get currentView(): MatCalendarView; set currentView(value: MatCalendarView); private _currentView; /** * Emits whenever there is a state change that the header may need to respond to. */ readonly stateChanges: Subject<void>; constructor(_intl: MatDatepickerIntl, _dateAdapter: DateAdapter<D>, _dateFormats: MatDateFormats, _changeDetectorRef: ChangeDetectorRef); ngAfterContentInit(): void; ngAfterViewChecked(): void; ngOnDestroy(): void; ngOnChanges(changes: SimpleChanges): void; /** Focuses the active date. */ focusActiveCell(): void; /** Updates today's date after an update of the active date */ updateTodaysDate(): void; /** Handles date selection in the month view. */ _dateSelected(event: MatCalendarUserEvent<D | null>): void; /** Handles year selection in the multiyear view. */ _yearSelectedInMultiYearView(normalizedYear: D): void; /** Handles month selection in the year view. */ _monthSelectedInYearView(normalizedMonth: D): void; /** Handles year/month selection in the multi-year/year views. */ _goToDateInView(date: D, view: 'month' | 'year' | 'multi-year'): void; /** Returns the component instance that corresponds to the current calendar view. */ private _getCurrentViewComponent; static ɵfac: i0.ɵɵFactoryDeclaration<MatCalendar<any>, [null, { optional: true; }, { optional: true; }, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<MatCalendar<any>, "mat-calendar", ["matCalendar"], { "headerComponent": "headerComponent"; "startAt": "startAt"; "startView": "startView"; "selected": "selected"; "minDate": "minDate"; "maxDate": "maxDate"; "dateFilter": "dateFilter"; "dateClass": "dateClass"; "comparisonStart": "comparisonStart"; "comparisonEnd": "comparisonEnd"; }, { "selectedChange": "selectedChange"; "yearSelected": "yearSelected"; "monthSelected": "monthSelected"; "viewChanged": "viewChanged"; "_userSelection": "_userSelection"; }, never, never, false>; } /** * An internal component used to display calendar data in a table. * @docs-private */ export declare class MatCalendarBody implements OnChanges, OnDestroy, AfterViewChecked { private _elementRef; private _ngZone; /** * Used to skip the next focus event when rendering the preview range. * We need a flag like this, because some browsers fire focus events asynchronously. */ private _skipNextFocus; /** * Used to focus the active cell after change detection has run. */ private _focusActiveCellAfterViewChecked; /** The label for the table. (e.g. "Jan 2017"). */ label: string; /** The cells to display in the table. */ rows: MatCalendarCell[][]; /** The value in the table that corresponds to today. */ todayValue: number; /** Start value of the selected date range. */ startValue: number; /** End value of the selected date range. */ endValue: number; /** The minimum number of free cells needed to fit the label in the first row. */ labelMinRequiredCells: number; /** The number of columns in the table. */ numCols: number; /** The cell number of the active cell in the table. */ activeCell: number; ngAfterViewChecked(): void; /** Whether a range is being selected. */ isRange: boolean; /** * The aspect ratio (width / height) to use for the cells in the table. This aspect ratio will be * maintained even as the table resizes. */ cellAspectRatio: number; /** Start of the comparison range. */ comparisonStart: number | null; /** End of the comparison range. */ comparisonEnd: number | null; /** Start of the preview range. */ previewStart: number | null; /** End of the preview range. */ previewEnd: number | null; /** Emits when a new value is selected. */ readonly selectedValueChange: EventEmitter<MatCalendarUserEvent<number>>; /** Emits when the preview has changed as a result of a user action. */ readonly previewChange: EventEmitter<MatCalendarUserEvent<MatCalendarCell<any> | null>>; readonly activeDateChange: EventEmitter<MatCalendarUserEvent<number>>; /** The number of blank cells to put at the beginning for the first row. */ _firstRowOffset: number; /** Padding for the individual date cells. */ _cellPadding: string; /** Width of an individual cell. */ _cellWidth: string; constructor(_elementRef: ElementRef<HTMLElement>, _ngZone: NgZone); /** Called when a cell is clicked. */ _cellClicked(cell: MatCalendarCell, event: MouseEvent): void; _emitActiveDateChange(cell: MatCalendarCell, event: FocusEvent): void; /** Returns whether a cell should be marked as selected. */ _isSelected(value: number): boolean; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** Returns whether a cell is active. */ _isActiveCell(rowIndex: number, colIndex: number): boolean; /** * Focuses the active cell after the microtask queue is empty. * * Adding a 0ms setTimeout seems to fix Voiceover losing focus when pressing PageUp/PageDown * (issue #24330). * * Determined a 0ms by gradually increasing duration from 0 and testing two use cases with screen * reader enabled: * * 1. Pressing PageUp/PageDown repeatedly with pausing between each key press. * 2. Pressing and holding the PageDown key with repeated keys enabled. * * Test 1 worked roughly 95-99% of the time with 0ms and got a little bit better as the duration * increased. Test 2 got slightly better until the duration was long enough to interfere with * repeated keys. If the repeated key speed was faster than the timeout duration, then pressing * and holding pagedown caused the entire page to scroll. * * Since repeated key speed can verify across machines, determined that any duration could * potentially interfere with repeated keys. 0ms would be best because it almost entirely * eliminates the focus being lost in Voiceover (#24330) without causing unintended side effects. * Adding delay also complicates writing tests. */ _focusActiveCell(movePreview?: boolean): void; /** Focuses the active cell after change detection has run and the microtask queue is empty. */ _scheduleFocusActiveCellAfterViewChecked(): void; /** Gets whether a value is the start of the main range. */ _isRangeStart(value: number): boolean; /** Gets whether a value is the end of the main range. */ _isRangeEnd(value: number): boolean; /** Gets whether a value is within the currently-selected range. */ _isInRange(value: number): boolean; /** Gets whether a value is the start of the comparison range. */ _isComparisonStart(value: number): boolean; /** Whether the cell is a start bridge cell between the main and comparison ranges. */ _isComparisonBridgeStart(value: number, rowIndex: number, colIndex: number): boolean; /** Whether the cell is an end bridge cell between the main and comparison ranges. */ _isComparisonBridgeEnd(value: number, rowIndex: number, colIndex: number): boolean; /** Gets whether a value is the end of the comparison range. */ _isComparisonEnd(value: number): boolean; /** Gets whether a value is within the current comparison range. */ _isInComparisonRange(value: number): boolean; /** * Gets whether a value is the same as the start and end of the comparison range. * For context, the functions that we use to determine whether something is the start/end of * a range don't allow for the start and end to be on the same day, because we'd have to use * much more specific CSS selectors to style them correctly in all scenarios. This is fine for * the regular range, because when it happens, the selected styles take over and still show where * the range would've been, however we don't have these selected styles for a comparison range. * This function is used to apply a class that serves the same purpose as the one for selected * dates, but it only applies in the context of a comparison range. */ _isComparisonIdentical(value: number): boolean; /** Gets whether a value is the start of the preview range. */ _isPreviewStart(value: number): boolean; /** Gets whether a value is the end of the preview range. */ _isPreviewEnd(value: number): boolean; /** Gets whether a value is inside the preview range. */ _isInPreview(value: number): boolean; /** * Event handler for when the user enters an element * inside the calendar body (e.g. by hovering in or focus). */ private _enterHandler; /** * Event handler for when the user's pointer leaves an element * inside the calendar body (e.g. by hovering out or blurring). */ private _leaveHandler; /** Finds the MatCalendarCell that corresponds to a DOM node. */ private _getCellFromElement; static ɵfac: i0.ɵɵFactoryDeclaration<MatCalendarBody, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatCalendarBody, "[mat-calendar-body]", ["matCalendarBody"], { "label": "label"; "rows": "rows"; "todayValue": "todayValue"; "startValue": "startValue"; "endValue": "endValue"; "labelMinRequiredCells": "labelMinRequiredCells"; "numCols": "numCols"; "activeCell": "activeCell"; "isRange": "isRange"; "cellAspectRatio": "cellAspectRatio"; "comparisonStart": "comparisonStart"; "comparisonEnd": "comparisonEnd"; "previewStart": "previewStart"; "previewEnd": "previewEnd"; }, { "selectedValueChange": "selectedValueChange"; "previewChange": "previewChange"; "activeDateChange": "activeDateChange"; }, never, never, false>; } /** * An internal class that represents the data corresponding to a single calendar cell. * @docs-private */ export declare class MatCalendarCell<D = any> { value: number; displayValue: string; ariaLabel: string; enabled: boolean; cssClasses: MatCalendarCellCssClasses; compareValue: number; rawValue?: D | undefined; constructor(value: number, displayValue: string, ariaLabel: string, enabled: boolean, cssClasses?: MatCalendarCellCssClasses, compareValue?: number, rawValue?: D | undefined); } /** Function that can generate the extra classes that should be added to a calendar cell. */ export declare type MatCalendarCellClassFunction<D> = (date: D, view: 'month' | 'year' | 'multi-year') => MatCalendarCellCssClasses; /** Extra CSS classes that can be associated with a calendar cell. */ export declare type MatCalendarCellCssClasses = string | string[] | Set<string> | { [key: string]: any; }; /** Default header for MatCalendar */ export declare class MatCalendarHeader<D> { private _intl; calendar: MatCalendar<D>; private _dateAdapter; private _dateFormats; _buttonDescriptionId: string; constructor(_intl: MatDatepickerIntl, calendar: MatCalendar<D>, _dateAdapter: DateAdapter<D>, _dateFormats: MatDateFormats, changeDetectorRef: ChangeDetectorRef); /** The label for the current calendar view. */ get periodButtonText(): string; get periodButtonLabel(): string; /** The label for the previous button. */ get prevButtonLabel(): string; /** The label for the next button. */ get nextButtonLabel(): string; /** Handles user clicks on the period label. */ currentPeriodClicked(): void; /** Handles user clicks on the previous button. */ previousClicked(): void; /** Handles user clicks on the next button. */ nextClicked(): void; /** Whether the previous period button is enabled. */ previousEnabled(): boolean; /** Whether the next period button is enabled. */ nextEnabled(): boolean; /** Whether the two dates represent the same view in the current view mode (month or year). */ private _isSameView; static ɵfac: i0.ɵɵFactoryDeclaration<MatCalendarHeader<any>, [null, null, { optional: true; }, { optional: true; }, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<MatCalendarHeader<any>, "mat-calendar-header", ["matCalendarHeader"], {}, {}, never, ["*"], false>; } /** Event emitted when a date inside the calendar is triggered as a result of a user action. */ export declare interface MatCalendarUserEvent<D> { value: D; event: Event; } /** * Possible views for the calendar. * @docs-private */ export declare type MatCalendarView = 'month' | 'year' | 'multi-year'; /** Component responsible for managing the datepicker popup/dialog. */ export declare class MatDatepicker<D> extends MatDatepickerBase<MatDatepickerControl<D>, D | null, D> { static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepicker<any>, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatDatepicker<any>, "mat-datepicker", ["matDatepicker"], {}, {}, never, never, false>; } /** * Container that can be used to project a row of action buttons * to the bottom of a datepicker or date range picker. */ export declare class MatDatepickerActions implements AfterViewInit, OnDestroy { private _datepicker; private _viewContainerRef; _template: TemplateRef<unknown>; private _portal; constructor(_datepicker: MatDatepickerBase<MatDatepickerControl<any>, unknown>, _viewContainerRef: ViewContainerRef); ngAfterViewInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerActions, never>; static ɵcmp: i0.ɵɵComponentDeclaration<MatDatepickerActions, "mat-datepicker-actions, mat-date-range-picker-actions", never, {}, {}, never, ["*"], false>; } /** * Animations used by the Material datepicker. * @docs-private */ export declare const matDatepickerAnimations: { readonly transformPanel: AnimationTriggerMetadata; readonly fadeInCalendar: AnimationTriggerMetadata; }; /** Button that will close the datepicker and assign the current selection to the data model. */ export declare class MatDatepickerApply { private _datepicker; constructor(_datepicker: MatDatepickerBase<MatDatepickerControl<any>, unknown>); _applySelection(): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerApply, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatDatepickerApply, "[matDatepickerApply], [matDateRangePickerApply]", never, {}, {}, never, never, false>; } /** Base class for a datepicker. */ declare abstract class MatDatepickerBase<C extends MatDatepickerControl<D>, S, D = ExtractDateTypeFromSelection<S>> implements MatDatepickerPanel<C, S, D>, OnDestroy, OnChanges { private _overlay; private _ngZone; private _viewContainerRef; private _dateAdapter; private _dir; private _model; private _scrollStrategy; private _inputStateChanges; /** An input indicating the type of the custom header component for the calendar, if set. */ calendarHeaderComponent: ComponentType<any>; /** 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'; /** Color palette to use on the datepicker's calendar. */ get color(): ThemePalette; set color(value: ThemePalette); _color: ThemePalette; /** * Whether the calendar UI is in touch mode. In touch mode the calendar opens in a dialog rather * than a dropdown and elements have more padding to allow for bigger touch targets. */ get touchUi(): boolean; set touchUi(value: BooleanInput); private _touchUi; /** Whether the datepicker pop-up should be disabled. */ get disabled(): boolean; set disabled(value: BooleanInput); private _disabled; /** Preferred position of the datepicker in the X axis. */ xPosition: DatepickerDropdownPositionX; /** Preferred position of the datepicker in the Y axis. */ yPosition: DatepickerDropdownPositionY; /** * Whether to restore focus to the previously-focused element 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: BooleanInput); private _restoreFocus; /** * Emits selected year in multiyear view. * This doesn't imply a change on the selected date. */ readonly yearSelected: EventEmitter<D>; /** * Emits selected month in year view. * This doesn't imply a change on the selected date. */ readonly monthSelected: EventEmitter<D>; /** * Emits when the current view changes. */ readonly viewChanged: EventEmitter<MatCalendarView>; /** Function that can be used to add custom CSS classes to dates. */ dateClass: MatCalendarCellClassFunction<D>; /** Emits when the datepicker has been opened. */ readonly openedStream: EventEmitter<void>; /** Emits when the datepicker has been closed. */ readonly closedStream: EventEmitter<void>; /** * 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: BooleanInput); 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<D>; /** A reference to the overlay into which we've rendered the calendar. */ private _overlayRef; /** Reference to the component instance rendered in the overlay. */ private _componentRef; /** The element that was focused before the datepicker was opened. */ private _focusedElementBeforeOpen; /** Unique class that will be added to the backdrop so that the test harnesses can look it up. */ private _backdropHarnessClass; /** Currently-registered actions portal. */ private _actionsPortal; /** The input element this datepicker is associated with. */ datepickerInput: C; /** Emits when the datepicker's state changes. */ readonly stateChanges: Subject<void>; constructor(_overlay: Overlay, _ngZone: NgZone, _viewContainerRef: ViewContainerRef, scrollStrategy: any, _dateAdapter: DateAdapter<D>, _dir: Directionality, _model: MatDateSelectionModel<S, D>); ngOnChanges(changes: SimpleChanges): 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; /** Emits changed view */ _viewChanged(view: MatCalendarView): 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): MatDateSelectionModel<S, D>; /** * Registers a portal containing action buttons with the datepicker. * @param portal Portal to be registered. */ registerActions(portal: TemplatePortal): void; /** * Removes a portal containing action buttons from the datepicker. * @param portal Portal to be removed. */ removeActions(portal: TemplatePortal): void; /** 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: MatDatepickerContent<S, D>): void; /** Opens the overlay with the calendar. */ private _openOverlay; /** Destroys the current overlay. */ private _destroyOverlay; /** Gets a position strategy that will open the calendar as a dropdown. */ private _getDialogStrategy; /** Gets a position strategy that will open the calendar as a dropdown. */ private _getDropdownStrategy; /** Sets the positions of the datepicker in dropdown mode based on the current configuration. */ private _setConnectedPositions; /** Gets an observable that will emit when the overlay is supposed to be closed. */ private _getCloseStream; static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerBase<any, any, any>, [null, null, null, null, { optional: true; }, { optional: true; }, null]>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatDatepickerBase<any, any, any>, never, never, { "calendarHeaderComponent": "calendarHeaderComponent"; "startAt": "startAt"; "startView": "startView"; "color": "color"; "touchUi": "touchUi"; "disabled": "disabled"; "xPosition": "xPosition"; "yPosition": "yPosition"; "restoreFocus": "restoreFocus"; "dateClass": "dateClass"; "panelClass": "panelClass"; "opened": "opened"; }, { "yearSelected": "yearSelected"; "monthSelected": "monthSelected"; "viewChanged": "viewChanged"; "openedStream": "opened"; "closedStream": "closed"; }, never, never, false>; } /** Button that will close the datepicker and discard the current selection. */ export declare class MatDatepickerCancel { _datepicker: MatDatepickerBase<MatDatepickerControl<any>, unknown>; constructor(_datepicker: MatDatepickerBase<MatDatepickerControl<any>, unknown>); static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerCancel, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatDatepickerCancel, "[matDatepickerCancel], [matDateRangePickerCancel]", never, {}, {}, never, never, false>; } /** * Component used as the content for the datepicker overlay. We use this instead of using * MatCalendar directly as the content so we can control the initial focus. This also gives us a * place to put additional features of the overlay that are not part of the calendar itself in the * future. (e.g. confirmation buttons). * @docs-private */ export declare class MatDatepickerContent<S, D = ExtractDateTypeFromSelection<S>> extends _MatDatepickerContentBase implements OnInit, AfterViewInit, OnDestroy, CanColor { private _changeDetectorRef; private _globalModel; private _dateAdapter; private _rangeSelectionStrategy; private _subscriptions; private _model; /** Reference to the internal calendar component. */ _calendar: MatCalendar<D>; /** Reference to the datepicker that created the overlay. */ datepicker: MatDatepickerBase<any, S, D>; /** 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; /** Current state of the animation. */ _animationState: 'enter-dropdown' | 'enter-dialog' | 'void'; /** Emits when an animation has finished. */ readonly _animationDone: Subject<void>; /** Text for the close button. */ _closeButtonText: string; /** Whether the close button currently has focus. */ _closeButtonFocused: boolean; /** Portal with projected action buttons. */ _actionsPortal: TemplatePortal | null; /** Id of the label for the `role="dialog"` element. */ _dialogLabelId: string | null; constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _globalModel: MatDateSelectionModel<S, D>, _dateAdapter: DateAdapter<D>, _rangeSelectionStrategy: MatDateRangeSelectionStrategy<D>, intl: MatDatepickerIntl); ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; _handleUserSelection(event: MatCalendarUserEvent<D | null>): void; _startExitAnimation(): void; _getSelected(): D | DateRange<D> | null; /** Applies the current pending selection to the global model. */ _applyPendingSelection(): void; /** * Assigns a new portal containing the datepicker actions. * @param portal Portal with the actions to be assigned. * @param forceRerender Whether a re-render of the portal should be triggered. This isn't * necessary if the portal is assigned during initialization, but it may be required if it's * added at a later point. */ _assignActions(portal: TemplatePortal<any> | null, forceRerender: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerContent<any, any>, [null, null, null, null, { optional: true; }, null]>; static ɵcmp: i0.ɵɵComponentDeclaration<MatDatepickerContent<any, any>, "mat-datepicker-content", ["matDatepickerContent"], { "color": "color"; }, {}, never, never, false>; } /** @docs-private */ declare const _MatDatepickerContentBase: _Constructor<CanColor> & _AbstractConstructor<CanColor> & { new (_elementRef: ElementRef): { _elementRef: ElementRef; }; }; /** Form control that can be associated with a datepicker. */ declare interface MatDatepickerControl<D> { getStartValue(): D | null; getThemePalette(): ThemePalette; min: D | null; max: D | null; disabled: boolean; dateFilter: DateFilterFn<D>; getConnectedOverlayOrigin(): ElementRef; getOverlayLabelId(): string | null; stateChanges: Observable<void>; } /** Directive used to connect an input to a MatDatepicker. */ export declare class MatDatepickerInput<D> extends MatDatepickerInputBase<D | null, D> implements MatDatepickerControl<D | null>, OnDestroy { private _formField?; private _closedSubscription; /** The datepicker that this input is associated with. */ set matDatepicker(datepicker: MatDatepickerPanel<MatDatepickerControl<D>, D | null, D>); _datepicker: MatDatepickerPanel<MatDatepickerControl<D>, D | null, D>; /** The minimum valid date. */ get min(): D | null; set min(value: D | null); private _min; /** The maximum valid date. */ get max(): D | null; set max(value: D | null); private _max; /** Function that can be used to filter out dates within the datepicker. */ get dateFilter(): DateFilterFn<D | null>; set dateFilter(value: DateFilterFn<D | null>); private _dateFilter; /** The combined form control validator for this input. */ protected _validator: ValidatorFn | null; constructor(elementRef: ElementRef<HTMLInputElement>, dateAdapter: DateAdapter<D>, dateFormats: MatDateFormats, _formField?: MatFormField | undefined); /** * Gets the element that the datepicker popup should be connected to. * @return The element to connect the popup to. */ getConnectedOverlayOrigin(): ElementRef; /** Gets the ID of an element that should be used a description for the calendar overlay. */ getOverlayLabelId(): string | null; /** Returns the palette used by the input's form field, if any. */ getThemePalette(): ThemePalette; /** Gets the value at which the calendar should start. */ getStartValue(): D | null; ngOnDestroy(): void; /** Opens the associated datepicker. */ protected _openPopup(): void; protected _getValueFromModel(modelValue: D | null): D | null; protected _assignValueToModel(value: D | null): void; /** Gets the input's minimum date. */ _getMinDate(): D | null; /** Gets the input's maximum date. */ _getMaxDate(): D | null; /** Gets the input's date filtering function. */ protected _getDateFilter(): DateFilterFn<D | null>; protected _shouldHandleChangeEvent(event: DateSelectionModelChange<D>): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerInput<any>, [null, { optional: true; }, { optional: true; }, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatDatepickerInput<any>, "input[matDatepicker]", ["matDatepickerInput"], { "matDatepicker": "matDatepicker"; "min": "min"; "max": "max"; "dateFilter": "matDatepickerFilter"; }, {}, never, never, false>; } /** Base class for datepicker inputs. */ declare abstract class MatDatepickerInputBase<S, D = ExtractDateTypeFromSelection<S>> implements ControlValueAccessor, AfterViewInit, OnChanges, OnDestroy, Validator { protected _elementRef: ElementRef<HTMLInputElement>; _dateAdapter: DateAdapter<D>; private _dateFormats; /** Whether the component has been initialized. */ private _isInitialized; /** The value of the input. */ get value(): D | null; set value(value: any); protected _model: MatDateSelectionModel<S, D> | undefined; /** Whether the datepicker-input is disabled. */ get disabled(): boolean; set disabled(value: BooleanInput); private _disabled; /** Emits when a `change` event is fired on this `<input>`. */ readonly dateChange: EventEmitter<MatDatepickerInputEvent<D, S>>; /** Emits when an `input` event is fired on this `<input>`. */ readonly dateInput: EventEmitter<MatDatepickerInputEvent<D, S>>; /** Emits when the internal state has changed */ readonly stateChanges: Subject<void>; _onTouched: () => void; _validatorOnChange: () => void; private _cvaOnChange; private _valueChangesSubscription; private _localeSubscription; /** * Since the value is kept on the model which is assigned in an Input, * we might get a value before we have a model. This property keeps track * of the value until we have somewhere to assign it. */ private _pendingValue; /** The form control validator for whether the input parses. */ private _parseValidator; /** The form control validator for the date filter. */ private _filterValidator; /** The form control validator for the min date. */ private _minValidator; /** The form control validator for the max date. */ private _maxValidator; /** Gets the base validator functions. */ protected _getValidators(): ValidatorFn[]; /** Gets the minimum date for the input. Used for validation. */ abstract _getMinDate(): D | null; /** Gets the maximum date for the input. Used for validation. */ abstract _getMaxDate(): D | null; /** Gets the date filter function. Used for validation. */ protected abstract _getDateFilter(): DateFilterFn<D> | undefined; /** Registers a date selection model with the input. */ _registerModel(model: MatDateSelectionModel<S, D>): void; /** Opens the popup associated with the input. */ protected abstract _openPopup(): void; /** Assigns a value to the input's model. */ protected abstract _assignValueToModel(model: D | null): void; /** Converts a value from the model into a native value for the input. */ protected abstract _getValueFromModel(modelValue: S): D | null; /** Combined form control validator for this input. */ protected abstract _validator: ValidatorFn | null; /** Predicate that determines whether the input should handle a particular change event. */ protected abstract _shouldHandleChangeEvent(event: DateSelectionModelChange<S>): boolean; /** Whether the last value set on the input was valid. */ protected _lastValueValid: boolean; constructor(_elementRef: ElementRef<HTMLInputElement>, _dateAdapter: DateAdapter<D>, _dateFormats: MatDateFormats); ngAfterViewInit(): void; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; /** @docs-private */ registerOnValidatorChange(fn: () => void): void; /** @docs-private */ validate(c: AbstractControl): ValidationErrors | null; writeValue(value: D): void; registerOnChange(fn: (value: any) => void): void; registerOnTouched(fn: () => void): void; setDisabledState(isDisabled: boolean): void; _onKeydown(event: KeyboardEvent): void; _onInput(value: string): void; _onChange(): void; /** Handles blur events on the input. */ _onBlur(): void; /** Formats a value and sets it on the input element. */ protected _formatValue(value: D | null): void; /** Assigns a value to the model. */ private _assignValue; /** Whether a value is considered valid. */ private _isValidValue; /** * Checks whether a parent control is disabled. This is in place so that it can be overridden * by inputs extending this one which can be placed inside of a group that can be disabled. */ protected _parentDisabled(): boolean; /** Programmatically assigns a value to the input. */ protected _assignValueProgrammatically(value: D | null): void; /** Gets whether a value matches the current date filter. */ _matchesFilter(value: D | null): boolean; static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerInputBase<any, any>, [null, { optional: true; }, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<MatDatepickerInputBase<any, any>, never, never, { "value": "value"; "disabled": "disabled"; }, { "dateChange": "dateChange"; "dateInput": "dateInput"; }, never, never, false>; } /** * An event used for datepicker input and change events. We don't always have access to a native * input or change event because the event may have been triggered by the user clicking on the * calendar popup. For consistency, we always use MatDatepickerInputEvent instead. */ export declare class MatDatepickerInputEvent<D, S = unknown> { /** Reference to the datepicker input component that emitted the event. */ target: MatDatepickerInputBase<S, D>; /** Reference to the native input element associated with the datepicker input. */ targetElement: HTMLElement; /** The new value for the target datepicker input. */ value: D | null; constructor( /** Reference to the datepicker input component that emitted the event. */ target: MatDatepickerInputBase<S, D>, /** Reference to the native input element associated with the datepicker input. */ targetElement: HTMLElement); } /** Datepicker data that requires internationalization. */ export declare class MatDatepickerIntl { /** * Stream that emits whenever the labels here are changed. Use this to notify * components if the labels have changed after initialization. */ readonly changes: Subject<void>; /** A label for the calendar popup (used by screen readers). */ calendarLabel: string; /** A label for the button used to open the calendar popup (used by screen readers). */ openCalendarLabel: string; /** Label for the button used to close the calendar popup. */ closeCalendarLabel: string; /** A label for the previous month button (used by screen readers). */ prevMonthLabel: string; /** A label for the next month button (used by screen readers). */ nextMonthLabel: string; /** A label for the previous year button (used by screen readers). */ prevYearLabel: string; /** A label for the next year button (used by screen readers). */ nextYearLabel: string; /** A label for the previous multi-year button (used by screen readers). */ prevMultiYearLabel: string; /** A label for the next multi-year button (used by screen readers). */ nextMultiYearLabel: string; /** A label for the 'switch to month view' button (used by screen readers). */ switchToMonthViewLabel: string; /** A label for the 'switch to year view' button (used by screen readers). */ switchToMultiYearViewLabel: string; /** A label for the first date of a range of dates (used by screen readers). */ startDateLabel: string; /** A label for the last date of a range of dates (used by screen readers). */ endDateLabel: string; /** Formats a range of years (used for visuals). */ formatYearRange(start: string, end: string): string; /** Formats a label for a range of years (used by screen readers). */ formatYearRangeLabel(start: string, end: string): string; static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerIntl, never>; static ɵprov: i0.ɵɵInjectableDeclaration<MatDatepickerIntl>; } export declare class MatDatepickerModule { static ɵfac: i0.ɵɵFactoryDeclaration<MatDatepickerModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<MatDatepickerModule, [typeof i1.MatCalendar, typeof i2.MatCalendarBody, typeof i3.MatDatepicker, typeof i4.MatDatepickerContent, typeof i5.MatDatepickerInput, typeof i6.MatDatepickerToggle, typeof i6.MatDatepickerToggleIcon, typeof i7.MatMonthView, typeof i8.MatYearView, typeof i9.MatMultiYearView, typeof i1.MatCalendarHeader, typeof i10.MatDateRangeInput, typeof i11.MatStartDate, typeof i11.MatEndDate, typeof i12.MatDateRangePicker, typeof i13.MatDatepickerActions, typeof i13.MatDatepickerCancel, typeof i13.MatDatepickerApply], [typeof i14.CommonModule, typeof i15.MatButtonModule, typeof i16.OverlayModule, typeof i17.A11yModule, typeof i18.PortalModule, typeof i19.MatCommonModule], [typeof i20.CdkScrollableModule, typeof i1.MatCalendar, typeof i2.MatCalendarBody, typeof i3.MatDatepicker, typeof i4.MatDatepickerContent, typeof i5.MatDatepickerInput, typeof i6.MatDatepickerToggle, typeof i6.MatDatepickerToggleIcon, typeof i7.MatMonthView, typeof i8.MatYearView, typeof i9.MatMultiYearView, typeof i1.MatCalendarHeader, typeof i10.MatDateRangeInput, typeof i11.MatStartDate, typeof i11.MatEndDate, typeof i12.MatDateRangePicker, typeof i13.MatDatepickerActions, typeof i13.MatDatepickerCancel, typeof i13.MatDatepickerApply]>; static ɵinj: i0.ɵɵInjectorDeclaration<MatDatepickerModule>; } /** A datepicker that can be attached to a {@link MatDatepickerControl}. */ declare interface MatDatepickerPanel<C extends MatDatepickerControl<D>, S, D = ExtractDateTypeFromSelection<S>> { /** Stream that emits whenever the date picker is closed. */ closedStream: EventEmitter<void>; /** Color palette to use on the datepicker's calendar. */ color: ThemePalette; /** The input element th