@angular/material
Version:
Angular Material
82 lines (81 loc) • 3.43 kB
TypeScript
import { AfterContentInit, ChangeDetectorRef, EventEmitter } from '@angular/core';
import { DateAdapter, MatDateFormats } from '@angular/material/core';
import { Directionality } from '@angular/cdk/bidi';
import { MatCalendarCell } from './calendar-body';
/**
* An internal component used to display a single year in the datepicker.
* @docs-private
*/
export declare class MatYearView<D> implements AfterContentInit {
private _changeDetectorRef;
private _dateFormats;
_dateAdapter: DateAdapter<D>;
private _dir;
/** The date to display in this year view (everything other than the year is ignored). */
activeDate: D;
private _activeDate;
/** The currently selected date. */
selected: D | null;
private _selected;
/** The minimum selectable date. */
minDate: D | null;
private _minDate;
/** The maximum selectable date. */
maxDate: D | null;
private _maxDate;
/** A function used to filter which dates are selectable. */
dateFilter: (date: D) => boolean;
/** Emits when a new month is selected. */
readonly selectedChange: EventEmitter<D>;
/** Emits the selected month. This doesn't imply a change on the selected date */
readonly monthSelected: EventEmitter<D>;
/** The body of calendar table */
_matCalendarBody: any;
/** Grid of calendar cells representing the months of the year. */
_months: MatCalendarCell[][];
/** The label for this year (e.g. "2017"). */
_yearLabel: string;
/** The month in this year that today falls on. Null if today is in a different year. */
_todayMonth: number | null;
/**
* The month in this year that the selected Date falls on.
* Null if the selected Date is in a different year.
*/
_selectedMonth: number | null;
constructor(_changeDetectorRef: ChangeDetectorRef, _dateFormats: MatDateFormats, _dateAdapter: DateAdapter<D>, _dir?: Directionality | undefined);
ngAfterContentInit(): void;
/** Handles when a new month is selected. */
_monthSelected(month: number): void;
/** Handles keydown events on the calendar body when calendar is in year view. */
_handleCalendarBodyKeydown(event: KeyboardEvent): void;
/** Initializes this year view. */
_init(): void;
/** Focuses the active cell after the microtask queue is empty. */
private _focusActiveCell();
/**
* Gets the month in this year that the given Date falls on.
* Returns null if the given Date is in another year.
*/
private _getMonthInCurrentYear(date);
/** Creates an MatCalendarCell for the given month. */
private _createCellForMonth(month, monthName);
/** Whether the given month is enabled. */
private _shouldEnableMonth(month);
/**
* Tests whether the combination month/year is after this.maxDate, considering
* just the month and year of this.maxDate
*/
private _isYearAndMonthAfterMaxDate(year, month);
/**
* Tests whether the combination month/year is before this.minDate, considering
* just the month and year of this.minDate
*/
private _isYearAndMonthBeforeMinDate(year, month);
/**
* @param obj The object to check.
* @returns The given object if it is both a date instance and valid, otherwise null.
*/
private _getValidDateOrNull(obj);
/** Determines whether the user has the RTL layout direction. */
private _isRtl();
}