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 { AfterContentInit, ChangeDetectorRef, EventEmitter, OnDestroy } from '@angular/core';
|
---|
9 | import { DateAdapter } from '@angular/material/core';
|
---|
10 | import { Directionality } from '@angular/cdk/bidi';
|
---|
11 | import { MatCalendarBody, MatCalendarCell, MatCalendarUserEvent, MatCalendarCellClassFunction } from './calendar-body';
|
---|
12 | import { DateRange } from './date-selection-model';
|
---|
13 | export declare const yearsPerPage = 24;
|
---|
14 | export declare const yearsPerRow = 4;
|
---|
15 | /**
|
---|
16 | * An internal component used to display a year selector in the datepicker.
|
---|
17 | * @docs-private
|
---|
18 | */
|
---|
19 | export declare class MatMultiYearView<D> implements AfterContentInit, OnDestroy {
|
---|
20 | private _changeDetectorRef;
|
---|
21 | _dateAdapter: DateAdapter<D>;
|
---|
22 | private _dir?;
|
---|
23 | private _rerenderSubscription;
|
---|
24 | /** Flag used to filter out space/enter keyup events that originated outside of the view. */
|
---|
25 | private _selectionKeyPressed;
|
---|
26 | /** The date to display in this multi-year view (everything other than the year is ignored). */
|
---|
27 | get activeDate(): D;
|
---|
28 | set activeDate(value: D);
|
---|
29 | private _activeDate;
|
---|
30 | /** The currently selected date. */
|
---|
31 | get selected(): DateRange<D> | D | null;
|
---|
32 | set selected(value: DateRange<D> | D | null);
|
---|
33 | private _selected;
|
---|
34 | /** The minimum selectable date. */
|
---|
35 | get minDate(): D | null;
|
---|
36 | set minDate(value: D | null);
|
---|
37 | private _minDate;
|
---|
38 | /** The maximum selectable date. */
|
---|
39 | get maxDate(): D | null;
|
---|
40 | set maxDate(value: D | null);
|
---|
41 | private _maxDate;
|
---|
42 | /** A function used to filter which dates are selectable. */
|
---|
43 | dateFilter: (date: D) => boolean;
|
---|
44 | /** Function that can be used to add custom CSS classes to date cells. */
|
---|
45 | dateClass: MatCalendarCellClassFunction<D>;
|
---|
46 | /** Emits when a new year is selected. */
|
---|
47 | readonly selectedChange: EventEmitter<D>;
|
---|
48 | /** Emits the selected year. This doesn't imply a change on the selected date */
|
---|
49 | readonly yearSelected: EventEmitter<D>;
|
---|
50 | /** Emits when any date is activated. */
|
---|
51 | readonly activeDateChange: EventEmitter<D>;
|
---|
52 | /** The body of calendar table */
|
---|
53 | _matCalendarBody: MatCalendarBody;
|
---|
54 | /** Grid of calendar cells representing the currently displayed years. */
|
---|
55 | _years: MatCalendarCell[][];
|
---|
56 | /** The year that today falls on. */
|
---|
57 | _todayYear: number;
|
---|
58 | /** The year of the selected date. Null if the selected date is null. */
|
---|
59 | _selectedYear: number | null;
|
---|
60 | constructor(_changeDetectorRef: ChangeDetectorRef, _dateAdapter: DateAdapter<D>, _dir?: Directionality | undefined);
|
---|
61 | ngAfterContentInit(): void;
|
---|
62 | ngOnDestroy(): void;
|
---|
63 | /** Initializes this multi-year view. */
|
---|
64 | _init(): void;
|
---|
65 | /** Handles when a new year is selected. */
|
---|
66 | _yearSelected(event: MatCalendarUserEvent<number>): void;
|
---|
67 | /** Handles keydown events on the calendar body when calendar is in multi-year view. */
|
---|
68 | _handleCalendarBodyKeydown(event: KeyboardEvent): void;
|
---|
69 | /** Handles keyup events on the calendar body when calendar is in multi-year view. */
|
---|
70 | _handleCalendarBodyKeyup(event: KeyboardEvent): void;
|
---|
71 | _getActiveCell(): number;
|
---|
72 | /** Focuses the active cell after the microtask queue is empty. */
|
---|
73 | _focusActiveCell(): void;
|
---|
74 | /** Creates an MatCalendarCell for the given year. */
|
---|
75 | private _createCellForYear;
|
---|
76 | /** Whether the given year is enabled. */
|
---|
77 | private _shouldEnableYear;
|
---|
78 | /** Determines whether the user has the RTL layout direction. */
|
---|
79 | private _isRtl;
|
---|
80 | /** Sets the currently-highlighted year based on a model value. */
|
---|
81 | private _setSelectedYear;
|
---|
82 | }
|
---|
83 | export declare function isSameMultiYearView<D>(dateAdapter: DateAdapter<D>, date1: D, date2: D, minDate: D | null, maxDate: D | null): boolean;
|
---|
84 | /**
|
---|
85 | * When the multi-year view is first opened, the active year will be in view.
|
---|
86 | * So we compute how many years are between the active year and the *slot* where our
|
---|
87 | * "startingYear" will render when paged into view.
|
---|
88 | */
|
---|
89 | export declare function getActiveOffset<D>(dateAdapter: DateAdapter<D>, activeDate: D, minDate: D | null, maxDate: D | null): number;
|
---|