source: trip-planner-front/node_modules/@angular/material/esm2015/datepicker/multi-year-view.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 43.7 KB
Line 
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 */
8import { DOWN_ARROW, END, ENTER, HOME, LEFT_ARROW, PAGE_DOWN, PAGE_UP, RIGHT_ARROW, UP_ARROW, SPACE, } from '@angular/cdk/keycodes';
9import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, Input, Optional, Output, ViewChild, ViewEncapsulation, } from '@angular/core';
10import { DateAdapter } from '@angular/material/core';
11import { Directionality } from '@angular/cdk/bidi';
12import { MatCalendarBody, MatCalendarCell, } from './calendar-body';
13import { createMissingDateImplError } from './datepicker-errors';
14import { Subscription } from 'rxjs';
15import { startWith } from 'rxjs/operators';
16import { DateRange } from './date-selection-model';
17export const yearsPerPage = 24;
18export const yearsPerRow = 4;
19/**
20 * An internal component used to display a year selector in the datepicker.
21 * @docs-private
22 */
23export class MatMultiYearView {
24 constructor(_changeDetectorRef, _dateAdapter, _dir) {
25 this._changeDetectorRef = _changeDetectorRef;
26 this._dateAdapter = _dateAdapter;
27 this._dir = _dir;
28 this._rerenderSubscription = Subscription.EMPTY;
29 /** Emits when a new year is selected. */
30 this.selectedChange = new EventEmitter();
31 /** Emits the selected year. This doesn't imply a change on the selected date */
32 this.yearSelected = new EventEmitter();
33 /** Emits when any date is activated. */
34 this.activeDateChange = new EventEmitter();
35 if (!this._dateAdapter && (typeof ngDevMode === 'undefined' || ngDevMode)) {
36 throw createMissingDateImplError('DateAdapter');
37 }
38 this._activeDate = this._dateAdapter.today();
39 }
40 /** The date to display in this multi-year view (everything other than the year is ignored). */
41 get activeDate() { return this._activeDate; }
42 set activeDate(value) {
43 let oldActiveDate = this._activeDate;
44 const validDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value)) || this._dateAdapter.today();
45 this._activeDate = this._dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
46 if (!isSameMultiYearView(this._dateAdapter, oldActiveDate, this._activeDate, this.minDate, this.maxDate)) {
47 this._init();
48 }
49 }
50 /** The currently selected date. */
51 get selected() { return this._selected; }
52 set selected(value) {
53 if (value instanceof DateRange) {
54 this._selected = value;
55 }
56 else {
57 this._selected = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
58 }
59 this._setSelectedYear(value);
60 }
61 /** The minimum selectable date. */
62 get minDate() { return this._minDate; }
63 set minDate(value) {
64 this._minDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
65 }
66 /** The maximum selectable date. */
67 get maxDate() { return this._maxDate; }
68 set maxDate(value) {
69 this._maxDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(value));
70 }
71 ngAfterContentInit() {
72 this._rerenderSubscription = this._dateAdapter.localeChanges
73 .pipe(startWith(null))
74 .subscribe(() => this._init());
75 }
76 ngOnDestroy() {
77 this._rerenderSubscription.unsubscribe();
78 }
79 /** Initializes this multi-year view. */
80 _init() {
81 this._todayYear = this._dateAdapter.getYear(this._dateAdapter.today());
82 // We want a range years such that we maximize the number of
83 // enabled dates visible at once. This prevents issues where the minimum year
84 // is the last item of a page OR the maximum year is the first item of a page.
85 // The offset from the active year to the "slot" for the starting year is the
86 // *actual* first rendered year in the multi-year view.
87 const activeYear = this._dateAdapter.getYear(this._activeDate);
88 const minYearOfPage = activeYear - getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate);
89 this._years = [];
90 for (let i = 0, row = []; i < yearsPerPage; i++) {
91 row.push(minYearOfPage + i);
92 if (row.length == yearsPerRow) {
93 this._years.push(row.map(year => this._createCellForYear(year)));
94 row = [];
95 }
96 }
97 this._changeDetectorRef.markForCheck();
98 }
99 /** Handles when a new year is selected. */
100 _yearSelected(event) {
101 const year = event.value;
102 this.yearSelected.emit(this._dateAdapter.createDate(year, 0, 1));
103 let month = this._dateAdapter.getMonth(this.activeDate);
104 let daysInMonth = this._dateAdapter.getNumDaysInMonth(this._dateAdapter.createDate(year, month, 1));
105 this.selectedChange.emit(this._dateAdapter.createDate(year, month, Math.min(this._dateAdapter.getDate(this.activeDate), daysInMonth)));
106 }
107 /** Handles keydown events on the calendar body when calendar is in multi-year view. */
108 _handleCalendarBodyKeydown(event) {
109 const oldActiveDate = this._activeDate;
110 const isRtl = this._isRtl();
111 switch (event.keyCode) {
112 case LEFT_ARROW:
113 this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, isRtl ? 1 : -1);
114 break;
115 case RIGHT_ARROW:
116 this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, isRtl ? -1 : 1);
117 break;
118 case UP_ARROW:
119 this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, -yearsPerRow);
120 break;
121 case DOWN_ARROW:
122 this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, yearsPerRow);
123 break;
124 case HOME:
125 this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, -getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate));
126 break;
127 case END:
128 this.activeDate = this._dateAdapter.addCalendarYears(this._activeDate, yearsPerPage - getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate) - 1);
129 break;
130 case PAGE_UP:
131 this.activeDate =
132 this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
133 break;
134 case PAGE_DOWN:
135 this.activeDate =
136 this._dateAdapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
137 break;
138 case ENTER:
139 case SPACE:
140 // Note that we only prevent the default action here while the selection happens in
141 // `keyup` below. We can't do the selection here, because it can cause the calendar to
142 // reopen if focus is restored immediately. We also can't call `preventDefault` on `keyup`
143 // because it's too late (see #23305).
144 this._selectionKeyPressed = true;
145 break;
146 default:
147 // Don't prevent default or focus active cell on keys that we don't explicitly handle.
148 return;
149 }
150 if (this._dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
151 this.activeDateChange.emit(this.activeDate);
152 }
153 this._focusActiveCell();
154 // Prevent unexpected default actions such as form submission.
155 event.preventDefault();
156 }
157 /** Handles keyup events on the calendar body when calendar is in multi-year view. */
158 _handleCalendarBodyKeyup(event) {
159 if (event.keyCode === SPACE || event.keyCode === ENTER) {
160 if (this._selectionKeyPressed) {
161 this._yearSelected({ value: this._dateAdapter.getYear(this._activeDate), event });
162 }
163 this._selectionKeyPressed = false;
164 }
165 }
166 _getActiveCell() {
167 return getActiveOffset(this._dateAdapter, this.activeDate, this.minDate, this.maxDate);
168 }
169 /** Focuses the active cell after the microtask queue is empty. */
170 _focusActiveCell() {
171 this._matCalendarBody._focusActiveCell();
172 }
173 /** Creates an MatCalendarCell for the given year. */
174 _createCellForYear(year) {
175 const date = this._dateAdapter.createDate(year, 0, 1);
176 const yearName = this._dateAdapter.getYearName(date);
177 const cellClasses = this.dateClass ? this.dateClass(date, 'multi-year') : undefined;
178 return new MatCalendarCell(year, yearName, yearName, this._shouldEnableYear(year), cellClasses);
179 }
180 /** Whether the given year is enabled. */
181 _shouldEnableYear(year) {
182 // disable if the year is greater than maxDate lower than minDate
183 if (year === undefined || year === null ||
184 (this.maxDate && year > this._dateAdapter.getYear(this.maxDate)) ||
185 (this.minDate && year < this._dateAdapter.getYear(this.minDate))) {
186 return false;
187 }
188 // enable if it reaches here and there's no filter defined
189 if (!this.dateFilter) {
190 return true;
191 }
192 const firstOfYear = this._dateAdapter.createDate(year, 0, 1);
193 // If any date in the year is enabled count the year as enabled.
194 for (let date = firstOfYear; this._dateAdapter.getYear(date) == year; date = this._dateAdapter.addCalendarDays(date, 1)) {
195 if (this.dateFilter(date)) {
196 return true;
197 }
198 }
199 return false;
200 }
201 /** Determines whether the user has the RTL layout direction. */
202 _isRtl() {
203 return this._dir && this._dir.value === 'rtl';
204 }
205 /** Sets the currently-highlighted year based on a model value. */
206 _setSelectedYear(value) {
207 this._selectedYear = null;
208 if (value instanceof DateRange) {
209 const displayValue = value.start || value.end;
210 if (displayValue) {
211 this._selectedYear = this._dateAdapter.getYear(displayValue);
212 }
213 }
214 else if (value) {
215 this._selectedYear = this._dateAdapter.getYear(value);
216 }
217 }
218}
219MatMultiYearView.decorators = [
220 { type: Component, args: [{
221 selector: 'mat-multi-year-view',
222 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 [rows]=\"_years\"\n [todayValue]=\"_todayYear\"\n [startValue]=\"_selectedYear!\"\n [endValue]=\"_selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"_getActiveCell()\"\n (selectedValueChange)=\"_yearSelected($event)\"\n (keyup)=\"_handleCalendarBodyKeyup($event)\"\n (keydown)=\"_handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n",
223 exportAs: 'matMultiYearView',
224 encapsulation: ViewEncapsulation.None,
225 changeDetection: ChangeDetectionStrategy.OnPush
226 },] }
227];
228MatMultiYearView.ctorParameters = () => [
229 { type: ChangeDetectorRef },
230 { type: DateAdapter, decorators: [{ type: Optional }] },
231 { type: Directionality, decorators: [{ type: Optional }] }
232];
233MatMultiYearView.propDecorators = {
234 activeDate: [{ type: Input }],
235 selected: [{ type: Input }],
236 minDate: [{ type: Input }],
237 maxDate: [{ type: Input }],
238 dateFilter: [{ type: Input }],
239 dateClass: [{ type: Input }],
240 selectedChange: [{ type: Output }],
241 yearSelected: [{ type: Output }],
242 activeDateChange: [{ type: Output }],
243 _matCalendarBody: [{ type: ViewChild, args: [MatCalendarBody,] }]
244};
245export function isSameMultiYearView(dateAdapter, date1, date2, minDate, maxDate) {
246 const year1 = dateAdapter.getYear(date1);
247 const year2 = dateAdapter.getYear(date2);
248 const startingYear = getStartingYear(dateAdapter, minDate, maxDate);
249 return Math.floor((year1 - startingYear) / yearsPerPage) ===
250 Math.floor((year2 - startingYear) / yearsPerPage);
251}
252/**
253 * When the multi-year view is first opened, the active year will be in view.
254 * So we compute how many years are between the active year and the *slot* where our
255 * "startingYear" will render when paged into view.
256 */
257export function getActiveOffset(dateAdapter, activeDate, minDate, maxDate) {
258 const activeYear = dateAdapter.getYear(activeDate);
259 return euclideanModulo((activeYear - getStartingYear(dateAdapter, minDate, maxDate)), yearsPerPage);
260}
261/**
262 * We pick a "starting" year such that either the maximum year would be at the end
263 * or the minimum year would be at the beginning of a page.
264 */
265function getStartingYear(dateAdapter, minDate, maxDate) {
266 let startingYear = 0;
267 if (maxDate) {
268 const maxYear = dateAdapter.getYear(maxDate);
269 startingYear = maxYear - yearsPerPage + 1;
270 }
271 else if (minDate) {
272 startingYear = dateAdapter.getYear(minDate);
273 }
274 return startingYear;
275}
276/** Gets remainder that is non-negative, even if first number is negative */
277function euclideanModulo(a, b) {
278 return (a % b + b) % b;
279}
280//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXVsdGkteWVhci12aWV3LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2RhdGVwaWNrZXIvbXVsdGkteWVhci12aWV3LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFDTCxVQUFVLEVBQ1YsR0FBRyxFQUNILEtBQUssRUFDTCxJQUFJLEVBQ0osVUFBVSxFQUNWLFNBQVMsRUFDVCxPQUFPLEVBQ1AsV0FBVyxFQUNYLFFBQVEsRUFDUixLQUFLLEdBQ04sTUFBTSx1QkFBdUIsQ0FBQztBQUMvQixPQUFPLEVBRUwsdUJBQXVCLEVBQ3ZCLGlCQUFpQixFQUNqQixTQUFTLEVBQ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