@ptsecurity/mosaic 14.6.1 → 14.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/_theming.scss +3790 -2072
  2. package/_visual.scss +341 -0
  3. package/button/button.component.d.ts +2 -0
  4. package/card/card.component.d.ts +2 -0
  5. package/checkbox/checkbox.d.ts +1 -0
  6. package/code-block/README.md +32 -0
  7. package/code-block/actionbar.component.d.ts +22 -0
  8. package/code-block/code-block.component.d.ts +74 -0
  9. package/code-block/code-block.module.d.ts +14 -0
  10. package/code-block/code-block.types.d.ts +17 -0
  11. package/code-block/index.d.ts +1 -0
  12. package/code-block/public-api.d.ts +3 -0
  13. package/core/formatters/date/formatter.d.ts +55 -1
  14. package/core/option/action.d.ts +2 -0
  15. package/core/selection/pseudo-checkbox/pseudo-checkbox.d.ts +1 -0
  16. package/datepicker/calendar-body.component.d.ts +3 -11
  17. package/datepicker/calendar-header.component.d.ts +45 -0
  18. package/datepicker/calendar.component.d.ts +10 -81
  19. package/datepicker/datepicker-input.directive.d.ts +3 -3
  20. package/datepicker/datepicker-module.d.ts +8 -8
  21. package/datepicker/datepicker.component.d.ts +2 -12
  22. package/datepicker/month-view.component.d.ts +7 -26
  23. package/datepicker/public-api.d.ts +1 -2
  24. package/design-tokens/legacy-2017/tokens/components/code-block.json5 +704 -0
  25. package/design-tokens/legacy-2017/tokens.d.ts +341 -0
  26. package/design-tokens/pt-2022/tokens/components/code-block.json5 +697 -0
  27. package/design-tokens/pt-2022/tokens.d.ts +341 -0
  28. package/design-tokens/style-dictionary/configs/index.js +6 -8
  29. package/dropdown/dropdown-item.component.d.ts +1 -0
  30. package/esm2020/button/button.component.mjs +3 -3
  31. package/esm2020/card/card.component.mjs +3 -3
  32. package/esm2020/checkbox/checkbox.mjs +2 -2
  33. package/esm2020/code-block/actionbar.component.mjs +67 -0
  34. package/esm2020/code-block/code-block.component.mjs +157 -0
  35. package/esm2020/code-block/code-block.module.mjs +60 -0
  36. package/esm2020/code-block/code-block.types.mjs +2 -0
  37. package/esm2020/code-block/index.mjs +2 -0
  38. package/esm2020/code-block/ptsecurity-mosaic-code-block.mjs +5 -0
  39. package/esm2020/code-block/public-api.mjs +4 -0
  40. package/esm2020/core/formatters/date/formatter.mjs +77 -1
  41. package/esm2020/core/formatters/date/templates/en-US.mjs +56 -1
  42. package/esm2020/core/formatters/date/templates/ru-RU.mjs +92 -1
  43. package/esm2020/core/option/action.mjs +3 -2
  44. package/esm2020/core/selection/pseudo-checkbox/pseudo-checkbox.mjs +2 -2
  45. package/esm2020/core/version.mjs +2 -2
  46. package/esm2020/datepicker/calendar-body.component.mjs +9 -28
  47. package/esm2020/datepicker/calendar-header.component.mjs +135 -0
  48. package/esm2020/datepicker/calendar.component.mjs +25 -212
  49. package/esm2020/datepicker/datepicker-input.directive.mjs +54 -54
  50. package/esm2020/datepicker/datepicker-module.mjs +13 -17
  51. package/esm2020/datepicker/datepicker.component.mjs +10 -21
  52. package/esm2020/datepicker/month-view.component.mjs +32 -131
  53. package/esm2020/datepicker/public-api.mjs +2 -3
  54. package/esm2020/design-tokens/legacy-2017/tokens.mjs +342 -1
  55. package/esm2020/design-tokens/pt-2022/tokens.mjs +342 -1
  56. package/esm2020/dropdown/dropdown-item.component.mjs +2 -2
  57. package/esm2020/form-field/form-field.mjs +3 -2
  58. package/esm2020/form-field/hint.mjs +3 -2
  59. package/esm2020/icon/icon.component.mjs +3 -2
  60. package/esm2020/input/input-number-validators.mjs +3 -7
  61. package/esm2020/input/input.mjs +3 -2
  62. package/esm2020/link/link.component.mjs +3 -2
  63. package/esm2020/list/list-selection.component.mjs +3 -2
  64. package/esm2020/modal/modal.component.mjs +4 -3
  65. package/esm2020/progress-bar/progress-bar.component.mjs +3 -2
  66. package/esm2020/progress-spinner/progress-spinner.component.mjs +3 -2
  67. package/esm2020/radio/radio.component.mjs +3 -4
  68. package/esm2020/select/select.component.mjs +18 -6
  69. package/esm2020/select/select.module.mjs +6 -2
  70. package/esm2020/tabs/tab-group.component.mjs +2 -2
  71. package/esm2020/tabs/tab-label-wrapper.directive.mjs +2 -2
  72. package/esm2020/tabs/tab-nav-bar/tab-nav-bar.mjs +3 -2
  73. package/esm2020/tabs/tab.component.mjs +3 -2
  74. package/esm2020/tags/tag-list.component.mjs +3 -2
  75. package/esm2020/tags/tag.component.mjs +3 -2
  76. package/esm2020/textarea/textarea.component.mjs +3 -2
  77. package/esm2020/timezone/timezone-select.component.mjs +2 -2
  78. package/esm2020/toggle/toggle.component.mjs +3 -2
  79. package/esm2020/tree/control/flat-tree-control.mjs +1 -1
  80. package/esm2020/tree/toggle.mjs +3 -2
  81. package/esm2020/tree/tree-base.mjs +1 -1
  82. package/esm2020/tree-select/tree-select.component.mjs +3 -2
  83. package/fesm2015/ptsecurity-mosaic-button.mjs +2 -2
  84. package/fesm2015/ptsecurity-mosaic-button.mjs.map +1 -1
  85. package/fesm2015/ptsecurity-mosaic-card.mjs +2 -2
  86. package/fesm2015/ptsecurity-mosaic-card.mjs.map +1 -1
  87. package/fesm2015/ptsecurity-mosaic-checkbox.mjs +1 -1
  88. package/fesm2015/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  89. package/fesm2015/ptsecurity-mosaic-code-block.mjs +280 -0
  90. package/fesm2015/ptsecurity-mosaic-code-block.mjs.map +1 -0
  91. package/fesm2015/ptsecurity-mosaic-core.mjs +226 -3
  92. package/fesm2015/ptsecurity-mosaic-core.mjs.map +1 -1
  93. package/fesm2015/ptsecurity-mosaic-datepicker.mjs +272 -906
  94. package/fesm2015/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  95. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs +1024 -1
  96. package/fesm2015/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  97. package/fesm2015/ptsecurity-mosaic-dropdown.mjs +1 -1
  98. package/fesm2015/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  99. package/fesm2015/ptsecurity-mosaic-form-field.mjs +4 -2
  100. package/fesm2015/ptsecurity-mosaic-form-field.mjs.map +1 -1
  101. package/fesm2015/ptsecurity-mosaic-icon.mjs +2 -1
  102. package/fesm2015/ptsecurity-mosaic-icon.mjs.map +1 -1
  103. package/fesm2015/ptsecurity-mosaic-input.mjs +4 -7
  104. package/fesm2015/ptsecurity-mosaic-input.mjs.map +1 -1
  105. package/fesm2015/ptsecurity-mosaic-link.mjs +2 -1
  106. package/fesm2015/ptsecurity-mosaic-link.mjs.map +1 -1
  107. package/fesm2015/ptsecurity-mosaic-list.mjs +2 -1
  108. package/fesm2015/ptsecurity-mosaic-list.mjs.map +1 -1
  109. package/fesm2015/ptsecurity-mosaic-modal.mjs +3 -2
  110. package/fesm2015/ptsecurity-mosaic-modal.mjs.map +1 -1
  111. package/fesm2015/ptsecurity-mosaic-progress-bar.mjs +2 -1
  112. package/fesm2015/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
  113. package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs +2 -1
  114. package/fesm2015/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
  115. package/fesm2015/ptsecurity-mosaic-radio.mjs +2 -3
  116. package/fesm2015/ptsecurity-mosaic-radio.mjs.map +1 -1
  117. package/fesm2015/ptsecurity-mosaic-select.mjs +22 -6
  118. package/fesm2015/ptsecurity-mosaic-select.mjs.map +1 -1
  119. package/fesm2015/ptsecurity-mosaic-tabs.mjs +6 -4
  120. package/fesm2015/ptsecurity-mosaic-tabs.mjs.map +1 -1
  121. package/fesm2015/ptsecurity-mosaic-tags.mjs +4 -2
  122. package/fesm2015/ptsecurity-mosaic-tags.mjs.map +1 -1
  123. package/fesm2015/ptsecurity-mosaic-textarea.mjs +2 -1
  124. package/fesm2015/ptsecurity-mosaic-textarea.mjs.map +1 -1
  125. package/fesm2015/ptsecurity-mosaic-timezone.mjs +2 -2
  126. package/fesm2015/ptsecurity-mosaic-timezone.mjs.map +1 -1
  127. package/fesm2015/ptsecurity-mosaic-toggle.mjs +2 -1
  128. package/fesm2015/ptsecurity-mosaic-toggle.mjs.map +1 -1
  129. package/fesm2015/ptsecurity-mosaic-tree-select.mjs +2 -1
  130. package/fesm2015/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  131. package/fesm2015/ptsecurity-mosaic-tree.mjs +2 -1
  132. package/fesm2015/ptsecurity-mosaic-tree.mjs.map +1 -1
  133. package/fesm2020/ptsecurity-mosaic-button.mjs +2 -2
  134. package/fesm2020/ptsecurity-mosaic-button.mjs.map +1 -1
  135. package/fesm2020/ptsecurity-mosaic-card.mjs +2 -2
  136. package/fesm2020/ptsecurity-mosaic-card.mjs.map +1 -1
  137. package/fesm2020/ptsecurity-mosaic-checkbox.mjs +1 -1
  138. package/fesm2020/ptsecurity-mosaic-checkbox.mjs.map +1 -1
  139. package/fesm2020/ptsecurity-mosaic-code-block.mjs +278 -0
  140. package/fesm2020/ptsecurity-mosaic-code-block.mjs.map +1 -0
  141. package/fesm2020/ptsecurity-mosaic-core.mjs +226 -3
  142. package/fesm2020/ptsecurity-mosaic-core.mjs.map +1 -1
  143. package/fesm2020/ptsecurity-mosaic-datepicker.mjs +270 -901
  144. package/fesm2020/ptsecurity-mosaic-datepicker.mjs.map +1 -1
  145. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs +1024 -1
  146. package/fesm2020/ptsecurity-mosaic-design-tokens.mjs.map +1 -1
  147. package/fesm2020/ptsecurity-mosaic-dropdown.mjs +1 -1
  148. package/fesm2020/ptsecurity-mosaic-dropdown.mjs.map +1 -1
  149. package/fesm2020/ptsecurity-mosaic-form-field.mjs +4 -2
  150. package/fesm2020/ptsecurity-mosaic-form-field.mjs.map +1 -1
  151. package/fesm2020/ptsecurity-mosaic-icon.mjs +2 -1
  152. package/fesm2020/ptsecurity-mosaic-icon.mjs.map +1 -1
  153. package/fesm2020/ptsecurity-mosaic-input.mjs +4 -7
  154. package/fesm2020/ptsecurity-mosaic-input.mjs.map +1 -1
  155. package/fesm2020/ptsecurity-mosaic-link.mjs +2 -1
  156. package/fesm2020/ptsecurity-mosaic-link.mjs.map +1 -1
  157. package/fesm2020/ptsecurity-mosaic-list.mjs +2 -1
  158. package/fesm2020/ptsecurity-mosaic-list.mjs.map +1 -1
  159. package/fesm2020/ptsecurity-mosaic-modal.mjs +3 -2
  160. package/fesm2020/ptsecurity-mosaic-modal.mjs.map +1 -1
  161. package/fesm2020/ptsecurity-mosaic-progress-bar.mjs +2 -1
  162. package/fesm2020/ptsecurity-mosaic-progress-bar.mjs.map +1 -1
  163. package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs +2 -1
  164. package/fesm2020/ptsecurity-mosaic-progress-spinner.mjs.map +1 -1
  165. package/fesm2020/ptsecurity-mosaic-radio.mjs +2 -3
  166. package/fesm2020/ptsecurity-mosaic-radio.mjs.map +1 -1
  167. package/fesm2020/ptsecurity-mosaic-select.mjs +22 -6
  168. package/fesm2020/ptsecurity-mosaic-select.mjs.map +1 -1
  169. package/fesm2020/ptsecurity-mosaic-tabs.mjs +6 -4
  170. package/fesm2020/ptsecurity-mosaic-tabs.mjs.map +1 -1
  171. package/fesm2020/ptsecurity-mosaic-tags.mjs +4 -2
  172. package/fesm2020/ptsecurity-mosaic-tags.mjs.map +1 -1
  173. package/fesm2020/ptsecurity-mosaic-textarea.mjs +2 -1
  174. package/fesm2020/ptsecurity-mosaic-textarea.mjs.map +1 -1
  175. package/fesm2020/ptsecurity-mosaic-timezone.mjs +2 -2
  176. package/fesm2020/ptsecurity-mosaic-timezone.mjs.map +1 -1
  177. package/fesm2020/ptsecurity-mosaic-toggle.mjs +2 -1
  178. package/fesm2020/ptsecurity-mosaic-toggle.mjs.map +1 -1
  179. package/fesm2020/ptsecurity-mosaic-tree-select.mjs +2 -1
  180. package/fesm2020/ptsecurity-mosaic-tree-select.mjs.map +1 -1
  181. package/fesm2020/ptsecurity-mosaic-tree.mjs +2 -1
  182. package/fesm2020/ptsecurity-mosaic-tree.mjs.map +1 -1
  183. package/form-field/form-field.d.ts +2 -0
  184. package/form-field/hint.d.ts +2 -0
  185. package/icon/icon.component.d.ts +2 -0
  186. package/input/input-number-validators.d.ts +2 -6
  187. package/input/input.d.ts +2 -0
  188. package/link/link.component.d.ts +2 -0
  189. package/list/list-selection.component.d.ts +2 -0
  190. package/package.json +12 -4
  191. package/prebuilt-themes/dark-theme.css +1 -1
  192. package/prebuilt-themes/default-theme.css +1 -1
  193. package/progress-bar/progress-bar.component.d.ts +2 -0
  194. package/progress-spinner/progress-spinner.component.d.ts +2 -0
  195. package/radio/radio.component.d.ts +2 -0
  196. package/select/select.component.d.ts +9 -2
  197. package/select/select.module.d.ts +1 -1
  198. package/tabs/tab-group.component.d.ts +1 -0
  199. package/tabs/tab-label-wrapper.directive.d.ts +1 -0
  200. package/tabs/tab-nav-bar/tab-nav-bar.d.ts +2 -0
  201. package/tabs/tab.component.d.ts +2 -0
  202. package/tags/tag-list.component.d.ts +2 -0
  203. package/tags/tag.component.d.ts +2 -0
  204. package/textarea/textarea.component.d.ts +2 -0
  205. package/toggle/toggle.component.d.ts +2 -0
  206. package/tree/control/flat-tree-control.d.ts +4 -4
  207. package/tree/toggle.d.ts +2 -0
  208. package/tree-select/tree-select.component.d.ts +2 -0
  209. package/datepicker/multi-year-view.component.d.ts +0 -72
  210. package/datepicker/year-view.component.d.ts +0 -90
  211. package/esm2020/datepicker/multi-year-view.component.mjs +0 -218
  212. package/esm2020/datepicker/year-view.component.mjs +0 -253
@@ -1,27 +1,30 @@
1
1
  import { A11yModule } from '@angular/cdk/a11y';
2
- import * as i3 from '@angular/cdk/overlay';
2
+ import * as i3$1 from '@angular/cdk/overlay';
3
3
  import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
4
- import * as i4 from '@angular/cdk/portal';
5
4
  import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
6
5
  import * as i1 from '@angular/common';
7
6
  import { DOCUMENT, CommonModule } from '@angular/common';
8
7
  import * as i0 from '@angular/core';
9
8
  import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Optional, Inject, ViewChild, Injectable, forwardRef, Directive, ContentChild, InjectionToken, NgModule } from '@angular/core';
10
- import * as i8 from '@ptsecurity/mosaic/button';
9
+ import * as i3 from '@ptsecurity/mosaic/button';
11
10
  import { McButtonModule } from '@ptsecurity/mosaic/button';
12
- import * as i9 from '@ptsecurity/mosaic/icon';
11
+ import * as i7 from '@ptsecurity/mosaic/icon';
13
12
  import { McIconModule } from '@ptsecurity/mosaic/icon';
14
- import { take } from 'rxjs/operators';
13
+ import * as i5 from '@ptsecurity/mosaic/select';
14
+ import { McSelectModule } from '@ptsecurity/mosaic/select';
15
15
  import * as i1$1 from '@ptsecurity/cdk/datetime';
16
16
  import { MC_DATE_FORMATS } from '@ptsecurity/cdk/datetime';
17
+ import * as i4 from '@ptsecurity/mosaic/form-field';
18
+ import { McFormFieldControl } from '@ptsecurity/mosaic/form-field';
19
+ import * as i6 from '@ptsecurity/mosaic/core';
20
+ import { validationTooltipShowDelay, validationTooltipHideDelay } from '@ptsecurity/mosaic/core';
17
21
  import { Subject, Subscription, of, merge } from 'rxjs';
