year-view.d.ts 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 } from '@angular/core';
  9. import { DateAdapter, MatDateFormats } from '@angular/material/core';
  10. import { Directionality } from '@angular/cdk/bidi';
  11. import { MatCalendarBody, MatCalendarCell } from './calendar-body';
  12. /**
  13. * An internal component used to display a single year in the datepicker.
  14. * @docs-private
  15. */
  16. export declare class MatYearView<D> implements AfterContentInit {
  17. private _changeDetectorRef;
  18. private _dateFormats;
  19. _dateAdapter: DateAdapter<D>;
  20. private _dir?;
  21. /** The date to display in this year view (everything other than the year is ignored). */
  22. activeDate: D;
  23. private _activeDate;
  24. /** The currently selected date. */
  25. selected: D | null;
  26. private _selected;
  27. /** The minimum selectable date. */
  28. minDate: D | null;
  29. private _minDate;
  30. /** The maximum selectable date. */
  31. maxDate: D | null;
  32. private _maxDate;
  33. /** A function used to filter which dates are selectable. */
  34. dateFilter: (date: D) => boolean;
  35. /** Emits when a new month is selected. */
  36. readonly selectedChange: EventEmitter<D>;
  37. /** Emits the selected month. This doesn't imply a change on the selected date */
  38. readonly monthSelected: EventEmitter<D>;
  39. /** Emits when any date is activated. */
  40. readonly activeDateChange: EventEmitter<D>;
  41. /** The body of calendar table */
  42. _matCalendarBody: MatCalendarBody;
  43. /** Grid of calendar cells representing the months of the year. */
  44. _months: MatCalendarCell[][];
  45. /** The label for this year (e.g. "2017"). */
  46. _yearLabel: string;
  47. /** The month in this year that today falls on. Null if today is in a different year. */
  48. _todayMonth: number | null;
  49. /**
  50. * The month in this year that the selected Date falls on.
  51. * Null if the selected Date is in a different year.
  52. */
  53. _selectedMonth: number | null;
  54. constructor(_changeDetectorRef: ChangeDetectorRef, _dateFormats: MatDateFormats, _dateAdapter: DateAdapter<D>, _dir?: Directionality | undefined);
  55. ngAfterContentInit(): void;
  56. /** Handles when a new month is selected. */
  57. _monthSelected(month: number): void;
  58. /** Handles keydown events on the calendar body when calendar is in year view. */
  59. _handleCalendarBodyKeydown(event: KeyboardEvent): void;
  60. /** Initializes this year view. */
  61. _init(): void;
  62. /** Focuses the active cell after the microtask queue is empty. */
  63. _focusActiveCell(): void;
  64. /**
  65. * Gets the month in this year that the given Date falls on.
  66. * Returns null if the given Date is in another year.
  67. */
  68. private _getMonthInCurrentYear;
  69. /** Creates an MatCalendarCell for the given month. */
  70. private _createCellForMonth;
  71. /** Whether the given month is enabled. */
  72. private _shouldEnableMonth;
  73. /**
  74. * Tests whether the combination month/year is after this.maxDate, considering
  75. * just the month and year of this.maxDate
  76. */
  77. private _isYearAndMonthAfterMaxDate;
  78. /**
  79. * Tests whether the combination month/year is before this.minDate, considering
  80. * just the month and year of this.minDate
  81. */
  82. private _isYearAndMonthBeforeMinDate;
  83. /**
  84. * @param obj The object to check.
  85. * @returns The given object if it is both a date instance and valid, otherwise null.
  86. */
  87. private _getValidDateOrNull;
  88. /** Determines whether the user has the RTL layout direction. */
  89. private _isRtl;
  90. }