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 { DOWN_ARROW, END, ENTER, HOME, LEFT_ARROW, PAGE_DOWN, PAGE_UP, RIGHT_ARROW, UP_ARROW, SPACE, } from '@angular/cdk/keycodes';
|
---|
9 | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Inject, Input, Optional, Output, ViewChild, ViewEncapsulation, } from '@angular/core';
|
---|
10 | import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
---|
11 | import { Directionality } from '@angular/cdk/bidi';
|
---|
12 | import { MatCalendarBody, MatCalendarCell, } from './calendar-body';
|
---|
13 | import { createMissingDateImplError } from './datepicker-errors';
|
---|
14 | import { Subscription } from 'rxjs';
|
---|
15 | import { startWith } from 'rxjs/operators';
|
---|
16 | import { DateRange } from './date-selection-model';
|
---|
17 | /**
|
---|
18 | * An internal component used to display a single year in the datepicker.
|
---|
19 | * @docs-private
|
---|
20 | */
|
---|
21 | export class MatYearView {
|
---|
22 | constructor(_changeDetectorRef, _dateFormats, _dateAdapter, _dir) {
|
---|
23 | this._changeDetectorRef = _changeDetectorRef;
|
---|
24 | this._dateFormats = _dateFormats;
|
---|
25 | this._dateAdapter = _dateAdapter;
|
---|
26 | this._dir = _dir;
|
---|
27 | this._rerenderSubscription = Subscription.EMPTY;
|
---|
28 | /** Emits when a new month is selected. */
|
---|
29 | this.selectedChange = new EventEmitter();
|
---|
30 | /** Emits the selected month. This doesn't imply a change on the selected date */
|
---|
31 | this.monthSelected = new EventEmitter();
|
---|
32 | /** Emits when any date is activated. */
|
---|
33 | this.activeDateChange = new EventEmitter();
|
---|
34 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
---|
35 | if (!this._dateAdapter) {
|
---|
36 | throw createMissingDateImplError('DateAdapter');
|
---|
37 | }
|
---|
38 | if (!this._dateFormats) {
|
---|
39 | throw createMissingDateImplError('MAT_DATE_FORMATS');
|
---|
40 | }
|
---|
41 | }
|
---|
42 | this._activeDate = this._dateAdapter.today();
|
---|
43 | }
|
---|
44 | /** The date to display in this year view (everything other than the year is ignored). */
|
---|
45 | get activeDate() { return this._activeDate; }
|
---|
46 | set activeDate(value) {
|
---|
47 | let oldActiveDate = this._activeDate;
|
---|
48 | const validDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
|
---|
49 | this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
|
---|
50 | if (this._dateAdapter.getYear(oldActiveDate) !== this._dateAdapter.getYear(this._activeDate)) {
|
---|
51 | this._init();
|
---|
52 | }
|
---|
53 | }
|
---|
54 | /** The currently selected date. */
|
---|
55 | get selected() { return this._selected; }
|
---|
56 | set selected(value) {
|
---|
57 | if (value instanceof DateRange) {
|
---|
58 | this._selected = value;
|
---|
59 | }
|
---|
60 | else {
|
---|
61 | this._selected = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
---|
62 | }
|
---|
63 | this._setSelectedMonth(value);
|
---|
64 | }
|
---|
65 | /** The minimum selectable date. */
|
---|
66 | get minDate() { return this._minDate; }
|
---|
67 | set minDate(value) {
|
---|
68 | this._minDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
---|
69 | }
|
---|
70 | /** The maximum selectable date. */
|
---|
71 | get maxDate() { return this._maxDate; }
|
---|
72 | set maxDate(value) {
|
---|
73 | this._maxDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
|
---|
74 | }
|
---|
75 | ngAfterContentInit() {
|
---|
76 | this._rerenderSubscription = this._dateAdapter.localeChanges
|
---|
77 | .pipe(startWith(null))
|
---|
78 | .subscribe(() => this._init());
|
---|
79 | }
|
---|
80 | ngOnDestroy() {
|
---|
81 | this._rerenderSubscription.unsubscribe();
|
---|
82 | }
|
---|
83 | /** Handles when a new month is selected. */
|
---|
84 | _monthSelected(event) {
|
---|
85 | const month = event.value;
|
---|
86 | const normalizedDate = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);
|
---|
87 | this.monthSelected.emit(normalizedDate);
|
---|
88 | const daysInMonth = this._dateAdapter.getNumDaysInMonth(normalizedDate);
|
---|
89 | this.selectedChange.emit(this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));
|
---|
90 | }
|
---|
91 | /** Handles keydown events on the calendar body when calendar is in year view. */
|
---|
92 | _handleCalendarBodyKeydown(event) {
|
---|
93 | // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
|
---|
94 | // disabled ones from being selected. This may not be ideal, we should look into whether
|
---|
95 | // navigation should skip over disabled dates, and if so, how to implement that efficiently.
|
---|
96 | const oldActiveDate = this._activeDate;
|
---|
97 | const isRtl = this._isRtl();
|
---|
98 | switch (event.keyCode) {
|
---|
99 | case LEFT_ARROW:
|
---|
100 | this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, isRtl ? 1 : -1);
|
---|
101 | break;
|
---|
102 | case RIGHT_ARROW:
|
---|
103 | this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, isRtl ? -1 : 1);
|
---|
104 | break;
|
---|
105 | case UP_ARROW:
|
---|
106 | this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, -4);
|
---|
107 | break;
|
---|
108 | case DOWN_ARROW:
|
---|
109 | this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, 4);
|
---|
110 | break;
|
---|
111 | case HOME:
|
---|
112 | this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, -this._dateAdapter.getMonth(this._activeDate));
|
---|
113 | break;
|
---|
114 | case END:
|
---|
115 | this.activeDate = this._dateAdapter.addCalendarMonths(this._activeDate, 11 - this._dateAdapter.getMonth(this._activeDate));
|
---|
116 | break;
|
---|
117 | case PAGE_UP:
|
---|
118 | this.activeDate =
|
---|
119 | this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -10 : -1);
|
---|
120 | break;
|
---|
121 | case PAGE_DOWN:
|
---|
122 | this.activeDate =
|
---|
123 | this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? 10 : 1);
|
---|
124 | break;
|
---|
125 | case ENTER:
|
---|
126 | case SPACE:
|
---|
127 | // Note that we only prevent the default action here while the selection happens in
|
---|
128 | // `keyup` below. We can't do the selection here, because it can cause the calendar to
|
---|
129 | // reopen if focus is restored immediately. We also can't call `preventDefault` on `keyup`
|
---|
130 | // because it's too late (see #23305).
|
---|
131 | this._selectionKeyPressed = true;
|
---|
132 | break;
|
---|
133 | default:
|
---|
134 | // Don't prevent default or focus active cell on keys that we don't explicitly handle.
|
---|
135 | return;
|
---|
136 | }
|
---|
137 | if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
|
---|
138 | this.activeDateChange.emit(this.activeDate);
|
---|
139 | }
|
---|
140 | this._focusActiveCell();
|
---|
141 | // Prevent unexpected default actions such as form submission.
|
---|
142 | event.preventDefault();
|
---|
143 | }
|
---|
144 | /** Handles keyup events on the calendar body when calendar is in year view. */
|
---|
145 | _handleCalendarBodyKeyup(event) {
|
---|
146 | if (event.keyCode === SPACE || event.keyCode === ENTER) {
|
---|
147 | if (this._selectionKeyPressed) {
|
---|
148 | this._monthSelected({ value: this._dateAdapter.getMonth(this._activeDate), event });
|
---|
149 | }
|
---|
150 | this._selectionKeyPressed = false;
|
---|
151 | }
|
---|
152 | }
|
---|
153 | /** Initializes this year view. */
|
---|
154 | _init() {
|
---|
155 | this._setSelectedMonth(this.selected);
|
---|
156 | this._todayMonth = this._getMonthInCurrentYear(this._dateAdapter.today());
|
---|
157 | this._yearLabel = this._dateAdapter.getYearName(this.activeDate);
|
---|
158 | let monthNames = this._dateAdapter.getMonthNames('short');
|
---|
159 | // First row of months only contains 5 elements so we can fit the year label on the same row.
|
---|
160 | this._months = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]].map(row => row.map(month => this._createCellForMonth(month, monthNames[month])));
|
---|
161 | this._changeDetectorRef.markForCheck();
|
---|
162 | }
|
---|
163 | /** Focuses the active cell after the microtask queue is empty. */
|
---|
164 | _focusActiveCell() {
|
---|
165 | this._matCalendarBody._focusActiveCell();
|
---|
166 | }
|
---|
167 | /**
|
---|
168 | * Gets the month in this year that the given Date falls on.
|
---|
169 | * Returns null if the given Date is in another year.
|
---|
170 | */
|
---|
171 | _getMonthInCurrentYear(date) {
|
---|
172 | return date && this._dateAdapter.getYear(date) == this._dateAdapter.getYear(this.activeDate) ?
|
---|
173 | this._dateAdapter.getMonth(date) : null;
|
---|
174 | }
|
---|
175 | /** Creates an MatCalendarCell for the given month. */
|
---|
176 | _createCellForMonth(month, monthName) {
|
---|
177 | const date = this._dateAdapter.createDate(this._dateAdapter.getYear(this.activeDate), month, 1);
|
---|
178 | const ariaLabel = this._dateAdapter.format(date, this._dateFormats.display.monthYearA11yLabel);
|
---|
179 | const cellClasses = this.dateClass ? this.dateClass(date, 'year') : undefined;
|
---|
180 | return new MatCalendarCell(month, monthName.toLocaleUpperCase(), ariaLabel, this._shouldEnableMonth(month), cellClasses);
|
---|
181 | }
|
---|
182 | /** Whether the given month is enabled. */
|
---|
183 | _shouldEnableMonth(month) {
|
---|
184 | const activeYear = this._dateAdapter.getYear(this.activeDate);
|
---|
185 | if (month === undefined || month === null ||
|
---|
186 | this._isYearAndMonthAfterMaxDate(activeYear, month) ||
|
---|
187 | this._isYearAndMonthBeforeMinDate(activeYear, month)) {
|
---|
188 | return false;
|
---|
189 | }
|
---|
190 | if (!this.dateFilter) {
|
---|
191 | return true;
|
---|
192 | }
|
---|
193 | const firstOfMonth = this._dateAdapter.createDate(activeYear, month, 1);
|
---|
194 | // If any date in the month is enabled count the month as enabled.
|
---|
195 | for (let date = firstOfMonth; this._dateAdapter.getMonth(date) == month; date = this._dateAdapter.addCalendarDays(date, 1)) {
|
---|
196 | if (this.dateFilter(date)) {
|
---|
197 | return true;
|
---|
198 | }
|
---|
199 | }
|
---|
200 | return false;
|
---|
201 | }
|
---|
202 | /**
|
---|
203 | * Tests whether the combination month/year is after this.maxDate, considering
|
---|
204 | * just the month and year of this.maxDate
|
---|
205 | */
|
---|
206 | _isYearAndMonthAfterMaxDate(year, month) {
|
---|
207 | if (this.maxDate) {
|
---|
208 | const maxYear = this._dateAdapter.getYear(this.maxDate);
|
---|
209 | const maxMonth = this._dateAdapter.getMonth(this.maxDate);
|
---|
210 | return year > maxYear || (year === maxYear && month > maxMonth);
|
---|
211 | }
|
---|
212 | return false;
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Tests whether the combination month/year is before this.minDate, considering
|
---|
216 | * just the month and year of this.minDate
|
---|
217 | */
|
---|
218 | _isYearAndMonthBeforeMinDate(year, month) {
|
---|
219 | if (this.minDate) {
|
---|
220 | const minYear = this._dateAdapter.getYear(this.minDate);
|
---|
221 | const minMonth = this._dateAdapter.getMonth(this.minDate);
|
---|
222 | return year < minYear || (year === minYear && month < minMonth);
|
---|
223 | }
|
---|
224 | return false;
|
---|
225 | }
|
---|
226 | /** Determines whether the user has the RTL layout direction. */
|
---|
227 | _isRtl() {
|
---|
228 | return this._dir && this._dir.value === 'rtl';
|
---|
229 | }
|
---|
230 | /** Sets the currently-selected month based on a model value. */
|
---|
231 | _setSelectedMonth(value) {
|
---|
232 | if (value instanceof DateRange) {
|
---|
233 | this._selectedMonth = this._getMonthInCurrentYear(value.start) ||
|
---|
234 | this._getMonthInCurrentYear(value.end);
|
---|
235 | }
|
---|
236 | else {
|
---|
237 | this._selectedMonth = this._getMonthInCurrentYear(value);
|
---|
238 | }
|
---|
239 | }
|
---|
240 | }
|
---|
241 | MatYearView.decorators = [
|
---|
242 | { type: Component, args: [{
|
---|
243 | selector: 'mat-year-view',
|
---|
244 | template: "<table class=\"mat-calendar-table\" role=\"grid\">\n <thead aria-hidden=\"true\" class=\"mat-calendar-table-header\">\n <tr><th class=\"mat-calendar-table-header-divider\" colspan=\"4\"></th></tr>\n </thead>\n <tbody mat-calendar-body\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [startValue]=\"_selectedMonth!\"\n [endValue]=\"_selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"_monthSelected($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n",
|
---|
245 | exportAs: 'matYearView',
|
---|
246 | encapsulation: ViewEncapsulation.None,
|
---|
247 | changeDetection: ChangeDetectionStrategy.OnPush
|
---|
248 | },] }
|
---|
249 | ];
|
---|
250 | MatYearView.ctorParameters = () => [
|
---|
251 | { type: ChangeDetectorRef },
|
---|
252 | { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_DATE_FORMATS,] }] },
|
---|
253 | { type: DateAdapter, decorators: [{ type: Optional }] },
|
---|
254 | { type: Directionality, decorators: [{ type: Optional }] }
|
---|
255 | ];
|
---|
256 | MatYearView.propDecorators = {
|
---|
257 | activeDate: [{ type: Input }],
|
---|
258 | selected: [{ type: Input }],
|
---|
259 | minDate: [{ type: Input }],
|
---|
260 | maxDate: [{ type: Input }],
|
---|
261 | dateFilter: [{ type: Input }],
|
---|
262 | dateClass: [{ type: Input }],
|
---|
263 | selectedChange: [{ type: Output }],
|
---|
264 | monthSelected: [{ type: Output }],
|
---|
265 | activeDateChange: [{ type: Output }],
|
---|
266 | _matCalendarBody: [{ type: ViewChild, args: [MatCalendarBody,] }]
|
---|
267 | };
|
---|
268 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoieWVhci12aWV3LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiO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