@ng-matero/extensions 12.5.0 → 12.6.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 (167) hide show
  1. package/_all-theme.scss +2 -0
  2. package/_index.scss +2 -0
  3. package/_theming.scss +2 -0
  4. package/bundles/extensions.umd.js +24 -58
  5. package/bundles/extensions.umd.js.map +1 -1
  6. package/bundles/mtxAlert.umd.js +3 -3
  7. package/bundles/mtxButton.umd.js +3 -3
  8. package/bundles/mtxCheckboxGroup.umd.js +4 -5
  9. package/bundles/mtxCheckboxGroup.umd.js.map +1 -1
  10. package/bundles/mtxColorpicker.umd.js +1106 -0
  11. package/bundles/mtxColorpicker.umd.js.map +1 -0
  12. package/bundles/mtxColumnResize.umd.js +3 -3
  13. package/bundles/mtxColumnResize.umd.js.map +1 -1
  14. package/bundles/mtxCore.umd.js +3 -3
  15. package/bundles/mtxDatetimepicker.umd.js +611 -156
  16. package/bundles/mtxDatetimepicker.umd.js.map +1 -1
  17. package/bundles/mtxDialog.umd.js +4 -6
  18. package/bundles/mtxDialog.umd.js.map +1 -1
  19. package/bundles/mtxFormGroup.umd.js +5 -12
  20. package/bundles/mtxFormGroup.umd.js.map +1 -1
  21. package/bundles/mtxGrid.umd.js +5 -7
  22. package/bundles/mtxGrid.umd.js.map +1 -1
  23. package/bundles/mtxLoader.umd.js +3 -3
  24. package/bundles/mtxPipes.umd.js +3 -3
  25. package/bundles/mtxPopover.umd.js +3 -3
  26. package/bundles/mtxPopover.umd.js.map +1 -1
  27. package/bundles/mtxProgress.umd.js +4 -4
  28. package/bundles/mtxSelect.umd.js +4 -4
  29. package/bundles/mtxSelect.umd.js.map +1 -1
  30. package/bundles/mtxSlider.umd.js +4 -4
  31. package/bundles/mtxSlider.umd.js.map +1 -1
  32. package/bundles/mtxSplit.umd.js +5 -16
  33. package/bundles/mtxSplit.umd.js.map +1 -1
  34. package/bundles/mtxText3d.umd.js +4 -12
  35. package/bundles/mtxText3d.umd.js.map +1 -1
  36. package/bundles/mtxTooltip.umd.js +10 -5
  37. package/bundles/mtxTooltip.umd.js.map +1 -1
  38. package/checkbox-group/checkbox-group.component.d.ts +2 -4
  39. package/checkbox-group/mtxCheckboxGroup.metadata.json +1 -1
  40. package/colorpicker/_colorpicker-theme.import.scss +2 -0
  41. package/colorpicker/_colorpicker-theme.scss +43 -0
  42. package/colorpicker/colorpicker-animations.d.ts +8 -0
  43. package/colorpicker/colorpicker-content.scss +4 -0
  44. package/colorpicker/colorpicker-input.d.ts +86 -0
  45. package/colorpicker/colorpicker-module.d.ts +2 -0
  46. package/colorpicker/colorpicker-toggle.d.ts +34 -0
  47. package/colorpicker/colorpicker-toggle.scss +23 -0
  48. package/colorpicker/colorpicker.d.ts +122 -0
  49. package/{color-picker/mtxColorPicker.d.ts → colorpicker/mtxColorpicker.d.ts} +0 -0
  50. package/colorpicker/mtxColorpicker.metadata.json +1 -0
  51. package/colorpicker/package.json +11 -0
  52. package/colorpicker/public-api.d.ts +5 -0
  53. package/datetimepicker/_datetimepicker-theme.scss +12 -0
  54. package/datetimepicker/calendar.d.ts +2 -10
  55. package/datetimepicker/clock.d.ts +10 -9
  56. package/datetimepicker/datetimepicker-animations.d.ts +7 -5
  57. package/datetimepicker/datetimepicker-input.d.ts +4 -2
  58. package/datetimepicker/{datetimepicker.module.d.ts → datetimepicker-module.d.ts} +0 -0
  59. package/datetimepicker/datetimepicker-toggle.d.ts +15 -2
  60. package/datetimepicker/datetimepicker-toggle.scss +23 -0
  61. package/datetimepicker/datetimepicker.d.ts +67 -24
  62. package/datetimepicker/month-view.d.ts +3 -3
  63. package/datetimepicker/mtxDatetimepicker.d.ts +0 -2
  64. package/datetimepicker/mtxDatetimepicker.metadata.json +1 -1
  65. package/datetimepicker/multi-year-view.d.ts +3 -3
  66. package/datetimepicker/public-api.d.ts +3 -1
  67. package/datetimepicker/year-view.d.ts +3 -3
  68. package/dialog/{dialog.config.d.ts → dialog-config.d.ts} +0 -0
  69. package/dialog/dialog.component.d.ts +1 -1
  70. package/dialog/dialog.d.ts +1 -1
  71. package/dialog/mtxDialog.metadata.json +1 -1
  72. package/dialog/public-api.d.ts +2 -2
  73. package/esm2015/checkbox-group/checkbox-group.component.js +2 -3
  74. package/esm2015/colorpicker/colorpicker-animations.js +16 -0
  75. package/esm2015/colorpicker/colorpicker-input.js +225 -0
  76. package/esm2015/colorpicker/colorpicker-module.js +41 -0
  77. package/esm2015/colorpicker/colorpicker-toggle.js +98 -0
  78. package/esm2015/colorpicker/colorpicker.js +361 -0
  79. package/esm2015/colorpicker/mtxColorpicker.js +5 -0
  80. package/esm2015/colorpicker/public-api.js +6 -0
  81. package/esm2015/column-resize/event-dispatcher.js +1 -1
  82. package/esm2015/datetimepicker/calendar-body.js +2 -1
  83. package/esm2015/datetimepicker/calendar.js +17 -32
  84. package/esm2015/datetimepicker/clock.js +10 -10
  85. package/esm2015/datetimepicker/datetimepicker-animations.js +38 -24
  86. package/esm2015/datetimepicker/datetimepicker-input.js +7 -4
  87. package/esm2015/datetimepicker/datetimepicker-module.js +52 -0
  88. package/esm2015/datetimepicker/datetimepicker-toggle.js +30 -8
  89. package/esm2015/datetimepicker/datetimepicker.js +150 -71
  90. package/esm2015/datetimepicker/month-view.js +8 -7
  91. package/esm2015/datetimepicker/mtxDatetimepicker.js +1 -3
  92. package/esm2015/datetimepicker/multi-year-view.js +8 -7
  93. package/esm2015/datetimepicker/public-api.js +4 -2
  94. package/esm2015/datetimepicker/year-view.js +8 -7
  95. package/esm2015/dialog/{dialog.config.js → dialog-config.js} +1 -1
  96. package/esm2015/dialog/dialog.component.js +2 -2
  97. package/esm2015/dialog/dialog.js +1 -1
  98. package/esm2015/dialog/public-api.js +3 -3
  99. package/esm2015/extensions.module.js +3 -3
  100. package/esm2015/form-group/form-group.component.js +4 -11
  101. package/esm2015/popover/popover.js +1 -1
  102. package/esm2015/progress/progress.component.js +1 -1
  103. package/esm2015/public-api.js +2 -2
  104. package/esm2015/select/select.component.js +2 -2
  105. package/esm2015/slider/slider.js +2 -2
  106. package/esm2015/split/interface.js +1 -1
  107. package/esm2015/split/split.component.js +3 -9
  108. package/esm2015/split/utils.js +1 -6
  109. package/esm2015/text3d/text3d.component.js +2 -10
  110. package/esm2015/tooltip/tooltip.js +8 -3
  111. package/extensions.metadata.json +1 -1
  112. package/fesm2015/extensions.js +3 -3
  113. package/fesm2015/extensions.js.map +1 -1
  114. package/fesm2015/mtxCheckboxGroup.js +1 -2
  115. package/fesm2015/mtxCheckboxGroup.js.map +1 -1
  116. package/fesm2015/mtxColorpicker.js +730 -0
  117. package/fesm2015/mtxColorpicker.js.map +1 -0
  118. package/fesm2015/mtxColumnResize.js.map +1 -1
  119. package/fesm2015/mtxDatetimepicker.js +266 -153
  120. package/fesm2015/mtxDatetimepicker.js.map +1 -1
  121. package/fesm2015/mtxDialog.js +2 -2
  122. package/fesm2015/mtxDialog.js.map +1 -1
  123. package/fesm2015/mtxFormGroup.js +3 -10
  124. package/fesm2015/mtxFormGroup.js.map +1 -1
  125. package/fesm2015/mtxPopover.js.map +1 -1
  126. package/fesm2015/mtxProgress.js +1 -1
  127. package/fesm2015/mtxSelect.js +1 -1
  128. package/fesm2015/mtxSelect.js.map +1 -1
  129. package/fesm2015/mtxSlider.js +1 -1
  130. package/fesm2015/mtxSlider.js.map +1 -1
  131. package/fesm2015/mtxSplit.js +2 -13
  132. package/fesm2015/mtxSplit.js.map +1 -1
  133. package/fesm2015/mtxText3d.js +1 -9
  134. package/fesm2015/mtxText3d.js.map +1 -1
  135. package/fesm2015/mtxTooltip.js +7 -2
  136. package/fesm2015/mtxTooltip.js.map +1 -1
  137. package/form-group/form-group.component.d.ts +2 -4
  138. package/form-group/mtxFormGroup.metadata.json +1 -1
  139. package/package.json +2 -2
  140. package/popover/popover.d.ts +3 -3
  141. package/progress/mtxProgress.metadata.json +1 -1
  142. package/public-api.d.ts +1 -1
  143. package/select/mtxSelect.metadata.json +1 -1
  144. package/select/select.component.d.ts +1 -1
  145. package/slider/_slider-theme.scss +1 -1
  146. package/slider/mtxSlider.metadata.json +1 -1
  147. package/slider/slider.d.ts +1 -1
  148. package/slider/slider.scss +1 -0
  149. package/split/interface.d.ts +1 -2
  150. package/split/mtxSplit.metadata.json +1 -1
  151. package/text3d/mtxText3d.metadata.json +1 -1
  152. package/text3d/text3d.component.d.ts +0 -1
  153. package/tooltip/mtxTooltip.metadata.json +1 -1
  154. package/bundles/mtxColorPicker.umd.js +0 -337
  155. package/bundles/mtxColorPicker.umd.js.map +0 -1
  156. package/color-picker/color-picker.component.d.ts +0 -120
  157. package/color-picker/color-picker.module.d.ts +0 -2
  158. package/color-picker/mtxColorPicker.metadata.json +0 -1
  159. package/color-picker/package.json +0 -11
  160. package/color-picker/public-api.d.ts +0 -2
  161. package/esm2015/color-picker/color-picker.component.js +0 -268
  162. package/esm2015/color-picker/color-picker.module.js +0 -26
  163. package/esm2015/color-picker/mtxColorPicker.js +0 -5
  164. package/esm2015/color-picker/public-api.js +0 -3
  165. package/esm2015/datetimepicker/datetimepicker.module.js +0 -49
  166. package/fesm2015/mtxColorPicker.js +0 -295
  167. package/fesm2015/mtxColorPicker.js.map +0 -1