18
- import { SPACE, ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, TAB, ESCAPE, isLetterKey, hasModifierKey, isVerticalMovement, isHorizontalMovement, DELETE, BACKSPACE } from '@ptsecurity/cdk/keycodes';
19
- import * as i2 from '@angular/cdk/bidi';
20
22
  import { coerceBooleanProperty } from '@angular/cdk/coercion';
21
23
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
22
- import { validationTooltipShowDelay, validationTooltipHideDelay } from '@ptsecurity/mosaic/core';
23
- import { McFormFieldControl } from '@ptsecurity/mosaic/form-field';
24
+ import { TAB, SPACE, UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW, HOME, PAGE_UP, END, PAGE_DOWN, ESCAPE, isLetterKey, hasModifierKey, isVerticalMovement, isHorizontalMovement, DELETE, BACKSPACE } from '@ptsecurity/cdk/keycodes';
25
+ import { take } from 'rxjs/operators';
24
26
  import { trigger, state, style, transition, animate } from '@angular/animations';
27
+ import * as i5$1 from '@angular/cdk/bidi';
25
28
 
26
29
  // tslint:disable:no-magic-numbers
27
30
  /**
@@ -29,10 +32,9 @@ import { trigger, state, style, transition, animate } from '@angular/animations'
29
32
  * @docs-private
30
33
  */
