1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { ComponentType, Portal } from '@angular/cdk/portal';
|
---|
9 | import { AfterContentInit, AfterViewChecked, ChangeDetectorRef, EventEmitter, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
|
---|
10 | import { DateAdapter, MatDateFormats } from '@angular/material/core';
|
---|
11 | import { Subject } from 'rxjs';
|
---|
12 | import { MatCalendarUserEvent, MatCalendarCellClassFunction } from './calendar-body';
|
---|
13 | import { MatDatepickerIntl } from './datepicker-intl';
|
---|
14 | import { MatMonthView } from './month-view';
|
---|
15 | import { MatMultiYearView } from './multi-year-view';
|
---|
16 | import { MatYearView } from './year-view';
|
---|
17 | import { DateRange } from './date-selection-model';
|
---|
18 | /**
|
---|
19 | * Possible views for the calendar.
|
---|
20 | * @docs-private
|
---|
21 | */
|
---|
22 | export declare type MatCalendarView = 'month' | 'year' | 'multi-year';
|
---|
23 | /** Default header for MatCalendar */
|
---|
24 | export declare class MatCalendarHeader<D> {
|
---|
25 | private _intl;
|
---|
26 | calendar: MatCalendar<D>;
|
---|
27 | private _dateAdapter;
|
---|
28 | private _dateFormats;
|
---|
29 | _buttonDescriptionId: string;
|
---|
30 | constructor(_intl: MatDatepickerIntl, calendar: MatCalendar<D>, _dateAdapter: DateAdapter<D>, _dateFormats: MatDateFormats, changeDetectorRef: ChangeDetectorRef);
|
---|
31 | /** The label for the current calendar view. */
|
---|
32 | get periodButtonText(): string;
|
---|
33 | get periodButtonLabel(): string;
|
---|
34 | /** The label for the previous button. */
|
---|
35 | get prevButtonLabel(): string;
|
---|
36 | /** The label for the next button. */
|
---|
37 | get nextButtonLabel(): string;
|
---|
38 | /** Handles user clicks on the period label. */
|
---|
39 | currentPeriodClicked(): void;
|
---|
40 | /** Handles user clicks on the previous button. */
|
---|
41 | previousClicked(): void;
|
---|
42 | /** Handles user clicks on the next button. */
|
---|
43 | nextClicked(): void;
|
---|
44 | /** Whether the previous period button is enabled. */
|
---|
45 | previousEnabled(): boolean;
|
---|
46 | /** Whether the next period button is enabled. */
|
---|
47 | nextEnabled(): boolean;
|
---|
48 | /** Whether the two dates represent the same view in the current view mode (month or year). */
|
---|
49 | private _isSameView;
|
---|
50 | }
|
---|
51 | /** A calendar that is used as part of the datepicker. */
|
---|
52 | export declare class MatCalendar<D> implements AfterContentInit, AfterViewChecked, OnDestroy, OnChanges {
|
---|
53 | private _dateAdapter;
|
---|
54 | private _dateFormats;
|
---|
55 | private _changeDetectorRef;
|
---|
56 | /** An input indicating the type of the header component, if set. */
|
---|
57 | headerComponent: ComponentType<any>;
|
---|
58 | /** A portal containing the header component type for this calendar. */
|
---|
59 | _calendarHeaderPortal: Portal<any>;
|
---|
60 | private _intlChanges;
|
---|
61 | /**
|
---|
62 | * Used for scheduling that focus should be moved to the active cell on the next tick.
|
---|
63 | * We need to schedule it, rather than do it immediately, because we have to wait
|
---|
64 | * for Angular to re-evaluate the view children.
|
---|
65 | */
|
---|
66 | private _moveFocusOnNextTick;
|
---|
67 | /** A date representing the period (month or year) to start the calendar in. */
|
---|
68 | get startAt(): D | null;
|
---|
69 | set startAt(value: D | null);
|
---|
70 | private _startAt;
|
---|
71 | /** Whether the calendar should be started in month or year view. */
|
---|
72 | startView: MatCalendarView;
|
---|
73 | /** The currently selected date. */
|
---|
74 | get selected(): DateRange<D> | D | null;
|
---|
75 | set selected(value: DateRange<D> | D | null);
|
---|
76 | private _selected;
|
---|
77 | /** The minimum selectable date. */
|
---|
78 | get minDate(): D | null;
|
---|
79 | set minDate(value: D | null);
|
---|
80 | private _minDate;
|
---|
81 | /** The maximum selectable date. */
|
---|
82 | get maxDate(): D | null;
|
---|
83 | set maxDate(value: D | null);
|
---|
84 | private _maxDate;
|
---|
85 | /** Function used to filter which dates are selectable. */
|
---|
86 | dateFilter: (date: D) => boolean;
|
---|
87 | /** Function that can be used to add custom CSS classes to dates. */
|
---|
88 | dateClass: MatCalendarCellClassFunction<D>;
|
---|
89 | /** Start of the comparison range. */
|
---|
90 | comparisonStart: D | null;
|
---|
91 | /** End of the comparison range. */
|
---|
92 | comparisonEnd: D | null;
|
---|
93 | /** Emits when the currently selected date changes. */
|
---|
94 | readonly selectedChange: EventEmitter<D | null>;
|
---|
95 | /**
|
---|
96 | * Emits the year chosen in multiyear view.
|
---|
97 | * This doesn't imply a change on the selected date.
|
---|
98 | */
|
---|
99 | readonly yearSelected: EventEmitter<D>;
|
---|
100 | /**
|
---|
101 | * Emits the month chosen in year view.
|
---|
102 | * This doesn't imply a change on the selected date.
|
---|
103 | */
|
---|
104 | readonly monthSelected: EventEmitter<D>;
|
---|
105 | /**
|
---|
106 | * Emits when the current view changes.
|
---|
107 | */
|
---|
108 | readonly viewChanged: EventEmitter<MatCalendarView>;
|
---|
109 | /** Emits when any date is selected. */
|
---|
110 | readonly _userSelection: EventEmitter<MatCalendarUserEvent<D | null>>;
|
---|
111 | /** Reference to the current month view component. */
|
---|
112 | monthView: MatMonthView<D>;
|
---|
113 | /** Reference to the current year view component. */
|
---|
114 | yearView: MatYearView<D>;
|
---|
115 | /** Reference to the current multi-year view component. */
|
---|
116 | multiYearView: MatMultiYearView<D>;
|
---|
117 | /**
|
---|
118 | * The current active date. This determines which time period is shown and which date is
|
---|
119 | * highlighted when using keyboard navigation.
|
---|
120 | */
|
---|
121 | get activeDate(): D;
|
---|
122 | set activeDate(value: D);
|
---|
123 | private _clampedActiveDate;
|
---|
124 | /** Whether the calendar is in month view. */
|
---|
125 | get currentView(): MatCalendarView;
|
---|
126 | set currentView(value: MatCalendarView);
|
---|
127 | private _currentView;
|
---|
128 | /**
|
---|
129 | * Emits whenever there is a state change that the header may need to respond to.
|
---|
130 | */
|
---|
131 | readonly stateChanges: Subject<void>;
|
---|
132 | constructor(_intl: MatDatepickerIntl, _dateAdapter: DateAdapter<D>, _dateFormats: MatDateFormats, _changeDetectorRef: ChangeDetectorRef);
|
---|
133 | ngAfterContentInit(): void;
|
---|
134 | ngAfterViewChecked(): void;
|
---|
135 | ngOnDestroy(): void;
|
---|
136 | ngOnChanges(changes: SimpleChanges): void;
|
---|
137 | /** Focuses the active date. */
|
---|
138 | focusActiveCell(): void;
|
---|
139 | /** Updates today's date after an update of the active date */
|
---|
140 | updateTodaysDate(): void;
|
---|
141 | /** Handles date selection in the month view. */
|
---|
142 | _dateSelected(event: MatCalendarUserEvent<D | null>): void;
|
---|
143 | /** Handles year selection in the multiyear view. */
|
---|
144 | _yearSelectedInMultiYearView(normalizedYear: D): void;
|
---|
145 | /** Handles month selection in the year view. */
|
---|
146 | _monthSelectedInYearView(normalizedMonth: D): void;
|
---|
147 | /** Handles year/month selection in the multi-year/year views. */
|
---|
148 | _goToDateInView(date: D, view: 'month' | 'year' | 'multi-year'): void;
|
---|
149 | /** Returns the component instance that corresponds to the current calendar view. */
|
---|
150 | private _getCurrentViewComponent;
|
---|
151 | }
|
---|