@@ -1,51 +1,65 @@
1
1
  import { A11yModule } from '@angular/cdk/a11y';
2
- import { OverlayConfig, Overlay, OverlayModule } from '@angular/cdk/overlay';
2
+ import { Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
3
+ import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
3
4
  import { CommonModule } from '@angular/common';
4
- import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Optional, Inject, ElementRef, NgZone, ChangeDetectorRef, ViewChild, ViewContainerRef, forwardRef, Directive, NgModule } from '@angular/core';
5
+ import { EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, Output, Optional, Inject, ElementRef, NgZone, ChangeDetectorRef, InjectionToken, ViewChild, ViewContainerRef, forwardRef, Directive, ContentChild, NgModule } from '@angular/core';
5
6
  import { MatButtonModule } from '@angular/material/button';
6
- import { MatIconModule } from '@angular/material/icon';
7
7
  import { ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
8
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
9
- import { MatDatepickerIntl, MAT_DATEPICKER_SCROLL_STRATEGY } from '@angular/material/datepicker';
8
+ import { coerceBooleanProperty, coerceStringArray } from '@angular/cdk/coercion';
9
+ import { MatDatepickerIntl } from '@angular/material/datepicker';
10
10
  import { first, take, filter } from 'rxjs/operators';
11
11
  import { DatetimeAdapter, MTX_DATETIME_FORMATS } from '@ng-matero/extensions/core';
12
- import { trigger, state, style, transition, animate, keyframes } from '@angular/animations';
12
+ import { trigger, transition, animate, keyframes, style, state } from '@angular/animations';
13
13
  import { Directionality } from '@angular/cdk/bidi';
14
- import { ComponentPortal } from '@angular/cdk/portal';
15
- import { Subject, Subscription, merge, of } from 'rxjs';
16
14
  import { _getFocusedElementPierceShadowDom } from '@angular/cdk/platform';
15
+ import { mixinColor } from '@angular/material/core';
16
+ import { Subject, Subscription, merge, of } from 'rxjs';
17
17
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
18
18
  import { MAT_INPUT_VALUE_ACCESSOR } from '@angular/material/input';
19
19
  import { MatFormField } from '@angular/material/form-field';
20
20
 
21
21
  /**
22
- * This animation fades in the background color and text content of the
23
- * select's options. It is time delayed to occur 100ms after the overlay
24
- * panel has transformed in.
22
+ * Animations used by the Material datepicker.
23
+ * @docs-private
25
24
  */
26
- const fadeInContent = trigger('fadeInContent', [
27
- state('showing', style({ opacity: 1 })),
28
- transition('void => showing', [
29
- style({ opacity: 0 }),
30
- animate(`150ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)`),
25
+ const mtxDatetimepickerAnimations = {
26
+ /** Transforms the height of the datepicker's calendar. */
27
+ transformPanel: trigger('transformPanel', [
28
+ transition('void => enter-dropdown', animate('120ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
29
+ style({ opacity: 0, transform: 'scale(1, 0.8)' }),
30
+ style({ opacity: 1, transform: 'scale(1, 1)' }),
31
+ ]))),
32
+ transition('void => enter-dialog', animate('150ms cubic-bezier(0, 0, 0.2, 1)', keyframes([
33
+ style({ opacity: 0, transform: 'scale(0.7)' }),
34
+ style({ transform: 'none', opacity: 1 }),
35
+ ]))),
36
+ transition('* => void', animate('100ms linear', style({ opacity: 0 }))),
31
37
  ]),
32
- ]);
33
- const slideCalendar = trigger('slideCalendar', [
34
- transition('* => left', [
35
- animate(180, keyframes([
36
- style({ transform: 'translateX(100%)', offset: 0.5 }),
37
- style({ transform: 'translateX(-100%)', offset: 0.51 }),
38
- style({ transform: 'translateX(0)', offset: 1 }),
39
- ])),
38
+ /** Fades in the content of the calendar. */
39
+ fadeInCalendar: trigger('fadeInCalendar', [
40
+ state('void', style({ opacity: 0 })),
41
+ state('enter', style({ opacity: 1 })),
42
+ // TODO(crisbeto): this animation should be removed since it isn't quite on spec, but we
43
+ // need to keep it until #12440 gets in, otherwise the exit animation will look glitchy.
44
+ transition('void => *', animate('120ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)')),
40
45
  ]),
41
- transition('* => right', [
42
- animate(180, keyframes([
43
- style({ transform: 'translateX(-100%)', offset: 0.5 }),
44
- style({ transform: 'translateX(100%)', offset: 0.51 }),
45
- style({ transform: 'translateX(0)', offset: 1 }),
46
- ])),
46
+ slideCalendar: trigger('slideCalendar', [
47
+ transition('* => left', [
48
+ animate(180, keyframes([
49
+ style({ transform: 'translateX(100%)', offset: 0.5 }),
50
+ style({ transform: 'translateX(-100%)', offset: 0.51 }),
51
+ style({ transform: 'translateX(0)', offset: 1 }),
52
+ ])),
53
+ ]),
54
+ transition('* => right', [
55
+ animate(180, keyframes([
56
+ style({ transform: 'translateX(-100%)', offset: 0.5 }),
57
+ style({ transform: 'translateX(100%)', offset: 0.51 }),
58
+ style({ transform: 'translateX(0)', offset: 1 }),
59
+ ])),
60
+ ]),
47
61
  ]),
48
- ]);
62
+ };
49
63
 
50
64
  /** @docs-private */
51
65
  function createMissingDateImplError(provider) {
@@ -117,6 +131,7 @@ MtxCalendarBody.decorators = [
117
131
  host: {
118
132
  class: 'mtx-calendar-body',
119
133
  },
134
+ exportAs: 'mtxCalendarBody',
120
135
  encapsulation: ViewEncapsulation.None,
121
136
  changeDetection: ChangeDetectionStrategy.OnPush,
122
137
  styles: [".mtx-calendar-body{min-width:224px}.mtx-calendar-body-label{height:0;line-height:0;text-align:left;padding:7.1428571429% 4.7142857143%}[dir=rtl] .mtx-calendar-body-label{text-align:right}.mtx-calendar-body-cell{position:relative;width:14.2857142857%;height:0;line-height:0;padding:7.1428571429% 0;text-align:center;outline:none;cursor:pointer}.mtx-calendar-body-disabled{cursor:default;pointer-events:none}.mtx-calendar-body-cell-content{position:absolute;top:5%;left:5%;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:90%;height:90%;border:1px solid transparent;border-radius:999px}\n"]
@@ -145,10 +160,11 @@ class MtxMultiYearView {
145
160
  constructor(_adapter, _dateFormats) {
146
161
  this._adapter = _adapter;
147
162
  this._dateFormats = _dateFormats;
148
- this._userSelection = new EventEmitter();
149
163
  this.type = 'date';
150
164
  /** Emits when a new month is selected. */
151
165
  this.selectedChange = new EventEmitter();
166
+ /** Emits when any date is selected. */
167
+ this._userSelection = new EventEmitter();
152
168
  if (!this._adapter) {
153
169
  throw createMissingDateImplError('DatetimeAdapter');
154
170
  }
@@ -280,7 +296,8 @@ MtxMultiYearView.decorators = [
280
296
  { type: Component, args: [{
281
297
  selector: 'mtx-multi-year-view',
282
298
  template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [todayValue]=\"_todayYear\"\n [rows]=\"_years\"\n [numCols]=\"4\"\n [activeCell]=\"_getActiveCell()\"\n [allowDisabledSelection]=\"true\"\n [selectedValue]=\"_selectedYear!\"\n (selectedValueChange)=\"_yearSelected($event)\"></tbody>\n</table>\n",
283
- animations: [slideCalendar],
299
+ exportAs: 'mtxMultiYearView',
300
+ animations: [mtxDatetimepickerAnimations.slideCalendar],
284
301
  encapsulation: ViewEncapsulation.None,
285
302
  changeDetection: ChangeDetectionStrategy.OnPush
286
303
  },] }
@@ -298,10 +315,10 @@ MtxMultiYearView.ctorParameters = () => [
298
315
  ];
299
316
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
300
317
  MtxMultiYearView.propDecorators = {
301
- _userSelection: [{ type: Output }],
302
318
  type: [{ type: Input }],
303
319
  dateFilter: [{ type: Input }],
304
320
  selectedChange: [{ type: Output }],
321
+ _userSelection: [{ type: Output }],
305
322
  activeDate: [{ type: Input }],
306
323
  selected: [{ type: Input }],
307
324
  minDate: [{ type: Input }],
@@ -354,25 +371,18 @@ class MtxCalendar {
354
371
  this._ngZone = _ngZone;
355
372
  this._adapter = _adapter;
356
373
  this._dateFormats = _dateFormats;
357
- this._userSelection = new EventEmitter();
358
374
  this._multiYearSelector = false;
359
375
  this._twelvehour = false;
360
376
  /** Whether the calendar should be started in month or year view. */
361
377
  this.startView = 'month';
362
378
  this.timeInterval = 1;
363
- this.ariaLabel = 'Use arrow keys to navigate';
364
- this.ariaNextMonthLabel = 'Next month';
365
- this.ariaPrevMonthLabel = 'Previous month';
366
- this.ariaNextYearLabel = 'Next year';
367
- this.ariaPrevYearLabel = 'Previous year';
368
- this.ariaNextMultiYearLabel = 'Next year range';
369
- this.ariaPrevMultiYearLabel = 'Previous year range';
370
379
  /** Prevent user to select same date time */
371
380
  this.preventSameDateTimeSelection = false;
372
381
  /** Emits when the currently selected date changes. */
373
382
  this.selectedChange = new EventEmitter();
374
383
  /** Emits when the view has been changed. */
375
384
  this.viewChanged = new EventEmitter();
385
+ this._userSelection = new EventEmitter();
376
386
  this._clockView = 'hour';
377
387
  this._type = 'date';
378
388
  /** Date filter for the month and year views. */
@@ -500,7 +510,7 @@ class MtxCalendar {
500
510
  }
501
511
  get _hoursLabel() {
502
512
  let hour = this._adapter.getHour(this._activeDate);
503
- if (!!this.twelvehour) {
513
+ if (this.twelvehour) {
504
514
  if (hour === 0) {
505
515
  hour = 24;
506
516
  }
@@ -514,11 +524,11 @@ class MtxCalendar {
514
524
  get _ariaLabelNext() {
515
525
  switch (this._currentView) {
516
526
  case 'month':
517
- return this.ariaNextMonthLabel;
527
+ return this._intl.nextMonthLabel;
518
528
  case 'year':
519
- return this.ariaNextYearLabel;
529
+ return this._intl.nextYearLabel;
520
530
  case 'multi-year':
521
- return this.ariaNextMultiYearLabel;
531
+ return this._intl.nextMultiYearLabel;
522
532
  default:
523
533
  return '';
524
534
  }
@@ -526,11 +536,11 @@ class MtxCalendar {
526
536
  get _ariaLabelPrev() {
527
537
  switch (this._currentView) {
528
538
  case 'month':
529
- return this.ariaPrevMonthLabel;
539
+ return this._intl.prevMonthLabel;
530
540
  case 'year':
531
- return this.ariaPrevYearLabel;
541
+ return this._intl.prevYearLabel;
532
542
  case 'multi-year':
533
- return this.ariaPrevMultiYearLabel;
543
+ return this._intl.prevMultiYearLabel;
534
544
  default:
535
545
  return '';
536
546
  }
@@ -611,7 +621,7 @@ class MtxCalendar {
611
621
  this._activeDate = date;
612
622
  }
613
623
  _updateDate(date) {
614
- if (!!this.twelvehour) {
624
+ if (this.twelvehour) {
615
625
  const HOUR = this._adapter.getHour(date);
616
626
  if (HOUR === 12) {
617
627
  if (this._AMPM === 'AM') {
@@ -908,17 +918,17 @@ class MtxCalendar {
908
918
  MtxCalendar.decorators = [
909
919
  { type: Component, args: [{
910
920
  selector: 'mtx-calendar',
911
- template: "<div class=\"mtx-calendar-header\">\n <div (click)=\"_yearClicked()\"\n *ngIf=\"type !== 'time'\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-calendar-header-year\"\n role=\"button\">\n <span>{{ _yearLabel }}</span>\n <mat-icon *ngIf=\"multiYearSelector || type === 'year'\">arrow_drop_down</mat-icon>\n </div>\n <div class=\"mtx-calendar-header-date-time\">\n <span (click)=\"_dateClicked()\" *ngIf=\"type !== 'time' && type !== 'year'\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n class=\"mtx-calendar-header-date\"\n role=\"button\">{{ _dateLabel }}</span>\n <span *ngIf=\"type.endsWith('time')\"\n [class.active]=\"currentView === 'clock'\"\n class=\"mtx-calendar-header-time\">\n <span (click)=\"_hoursClicked()\"\n [class.active]=\"_clockView == 'hour'\"\n class=\"mtx-calendar-header-hours\"\n role=\"button\">{{ _hoursLabel }}</span>:<span (click)=\"_minutesClicked()\"\n [class.active]=\"_clockView == 'minute'\"\n class=\"mtx-calendar-header-minutes\"\n role=\"button\">{{ _minutesLabel }}</span>\n <br />\n <span *ngIf=\"twelvehour\" class=\"mtx-calendar-header-ampm-container\">\n <span (click)=\"_ampmClicked('AM')\"\n [class.active]=\"_AMPM === 'AM'\"\n class=\"mtx-calendar-header-ampm\">AM</span>/<span\n (click)=\"_ampmClicked('PM')\"\n [class.active]=\"_AMPM === 'PM'\"\n class=\"mtx-calendar-header-ampm\">PM</span>\n </span>\n </span>\n </div>\n</div>\n<div class=\"mtx-calendar-content\" [ngSwitch]=\"currentView\">\n <div *ngIf=\"currentView === 'month' || currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-month-content\">\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\" (click)=\"_previousClicked()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_ariaLabelPrev\"\n [class.disabled]=\"!_previousEnabled()\"\n class=\"mtx-calendar-previous-button\">\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"></path>\n </svg>\n </button>\n <div (@slideCalendar.done)=\"_calendarStateDone()\" [@slideCalendar]=\"_calendarState\"\n class=\"mtx-calendar-period-button\">\n <strong>{{ _monthYearLabel }}</strong>\n </div>\n <button mat-icon-button type=\"button\" (click)=\"_nextClicked()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_ariaLabelNext\"\n [class.disabled]=\"!_nextEnabled()\"\n class=\"mtx-calendar-next-button\">\n <svg height=\"24\" viewBox=\"0 0 24 24\" width=\"24\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"></path>\n </svg>\n </button>\n </div>\n </div>\n <mtx-month-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n *ngSwitchCase=\"'month'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n <mtx-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n *ngSwitchCase=\"'year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n <mtx-multi-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n *ngSwitchCase=\"'multi-year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-multi-year-view>\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n *ngSwitchDefault\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"_activeDate\"\n [startView]=\"_clockView\"\n [twelvehour]=\"twelvehour\">\n </mtx-clock>\n</div>\n",
921
+ template: "<div class=\"mtx-calendar-header\">\n <div (click)=\"_yearClicked()\"\n *ngIf=\"type !== 'time'\"\n [class.active]=\"currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-calendar-header-year\"\n role=\"button\">\n <span>{{ _yearLabel }}</span>\n <svg *ngIf=\"multiYearSelector || type === 'year'\"\n class=\"mtx-calendar-header-year-dropdown\"\n width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n <path d=\"M7,10L12,15L17,10H7Z\"></path>\n </svg>\n </div>\n <div class=\"mtx-calendar-header-date-time\">\n <span (click)=\"_dateClicked()\" *ngIf=\"type !== 'time' && type !== 'year'\"\n [class.active]=\"currentView === 'month'\"\n [class.not-clickable]=\"type === 'month'\"\n class=\"mtx-calendar-header-date\"\n role=\"button\">{{ _dateLabel }}</span>\n <span *ngIf=\"type.endsWith('time')\"\n [class.active]=\"currentView === 'clock'\"\n class=\"mtx-calendar-header-time\">\n <span (click)=\"_hoursClicked()\"\n [class.active]=\"_clockView === 'hour'\"\n class=\"mtx-calendar-header-hours\"\n role=\"button\">{{ _hoursLabel }}</span>:<span (click)=\"_minutesClicked()\"\n [class.active]=\"_clockView === 'minute'\"\n class=\"mtx-calendar-header-minutes\"\n role=\"button\">{{ _minutesLabel }}</span>\n <br />\n <span *ngIf=\"twelvehour\" class=\"mtx-calendar-header-ampm-container\">\n <span (click)=\"_ampmClicked('AM')\"\n [class.active]=\"_AMPM === 'AM'\"\n class=\"mtx-calendar-header-ampm\">AM</span>/<span\n (click)=\"_ampmClicked('PM')\"\n [class.active]=\"_AMPM === 'PM'\"\n class=\"mtx-calendar-header-ampm\">PM</span>\n </span>\n </span>\n </div>\n</div>\n<div class=\"mtx-calendar-content\" [ngSwitch]=\"currentView\">\n <div *ngIf=\"currentView === 'month' || currentView === 'year' || currentView === 'multi-year'\"\n class=\"mtx-month-content\">\n <div class=\"mtx-calendar-controls\">\n <button mat-icon-button type=\"button\" (click)=\"_previousClicked()\"\n [attr.aria-disabled]=\"!_previousEnabled()\"\n [attr.aria-label]=\"_ariaLabelPrev\"\n [class.disabled]=\"!_previousEnabled()\"\n class=\"mtx-calendar-previous-button\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z\"></path>\n </svg>\n </button>\n <div [@slideCalendar]=\"_calendarState\"\n (@slideCalendar.done)=\"_calendarStateDone()\"\n class=\"mtx-calendar-period-button\">\n <strong>{{ _monthYearLabel }}</strong>\n </div>\n <button mat-icon-button type=\"button\" (click)=\"_nextClicked()\"\n [attr.aria-disabled]=\"!_nextEnabled()\"\n [attr.aria-label]=\"_ariaLabelNext\"\n [class.disabled]=\"!_nextEnabled()\"\n class=\"mtx-calendar-next-button\">\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\">\n <path d=\"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z\"></path>\n </svg>\n </button>\n </div>\n </div>\n <mtx-month-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_dateSelected($event)\"\n *ngSwitchCase=\"'month'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-month-view>\n <mtx-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_monthSelected($event)\"\n *ngSwitchCase=\"'year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-year-view>\n <mtx-multi-year-view (_userSelection)=\"_userSelected()\"\n (selectedChange)=\"_yearSelected($event)\"\n *ngSwitchCase=\"'multi-year'\"\n [activeDate]=\"_activeDate\"\n [dateFilter]=\"_dateFilterForViews\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"selected!\"\n [type]=\"type\">\n </mtx-multi-year-view>\n <mtx-clock (_userSelection)=\"_userSelected()\"\n (activeDateChange)=\"_onActiveDateChange($event)\"\n (selectedChange)=\"_timeSelected($event)\"\n *ngSwitchDefault\n [dateFilter]=\"dateFilter\"\n [interval]=\"timeInterval\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [selected]=\"_activeDate\"\n [startView]=\"_clockView\"\n [twelvehour]=\"twelvehour\">\n </mtx-clock>\n</div>\n",
912
922
  host: {
913
923
  'class': 'mtx-calendar',
914
- '[attr.aria-label]': 'ariaLabel',
915
924
  'tabindex': '0',
916
925
  '(keydown)': '_handleCalendarBodyKeydown($event)',
917
926
  },
918
- animations: [slideCalendar],
927
+ exportAs: 'mtxCalendar',
928
+ animations: [mtxDatetimepickerAnimations.slideCalendar],
919
929
  encapsulation: ViewEncapsulation.None,
920
930
  changeDetection: ChangeDetectionStrategy.OnPush,
921
- styles: [".mtx-calendar{display:block;outline:none}.mtx-calendar[mode=landscape]{display:flex}.mtx-calendar-header{padding:16px;box-sizing:border-box;border-radius:4px 4px 0 0}[mode=landscape] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] [mode=landscape] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar-header-year,.mtx-calendar-header-date-time{width:100%;white-space:nowrap}.mtx-calendar-header-year{height:32px;line-height:32px}.mtx-calendar-header-year>*{vertical-align:middle}.mtx-calendar-header-date-time{line-height:34px}[mode=landscape] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar-header-year:not(.active),.mtx-calendar-header-date:not(.active),.mtx-calendar-header-hours:not(.active),.mtx-calendar-header-minutes:not(.active),.mtx-calendar-header-ampm:not(.active){cursor:pointer;opacity:.6}.mtx-calendar-header-year.not-clickable,.mtx-calendar-header-date.not-clickable,.mtx-calendar-header-hours.not-clickable,.mtx-calendar-header-minutes.not-clickable,.mtx-calendar-header-ampm.not-clickable{cursor:auto;cursor:initial}.mtx-calendar-header-time{display:inline-block;padding-left:8px}.mtx-calendar-header-time:not(.active){opacity:.6}.mtx-calendar-header-time:not(.active) .mtx-calendar-header-hours,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-minutes,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-ampm{cursor:pointer;opacity:1}[dir=rtl] .mtx-calendar-header-time{padding-right:8px}[mode=landscape] .mtx-calendar-header-time{display:block;padding:0}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;justify-content:space-between;margin:0 calc(33% / 7 - 16px)}.mtx-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mtx-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none}.mtx-calendar-previous-button svg,.mtx-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .mtx-calendar-previous-button svg,[dir=rtl] .mtx-calendar-next-button svg{transform:rotate(180deg)}.mtx-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mtx-calendar-table-header th{text-align:center;padding:8px 0}@media all and (orientation: landscape){.mtx-calendar[mode=auto]{display:flex}.mtx-calendar[mode=auto] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] .mtx-calendar[mode=auto] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar[mode=auto] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar[mode=auto] .mtx-calendar-header-time{display:block;padding:0}}\n"]
931
+ styles: [".mtx-calendar{display:block;outline:none}.mtx-calendar[mode=landscape]{display:flex}.mtx-calendar-header{padding:16px;box-sizing:border-box;border-radius:4px 4px 0 0}[mode=landscape] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] [mode=landscape] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar-header-year,.mtx-calendar-header-date-time{width:100%;white-space:nowrap}.mtx-calendar-header-year{height:32px;line-height:32px}.mtx-calendar-header-year>*{vertical-align:middle}.mtx-calendar-header-date-time{line-height:34px}[mode=landscape] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar-header-year:not(.active),.mtx-calendar-header-date:not(.active),.mtx-calendar-header-hours:not(.active),.mtx-calendar-header-minutes:not(.active),.mtx-calendar-header-ampm:not(.active){cursor:pointer;opacity:.6}.mtx-calendar-header-year.not-clickable,.mtx-calendar-header-date.not-clickable,.mtx-calendar-header-hours.not-clickable,.mtx-calendar-header-minutes.not-clickable,.mtx-calendar-header-ampm.not-clickable{cursor:initial}.mtx-calendar-header-time{display:inline-block;padding-left:8px}.mtx-calendar-header-time:not(.active){opacity:.6}.mtx-calendar-header-time:not(.active) .mtx-calendar-header-hours,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-minutes,.mtx-calendar-header-time:not(.active) .mtx-calendar-header-ampm{cursor:pointer;opacity:1}[dir=rtl] .mtx-calendar-header-time{padding-right:8px}[mode=landscape] .mtx-calendar-header-time{display:block;padding:0}.mtx-calendar-content{width:100%;padding:8px;outline:none;box-sizing:border-box;overflow:hidden}.mtx-calendar-controls{display:flex;justify-content:space-between;margin:0 calc(4.7142857143% - 16px)}.mtx-calendar-controls .mat-icon-button:hover .mat-button-focus-overlay{opacity:.04}.mtx-calendar-period-button{display:inline-block;height:40px;line-height:40px;outline:none;border:0;background:transparent;box-sizing:border-box}.mtx-calendar-previous-button.disabled,.mtx-calendar-next-button.disabled{pointer-events:none}.mtx-calendar-previous-button svg,.mtx-calendar-next-button svg{fill:currentColor;vertical-align:top}[dir=rtl] .mtx-calendar-previous-button svg,[dir=rtl] .mtx-calendar-next-button svg{transform:rotate(180deg)}.mtx-calendar-table{border-spacing:0;border-collapse:collapse;width:100%}.mtx-calendar-table-header th{text-align:center;padding:8px 0}@media all and (orientation: landscape){.mtx-calendar[mode=auto]{display:flex}.mtx-calendar[mode=auto] .mtx-calendar-header{width:150px;min-width:150px;border-radius:4px 0 0 4px}[dir=rtl] .mtx-calendar[mode=auto] .mtx-calendar-header{border-radius:0 4px 4px 0}.mtx-calendar[mode=auto] .mtx-calendar-header-date-time{white-space:normal;word-wrap:break-word}.mtx-calendar[mode=auto] .mtx-calendar-header-time{display:block;padding:0}}\n"]
922
932
  },] }
923
933
  ];
924
934
  /**
@@ -938,22 +948,15 @@ MtxCalendar.ctorParameters = () => [
938
948
  ];
939
949
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
940
950
  MtxCalendar.propDecorators = {
941
- _userSelection: [{ type: Output }],
942
951
  multiYearSelector: [{ type: Input }],
943
952
  twelvehour: [{ type: Input }],
944
953
  startView: [{ type: Input }],
945
954
  timeInterval: [{ type: Input }],
946
955
  dateFilter: [{ type: Input }],
947
- ariaLabel: [{ type: Input }],
948
- ariaNextMonthLabel: [{ type: Input }],
949
- ariaPrevMonthLabel: [{ type: Input }],
950
- ariaNextYearLabel: [{ type: Input }],
951
- ariaPrevYearLabel: [{ type: Input }],
952
- ariaNextMultiYearLabel: [{ type: Input }],
953
- ariaPrevMultiYearLabel: [{ type: Input }],
954
956
  preventSameDateTimeSelection: [{ type: Input }],
955
957
  selectedChange: [{ type: Output }],
956
958
  viewChanged: [{ type: Output }],
959
+ _userSelection: [{ type: Output }],
957
960
  type: [{ type: Input }],
958
961
  startAt: [{ type: Input }],
959
962
  selected: [{ type: Input }],
@@ -973,12 +976,14 @@ class MtxClock {
973
976
  constructor(_element, _adapter) {
974
977
  this._element = _element;
975
978
  this._adapter = _adapter;
976
- this._userSelection = new EventEmitter();
977
979
  this.interval = 1;
978
980
  this.twelvehour = false;
979
981
  /** Emits when the currently selected date changes. */
980
982
  this.selectedChange = new EventEmitter();
983
+ /** Emits when any date is activated. */
981
984
  this.activeDateChange = new EventEmitter();
985
+ /** Emits when any date is selected. */
986
+ this._userSelection = new EventEmitter();
982
987
  /** Hours and Minutes representing the clock view. */
983
988
  this._hours = [];
984
989
  this._minutes = [];
@@ -1035,7 +1040,7 @@ class MtxClock {
1035
1040
  }
1036
1041
  get _hand() {
1037
1042
  let hour = this._adapter.getHour(this.activeDate);
1038
- if (!!this.twelvehour) {
1043
+ if (this.twelvehour) {
1039
1044
  if (hour === 0) {
1040
1045
  hour = 24;
1041
1046
  }
@@ -1068,10 +1073,7 @@ class MtxClock {
1068
1073
  this.activeDate = this._activeDate || this._adapter.today();
1069
1074
  this._init();
1070
1075
  }
1071
- /**
1072
- * TODO: use `fromEvent` of rxjs.
1073
- * Handles mousedown events on the clock body.
1074
- */
1076
+ /** Handles mousedown events on the clock body. */
1075
1077
  _handleMousedown(event) {
1076
1078
  this._timeChanged = false;
1077
1079
  this.setTime(event);
@@ -1205,14 +1207,15 @@ class MtxClock {
1205
1207
  MtxClock.decorators = [
1206
1208
  { type: Component, args: [{
1207
1209
  selector: 'mtx-clock',
1208
- template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div [ngStyle]=\"_hand\" class=\"mtx-clock-hand\"></div>\n <div [class.active]=\"_hourView\" class=\"mtx-clock-hours\">\n <div *ngFor=\"let item of _hours\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedHour == item.value\"\n [style.fontSize]=\"item.fontSize\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\"\n class=\"mtx-clock-cell\">{{ item.displayValue }}</div>\n </div>\n <div [class.active]=\"!_hourView\" class=\"mtx-clock-minutes\">\n <div *ngFor=\"let item of _minutes\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedMinute == item.value\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\"\n class=\"mtx-clock-cell\">{{ item.displayValue }}</div>\n </div>\n</div>\n",
1210
+ template: "<div class=\"mtx-clock-wrapper\">\n <div class=\"mtx-clock-center\"></div>\n <div [ngStyle]=\"_hand\" class=\"mtx-clock-hand\"></div>\n <div [class.active]=\"_hourView\" class=\"mtx-clock-hours\">\n <div *ngFor=\"let item of _hours\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedHour === item.value\"\n [style.fontSize]=\"item.fontSize\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\"\n class=\"mtx-clock-cell\">{{ item.displayValue }}</div>\n </div>\n <div [class.active]=\"!_hourView\" class=\"mtx-clock-minutes\">\n <div *ngFor=\"let item of _minutes\"\n [class.mtx-clock-cell-disabled]=\"!item.enabled\"\n [class.mtx-clock-cell-selected]=\"_selectedMinute === item.value\"\n [style.left]=\"item.left+'%'\"\n [style.top]=\"item.top+'%'\"\n class=\"mtx-clock-cell\">{{ item.displayValue }}</div>\n </div>\n</div>\n",
1209
1211
  host: {
1210
1212
  '[class.mtx-clock]': 'true',
1211
1213
  'role': 'clock',
1212
1214
  '(mousedown)': '_handleMousedown($event)',
1213
1215
  },
1216
+ exportAs: 'mtxClock',
1214
1217
  encapsulation: ViewEncapsulation.None,
1215
- styles: [".mtx-clock{position:relative;display:block;min-width:224px;margin:8px;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%}.mtx-clock-center{position:absolute;top:50%;left:50%;width:2%;height:2%;margin:-1%;border-radius:50%}.mtx-clock-hand{position:absolute;top:0;right:0;bottom:0;left:0;width:1px;margin:0 auto;transform-origin:bottom}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-4px;width:8px;height:8px;border-radius:50%}.mtx-clock-hours,.mtx-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.mtx-clock-hours.active,.mtx-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.mtx-clock-minutes{transform:scale(.8)}.mtx-clock-cell{position:absolute;display:flex;width:14.1666%;height:14.1666%;justify-content:center;box-sizing:border-box;border-radius:50%;align-items:center;cursor:pointer}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none}\n"]
1218
+ styles: [".mtx-clock{position:relative;display:block;min-width:224px;margin:8px;box-sizing:border-box;-webkit-user-select:none;user-select:none}.mtx-clock-wrapper{position:relative;width:100%;height:0;padding-top:100%;border-radius:50%}.mtx-clock-center{position:absolute;top:50%;left:50%;width:2%;height:2%;margin:-1%;border-radius:50%}.mtx-clock-hand{position:absolute;top:0;right:0;bottom:0;left:0;width:1px;margin:0 auto;transform-origin:bottom}.mtx-clock-hand:before{content:\"\";position:absolute;top:-4px;left:-4px;width:8px;height:8px;border-radius:50%}.mtx-clock-hours,.mtx-clock-minutes{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0;visibility:hidden;transition:.35s;transform:scale(1.2)}.mtx-clock-hours.active,.mtx-clock-minutes.active{opacity:1;visibility:visible;transform:scale(1)}.mtx-clock-minutes{transform:scale(.8)}.mtx-clock-cell{position:absolute;display:flex;width:14.1666%;height:14.1666%;justify-content:center;box-sizing:border-box;border-radius:50%;align-items:center;cursor:pointer}.mtx-clock-cell.mtx-clock-cell-disabled{pointer-events:none}\n"]
1216
1219
  },] }
1217
1220
  ];
1218
1221
  /**
@@ -1228,12 +1231,12 @@ MtxClock.ctorParameters = () => [
1228
1231
  ];
1229
1232
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
1230
1233
  MtxClock.propDecorators = {
1231
- _userSelection: [{ type: Output }],
1232
1234
  dateFilter: [{ type: Input }],
1233
1235
  interval: [{ type: Input }],
1234
1236
  twelvehour: [{ type: Input }],
1235
1237
  selectedChange: [{ type: Output }],
1236
1238
  activeDateChange: [{ type: Output }],
1239
+ _userSelection: [{ type: Output }],
1237
1240
  activeDate: [{ type: Input }],
1238
1241
  selected: [{ type: Input }],
1239
1242
  minDate: [{ type: Input }],
@@ -1243,6 +1246,23 @@ MtxClock.propDecorators = {
1243
1246
 
1244
1247
  /** Used to generate a unique ID for each datetimepicker instance. */
1245
1248
  let datetimepickerUid = 0;
1249
+ /** Injection token that determines the scroll handling while the calendar is open. */
1250
+ const MTX_DATETIMEPICKER_SCROLL_STRATEGY = new InjectionToken('mtx-datetimepicker-scroll-strategy');
1251
+ function MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY(overlay) {
1252
+ return () => overlay.scrollStrategies.reposition();
1253
+ }
1254
+ const MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER = {
1255
+ provide: MTX_DATETIMEPICKER_SCROLL_STRATEGY,
1256
+ deps: [Overlay],
1257
+ useFactory: MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY,
1258
+ };
1259
+ // Boilerplate for applying mixins to MtxDatetimepickerContent.
1260
+ /** @docs-private */
1261
+ const _MtxDatetimepickerContentBase = mixinColor(class {
1262
+ constructor(_elementRef) {
1263
+ this._elementRef = _elementRef;
1264
+ }
1265
+ });
1246
1266
  /**
1247
1267
  * Component used as the content for the datetimepicker dialog and popup. We use this instead of
1248
1268
  * using MtxCalendar directly as the content so we can control the initial focus. This also gives us
@@ -1250,30 +1270,60 @@ let datetimepickerUid = 0;
1250
1270
  * future. (e.g. confirmation buttons).
1251
1271
  * @docs-private
1252
1272
  */
1253
- class MtxDatetimepickerContent {
1273
+ class MtxDatetimepickerContent extends _MtxDatetimepickerContentBase {
1274
+ constructor(elementRef, _changeDetectorRef) {
1275
+ super(elementRef);
1276
+ this._changeDetectorRef = _changeDetectorRef;
1277
+ /** Emits when an animation has finished. */
1278
+ this._animationDone = new Subject();
1279
+ }
1280
+ ngOnInit() {
1281
+ this._animationState = this.datetimepicker.touchUi ? 'enter-dialog' : 'enter-dropdown';
1282
+ }
1254
1283
  ngAfterContentInit() {
1255
1284
  this._calendar._focusActiveCell();
1256
1285
  }
1257
- onSelectionChange(date) {
1258
- this.datetimepicker._select(date);
1259
- this.datetimepicker.close();
1286
+ _startExitAnimation() {
1287
+ this._animationState = 'void';
1288
+ this._changeDetectorRef.markForCheck();
1289
+ }
1290
+ ngOnDestroy() {
1291
+ this._animationDone.complete();
1260
1292
  }
1261
1293
  }
1262
1294
  /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1263
1295
  MtxDatetimepickerContent.decorators = [
1264
1296
  { type: Component, args: [{
1265
1297
  selector: 'mtx-datetimepicker-content',
1266
- template: "<div cdkTrapFocus\n class=\"mtx-datetimepicker-content-container\"\n [attr.mode]=\"datetimepicker.mode\">\n <mtx-calendar (_userSelection)=\"datetimepicker.close()\"\n (selectedChange)=\"onSelectionChange($event)\"\n (viewChanged)=\"datetimepicker._viewChanged($event)\"\n [ariaNextMonthLabel]=\"datetimepicker.ariaNextMonthLabel\"\n [ariaNextYearLabel]=\"datetimepicker.ariaNextYearLabel\"\n [ariaPrevMonthLabel]=\"datetimepicker.ariaPrevMonthLabel\"\n [ariaPrevYearLabel]=\"datetimepicker.ariaPrevYearLabel\"\n [preventSameDateTimeSelection]=\"datetimepicker.preventSameDateTimeSelection\"\n [attr.mode]=\"datetimepicker.mode\"\n [id]=\"datetimepicker.id\"\n [maxDate]=\"datetimepicker._maxDate\"\n [minDate]=\"datetimepicker._minDate\"\n [dateFilter]=\"datetimepicker._dateFilter\"\n [selected]=\"datetimepicker._selected\"\n [multiYearSelector]=\"datetimepicker.multiYearSelector\"\n [startAt]=\"datetimepicker.startAt\"\n [startView]=\"datetimepicker.startView\"\n [timeInterval]=\"datetimepicker.timeInterval\"\n [twelvehour]=\"datetimepicker.twelvehour\"\n [type]=\"datetimepicker.type\">\n </mtx-calendar>\n</div>\n",
1298
+ template: "<div cdkTrapFocus\n class=\"mtx-datetimepicker-content-container\"\n [attr.mode]=\"datetimepicker.mode\">\n <mtx-calendar [id]=\"datetimepicker.id\"\n [ngClass]=\"datetimepicker.panelClass\"\n [attr.mode]=\"datetimepicker.mode\"\n [type]=\"datetimepicker.type\"\n [startAt]=\"datetimepicker.startAt\"\n [startView]=\"datetimepicker.startView\"\n [maxDate]=\"datetimepicker._maxDate\"\n [minDate]=\"datetimepicker._minDate\"\n [dateFilter]=\"datetimepicker._dateFilter\"\n [multiYearSelector]=\"datetimepicker.multiYearSelector\"\n [preventSameDateTimeSelection]=\"datetimepicker.preventSameDateTimeSelection\"\n [timeInterval]=\"datetimepicker.timeInterval\"\n [twelvehour]=\"datetimepicker.twelvehour\"\n [selected]=\"datetimepicker._selected\"\n [@fadeInCalendar]=\"'enter'\"\n (selectedChange)=\"datetimepicker._select($event)\"\n (viewChanged)=\"datetimepicker._viewChanged($event)\"\n (_userSelection)=\"datetimepicker.close()\">\n </mtx-calendar>\n</div>\n",
1267
1299
  host: {
1268
1300
  'class': 'mtx-datetimepicker-content',
1269
1301
  '[class.mtx-datetimepicker-content-touch]': 'datetimepicker?.touchUi',
1270
1302
  '[attr.mode]': 'datetimepicker.mode',
1303
+ '[@transformPanel]': '_animationState',
1304
+ '(@transformPanel.done)': '_animationDone.next()',
1271
1305
  },
1306
+ animations: [
1307
+ mtxDatetimepickerAnimations.transformPanel,
1308
+ mtxDatetimepickerAnimations.fadeInCalendar,
1309
+ ],
1272
1310
  encapsulation: ViewEncapsulation.None,
1273
1311
  changeDetection: ChangeDetectionStrategy.OnPush,
1312
+ inputs: ['color'],
1274
1313
  styles: [".mtx-datetimepicker-content{display:block;border-radius:4px}.mtx-datetimepicker-content-container{display:flex;flex-direction:column;justify-content:space-between}.mtx-datetimepicker-content .mtx-calendar{width:296px;height:404px}.mtx-datetimepicker-content .mtx-calendar[mode=landscape]{width:446px;height:328px}@media all and (orientation: landscape){.mtx-datetimepicker-content .mtx-calendar[mode=auto]{width:446px;height:328px}}.mtx-datetimepicker-content-touch{display:block;max-height:80vh;position:relative;overflow:visible}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container{min-height:300px;max-height:850px;min-width:250px;max-width:750px}.mtx-datetimepicker-content-touch .mtx-calendar{width:100%;height:auto}@media all and (orientation: landscape){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:120vh;height:80vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:64vh;height:90vh}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}}@media all and (orientation: portrait){.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto],.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait]{width:80vw;height:120vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=auto] .mtx-calendar,.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=portrait] .mtx-calendar{width:100%;height:auto}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape]{width:90vw;height:64vw}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container[mode=landscape] .mtx-calendar{width:auto;height:100%}.mtx-datetimepicker-content-touch .mtx-datetimepicker-content-container-with-actions{height:135vw}}\n"]
1275
1314
  },] }
1276
1315
  ];
1316
+ /**
1317
+ * @type {function(): !Array<(null|{
1318
+ * type: ?,
1319
+ * decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
1320
+ * })>}
1321
+ * @nocollapse
1322
+ */
1323
+ MtxDatetimepickerContent.ctorParameters = () => [
1324
+ { type: ElementRef },
1325
+ { type: ChangeDetectorRef }
1326
+ ];
1277
1327
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
1278
1328
  MtxDatetimepickerContent.propDecorators = {
1279
1329
  _calendar: [{ type: ViewChild, args: [MtxCalendar, { static: true },] }]
@@ -1292,10 +1342,6 @@ class MtxDatetimepicker {
1292
1342
  this.startView = 'month';
1293
1343
  this.mode = 'auto';
1294
1344
  this.timeInterval = 1;
1295
- this.ariaNextMonthLabel = 'Next month';
1296
- this.ariaPrevMonthLabel = 'Previous month';
1297
- this.ariaNextYearLabel = 'Next year';
1298
- this.ariaPrevYearLabel = 'Previous year';
1299
1345
  /** Prevent user to select same date time */
1300
1346
  this.preventSameDateTimeSelection = false;
1301
1347
  /**
@@ -1309,8 +1355,7 @@ class MtxDatetimepicker {
1309
1355
  this.closedStream = new EventEmitter();
1310
1356
  /** Emits when the view has been changed. */
1311
1357
  this.viewChanged = new EventEmitter();
1312
- /** Whether the calendar is open. */
1313
- this.opened = false;
1358
+ this._opened = false;
1314
1359
  /** The id for the datetimepicker calendar. */
1315
1360
  this.id = `mtx-datetimepicker-${datetimepickerUid++}`;
1316
1361
  /** Emits when the datetimepicker is disabled. */
@@ -1323,6 +1368,11 @@ class MtxDatetimepicker {
1323
1368
  this._inputStateChanges = Subscription.EMPTY;
1324
1369
  this._type = 'date';
1325
1370
  this._touchUi = false;
1371
+ /** Preferred position of the datetimepicker in the X axis. */
1372
+ this.xPosition = 'start';
1373
+ /** Preferred position of the datetimepicker in the Y axis. */
1374
+ this.yPosition = 'below';
1375
+ this._restoreFocus = true;
1326
1376
  if (!this._dateAdapter) {
1327
1377
  throw createMissingDateImplError('DateAdapter');
1328
1378
  }
@@ -1341,21 +1391,40 @@ class MtxDatetimepicker {
1341
1391
  set twelvehour(value) {
1342
1392
  this._twelvehour = coerceBooleanProperty(value);
1343
1393
  }
1394
+ /**
1395
+ * Classes to be passed to the date picker panel.
1396
+ * Supports string and string array values, similar to `ngClass`.
1397
+ */
1398
+ get panelClass() {
1399
+ return this._panelClass;
1400
+ }
1401
+ set panelClass(value) {
1402
+ this._panelClass = coerceStringArray(value);
1403
+ }
1404
+ /** Whether the calendar is open. */
1405
+ get opened() {
1406
+ return this._opened;
1407
+ }
1408
+ set opened(value) {
1409
+ coerceBooleanProperty(value) ? this.open() : this.close();
1410
+ }
1411
+ /** Color palette to use on the datetimepicker's calendar. */
1412
+ get color() {
1413
+ return (this._color ||
1414
+ (this.datetimepickerInput ? this.datetimepickerInput.getThemePalette() : undefined));
1415
+ }
1416
+ set color(value) {
1417
+ this._color = value;
1418
+ }
1344
1419
  /** The date to open the calendar to initially. */
1345
1420
  get startAt() {
1346
1421
  // If an explicit startAt is set we start there, otherwise we start at whatever the currently
1347
1422
  // selected value is.
1348
- return this._startAt || (this._datetimepickerInput ? this._datetimepickerInput.value : null);
1423
+ return this._startAt || (this.datetimepickerInput ? this.datetimepickerInput.value : null);
1349
1424
  }
1350
1425
  set startAt(date) {
1351
1426
  this._startAt = this._dateAdapter.getValidDateOrNull(date);
1352
1427
  }
1353
- get openOnFocus() {
1354
- return this._openOnFocus;
1355
- }
1356
- set openOnFocus(value) {
1357
- this._openOnFocus = coerceBooleanProperty(value);
1358
- }
1359
1428
  get type() {
1360
1429
  return this._type;
1361
1430
  }
@@ -1374,8 +1443,8 @@ class MtxDatetimepicker {
1374
1443
  }
1375
1444
  /** Whether the datetimepicker pop-up should be disabled. */
1376
1445
  get disabled() {
1377
- return this._disabled === undefined && this._datetimepickerInput
1378
- ? this._datetimepickerInput.disabled
1446
+ return this._disabled === undefined && this.datetimepickerInput
1447
+ ? this.datetimepickerInput.disabled
1379
1448
  : !!this._disabled;
1380
1449
  }
1381
1450
  set disabled(value) {
@@ -1385,6 +1454,17 @@ class MtxDatetimepicker {
1385
1454
  this._disabledChange.next(newValue);
1386
1455
  }
1387
1456
  }
1457
+ /**
1458
+ * Whether to restore focus to the previously-focused element when the panel is closed.
1459
+ * Note that automatic focus restoration is an accessibility feature and it is recommended that
1460
+ * you provide your own equivalent, if you decide to turn it off.
1461
+ */
1462
+ get restoreFocus() {
1463
+ return this._restoreFocus;
1464
+ }
1465
+ set restoreFocus(value) {
1466
+ this._restoreFocus = coerceBooleanProperty(value);
1467
+ }
1388
1468
  /** The currently selected date. */
1389
1469
  get _selected() {
1390
1470
  return this._validSelected;
@@ -1394,14 +1474,14 @@ class MtxDatetimepicker {
1394
1474
  }
1395
1475
  /** The minimum selectable date. */
1396
1476
  get _minDate() {
1397
- return this._datetimepickerInput && this._datetimepickerInput.min;
1477
+ return this.datetimepickerInput && this.datetimepickerInput.min;
1398
1478
  }
1399
1479
  /** The maximum selectable date. */
1400
1480
  get _maxDate() {
1401
- return this._datetimepickerInput && this._datetimepickerInput.max;
1481
+ return this.datetimepickerInput && this.datetimepickerInput.max;
1402
1482
  }
1403
1483
  get _dateFilter() {
1404
- return this._datetimepickerInput && this._datetimepickerInput._dateFilter;
1484
+ return this.datetimepickerInput && this.datetimepickerInput._dateFilter;
1405
1485
  }
1406
1486
  _viewChanged(type) {
1407
1487
  this.viewChanged.emit(type);
@@ -1412,10 +1492,7 @@ class MtxDatetimepicker {
1412
1492
  this._inputStateChanges.unsubscribe();
1413
1493
  this._disabledChange.complete();
1414
1494
  }
1415
- /**
1416
- * TODO: use model
1417
- * Selects the given date
1418
- */
1495
+ /** Selects the given date */
1419
1496
  _select(date) {
1420
1497
  const oldValue = this._selected;
1421
1498
  this._selected = date;
@@ -1428,28 +1505,28 @@ class MtxDatetimepicker {
1428
1505
  * @param input The datetimepicker input to register with this datetimepicker.
1429
1506
  */
1430
1507
  _registerInput(input) {
1431
- if (this._datetimepickerInput) {
1508
+ if (this.datetimepickerInput) {
1432
1509
  throw Error('A MtxDatetimepicker can only be associated with a single input.');
1433
1510
  }
1434
- this._datetimepickerInput = input;
1435
- this._inputStateChanges = this._datetimepickerInput._valueChange.subscribe((value) => (this._selected = value));
1511
+ this.datetimepickerInput = input;
1512
+ this._inputStateChanges = this.datetimepickerInput._valueChange.subscribe((value) => (this._selected = value));
1436
1513
  }
1437
1514
  /** Open the calendar. */
1438
1515
  open() {
1439
- if (this.opened || this.disabled) {
1516
+ if (this._opened || this.disabled) {
1440
1517
  return;
1441
1518
  }
1442
- if (!this._datetimepickerInput) {
1519
+ if (!this.datetimepickerInput) {
1443
1520
  throw Error('Attempted to open an MtxDatetimepicker with no associated input.');
1444
1521
  }
1445
1522
  this._focusedElementBeforeOpen = _getFocusedElementPierceShadowDom();
1446
1523
  this._openOverlay();
1447
- this.opened = true;
1524
+ this._opened = true;
1448
1525
  this.openedStream.emit();
1449
1526
  }
1450
1527
  /** Close the calendar. */
1451
1528
  close() {
1452
- if (!this.opened) {
1529
+ if (!this._opened) {
1453
1530
  return;
1454
1531
  }
1455
1532
  if (this._componentRef) {
@@ -1458,13 +1535,14 @@ class MtxDatetimepicker {
1458
1535
  const completeClose = () => {
1459
1536
  // The `_opened` could've been reset already if
1460
1537
  // we got two events in quick succession.
1461
- if (this.opened) {
1462
- this.opened = false;
1538
+ if (this._opened) {
1539
+ this._opened = false;
1463
1540
  this.closedStream.emit();
1464
1541
  this._focusedElementBeforeOpen = null;
1465
1542
  }
1466
1543
  };
1467
- if (this._focusedElementBeforeOpen &&
1544
+ if (this._restoreFocus &&
1545
+ this._focusedElementBeforeOpen &&
1468
1546
  typeof this._focusedElementBeforeOpen.focus === 'function') {
1469
1547
  // Because IE moves focus asynchronously, we can't count on it being restored before we've
1470
1548
  // marked the datetimepicker as closed. If the event fires out of sequence and the element
@@ -1479,18 +1557,18 @@ class MtxDatetimepicker {
1479
1557
  }
1480
1558
  }
1481
1559
  /**
1482
- * TODO: add datetimepicker color
1483
1560
  * Forwards relevant values from the datetimepicker to the
1484
1561
  * datetimepicker content inside the overlay.
1485
1562
  */
1486
1563
  _forwardContentValues(instance) {
1487
1564
  instance.datetimepicker = this;
1565
+ instance.color = this.color;
1488
1566
  }
1489
1567
  /** Opens the overlay with the calendar. */
1490
1568
  _openOverlay() {
1491
1569
  this._destroyOverlay();
1492
1570
  const isDialog = this.touchUi;
1493
- const labelId = this._datetimepickerInput.getOverlayLabelId();
1571
+ const labelId = this.datetimepickerInput.getOverlayLabelId();
1494
1572
  const portal = new ComponentPortal(MtxDatetimepickerContent, this._viewContainerRef);
1495
1573
  const overlayRef = (this._overlayRef = this._overlay.create(new OverlayConfig({
1496
1574
  positionStrategy: isDialog ? this._getDialogStrategy() : this._getDropdownStrategy(),
@@ -1539,7 +1617,7 @@ class MtxDatetimepicker {
1539
1617
  _getDropdownStrategy() {
1540
1618
  const strategy = this._overlay
1541
1619
  .position()
1542
- .flexibleConnectedTo(this._datetimepickerInput.getConnectedOverlayOrigin())
1620
+ .flexibleConnectedTo(this.datetimepickerInput.getConnectedOverlayOrigin())
1543
1621
  .withTransformOriginOn('.mtx-datetimepicker-content')
1544
1622
  .withFlexibleDimensions(false)
1545
1623
  .withViewportMargin(8)
@@ -1547,34 +1625,37 @@ class MtxDatetimepicker {
1547
1625
  return this._setConnectedPositions(strategy);
1548
1626
  }
1549
1627
  /**
1550
- * TODO: `xPosition` and `yPosition`
1551
1628
  * Sets the positions of the datetimepicker in dropdown mode based on the current configuration.
1552
1629
  */
1553
1630
  _setConnectedPositions(strategy) {
1631
+ const primaryX = this.xPosition === 'end' ? 'end' : 'start';
1632
+ const secondaryX = primaryX === 'start' ? 'end' : 'start';
1633
+ const primaryY = this.yPosition === 'above' ? 'bottom' : 'top';
1634
+ const secondaryY = primaryY === 'top' ? 'bottom' : 'top';
1554
1635
  return strategy.withPositions([
1555
1636
  {
1556
- originX: 'start',
1557
- originY: 'bottom',
1558
- overlayX: 'start',
1559
- overlayY: 'top',
1637
+ originX: primaryX,
1638
+ originY: secondaryY,
1639
+ overlayX: primaryX,
1640
+ overlayY: primaryY,
1560
1641
  },
1561
1642
  {
1562
- originX: 'start',
1563
- originY: 'top',
1564
- overlayX: 'start',
1565
- overlayY: 'bottom',
1643
+ originX: primaryX,
1644
+ originY: primaryY,
1645
+ overlayX: primaryX,
1646
+ overlayY: secondaryY,
1566
1647
  },
1567
1648
  {
1568
- originX: 'end',
1569
- originY: 'bottom',
1570
- overlayX: 'end',
1571
- overlayY: 'top',
1649
+ originX: secondaryX,
1650
+ originY: secondaryY,
1651
+ overlayX: secondaryX,
1652
+ overlayY: primaryY,
1572
1653
  },
1573
1654
  {
1574
- originX: 'end',
1575
- originY: 'top',
1576
- overlayX: 'end',
1577
- overlayY: 'bottom',
1655
+ originX: secondaryX,
1656
+ originY: primaryY,
1657
+ overlayX: secondaryX,
1658
+ overlayY: secondaryY,
1578
1659
  },
1579
1660
  ]);
1580
1661
  }
@@ -1583,7 +1664,7 @@ class MtxDatetimepicker {
1583
1664
  return merge(overlayRef.backdropClick(), overlayRef.detachments(), overlayRef.keydownEvents().pipe(filter(event => {
1584
1665
  // Closing on alt + up is only valid when there's an input associated with the datetimepicker.
1585
1666
  return ((event.keyCode === ESCAPE && !hasModifierKey(event)) ||
1586
- (this._datetimepickerInput &&
1667
+ (this.datetimepickerInput &&
1587
1668
  hasModifierKey(event, 'altKey') &&
1588
1669
  event.keyCode === UP_ARROW));
1589
1670
  })));
@@ -1611,7 +1692,7 @@ MtxDatetimepicker.ctorParameters = () => [
1611
1692
  { type: Overlay },
1612
1693
  { type: NgZone },
1613
1694
  { type: ViewContainerRef },
1614
- { type: undefined, decorators: [{ type: Inject, args: [MAT_DATEPICKER_SCROLL_STRATEGY,] }] },
1695
+ { type: undefined, decorators: [{ type: Inject, args: [MTX_DATETIMEPICKER_SCROLL_STRATEGY,] }] },
1615
1696
  { type: DatetimeAdapter, decorators: [{ type: Optional }] },
1616
1697
  { type: Directionality, decorators: [{ type: Optional }] }
1617
1698
  ];
@@ -1622,21 +1703,21 @@ MtxDatetimepicker.propDecorators = {
1622
1703
  startView: [{ type: Input }],
1623
1704
  mode: [{ type: Input }],
1624
1705
  timeInterval: [{ type: Input }],
1625
- ariaNextMonthLabel: [{ type: Input }],
1626
- ariaPrevMonthLabel: [{ type: Input }],
1627
- ariaNextYearLabel: [{ type: Input }],
1628
- ariaPrevYearLabel: [{ type: Input }],
1629
1706
  preventSameDateTimeSelection: [{ type: Input }],
1630
1707
  selectedChanged: [{ type: Output }],
1631
- panelClass: [{ type: Input }],
1632
1708
  openedStream: [{ type: Output, args: ['opened',] }],
1633
1709
  closedStream: [{ type: Output, args: ['closed',] }],
1634
1710
  viewChanged: [{ type: Output }],
1711
+ panelClass: [{ type: Input }],
1712
+ opened: [{ type: Input }],
1713
+ color: [{ type: Input }],
1635
1714
  startAt: [{ type: Input }],
1636
- openOnFocus: [{ type: Input }],
1637
1715
  type: [{ type: Input }],
1638
1716
  touchUi: [{ type: Input }],
1639
- disabled: [{ type: Input }]
1717
+ disabled: [{ type: Input }],
1718
+ xPosition: [{ type: Input }],
1719
+ yPosition: [{ type: Input }],
1720
+ restoreFocus: [{ type: Input }]
1640
1721
  };
1641
1722
 
1642
1723
  const MAT_DATETIMEPICKER_VALUE_ACCESSOR = {
@@ -1731,7 +1812,7 @@ class MtxDatetimepickerInput {
1731
1812
  }
1732
1813
  // Update the displayed date when the locale changes.
1733
1814
  this._localeSubscription = _dateAdapter.localeChanges.subscribe(() => {
1734
- this.value = this.value;
1815
+ this.value = this._dateAdapter.deserialize(this.value);
1735
1816
  });
1736
1817
  }
1737
1818
  /** The datetimepicker that this input is associated with. */
@@ -1911,6 +1992,10 @@ class MtxDatetimepickerInput {
1911
1992
  ? this._dateAdapter.format(value, this.getDisplayFormat())
1912
1993
  : '';
1913
1994
  }
1995
+ /** Returns the palette used by the input's form field, if any. */
1996
+ getThemePalette() {
1997
+ return this._formField ? this._formField.color : undefined;
1998
+ }
1914
1999
  }
1915
2000
  /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
1916
2001
  MtxDatetimepickerInput.decorators = [
@@ -1960,6 +2045,15 @@ MtxDatetimepickerInput.propDecorators = {
1960
2045
  disabled: [{ type: Input }]
1961
2046
  };
1962
2047
 
2048
+ /** Can be used to override the icon of a `mtxDatetimepickerToggle`. */
2049
+ class MtxDatetimepickerToggleIcon {
2050
+ }
2051
+ /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2052
+ MtxDatetimepickerToggleIcon.decorators = [
2053
+ { type: Directive, args: [{
2054
+ selector: '[mtxDatetimepickerToggleIcon]',
2055
+ },] }
2056
+ ];
1963
2057
  class MtxDatetimepickerToggle {
1964
2058
  constructor(_intl, _changeDetectorRef) {
1965
2059
  this._intl = _intl;
@@ -1994,8 +2088,8 @@ class MtxDatetimepickerToggle {
1994
2088
  const datetimepickerDisabled = this.datetimepicker
1995
2089
  ? this.datetimepicker._disabledChange
1996
2090
  : of();
1997
- const inputDisabled = this.datetimepicker && this.datetimepicker._datetimepickerInput
1998
- ? this.datetimepicker._datetimepickerInput._disabledChange
2091
+ const inputDisabled = this.datetimepicker && this.datetimepicker.datetimepickerInput
2092
+ ? this.datetimepicker.datetimepickerInput._disabledChange
1999
2093
  : of();
2000
2094
  this._stateChanges.unsubscribe();
2001
2095
  this._stateChanges = merge([
@@ -2009,14 +2103,22 @@ class MtxDatetimepickerToggle {
2009
2103
  MtxDatetimepickerToggle.decorators = [
2010
2104
  { type: Component, args: [{
2011
2105
  selector: 'mtx-datetimepicker-toggle',
2012
- template: "<button (click)=\"_open($event)\" [attr.aria-label]=\"_intl.openCalendarLabel\" [disabled]=\"disabled\"\n mat-icon-button type=\"button\">\n <mat-icon [ngSwitch]=\"datetimepicker.type\">\n <svg *ngSwitchCase=\"'time'\" fill=\"currentColor\" focusable=\"false\" height=\"100%\"\n style=\"vertical-align: top;\"\n viewBox=\"0 0 24 24\" width=\"100%\">\n <path d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\">\n </path>\n </svg>\n <svg *ngSwitchCase=\"'datetime'\" fill=\"currentColor\" focusable=\"false\" height=\"100%\"\n style=\"vertical-align: top;\"\n viewBox=\"0 0 24 24\" width=\"100%\">\n <path d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\">\n </path>\n </svg>\n <svg *ngSwitchDefault fill=\"currentColor\" focusable=\"false\" height=\"100%\"\n style=\"vertical-align: top;\"\n viewBox=\"0 0 24 24\" width=\"100%\">\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\" />\n </svg>\n </mat-icon>\n</button>\n",
2106
+ template: "<button #button\n mat-icon-button\n type=\"button\"\n [attr.aria-label]=\"_intl.openCalendarLabel\"\n [attr.tabindex]=\"disabled ? -1 : tabIndex\"\n [disabled]=\"disabled\"\n (click)=\"_open($event)\">\n\n <ng-container *ngIf=\"!_customIcon\" [ngSwitch]=\"datetimepicker.type\">\n <svg *ngSwitchCase=\"'time'\"\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path\n d=\"M12,20A8,8 0 0,0 20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C6.47,22 2,17.5 2,12A10,10 0 0,1 12,2M12.5,7V12.25L17,14.92L16.25,16.15L11,13V7H12.5Z\">\n </path>\n </svg>\n <svg *ngSwitchCase=\"'datetime'\"\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path\n d=\"M15,13H16.5V15.82L18.94,17.23L18.19,18.53L15,16.69V13M19,8H5V19H9.67C9.24,18.09 9,17.07 9,16A7,7 0 0,1 16,9C17.07,9 18.09,9.24 19,9.67V8M5,21C3.89,21 3,20.1 3,19V5C3,3.89 3.89,3 5,3H6V1H8V3H16V1H18V3H19A2,2 0 0,1 21,5V11.1C22.24,12.36 23,14.09 23,16A7,7 0 0,1 16,23C14.09,23 12.36,22.24 11.1,21H5M16,11.15A4.85,4.85 0 0,0 11.15,16C11.15,18.68 13.32,20.85 16,20.85A4.85,4.85 0 0,0 20.85,16C20.85,13.32 18.68,11.15 16,11.15Z\">\n </path>\n </svg>\n <svg *ngSwitchDefault\n class=\"mtx-datetimepicker-toggle-default-icon\"\n viewBox=\"0 0 24 24\"\n width=\"24px\"\n height=\"24px\"\n fill=\"currentColor\"\n focusable=\"false\">\n <path d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path\n d=\"M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z\" />\n </svg>\n </ng-container>\n\n <ng-content select=\"[mtxDatetimepickerToggleIcon]\"></ng-content>\n</button>\n",
2013
2107
  host: {
2014
- class: 'mtx-datetimepicker-toggle',
2108
+ 'class': 'mtx-datetimepicker-toggle',
2109
+ // Always set the tabindex to -1 so that it doesn't overlap with any custom tabindex the
2110
+ // consumer may have provided, while still being able to receive focus.
2111
+ '[attr.tabindex]': 'disabled ? null : -1',
2112
+ '[class.mtx-datetimepicker-toggle-active]': 'datetimepicker && datetimepicker.opened',
2113
+ '[class.mat-accent]': 'datetimepicker && datetimepicker.color === "accent"',
2114
+ '[class.mat-warn]': 'datetimepicker && datetimepicker.color === "warn"',
2115
+ '(focus)': '_button.focus()',
2015
2116
  },
2016
2117
  exportAs: 'mtxDatetimepickerToggle',
2017
2118
  encapsulation: ViewEncapsulation.None,
2018
2119
  preserveWhitespaces: false,
2019
- changeDetection: ChangeDetectionStrategy.OnPush
2120
+ changeDetection: ChangeDetectionStrategy.OnPush,
2121
+ styles: [".mat-form-field-appearance-legacy .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field-appearance-legacy .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{width:1em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mtx-datetimepicker-toggle-default-icon{display:block;width:1.5em;height:1.5em}.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-prefix .mat-icon-button .mtx-datetimepicker-toggle-default-icon,.mat-form-field:not(.mat-form-field-appearance-legacy) .mat-form-field-suffix .mat-icon-button .mtx-datetimepicker-toggle-default-icon{margin:auto}\n"]
2020
2122
  },] }
2021
2123
  ];
2022
2124
  /**
@@ -2033,7 +2135,11 @@ MtxDatetimepickerToggle.ctorParameters = () => [
2033
2135
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
2034
2136
  MtxDatetimepickerToggle.propDecorators = {
2035
2137
  datetimepicker: [{ type: Input, args: ['for',] }],
2036
- disabled: [{ type: Input }]
2138
+ tabIndex: [{ type: Input }],
2139
+ disabled: [{ type: Input }],
2140
+ disableRipple: [{ type: Input }],
2141
+ _customIcon: [{ type: ContentChild, args: [MtxDatetimepickerToggleIcon,] }],
2142
+ _button: [{ type: ViewChild, args: ['button',] }]
2037
2143
  };
2038
2144
 
2039
2145
  const DAYS_PER_WEEK = 7;
@@ -2046,9 +2152,10 @@ class MtxMonthView {
2046
2152
  this._adapter = _adapter;
2047
2153
  this._dateFormats = _dateFormats;
2048
2154
  this.type = 'date';
2049
- this._userSelection = new EventEmitter();
2050
2155
  /** Emits when a new date is selected. */
2051
2156
  this.selectedChange = new EventEmitter();
2157
+ /** Emits when any date is selected. */
2158
+ this._userSelection = new EventEmitter();
2052
2159
  if (!this._adapter) {
2053
2160
  throw createMissingDateImplError('DatetimeAdapter');
2054
2161
  }
@@ -2153,7 +2260,8 @@ MtxMonthView.decorators = [
2153
2260
  { type: Component, args: [{
2154
2261
  selector: 'mtx-month-view',
2155
2262
  template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\">\n <tr>\n <th *ngFor=\"let day of _weekdays\" [attr.aria-label]=\"day.long\">{{day.narrow}}</th>\n </tr>\n </thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [rows]=\"_weeks\"\n [todayValue]=\"_todayDate!\"\n [activeCell]=\"_adapter.getDate(activeDate) - 1\"\n [selectedValue]=\"_selectedDate!\"\n (selectedValueChange)=\"_dateSelected($event)\"></tbody>\n</table>\n",
2156
- animations: [slideCalendar],
2263
+ exportAs: 'mtxMonthView',
2264
+ animations: [mtxDatetimepickerAnimations.slideCalendar],
2157
2265
  encapsulation: ViewEncapsulation.None,
2158
2266
  changeDetection: ChangeDetectionStrategy.OnPush
2159
2267
  },] }
@@ -2172,9 +2280,9 @@ MtxMonthView.ctorParameters = () => [
2172
2280
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
2173
2281
  MtxMonthView.propDecorators = {
2174
2282
  type: [{ type: Input }],
2175
- _userSelection: [{ type: Output }],
2176
2283
  dateFilter: [{ type: Input }],
2177
2284
  selectedChange: [{ type: Output }],
2285
+ _userSelection: [{ type: Output }],
2178
2286
  activeDate: [{ type: Input }],
2179
2287
  selected: [{ type: Input }]
2180
2288
  };
@@ -2187,10 +2295,11 @@ class MtxYearView {
2187
2295
  constructor(_adapter, _dateFormats) {
2188
2296
  this._adapter = _adapter;
2189
2297
  this._dateFormats = _dateFormats;
2190
- this._userSelection = new EventEmitter();
2191
2298
  this.type = 'date';
2192
2299
  /** Emits when a new month is selected. */
2193
2300
  this.selectedChange = new EventEmitter();
2301
+ /** Emits when any date is selected. */
2302
+ this._userSelection = new EventEmitter();
2194
2303
  if (!this._adapter) {
2195
2304
  throw createMissingDateImplError('DatetimeAdapter');
2196
2305
  }
@@ -2287,7 +2396,8 @@ MtxYearView.decorators = [
2287
2396
  { type: Component, args: [{
2288
2397
  selector: 'mtx-year-view',
2289
2398
  template: "<table class=\"mtx-calendar-table\" role=\"grid\">\n <thead class=\"mtx-calendar-table-header\"></thead>\n <tbody mtx-calendar-body\n (@slideCalendar.done)=\"_calendarStateDone()\"\n [@slideCalendar]=\"_calendarState\"\n [label]=\"_yearLabel\"\n [rows]=\"_months\"\n [todayValue]=\"_todayMonth!\"\n [labelMinRequiredCells]=\"2\"\n [numCols]=\"4\"\n [activeCell]=\"_adapter.getMonth(activeDate)\"\n [selectedValue]=\"_selectedMonth!\"\n (selectedValueChange)=\"_monthSelected($event)\"\n [allowDisabledSelection]=\"true\"></tbody>\n</table>\n",
2290
- animations: [slideCalendar],
2399
+ exportAs: 'mtxYearView',
2400
+ animations: [mtxDatetimepickerAnimations.slideCalendar],
2291
2401
  encapsulation: ViewEncapsulation.None,
2292
2402
  changeDetection: ChangeDetectionStrategy.OnPush
2293
2403
  },] }
@@ -2305,10 +2415,10 @@ MtxYearView.ctorParameters = () => [
2305
2415
  ];
2306
2416
  /** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
2307
2417
  MtxYearView.propDecorators = {
2308
- _userSelection: [{ type: Output }],
2309
2418
  type: [{ type: Input }],
2310
2419
  dateFilter: [{ type: Input }],
2311
2420
  selectedChange: [{ type: Output }],
2421
+ _userSelection: [{ type: Output }],
2312
2422
  activeDate: [{ type: Input }],
2313
2423
  selected: [{ type: Input }]
2314
2424
  };
@@ -2318,14 +2428,14 @@ class MtxDatetimepickerModule {
2318
2428
  /** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
2319
2429
  MtxDatetimepickerModule.decorators = [
2320
2430
  { type: NgModule, args: [{
2321
- imports: [CommonModule, MatButtonModule, MatIconModule, OverlayModule, A11yModule],
2322
- entryComponents: [MtxDatetimepickerContent],
2431
+ imports: [CommonModule, MatButtonModule, OverlayModule, A11yModule, PortalModule],
2323
2432
  declarations: [
2324
2433
  MtxCalendar,
2325
2434
  MtxCalendarBody,
2326
2435
  MtxClock,
2327
2436
  MtxDatetimepicker,
2328
2437
  MtxDatetimepickerToggle,
2438
+ MtxDatetimepickerToggleIcon,
2329
2439
  MtxDatetimepickerInput,
2330
2440
  MtxDatetimepickerContent,
2331
2441
  MtxMonthView,
@@ -2338,12 +2448,15 @@ MtxDatetimepickerModule.decorators = [
2338
2448
  MtxClock,
2339
2449
  MtxDatetimepicker,
2340
2450
  MtxDatetimepickerToggle,
2451
+ MtxDatetimepickerToggleIcon,
2341
2452
  MtxDatetimepickerInput,
2342
2453
  MtxDatetimepickerContent,
2343
2454
  MtxMonthView,
2344
2455
  MtxYearView,
2345
2456
  MtxMultiYearView,
2346
2457
  ],
2458
+ providers: [MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER],
2459
+ entryComponents: [MtxDatetimepickerContent],
2347
2460
  },] }
2348
2461
  ];
2349
2462
 
@@ -2351,5 +2464,5 @@ MtxDatetimepickerModule.decorators = [
2351
2464
  * Generated bundle index. Do not edit.
2352
2465
  */
2353
2466
 
2354
- export { CLOCK_INNER_RADIUS, CLOCK_OUTER_RADIUS, CLOCK_RADIUS, CLOCK_TICK_RADIUS, MAT_DATETIMEPICKER_VALIDATORS, MAT_DATETIMEPICKER_VALUE_ACCESSOR, MtxCalendar, MtxCalendarBody, MtxCalendarCell, MtxClock, MtxDatetimepicker, MtxDatetimepickerContent, MtxDatetimepickerFilterType, MtxDatetimepickerInput, MtxDatetimepickerInputEvent, MtxDatetimepickerModule, MtxDatetimepickerToggle, MtxMonthView, MtxYearView, slideCalendar as ɵa, MtxMultiYearView as ɵb };
2467
+ export { CLOCK_INNER_RADIUS, CLOCK_OUTER_RADIUS, CLOCK_RADIUS, CLOCK_TICK_RADIUS, MAT_DATETIMEPICKER_VALIDATORS, MAT_DATETIMEPICKER_VALUE_ACCESSOR, MTX_DATETIMEPICKER_SCROLL_STRATEGY, MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY, MTX_DATETIMEPICKER_SCROLL_STRATEGY_FACTORY_PROVIDER, MtxCalendar, MtxCalendarBody, MtxCalendarCell, MtxClock, MtxDatetimepicker, MtxDatetimepickerContent, MtxDatetimepickerFilterType, MtxDatetimepickerInput, MtxDatetimepickerInputEvent, MtxDatetimepickerModule, MtxDatetimepickerToggle, MtxDatetimepickerToggleIcon, MtxMonthView, MtxMultiYearView, MtxYearView, getActiveOffset, isSameMultiYearView, mtxDatetimepickerAnimations, yearsPerPage, yearsPerRow };
2355
2468
  //# sourceMappingURL=mtxDatetimepicker.js.map