31
34
  class McCalendarCell {
32
- constructor(value, displayValue, ariaLabel, enabled, cssClasses) {
35
+ constructor(value, displayValue, enabled, cssClasses) {
33
36
  this.value = value;
34
37
  this.displayValue = displayValue;
35
- this.ariaLabel = ariaLabel;
36
38
  this.enabled = enabled;
37
39
  this.cssClasses = cssClasses;
38
40
  }
@@ -42,9 +44,7 @@ class McCalendarCell {
42
44
  * @docs-private
43
45
  */
44
46
  class McCalendarBody {
45
- constructor(elementRef, ngZone) {
46
- this.elementRef = elementRef;
47
- this.ngZone = ngZone;
47
+ constructor() {
48
48
  /** The number of columns in the table. */
49
49
  this.numCols = 7;
50
50
  /** The cell number of the active cell in the table. */
@@ -84,30 +84,15 @@ class McCalendarBody {
84
84
  }
85
85
  return cellNumber === this.activeCell;
86
86
  }
87
- /** Focuses the active cell after the microtask queue is empty. */
88
- focusActiveCell() {
89
- this.ngZone.runOutsideAngular(() => {
90
- this.ngZone.onStable.asObservable().pipe(take(1)).subscribe(() => {
91
- const activeCell = this.elementRef.nativeElement.querySelector('.mc-calendar__body_active');
92
- if (activeCell) {
93
- activeCell.focus();
94
- }
95
- });
96
- });
97
- }
98
87
  }
99
- /** @nocollapse */ McCalendarBody.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendarBody, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
100
- /** @nocollapse */ McCalendarBody.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McCalendarBody, selector: "[mc-calendar-body]", inputs: { label: "label", rows: "rows", todayValue: "todayValue", selectedValue: "selectedValue", labelMinRequiredCells: "labelMinRequiredCells", numCols: "numCols", activeCell: "activeCell", cellAspectRatio: "cellAspectRatio" }, outputs: { selectedValueChange: "selectedValueChange" }, host: { attributes: { "role": "grid", "aria-readonly": "true" }, classAttribute: "mc-calendar__body" }, exportAs: ["mcCalendarBody"], usesOnChanges: true, ngImport: i0, template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n<tr *ngIf=\"firstRowOffset < labelMinRequiredCells\">\n <td class=\"mc-calendar__body-label\" [attr.colspan]=\"numCols\">\n {{ label }}\n </td>\n</tr>\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\">\n <!--\n We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n The aspect ratio of the table cells is maintained by setting the top and bottom padding as a\n percentage of the width (a variant of the trick described here:\n https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n <td *ngIf=\"rowIndex === 0 && firstRowOffset\"\n class=\"mc-calendar__body-label\"\n [attr.colspan]=\"firstRowOffset\">\n {{ firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"mc-calendar__body-cell\"\n [ngClass]=\"item.cssClasses!\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mc-calendar__body_disabled]=\"!item.enabled\"\n [class.mc-calendar__body_active]=\"isActiveCell(rowIndex, colIndex)\"\n (click)=\"cellClicked(item)\"\n [style.width]=\"cellWidth\"\n [style.paddingTop]=\"cellPadding\"\n [style.paddingBottom]=\"cellPadding\">\n <div class=\"mc-calendar__body-cell-content\"\n [class.mc-selected]=\"selectedValue === item.value\"\n [class.mc-calendar__body-today]=\"todayValue === item.value\">\n {{ item.displayValue }}\n </div>\n </td>\n</tr>\n", styles: [".mc-calendar__body{min-width:224px;min-width:calc(7 * var(--mc-datepicker-body-size-cell-min-size, 32px))}.mc-calendar__body-label{text-align:left;padding:8px 28px 12px 12px;padding:var(--mc-datepicker-body-size-label-paddings, 8px 28px 12px 12px)}.mc-calendar__body-cell{position:relative;height:0;line-height:0;text-align:center;outline:none;cursor:pointer}.mc-calendar__body_disabled{cursor:default}.mc-calendar__body-cell-content{position:absolute;top:5%;top:var(--mc-datepicker-body-size-cell-margin, 5%);left:5%;left:var(--mc-datepicker-body-size-cell-margin, 5%);padding:8px;padding:var(--mc-datepicker-body-size-cell-padding, 8px);display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-width:var(--mc-datepicker-body-size-cell-border-width, 1px);border-radius:0;border-radius:var(--mc-datepicker-body-size-cell-border-radius, 0);border-style:solid}.cdk-high-contrast-active .mc-calendar__body-cell-content{border:none}.cdk-high-contrast-active :host .mc-calendar__body-cell-content{border:none}mc-month-view .mc-calendar__body-cell-content{justify-content:flex-end}mc-multi-year-view .mc-calendar__body-cell-content,mc-year-view .mc-calendar__body-cell-content{justify-content:center}.cdk-high-contrast-active .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active .mc-selected{outline:solid 1px}.cdk-high-contrast-active .mc-calendar__body-today{outline:dotted 1px}.cdk-high-contrast-active :host .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active :host .mc-selected{outline:solid 1px}.cdk-high-contrast-active :host .mc-calendar__body-today{outline:dotted 1px}[dir=rtl] .mc-calendar__body-label{text-align:right}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
88
+ /** @nocollapse */ McCalendarBody.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendarBody, deps: [], target: i0.ɵɵFactoryTarget.Component });
89
+ /** @nocollapse */ McCalendarBody.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McCalendarBody, selector: "[mc-calendar-body]", inputs: { rows: "rows", todayValue: "todayValue", selectedValue: "selectedValue", labelMinRequiredCells: "labelMinRequiredCells", numCols: "numCols", activeCell: "activeCell", cellAspectRatio: "cellAspectRatio" }, outputs: { selectedValueChange: "selectedValueChange" }, host: { classAttribute: "mc-calendar__body" }, exportAs: ["mcCalendarBody"], usesOnChanges: true, ngImport: i0, template: "<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\">\n <!--\n We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n The aspect ratio of the table cells is maintained by setting the top and bottom padding as a\n percentage of the width (a variant of the trick described here:\n https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n <td *ngIf=\"rowIndex === 0 && firstRowOffset\"\n class=\"mc-calendar__body-label\"\n [attr.colspan]=\"firstRowOffset\">\n </td>\n\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"mc-calendar__body-cell\"\n [ngClass]=\"item.cssClasses!\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mc-calendar__body_disabled]=\"!item.enabled\"\n [class.mc-calendar__body_active]=\"isActiveCell(rowIndex, colIndex)\"\n (click)=\"cellClicked(item)\"\n [style.width]=\"cellWidth\"\n [style.paddingTop]=\"cellPadding\"\n [style.paddingBottom]=\"cellPadding\">\n <div class=\"mc-calendar__body-cell-content\"\n [class.mc-selected]=\"selectedValue === item.value\"\n [class.mc-calendar__body-today]=\"todayValue === item.value\">\n {{ item.displayValue }}\n </div>\n </td>\n</tr>\n", styles: [".mc-calendar__body{min-width:224px;min-width:calc(7 * var(--mc-datepicker-body-size-cell-min-size, 32px))}.mc-calendar__body-cell{position:relative;height:0;line-height:0;text-align:center;outline:none;cursor:pointer}.mc-calendar__body_disabled{cursor:default}.mc-calendar__body-cell-content{position:absolute;top:5%;top:var(--mc-datepicker-body-size-cell-margin, 5%);left:5%;left:var(--mc-datepicker-body-size-cell-margin, 5%);padding:8px;padding:var(--mc-datepicker-body-size-cell-padding, 8px);display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-width:var(--mc-datepicker-body-size-cell-border-width, 1px);border-radius:0;border-radius:var(--mc-datepicker-body-size-cell-border-radius, 0);border-style:solid}.cdk-high-contrast-active .mc-calendar__body-cell-content{border:none}.cdk-high-contrast-active :host .mc-calendar__body-cell-content{border:none}mc-month-view .mc-calendar__body-cell-content{justify-content:flex-end}.cdk-high-contrast-active .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active .mc-selected{outline:solid 1px}.cdk-high-contrast-active .mc-calendar__body-today{outline:dotted 1px}.cdk-high-contrast-active :host .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active :host .mc-selected{outline:solid 1px}.cdk-high-contrast-active :host .mc-calendar__body-today{outline:dotted 1px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
101
90
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendarBody, decorators: [{
102
91
  type: Component,
103
92
  args: [{ selector: '[mc-calendar-body]', exportAs: 'mcCalendarBody', host: {
104
- class: 'mc-calendar__body',
105
- role: 'grid',
106
- 'aria-readonly': 'true'
107
- }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!--\n If there's not enough space in the first row, create a separate label row. We mark this row as\n aria-hidden because we don't want it to be read out as one of the weeks in the month.\n-->\n<tr *ngIf=\"firstRowOffset < labelMinRequiredCells\">\n <td class=\"mc-calendar__body-label\" [attr.colspan]=\"numCols\">\n {{ label }}\n </td>\n</tr>\n\n<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\">\n <!--\n We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n The aspect ratio of the table cells is maintained by setting the top and bottom padding as a\n percentage of the width (a variant of the trick described here:\n https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n <td *ngIf=\"rowIndex === 0 && firstRowOffset\"\n class=\"mc-calendar__body-label\"\n [attr.colspan]=\"firstRowOffset\">\n {{ firstRowOffset >= labelMinRequiredCells ? label : '' }}\n </td>\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"mc-calendar__body-cell\"\n [ngClass]=\"item.cssClasses!\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mc-calendar__body_disabled]=\"!item.enabled\"\n [class.mc-calendar__body_active]=\"isActiveCell(rowIndex, colIndex)\"\n (click)=\"cellClicked(item)\"\n [style.width]=\"cellWidth\"\n [style.paddingTop]=\"cellPadding\"\n [style.paddingBottom]=\"cellPadding\">\n <div class=\"mc-calendar__body-cell-content\"\n [class.mc-selected]=\"selectedValue === item.value\"\n [class.mc-calendar__body-today]=\"todayValue === item.value\">\n {{ item.displayValue }}\n </div>\n </td>\n</tr>\n", styles: [".mc-calendar__body{min-width:224px;min-width:calc(7 * var(--mc-datepicker-body-size-cell-min-size, 32px))}.mc-calendar__body-label{text-align:left;padding:8px 28px 12px 12px;padding:var(--mc-datepicker-body-size-label-paddings, 8px 28px 12px 12px)}.mc-calendar__body-cell{position:relative;height:0;line-height:0;text-align:center;outline:none;cursor:pointer}.mc-calendar__body_disabled{cursor:default}.mc-calendar__body-cell-content{position:absolute;top:5%;top:var(--mc-datepicker-body-size-cell-margin, 5%);left:5%;left:var(--mc-datepicker-body-size-cell-margin, 5%);padding:8px;padding:var(--mc-datepicker-body-size-cell-padding, 8px);display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-width:var(--mc-datepicker-body-size-cell-border-width, 1px);border-radius:0;border-radius:var(--mc-datepicker-body-size-cell-border-radius, 0);border-style:solid}.cdk-high-contrast-active .mc-calendar__body-cell-content{border:none}.cdk-high-contrast-active :host .mc-calendar__body-cell-content{border:none}mc-month-view .mc-calendar__body-cell-content{justify-content:flex-end}mc-multi-year-view .mc-calendar__body-cell-content,mc-year-view .mc-calendar__body-cell-content{justify-content:center}.cdk-high-contrast-active .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active .mc-selected{outline:solid 1px}.cdk-high-contrast-active .mc-calendar__body-today{outline:dotted 1px}.cdk-high-contrast-active :host .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active :host .mc-selected{outline:solid 1px}.cdk-high-contrast-active :host .mc-calendar__body-today{outline:dotted 1px}[dir=rtl] .mc-calendar__body-label{text-align:right}\n"] }]
108
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { label: [{
109
- type: Input
110
- }], rows: [{
93
+ class: 'mc-calendar__body'
94
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- Create the first row separately so we can include a special spacer cell. -->\n<tr *ngFor=\"let row of rows; let rowIndex = index\">\n <!--\n We mark this cell as aria-hidden so it doesn't get read out as one of the days in the week.\n The aspect ratio of the table cells is maintained by setting the top and bottom padding as a\n percentage of the width (a variant of the trick described here:\n https://www.w3schools.com/howto/howto_css_aspect_ratio.asp).\n -->\n <td *ngIf=\"rowIndex === 0 && firstRowOffset\"\n class=\"mc-calendar__body-label\"\n [attr.colspan]=\"firstRowOffset\">\n </td>\n\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"mc-calendar__body-cell\"\n [ngClass]=\"item.cssClasses!\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.mc-calendar__body_disabled]=\"!item.enabled\"\n [class.mc-calendar__body_active]=\"isActiveCell(rowIndex, colIndex)\"\n (click)=\"cellClicked(item)\"\n [style.width]=\"cellWidth\"\n [style.paddingTop]=\"cellPadding\"\n [style.paddingBottom]=\"cellPadding\">\n <div class=\"mc-calendar__body-cell-content\"\n [class.mc-selected]=\"selectedValue === item.value\"\n [class.mc-calendar__body-today]=\"todayValue === item.value\">\n {{ item.displayValue }}\n </div>\n </td>\n</tr>\n", styles: [".mc-calendar__body{min-width:224px;min-width:calc(7 * var(--mc-datepicker-body-size-cell-min-size, 32px))}.mc-calendar__body-cell{position:relative;height:0;line-height:0;text-align:center;outline:none;cursor:pointer}.mc-calendar__body_disabled{cursor:default}.mc-calendar__body-cell-content{position:absolute;top:5%;top:var(--mc-datepicker-body-size-cell-margin, 5%);left:5%;left:var(--mc-datepicker-body-size-cell-margin, 5%);padding:8px;padding:var(--mc-datepicker-body-size-cell-padding, 8px);display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;line-height:1;border-width:1px;border-width:var(--mc-datepicker-body-size-cell-border-width, 1px);border-radius:0;border-radius:var(--mc-datepicker-body-size-cell-border-radius, 0);border-style:solid}.cdk-high-contrast-active .mc-calendar__body-cell-content{border:none}.cdk-high-contrast-active :host .mc-calendar__body-cell-content{border:none}mc-month-view .mc-calendar__body-cell-content{justify-content:flex-end}.cdk-high-contrast-active .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active .mc-selected{outline:solid 1px}.cdk-high-contrast-active .mc-calendar__body-today{outline:dotted 1px}.cdk-high-contrast-active :host .mc-datepicker__popup:not(:empty),.cdk-high-contrast-active :host .mc-selected{outline:solid 1px}.cdk-high-contrast-active :host .mc-calendar__body-today{outline:dotted 1px}\n"] }]
95
+ }], propDecorators: { rows: [{
111
96
  type: Input
112
97
  }], todayValue: [{
113
98
  type: Input
@@ -125,38 +110,163 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
125
110
  type: Output
126
111
  }] } });
127
112
 
113
+ const defaultMinYear = 1900;
114
+ const defaultMaxYear = 2099;
115
+ /** Default header for McCalendar */
116
+ class McCalendarHeader {
117
+ constructor(adapter) {
118
+ this.adapter = adapter;
119
+ this.years = [];
120
+ // tslint:disable-next-line:no-magic-numbers
121
+ this._maxDate = this.adapter.createDate(defaultMaxYear, 11);
122
+ this._minDate = this.adapter.createDate(defaultMinYear, 1);
123
+ /** Emits when any date is activated. */
124
+ this.activeDateChange = new EventEmitter();
125
+ this.monthSelected = new EventEmitter();
126
+ this.yearSelected = new EventEmitter();
127
+ this.monthNames = this.adapter.getMonthNames('long')
128
+ .map((name, i) => ({ name, value: i }));
129
+ }
130
+ get activeDate() {
131
+ return this._activeDate;
132
+ }
133
+ set activeDate(value) {
134
+ this._activeDate = value;
135
+ this.updateSelectedValues();
136
+ }
137
+ get maxDate() {
138
+ return this._maxDate;
139
+ }
140
+ set maxDate(value) {
141
+ if (!value) {
142
+ return;
143
+ }
144
+ this._maxDate = value;
145
+ this.updateYearsArray();
146
+ }
147
+ get minDate() {
148
+ return this._minDate;
149
+ }
150
+ set minDate(value) {
151
+ if (!value) {
152
+ return;
153
+ }
154
+ this._minDate = value;
155
+ this.updateYearsArray();
156
+ }
157
+ get previousDisabled() {
158
+ return this.compareDate(this.activeDate, this.minDate) < 0;
159
+ }
160
+ get nextDisabled() {
161
+ return this.compareDate(this.activeDate, this.maxDate) >= 0;
162
+ }
163
+ ngAfterContentInit() {
164
+ this.updateYearsArray();
165
+ this.updateSelectedValues();
166
+ }
167
+ /** Handles when a new month is selected. */
168
+ onMonthSelected(month) {
169
+ const year = this.adapter.getYear(this.activeDate);
170
+ const normalizedDate = this.adapter.createDate(year, month);
171
+ const daysInMonth = this.adapter.getNumDaysInMonth(normalizedDate);
172
+ this.activeDate = this.adapter.createDate(year, month, Math.min(this.adapter.getDate(this.activeDate), daysInMonth));
173
+ this.monthSelected.emit(this.activeDate);
174
+ this.activeDateChange.emit(this.activeDate);
175
+ }
176
+ /** Handles when a new year is selected. */
177
+ onYearSelected(year) {
178
+ const month = this.adapter.getMonth(this.activeDate);
179
+ const daysInMonth = this.adapter.getNumDaysInMonth(this.adapter.createDate(year, month));
180
+ this.activeDate = this.adapter.createDate(year, month, Math.min(this.adapter.getDate(this.activeDate), daysInMonth));
181
+ this.yearSelected.emit(this.activeDate);
182
+ this.activeDateChange.emit(this.activeDate);
183
+ }
184
+ selectCurrentDate() {
185
+ this.activeDate = this.adapter.today();
186
+ this.activeDateChange.emit(this.activeDate);
187
+ }
188
+ /** Handles user clicks on the previous button. */
189
+ selectPreviousMonth() {
190
+ this.activeDate = this.adapter.addCalendarMonths(this.activeDate, -1);
191
+ this.activeDateChange.emit(this.activeDate);
192
+ }
193
+ /** Handles user clicks on the next button. */
194
+ selectNextMonth() {
195
+ this.activeDate = this.adapter.addCalendarMonths(this.activeDate, 1);
196
+ this.activeDateChange.emit(this.activeDate);
197
+ }
198
+ compareDate(first, second) {
199
+ const normalizedFirst = this.adapter.createDate(this.adapter.getYear(first), this.adapter.getMonth(first));
200
+ const normalizedSecond = this.adapter.createDate(this.adapter.getYear(second), this.adapter.getMonth(second));
201
+ return this.adapter.compareDate(normalizedFirst, normalizedSecond);
202
+ }
203
+ updateSelectedValues() {
204
+ this.selectedMonth = this.monthNames[this.adapter.getMonth(this.activeDate)].value;
205
+ const selectedYear = this.adapter.getYear(this.activeDate);
206
+ this.selectedYear = this.years.includes(selectedYear) ? selectedYear : this.years[0];
207
+ }
208
+ updateYearsArray() {
209
+ const minYear = this.adapter.getYear(this.minDate);
210
+ const maxYear = this.adapter.getYear(this.maxDate);
211
+ this.years = [];
212
+ for (let i = minYear; i <= maxYear; i++) {
213
+ this.years.push(i);
214
+ }
215
+ }
216
+ }
217
+ /** @nocollapse */ McCalendarHeader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendarHeader, deps: [{ token: i1$1.DateAdapter }], target: i0.ɵɵFactoryTarget.Component });
218
+ /** @nocollapse */ McCalendarHeader.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McCalendarHeader, selector: "mc-calendar-header", inputs: { activeDate: "activeDate", maxDate: "maxDate", minDate: "minDate" }, outputs: { activeDateChange: "activeDateChange", monthSelected: "monthSelected", yearSelected: "yearSelected" }, host: { classAttribute: "mc-calendar-header" }, exportAs: ["mcCalendarHeader"], ngImport: i0, template: "<div class=\"mc-calendar-header__select-group\">\n <mc-select\n class=\"mc-calendar-header__select\"\n #monthSelect=\"mcSelect\"\n [value]=\"selectedMonth\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onMonthSelected($event.value)\">\n\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"monthSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ monthSelect.triggerValue }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let month of monthNames\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"month.value\">\n {{ month.name }}\n </mc-option>\n </mc-select>\n\n <mc-select\n #yearSelect=\"mcSelect\"\n [value]=\"selectedYear\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onYearSelected($event.value)\">\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"yearSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ yearSelect.triggerValue }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let year of years\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"year\">\n {{ year }}\n </mc-option>\n </mc-select>\n</div>\n\n<div class=\"mc-calendar-header__button-group\">\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__previous-button\"\n [tabindex]=\"-1\"\n [disabled]=\"previousDisabled\"\n (click)=\"selectPreviousMonth()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\">\n\n <i mc-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__next-button\"\n [tabindex]=\"-1\"\n [disabled]=\"nextDisabled\"\n (click)=\"selectNextMonth()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".mc-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding:16px 8px 12px;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar-header__previous-button:after{border-left-width:2px;border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(2px) rotate(-45deg);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar-header__next-button:after{border-right-width:2px;border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(-2px) rotate(45deg);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar-header__select{width:auto!important}.mc-calendar-header__button-group,.mc-calendar-header__select-group{display:flex;flex-direction:row}.mc-calendar-select-panel{margin-top:2px;min-width:98%!important}.mc-calendar-select-panel .mc-select__content{max-height:384px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: i3.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { kind: "directive", type: i3.McButtonCssStyler, selector: "[mc-button]" }, { kind: "directive", type: i4.McValidateDirective, selector: " input[mcInput], input[mcInputPassword], input[mcTimepicker], input[mcDatepicker], mc-select, mc-tag-list, textarea[mcTextarea], mc-tree-select ", exportAs: ["McValidate"] }, { kind: "component", type: i5.McSelect, selector: "mc-select", inputs: ["disabled", "tabIndex", "hiddenItemsText", "panelClass", "backdropClass", "errorStateMatcher", "sortComparator", "hasBackdrop", "placeholder", "required", "multiple", "compareWith", "value", "id", "hiddenItemsTextFormatter"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["mcSelect"] }, { kind: "directive", type: i5.McSelectMatcher, selector: "mc-select-matcher, [mc-select-matcher]" }, { kind: "directive", type: i5.McOptionTooltip, selector: "mc-option" }, { kind: "component", type: i6.McOption, selector: "mc-option", inputs: ["value", "showCheckbox", "disabled"], outputs: ["onSelectionChange"], exportAs: ["mcOption"] }, { kind: "component", type: i7.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i7.McIconCSSStyler, selector: "[mc-icon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendarHeader, decorators: [{
220
+ type: Component,
221
+ args: [{ selector: 'mc-calendar-header', exportAs: 'mcCalendarHeader', host: {
222
+ class: 'mc-calendar-header'
223
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"mc-calendar-header__select-group\">\n <mc-select\n class=\"mc-calendar-header__select\"\n #monthSelect=\"mcSelect\"\n [value]=\"selectedMonth\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onMonthSelected($event.value)\">\n\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"monthSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ monthSelect.triggerValue }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let month of monthNames\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"month.value\">\n {{ month.name }}\n </mc-option>\n </mc-select>\n\n <mc-select\n #yearSelect=\"mcSelect\"\n [value]=\"selectedYear\"\n [panelClass]=\"'mc-calendar-select-panel'\"\n (selectionChange)=\"onYearSelected($event.value)\">\n <button class=\"mc-button_transparent layout-padding-right-xs\"\n mc-button\n mc-select-matcher\n [class.mc-active]=\"yearSelect.panelOpen\"\n [tabindex]=\"-1\">\n {{ yearSelect.triggerValue }}\n\n <i class=\"layout-padding-left-3xs\" mc-icon=\"mc-angle-down-S_16\"></i>\n </button>\n\n <mc-option *ngFor=\"let year of years\"\n [mcTooltipDisabled]=\"true\"\n [value]=\"year\">\n {{ year }}\n </mc-option>\n </mc-select>\n</div>\n\n<div class=\"mc-calendar-header__button-group\">\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__previous-button\"\n [tabindex]=\"-1\"\n [disabled]=\"previousDisabled\"\n (click)=\"selectPreviousMonth()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent\"\n [tabindex]=\"-1\"\n (click)=\"selectCurrentDate()\">\n\n <i mc-icon=\"mc-circle-8_16\"></i>\n </button>\n\n <button mc-button\n class=\"mc-button_transparent mc-calendar-header__next-button\"\n [tabindex]=\"-1\"\n [disabled]=\"nextDisabled\"\n (click)=\"selectNextMonth()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n </button>\n</div>\n", styles: [".mc-calendar-header{display:flex;flex-direction:row;justify-content:space-between;padding:16px 8px 12px;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar-header__previous-button:after{border-left-width:2px;border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(2px) rotate(-45deg);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar-header__next-button:after{border-right-width:2px;border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(-2px) rotate(45deg);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar-header__select{width:auto!important}.mc-calendar-header__button-group,.mc-calendar-header__select-group{display:flex;flex-direction:row}.mc-calendar-select-panel{margin-top:2px;min-width:98%!important}.mc-calendar-select-panel .mc-select__content{max-height:384px}\n"] }]
224
+ }], ctorParameters: function () { return [{ type: i1$1.DateAdapter }]; }, propDecorators: { activeDate: [{
225
+ type: Input
226
+ }], maxDate: [{
227
+ type: Input
228
+ }], minDate: [{
229
+ type: Input
230
+ }], activeDateChange: [{
231
+ type: Output
232
+ }], monthSelected: [{
233
+ type: Output
234
+ }], yearSelected: [{
235
+ type: Output
236
+ }] } });
237
+
128
238
  /** @docs-private */
129
239
  function createMissingDateImplError(provider) {
130
240
  return Error(`McDatepicker: No provider found for ${provider}. You must import one of the existing ` +
131
241
  `modules at your application root or provide a custom implementation or use exists ones.`);
132
242
  }
133
243
 
244
+ // tslint:disable:no-magic-numbers
134
245
  const DAYS_PER_WEEK = 7;
135
246
  /**
136
247
  * An internal component used to display a single month in the datepicker.
137
248
  * @docs-private
138
249
  */
139
250
  class McMonthView {
140
- constructor(changeDetectorRef, dateFormats, dateAdapter, dir) {
251
+ constructor(changeDetectorRef, dateFormats, adapter) {
141
252
  this.changeDetectorRef = changeDetectorRef;
142
253
  this.dateFormats = dateFormats;
143
- this.dateAdapter = dateAdapter;
144
- this.dir = dir;
254
+ this.adapter = adapter;
145
255
  /** Emits when a new date is selected. */
146
256
  this.selectedChange = new EventEmitter();
147
257
  /** Emits when any date is selected. */
148
258
  this.userSelection = new EventEmitter();
149
259
  /** Emits when any date is activated. */
150
260
  this.activeDateChange = new EventEmitter();
151
- if (!this.dateAdapter) {
261
+ if (!this.adapter) {
152
262
  throw createMissingDateImplError('DateAdapter');
153
263
  }
154
264
  if (!this.dateFormats) {
155
265
  throw createMissingDateImplError('MC_DATE_FORMATS');
156
266
  }
157
- const firstDayOfWeek = this.dateAdapter.getFirstDayOfWeek();
158
- const narrowWeekdays = this.dateAdapter.getDayOfWeekNames('short');
159
- const longWeekdays = this.dateAdapter.getDayOfWeekNames('long');
267
+ const firstDayOfWeek = this.adapter.getFirstDayOfWeek();
268
+ const narrowWeekdays = this.adapter.getDayOfWeekNames('short');
269
+ const longWeekdays = this.adapter.getDayOfWeekNames('long');
160
270
  // Rotate the labels for days of the week based on the configured first day of the week.
161
271
  const weekdays = longWeekdays.map((long, i) => {
162
272
  return { long, narrow: narrowWeekdays[i] };
@@ -164,7 +274,7 @@ class McMonthView {
164
274
  this.weekdays = weekdays
165
275
  .slice(firstDayOfWeek)
166
276
  .concat(weekdays.slice(0, firstDayOfWeek));
167
- this._activeDate = this.dateAdapter.today();
277
+ this._activeDate = this.adapter.today();
168
278
  }
169
279
  /**
170
280
  * The date to display in this month view (everything other than the month and year is ignored).
@@ -173,10 +283,9 @@ class McMonthView {
173
283
  return this._activeDate;
174
284
  }
175
285
  set activeDate(value) {
176
- const oldActiveDate = this._activeDate;
177
- const validDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value)) || this.dateAdapter.today();
178
- this._activeDate = this.dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
179
- if (!this.hasSameMonthAndYear(oldActiveDate, this._activeDate)) {
286
+ const oldValue = this._activeDate;
287
+ this._activeDate = value;
288
+ if (!this.hasSameMonthAndYear(oldValue, value)) {
180
289
  this.init();
181
290
  }
182
291
  }
@@ -185,165 +294,73 @@ class McMonthView {
185
294
  return this._selected;
186
295
  }
187
296
  set selected(value) {
188
- this._selected = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
297
+ this._selected = value;
189
298
  this.selectedDate = this.getDateInCurrentMonth(this._selected);
190
299
  }
191
- /** The minimum selectable date. */
192
- get minDate() {
193
- return this._minDate;
194
- }
195
- set minDate(value) {
196
- this._minDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
197
- }
198
- /** The maximum selectable date. */
199
- get maxDate() {
200
- return this._maxDate;
201
- }
202
- set maxDate(value) {
203
- this._maxDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
204
- }
205
300
  ngAfterContentInit() {
206
301
  this.init();
207
302
  }
208
303
  /** Handles when a new date is selected. */
209
304
  dateSelected(date) {
210
305
  if (this.selectedDate !== date) {
211
- const selectedYear = this.dateAdapter.getYear(this.activeDate);
212
- const selectedMonth = this.dateAdapter.getMonth(this.activeDate);
213
- const selectedDate = this.dateAdapter.createDate(selectedYear, selectedMonth, date);
306
+ const selectedYear = this.adapter.getYear(this.activeDate);
307
+ const selectedMonth = this.adapter.getMonth(this.activeDate);
308
+ const selectedDate = this.adapter.createDate(selectedYear, selectedMonth, date);
214
309
  this.selectedChange.emit(selectedDate);
215
310
  }
216
311
  this.userSelection.emit();
217
312
  }
218
- /** Handles keydown events on the calendar body when calendar is in month view. */
219
- handleCalendarBodyKeydown(event) {
220
- // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
221
- // disabled ones from being selected. This may not be ideal, we should look into whether
222
- // navigation should skip over disabled dates, and if so, how to implement that efficiently.
223
- const oldActiveDate = this._activeDate;
224
- const isRtl = this.isRtl();
225
- // tslint:disable-next-line:deprecation
226
- switch (event.keyCode) {
227
- case LEFT_ARROW:
228
- this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, isRtl ? 1 : -1);
229
- break;
230
- case RIGHT_ARROW:
231
- this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, isRtl ? -1 : 1);
232
- break;
233
- case UP_ARROW:
234
- this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, -7);
235
- break;
236
- case DOWN_ARROW:
237
- this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, 7);
238
- break;
239
- case HOME:
240
- this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, 1 - this.dateAdapter.getDate(this._activeDate));
241
- break;
242
- case END:
243
- this.activeDate = this.dateAdapter.addCalendarDays(this._activeDate, (this.dateAdapter.getNumDaysInMonth(this._activeDate) - this.dateAdapter.getDate(this._activeDate)));
244
- break;
245
- case PAGE_UP:
246
- this.activeDate = event.altKey ?
247
- this.dateAdapter.addCalendarYears(this._activeDate, -1) :
248
- this.dateAdapter.addCalendarMonths(this._activeDate, -1);
249
- break;
250
- case PAGE_DOWN:
251
- this.activeDate = event.altKey ?
252
- this.dateAdapter.addCalendarYears(this._activeDate, 1) :
253
- this.dateAdapter.addCalendarMonths(this._activeDate, 1);
254
- break;
255
- case ENTER:
256
- case SPACE:
257
- if (!this.dateFilter || this.dateFilter(this._activeDate)) {
258
- this.dateSelected(this.dateAdapter.getDate(this._activeDate));
259
- this.userSelection.emit();
260
- // Prevent unexpected default actions such as form submission.
261
- event.preventDefault();
262
- }
263
- return;
264
- default:
265
- // Don't prevent default or focus active cell on keys that we don't explicitly handle.
266
- return;
267
- }
268
- if (this.dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
269
- this.activeDateChange.emit(this.activeDate);
270
- }
271
- this.focusActiveCell();
272
- // Prevent unexpected default actions such as form submission.
273
- event.preventDefault();
274
- }
275
313
  /** Initializes this month view. */
276
314
  init() {
277
315
  this.selectedDate = this.getDateInCurrentMonth(this.selected);
278
- this.todayDate = this.getDateInCurrentMonth(this.dateAdapter.today());
279
- this.monthLabel = this.dateAdapter.getMonthNames('short')[this.dateAdapter.getMonth(this.activeDate)];
280
- this.monthLabel = this.monthLabel[0].toLocaleUpperCase() + this.monthLabel.substr(1);
281
- const firstOfMonth = this.dateAdapter.createDate(this.dateAdapter.getYear(this.activeDate), this.dateAdapter.getMonth(this.activeDate));
282
- this.firstWeekOffset =
283
- (DAYS_PER_WEEK + this.dateAdapter.getDayOfWeek(firstOfMonth) -
284
- this.dateAdapter.getFirstDayOfWeek()) % DAYS_PER_WEEK;
316
+ this.todayDate = this.getDateInCurrentMonth(this.adapter.today());
317
+ const firstOfMonth = this.adapter.createDate(this.adapter.getYear(this.activeDate), this.adapter.getMonth(this.activeDate));
318
+ this.firstWeekOffset = (DAYS_PER_WEEK + this.adapter.getDayOfWeek(firstOfMonth) - this.adapter.getFirstDayOfWeek()) % DAYS_PER_WEEK;
285
319
  this.createWeekCells();
286
320
  this.changeDetectorRef.markForCheck();
287
321
  }
288
- /** Focuses the active cell after the microtask queue is empty. */
289
- focusActiveCell() {
290
- this.mcCalendarBody.focusActiveCell();
291
- }
292
322
  /** Creates McCalendarCells for the dates in this month. */
293
323
  createWeekCells() {
294
- const daysInMonth = this.dateAdapter.getNumDaysInMonth(this.activeDate);
295
- const dateNames = this.dateAdapter.getDateNames();
324
+ const daysInMonth = this.adapter.getNumDaysInMonth(this.activeDate);
325
+ const dateNames = this.adapter.getDateNames();
296
326
  this.weeks = [[]];
297
327
  for (let i = 0, cell = this.firstWeekOffset; i < daysInMonth; i++, cell++) {
298
328
  if (cell === DAYS_PER_WEEK) {
299
329
  this.weeks.push([]);
300
330
  cell = 0;
301
331
  }
302
- const date = this.dateAdapter.createDate(this.dateAdapter.getYear(this.activeDate), this.dateAdapter.getMonth(this.activeDate), i + 1);
332
+ const date = this.adapter.createDate(this.adapter.getYear(this.activeDate), this.adapter.getMonth(this.activeDate), i + 1);
303
333
  const enabled = this.shouldEnableDate(date);
304
- const ariaLabel = this.dateAdapter.format(date, this.dateFormats.dateA11yLabel);
305
334
  const cellClasses = this.dateClass ? this.dateClass(date) : undefined;
306
335
  this.weeks[this.weeks.length - 1]
307
- .push(new McCalendarCell(i + 1, dateNames[i], ariaLabel, enabled, cellClasses));
336
+ .push(new McCalendarCell(i + 1, dateNames[i], enabled, cellClasses));
308
337
  }
309
338
  }
310
339
  /** Date filter for the month */
311
340
  shouldEnableDate(date) {
312
341
  return !!date &&
313
342
  (!this.dateFilter || this.dateFilter(date)) &&
314
- (!this.minDate || this.dateAdapter.compareDate(date, this.minDate) >= 0) &&
315
- (!this.maxDate || this.dateAdapter.compareDate(date, this.maxDate) <= 0);
343
+ (!this.minDate || this.adapter.compareDate(date, this.minDate) >= 0) &&
344
+ (!this.maxDate || this.adapter.compareDate(date, this.maxDate) <= 0);
316
345
  }
317
346
  /**
318
347
  * Gets the date in this month that the given Date falls on.
319
348
  * Returns null if the given Date is in another month.
320
349
  */
321
350
  getDateInCurrentMonth(date) {
322
- return date && this.hasSameMonthAndYear(date, this.activeDate) ?
323
- this.dateAdapter.getDate(date) : null;
351
+ return date && this.hasSameMonthAndYear(date, this.activeDate) ? this.adapter.getDate(date) : null;
324
352
  }
325
353
  /** Checks whether the 2 dates are non-null and fall within the same month of the same year. */
326
354
  hasSameMonthAndYear(d1, d2) {
327
- return !!(d1 && d2 && this.dateAdapter.getMonth(d1) === this.dateAdapter.getMonth(d2) &&
328
- this.dateAdapter.getYear(d1) === this.dateAdapter.getYear(d2));
329
- }
330
- /**
331
- * @param obj The object to check.
332
- * @returns The given object if it is both a date instance and valid, otherwise null.
333
- */
334
- getValidDateOrNull(obj) {
335
- return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
336
- }
337
- /** Determines whether the user has the RTL layout direction. */
338
- isRtl() {
339
- return this.dir && this.dir.value === 'rtl';
355
+ return !!(d1 && d2 && this.adapter.getMonth(d1) === this.adapter.getMonth(d2) &&
356
+ this.adapter.getYear(d1) === this.adapter.getYear(d2));
340
357
  }
341
358
  }
342
- /** @nocollapse */ McMonthView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McMonthView, deps: [{ token: i0.ChangeDetectorRef }, { token: MC_DATE_FORMATS, optional: true }, { token: i1$1.DateAdapter, optional: true }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component });
343
- /** @nocollapse */ McMonthView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McMonthView, selector: "mc-month-view", inputs: { activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter", dateClass: "dateClass" }, outputs: { selectedChange: "selectedChange", userSelection: "userSelection", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "mcCalendarBody", first: true, predicate: McCalendarBody, descendants: true }], exportAs: ["mcMonthView"], ngImport: i0, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th *ngFor=\"let day of weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [label]=\"monthLabel\"\n [rows]=\"weeks\"\n [todayValue]=\"todayDate!\"\n [selectedValue]=\"selectedDate!\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"dateAdapter.getDate(activeDate) - 1\"\n (selectedValueChange)=\"dateSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: McCalendarBody, selector: "[mc-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "activeCell", "cellAspectRatio"], outputs: ["selectedValueChange"], exportAs: ["mcCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
359
+ /** @nocollapse */ McMonthView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McMonthView, deps: [{ token: i0.ChangeDetectorRef }, { token: MC_DATE_FORMATS, optional: true }, { token: i1$1.DateAdapter, optional: true }], target: i0.ɵɵFactoryTarget.Component });
360
+ /** @nocollapse */ McMonthView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McMonthView, selector: "mc-month-view", inputs: { activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter", dateClass: "dateClass" }, outputs: { selectedChange: "selectedChange", userSelection: "userSelection", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "mcCalendarBody", first: true, predicate: McCalendarBody, descendants: true }], exportAs: ["mcMonthView"], ngImport: i0, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th *ngFor=\"let day of weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [rows]=\"weeks\"\n [todayValue]=\"todayDate!\"\n [selectedValue]=\"selectedDate!\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"adapter.getDate(activeDate) - 1\"\n (selectedValueChange)=\"dateSelected($event)\">\n </tbody>\n</table>\n", dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: McCalendarBody, selector: "[mc-calendar-body]", inputs: ["rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "activeCell", "cellAspectRatio"], outputs: ["selectedValueChange"], exportAs: ["mcCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
344
361
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McMonthView, decorators: [{
345
362
  type: Component,
346
- args: [{ selector: 'mc-month-view', exportAs: 'mcMonthView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th *ngFor=\"let day of weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [label]=\"monthLabel\"\n [rows]=\"weeks\"\n [todayValue]=\"todayDate!\"\n [selectedValue]=\"selectedDate!\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"dateAdapter.getDate(activeDate) - 1\"\n (selectedValueChange)=\"dateSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n" }]
363
+ args: [{ selector: 'mc-month-view', exportAs: 'mcMonthView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th *ngFor=\"let day of weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [rows]=\"weeks\"\n [todayValue]=\"todayDate!\"\n [selectedValue]=\"selectedDate!\"\n [labelMinRequiredCells]=\"3\"\n [activeCell]=\"adapter.getDate(activeDate) - 1\"\n (selectedValueChange)=\"dateSelected($event)\">\n </tbody>\n</table>\n" }]
347
364
  }], ctorParameters: function () {
348
365
  return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
349
366
  type: Optional
@@ -352,8 +369,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
352
369
  args: [MC_DATE_FORMATS]
353
370
  }] }, { type: i1$1.DateAdapter, decorators: [{
354
371
  type: Optional
355
- }] }, { type: i2.Directionality, decorators: [{
356
- type: Optional
357
372
  }] }];
358
373
  }, propDecorators: { activeDate: [{
359
374
  type: Input
@@ -378,460 +393,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
378
393
  args: [McCalendarBody, { static: false }]
379
394
  }] } });
380
395
 
381
- const yearsPerPage = 24;
382
- const yearsPerRow = 4;
383
- /**
384
- * An internal component used to display a year selector in the datepicker.
385
- * @docs-private
386
- */
387
- class McMultiYearView {
388
- constructor(changeDetectorRef, dateAdapter, dir) {
389
- this.changeDetectorRef = changeDetectorRef;
390
- this.dateAdapter = dateAdapter;
391
- this.dir = dir;
392
- /** Emits when a new year is selected. */
393
- this.selectedChange = new EventEmitter();
394
- /** Emits the selected year. This doesn't imply a change on the selected date */
395
- this.yearSelected = new EventEmitter();
396
- /** Emits when any date is activated. */
397
- this.activeDateChange = new EventEmitter();
398
- if (!this.dateAdapter) {
399
- throw createMissingDateImplError('DateAdapter');
400
- }
401
- this._activeDate = this.dateAdapter.today();
402
- }
403
- /** The date to display in this multi-year view (everything other than the year is ignored). */
404
- get activeDate() {
405
- return this._activeDate;
406
- }
407
- set activeDate(value) {
408
- const oldActiveDate = this._activeDate;
409
- const validDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value)) || this.dateAdapter.today();
410
- this._activeDate = this.dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
411
- if (Math.floor(this.dateAdapter.getYear(oldActiveDate) / yearsPerPage) !==
412
- Math.floor(this.dateAdapter.getYear(this._activeDate) / yearsPerPage)) {
413
- this.init();
414
- }
415
- }
416
- /** The currently selected date. */
417
- get selected() {
418
- return this._selected;
419
- }
420
- set selected(value) {
421
- this._selected = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
422
- this.selectedYear = this._selected && this.dateAdapter.getYear(this._selected);
423
- }
424
- /** The minimum selectable date. */
425
- get minDate() {
426
- return this._minDate;
427
- }
428
- set minDate(value) {
429
- this._minDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
430
- }
431
- /** The maximum selectable date. */
432
- get maxDate() {
433
- return this._maxDate;
434
- }
435
- set maxDate(value) {
436
- this._maxDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
437
- }
438
- ngAfterContentInit() {
439
- this.init();
440
- }
441
- /** Initializes this multi-year view. */
442
- init() {
443
- this.todayYear = this.dateAdapter.getYear(this.dateAdapter.today());
444
- const activeYear = this.dateAdapter.getYear(this._activeDate);
445
- const activeOffset = activeYear % yearsPerPage;
446
- this.years = [];
447
- for (let i = 0, row = []; i < yearsPerPage; i++) {
448
- row.push(activeYear - activeOffset + i);
449
- if (row.length === yearsPerRow) {
450
- this.years.push(row.map((year) => this.createCellForYear(year)));
451
- row = [];
452
- }
453
- }
454
- this.changeDetectorRef.markForCheck();
455
- }
456
- /** Handles when a new year is selected. */
457
- onYearSelected(year) {
458
- this.yearSelected.emit(this.dateAdapter.createDate(year));
459
- const month = this.dateAdapter.getMonth(this.activeDate);
460
- const daysInMonth = this.dateAdapter.getNumDaysInMonth(this.dateAdapter.createDate(year, month));
461
- this.selectedChange.emit(this.dateAdapter.createDate(year, month, Math.min(this.dateAdapter.getDate(this.activeDate), daysInMonth)));
462
- }
463
- /** Handles keydown events on the calendar body when calendar is in multi-year view. */
464
- handleCalendarBodyKeydown(event) {
465
- // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
466
- // disabled ones from being selected. This may not be ideal, we should look into whether
467
- // navigation should skip over disabled dates, and if so, how to implement that efficiently.
468
- const oldActiveDate = this._activeDate;
469
- const isRtl = this.isRtl();
470
- // tslint:disable-next-line:deprecation
471
- switch (event.keyCode) {
472
- case LEFT_ARROW:
473
- this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, isRtl ? 1 : -1);
474
- break;
475
- case RIGHT_ARROW:
476
- this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, isRtl ? -1 : 1);
477
- break;
478
- case UP_ARROW:
479
- this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, -yearsPerRow);
480
- break;
481
- case DOWN_ARROW:
482
- this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, yearsPerRow);
483
- break;
484
- case HOME:
485
- this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, -this.dateAdapter.getYear(this._activeDate) % yearsPerPage);
486
- break;
487
- case END:
488
- this.activeDate = this.dateAdapter.addCalendarYears(this._activeDate, yearsPerPage - this.dateAdapter.getYear(this._activeDate) % yearsPerPage - 1);
489
- break;
490
- case PAGE_UP:
491
- this.activeDate =
492
- this.dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -yearsPerPage * 10 : -yearsPerPage);
493
- break;
494
- case PAGE_DOWN:
495
- this.activeDate =
496
- this.dateAdapter.addCalendarYears(this._activeDate, event.altKey ? yearsPerPage * 10 : yearsPerPage);
497
- break;
498
- case ENTER:
499
- case SPACE:
500
- this.onYearSelected(this.dateAdapter.getYear(this._activeDate));
501
- break;
502
- default:
503
- // Don't prevent default or focus active cell on keys that we don't explicitly handle.
504
- return;
505
- }
506
- if (this.dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
507
- this.activeDateChange.emit(this.activeDate);
508
- }
509
- this.focusActiveCell();
510
- // Prevent unexpected default actions such as form submission.
511
- event.preventDefault();
512
- }
513
- getActiveCell() {
514
- return this.dateAdapter.getYear(this.activeDate) % yearsPerPage;
515
- }
516
- /** Focuses the active cell after the microtask queue is empty. */
517
- focusActiveCell() {
518
- this.mcCalendarBody.focusActiveCell();
519
- }
520
- /** Creates an McCalendarCell for the given year. */
521
- createCellForYear(year) {
522
- const yearName = this.dateAdapter.getYearName(this.dateAdapter.createDate(year));
523
- return new McCalendarCell(year, yearName, yearName, this.shouldEnableYear(year));
524
- }
525
- /** Whether the given year is enabled. */
526
- shouldEnableYear(year) {
527
- // disable if the year is greater than maxDate lower than minDate
528
- if (year === undefined || year === null ||
529
- (this.maxDate && year > this.dateAdapter.getYear(this.maxDate)) ||
530
- (this.minDate && year < this.dateAdapter.getYear(this.minDate))) {
531
- return false;
532
- }
533
- // enable if it reaches here and there's no filter defined
534
- if (!this.dateFilter) {
535
- return true;
536
- }
537
- const firstOfYear = this.dateAdapter.createDate(year);
538
- // If any date in the year is enabled count the year as enabled.
539
- for (let date = firstOfYear; this.dateAdapter.getYear(date) === year; date = this.dateAdapter.addCalendarDays(date, 1)) {
540
- if (this.dateFilter(date)) {
541
- return true;
542
- }
543
- }
544
- return false;
545
- }
546
- /**
547
- * @param obj The object to check.
548
- * @returns The given object if it is both a date instance and valid, otherwise null.
549
- */
550
- getValidDateOrNull(obj) {
551
- return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
552
- }
553
- /** Determines whether the user has the RTL layout direction. */
554
- isRtl() {
555
- return this.dir && this.dir.value === 'rtl';
556
- }
557
- }
558
- /** @nocollapse */ McMultiYearView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McMultiYearView, deps: [{ token: i0.ChangeDetectorRef }, { token: i1$1.DateAdapter, optional: true }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component });
559
- /** @nocollapse */ McMultiYearView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McMultiYearView, selector: "mc-multi-year-view", inputs: { activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter" }, outputs: { selectedChange: "selectedChange", yearSelected: "yearSelected", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "mcCalendarBody", first: true, predicate: McCalendarBody, descendants: true }], exportAs: ["mcMultiYearView"], ngImport: i0, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [rows]=\"years\"\n [todayValue]=\"todayYear\"\n [selectedValue]=\"selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"getActiveCell()\"\n (selectedValueChange)=\"onYearSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n", dependencies: [{ kind: "component", type: McCalendarBody, selector: "[mc-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "activeCell", "cellAspectRatio"], outputs: ["selectedValueChange"], exportAs: ["mcCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
560
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McMultiYearView, decorators: [{
561
- type: Component,
562
- args: [{ selector: 'mc-multi-year-view', exportAs: 'mcMultiYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [rows]=\"years\"\n [todayValue]=\"todayYear\"\n [selectedValue]=\"selectedYear!\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"getActiveCell()\"\n (selectedValueChange)=\"onYearSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n" }]
563
- }], ctorParameters: function () {
564
- return [{ type: i0.ChangeDetectorRef }, { type: i1$1.DateAdapter, decorators: [{
565
- type: Optional
566
- }] }, { type: i2.Directionality, decorators: [{
567
- type: Optional
568
- }] }];
569
- }, propDecorators: { activeDate: [{
570
- type: Input
571
- }], selected: [{
572
- type: Input
573
- }], minDate: [{
574
- type: Input
575
- }], maxDate: [{
576
- type: Input
577
- }], dateFilter: [{
578
- type: Input
579
- }], selectedChange: [{
580
- type: Output
581
- }], yearSelected: [{
582
- type: Output
583
- }], activeDateChange: [{
584
- type: Output
585
- }], mcCalendarBody: [{
586
- type: ViewChild,
587
- args: [McCalendarBody, { static: false }]
588
- }] } });
589
-
590
- /**
591
- * An internal component used to display a single year in the datepicker.
592
- * @docs-private
593
- */
594
- class McYearView {
595
- constructor(changeDetectorRef, dateFormats, dateAdapter, dir) {
596
- this.changeDetectorRef = changeDetectorRef;
597
- this.dateFormats = dateFormats;
598
- this.dateAdapter = dateAdapter;
599
- this.dir = dir;
600
- /** Emits when a new month is selected. */
601
- this.selectedChange = new EventEmitter();
602
- /** Emits the selected month. This doesn't imply a change on the selected date */
603
- this.monthSelected = new EventEmitter();
604
- /** Emits when any date is activated. */
605
- this.activeDateChange = new EventEmitter();
606
- if (!this.dateAdapter) {
607
- throw createMissingDateImplError('DateAdapter');
608
- }
609
- if (!this.dateFormats) {
610
- throw createMissingDateImplError('MC_DATE_FORMATS');
611
- }
612
- this._activeDate = this.dateAdapter.today();
613
- }
614
- /** The date to display in this year view (everything other than the year is ignored). */
615
- get activeDate() {
616
- return this._activeDate;
617
- }
618
- set activeDate(value) {
619
- const oldActiveDate = this._activeDate;
620
- const validDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value)) || this.dateAdapter.today();
621
- this._activeDate = this.dateAdapter.clampDate(validDate, this.minDate, this.maxDate);
622
- if (this.dateAdapter.getYear(oldActiveDate) !== this.dateAdapter.getYear(this._activeDate)) {
623
- this.init();
624
- }
625
- }
626
- /** The currently selected date. */
627
- get selected() {
628
- return this._selected;
629
- }
630
- set selected(value) {
631
- this._selected = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
632
- this.selectedMonth = this.getMonthInCurrentYear(this._selected);
633
- }
634
- /** The minimum selectable date. */
635
- get minDate() {
636
- return this._minDate;
637
- }
638
- set minDate(value) {
639
- this._minDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
640
- }
641
- /** The maximum selectable date. */
642
- get maxDate() {
643
- return this._maxDate;
644
- }
645
- set maxDate(value) {
646
- this._maxDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
647
- }
648
- ngAfterContentInit() {
649
- this.init();
650
- }
651
- /** Handles when a new month is selected. */
652
- onMonthSelected(month) {
653
- const year = this.dateAdapter.getYear(this.activeDate);
654
- const normalizedDate = this.dateAdapter.createDate(year, month);
655
- this.monthSelected.emit(normalizedDate);
656
- const daysInMonth = this.dateAdapter.getNumDaysInMonth(normalizedDate);
657
- this.selectedChange.emit(this.dateAdapter.createDate(year, month, Math.min(this.dateAdapter.getDate(this.activeDate), daysInMonth)));
658
- }
659
- /** Handles keydown events on the calendar body when calendar is in year view. */
660
- handleCalendarBodyKeydown(event) {
661
- // TODO(mmalerba): We currently allow keyboard navigation to disabled dates, but just prevent
662
- // disabled ones from being selected. This may not be ideal, we should look into whether
663
- // navigation should skip over disabled dates, and if so, how to implement that efficiently.
664
- const oldActiveDate = this._activeDate;
665
- const isRtl = this.isRtl();
666
- const VERTICAL_SHIFT = 4;
667
- const PAGE_SHIFT = 10;
668
- const MAX_MONTH_INDEX = 11;
669
- // tslint:disable-next-line:deprecation
670
- switch (event.keyCode) {
671
- case LEFT_ARROW:
672
- this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, isRtl ? 1 : -1);
673
- break;
674
- case RIGHT_ARROW:
675
- this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, isRtl ? -1 : 1);
676
- break;
677
- case UP_ARROW:
678
- this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, -VERTICAL_SHIFT);
679
- break;
680
- case DOWN_ARROW:
681
- this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, VERTICAL_SHIFT);
682
- break;
683
- case HOME:
684
- this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, -this.dateAdapter.getMonth(this._activeDate));
685
- break;
686
- case END:
687
- this.activeDate = this.dateAdapter.addCalendarMonths(this._activeDate, MAX_MONTH_INDEX - this.dateAdapter.getMonth(this._activeDate));
688
- break;
689
- case PAGE_UP:
690
- this.activeDate =
691
- this.dateAdapter.addCalendarYears(this._activeDate, event.altKey ? -PAGE_SHIFT : -1);
692
- break;
693
- case PAGE_DOWN:
694
- this.activeDate =
695
- this.dateAdapter.addCalendarYears(this._activeDate, event.altKey ? PAGE_SHIFT : 1);
696
- break;
697
- case ENTER:
698
- case SPACE:
699
- this.onMonthSelected(this.dateAdapter.getMonth(this._activeDate));
700
- break;
701
- default:
702
- // Don't prevent default or focus active cell on keys that we don't explicitly handle.
703
- return;
704
- }
705
- if (this.dateAdapter.compareDate(oldActiveDate, this.activeDate)) {
706
- this.activeDateChange.emit(this.activeDate);
707
- }
708
- this.focusActiveCell();
709
- // Prevent unexpected default actions such as form submission.
710
- event.preventDefault();
711
- }
712
- /** Initializes this year view. */
713
- init() {
714
- this.selectedMonth = this.getMonthInCurrentYear(this.selected);
715
- this.todayMonth = this.getMonthInCurrentYear(this.dateAdapter.today());
716
- this.yearLabel = this.dateAdapter.getYearName(this.activeDate);
717
- const monthNames = this.dateAdapter.getMonthNames('short');
718
- // First row of months only contains 5 elements so we can fit the year label on the same row.
719
- // tslint:disable-next-line:no-magic-numbers
720
- this.months = [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11]]
721
- .map((row) => row.map((month) => this.createCellForMonth(month, monthNames[month])));
722
- this.changeDetectorRef.markForCheck();
723
- }
724
- /** Focuses the active cell after the microtask queue is empty. */
725
- focusActiveCell() {
726
- this.mcCalendarBody.focusActiveCell();
727
- }
728
- /**
729
- * Gets the month in this year that the given Date falls on.
730
- * Returns null if the given Date is in another year.
731
- */
732
- getMonthInCurrentYear(date) {
733
- return date && this.dateAdapter.getYear(date) === this.dateAdapter.getYear(this.activeDate) ?
734
- this.dateAdapter.getMonth(date) : null;
735
- }
736
- /** Creates an McCalendarCell for the given month. */
737
- createCellForMonth(month, monthName) {
738
- const ariaLabel = this.dateAdapter.format(this.dateAdapter.createDate(this.dateAdapter.getYear(this.activeDate), month), this.dateFormats.monthYearA11yLabel);
739
- const newMonthName = monthName[0].toLocaleUpperCase() + monthName.substr(1);
740
- return new McCalendarCell(month, newMonthName, ariaLabel, this.shouldEnableMonth(month));
741
- }
742
- /** Whether the given month is enabled. */
743
- shouldEnableMonth(month) {
744
- const activeYear = this.dateAdapter.getYear(this.activeDate);
745
- if (month === undefined || month === null ||
746
- this.isYearAndMonthAfterMaxDate(activeYear, month) ||
747
- this.isYearAndMonthBeforeMinDate(activeYear, month)) {
748
- return false;
749
- }
750
- if (!this.dateFilter) {
751
- return true;
752
- }
753
- const firstOfMonth = this.dateAdapter.createDate(activeYear, month);
754
- // If any date in the month is enabled count the month as enabled.
755
- for (let date = firstOfMonth; this.dateAdapter.getMonth(date) === month; date = this.dateAdapter.addCalendarDays(date, 1)) {
756
- if (this.dateFilter(date)) {
757
- return true;
758
- }
759
- }
760
- return false;
761
- }
762
- /**
763
- * Tests whether the combination month/year is after this.maxDate, considering
764
- * just the month and year of this.maxDate
765
- */
766
- isYearAndMonthAfterMaxDate(year, month) {
767
- if (this.maxDate) {
768
- const maxYear = this.dateAdapter.getYear(this.maxDate);
769
- const maxMonth = this.dateAdapter.getMonth(this.maxDate);
770
- return year > maxYear || (year === maxYear && month > maxMonth);
771
- }
772
- return false;
773
- }
774
- /**
775
- * Tests whether the combination month/year is before this.minDate, considering
776
- * just the month and year of this.minDate
777
- */
778
- isYearAndMonthBeforeMinDate(year, month) {
779
- if (this.minDate) {
780
- const minYear = this.dateAdapter.getYear(this.minDate);
781
- const minMonth = this.dateAdapter.getMonth(this.minDate);
782
- return year < minYear || (year === minYear && month < minMonth);
783
- }
784
- return false;
785
- }
786
- /**
787
- * @param obj The object to check.
788
- * @returns The given object if it is both a date instance and valid, otherwise null.
789
- */
790
- getValidDateOrNull(obj) {
791
- return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
792
- }
793
- /** Determines whether the user has the RTL layout direction. */
794
- isRtl() {
795
- return this.dir && this.dir.value === 'rtl';
796
- }
797
- }
798
- /** @nocollapse */ McYearView.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McYearView, deps: [{ token: i0.ChangeDetectorRef }, { token: MC_DATE_FORMATS, optional: true }, { token: i1$1.DateAdapter, optional: true }, { token: i2.Directionality, optional: true }], target: i0.ɵɵFactoryTarget.Component });
799
- /** @nocollapse */ McYearView.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McYearView, selector: "mc-year-view", inputs: { activeDate: "activeDate", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter" }, outputs: { selectedChange: "selectedChange", monthSelected: "monthSelected", activeDateChange: "activeDateChange" }, viewQueries: [{ propertyName: "mcCalendarBody", first: true, predicate: McCalendarBody, descendants: true }], exportAs: ["mcYearView"], ngImport: i0, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [label]=\"yearLabel\"\n [rows]=\"months\"\n [todayValue]=\"todayMonth!\"\n [selectedValue]=\"selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"onMonthSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n", dependencies: [{ kind: "component", type: McCalendarBody, selector: "[mc-calendar-body]", inputs: ["label", "rows", "todayValue", "selectedValue", "labelMinRequiredCells", "numCols", "activeCell", "cellAspectRatio"], outputs: ["selectedValueChange"], exportAs: ["mcCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
800
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McYearView, decorators: [{
801
- type: Component,
802
- args: [{ selector: 'mc-year-view', exportAs: 'mcYearView', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"mc-calendar__table\">\n <thead class=\"mc-calendar__table-header\">\n <tr>\n <th class=\"mc-calendar__table-header-divider\" colspan=\"4\"></th>\n </tr>\n </thead>\n <tbody mc-calendar-body\n [label]=\"yearLabel\"\n [rows]=\"months\"\n [todayValue]=\"todayMonth!\"\n [selectedValue]=\"selectedMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [cellAspectRatio]=\"4 / 7\"\n [activeCell]=\"dateAdapter.getMonth(activeDate)\"\n (selectedValueChange)=\"onMonthSelected($event)\"\n (keydown)=\"handleCalendarBodyKeydown($event)\">\n </tbody>\n</table>\n" }]
803
- }], ctorParameters: function () {
804
- return [{ type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
805
- type: Optional
806
- }, {
807
- type: Inject,
808
- args: [MC_DATE_FORMATS]
809
- }] }, { type: i1$1.DateAdapter, decorators: [{
810
- type: Optional
811
- }] }, { type: i2.Directionality, decorators: [{
812
- type: Optional
813
- }] }];
814
- }, propDecorators: { activeDate: [{
815
- type: Input
816
- }], selected: [{
817
- type: Input
818
- }], minDate: [{
819
- type: Input
820
- }], maxDate: [{
821
- type: Input
822
- }], dateFilter: [{
823
- type: Input
824
- }], selectedChange: [{
825
- type: Output
826
- }], monthSelected: [{
827
- type: Output
828
- }], activeDateChange: [{
829
- type: Output
830
- }], mcCalendarBody: [{
831
- type: ViewChild,
832
- args: [McCalendarBody, { static: false }]
833
- }] } });
834
-
835
396
  /** Datepicker data that requires internationalization. */
836
397
  class McDatepickerIntl {
837
398
  constructor() {
@@ -869,27 +430,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
869
430
  args: [{ providedIn: 'root' }]
870
431
  }] });
871
432
 
872
- /**
873
- * Possible views for the calendar.
874
- * @docs-private
875
- */
876
- var McCalendarView;
877
- (function (McCalendarView) {
878
- McCalendarView["Month"] = "month";
879
- McCalendarView["Year"] = "year";
880
- McCalendarView["MultiYear"] = "multi-year";
881
- })(McCalendarView || (McCalendarView = {}));
882
433
  /**
883
434
  * A calendar that is used as part of the datepicker.
884
435
  * @docs-private
885
436
  */
886
437
  class McCalendar {
887
- constructor(intl, dateAdapter, dateFormats, changeDetectorRef) {
888
- this.dateAdapter = dateAdapter;
438
+ constructor(intl, adapter, dateFormats, changeDetectorRef) {
439
+ this.adapter = adapter;
889
440
  this.dateFormats = dateFormats;
890
441
  this.changeDetectorRef = changeDetectorRef;
891
- /** Whether the calendar should be started in month or year view. */
892
- this.startView = McCalendarView.Month;
893
442
  /** Emits when the currently selected date changes. */
894
443
  this.selectedChange = new EventEmitter();
895
444
  /**
@@ -908,13 +457,7 @@ class McCalendar {
908
457
  * Emits whenever there is a state change that the header may need to respond to.
909
458
  */
910
459
  this.stateChanges = new Subject();
911
- /**
912
- * Used for scheduling that focus should be moved to the active cell on the next tick.
913
- * We need to schedule it, rather than do it immediately, because we have to wait
914
- * for Angular to re-evaluate the view children.
915
- */
916
- this.moveFocusOnNextTick = false;
917
- if (!this.dateAdapter) {
460
+ if (!this.adapter) {
918
461
  throw createMissingDateImplError('DateAdapter');
919
462
  }
920
463
  if (!this.dateFormats) {
@@ -930,59 +473,46 @@ class McCalendar {
930
473
  return this._startAt;
931
474
  }
932
475
  set startAt(value) {
933
- this._startAt = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
476
+ const deserializedValue = this.getValidDateOrNull(this.adapter.deserialize(value));
477
+ this._startAt = deserializedValue !== null ?
478
+ this.adapter.clampDate(deserializedValue, this.minDate, this.maxDate) : null;
934
479
  }
935
480
  /** The currently selected date. */
936
481
  get selected() {
937
482
  return this._selected;
938
483
  }
939
484
  set selected(value) {
940
- this._selected = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
485
+ this._selected = this.adapter.deserialize(value);
941
486
  }
942
487
  /** The minimum selectable date. */
943
488
  get minDate() {
944
489
  return this._minDate;
945
490
  }
946
491
  set minDate(value) {
947
- this._minDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
492
+ this._minDate = this.adapter.deserialize(value);
493
+ this.startAt = this._startAt;
948
494
  }
949
495
  /** The maximum selectable date. */
950
496
  get maxDate() {
951
497
  return this._maxDate;
952
498
  }
953
499
  set maxDate(value) {
954
- this._maxDate = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
500
+ this._maxDate = this.adapter.deserialize(value);
501
+ this.startAt = this._startAt;
955
502
  }
956
503
  /**
957
504
  * The current active date. This determines which time period is shown and which date is
958
505
  * highlighted when using keyboard navigation.
959
506
  */
960
507
  get activeDate() {
961
- return this.clampedActiveDate;
508
+ return this._activeDate;
962
509
  }
963
510
  set activeDate(value) {
964
- this.clampedActiveDate = this.dateAdapter.clampDate(value, this.minDate, this.maxDate);
511
+ this._activeDate = this.adapter.clampDate(value, this.minDate, this.maxDate);
965
512
  this.stateChanges.next();
966
513
  }
967
- /** Whether the calendar is in month view. */
968
- get currentView() {
969
- return this._currentView;
970
- }
971
- set currentView(value) {
972
- this._currentView = value;
973
- this.moveFocusOnNextTick = true;
974
- }
975
514
  ngAfterContentInit() {
976
- this.calendarHeaderPortal = new ComponentPortal(this.headerComponent || McCalendarHeader);
977
- this.activeDate = this.startAt || this.dateAdapter.today();
978
- // Assign to the private property since we don't want to move focus on init.
979
- this._currentView = this.startView;
980
- }
981
- ngAfterViewChecked() {
982
- if (this.moveFocusOnNextTick) {
983
- this.moveFocusOnNextTick = false;
984
- this.focusActiveCell();
985
- }
515
+ this.activeDate = this.startAt || this.adapter.today();
986
516
  }
987
517
  ngOnDestroy() {
988
518
  this.intlChanges.unsubscribe();
@@ -991,66 +521,44 @@ class McCalendar {
991
521
  ngOnChanges(changes) {
992
522
  const change = changes.minDate || changes.maxDate || changes.dateFilter;
993
523
  if (change && !change.firstChange) {
994
- const view = this.getCurrentViewComponent();
995
- if (view) {
524
+ if (this.monthView) {
996
525
  // We need to `detectChanges` manually here, because the `minDate`, `maxDate` etc. are
997
526
  // passed down to the view via data bindings which won't be up-to-date when we call `init`.
998
527
  this.changeDetectorRef.detectChanges();
999
- view.init();
528
+ this.monthView.init();
1000
529
  }
1001
530
  }
1002
531
  this.stateChanges.next();
1003
532
  }
1004
- focusActiveCell() {
1005
- this.getCurrentViewComponent().focusActiveCell();
1006
- }
1007
533
  /** Updates today's date after an update of the active date */
1008
534
  updateTodaysDate() {
1009
- const view = this.currentView === McCalendarView.Month ? this.monthView :
1010
- (this.currentView === McCalendarView.Year ? this.yearView : this.multiYearView);
1011
- view.ngAfterContentInit();
535
+ this.monthView.ngAfterContentInit();
1012
536
  }
1013
537
  /** Handles date selection in the month view. */
1014
538
  dateSelected(date) {
1015
- if (!this.dateAdapter.sameDate(date, this.selected)) {
539
+ if (!this.adapter.sameDate(date, this.selected)) {
1016
540
  this.selectedChange.emit(date);
1017
541
  }
1018
542
  }
1019
- /** Handles year selection in the multiyear view. */
1020
- yearSelectedInMultiYearView(normalizedYear) {
1021
- this.yearSelected.emit(normalizedYear);
1022
- }
1023
- /** Handles month selection in the year view. */
1024
- monthSelectedInYearView(normalizedMonth) {
1025
- this.monthSelected.emit(normalizedMonth);
1026
- }
1027
543
  userSelected() {
1028
544
  this.userSelection.emit();
1029
545
  }
1030
- /** Handles year/month selection in the multi-year/year views. */
1031
- goToDateInView(date, view) {
1032
- this.activeDate = date;
1033
- this.currentView = view;
1034
- }
1035
546
  /**
1036
547
  * @param obj The object to check.
1037
548
  * @returns The given object if it is both a date instance and valid, otherwise null.
1038
549
  */
550
+ // todo выглядит как костыль от которого нужно избавиться
1039
551
  getValidDateOrNull(obj) {
1040
- return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
1041
- }
1042
- /** Returns the component instance that corresponds to the current calendar view. */
1043
- getCurrentViewComponent() {
1044
- return this.monthView || this.yearView || this.multiYearView;
552
+ return (this.adapter.isDateInstance(obj) && this.adapter.isValid(obj)) ? obj : null;
1045
553
  }
1046
554
  }
1047
555
  /** @nocollapse */ McCalendar.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendar, deps: [{ token: McDatepickerIntl }, { token: i1$1.DateAdapter, optional: true }, { token: MC_DATE_FORMATS, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1048
- /** @nocollapse */ McCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McCalendar, selector: "mc-calendar", inputs: { startAt: "startAt", selected: "selected", minDate: "minDate", maxDate: "maxDate", headerComponent: "headerComponent", startView: "startView", dateFilter: "dateFilter", dateClass: "dateClass" }, outputs: { selectedChange: "selectedChange", yearSelected: "yearSelected", monthSelected: "monthSelected", userSelection: "userSelection" }, host: { classAttribute: "mc-calendar" }, viewQueries: [{ propertyName: "monthView", first: true, predicate: McMonthView, descendants: true }, { propertyName: "yearView", first: true, predicate: McYearView, descendants: true }, { propertyName: "multiYearView", first: true, predicate: McMultiYearView, descendants: true }], exportAs: ["mcCalendar"], usesOnChanges: true, ngImport: i0, template: "<ng-template [cdkPortalOutlet]=\"calendarHeaderPortal\"></ng-template>\n\n<div class=\"mc-calendar__content\" [ngSwitch]=\"currentView\">\n <mc-month-view\n *ngSwitchCase=\"'month'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass\"\n (selectedChange)=\"dateSelected($event!)\"\n (userSelection)=\"userSelected()\">\n </mc-month-view>\n\n <mc-year-view\n *ngSwitchCase=\"'year'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (monthSelected)=\"monthSelectedInYearView($event)\"\n (selectedChange)=\"goToDateInView($event, 'multi-year')\">\n </mc-year-view>\n\n <mc-multi-year-view\n *ngSwitchCase=\"'multi-year'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (yearSelected)=\"yearSelectedInMultiYearView($event)\"\n (selectedChange)=\"goToDateInView($event, 'month')\">\n </mc-multi-year-view>\n</div>\n", styles: [".mc-calendar{display:block}.mc-calendar-header{display:flex;padding:16px 8px 12px;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar__content{padding:0 8px 8px;padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar-spacer{flex:1 1 auto}.mc-calendar__period-button{min-width:0}.mc-calendar__period-button .mc-icon{vertical-align:baseline}.mc-calendar__previous-button:after{border-left-width:2px;border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(2px) rotate(-45deg);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar__next-button:after{border-right-width:2px;border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(-2px) rotate(45deg);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:10px;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:-8px;right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:1px;height:var(--mc-datepicker-calendar-size-divider-width, 1px)}\n"], dependencies: [{ kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i4.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "component", type: McMonthView, selector: "mc-month-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass"], outputs: ["selectedChange", "userSelection", "activeDateChange"], exportAs: ["mcMonthView"] }, { kind: "component", type: McYearView, selector: "mc-year-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter"], outputs: ["selectedChange", "monthSelected", "activeDateChange"], exportAs: ["mcYearView"] }, { kind: "component", type: McMultiYearView, selector: "mc-multi-year-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter"], outputs: ["selectedChange", "yearSelected", "activeDateChange"], exportAs: ["mcMultiYearView"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
556
+ /** @nocollapse */ McCalendar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McCalendar, selector: "mc-calendar", inputs: { startAt: "startAt", selected: "selected", minDate: "minDate", maxDate: "maxDate", dateFilter: "dateFilter", dateClass: "dateClass" }, outputs: { selectedChange: "selectedChange", yearSelected: "yearSelected", monthSelected: "monthSelected", userSelection: "userSelection" }, host: { classAttribute: "mc-calendar" }, viewQueries: [{ propertyName: "monthView", first: true, predicate: McMonthView, descendants: true }], exportAs: ["mcCalendar"], usesOnChanges: true, ngImport: i0, template: "<mc-calendar-header\n [(activeDate)]=\"activeDate\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (monthSelected)=\"monthSelected.emit(activeDate)\"\n (yearSelected)=\"yearSelected.emit(activeDate)\">\n</mc-calendar-header>\n\n<div class=\"mc-calendar__content\">\n <mc-month-view\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass\"\n (selectedChange)=\"dateSelected($event!)\"\n (userSelection)=\"userSelected()\">\n </mc-month-view>\n</div>\n", styles: [".mc-calendar{display:block}.mc-calendar__content{padding:0 8px 8px;padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:10px;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:-8px;right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:1px;height:var(--mc-datepicker-calendar-size-divider-width, 1px)}\n"], dependencies: [{ kind: "component", type: McMonthView, selector: "mc-month-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass"], outputs: ["selectedChange", "userSelection", "activeDateChange"], exportAs: ["mcMonthView"] }, { kind: "component", type: McCalendarHeader, selector: "mc-calendar-header", inputs: ["activeDate", "maxDate", "minDate"], outputs: ["activeDateChange", "monthSelected", "yearSelected"], exportAs: ["mcCalendarHeader"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1049
557
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendar, decorators: [{
1050
558
  type: Component,
1051
559
  args: [{ selector: 'mc-calendar', exportAs: 'mcCalendar', host: {
1052
560
  class: 'mc-calendar'
1053
- }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template [cdkPortalOutlet]=\"calendarHeaderPortal\"></ng-template>\n\n<div class=\"mc-calendar__content\" [ngSwitch]=\"currentView\">\n <mc-month-view\n *ngSwitchCase=\"'month'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass\"\n (selectedChange)=\"dateSelected($event!)\"\n (userSelection)=\"userSelected()\">\n </mc-month-view>\n\n <mc-year-view\n *ngSwitchCase=\"'year'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (monthSelected)=\"monthSelectedInYearView($event)\"\n (selectedChange)=\"goToDateInView($event, 'multi-year')\">\n </mc-year-view>\n\n <mc-multi-year-view\n *ngSwitchCase=\"'multi-year'\"\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (yearSelected)=\"yearSelectedInMultiYearView($event)\"\n (selectedChange)=\"goToDateInView($event, 'month')\">\n </mc-multi-year-view>\n</div>\n", styles: [".mc-calendar{display:block}.mc-calendar-header{display:flex;padding:16px 8px 12px;padding:var(--mc-datepicker-calendar-size-padding-top, 16px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-blocks, 12px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px)}.mc-calendar__content{padding:0 8px 8px;padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar-spacer{flex:1 1 auto}.mc-calendar__period-button{min-width:0}.mc-calendar__period-button .mc-icon{vertical-align:baseline}.mc-calendar__previous-button:after{border-left-width:2px;border-left-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(2px) rotate(-45deg);transform:var(--mc-datepicker-calendar-size-icon-prev-icon-transform, translateX(2px) rotate(-45deg))}.mc-calendar__next-button:after{border-right-width:2px;border-right-width:var(--mc-datepicker-calendar-size-icon-border-width, 2px);transform:translate(-2px) rotate(45deg);transform:var(--mc-datepicker-calendar-size-icon-nex-icon-transform, translateX(-2px) rotate(45deg))}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:10px;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:-8px;right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:1px;height:var(--mc-datepicker-calendar-size-divider-width, 1px)}\n"] }]
561
+ }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<mc-calendar-header\n [(activeDate)]=\"activeDate\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n (monthSelected)=\"monthSelected.emit(activeDate)\"\n (yearSelected)=\"yearSelected.emit(activeDate)\">\n</mc-calendar-header>\n\n<div class=\"mc-calendar__content\">\n <mc-month-view\n [(activeDate)]=\"activeDate\"\n [selected]=\"selected\"\n [dateFilter]=\"dateFilter\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [dateClass]=\"dateClass\"\n (selectedChange)=\"dateSelected($event!)\"\n (userSelection)=\"userSelected()\">\n </mc-month-view>\n</div>\n", styles: [".mc-calendar{display:block}.mc-calendar__content{padding:0 8px 8px;padding:0 var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px) var(--mc-datepicker-calendar-size-padding-horizontal, 8px);outline:none}.mc-calendar__table{border-spacing:0;border-collapse:collapse;width:100%}.mc-calendar__table-header th{text-align:center;height:30px}.mc-calendar__table-header th.mc-calendar__table-header-divider{position:relative;height:10px;height:calc(var(--mc-datepicker-calendar-size-padding-blocks, 12px) - 2px)}.mc-calendar__table-header th.mc-calendar__table-header-divider:after{content:\"\";position:absolute;top:0;left:-8px;left:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));right:-8px;right:calc(-1 * var(--mc-datepicker-calendar-size-padding-horizontal, 8px));height:1px;height:var(--mc-datepicker-calendar-size-divider-width, 1px)}\n"] }]
1054
562
  }], ctorParameters: function () {
1055
563
  return [{ type: McDatepickerIntl }, { type: i1$1.DateAdapter, decorators: [{
1056
564
  type: Optional
@@ -1068,10 +576,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
1068
576
  type: Input
1069
577
  }], maxDate: [{
1070
578
  type: Input
1071
- }], headerComponent: [{
1072
- type: Input
1073
- }], startView: [{
1074
- type: Input
1075
579
  }], dateFilter: [{
1076
580
  type: Input
1077
581
  }], dateClass: [{
@@ -1087,131 +591,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
1087
591
  }], monthView: [{
1088
592
  type: ViewChild,
1089
593
  args: [McMonthView, { static: false }]
1090
- }], yearView: [{
1091
- type: ViewChild,
1092
- args: [McYearView, { static: false }]
1093
- }], multiYearView: [{
1094
- type: ViewChild,
1095
- args: [McMultiYearView, { static: false }]
1096
594
  }] } });
1097
- /** Default header for McCalendar */
1098
- class McCalendarHeader {
1099
- constructor(intl, calendar, dateAdapter, dateFormats, changeDetectorRef) {
1100
- this.intl = intl;
1101
- this.calendar = calendar;
1102
- this.dateAdapter = dateAdapter;
1103
- this.dateFormats = dateFormats;
1104
- this.calendar.stateChanges.subscribe(() => changeDetectorRef.markForCheck());
1105
- }
1106
- /** The label for the current calendar view. */
1107
- get periodButtonText() {
1108
- if (this.calendar.currentView === McCalendarView.Month) {
1109
- const label = this.dateAdapter.format(this.calendar.activeDate, this.dateFormats.monthYearLabel);
1110
- return (label[0].toLocaleUpperCase() + label.substr(1)).replace('.', '');
1111
- }
1112
- if (this.calendar.currentView === McCalendarView.Year) {
1113
- return this.dateAdapter.getYearName(this.calendar.activeDate);
1114
- }
1115
- const activeYear = this.dateAdapter.getYear(this.calendar.activeDate);
1116
- const firstYearInView = this.dateAdapter.getYearName(
1117
- // tslint:disable-next-line:no-magic-numbers
1118
- this.dateAdapter.createDate(activeYear - activeYear % 24));
1119
- const lastYearInView = this.dateAdapter.getYearName(
1120
- // tslint:disable-next-line:no-magic-numbers
1121
- this.dateAdapter.createDate(activeYear + yearsPerPage - 1 - activeYear % 24));
1122
- return `${firstYearInView} \u2013 ${lastYearInView}`;
1123
- }
1124
- get periodButtonLabel() {
1125
- return this.calendar.currentView === McCalendarView.Month ?
1126
- this.intl.switchToMultiYearViewLabel : this.intl.switchToMonthViewLabel;
1127
- }
1128
- /** The label for the previous button. */
1129
- get prevButtonLabel() {
1130
- return {
1131
- [McCalendarView.Month]: this.intl.prevMonthLabel,
1132
- [McCalendarView.Year]: this.intl.prevYearLabel,
1133
- [McCalendarView.MultiYear]: this.intl.prevMultiYearLabel
1134
- }[this.calendar.currentView];
1135
- }
1136
- /** The label for the next button. */
1137
- get nextButtonLabel() {
1138
- return {
1139
- [McCalendarView.Month]: this.intl.nextMonthLabel,
1140
- [McCalendarView.Year]: this.intl.nextYearLabel,
1141
- [McCalendarView.MultiYear]: this.intl.nextMultiYearLabel
1142
- }[this.calendar.currentView];
1143
- }
1144
- /** Handles user clicks on the period label. */
1145
- currentPeriodClicked() {
1146
- if ([McCalendarView.Month, McCalendarView.MultiYear].includes(this.calendar.currentView)) {
1147
- this.calendar.currentView = McCalendarView.Year;
1148
- }
1149
- else if (this.calendar.currentView === McCalendarView.Year) {
1150
- this.calendar.currentView = McCalendarView.Month;
1151
- }
1152
- }
1153
- /** Handles user clicks on the previous button. */
1154
- previousClicked() {
1155
- if (this.calendar.currentView === McCalendarView.Month) {
1156
- this.calendar.activeDate = this.dateAdapter.addCalendarMonths(this.calendar.activeDate, -1);
1157
- }
1158
- else {
1159
- this.calendar.activeDate = this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView === McCalendarView.Year ? -1 : -yearsPerPage);
1160
- }
1161
- }
1162
- /** Handles user clicks on the next button. */
1163
- nextClicked() {
1164
- if (this.calendar.currentView === McCalendarView.Month) {
1165
- this.calendar.activeDate = this.dateAdapter.addCalendarMonths(this.calendar.activeDate, 1);
1166
- }
1167
- else {
1168
- this.calendar.activeDate = this.dateAdapter.addCalendarYears(this.calendar.activeDate, this.calendar.currentView === McCalendarView.Year ? 1 : yearsPerPage);
1169
- }
1170
- }
1171
- /** Whether the previous period button is enabled. */
1172
- previousEnabled() {
1173
- if (!this.calendar.minDate) {
1174
- return true;
1175
- }
1176
- return !this.calendar.minDate || !this.isSameView(this.calendar.activeDate, this.calendar.minDate);
1177
- }
1178
- /** Whether the next period button is enabled. */
1179
- nextEnabled() {
1180
- return !this.calendar.maxDate || !this.isSameView(this.calendar.activeDate, this.calendar.maxDate);
1181
- }
1182
- /** Whether the two dates represent the same view in the current view mode (month or year). */
1183
- isSameView(firstDate, secondDate) {
1184
- const firstYear = this.dateAdapter.getYear(firstDate);
1185
- const secondYear = this.dateAdapter.getYear(secondDate);
1186
- const firstMonth = this.dateAdapter.getMonth(firstDate);
1187
- const secondMonth = this.dateAdapter.getMonth(secondDate);
1188
- if (this.calendar.currentView === McCalendarView.Month) {
1189
- return firstYear === secondYear && firstMonth === secondMonth;
1190
- }
1191
- if (this.calendar.currentView === McCalendarView.Year) {
1192
- return firstYear === secondYear;
1193
- }
1194
- // Otherwise we are in 'multi-year' view.
1195
- return Math.floor(firstYear / yearsPerPage) === Math.floor(secondYear / yearsPerPage);
1196
- }
1197
- }
1198
- /** @nocollapse */ McCalendarHeader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendarHeader, deps: [{ token: McDatepickerIntl }, { token: McCalendar }, { token: i1$1.DateAdapter, optional: true }, { token: MC_DATE_FORMATS, optional: true }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1199
- /** @nocollapse */ McCalendarHeader.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McCalendarHeader, selector: "mc-calendar-header", host: { classAttribute: "mc-calendar-header" }, exportAs: ["mcCalendarHeader"], ngImport: i0, template: "<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__period-button\"\n (click)=\"currentPeriodClicked()\">\n {{ periodButtonText }}\n\n <i class=\"mc mc-icon\"\n [class.mc-angle-up-M_16]=\"calendar.currentView !== 'month'\"\n [class.mc-angle-down-M_16]=\"calendar.currentView === 'month'\">\n </i>\n</button>\n\n<div class=\"mc-calendar-spacer\"></div>\n\n<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__previous-button\"\n [disabled]=\"!previousEnabled()\"\n (click)=\"previousClicked()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n</button>\n\n<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__next-button\"\n [disabled]=\"!nextEnabled()\"\n (click)=\"nextClicked()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n</button>\n", dependencies: [{ kind: "component", type: i8.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { kind: "directive", type: i8.McButtonCssStyler, selector: "[mc-button]" }, { kind: "component", type: i9.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i9.McIconCSSStyler, selector: "[mc-icon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1200
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McCalendarHeader, decorators: [{
1201
- type: Component,
1202
- args: [{ selector: 'mc-calendar-header', exportAs: 'mcCalendarHeader', host: {
1203
- class: 'mc-calendar-header'
1204
- }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__period-button\"\n (click)=\"currentPeriodClicked()\">\n {{ periodButtonText }}\n\n <i class=\"mc mc-icon\"\n [class.mc-angle-up-M_16]=\"calendar.currentView !== 'month'\"\n [class.mc-angle-down-M_16]=\"calendar.currentView === 'month'\">\n </i>\n</button>\n\n<div class=\"mc-calendar-spacer\"></div>\n\n<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__previous-button\"\n [disabled]=\"!previousEnabled()\"\n (click)=\"previousClicked()\">\n\n <i mc-icon=\"mc-angle-left-L_16\"></i>\n</button>\n\n<button mc-button\n [tabindex]=\"'-1'\"\n class=\"mc-button_transparent mc-calendar__next-button\"\n [disabled]=\"!nextEnabled()\"\n (click)=\"nextClicked()\">\n\n <i mc-icon=\"mc-angle-right-L_16\"></i>\n</button>\n" }]
1205
- }], ctorParameters: function () {
1206
- return [{ type: McDatepickerIntl }, { type: McCalendar }, { type: i1$1.DateAdapter, decorators: [{
1207
- type: Optional
1208
- }] }, { type: undefined, decorators: [{
1209
- type: Optional
1210
- }, {
1211
- type: Inject,
1212
- args: [MC_DATE_FORMATS]
1213
- }] }, { type: i0.ChangeDetectorRef }];
1214
- } });
1215
595
 
1216
596
  // tslint:disable:no-empty, deprecation
1217
597
  // tslint:disable:naming-convention
@@ -1326,10 +706,10 @@ class McDatepickerInputEvent {
1326
706
  let uniqueComponentIdSuffix = 0;
1327
707
  /** Directive used to connect an input to a McDatepicker. */
1328
708
  class McDatepickerInput {
1329
- constructor(elementRef, renderer, dateAdapter, dateFormats) {
709
+ constructor(elementRef, renderer, adapter, dateFormats) {
1330
710
  this.elementRef = elementRef;
1331
711
  this.renderer = renderer;
1332
- this.dateAdapter = dateAdapter;
712
+ this.adapter = adapter;
1333
713
  this.dateFormats = dateFormats;
1334
714
  this.stateChanges = new Subject();
1335
715
  this.controlType = 'datepicker';
@@ -1428,21 +808,21 @@ class McDatepickerInput {
1428
808
  };
1429
809
  /** The form control validator for the min date. */
1430
810
  this.minValidator = (control) => {
1431
- const controlValue = this.getValidDateOrNull(this.dateAdapter.deserialize(control.value));
1432
- return !this.min || !controlValue || this.dateAdapter.compareDateTime(this.min, controlValue) <= 0 ?
811
+ const controlValue = this.adapter.deserialize(control.value);
812
+ return !this.min || !controlValue || this.adapter.compareDateTime(this.min, controlValue) <= 0 ?
1433
813
  null :
1434
814
  { mcDatepickerMin: { min: this.min, actual: controlValue } };
1435
815
  };
1436
816
  /** The form control validator for the max date. */
1437
817
  this.maxValidator = (control) => {
1438
- const controlValue = this.getValidDateOrNull(this.dateAdapter.deserialize(control.value));
1439
- return !this.max || !controlValue || this.dateAdapter.compareDateTime(this.max, controlValue) >= 0 ?
818
+ const controlValue = this.adapter.deserialize(control.value);
819
+ return !this.max || !controlValue || this.adapter.compareDateTime(this.max, controlValue) >= 0 ?
1440
820
  null :
1441
821
  { mcDatepickerMax: { max: this.max, actual: controlValue } };
1442
822
  };
1443
823
  /** The form control validator for the date filter. */
1444
824
  this.filterValidator = (control) => {
1445
- const controlValue = this.getValidDateOrNull(this.dateAdapter.deserialize(control.value));
825
+ const controlValue = this.adapter.deserialize(control.value);
1446
826
  return !this.dateFilter || !controlValue || this.dateFilter(controlValue) ?
1447
827
  null : { mcDatepickerFilter: true };
1448
828
  };
@@ -1452,14 +832,14 @@ class McDatepickerInput {
1452
832
  this.maxValidator,
1453
833
  this.filterValidator
1454
834
  ]);
1455
- if (!this.dateAdapter) {
835
+ if (!this.adapter) {
1456
836
  throw createMissingDateImplError('DateAdapter');
1457
837
  }
1458
838
  if (!this.dateFormats) {
1459
839
  throw createMissingDateImplError('MC_DATE_FORMATS');
1460
840
  }
1461
841
  this.setFormat(dateFormats.dateInput);
1462
- this.localeSubscription = dateAdapter.localeChanges
842
+ this.localeSubscription = adapter.localeChanges
1463
843
  .subscribe(this.updateLocaleParams);
1464
844
  }
1465
845
  get required() {
@@ -1495,13 +875,13 @@ class McDatepickerInput {
1495
875
  return this._value;
1496
876
  }
1497
877
  set value(value) {
1498
- let newValue = this.dateAdapter.deserialize(value);
1499
- this.lastValueValid = !newValue || this.dateAdapter.isValid(newValue);
878
+ let newValue = this.adapter.deserialize(value);
879
+ this.lastValueValid = !newValue || this.adapter.isValid(newValue);
1500
880
  newValue = this.getValidDateOrNull(newValue);
1501
881
  const oldDate = this.value;
1502
882
  this._value = newValue;
1503
883
  this.formatValue(newValue);
1504
- if (!this.dateAdapter.sameDate(oldDate, newValue)) {
884
+ if (!this.adapter.sameDate(oldDate, newValue)) {
1505
885
  this.valueChange.emit(newValue);
1506
886
  }
1507
887
  }
@@ -1510,7 +890,7 @@ class McDatepickerInput {
1510
890
  return this._min;
1511
891
  }
1512
892
  set min(value) {
1513
- this._min = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
893
+ this._min = this.adapter.deserialize(value);
1514
894
  this.validatorOnChange();
1515
895
  }
1516
896
  /** The maximum valid date. */
@@ -1518,7 +898,7 @@ class McDatepickerInput {
1518
898
  return this._max;
1519
899
  }
1520
900
  set max(value) {
1521
- this._max = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
901
+ this._max = this.adapter.deserialize(value);
1522
902
  this.validatorOnChange();
1523
903
  }
1524
904
  /** Whether the datepicker-input is disabled. */
@@ -1716,20 +1096,20 @@ class McDatepickerInput {
1716
1096
  this.updateValue(newTimeObj);
1717
1097
  }
1718
1098
  toISO8601(value) {
1719
- return this.dateAdapter.toIso8601(value);
1099
+ return this.adapter.toIso8601(value);
1720
1100
  }
1721
1101
  saveTimePart(selected) {
1722
1102
  if (!this.value) {
1723
1103
  return selected;
1724
1104
  }
1725
- const years = this.dateAdapter.getYear(selected);
1726
- const month = this.dateAdapter.getMonth(selected);
1727
- const day = this.dateAdapter.getDate(selected);
1728
- const hours = this.dateAdapter.getHours(this.value);
1729
- const minutes = this.dateAdapter.getMinutes(this.value);
1730
- const seconds = this.dateAdapter.getSeconds(this.value);
1731
- const milliseconds = this.dateAdapter.getMilliseconds(this.value);
1732
- return this.dateAdapter.createDateTime(years, month, day, hours, minutes, seconds, milliseconds);
1105
+ const years = this.adapter.getYear(selected);
1106
+ const month = this.adapter.getMonth(selected);
1107
+ const day = this.adapter.getDate(selected);
1108
+ const hours = this.adapter.getHours(this.value);
1109
+ const minutes = this.adapter.getMinutes(this.value);
1110
+ const seconds = this.adapter.getSeconds(this.value);
1111
+ const milliseconds = this.adapter.getMilliseconds(this.value);
1112
+ return this.adapter.createDateTime(years, month, day, hours, minutes, seconds, milliseconds);
1733
1113
  }
1734
1114
  setFormat(format) {
1735
1115
  // @ts-ignore
@@ -1741,7 +1121,7 @@ class McDatepickerInput {
1741
1121
  }
1742
1122
  updateValue(newValue) {
1743
1123
  var _a;
1744
- if (!this.dateAdapter.sameDate(newValue, this.value)) {
1124
+ if (!this.adapter.sameDate(newValue, this.value)) {
1745
1125
  this._value = newValue;
1746
1126
  this.cvaOnChange(newValue);
1747
1127
  this.valueChange.emit(newValue);
@@ -1836,22 +1216,22 @@ class McDatepickerInput {
1836
1216
  return this.createDateTime(date);
1837
1217
  }
1838
1218
  getDefaultValue() {
1839
- const defaultValue = this.value || this.dateAdapter.today();
1219
+ const defaultValue = this.value || this.adapter.today();
1840
1220
  return {
1841
- year: this.dateAdapter.getYear(defaultValue),
1842
- month: this.dateAdapter.getMonth(defaultValue),
1843
- date: this.dateAdapter.getDate(defaultValue),
1844
- hours: this.dateAdapter.getHours(defaultValue),
1845
- minutes: this.dateAdapter.getMinutes(defaultValue),
1846
- seconds: this.dateAdapter.getSeconds(defaultValue),
1847
- milliseconds: this.dateAdapter.getMilliseconds(defaultValue)
1221
+ year: this.adapter.getYear(defaultValue),
1222
+ month: this.adapter.getMonth(defaultValue),
1223
+ date: this.adapter.getDate(defaultValue),
1224
+ hours: this.adapter.getHours(defaultValue),
1225
+ minutes: this.adapter.getMinutes(defaultValue),
1226
+ seconds: this.adapter.getSeconds(defaultValue),
1227
+ milliseconds: this.adapter.getMilliseconds(defaultValue)
1848
1228
  };
1849
1229
  }
1850
1230
  getTimeStringFromDate(value, timeFormat) {
1851
- if (!value || !this.dateAdapter.isValid(value)) {
1231
+ if (!value || !this.adapter.isValid(value)) {
1852
1232
  return '';
1853
1233
  }
1854
- return this.dateAdapter.format(value, timeFormat);
1234
+ return this.adapter.format(value, timeFormat);
1855
1235
  }
1856
1236
  getDateEditMetrics(cursorPosition) {
1857
1237
  for (const digit of [this.firstDigit, this.secondDigit, this.thirdDigit]) {
@@ -1862,13 +1242,13 @@ class McDatepickerInput {
1862
1242
  return [this.thirdDigit.value, this.thirdDigit.start, this.thirdDigit.end];
1863
1243
  }
1864
1244
  incrementDate(dateVal, whatToIncrement) {
1865
- let year = this.dateAdapter.getYear(dateVal);
1866
- let month = this.dateAdapter.getMonth(dateVal);
1867
- let day = this.dateAdapter.getDate(dateVal);
1245
+ let year = this.adapter.getYear(dateVal);
1246
+ let month = this.adapter.getMonth(dateVal);
1247
+ let day = this.adapter.getDate(dateVal);
1868
1248
  switch (whatToIncrement) {
1869
1249
  case DateParts.day:
1870
1250
  day++;
1871
- if (day > this.dateAdapter.getNumDaysInMonth(dateVal)) {
1251
+ if (day > this.adapter.getNumDaysInMonth(dateVal)) {
1872
1252
  day = 1;
1873
1253
  }
1874
1254
  break;
@@ -1894,17 +1274,17 @@ class McDatepickerInput {
1894
1274
  return this.createDate(year, month, day);
1895
1275
  }
1896
1276
  getLastDayFor(year, month) {
1897
- return this.dateAdapter.getNumDaysInMonth(this.createDate(year, month, 1));
1277
+ return this.adapter.getNumDaysInMonth(this.createDate(year, month, 1));
1898
1278
  }
1899
1279
  decrementDate(dateVal, whatToDecrement) {
1900
- let year = this.dateAdapter.getYear(dateVal);
1901
- let month = this.dateAdapter.getMonth(dateVal);
1902
- let day = this.dateAdapter.getDate(dateVal);
1280
+ let year = this.adapter.getYear(dateVal);
1281
+ let month = this.adapter.getMonth(dateVal);
1282
+ let day = this.adapter.getDate(dateVal);
1903
1283
  switch (whatToDecrement) {
1904
1284
  case DateParts.day:
1905
1285
  day--;
1906
1286
  if (day < 1) {
1907
- day = this.dateAdapter.getNumDaysInMonth(dateVal);
1287
+ day = this.adapter.getNumDaysInMonth(dateVal);
1908
1288
  }
1909
1289
  break;
1910
1290
  case DateParts.month:
@@ -1999,16 +1379,9 @@ class McDatepickerInput {
1999
1379
  }
2000
1380
  /** Formats a value and sets it on the input element. */
2001
1381
  formatValue(value) {
2002
- const formattedValue = value ? this.dateAdapter.format(value, this.dateFormats.dateInput) : '';
1382
+ const formattedValue = value ? this.adapter.format(value, this.dateFormats.dateInput) : '';
2003
1383
  this.setViewValue(formattedValue);
2004
1384
  }
2005
- /**
2006
- * @param obj The object to check.
2007
- * @returns The given object if it is both a date instance and valid, otherwise null.
2008
- */
2009
- getValidDateOrNull(obj) {
2010
- return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
2011
- }
2012
1385
  setControl(control) {
2013
1386
  if (this.control) {
2014
1387
  return;
@@ -2017,6 +1390,13 @@ class McDatepickerInput {
2017
1390
  this.control.valueChanges
2018
1391
  .subscribe((value) => this._value = value);
2019
1392
  }
1393
+ /**
1394
+ * @param obj The object to check.
1395
+ * @returns The given object if it is both a date instance and valid, otherwise null.
1396
+ */
1397
+ getValidDateOrNull(obj) {
1398
+ return (this.adapter.isDateInstance(obj) && this.adapter.isValid(obj)) ? obj : null;
1399
+ }
2020
1400
  getDigitPositions(format) {
2021
1401
  const formatInLowerCase = format.toLowerCase();
2022
1402
  formatInLowerCase
@@ -2046,13 +1426,13 @@ class McDatepickerInput {
2046
1426
  }
2047
1427
  }
2048
1428
  createDate(year, month, day) {
2049
- return this.dateAdapter.createDateTime(year, month, day, this.dateAdapter.getHours(this.value), this.dateAdapter.getMinutes(this.value), this.dateAdapter.getSeconds(this.value), this.dateAdapter.getMilliseconds(this.value));
1429
+ return this.adapter.createDateTime(year, month, day, this.adapter.getHours(this.value), this.adapter.getMinutes(this.value), this.adapter.getSeconds(this.value), this.adapter.getMilliseconds(this.value));
2050
1430
  }
2051
1431
  createDateTime(value) {
2052
1432
  if (Object.values(value).some(isNaN)) {
2053
1433
  return null;
2054
1434
  }
2055
- return this.getValidDateOrNull(this.dateAdapter.createDateTime(value.year, value.month - 1, value.date, value.hours, value.minutes, value.seconds, value.milliseconds));
1435
+ return this.adapter.createDateTime(value.year, value.month - 1, value.date, value.hours, value.minutes, value.seconds, value.milliseconds);
2056
1436
  }
2057
1437
  correctCursorPosition() {
2058
1438
  if (this.selectionStart && this.separatorPositions.includes(this.selectionStart)) {
@@ -2181,7 +1561,7 @@ class McDatepickerToggle {
2181
1561
  }
2182
1562
  }
2183
1563
  /** @nocollapse */ McDatepickerToggle.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McDatepickerToggle, deps: [{ token: McDatepickerIntl }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2184
- /** @nocollapse */ McDatepickerToggle.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McDatepickerToggle, selector: "mc-datepicker-toggle", inputs: { disabled: "disabled", datepicker: ["for", "datepicker"], tabIndex: "tabIndex" }, host: { properties: { "class.mc-active": "datepicker && datepicker.opened" }, classAttribute: "mc-datepicker-toggle" }, queries: [{ propertyName: "customIcon", first: true, predicate: McDatepickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mcDatepickerToggle"], usesOnChanges: true, ngImport: i0, template: "<!--todo need simplify this-->\n<button\n #button\n mc-button\n type=\"button\"\n class=\"mc-datepicker-toggle__button\"\n aria-haspopup=\"true\"\n [attr.aria-label]=\"intl.openCalendarLabel\"\n [tabIndex]=\"tabIndex\"\n [disabled]=\"disabled\"\n (click)=\"open($event)\">\n\n <i *ngIf=\"!customIcon\" mc-icon=\"mc-calendar_16\" class=\"mc-datepicker-toggle__default-icon\"></i>\n\n <ng-content select=\"[mcDatepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mc-datepicker-toggle:focus{outline:0}.mc-datepicker-toggle__button.mc-icon-button{width:30px;width:var(--mc-datepicker-toggle-size-width, 30px);height:30px;height:var(--mc-datepicker-toggle-size-height, 30px);margin-left:2px}.mc-form-field-appearance-legacy .mc-form-field-prefix .mc-datepicker-toggle__default-icon,.mc-form-field-appearance-legacy .mc-form-field-suffix .mc-datepicker-toggle__default-icon{width:1em}.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-prefix .mc-datepicker-toggle__default-icon,.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-suffix .mc-datepicker-toggle__default-icon{display:block;width:1.5em;height:1.5em}.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-prefix .mc-icon-button .mc-datepicker-toggle__default-icon,.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-suffix .mc-icon-button .mc-datepicker-toggle__default-icon{margin:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i8.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { kind: "directive", type: i8.McButtonCssStyler, selector: "[mc-button]" }, { kind: "component", type: i9.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i9.McIconCSSStyler, selector: "[mc-icon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1564
+ /** @nocollapse */ McDatepickerToggle.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McDatepickerToggle, selector: "mc-datepicker-toggle", inputs: { disabled: "disabled", datepicker: ["for", "datepicker"], tabIndex: "tabIndex" }, host: { properties: { "class.mc-active": "datepicker && datepicker.opened" }, classAttribute: "mc-datepicker-toggle" }, queries: [{ propertyName: "customIcon", first: true, predicate: McDatepickerToggleIcon, descendants: true }], viewQueries: [{ propertyName: "button", first: true, predicate: ["button"], descendants: true }], exportAs: ["mcDatepickerToggle"], usesOnChanges: true, ngImport: i0, template: "<!--todo need simplify this-->\n<button\n #button\n mc-button\n type=\"button\"\n class=\"mc-datepicker-toggle__button\"\n aria-haspopup=\"true\"\n [attr.aria-label]=\"intl.openCalendarLabel\"\n [tabIndex]=\"tabIndex\"\n [disabled]=\"disabled\"\n (click)=\"open($event)\">\n\n <i *ngIf=\"!customIcon\" mc-icon=\"mc-calendar_16\" class=\"mc-datepicker-toggle__default-icon\"></i>\n\n <ng-content select=\"[mcDatepickerToggleIcon]\"></ng-content>\n</button>\n", styles: [".mc-datepicker-toggle:focus{outline:0}.mc-datepicker-toggle__button.mc-icon-button{width:30px;width:var(--mc-datepicker-toggle-size-width, 30px);height:30px;height:var(--mc-datepicker-toggle-size-height, 30px);margin-left:2px}.mc-form-field-appearance-legacy .mc-form-field-prefix .mc-datepicker-toggle__default-icon,.mc-form-field-appearance-legacy .mc-form-field-suffix .mc-datepicker-toggle__default-icon{width:1em}.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-prefix .mc-datepicker-toggle__default-icon,.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-suffix .mc-datepicker-toggle__default-icon{display:block;width:1.5em;height:1.5em}.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-prefix .mc-icon-button .mc-datepicker-toggle__default-icon,.mc-form-field:not(.mc-form-field-appearance-legacy) .mc-form-field-suffix .mc-icon-button .mc-datepicker-toggle__default-icon{margin:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.McButton, selector: "[mc-button]", inputs: ["color", "tabIndex", "disabled"] }, { kind: "directive", type: i3.McButtonCssStyler, selector: "[mc-button]" }, { kind: "component", type: i7.McIcon, selector: "[mc-icon]", inputs: ["color"] }, { kind: "directive", type: i7.McIconCSSStyler, selector: "[mc-icon]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2185
1565
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McDatepickerToggle, decorators: [{
2186
1566
  type: Component,
2187
1567
  args: [{ selector: 'mc-datepicker-toggle', host: {
@@ -2278,7 +1658,7 @@ class McDatepickerContent {
2278
1658
  }
2279
1659
  }
2280
1660
  /** @nocollapse */ McDatepickerContent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McDatepickerContent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2281
- /** @nocollapse */ McDatepickerContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McDatepickerContent, selector: "mc-datepicker__content", host: { listeners: { "@transformPanel.done": "animationDone.next()" }, properties: { "@transformPanel": "animationState" }, classAttribute: "mc-datepicker__content" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: McCalendar, descendants: true }], exportAs: ["mcDatepickerContent"], ngImport: i0, template: "<mc-calendar [id]=\"datepicker.id\"\n [ngClass]=\"datepicker.panelClass\"\n [startAt]=\"datepicker.startAt\"\n [startView]=\"datepicker.startView\"\n [minDate]=\"datepicker.minDate\"\n [maxDate]=\"datepicker.maxDate\"\n [dateFilter]=\"datepicker.dateFilter\"\n [headerComponent]=\"datepicker.calendarHeaderComponent\"\n [selected]=\"datepicker.selected\"\n [dateClass]=\"datepicker.dateClass\"\n [@fadeInCalendar]=\"'enter'\"\n (selectedChange)=\"datepicker.select($event)\"\n (yearSelected)=\"datepicker.selectYear($event)\"\n (monthSelected)=\"datepicker.selectMonth($event)\"\n (userSelection)=\"datepicker.close()\">\n</mc-calendar>\n", styles: [".mc-datepicker__content{display:block;border-width:1px;border-style:solid;border-radius:0;border-radius:var(--mc-datepicker-calendar-size-border-radius, 0)}.mc-datepicker__content .mc-calendar{width:296px;height:348px}.mc-datepicker__content .mc-calendar__next-button[disabled],.mc-datepicker__content .mc-calendar__previous-button[disabled]{border:0}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: McCalendar, selector: "mc-calendar", inputs: ["startAt", "selected", "minDate", "maxDate", "headerComponent", "startView", "dateFilter", "dateClass"], outputs: ["selectedChange", "yearSelected", "monthSelected", "userSelection"], exportAs: ["mcCalendar"] }], animations: [
1661
+ /** @nocollapse */ McDatepickerContent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McDatepickerContent, selector: "mc-datepicker__content", host: { listeners: { "@transformPanel.done": "animationDone.next()" }, properties: { "@transformPanel": "animationState" }, classAttribute: "mc-datepicker__content" }, viewQueries: [{ propertyName: "calendar", first: true, predicate: McCalendar, descendants: true }], exportAs: ["mcDatepickerContent"], ngImport: i0, template: "<mc-calendar [id]=\"datepicker.id\"\n [@fadeInCalendar]=\"'enter'\"\n [ngClass]=\"datepicker.panelClass\"\n [dateClass]=\"datepicker.dateClass\"\n\n [startAt]=\"datepicker.startAt\"\n [minDate]=\"datepicker.minDate\"\n [maxDate]=\"datepicker.maxDate\"\n [dateFilter]=\"datepicker.dateFilter\"\n\n [selected]=\"datepicker.selected\"\n\n (selectedChange)=\"datepicker.select($event)\"\n (yearSelected)=\"datepicker.selectYear($event)\"\n (monthSelected)=\"datepicker.selectMonth($event)\"\n (userSelection)=\"datepicker.close()\">\n</mc-calendar>\n", styles: [".mc-datepicker__content{display:block;border-width:1px;border-style:solid;border-radius:0;border-radius:var(--mc-datepicker-calendar-size-border-radius, 0)}.mc-datepicker__content .mc-calendar{width:296px;height:348px}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: McCalendar, selector: "mc-calendar", inputs: ["startAt", "selected", "minDate", "maxDate", "dateFilter", "dateClass"], outputs: ["selectedChange", "yearSelected", "monthSelected", "userSelection"], exportAs: ["mcCalendar"] }], animations: [
2282
1662
  mcDatepickerAnimations.transformPanel,
2283
1663
  mcDatepickerAnimations.fadeInCalendar
2284
1664
  ], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
@@ -2291,7 +1671,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
2291
1671
  }, animations: [
2292
1672
  mcDatepickerAnimations.transformPanel,
2293
1673
  mcDatepickerAnimations.fadeInCalendar
2294
- ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<mc-calendar [id]=\"datepicker.id\"\n [ngClass]=\"datepicker.panelClass\"\n [startAt]=\"datepicker.startAt\"\n [startView]=\"datepicker.startView\"\n [minDate]=\"datepicker.minDate\"\n [maxDate]=\"datepicker.maxDate\"\n [dateFilter]=\"datepicker.dateFilter\"\n [headerComponent]=\"datepicker.calendarHeaderComponent\"\n [selected]=\"datepicker.selected\"\n [dateClass]=\"datepicker.dateClass\"\n [@fadeInCalendar]=\"'enter'\"\n (selectedChange)=\"datepicker.select($event)\"\n (yearSelected)=\"datepicker.selectYear($event)\"\n (monthSelected)=\"datepicker.selectMonth($event)\"\n (userSelection)=\"datepicker.close()\">\n</mc-calendar>\n", styles: [".mc-datepicker__content{display:block;border-width:1px;border-style:solid;border-radius:0;border-radius:var(--mc-datepicker-calendar-size-border-radius, 0)}.mc-datepicker__content .mc-calendar{width:296px;height:348px}.mc-datepicker__content .mc-calendar__next-button[disabled],.mc-datepicker__content .mc-calendar__previous-button[disabled]{border:0}\n"] }]
1674
+ ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<mc-calendar [id]=\"datepicker.id\"\n [@fadeInCalendar]=\"'enter'\"\n [ngClass]=\"datepicker.panelClass\"\n [dateClass]=\"datepicker.dateClass\"\n\n [startAt]=\"datepicker.startAt\"\n [minDate]=\"datepicker.minDate\"\n [maxDate]=\"datepicker.maxDate\"\n [dateFilter]=\"datepicker.dateFilter\"\n\n [selected]=\"datepicker.selected\"\n\n (selectedChange)=\"datepicker.select($event)\"\n (yearSelected)=\"datepicker.selectYear($event)\"\n (monthSelected)=\"datepicker.selectMonth($event)\"\n (userSelection)=\"datepicker.close()\">\n</mc-calendar>\n", styles: [".mc-datepicker__content{display:block;border-width:1px;border-style:solid;border-radius:0;border-radius:var(--mc-datepicker-calendar-size-border-radius, 0)}.mc-datepicker__content .mc-calendar{width:296px;height:348px}\n"] }]
2295
1675
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { calendar: [{
2296
1676
  type: ViewChild,
2297
1677
  args: [McCalendar]
@@ -2310,8 +1690,6 @@ class McDatepicker {
2310
1690
  this.document = document;
2311
1691
  this._hasBackdrop = false;
2312
1692
  this._opened = false;
2313
- /** The view that the calendar should start in. */
2314
- this.startView = McCalendarView.Month;
2315
1693
  /**
2316
1694
  * Emits selected year in multiyear view.
2317
1695
  * This doesn't imply a change on the selected date.
@@ -2353,12 +1731,15 @@ class McDatepicker {
2353
1731
  }
2354
1732
  /** The date to open the calendar to initially. */
2355
1733
  get startAt() {
1734
+ var _a;
2356
1735
  // If an explicit startAt is set we start there, otherwise we start at whatever the currently
2357
1736
  // selected value is.
2358
- return this._startAt || (this.datepickerInput ? this.datepickerInput.value : null);
1737
+ return this._startAt || ((_a = this.datepickerInput) === null || _a === void 0 ? void 0 : _a.value);
2359
1738
  }
2360
1739
  set startAt(value) {
2361
- this._startAt = this.getValidDateOrNull(this.dateAdapter.deserialize(value));
1740
+ const deserializedValue = this.dateAdapter.deserialize(value);
1741
+ this._startAt = deserializedValue !== null ?
1742
+ this.dateAdapter.clampDate(deserializedValue, this.minDate, this.maxDate) : null;
2362
1743
  }
2363
1744
  /** Whether the datepicker pop-up should be disabled. */
2364
1745
  get disabled() {
@@ -2494,7 +1875,7 @@ class McDatepicker {
2494
1875
  // Update the position once the calendar has rendered.
2495
1876
  this.ngZone.onStable.asObservable()
2496
1877
  .pipe(take(1))
2497
- .subscribe(() => this.popupRef.updatePosition());
1878
+ .subscribe(() => { var _a; return (_a = this.popupRef) === null || _a === void 0 ? void 0 : _a.updatePosition(); });
2498
1879
  }
2499
1880
  }
2500
1881
  /** Create the popup. */
@@ -2552,16 +1933,9 @@ class McDatepicker {
2552
1933
  }
2553
1934
  ]);
2554
1935
  }
2555
- /**
2556
- * @param obj The object to check.
2557
- * @returns The given object if it is both a date instance and valid, otherwise null.
2558
- */
2559
- getValidDateOrNull(obj) {
2560
- return (this.dateAdapter.isDateInstance(obj) && this.dateAdapter.isValid(obj)) ? obj : null;
2561
- }
2562
1936
  }
2563
- /** @nocollapse */ McDatepicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McDatepicker, deps: [{ token: i3.Overlay }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: MC_DATEPICKER_SCROLL_STRATEGY }, { token: i1$1.DateAdapter, optional: true }, { token: i2.Directionality, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2564
- /** @nocollapse */ McDatepicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McDatepicker, selector: "mc-datepicker", inputs: { hasBackdrop: "hasBackdrop", startAt: "startAt", disabled: "disabled", opened: "opened", minDate: "minDate", maxDate: "maxDate", calendarHeaderComponent: "calendarHeaderComponent", startView: "startView", panelClass: "panelClass", dateClass: "dateClass", backdropClass: "backdropClass" }, outputs: { yearSelected: "yearSelected", monthSelected: "monthSelected", openedStream: "opened", closedStream: "closed" }, providers: [{ provide: McFormFieldControl, useExisting: McDatepicker }], exportAs: ["mcDatepicker"], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
1937
+ /** @nocollapse */ McDatepicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McDatepicker, deps: [{ token: i3$1.Overlay }, { token: i0.NgZone }, { token: i0.ViewContainerRef }, { token: MC_DATEPICKER_SCROLL_STRATEGY }, { token: i1$1.DateAdapter, optional: true }, { token: i5$1.Directionality, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1938
+ /** @nocollapse */ McDatepicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", type: McDatepicker, selector: "mc-datepicker", inputs: { hasBackdrop: "hasBackdrop", startAt: "startAt", disabled: "disabled", opened: "opened", minDate: "minDate", maxDate: "maxDate", panelClass: "panelClass", dateClass: "dateClass", backdropClass: "backdropClass" }, outputs: { yearSelected: "yearSelected", monthSelected: "monthSelected", openedStream: "opened", closedStream: "closed" }, providers: [{ provide: McFormFieldControl, useExisting: McDatepicker }], exportAs: ["mcDatepicker"], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
2565
1939
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McDatepicker, decorators: [{
2566
1940
  type: Component,
2567
1941
  args: [{
@@ -2573,12 +1947,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
2573
1947
  providers: [{ provide: McFormFieldControl, useExisting: McDatepicker }]
2574
1948
  }]
2575
1949
  }], ctorParameters: function () {
2576
- return [{ type: i3.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
1950
+ return [{ type: i3$1.Overlay }, { type: i0.NgZone }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
2577
1951
  type: Inject,
2578
1952
  args: [MC_DATEPICKER_SCROLL_STRATEGY]
2579
1953
  }] }, { type: i1$1.DateAdapter, decorators: [{
2580
1954
  type: Optional
2581
- }] }, { type: i2.Directionality, decorators: [{
1955
+ }] }, { type: i5$1.Directionality, decorators: [{
2582
1956
  type: Optional
2583
1957
  }] }, { type: undefined, decorators: [{
2584
1958
  type: Optional
@@ -2598,10 +1972,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
2598
1972
  type: Input
2599
1973
  }], maxDate: [{
2600
1974
  type: Input
2601
- }], calendarHeaderComponent: [{
2602
- type: Input
2603
- }], startView: [{
2604
- type: Input
2605
1975
  }], yearSelected: [{
2606
1976
  type: Output
2607
1977
  }], monthSelected: [{
@@ -2631,13 +2001,13 @@ class McDatepickerModule {
2631
2001
  McDatepickerToggle,
2632
2002
  McDatepickerToggleIcon,
2633
2003
  McMonthView,
2634
- McYearView,
2635
- McMultiYearView,
2636
2004
  McCalendarHeader], imports: [CommonModule,
2637
2005
  McButtonModule,
2638
2006
  OverlayModule,
2639
2007
  A11yModule,
2640
2008
  PortalModule,
2009
+ McButtonModule,
2010
+ McSelectModule,
2641
2011
  McIconModule], exports: [McCalendar,
2642
2012
  McCalendarBody,
2643
2013
  McDatepicker,
@@ -2646,10 +2016,7 @@ class McDatepickerModule {
2646
2016
  McDatepickerToggle,
2647
2017
  McDatepickerToggleIcon,
2648
2018
  McMonthView,
2649
- McYearView,
2650
- McMultiYearView,
2651
- McCalendarHeader,
2652
- McButtonModule] });
2019
+ McCalendarHeader] });
2653
2020
  /** @nocollapse */ McDatepickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McDatepickerModule, providers: [
2654
2021
  McDatepickerIntl,
2655
2022
  MC_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER
@@ -2658,7 +2025,9 @@ class McDatepickerModule {
2658
2025
  OverlayModule,
2659
2026
  A11yModule,
2660
2027
  PortalModule,
2661
- McIconModule, McButtonModule] });
2028
+ McButtonModule,
2029
+ McSelectModule,
2030
+ McIconModule] });
2662
2031
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: McDatepickerModule, decorators: [{
2663
2032
  type: NgModule,
2664
2033
  args: [{
@@ -2668,6 +2037,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
2668
2037
  OverlayModule,
2669
2038
  A11yModule,
2670
2039
  PortalModule,
2040
+ McButtonModule,
2041
+ McSelectModule,
2671
2042
  McIconModule
2672
2043
  ],
2673
2044
  exports: [
@@ -2679,10 +2050,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
2679
2050
  McDatepickerToggle,
2680
2051
  McDatepickerToggleIcon,
2681
2052
  McMonthView,
2682
- McYearView,
2683
- McMultiYearView,
2684
- McCalendarHeader,
2685
- McButtonModule
2053
+ McCalendarHeader
2686
2054
  ],
2687
2055
  declarations: [
2688
2056
  McCalendar,
@@ -2693,8 +2061,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
2693
2061
  McDatepickerToggle,
2694
2062
  McDatepickerToggleIcon,
2695
2063
  McMonthView,
2696
- McYearView,
2697
- McMultiYearView,
2698
2064
  McCalendarHeader
2699
2065
  ],
2700
2066
  providers: [
@@ -2708,5 +2074,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
2708
2074
  * Generated bundle index. Do not edit.
2709
2075
  */
2710
2076
 
2711
- export { MAX_YEAR, MC_DATEPICKER_SCROLL_STRATEGY, MC_DATEPICKER_SCROLL_STRATEGY_FACTORY, MC_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MC_DATEPICKER_VALIDATORS, MC_DATEPICKER_VALUE_ACCESSOR, McCalendar, McCalendarBody, McCalendarCell, McCalendarHeader, McCalendarView, McDatepicker, McDatepickerContent, McDatepickerInput, McDatepickerInputEvent, McDatepickerIntl, McDatepickerModule, McDatepickerToggle, McDatepickerToggleIcon, McMonthView, McMultiYearView, McYearView, mcDatepickerAnimations, yearsPerPage, yearsPerRow };
2077
+ export { MAX_YEAR, MC_DATEPICKER_SCROLL_STRATEGY, MC_DATEPICKER_SCROLL_STRATEGY_FACTORY, MC_DATEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MC_DATEPICKER_VALIDATORS, MC_DATEPICKER_VALUE_ACCESSOR, McCalendar, McCalendarBody, McCalendarCell, McCalendarHeader, McDatepicker, McDatepickerContent, McDatepickerInput, McDatepickerInputEvent, McDatepickerIntl, McDatepickerModule, McDatepickerToggle, McDatepickerToggleIcon, McMonthView, mcDatepickerAnimations };
2712
2078
  //# sourceMappingURL=ptsecurity-mosaic-datepicker.mjs.map