nxt-pick-datetime 10.0.0 → 13.0.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 (124) hide show
  1. package/{esm2015/lib/class/date-time-adapter.class.js → esm2020/lib/class/date-time-adapter.class.mjs} +0 -0
  2. package/{esm2015/lib/class/date-time-format.class.js → esm2020/lib/class/date-time-format.class.mjs} +1 -1
  3. package/esm2020/lib/class/date-time.class.mjs +161 -0
  4. package/{esm2015/lib/class/dialog-config.class.js → esm2020/lib/class/dialog-config.class.mjs} +0 -0
  5. package/esm2020/lib/class/dialog-ref.class.mjs +121 -0
  6. package/esm2020/lib/date-time/calendar/calendar.component.mjs +345 -0
  7. package/esm2020/lib/date-time/calendar-body/calendar-body.component.mjs +145 -0
  8. package/esm2020/lib/date-time/calendar-month-view/calendar-month-view.component.mjs +438 -0
  9. package/esm2020/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.mjs +359 -0
  10. package/esm2020/lib/date-time/calendar-year-view/calendar-year-view.component.mjs +369 -0
  11. package/esm2020/lib/date-time/date-time-inline/date-time-inline.component.mjs +264 -0
  12. package/esm2020/lib/date-time/date-time-picker/date-time-picker.component.mjs +529 -0
  13. package/{esm2015/lib/date-time/date-time-picker-container/date-time-picker-container.animations.js → esm2020/lib/date-time/date-time-picker-container/date-time-picker-container.animations.mjs} +1 -1
  14. package/esm2020/lib/date-time/date-time-picker-container/date-time-picker-container.component.mjs +390 -0
  15. package/esm2020/lib/date-time/date-time-picker-input.directive.mjs +624 -0
  16. package/esm2020/lib/date-time/date-time-picker-intl.service.mjs +61 -0
  17. package/esm2020/lib/date-time/date-time-picker-trigger.directive.mjs +68 -0
  18. package/esm2020/lib/date-time/date-time.module.mjs +88 -0
  19. package/esm2020/lib/date-time/number-fixed-len.pipe.mjs +25 -0
  20. package/esm2020/lib/date-time/timer/timer.component.mjs +292 -0
  21. package/esm2020/lib/date-time/timer-box/timer-box.component.mjs +88 -0
  22. package/esm2020/lib/dialog/dialog-container/dialog-container.component.mjs +243 -0
  23. package/esm2020/lib/dialog/dialog.module.mjs +34 -0
  24. package/esm2020/lib/dialog/dialog.service.mjs +240 -0
  25. package/{esm2015/lib/utils/object.js → esm2020/lib/utils/object.mjs} +0 -0
  26. package/esm2020/moment-adapter/date-time-adapter.class.mjs +215 -0
  27. package/{esm2015/moment-adapter/date-time-format.class.js → esm2020/moment-adapter/date-time-format.class.mjs} +0 -0
  28. package/esm2020/moment-adapter/moment-adapter.module.mjs +41 -0
  29. package/esm2020/moment-adapter/nxt-pick-datetime-moment-adapter.mjs +5 -0
  30. package/{esm2015/moment-adapter/public-api.js → esm2020/moment-adapter/public-api.mjs} +0 -0
  31. package/esm2020/native-adapter/date-time-adapter.class.mjs +344 -0
  32. package/{esm2015/native-adapter/date-time-format.class.js → esm2020/native-adapter/date-time-format.class.mjs} +0 -0
  33. package/esm2020/native-adapter/native-adapter.module.mjs +35 -0
  34. package/esm2020/native-adapter/nxt-pick-datetime-native-adapter.mjs +5 -0
  35. package/{esm2015/native-adapter/public-api.js → esm2020/native-adapter/public-api.mjs} +0 -0
  36. package/esm2020/nxt-pick-datetime.mjs +5 -0
  37. package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
  38. package/fesm2015/nxt-pick-datetime-moment-adapter.mjs +269 -0
  39. package/fesm2015/nxt-pick-datetime-moment-adapter.mjs.map +1 -0
  40. package/fesm2015/{nxt-pick-datetime-native-adapter.js → nxt-pick-datetime-native-adapter.mjs} +41 -27
  41. package/fesm2015/nxt-pick-datetime-native-adapter.mjs.map +1 -0
  42. package/fesm2015/nxt-pick-datetime.mjs +4974 -0
  43. package/fesm2015/nxt-pick-datetime.mjs.map +1 -0
  44. package/{fesm2015/nxt-pick-datetime-moment-adapter.js → fesm2020/nxt-pick-datetime-moment-adapter.mjs} +48 -27
  45. package/fesm2020/nxt-pick-datetime-moment-adapter.mjs.map +1 -0
  46. package/fesm2020/nxt-pick-datetime-native-adapter.mjs +390 -0
  47. package/fesm2020/nxt-pick-datetime-native-adapter.mjs.map +1 -0
  48. package/{fesm2015/nxt-pick-datetime.js → fesm2020/nxt-pick-datetime.mjs} +2207 -1967
  49. package/fesm2020/nxt-pick-datetime.mjs.map +1 -0
  50. package/lib/class/date-time.class.d.ts +3 -0
  51. package/lib/class/dialog-ref.class.d.ts +2 -0
  52. package/lib/date-time/calendar/calendar.component.d.ts +3 -0
  53. package/lib/date-time/calendar-body/calendar-body.component.d.ts +3 -0
  54. package/lib/date-time/calendar-month-view/calendar-month-view.component.d.ts +3 -0
  55. package/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.d.ts +3 -0
  56. package/lib/date-time/calendar-year-view/calendar-year-view.component.d.ts +3 -0
  57. package/lib/date-time/date-time-inline/date-time-inline.component.d.ts +3 -0
  58. package/lib/date-time/date-time-picker/date-time-picker.component.d.ts +3 -0
  59. package/lib/date-time/date-time-picker-container/date-time-picker-container.component.d.ts +3 -0
  60. package/lib/date-time/date-time-picker-input.directive.d.ts +3 -0
  61. package/lib/date-time/date-time-picker-intl.service.d.ts +3 -0
  62. package/lib/date-time/date-time-picker-trigger.directive.d.ts +3 -0
  63. package/lib/date-time/date-time.module.d.ts +21 -0
  64. package/lib/date-time/number-fixed-len.pipe.d.ts +3 -0
  65. package/lib/date-time/timer/timer.component.d.ts +3 -0
  66. package/lib/date-time/timer-box/timer-box.component.d.ts +3 -0
  67. package/lib/dialog/dialog-container/dialog-container.component.d.ts +5 -2
  68. package/lib/dialog/dialog.module.d.ts +9 -0
  69. package/lib/dialog/dialog.service.d.ts +6 -2
  70. package/moment-adapter/date-time-adapter.class.d.ts +3 -0
  71. package/moment-adapter/moment-adapter.module.d.ts +7 -0
  72. package/moment-adapter/nxt-pick-datetime-moment-adapter.d.ts +1 -3
  73. package/moment-adapter/package.json +6 -7
  74. package/native-adapter/date-time-adapter.class.d.ts +3 -0
  75. package/native-adapter/native-adapter.module.d.ts +8 -0
  76. package/native-adapter/nxt-pick-datetime-native-adapter.d.ts +1 -3
  77. package/native-adapter/package.json +6 -7
  78. package/nxt-pick-datetime.d.ts +1 -14
  79. package/package.json +48 -13
  80. package/bundles/nxt-pick-datetime-moment-adapter.umd.js +0 -577
  81. package/bundles/nxt-pick-datetime-moment-adapter.umd.js.map +0 -1
  82. package/bundles/nxt-pick-datetime-moment-adapter.umd.min.js +0 -17
  83. package/bundles/nxt-pick-datetime-moment-adapter.umd.min.js.map +0 -1
  84. package/bundles/nxt-pick-datetime-native-adapter.umd.js +0 -706
  85. package/bundles/nxt-pick-datetime-native-adapter.umd.js.map +0 -1
  86. package/bundles/nxt-pick-datetime-native-adapter.umd.min.js +0 -16
  87. package/bundles/nxt-pick-datetime-native-adapter.umd.min.js.map +0 -1
  88. package/bundles/nxt-pick-datetime.umd.js +0 -5809
  89. package/bundles/nxt-pick-datetime.umd.js.map +0 -1
  90. package/bundles/nxt-pick-datetime.umd.min.js +0 -17
  91. package/bundles/nxt-pick-datetime.umd.min.js.map +0 -1
  92. package/esm2015/lib/class/date-time.class.js +0 -151
  93. package/esm2015/lib/class/dialog-ref.class.js +0 -113
  94. package/esm2015/lib/date-time/calendar/calendar.component.js +0 -331
  95. package/esm2015/lib/date-time/calendar-body/calendar-body.component.js +0 -144
  96. package/esm2015/lib/date-time/calendar-month-view/calendar-month-view.component.js +0 -425
  97. package/esm2015/lib/date-time/calendar-multi-year-view/calendar-multi-year-view.component.js +0 -347
  98. package/esm2015/lib/date-time/calendar-year-view/calendar-year-view.component.js +0 -356
  99. package/esm2015/lib/date-time/date-time-inline/date-time-inline.component.js +0 -246
  100. package/esm2015/lib/date-time/date-time-picker/date-time-picker.component.js +0 -511
  101. package/esm2015/lib/date-time/date-time-picker-container/date-time-picker-container.component.js +0 -373
  102. package/esm2015/lib/date-time/date-time-picker-input.directive.js +0 -592
  103. package/esm2015/lib/date-time/date-time-picker-intl.service.js +0 -59
  104. package/esm2015/lib/date-time/date-time-picker-trigger.directive.js +0 -63
  105. package/esm2015/lib/date-time/date-time.module.js +0 -60
  106. package/esm2015/lib/date-time/number-fixed-len.pipe.js +0 -21
  107. package/esm2015/lib/date-time/timer/timer.component.js +0 -287
  108. package/esm2015/lib/date-time/timer-box/timer-box.component.js +0 -77
  109. package/esm2015/lib/dialog/dialog-container/dialog-container.component.js +0 -202
  110. package/esm2015/lib/dialog/dialog.module.js +0 -26
  111. package/esm2015/lib/dialog/dialog.service.js +0 -225
  112. package/esm2015/moment-adapter/date-time-adapter.class.js +0 -206
  113. package/esm2015/moment-adapter/moment-adapter.module.js +0 -28
  114. package/esm2015/moment-adapter/nxt-pick-datetime-moment-adapter.js +0 -8
  115. package/esm2015/native-adapter/date-time-adapter.class.js +0 -342
  116. package/esm2015/native-adapter/native-adapter.module.js +0 -26
  117. package/esm2015/native-adapter/nxt-pick-datetime-native-adapter.js +0 -8
  118. package/esm2015/nxt-pick-datetime.js +0 -19
  119. package/fesm2015/nxt-pick-datetime-moment-adapter.js.map +0 -1
  120. package/fesm2015/nxt-pick-datetime-native-adapter.js.map +0 -1
  121. package/fesm2015/nxt-pick-datetime.js.map +0 -1
  122. package/moment-adapter/nxt-pick-datetime-moment-adapter.metadata.json +0 -1
  123. package/native-adapter/nxt-pick-datetime-native-adapter.metadata.json +0 -1
  124. package/nxt-pick-datetime.metadata.json +0 -1
@@ -1,14 +1,19 @@
1
- import { InjectionToken, inject, LOCALE_ID, EventEmitter, Component, ChangeDetectionStrategy, ElementRef, NgZone, Input, Output, HostBinding, ChangeDetectorRef, Optional, Inject, ViewChild, ɵɵdefineInjectable, Injectable, Directive, HostListener, forwardRef, TemplateRef, Injector, SkipSelf, ViewContainerRef, Renderer2, NgModule, Pipe } from '@angular/core';
2
- import { Subject, Subscription, defer, merge, of } from 'rxjs';
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, inject, LOCALE_ID, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, HostBinding, Optional, Inject, ViewChild, Injectable, Directive, Pipe, HostListener, forwardRef, TemplateRef, Injector, SkipSelf, NgModule } from '@angular/core';
3
+ import { Subject, Subscription, of, merge, defer } from 'rxjs';
3
4
  import { coerceNumberProperty, coerceBooleanProperty, coerceArray } from '@angular/cdk/coercion';
4
5
  import { ENTER, PAGE_DOWN, PAGE_UP, END, HOME, DOWN_ARROW, UP_ARROW, RIGHT_ARROW, LEFT_ARROW, SPACE, ESCAPE } from '@angular/cdk/keycodes';
5
- import { take, filter, startWith, debounceTime, distinctUntilChanged } from 'rxjs/operators';
6
+ import { take, debounceTime, distinctUntilChanged, filter, concatAll } from 'rxjs/operators';
7
+ import * as i1 from '@angular/common';
8
+ import { DOCUMENT, CommonModule } from '@angular/common';
9
+ import * as i1$1 from '@angular/cdk/a11y';
10
+ import { A11yModule } from '@angular/cdk/a11y';
6
11
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS, Validators } from '@angular/forms';
7
12
  import { trigger, state, style, transition, group, query, animateChild, animate, keyframes } from '@angular/animations';
8
- import { NoopScrollStrategy, Overlay, OverlayConfig, OverlayContainer, OverlayModule } from '@angular/cdk/overlay';
9
- import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, PortalInjector, PortalModule } from '@angular/cdk/portal';
10
- import { DOCUMENT, Location, CommonModule } from '@angular/common';
11
- import { FocusTrapFactory, A11yModule } from '@angular/cdk/a11y';
13
+ import * as i1$2 from '@angular/cdk/overlay';
14
+ import { NoopScrollStrategy, Overlay, OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
15
+ import * as i2 from '@angular/cdk/portal';
16
+ import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, PortalModule } from '@angular/cdk/portal';
12
17
 
13
18
  /** InjectionToken for date time picker that can be used to override default locale code. */
14
19
  const OWL_DATE_TIME_LOCALE = new InjectionToken('OWL_DATE_TIME_LOCALE', {
@@ -238,32 +243,31 @@ class OwlCalendarBodyComponent {
238
243
  });
239
244
  }
240
245
  }
241
- OwlCalendarBodyComponent.decorators = [
242
- { type: Component, args: [{
243
- // tslint:disable-next-line:component-selector
244
- selector: '[owl-date-time-calendar-body]',
245
- exportAs: 'owlDateTimeCalendarBody',
246
- template: "<tr *ngFor=\"let row of rows; let rowIndex = index\"\n role=\"row\">\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"owl-dt-calendar-cell {{item.cellClass}}\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.owl-dt-calendar-cell-active]=\"isActiveCell(rowIndex, colIndex)\"\n [class.owl-dt-calendar-cell-disabled]=\"!item.enabled\"\n [class.owl-dt-calendar-cell-in-range]=\"isInRange(item.value)\"\n [class.owl-dt-calendar-cell-range-from]=\"isRangeFrom(item.value)\"\n [class.owl-dt-calendar-cell-range-to]=\"isRangeTo(item.value)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [style.width.%]=\"100 / numCols\"\n [style.paddingTop.%]=\"50 * cellRatio / numCols\"\n [style.paddingBottom.%]=\"50 * cellRatio / numCols\"\n (click)=\"selectCell(item)\">\n <span class=\"owl-dt-calendar-cell-content\"\n [ngClass]=\"{\n 'owl-dt-calendar-cell-out': item.out,\n 'owl-dt-calendar-cell-today': item.value === todayValue,\n 'owl-dt-calendar-cell-selected': isSelected(item.value)\n }\">\n {{item.displayValue}}\n </span>\n </td>\n</tr>\n",
247
- preserveWhitespaces: false,
248
- changeDetection: ChangeDetectionStrategy.OnPush,
249
- styles: [""]
250
- },] }
251
- ];
252
- OwlCalendarBodyComponent.ctorParameters = () => [
253
- { type: ElementRef },
254
- { type: NgZone }
255
- ];
256
- OwlCalendarBodyComponent.propDecorators = {
257
- activeCell: [{ type: Input }],
258
- rows: [{ type: Input }],
259
- numCols: [{ type: Input }],
260
- cellRatio: [{ type: Input }],
261
- todayValue: [{ type: Input }],
262
- selectedValues: [{ type: Input }],
263
- selectMode: [{ type: Input }],
264
- select: [{ type: Output }],
265
- owlDTCalendarBodyClass: [{ type: HostBinding, args: ['class.owl-dt-calendar-body',] }]
266
- };
246
+ OwlCalendarBodyComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlCalendarBodyComponent, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
247
+ OwlCalendarBodyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlCalendarBodyComponent, selector: "[owl-date-time-calendar-body]", inputs: { activeCell: "activeCell", rows: "rows", numCols: "numCols", cellRatio: "cellRatio", todayValue: "todayValue", selectedValues: "selectedValues", selectMode: "selectMode" }, outputs: { select: "select" }, host: { properties: { "class.owl-dt-calendar-body": "this.owlDTCalendarBodyClass" } }, exportAs: ["owlDateTimeCalendarBody"], ngImport: i0, template: "<tr *ngFor=\"let row of rows; let rowIndex = index\"\n role=\"row\">\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"owl-dt-calendar-cell {{item.cellClass}}\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.owl-dt-calendar-cell-active]=\"isActiveCell(rowIndex, colIndex)\"\n [class.owl-dt-calendar-cell-disabled]=\"!item.enabled\"\n [class.owl-dt-calendar-cell-in-range]=\"isInRange(item.value)\"\n [class.owl-dt-calendar-cell-range-from]=\"isRangeFrom(item.value)\"\n [class.owl-dt-calendar-cell-range-to]=\"isRangeTo(item.value)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [style.width.%]=\"100 / numCols\"\n [style.paddingTop.%]=\"50 * cellRatio / numCols\"\n [style.paddingBottom.%]=\"50 * cellRatio / numCols\"\n (click)=\"selectCell(item)\">\n <span class=\"owl-dt-calendar-cell-content\"\n [ngClass]=\"{\n 'owl-dt-calendar-cell-out': item.out,\n 'owl-dt-calendar-cell-today': item.value === todayValue,\n 'owl-dt-calendar-cell-selected': isSelected(item.value)\n }\">\n {{item.displayValue}}\n </span>\n </td>\n</tr>\n", styles: [""], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlCalendarBodyComponent, decorators: [{
249
+ type: Component,
250
+ args: [{ selector: '[owl-date-time-calendar-body]', exportAs: 'owlDateTimeCalendarBody', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<tr *ngFor=\"let row of rows; let rowIndex = index\"\n role=\"row\">\n <td *ngFor=\"let item of row; let colIndex = index\"\n class=\"owl-dt-calendar-cell {{item.cellClass}}\"\n [tabindex]=\"isActiveCell(rowIndex, colIndex) ? 0 : -1\"\n [class.owl-dt-calendar-cell-active]=\"isActiveCell(rowIndex, colIndex)\"\n [class.owl-dt-calendar-cell-disabled]=\"!item.enabled\"\n [class.owl-dt-calendar-cell-in-range]=\"isInRange(item.value)\"\n [class.owl-dt-calendar-cell-range-from]=\"isRangeFrom(item.value)\"\n [class.owl-dt-calendar-cell-range-to]=\"isRangeTo(item.value)\"\n [attr.aria-label]=\"item.ariaLabel\"\n [attr.aria-disabled]=\"!item.enabled || null\"\n [style.width.%]=\"100 / numCols\"\n [style.paddingTop.%]=\"50 * cellRatio / numCols\"\n [style.paddingBottom.%]=\"50 * cellRatio / numCols\"\n (click)=\"selectCell(item)\">\n <span class=\"owl-dt-calendar-cell-content\"\n [ngClass]=\"{\n 'owl-dt-calendar-cell-out': item.out,\n 'owl-dt-calendar-cell-today': item.value === todayValue,\n 'owl-dt-calendar-cell-selected': isSelected(item.value)\n }\">\n {{item.displayValue}}\n </span>\n </td>\n</tr>\n", styles: [""] }]
251
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { activeCell: [{
252
+ type: Input
253
+ }], rows: [{
254
+ type: Input
255
+ }], numCols: [{
256
+ type: Input
257
+ }], cellRatio: [{
258
+ type: Input
259
+ }], todayValue: [{
260
+ type: Input
261
+ }], selectedValues: [{
262
+ type: Input
263
+ }], selectMode: [{
264
+ type: Input
265
+ }], select: [{
266
+ type: Output
267
+ }], owlDTCalendarBodyClass: [{
268
+ type: HostBinding,
269
+ args: ['class.owl-dt-calendar-body']
270
+ }] } });
267
271
 
268
272
  const DAYS_PER_WEEK = 7;
269
273
  const WEEKS_PER_VIEW = 6;
@@ -526,9 +530,7 @@ class OwlMonthViewComponent {
526
530
  const shortWeekdays = this.dateTimeAdapter.getDayOfWeekNames('short');
527
531
  const narrowWeekdays = this.dateTimeAdapter.getDayOfWeekNames('narrow');
528
532
  const firstDayOfWeek = this.firstDayOfWeek;
529
- const weekdays = longWeekdays.map((long, i) => {
530
- return { long, short: shortWeekdays[i], narrow: narrowWeekdays[i] };
531
- });
533
+ const weekdays = longWeekdays.map((long, i) => ({ long, short: shortWeekdays[i], narrow: narrowWeekdays[i] }));
532
534
  this._weekdays = weekdays
533
535
  .slice(firstDayOfWeek)
534
536
  .concat(weekdays.slice(0, firstDayOfWeek));
@@ -651,37 +653,49 @@ class OwlMonthViewComponent {
651
653
  this.calendarBodyElm.focusActiveCell();
652
654
  }
653
655
  }
654
- OwlMonthViewComponent.decorators = [
655
- { type: Component, args: [{
656
- selector: 'owl-date-time-month-view',
657
- exportAs: 'owlYearView',
658
- template: "<table class=\"owl-dt-calendar-table owl-dt-calendar-month-table\"\n [class.owl-dt-calendar-only-current-month]=\"hideOtherMonths\">\n <thead class=\"owl-dt-calendar-header\">\n <tr class=\"owl-dt-weekdays\">\n <th *ngFor=\"let weekday of weekdays\"\n [attr.aria-label]=\"weekday.long\"\n class=\"owl-dt-weekday\"\n scope=\"col\">\n <span>{{weekday.short}}</span>\n </th>\n </tr>\n <tr>\n <th class=\"owl-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"days\"\n [todayValue]=\"todayDate\"\n [selectedValues]=\"selectedDates\"\n [selectMode]=\"selectMode\"\n [activeCell]=\"activeCell\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n",
659
- preserveWhitespaces: false,
660
- changeDetection: ChangeDetectionStrategy.OnPush,
661
- styles: [""]
662
- },] }
663
- ];
664
- OwlMonthViewComponent.ctorParameters = () => [
665
- { type: ChangeDetectorRef },
666
- { type: DateTimeAdapter, decorators: [{ type: Optional }] },
667
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [OWL_DATE_TIME_FORMATS,] }] }
668
- ];
669
- OwlMonthViewComponent.propDecorators = {
670
- hideOtherMonths: [{ type: Input }],
671
- firstDayOfWeek: [{ type: Input }],
672
- selectMode: [{ type: Input }],
673
- selected: [{ type: Input }],
674
- selecteds: [{ type: Input }],
675
- pickerMoment: [{ type: Input }],
676
- dateFilter: [{ type: Input }],
677
- minDate: [{ type: Input }],
678
- maxDate: [{ type: Input }],
679
- selectedChange: [{ type: Output }],
680
- userSelection: [{ type: Output }],
681
- pickerMomentChange: [{ type: Output }],
682
- calendarBodyElm: [{ type: ViewChild, args: [OwlCalendarBodyComponent, { static: true },] }],
683
- owlDTCalendarView: [{ type: HostBinding, args: ['class.owl-dt-calendar-view',] }]
684
- };
656
+ OwlMonthViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlMonthViewComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DateTimeAdapter, optional: true }, { token: OWL_DATE_TIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
657
+ OwlMonthViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlMonthViewComponent, selector: "owl-date-time-month-view", inputs: { hideOtherMonths: "hideOtherMonths", firstDayOfWeek: "firstDayOfWeek", selectMode: "selectMode", selected: "selected", selecteds: "selecteds", pickerMoment: "pickerMoment", dateFilter: "dateFilter", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectedChange: "selectedChange", userSelection: "userSelection", pickerMomentChange: "pickerMomentChange" }, host: { properties: { "class.owl-dt-calendar-view": "this.owlDTCalendarView" } }, viewQueries: [{ propertyName: "calendarBodyElm", first: true, predicate: OwlCalendarBodyComponent, descendants: true, static: true }], exportAs: ["owlYearView"], ngImport: i0, template: "<table class=\"owl-dt-calendar-table owl-dt-calendar-month-table\"\n [class.owl-dt-calendar-only-current-month]=\"hideOtherMonths\">\n <thead class=\"owl-dt-calendar-header\">\n <tr class=\"owl-dt-weekdays\">\n <th *ngFor=\"let weekday of weekdays\"\n [attr.aria-label]=\"weekday.long\"\n class=\"owl-dt-weekday\"\n scope=\"col\">\n <span>{{weekday.short}}</span>\n </th>\n </tr>\n <tr>\n <th class=\"owl-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"days\"\n [todayValue]=\"todayDate\"\n [selectedValues]=\"selectedDates\"\n [selectMode]=\"selectMode\"\n [activeCell]=\"activeCell\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n", styles: [""], components: [{ type: OwlCalendarBodyComponent, selector: "[owl-date-time-calendar-body]", inputs: ["activeCell", "rows", "numCols", "cellRatio", "todayValue", "selectedValues", "selectMode"], outputs: ["select"], exportAs: ["owlDateTimeCalendarBody"] }], directives: [{ type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
658
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlMonthViewComponent, decorators: [{
659
+ type: Component,
660
+ args: [{ selector: 'owl-date-time-month-view', exportAs: 'owlYearView', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"owl-dt-calendar-table owl-dt-calendar-month-table\"\n [class.owl-dt-calendar-only-current-month]=\"hideOtherMonths\">\n <thead class=\"owl-dt-calendar-header\">\n <tr class=\"owl-dt-weekdays\">\n <th *ngFor=\"let weekday of weekdays\"\n [attr.aria-label]=\"weekday.long\"\n class=\"owl-dt-weekday\"\n scope=\"col\">\n <span>{{weekday.short}}</span>\n </th>\n </tr>\n <tr>\n <th class=\"owl-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"7\"></th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"days\"\n [todayValue]=\"todayDate\"\n [selectedValues]=\"selectedDates\"\n [selectMode]=\"selectMode\"\n [activeCell]=\"activeCell\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n", styles: [""] }]
661
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
662
+ type: Optional
663
+ }] }, { type: undefined, decorators: [{
664
+ type: Optional
665
+ }, {
666
+ type: Inject,
667
+ args: [OWL_DATE_TIME_FORMATS]
668
+ }] }]; }, propDecorators: { hideOtherMonths: [{
669
+ type: Input
670
+ }], firstDayOfWeek: [{
671
+ type: Input
672
+ }], selectMode: [{
673
+ type: Input
674
+ }], selected: [{
675
+ type: Input
676
+ }], selecteds: [{
677
+ type: Input
678
+ }], pickerMoment: [{
679
+ type: Input
680
+ }], dateFilter: [{
681
+ type: Input
682
+ }], minDate: [{
683
+ type: Input
684
+ }], maxDate: [{
685
+ type: Input
686
+ }], selectedChange: [{
687
+ type: Output
688
+ }], userSelection: [{
689
+ type: Output
690
+ }], pickerMomentChange: [{
691
+ type: Output
692
+ }], calendarBodyElm: [{
693
+ type: ViewChild,
694
+ args: [OwlCalendarBodyComponent, { static: true }]
695
+ }], owlDTCalendarView: [{
696
+ type: HostBinding,
697
+ args: ['class.owl-dt-calendar-view']
698
+ }] } });
685
699
 
686
700
  class OwlDateTimeIntl {
687
701
  constructor() {
@@ -691,53 +705,55 @@ class OwlDateTimeIntl {
691
705
  */
692
706
  this.changes = new Subject();
693
707
  /** A label for the up second button (used by screen readers). */
694
- this.upSecondLabel = 'Add a second';
708
+ this.upSecondLabel = $localize `:@@nxt-pick-datetime.up-second:Add a second`;
695
709
  /** A label for the down second button (used by screen readers). */
696
- this.downSecondLabel = 'Minus a second';
710
+ this.downSecondLabel = $localize `:@@nxt-pick-datetime.down-second:Minus a second`;
697
711
  /** A label for the up minute button (used by screen readers). */
698
- this.upMinuteLabel = 'Add a minute';
712
+ this.upMinuteLabel = $localize `:@@nxt-pick-datetime.up-minute:Add a minute`;
699
713
  /** A label for the down minute button (used by screen readers). */
700
- this.downMinuteLabel = 'Minus a minute';
714
+ this.downMinuteLabel = $localize `:@@nxt-pick-datetime.down-minute:Minus a minute`;
701
715
  /** A label for the up hour button (used by screen readers). */
702
- this.upHourLabel = 'Add a hour';
716
+ this.upHourLabel = $localize `:@@nxt-pick-datetime.up-hour:Add a hour`;
703
717
  /** A label for the down hour button (used by screen readers). */
704
- this.downHourLabel = 'Minus a hour';
718
+ this.downHourLabel = $localize `:@@nxt-pick-datetime.down-hour:Minus a hour`;
705
719
  /** A label for the previous month button (used by screen readers). */
706
- this.prevMonthLabel = 'Previous month';
720
+ this.prevMonthLabel = $localize `:@@nxt-pick-datetime.prev-month:Previous month`;
707
721
  /** A label for the next month button (used by screen readers). */
708
- this.nextMonthLabel = 'Next month';
722
+ this.nextMonthLabel = $localize `:@@nxt-pick-datetime.next-month:Next month`;
709
723
  /** A label for the previous year button (used by screen readers). */
710
- this.prevYearLabel = 'Previous year';
724
+ this.prevYearLabel = $localize `:@@nxt-pick-datetime.prev-year:Previous year`;
711
725
  /** A label for the next year button (used by screen readers). */
712
- this.nextYearLabel = 'Next year';
726
+ this.nextYearLabel = $localize `:@@nxt-pick-datetime.next-year:Next year`;
713
727
  /** A label for the previous multi-year button (used by screen readers). */
714
- this.prevMultiYearLabel = 'Previous 21 years';
728
+ this.prevMultiYearLabel = $localize `:@@nxt-pick-datetime.prev-multi-year:Previous 21 years`;
715
729
  /** A label for the next multi-year button (used by screen readers). */
716
- this.nextMultiYearLabel = 'Next 21 years';
730
+ this.nextMultiYearLabel = $localize `:@@nxt-pick-datetime.next-multi-year:Next 21 years`;
717
731
  /** A label for the 'switch to month view' button (used by screen readers). */
718
- this.switchToMonthViewLabel = 'Change to month view';
732
+ this.switchToMonthViewLabel = $localize `:@@nxt-pick-datetime.switch-to-month:Change to month view`;
719
733
  /** A label for the 'switch to year view' button (used by screen readers). */
720
- this.switchToMultiYearViewLabel = 'Choose month and year';
734
+ this.switchToMultiYearViewLabel = $localize `:@@nxt-pick-datetime.switch-to-year-month:Choose month and year`;
721
735
  /** A label for the cancel button */
722
- this.cancelBtnLabel = 'Cancel';
736
+ this.cancelBtnLabel = $localize `:@@nxt-pick-datetime.cancel:Cancel`;
723
737
  /** A label for the set button */
724
- this.setBtnLabel = 'Set';
738
+ this.setBtnLabel = $localize `:@@nxt-pick-datetime.set:Set`;
725
739
  /** A label for the range 'from' in picker info */
726
- this.rangeFromLabel = 'From';
740
+ this.rangeFromLabel = $localize `:@@nxt-pick-datetime.from:From`;
727
741
  /** A label for the range 'to' in picker info */
728
- this.rangeToLabel = 'To';
742
+ this.rangeToLabel = $localize `:@@nxt-pick-datetime.to:To`;
729
743
  /** A label for the hour12 button (AM) */
730
- this.hour12AMLabel = 'AM';
744
+ this.hour12AMLabel = $localize `:@@nxt-pick-datetime.time-am:AM`;
731
745
  /** A label for the hour12 button (PM) */
732
- this.hour12PMLabel = 'PM';
746
+ this.hour12PMLabel = $localize `:@@nxt-pick-datetime.time-pm:PM`;
733
747
  }
734
748
  }
735
- OwlDateTimeIntl.ɵprov = ɵɵdefineInjectable({ factory: function OwlDateTimeIntl_Factory() { return new OwlDateTimeIntl(); }, token: OwlDateTimeIntl, providedIn: "root" });
736
- OwlDateTimeIntl.decorators = [
737
- { type: Injectable, args: [{
738
- providedIn: 'root'
739
- },] }
740
- ];
749
+ OwlDateTimeIntl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeIntl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
750
+ OwlDateTimeIntl.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeIntl, providedIn: 'root' });
751
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeIntl, decorators: [{
752
+ type: Injectable,
753
+ args: [{
754
+ providedIn: 'root'
755
+ }]
756
+ }] });
741
757
 
742
758
  const YEARS_PER_ROW = 3;
743
759
  const YEAR_ROWS = 7;
@@ -755,6 +771,7 @@ class OwlMultiYearViewComponent {
755
771
  /**
756
772
  * Callback to invoke when a new month is selected
757
773
  * */
774
+ // eslint-disable-next-line @angular-eslint/no-output-native
758
775
  this.change = new EventEmitter();
759
776
  /**
760
777
  * Emits the selected year. This doesn't imply a change on the selected date
@@ -1050,36 +1067,45 @@ class OwlMultiYearViewComponent {
1050
1067
  this.calendarBodyElm.focusActiveCell();
1051
1068
  }
1052
1069
  }
1053
- OwlMultiYearViewComponent.decorators = [
1054
- { type: Component, args: [{
1055
- selector: 'owl-date-time-multi-year-view',
1056
- template: "<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n [disabled]=\"!previousEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"prevYearList($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<table class=\"owl-dt-calendar-table owl-dt-calendar-multi-year-table\">\n <thead class=\"owl-dt-calendar-header\">\n <tr>\n <th colspan=\"3\">{{tableHeader}}</th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"years\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell\"\n [todayValue]=\"todayYear\"\n [selectedValues]=\"selectedYears\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\"></tbody>\n</table>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n [disabled]=\"!nextEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"nextYearList($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n",
1057
- preserveWhitespaces: false,
1058
- changeDetection: ChangeDetectionStrategy.OnPush,
1059
- styles: [""]
1060
- },] }
1061
- ];
1062
- OwlMultiYearViewComponent.ctorParameters = () => [
1063
- { type: ChangeDetectorRef },
1064
- { type: OwlDateTimeIntl },
1065
- { type: DateTimeAdapter, decorators: [{ type: Optional }] }
1066
- ];
1067
- OwlMultiYearViewComponent.propDecorators = {
1068
- selectMode: [{ type: Input }],
1069
- selected: [{ type: Input }],
1070
- selecteds: [{ type: Input }],
1071
- pickerMoment: [{ type: Input }],
1072
- dateFilter: [{ type: Input }],
1073
- minDate: [{ type: Input }],
1074
- maxDate: [{ type: Input }],
1075
- change: [{ type: Output }],
1076
- yearSelected: [{ type: Output }],
1077
- pickerMomentChange: [{ type: Output }],
1078
- keyboardEnter: [{ type: Output }],
1079
- calendarBodyElm: [{ type: ViewChild, args: [OwlCalendarBodyComponent, { static: true },] }],
1080
- owlDTCalendarView: [{ type: HostBinding, args: ['class.owl-dt-calendar-view',] }],
1081
- owlDTCalendarMultiYearView: [{ type: HostBinding, args: ['class.owl-dt-calendar-multi-year-view',] }]
1082
- };
1070
+ OwlMultiYearViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlMultiYearViewComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: OwlDateTimeIntl }, { token: DateTimeAdapter, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1071
+ OwlMultiYearViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlMultiYearViewComponent, selector: "owl-date-time-multi-year-view", inputs: { selectMode: "selectMode", selected: "selected", selecteds: "selecteds", pickerMoment: "pickerMoment", dateFilter: "dateFilter", minDate: "minDate", maxDate: "maxDate" }, outputs: { change: "change", yearSelected: "yearSelected", pickerMomentChange: "pickerMomentChange", keyboardEnter: "keyboardEnter" }, host: { properties: { "class.owl-dt-calendar-view": "this.owlDTCalendarView", "class.owl-dt-calendar-multi-year-view": "this.owlDTCalendarMultiYearView" } }, viewQueries: [{ propertyName: "calendarBodyElm", first: true, predicate: OwlCalendarBodyComponent, descendants: true, static: true }], ngImport: i0, template: "<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n [disabled]=\"!previousEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"prevYearList($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<table class=\"owl-dt-calendar-table owl-dt-calendar-multi-year-table\">\n <thead class=\"owl-dt-calendar-header\">\n <tr>\n <th colspan=\"3\">{{tableHeader}}</th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"years\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell\"\n [todayValue]=\"todayYear\"\n [selectedValues]=\"selectedYears\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\"></tbody>\n</table>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n [disabled]=\"!nextEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"nextYearList($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n", styles: [""], components: [{ type: OwlCalendarBodyComponent, selector: "[owl-date-time-calendar-body]", inputs: ["activeCell", "rows", "numCols", "cellRatio", "todayValue", "selectedValues", "selectMode"], outputs: ["select"], exportAs: ["owlDateTimeCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1072
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlMultiYearViewComponent, decorators: [{
1073
+ type: Component,
1074
+ args: [{ selector: 'owl-date-time-multi-year-view', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n [disabled]=\"!previousEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"prevYearList($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<table class=\"owl-dt-calendar-table owl-dt-calendar-multi-year-table\">\n <thead class=\"owl-dt-calendar-header\">\n <tr>\n <th colspan=\"3\">{{tableHeader}}</th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"years\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell\"\n [todayValue]=\"todayYear\"\n [selectedValues]=\"selectedYears\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\"></tbody>\n</table>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n [disabled]=\"!nextEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"nextYearList($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n", styles: [""] }]
1075
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: OwlDateTimeIntl }, { type: DateTimeAdapter, decorators: [{
1076
+ type: Optional
1077
+ }] }]; }, propDecorators: { selectMode: [{
1078
+ type: Input
1079
+ }], selected: [{
1080
+ type: Input
1081
+ }], selecteds: [{
1082
+ type: Input
1083
+ }], pickerMoment: [{
1084
+ type: Input
1085
+ }], dateFilter: [{
1086
+ type: Input
1087
+ }], minDate: [{
1088
+ type: Input
1089
+ }], maxDate: [{
1090
+ type: Input
1091
+ }], change: [{
1092
+ type: Output
1093
+ }], yearSelected: [{
1094
+ type: Output
1095
+ }], pickerMomentChange: [{
1096
+ type: Output
1097
+ }], keyboardEnter: [{
1098
+ type: Output
1099
+ }], calendarBodyElm: [{
1100
+ type: ViewChild,
1101
+ args: [OwlCalendarBodyComponent, { static: true }]
1102
+ }], owlDTCalendarView: [{
1103
+ type: HostBinding,
1104
+ args: ['class.owl-dt-calendar-view']
1105
+ }], owlDTCalendarMultiYearView: [{
1106
+ type: HostBinding,
1107
+ args: ['class.owl-dt-calendar-multi-year-view']
1108
+ }] } });
1083
1109
 
1084
1110
  const MONTHS_PER_YEAR = 12;
1085
1111
  const MONTHS_PER_ROW = 3;
@@ -1137,10 +1163,10 @@ class OwlYearViewComponent {
1137
1163
  }
1138
1164
  set selecteds(values) {
1139
1165
  this._selecteds = [];
1140
- for (let i = 0; i < values.length; i++) {
1141
- const value = this.dateTimeAdapter.deserialize(values[i]);
1166
+ values.forEach(val => {
1167
+ const value = this.dateTimeAdapter.deserialize(val);
1142
1168
  this._selecteds.push(this.getValidDate(value));
1143
- }
1169
+ });
1144
1170
  this.setSelectedMonths();
1145
1171
  }
1146
1172
  get pickerMoment() {
@@ -1400,36 +1426,47 @@ class OwlYearViewComponent {
1400
1426
  this.calendarBodyElm.focusActiveCell();
1401
1427
  }
1402
1428
  }
1403
- OwlYearViewComponent.decorators = [
1404
- { type: Component, args: [{
1405
- selector: 'owl-date-time-year-view',
1406
- exportAs: 'owlMonthView',
1407
- template: "<table class=\"owl-dt-calendar-table owl-dt-calendar-year-table\">\n <thead class=\"owl-dt-calendar-header\">\n <tr>\n <th class=\"owl-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"3\"></th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"months\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell\"\n [todayValue]=\"todayMonth\"\n [selectedValues]=\"selectedMonths\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n",
1408
- preserveWhitespaces: false,
1409
- changeDetection: ChangeDetectionStrategy.OnPush,
1410
- styles: [""]
1411
- },] }
1412
- ];
1413
- OwlYearViewComponent.ctorParameters = () => [
1414
- { type: ChangeDetectorRef },
1415
- { type: DateTimeAdapter, decorators: [{ type: Optional }] },
1416
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [OWL_DATE_TIME_FORMATS,] }] }
1417
- ];
1418
- OwlYearViewComponent.propDecorators = {
1419
- selectMode: [{ type: Input }],
1420
- selected: [{ type: Input }],
1421
- selecteds: [{ type: Input }],
1422
- pickerMoment: [{ type: Input }],
1423
- dateFilter: [{ type: Input }],
1424
- minDate: [{ type: Input }],
1425
- maxDate: [{ type: Input }],
1426
- change: [{ type: Output }],
1427
- monthSelected: [{ type: Output }],
1428
- pickerMomentChange: [{ type: Output }],
1429
- keyboardEnter: [{ type: Output }],
1430
- calendarBodyElm: [{ type: ViewChild, args: [OwlCalendarBodyComponent, { static: true },] }],
1431
- owlDTCalendarView: [{ type: HostBinding, args: ['class.owl-dt-calendar-view',] }]
1432
- };
1429
+ OwlYearViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlYearViewComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DateTimeAdapter, optional: true }, { token: OWL_DATE_TIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1430
+ OwlYearViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlYearViewComponent, selector: "owl-date-time-year-view", inputs: { selectMode: "selectMode", selected: "selected", selecteds: "selecteds", pickerMoment: "pickerMoment", dateFilter: "dateFilter", minDate: "minDate", maxDate: "maxDate" }, outputs: { change: "change", monthSelected: "monthSelected", pickerMomentChange: "pickerMomentChange", keyboardEnter: "keyboardEnter" }, host: { properties: { "class.owl-dt-calendar-view": "this.owlDTCalendarView" } }, viewQueries: [{ propertyName: "calendarBodyElm", first: true, predicate: OwlCalendarBodyComponent, descendants: true, static: true }], exportAs: ["owlMonthView"], ngImport: i0, template: "<table class=\"owl-dt-calendar-table owl-dt-calendar-year-table\">\n <thead class=\"owl-dt-calendar-header\">\n <tr>\n <th class=\"owl-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"3\"></th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"months\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell\"\n [todayValue]=\"todayMonth\"\n [selectedValues]=\"selectedMonths\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n", styles: [""], components: [{ type: OwlCalendarBodyComponent, selector: "[owl-date-time-calendar-body]", inputs: ["activeCell", "rows", "numCols", "cellRatio", "todayValue", "selectedValues", "selectMode"], outputs: ["select"], exportAs: ["owlDateTimeCalendarBody"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlYearViewComponent, decorators: [{
1432
+ type: Component,
1433
+ args: [{ selector: 'owl-date-time-year-view', exportAs: 'owlMonthView', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<table class=\"owl-dt-calendar-table owl-dt-calendar-year-table\">\n <thead class=\"owl-dt-calendar-header\">\n <tr>\n <th class=\"owl-dt-calendar-table-divider\"\n aria-hidden=\"true\"\n colspan=\"3\"></th>\n </tr>\n </thead>\n <tbody owl-date-time-calendar-body\n role=\"grid\"\n [rows]=\"months\"\n [numCols]=\"3\"\n [cellRatio]=\"3 / 7\"\n [activeCell]=\"activeCell\"\n [todayValue]=\"todayMonth\"\n [selectedValues]=\"selectedMonths\"\n [selectMode]=\"selectMode\"\n (keydown)=\"handleCalendarKeydown($event)\"\n (select)=\"selectCalendarCell($event)\">\n </tbody>\n</table>\n", styles: [""] }]
1434
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
1435
+ type: Optional
1436
+ }] }, { type: undefined, decorators: [{
1437
+ type: Optional
1438
+ }, {
1439
+ type: Inject,
1440
+ args: [OWL_DATE_TIME_FORMATS]
1441
+ }] }]; }, propDecorators: { selectMode: [{
1442
+ type: Input
1443
+ }], selected: [{
1444
+ type: Input
1445
+ }], selecteds: [{
1446
+ type: Input
1447
+ }], pickerMoment: [{
1448
+ type: Input
1449
+ }], dateFilter: [{
1450
+ type: Input
1451
+ }], minDate: [{
1452
+ type: Input
1453
+ }], maxDate: [{
1454
+ type: Input
1455
+ }], change: [{
1456
+ type: Output
1457
+ }], monthSelected: [{
1458
+ type: Output
1459
+ }], pickerMomentChange: [{
1460
+ type: Output
1461
+ }], keyboardEnter: [{
1462
+ type: Output
1463
+ }], calendarBodyElm: [{
1464
+ type: ViewChild,
1465
+ args: [OwlCalendarBodyComponent, { static: true }]
1466
+ }], owlDTCalendarView: [{
1467
+ type: HostBinding,
1468
+ args: ['class.owl-dt-calendar-view']
1469
+ }] } });
1433
1470
 
1434
1471
  class OwlCalendarComponent {
1435
1472
  constructor(elmRef, pickerIntl, ngZone, cdRef, dateTimeAdapter, dateTimeFormats) {
@@ -1465,14 +1502,12 @@ class OwlCalendarComponent {
1465
1502
  /**
1466
1503
  * Date filter for the month and year view
1467
1504
  */
1468
- this.dateFilterForViews = (date) => {
1469
- return (!!date &&
1470
- (!this.dateFilter || this.dateFilter(date, 'date')) &&
1471
- (!this.minDate ||
1472
- this.dateTimeAdapter.compare(date, this.minDate) >= 0) &&
1473
- (!this.maxDate ||
1474
- this.dateTimeAdapter.compare(date, this.maxDate) <= 0));
1475
- };
1505
+ this.dateFilterForViews = (date) => (!!date &&
1506
+ (!this.dateFilter || this.dateFilter(date, 'date')) &&
1507
+ (!this.minDate ||
1508
+ this.dateTimeAdapter.compare(date, this.minDate) >= 0) &&
1509
+ (!this.maxDate ||
1510
+ this.dateTimeAdapter.compare(date, this.maxDate) <= 0));
1476
1511
  this.intlChangesSub = Subscription.EMPTY;
1477
1512
  /**
1478
1513
  * Used for scheduling that focus should be moved to the active cell on the next tick.
@@ -1719,42 +1754,52 @@ class OwlCalendarComponent {
1719
1754
  : null;
1720
1755
  }
1721
1756
  }
1722
- OwlCalendarComponent.decorators = [
1723
- { type: Component, args: [{
1724
- selector: 'owl-date-time-calendar',
1725
- exportAs: 'owlDateTimeCalendar',
1726
- template: "<div class=\"owl-dt-calendar-control\">\n <!-- focus when keyboard tab (http://kizu.ru/en/blog/keyboard-only-focus/#x) -->\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!prevButtonEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n (click)=\"previousClicked()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n <div class=\"owl-dt-calendar-control-content\">\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-period-button\"\n type=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"periodButtonLabel\"\n (click)=\"toggleViews()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{periodButtonText}}\n\n <span class=\"owl-dt-control-button-arrow\"\n [style.transform]=\"'rotate(' + (isMonthView? 0 : 180) +'deg)'\">\n <!-- <editor-fold desc=\"SVG Arrow\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n width=\"50%\"\n height=\"50%\"\n viewBox=\"0 0 292.362 292.362\"\n style=\"enable-background:new 0 0 292.362 292.362;\"\n xml:space=\"preserve\">\n <g>\n <path\n d=\"M286.935,69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952,0-9.233,1.807-12.85,5.424\n C1.807,72.998,0,77.279,0,82.228c0,4.948,1.807,9.229,5.424,12.847l127.907,127.907c3.621,3.617,7.902,5.428,12.85,5.428\n s9.233-1.811,12.847-5.428L286.935,95.074c3.613-3.617,5.427-7.898,5.427-12.847C292.362,77.279,290.548,72.998,286.935,69.377z\" />\n </g>\n </svg>\n <!-- </editor-fold> -->\n </span>\n </span>\n </button>\n </div>\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!nextButtonEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n (click)=\"nextClicked()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n</div>\n<div class=\"owl-dt-calendar-main\"\n cdkMonitorSubtreeFocus\n [ngSwitch]=\"currentView\"\n tabindex=\"-1\">\n <owl-date-time-month-view *ngSwitchCase=\"'month'\"\n [pickerMoment]=\"pickerMoment\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n [hideOtherMonths]=\"hideOtherMonths\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (selectedChange)=\"dateSelected($event)\"\n (userSelection)=\"userSelected()\"></owl-date-time-month-view>\n\n <owl-date-time-year-view *ngSwitchCase=\"'year'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (monthSelected)=\"selectMonthInYearView($event)\"\n (change)=\"goToDateInView($event, 'month')\"></owl-date-time-year-view>\n\n <owl-date-time-multi-year-view *ngSwitchCase=\"'multi-years'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (yearSelected)=\"selectYearInMultiYearView($event)\"\n (change)=\"goToDateInView($event, 'year')\"></owl-date-time-multi-year-view>\n</div>\n",
1727
- preserveWhitespaces: false,
1728
- changeDetection: ChangeDetectionStrategy.OnPush,
1729
- styles: [""]
1730
- },] }
1731
- ];
1732
- OwlCalendarComponent.ctorParameters = () => [
1733
- { type: ElementRef },
1734
- { type: OwlDateTimeIntl },
1735
- { type: NgZone },
1736
- { type: ChangeDetectorRef },
1737
- { type: DateTimeAdapter, decorators: [{ type: Optional }] },
1738
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [OWL_DATE_TIME_FORMATS,] }] }
1739
- ];
1740
- OwlCalendarComponent.propDecorators = {
1741
- dateFilter: [{ type: Input }],
1742
- firstDayOfWeek: [{ type: Input }],
1743
- minDate: [{ type: Input }],
1744
- maxDate: [{ type: Input }],
1745
- pickerMoment: [{ type: Input }],
1746
- selectMode: [{ type: Input }],
1747
- selected: [{ type: Input }],
1748
- selecteds: [{ type: Input }],
1749
- startView: [{ type: Input }],
1750
- hideOtherMonths: [{ type: Input }],
1751
- pickerMomentChange: [{ type: Output }],
1752
- selectedChange: [{ type: Output }],
1753
- userSelection: [{ type: Output }],
1754
- yearSelected: [{ type: Output }],
1755
- monthSelected: [{ type: Output }],
1756
- owlDTCalendarClass: [{ type: HostBinding, args: ['class.owl-dt-calendar',] }]
1757
- };
1757
+ OwlCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlCalendarComponent, deps: [{ token: i0.ElementRef }, { token: OwlDateTimeIntl }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: DateTimeAdapter, optional: true }, { token: OWL_DATE_TIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
1758
+ OwlCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlCalendarComponent, selector: "owl-date-time-calendar", inputs: { dateFilter: "dateFilter", firstDayOfWeek: "firstDayOfWeek", minDate: "minDate", maxDate: "maxDate", pickerMoment: "pickerMoment", selectMode: "selectMode", selected: "selected", selecteds: "selecteds", startView: "startView", hideOtherMonths: "hideOtherMonths" }, outputs: { pickerMomentChange: "pickerMomentChange", selectedChange: "selectedChange", userSelection: "userSelection", yearSelected: "yearSelected", monthSelected: "monthSelected" }, host: { properties: { "class.owl-dt-calendar": "this.owlDTCalendarClass" } }, exportAs: ["owlDateTimeCalendar"], ngImport: i0, template: "<div class=\"owl-dt-calendar-control\">\n <!-- focus when keyboard tab (http://kizu.ru/en/blog/keyboard-only-focus/#x) -->\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!prevButtonEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n (click)=\"previousClicked()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n <div class=\"owl-dt-calendar-control-content\">\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-period-button\"\n type=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"periodButtonLabel\"\n (click)=\"toggleViews()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{periodButtonText}}\n\n <span class=\"owl-dt-control-button-arrow\"\n [style.transform]=\"'rotate(' + (isMonthView? 0 : 180) +'deg)'\">\n <!-- <editor-fold desc=\"SVG Arrow\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n width=\"50%\"\n height=\"50%\"\n viewBox=\"0 0 292.362 292.362\"\n style=\"enable-background:new 0 0 292.362 292.362;\"\n xml:space=\"preserve\">\n <g>\n <path\n d=\"M286.935,69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952,0-9.233,1.807-12.85,5.424\n C1.807,72.998,0,77.279,0,82.228c0,4.948,1.807,9.229,5.424,12.847l127.907,127.907c3.621,3.617,7.902,5.428,12.85,5.428\n s9.233-1.811,12.847-5.428L286.935,95.074c3.613-3.617,5.427-7.898,5.427-12.847C292.362,77.279,290.548,72.998,286.935,69.377z\" />\n </g>\n </svg>\n <!-- </editor-fold> -->\n </span>\n </span>\n </button>\n </div>\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!nextButtonEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n (click)=\"nextClicked()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n</div>\n<div class=\"owl-dt-calendar-main\"\n cdkMonitorSubtreeFocus\n [ngSwitch]=\"currentView\"\n tabindex=\"-1\">\n <owl-date-time-month-view *ngSwitchCase=\"'month'\"\n [pickerMoment]=\"pickerMoment\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n [hideOtherMonths]=\"hideOtherMonths\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (selectedChange)=\"dateSelected($event)\"\n (userSelection)=\"userSelected()\"></owl-date-time-month-view>\n\n <owl-date-time-year-view *ngSwitchCase=\"'year'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (monthSelected)=\"selectMonthInYearView($event)\"\n (change)=\"goToDateInView($event, 'month')\"></owl-date-time-year-view>\n\n <owl-date-time-multi-year-view *ngSwitchCase=\"'multi-years'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (yearSelected)=\"selectYearInMultiYearView($event)\"\n (change)=\"goToDateInView($event, 'year')\"></owl-date-time-multi-year-view>\n</div>\n", styles: [""], components: [{ type: OwlMonthViewComponent, selector: "owl-date-time-month-view", inputs: ["hideOtherMonths", "firstDayOfWeek", "selectMode", "selected", "selecteds", "pickerMoment", "dateFilter", "minDate", "maxDate"], outputs: ["selectedChange", "userSelection", "pickerMomentChange"], exportAs: ["owlYearView"] }, { type: OwlYearViewComponent, selector: "owl-date-time-year-view", inputs: ["selectMode", "selected", "selecteds", "pickerMoment", "dateFilter", "minDate", "maxDate"], outputs: ["change", "monthSelected", "pickerMomentChange", "keyboardEnter"], exportAs: ["owlMonthView"] }, { type: OwlMultiYearViewComponent, selector: "owl-date-time-multi-year-view", inputs: ["selectMode", "selected", "selecteds", "pickerMoment", "dateFilter", "minDate", "maxDate"], outputs: ["change", "yearSelected", "pickerMomentChange", "keyboardEnter"] }], directives: [{ type: i1$1.CdkMonitorFocus, selector: "[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]", outputs: ["cdkFocusChange"] }, { type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1759
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlCalendarComponent, decorators: [{
1760
+ type: Component,
1761
+ args: [{ selector: 'owl-date-time-calendar', exportAs: 'owlDateTimeCalendar', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"owl-dt-calendar-control\">\n <!-- focus when keyboard tab (http://kizu.ru/en/blog/keyboard-only-focus/#x) -->\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!prevButtonEnabled()\"\n [attr.aria-label]=\"prevButtonLabel\"\n (click)=\"previousClicked()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Left\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path style=\"fill-rule: evenodd; clip-rule: evenodd;\"\n d=\"M96.633,125.369l95.053-94.533c7.101-7.055,7.101-18.492,0-25.546 c-7.1-7.054-18.613-7.054-25.714,0L58.989,111.689c-3.784,3.759-5.487,8.759-5.238,13.68c-0.249,4.922,1.454,9.921,5.238,13.681 l106.983,106.398c7.101,7.055,18.613,7.055,25.714,0c7.101-7.054,7.101-18.491,0-25.544L96.633,125.369z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n <div class=\"owl-dt-calendar-control-content\">\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-period-button\"\n type=\"button\"\n tabindex=\"0\"\n [attr.aria-label]=\"periodButtonLabel\"\n (click)=\"toggleViews()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{periodButtonText}}\n\n <span class=\"owl-dt-control-button-arrow\"\n [style.transform]=\"'rotate(' + (isMonthView? 0 : 180) +'deg)'\">\n <!-- <editor-fold desc=\"SVG Arrow\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n width=\"50%\"\n height=\"50%\"\n viewBox=\"0 0 292.362 292.362\"\n style=\"enable-background:new 0 0 292.362 292.362;\"\n xml:space=\"preserve\">\n <g>\n <path\n d=\"M286.935,69.377c-3.614-3.617-7.898-5.424-12.848-5.424H18.274c-4.952,0-9.233,1.807-12.85,5.424\n C1.807,72.998,0,77.279,0,82.228c0,4.948,1.807,9.229,5.424,12.847l127.907,127.907c3.621,3.617,7.902,5.428,12.85,5.428\n s9.233-1.811,12.847-5.428L286.935,95.074c3.613-3.617,5.427-7.898,5.427-12.847C292.362,77.279,290.548,72.998,286.935,69.377z\" />\n </g>\n </svg>\n <!-- </editor-fold> -->\n </span>\n </span>\n </button>\n </div>\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"0\"\n [style.visibility]=\"showControlArrows? 'visible': 'hidden'\"\n [disabled]=\"!nextButtonEnabled()\"\n [attr.aria-label]=\"nextButtonLabel\"\n (click)=\"nextClicked()\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Right\"> -->\n <svg version=\"1.1\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 250.738 250.738\"\n style=\"enable-background:new 0 0 250.738 250.738;\"\n xml:space=\"preserve\">\n <path style=\"fill-rule:evenodd;clip-rule:evenodd;\"\n d=\"M191.75,111.689L84.766,5.291c-7.1-7.055-18.613-7.055-25.713,0\n c-7.101,7.054-7.101,18.49,0,25.544l95.053,94.534l-95.053,94.533c-7.101,7.054-7.101,18.491,0,25.545\n c7.1,7.054,18.613,7.054,25.713,0L191.75,139.05c3.784-3.759,5.487-8.759,5.238-13.681\n C197.237,120.447,195.534,115.448,191.75,111.689z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n </button>\n</div>\n<div class=\"owl-dt-calendar-main\"\n cdkMonitorSubtreeFocus\n [ngSwitch]=\"currentView\"\n tabindex=\"-1\">\n <owl-date-time-month-view *ngSwitchCase=\"'month'\"\n [pickerMoment]=\"pickerMoment\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n [hideOtherMonths]=\"hideOtherMonths\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (selectedChange)=\"dateSelected($event)\"\n (userSelection)=\"userSelected()\"></owl-date-time-month-view>\n\n <owl-date-time-year-view *ngSwitchCase=\"'year'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (monthSelected)=\"selectMonthInYearView($event)\"\n (change)=\"goToDateInView($event, 'month')\"></owl-date-time-year-view>\n\n <owl-date-time-multi-year-view *ngSwitchCase=\"'multi-years'\"\n [pickerMoment]=\"pickerMoment\"\n [selected]=\"selected\"\n [selecteds]=\"selecteds\"\n [selectMode]=\"selectMode\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [dateFilter]=\"dateFilter\"\n (keyboardEnter)=\"focusActiveCell()\"\n (pickerMomentChange)=\"handlePickerMomentChange($event)\"\n (yearSelected)=\"selectYearInMultiYearView($event)\"\n (change)=\"goToDateInView($event, 'year')\"></owl-date-time-multi-year-view>\n</div>\n", styles: [""] }]
1762
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: OwlDateTimeIntl }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
1763
+ type: Optional
1764
+ }] }, { type: undefined, decorators: [{
1765
+ type: Optional
1766
+ }, {
1767
+ type: Inject,
1768
+ args: [OWL_DATE_TIME_FORMATS]
1769
+ }] }]; }, propDecorators: { dateFilter: [{
1770
+ type: Input
1771
+ }], firstDayOfWeek: [{
1772
+ type: Input
1773
+ }], minDate: [{
1774
+ type: Input
1775
+ }], maxDate: [{
1776
+ type: Input
1777
+ }], pickerMoment: [{
1778
+ type: Input
1779
+ }], selectMode: [{
1780
+ type: Input
1781
+ }], selected: [{
1782
+ type: Input
1783
+ }], selecteds: [{
1784
+ type: Input
1785
+ }], startView: [{
1786
+ type: Input
1787
+ }], hideOtherMonths: [{
1788
+ type: Input
1789
+ }], pickerMomentChange: [{
1790
+ type: Output
1791
+ }], selectedChange: [{
1792
+ type: Output
1793
+ }], userSelection: [{
1794
+ type: Output
1795
+ }], yearSelected: [{
1796
+ type: Output
1797
+ }], monthSelected: [{
1798
+ type: Output
1799
+ }], owlDTCalendarClass: [{
1800
+ type: HostBinding,
1801
+ args: ['class.owl-dt-calendar']
1802
+ }] } });
1758
1803
 
1759
1804
  let nextUniqueId = 0;
1760
1805
  class OwlDateTimeDirective {
@@ -1796,24 +1841,22 @@ class OwlDateTimeDirective {
1796
1841
  /**
1797
1842
  * Date Time Checker to check if the give dateTime is selectable
1798
1843
  */
1799
- this.dateTimeChecker = (dateTime) => {
1800
- return (!!dateTime &&
1801
- (!this.dateTimeFilter || this.dateTimeFilter(dateTime)) &&
1802
- (!this.minDateTime ||
1803
- this.dateTimeAdapter.compare(dateTime, this.minDateTime) >=
1804
- 0) &&
1805
- (!this.maxDateTime ||
1806
- this.dateTimeAdapter.compare(dateTime, this.maxDateTime) <= 0));
1807
- };
1844
+ this.dateTimeChecker = (dateTime) => (!!dateTime &&
1845
+ (!this.dateTimeFilter || this.dateTimeFilter(dateTime)) &&
1846
+ (!this.minDateTime ||
1847
+ this.dateTimeAdapter.compare(dateTime, this.minDateTime) >=
1848
+ 0) &&
1849
+ (!this.maxDateTime ||
1850
+ this.dateTimeAdapter.compare(dateTime, this.maxDateTime) <= 0));
1808
1851
  if (!this.dateTimeAdapter) {
1809
- throw Error(`OwlDateTimePicker: No provider found for DateTimeAdapter. You must import one of the following ` +
1810
- `modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ` +
1811
- `custom implementation.`);
1852
+ throw Error('OwlDateTimePicker: No provider found for DateTimeAdapter. You must import one of the following ' +
1853
+ 'modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ' +
1854
+ 'custom implementation.');
1812
1855
  }
1813
1856
  if (!this.dateTimeFormats) {
1814
- throw Error(`OwlDateTimePicker: No provider found for OWL_DATE_TIME_FORMATS. You must import one of the following ` +
1815
- `modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ` +
1816
- `custom implementation.`);
1857
+ throw Error('OwlDateTimePicker: No provider found for OWL_DATE_TIME_FORMATS. You must import one of the following ' +
1858
+ 'modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ' +
1859
+ 'custom implementation.');
1817
1860
  }
1818
1861
  this._id = `owl-dt-picker-${nextUniqueId++}`;
1819
1862
  }
@@ -1885,23 +1928,138 @@ class OwlDateTimeDirective {
1885
1928
  : null;
1886
1929
  }
1887
1930
  }
1888
- OwlDateTimeDirective.decorators = [
1889
- { type: Directive }
1890
- ];
1891
- OwlDateTimeDirective.ctorParameters = () => [
1892
- { type: DateTimeAdapter, decorators: [{ type: Optional }] },
1893
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [OWL_DATE_TIME_FORMATS,] }] }
1894
- ];
1895
- OwlDateTimeDirective.propDecorators = {
1896
- showSecondsTimer: [{ type: Input }],
1897
- hour12Timer: [{ type: Input }],
1898
- startView: [{ type: Input }],
1899
- stepHour: [{ type: Input }],
1900
- stepMinute: [{ type: Input }],
1901
- stepSecond: [{ type: Input }],
1902
- firstDayOfWeek: [{ type: Input }],
1903
- hideOtherMonths: [{ type: Input }]
1904
- };
1931
+ OwlDateTimeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeDirective, deps: [{ token: DateTimeAdapter, optional: true }, { token: OWL_DATE_TIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
1932
+ OwlDateTimeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: OwlDateTimeDirective, inputs: { showSecondsTimer: "showSecondsTimer", hour12Timer: "hour12Timer", startView: "startView", stepHour: "stepHour", stepMinute: "stepMinute", stepSecond: "stepSecond", firstDayOfWeek: "firstDayOfWeek", hideOtherMonths: "hideOtherMonths" }, ngImport: i0 });
1933
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeDirective, decorators: [{
1934
+ type: Directive
1935
+ }], ctorParameters: function () { return [{ type: DateTimeAdapter, decorators: [{
1936
+ type: Optional
1937
+ }] }, { type: undefined, decorators: [{
1938
+ type: Optional
1939
+ }, {
1940
+ type: Inject,
1941
+ args: [OWL_DATE_TIME_FORMATS]
1942
+ }] }]; }, propDecorators: { showSecondsTimer: [{
1943
+ type: Input
1944
+ }], hour12Timer: [{
1945
+ type: Input
1946
+ }], startView: [{
1947
+ type: Input
1948
+ }], stepHour: [{
1949
+ type: Input
1950
+ }], stepMinute: [{
1951
+ type: Input
1952
+ }], stepSecond: [{
1953
+ type: Input
1954
+ }], firstDayOfWeek: [{
1955
+ type: Input
1956
+ }], hideOtherMonths: [{
1957
+ type: Input
1958
+ }] } });
1959
+
1960
+ class NumberFixedLenPipe {
1961
+ transform(num, len) {
1962
+ const number = Math.floor(num);
1963
+ const length = Math.floor(len);
1964
+ if (num === null || isNaN(number) || isNaN(length)) {
1965
+ return num;
1966
+ }
1967
+ let numString = number.toString();
1968
+ while (numString.length < length) {
1969
+ numString = '0' + numString;
1970
+ }
1971
+ return numString;
1972
+ }
1973
+ }
1974
+ NumberFixedLenPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NumberFixedLenPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1975
+ NumberFixedLenPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NumberFixedLenPipe, name: "numberFixedLen" });
1976
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: NumberFixedLenPipe, decorators: [{
1977
+ type: Pipe,
1978
+ args: [{
1979
+ name: 'numberFixedLen'
1980
+ }]
1981
+ }] });
1982
+
1983
+ class OwlTimerBoxComponent {
1984
+ constructor() {
1985
+ this.showDivider = false;
1986
+ this.step = 1;
1987
+ this.valueChange = new EventEmitter();
1988
+ this.inputChange = new EventEmitter();
1989
+ this.inputStream = new Subject();
1990
+ this.inputStreamSub = Subscription.EMPTY;
1991
+ }
1992
+ get displayValue() {
1993
+ return this.boxValue || this.value;
1994
+ }
1995
+ get owlDTTimerBoxClass() {
1996
+ return true;
1997
+ }
1998
+ ngOnInit() {
1999
+ this.inputStreamSub = this.inputStream.pipe(debounceTime(500), distinctUntilChanged()).subscribe((val) => {
2000
+ if (val) {
2001
+ const inputValue = coerceNumberProperty(val, 0);
2002
+ this.updateValueViaInput(inputValue);
2003
+ }
2004
+ });
2005
+ }
2006
+ ngOnDestroy() {
2007
+ this.inputStreamSub.unsubscribe();
2008
+ }
2009
+ upBtnClicked() {
2010
+ this.updateValue(this.value + this.step);
2011
+ }
2012
+ downBtnClicked() {
2013
+ this.updateValue(this.value - this.step);
2014
+ }
2015
+ handleInputChange(val) {
2016
+ this.inputStream.next(val);
2017
+ }
2018
+ updateValue(value) {
2019
+ this.valueChange.emit(value);
2020
+ }
2021
+ updateValueViaInput(value) {
2022
+ if (value > this.max || value < this.min) {
2023
+ return;
2024
+ }
2025
+ this.inputChange.emit(value);
2026
+ }
2027
+ }
2028
+ OwlTimerBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlTimerBoxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2029
+ OwlTimerBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlTimerBoxComponent, selector: "owl-date-time-timer-box", inputs: { showDivider: "showDivider", upBtnAriaLabel: "upBtnAriaLabel", upBtnDisabled: "upBtnDisabled", downBtnAriaLabel: "downBtnAriaLabel", downBtnDisabled: "downBtnDisabled", boxValue: "boxValue", value: "value", min: "min", max: "max", step: "step", inputLabel: "inputLabel" }, outputs: { valueChange: "valueChange", inputChange: "inputChange" }, host: { properties: { "class.owl-dt-timer-box": "this.owlDTTimerBoxClass" } }, exportAs: ["owlDateTimeTimerBox"], ngImport: i0, template: "<div *ngIf=\"showDivider\"\n class=\"owl-dt-timer-divider\"\n aria-hidden=\"true\"></div>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"upBtnDisabled\"\n [attr.aria-label]=\"upBtnAriaLabel\"\n (click)=\"upBtnClicked()\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Up\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path d=\"M248.292,106.406l194.281,194.29c12.365,12.359,12.365,32.391,0,44.744c-12.354,12.354-32.391,12.354-44.744,0\n L225.923,173.529L54.018,345.44c-12.36,12.354-32.395,12.354-44.748,0c-12.359-12.354-12.359-32.391,0-44.75L203.554,106.4\n c6.18-6.174,14.271-9.259,22.369-9.259C234.018,97.141,242.115,100.232,248.292,106.406z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<label class=\"owl-dt-timer-content\">\n <input class=\"owl-dt-timer-input\"\n maxlength=\"2\"\n [value]=\"displayValue | numberFixedLen : 2\"\n (input)=\"handleInputChange(valueInput.value)\"\n #valueInput>\n <span class=\"owl-hidden-accessible\">{{inputLabel}}</span>\n</label>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"downBtnDisabled\"\n [attr.aria-label]=\"downBtnAriaLabel\"\n (click)=\"downBtnClicked()\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Down\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path\n d=\"M225.923,354.706c-8.098,0-16.195-3.092-22.369-9.263L9.27,151.157c-12.359-12.359-12.359-32.397,0-44.751\n c12.354-12.354,32.388-12.354,44.748,0l171.905,171.915l171.906-171.909c12.359-12.354,32.391-12.354,44.744,0\n c12.365,12.354,12.365,32.392,0,44.751L248.292,345.449C242.115,351.621,234.018,354.706,225.923,354.706z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n", styles: [""], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "numberFixedLen": NumberFixedLenPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2030
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlTimerBoxComponent, decorators: [{
2031
+ type: Component,
2032
+ args: [{ exportAs: 'owlDateTimeTimerBox', selector: 'owl-date-time-timer-box', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf=\"showDivider\"\n class=\"owl-dt-timer-divider\"\n aria-hidden=\"true\"></div>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"upBtnDisabled\"\n [attr.aria-label]=\"upBtnAriaLabel\"\n (click)=\"upBtnClicked()\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Up\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path d=\"M248.292,106.406l194.281,194.29c12.365,12.359,12.365,32.391,0,44.744c-12.354,12.354-32.391,12.354-44.744,0\n L225.923,173.529L54.018,345.44c-12.36,12.354-32.395,12.354-44.748,0c-12.359-12.354-12.359-32.391,0-44.75L203.554,106.4\n c6.18-6.174,14.271-9.259,22.369-9.259C234.018,97.141,242.115,100.232,248.292,106.406z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<label class=\"owl-dt-timer-content\">\n <input class=\"owl-dt-timer-input\"\n maxlength=\"2\"\n [value]=\"displayValue | numberFixedLen : 2\"\n (input)=\"handleInputChange(valueInput.value)\"\n #valueInput>\n <span class=\"owl-hidden-accessible\">{{inputLabel}}</span>\n</label>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"downBtnDisabled\"\n [attr.aria-label]=\"downBtnAriaLabel\"\n (click)=\"downBtnClicked()\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Down\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path\n d=\"M225.923,354.706c-8.098,0-16.195-3.092-22.369-9.263L9.27,151.157c-12.359-12.359-12.359-32.397,0-44.751\n c12.354-12.354,32.388-12.354,44.748,0l171.905,171.915l171.906-171.909c12.359-12.354,32.391-12.354,44.744,0\n c12.365,12.354,12.365,32.392,0,44.751L248.292,345.449C242.115,351.621,234.018,354.706,225.923,354.706z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n", styles: [""] }]
2033
+ }], ctorParameters: function () { return []; }, propDecorators: { showDivider: [{
2034
+ type: Input
2035
+ }], upBtnAriaLabel: [{
2036
+ type: Input
2037
+ }], upBtnDisabled: [{
2038
+ type: Input
2039
+ }], downBtnAriaLabel: [{
2040
+ type: Input
2041
+ }], downBtnDisabled: [{
2042
+ type: Input
2043
+ }], boxValue: [{
2044
+ type: Input
2045
+ }], value: [{
2046
+ type: Input
2047
+ }], min: [{
2048
+ type: Input
2049
+ }], max: [{
2050
+ type: Input
2051
+ }], step: [{
2052
+ type: Input
2053
+ }], inputLabel: [{
2054
+ type: Input
2055
+ }], valueChange: [{
2056
+ type: Output
2057
+ }], inputChange: [{
2058
+ type: Output
2059
+ }], owlDTTimerBoxClass: [{
2060
+ type: HostBinding,
2061
+ args: ['class.owl-dt-timer-box']
2062
+ }] } });
1905
2063
 
1906
2064
  class OwlTimerComponent {
1907
2065
  constructor(ngZone, elmRef, pickerIntl, cdRef, dateTimeAdapter) {
@@ -2155,36 +2313,38 @@ class OwlTimerComponent {
2155
2313
  : null;
2156
2314
  }
2157
2315
  }
2158
- OwlTimerComponent.decorators = [
2159
- { type: Component, args: [{
2160
- exportAs: 'owlDateTimeTimer',
2161
- selector: 'owl-date-time-timer',
2162
- template: "<owl-date-time-timer-box [upBtnAriaLabel]=\"upHourButtonLabel\"\n [downBtnAriaLabel]=\"downHourButtonLabel\"\n [upBtnDisabled]=\"!upHourEnabled()\"\n [downBtnDisabled]=\"!downHourEnabled()\"\n [boxValue]=\"hourBoxValue\"\n [value]=\"hourValue\"\n [min]=\"0\"\n [max]=\"23\"\n [step]=\"stepHour\"\n [inputLabel]=\"'Hour'\"\n (inputChange)=\"setHourValueViaInput($event)\"\n (valueChange)=\"setHourValue($event)\"></owl-date-time-timer-box>\n<owl-date-time-timer-box [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upMinuteButtonLabel\"\n [downBtnAriaLabel]=\"downMinuteButtonLabel\"\n [upBtnDisabled]=\"!upMinuteEnabled()\"\n [downBtnDisabled]=\"!downMinuteEnabled()\"\n [value]=\"minuteValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepMinute\"\n [inputLabel]=\"'Minute'\"\n (inputChange)=\"setMinuteValue($event)\"\n (valueChange)=\"setMinuteValue($event)\"></owl-date-time-timer-box>\n<owl-date-time-timer-box *ngIf=\"showSecondsTimer\"\n [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upSecondButtonLabel\"\n [downBtnAriaLabel]=\"downSecondButtonLabel\"\n [upBtnDisabled]=\"!upSecondEnabled()\"\n [downBtnDisabled]=\"!downSecondEnabled()\"\n [value]=\"secondValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepSecond\"\n [inputLabel]=\"'Second'\"\n (inputChange)=\"setSecondValue($event)\"\n (valueChange)=\"setSecondValue($event)\"></owl-date-time-timer-box>\n\n<div *ngIf=\"hour12Timer\"\n class=\"owl-dt-timer-hour12\">\n <button class=\"owl-dt-control-button owl-dt-timer-hour12-box\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"setMeridiem($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{hour12ButtonLabel}}\n </span>\n </button>\n</div>\n",
2163
- preserveWhitespaces: false,
2164
- changeDetection: ChangeDetectionStrategy.OnPush,
2165
- styles: [""]
2166
- },] }
2167
- ];
2168
- OwlTimerComponent.ctorParameters = () => [
2169
- { type: NgZone },
2170
- { type: ElementRef },
2171
- { type: OwlDateTimeIntl },
2172
- { type: ChangeDetectorRef },
2173
- { type: DateTimeAdapter, decorators: [{ type: Optional }] }
2174
- ];
2175
- OwlTimerComponent.propDecorators = {
2176
- pickerMoment: [{ type: Input }],
2177
- minDateTime: [{ type: Input }],
2178
- maxDateTime: [{ type: Input }],
2179
- showSecondsTimer: [{ type: Input }],
2180
- hour12Timer: [{ type: Input }],
2181
- stepHour: [{ type: Input }],
2182
- stepMinute: [{ type: Input }],
2183
- stepSecond: [{ type: Input }],
2184
- selectedChange: [{ type: Output }],
2185
- owlDTTimerClass: [{ type: HostBinding, args: ['class.owl-dt-timer',] }],
2186
- owlDTTimeTabIndex: [{ type: HostBinding, args: ['attr.tabindex',] }]
2187
- };
2316
+ OwlTimerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlTimerComponent, deps: [{ token: i0.NgZone }, { token: i0.ElementRef }, { token: OwlDateTimeIntl }, { token: i0.ChangeDetectorRef }, { token: DateTimeAdapter, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2317
+ OwlTimerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlTimerComponent, selector: "owl-date-time-timer", inputs: { pickerMoment: "pickerMoment", minDateTime: "minDateTime", maxDateTime: "maxDateTime", showSecondsTimer: "showSecondsTimer", hour12Timer: "hour12Timer", stepHour: "stepHour", stepMinute: "stepMinute", stepSecond: "stepSecond" }, outputs: { selectedChange: "selectedChange" }, host: { properties: { "class.owl-dt-timer": "this.owlDTTimerClass", "attr.tabindex": "this.owlDTTimeTabIndex" } }, exportAs: ["owlDateTimeTimer"], ngImport: i0, template: "<owl-date-time-timer-box [upBtnAriaLabel]=\"upHourButtonLabel\"\n [downBtnAriaLabel]=\"downHourButtonLabel\"\n [upBtnDisabled]=\"!upHourEnabled()\"\n [downBtnDisabled]=\"!downHourEnabled()\"\n [boxValue]=\"hourBoxValue\"\n [value]=\"hourValue\"\n [min]=\"0\"\n [max]=\"23\"\n [step]=\"stepHour\"\n [inputLabel]=\"'Hour'\"\n (inputChange)=\"setHourValueViaInput($event)\"\n (valueChange)=\"setHourValue($event)\"></owl-date-time-timer-box>\n<owl-date-time-timer-box [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upMinuteButtonLabel\"\n [downBtnAriaLabel]=\"downMinuteButtonLabel\"\n [upBtnDisabled]=\"!upMinuteEnabled()\"\n [downBtnDisabled]=\"!downMinuteEnabled()\"\n [value]=\"minuteValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepMinute\"\n [inputLabel]=\"'Minute'\"\n (inputChange)=\"setMinuteValue($event)\"\n (valueChange)=\"setMinuteValue($event)\"></owl-date-time-timer-box>\n<owl-date-time-timer-box *ngIf=\"showSecondsTimer\"\n [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upSecondButtonLabel\"\n [downBtnAriaLabel]=\"downSecondButtonLabel\"\n [upBtnDisabled]=\"!upSecondEnabled()\"\n [downBtnDisabled]=\"!downSecondEnabled()\"\n [value]=\"secondValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepSecond\"\n [inputLabel]=\"'Second'\"\n (inputChange)=\"setSecondValue($event)\"\n (valueChange)=\"setSecondValue($event)\"></owl-date-time-timer-box>\n\n<div *ngIf=\"hour12Timer\"\n class=\"owl-dt-timer-hour12\">\n <button class=\"owl-dt-control-button owl-dt-timer-hour12-box\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"setMeridiem($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{hour12ButtonLabel}}\n </span>\n </button>\n</div>\n", styles: [""], components: [{ type: OwlTimerBoxComponent, selector: "owl-date-time-timer-box", inputs: ["showDivider", "upBtnAriaLabel", "upBtnDisabled", "downBtnAriaLabel", "downBtnDisabled", "boxValue", "value", "min", "max", "step", "inputLabel"], outputs: ["valueChange", "inputChange"], exportAs: ["owlDateTimeTimerBox"] }], directives: [{ type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlTimerComponent, decorators: [{
2319
+ type: Component,
2320
+ args: [{ exportAs: 'owlDateTimeTimer', selector: 'owl-date-time-timer', preserveWhitespaces: false, changeDetection: ChangeDetectionStrategy.OnPush, template: "<owl-date-time-timer-box [upBtnAriaLabel]=\"upHourButtonLabel\"\n [downBtnAriaLabel]=\"downHourButtonLabel\"\n [upBtnDisabled]=\"!upHourEnabled()\"\n [downBtnDisabled]=\"!downHourEnabled()\"\n [boxValue]=\"hourBoxValue\"\n [value]=\"hourValue\"\n [min]=\"0\"\n [max]=\"23\"\n [step]=\"stepHour\"\n [inputLabel]=\"'Hour'\"\n (inputChange)=\"setHourValueViaInput($event)\"\n (valueChange)=\"setHourValue($event)\"></owl-date-time-timer-box>\n<owl-date-time-timer-box [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upMinuteButtonLabel\"\n [downBtnAriaLabel]=\"downMinuteButtonLabel\"\n [upBtnDisabled]=\"!upMinuteEnabled()\"\n [downBtnDisabled]=\"!downMinuteEnabled()\"\n [value]=\"minuteValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepMinute\"\n [inputLabel]=\"'Minute'\"\n (inputChange)=\"setMinuteValue($event)\"\n (valueChange)=\"setMinuteValue($event)\"></owl-date-time-timer-box>\n<owl-date-time-timer-box *ngIf=\"showSecondsTimer\"\n [showDivider]=\"true\"\n [upBtnAriaLabel]=\"upSecondButtonLabel\"\n [downBtnAriaLabel]=\"downSecondButtonLabel\"\n [upBtnDisabled]=\"!upSecondEnabled()\"\n [downBtnDisabled]=\"!downSecondEnabled()\"\n [value]=\"secondValue\"\n [min]=\"0\"\n [max]=\"59\"\n [step]=\"stepSecond\"\n [inputLabel]=\"'Second'\"\n (inputChange)=\"setSecondValue($event)\"\n (valueChange)=\"setSecondValue($event)\"></owl-date-time-timer-box>\n\n<div *ngIf=\"hour12Timer\"\n class=\"owl-dt-timer-hour12\">\n <button class=\"owl-dt-control-button owl-dt-timer-hour12-box\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"setMeridiem($event)\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{hour12ButtonLabel}}\n </span>\n </button>\n</div>\n", styles: [""] }]
2321
+ }], ctorParameters: function () { return [{ type: i0.NgZone }, { type: i0.ElementRef }, { type: OwlDateTimeIntl }, { type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
2322
+ type: Optional
2323
+ }] }]; }, propDecorators: { pickerMoment: [{
2324
+ type: Input
2325
+ }], minDateTime: [{
2326
+ type: Input
2327
+ }], maxDateTime: [{
2328
+ type: Input
2329
+ }], showSecondsTimer: [{
2330
+ type: Input
2331
+ }], hour12Timer: [{
2332
+ type: Input
2333
+ }], stepHour: [{
2334
+ type: Input
2335
+ }], stepMinute: [{
2336
+ type: Input
2337
+ }], stepSecond: [{
2338
+ type: Input
2339
+ }], selectedChange: [{
2340
+ type: Output
2341
+ }], owlDTTimerClass: [{
2342
+ type: HostBinding,
2343
+ args: ['class.owl-dt-timer']
2344
+ }], owlDTTimeTabIndex: [{
2345
+ type: HostBinding,
2346
+ args: ['attr.tabindex']
2347
+ }] } });
2188
2348
 
2189
2349
  const owlDateTimePickerAnimations = {
2190
2350
  transformPicker: trigger('transformPicker', [
@@ -2535,40 +2695,52 @@ class OwlDateTimeContainerComponent {
2535
2695
  }
2536
2696
  }
2537
2697
  }
2538
- OwlDateTimeContainerComponent.decorators = [
2539
- { type: Component, args: [{
2540
- exportAs: 'owlDateTimeContainer',
2541
- selector: 'owl-date-time-container',
2542
- template: "<div [cdkTrapFocus]=\"picker?.pickerMode !== 'inline'\"\n [@fadeInPicker]=\"picker?.pickerMode === 'inline'? '' : 'enter'\"\n class=\"owl-dt-container-inner\">\n\n <owl-date-time-calendar *ngIf=\"pickerType === 'both' || pickerType === 'calendar'\"\n class=\"owl-dt-container-row\"\n [firstDayOfWeek]=\"picker?.firstDayOfWeek\"\n [(pickerMoment)]=\"pickerMoment\"\n [selected]=\"picker?.selected\"\n [selecteds]=\"picker?.selecteds\"\n [selectMode]=\"picker?.selectMode\"\n [minDate]=\"picker?.minDateTime\"\n [maxDate]=\"picker?.maxDateTime\"\n [dateFilter]=\"picker?.dateTimeFilter\"\n [startView]=\"picker?.startView\"\n [hideOtherMonths]=\"picker?.hideOtherMonths\"\n (yearSelected)=\"picker?.selectYear($event)\"\n (monthSelected)=\"picker?.selectMonth($event)\"\n (selectedChange)=\"dateSelected($event)\"></owl-date-time-calendar>\n\n <owl-date-time-timer *ngIf=\"pickerType === 'both' || pickerType === 'timer'\"\n class=\"owl-dt-container-row\"\n [pickerMoment]=\"pickerMoment\"\n [minDateTime]=\"picker?.minDateTime\"\n [maxDateTime]=\"picker?.maxDateTime\"\n [showSecondsTimer]=\"picker?.showSecondsTimer\"\n [hour12Timer]=\"picker?.hour12Timer\"\n [stepHour]=\"picker?.stepHour\"\n [stepMinute]=\"picker?.stepMinute\"\n [stepSecond]=\"picker?.stepSecond\"\n (selectedChange)=\"timeSelected($event)\"></owl-date-time-timer>\n\n <div *ngIf=\"picker?.isInRangeMode\"\n role=\"radiogroup\"\n class=\"owl-dt-container-info owl-dt-container-row\">\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 0 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 0\"\n class=\"owl-dt-control owl-dt-container-range owl-dt-container-from\"\n [ngClass]=\"{'owl-dt-container-info-active': activeSelectedIndex === 0}\"\n (click)=\"handleClickOnInfoGroup($event, 0)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, to, 0)\"\n #from>\n <span class=\"owl-dt-control-content owl-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"owl-dt-container-info-label\">{{fromLabel}}:</span>\n <span class=\"owl-dt-container-info-value\">{{fromFormattedValue}}</span>\n </span>\n </div>\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 1 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 1\"\n class=\"owl-dt-control owl-dt-container-range owl-dt-container-to\"\n [ngClass]=\"{'owl-dt-container-info-active': activeSelectedIndex === 1}\"\n (click)=\"handleClickOnInfoGroup($event, 1)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, from, 1)\"\n #to>\n <span class=\"owl-dt-control-content owl-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"owl-dt-container-info-label\">{{toLabel}}:</span>\n <span class=\"owl-dt-container-info-value\">{{toFormattedValue}}</span>\n </span>\n </div>\n </div>\n\n <div *ngIf=\"showControlButtons\"\n class=\"owl-dt-container-buttons owl-dt-container-row\">\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onCancelClicked($event)\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{cancelLabel}}\n </span>\n </button>\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onSetClicked($event)\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{setLabel}}\n </span>\n </button>\n </div>\n</div>\n",
2543
- changeDetection: ChangeDetectionStrategy.OnPush,
2544
- preserveWhitespaces: false,
2545
- animations: [
2546
- owlDateTimePickerAnimations.transformPicker,
2547
- owlDateTimePickerAnimations.fadeInPicker
2548
- ],
2549
- styles: [""]
2550
- },] }
2551
- ];
2552
- OwlDateTimeContainerComponent.ctorParameters = () => [
2553
- { type: ChangeDetectorRef },
2554
- { type: ElementRef },
2555
- { type: OwlDateTimeIntl },
2556
- { type: DateTimeAdapter, decorators: [{ type: Optional }] }
2557
- ];
2558
- OwlDateTimeContainerComponent.propDecorators = {
2559
- calendar: [{ type: ViewChild, args: [OwlCalendarComponent,] }],
2560
- timer: [{ type: ViewChild, args: [OwlTimerComponent,] }],
2561
- owlDTContainerClass: [{ type: HostBinding, args: ['class.owl-dt-container',] }],
2562
- owlDTPopupContainerClass: [{ type: HostBinding, args: ['class.owl-dt-popup-container',] }],
2563
- owlDTDialogContainerClass: [{ type: HostBinding, args: ['class.owl-dt-dialog-container',] }],
2564
- owlDTInlineContainerClass: [{ type: HostBinding, args: ['class.owl-dt-inline-container',] }],
2565
- owlDTContainerDisabledClass: [{ type: HostBinding, args: ['class.owl-dt-container-disabled',] }],
2566
- owlDTContainerId: [{ type: HostBinding, args: ['attr.id',] }],
2567
- owlDTContainerAnimation: [{ type: HostBinding, args: ['@transformPicker',] }],
2568
- handleContainerAnimationDone: [{ type: HostListener, args: ['@transformPicker.done', ['$event'],] }]
2569
- };
2698
+ OwlDateTimeContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeContainerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: OwlDateTimeIntl }, { token: DateTimeAdapter, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2699
+ OwlDateTimeContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlDateTimeContainerComponent, selector: "owl-date-time-container", host: { listeners: { "@transformPicker.done": "handleContainerAnimationDone($event)" }, properties: { "class.owl-dt-container": "this.owlDTContainerClass", "class.owl-dt-popup-container": "this.owlDTPopupContainerClass", "class.owl-dt-dialog-container": "this.owlDTDialogContainerClass", "class.owl-dt-inline-container": "this.owlDTInlineContainerClass", "class.owl-dt-container-disabled": "this.owlDTContainerDisabledClass", "attr.id": "this.owlDTContainerId", "@transformPicker": "this.owlDTContainerAnimation" } }, viewQueries: [{ propertyName: "calendar", first: true, predicate: OwlCalendarComponent, descendants: true }, { propertyName: "timer", first: true, predicate: OwlTimerComponent, descendants: true }], exportAs: ["owlDateTimeContainer"], ngImport: i0, template: "<div [cdkTrapFocus]=\"picker?.pickerMode !== 'inline'\"\n [@fadeInPicker]=\"picker?.pickerMode === 'inline'? '' : 'enter'\"\n class=\"owl-dt-container-inner\">\n\n <owl-date-time-calendar *ngIf=\"pickerType === 'both' || pickerType === 'calendar'\"\n class=\"owl-dt-container-row\"\n [firstDayOfWeek]=\"picker?.firstDayOfWeek\"\n [(pickerMoment)]=\"pickerMoment\"\n [selected]=\"picker?.selected\"\n [selecteds]=\"picker?.selecteds\"\n [selectMode]=\"picker?.selectMode\"\n [minDate]=\"picker?.minDateTime\"\n [maxDate]=\"picker?.maxDateTime\"\n [dateFilter]=\"picker?.dateTimeFilter\"\n [startView]=\"picker?.startView\"\n [hideOtherMonths]=\"picker?.hideOtherMonths\"\n (yearSelected)=\"picker?.selectYear($event)\"\n (monthSelected)=\"picker?.selectMonth($event)\"\n (selectedChange)=\"dateSelected($event)\"></owl-date-time-calendar>\n\n <owl-date-time-timer *ngIf=\"pickerType === 'both' || pickerType === 'timer'\"\n class=\"owl-dt-container-row\"\n [pickerMoment]=\"pickerMoment\"\n [minDateTime]=\"picker?.minDateTime\"\n [maxDateTime]=\"picker?.maxDateTime\"\n [showSecondsTimer]=\"picker?.showSecondsTimer\"\n [hour12Timer]=\"picker?.hour12Timer\"\n [stepHour]=\"picker?.stepHour\"\n [stepMinute]=\"picker?.stepMinute\"\n [stepSecond]=\"picker?.stepSecond\"\n (selectedChange)=\"timeSelected($event)\"></owl-date-time-timer>\n\n <div *ngIf=\"picker?.isInRangeMode\"\n role=\"radiogroup\"\n class=\"owl-dt-container-info owl-dt-container-row\">\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 0 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 0\"\n class=\"owl-dt-control owl-dt-container-range owl-dt-container-from\"\n [ngClass]=\"{'owl-dt-container-info-active': activeSelectedIndex === 0}\"\n (click)=\"handleClickOnInfoGroup($event, 0)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, to, 0)\"\n #from>\n <span class=\"owl-dt-control-content owl-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"owl-dt-container-info-label\">{{fromLabel}}:</span>\n <span class=\"owl-dt-container-info-value\">{{fromFormattedValue}}</span>\n </span>\n </div>\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 1 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 1\"\n class=\"owl-dt-control owl-dt-container-range owl-dt-container-to\"\n [ngClass]=\"{'owl-dt-container-info-active': activeSelectedIndex === 1}\"\n (click)=\"handleClickOnInfoGroup($event, 1)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, from, 1)\"\n #to>\n <span class=\"owl-dt-control-content owl-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"owl-dt-container-info-label\">{{toLabel}}:</span>\n <span class=\"owl-dt-container-info-value\">{{toFormattedValue}}</span>\n </span>\n </div>\n </div>\n\n <div *ngIf=\"showControlButtons\"\n class=\"owl-dt-container-buttons owl-dt-container-row\">\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onCancelClicked($event)\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{cancelLabel}}\n </span>\n </button>\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onSetClicked($event)\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{setLabel}}\n </span>\n </button>\n </div>\n</div>\n", styles: [""], components: [{ type: OwlCalendarComponent, selector: "owl-date-time-calendar", inputs: ["dateFilter", "firstDayOfWeek", "minDate", "maxDate", "pickerMoment", "selectMode", "selected", "selecteds", "startView", "hideOtherMonths"], outputs: ["pickerMomentChange", "selectedChange", "userSelection", "yearSelected", "monthSelected"], exportAs: ["owlDateTimeCalendar"] }, { type: OwlTimerComponent, selector: "owl-date-time-timer", inputs: ["pickerMoment", "minDateTime", "maxDateTime", "showSecondsTimer", "hour12Timer", "stepHour", "stepMinute", "stepSecond"], outputs: ["selectedChange"], exportAs: ["owlDateTimeTimer"] }], directives: [{ type: i1$1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [
2700
+ owlDateTimePickerAnimations.transformPicker,
2701
+ owlDateTimePickerAnimations.fadeInPicker
2702
+ ], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2703
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeContainerComponent, decorators: [{
2704
+ type: Component,
2705
+ args: [{ exportAs: 'owlDateTimeContainer', selector: 'owl-date-time-container', changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, animations: [
2706
+ owlDateTimePickerAnimations.transformPicker,
2707
+ owlDateTimePickerAnimations.fadeInPicker
2708
+ ], template: "<div [cdkTrapFocus]=\"picker?.pickerMode !== 'inline'\"\n [@fadeInPicker]=\"picker?.pickerMode === 'inline'? '' : 'enter'\"\n class=\"owl-dt-container-inner\">\n\n <owl-date-time-calendar *ngIf=\"pickerType === 'both' || pickerType === 'calendar'\"\n class=\"owl-dt-container-row\"\n [firstDayOfWeek]=\"picker?.firstDayOfWeek\"\n [(pickerMoment)]=\"pickerMoment\"\n [selected]=\"picker?.selected\"\n [selecteds]=\"picker?.selecteds\"\n [selectMode]=\"picker?.selectMode\"\n [minDate]=\"picker?.minDateTime\"\n [maxDate]=\"picker?.maxDateTime\"\n [dateFilter]=\"picker?.dateTimeFilter\"\n [startView]=\"picker?.startView\"\n [hideOtherMonths]=\"picker?.hideOtherMonths\"\n (yearSelected)=\"picker?.selectYear($event)\"\n (monthSelected)=\"picker?.selectMonth($event)\"\n (selectedChange)=\"dateSelected($event)\"></owl-date-time-calendar>\n\n <owl-date-time-timer *ngIf=\"pickerType === 'both' || pickerType === 'timer'\"\n class=\"owl-dt-container-row\"\n [pickerMoment]=\"pickerMoment\"\n [minDateTime]=\"picker?.minDateTime\"\n [maxDateTime]=\"picker?.maxDateTime\"\n [showSecondsTimer]=\"picker?.showSecondsTimer\"\n [hour12Timer]=\"picker?.hour12Timer\"\n [stepHour]=\"picker?.stepHour\"\n [stepMinute]=\"picker?.stepMinute\"\n [stepSecond]=\"picker?.stepSecond\"\n (selectedChange)=\"timeSelected($event)\"></owl-date-time-timer>\n\n <div *ngIf=\"picker?.isInRangeMode\"\n role=\"radiogroup\"\n class=\"owl-dt-container-info owl-dt-container-row\">\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 0 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 0\"\n class=\"owl-dt-control owl-dt-container-range owl-dt-container-from\"\n [ngClass]=\"{'owl-dt-container-info-active': activeSelectedIndex === 0}\"\n (click)=\"handleClickOnInfoGroup($event, 0)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, to, 0)\"\n #from>\n <span class=\"owl-dt-control-content owl-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"owl-dt-container-info-label\">{{fromLabel}}:</span>\n <span class=\"owl-dt-container-info-value\">{{fromFormattedValue}}</span>\n </span>\n </div>\n <div role=\"radio\"\n [tabindex]=\"activeSelectedIndex === 1 ? 0 : -1\"\n [attr.aria-checked]=\"activeSelectedIndex === 1\"\n class=\"owl-dt-control owl-dt-container-range owl-dt-container-to\"\n [ngClass]=\"{'owl-dt-container-info-active': activeSelectedIndex === 1}\"\n (click)=\"handleClickOnInfoGroup($event, 1)\"\n (keydown)=\"handleKeydownOnInfoGroup($event, from, 1)\"\n #to>\n <span class=\"owl-dt-control-content owl-dt-container-range-content\"\n tabindex=\"-1\">\n <span class=\"owl-dt-container-info-label\">{{toLabel}}:</span>\n <span class=\"owl-dt-container-info-value\">{{toFormattedValue}}</span>\n </span>\n </div>\n </div>\n\n <div *ngIf=\"showControlButtons\"\n class=\"owl-dt-container-buttons owl-dt-container-row\">\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onCancelClicked($event)\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{cancelLabel}}\n </span>\n </button>\n <button class=\"owl-dt-control owl-dt-control-button owl-dt-container-control-button\"\n type=\"button\"\n tabindex=\"0\"\n (click)=\"onSetClicked($event)\">\n <span class=\"owl-dt-control-content owl-dt-control-button-content\"\n tabindex=\"-1\">\n {{setLabel}}\n </span>\n </button>\n </div>\n</div>\n", styles: [""] }]
2709
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: OwlDateTimeIntl }, { type: DateTimeAdapter, decorators: [{
2710
+ type: Optional
2711
+ }] }]; }, propDecorators: { calendar: [{
2712
+ type: ViewChild,
2713
+ args: [OwlCalendarComponent]
2714
+ }], timer: [{
2715
+ type: ViewChild,
2716
+ args: [OwlTimerComponent]
2717
+ }], owlDTContainerClass: [{
2718
+ type: HostBinding,
2719
+ args: ['class.owl-dt-container']
2720
+ }], owlDTPopupContainerClass: [{
2721
+ type: HostBinding,
2722
+ args: ['class.owl-dt-popup-container']
2723
+ }], owlDTDialogContainerClass: [{
2724
+ type: HostBinding,
2725
+ args: ['class.owl-dt-dialog-container']
2726
+ }], owlDTInlineContainerClass: [{
2727
+ type: HostBinding,
2728
+ args: ['class.owl-dt-inline-container']
2729
+ }], owlDTContainerDisabledClass: [{
2730
+ type: HostBinding,
2731
+ args: ['class.owl-dt-container-disabled']
2732
+ }], owlDTContainerId: [{
2733
+ type: HostBinding,
2734
+ args: ['attr.id']
2735
+ }], owlDTContainerAnimation: [{
2736
+ type: HostBinding,
2737
+ args: ['@transformPicker']
2738
+ }], handleContainerAnimationDone: [{
2739
+ type: HostListener,
2740
+ args: ['@transformPicker.done', ['$event']]
2741
+ }] } });
2570
2742
 
2571
- const OWL_DATETIME_VALUE_ACCESSOR = {
2743
+ const OWL_DATETIME_VALUE_ACCESSOR$1 = {
2572
2744
  provide: NG_VALUE_ACCESSOR,
2573
2745
  useExisting: forwardRef(() => OwlDateTimeInlineComponent),
2574
2746
  multi: true
@@ -2659,6 +2831,7 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
2659
2831
  get minDateTime() {
2660
2832
  return this._min || null;
2661
2833
  }
2834
+ // eslint-disable-next-line @angular-eslint/no-input-rename
2662
2835
  set minDateTime(value) {
2663
2836
  this._min = this.getValidDate(this.dateTimeAdapter.deserialize(value));
2664
2837
  this.changeDetector.markForCheck();
@@ -2666,6 +2839,7 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
2666
2839
  get maxDateTime() {
2667
2840
  return this._max || null;
2668
2841
  }
2842
+ // eslint-disable-next-line @angular-eslint/no-input-rename
2669
2843
  set maxDateTime(value) {
2670
2844
  this._max = this.getValidDate(this.dateTimeAdapter.deserialize(value));
2671
2845
  this.changeDetector.markForCheck();
@@ -2776,1935 +2950,2001 @@ class OwlDateTimeInlineComponent extends OwlDateTimeDirective {
2776
2950
  this.monthSelected.emit(normalizedMonth);
2777
2951
  }
2778
2952
  }
2779
- OwlDateTimeInlineComponent.decorators = [
2780
- { type: Component, args: [{
2781
- selector: 'owl-date-time-inline',
2782
- template: "<owl-date-time-container></owl-date-time-container>\n",
2783
- changeDetection: ChangeDetectionStrategy.OnPush,
2784
- preserveWhitespaces: false,
2785
- providers: [OWL_DATETIME_VALUE_ACCESSOR],
2786
- styles: [""]
2787
- },] }
2788
- ];
2789
- OwlDateTimeInlineComponent.ctorParameters = () => [
2790
- { type: ChangeDetectorRef },
2791
- { type: DateTimeAdapter, decorators: [{ type: Optional }] },
2792
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [OWL_DATE_TIME_FORMATS,] }] }
2793
- ];
2794
- OwlDateTimeInlineComponent.propDecorators = {
2795
- container: [{ type: ViewChild, args: [OwlDateTimeContainerComponent, { static: true },] }],
2796
- pickerType: [{ type: Input }],
2797
- disabled: [{ type: Input }],
2798
- selectMode: [{ type: Input }],
2799
- startAt: [{ type: Input }],
2800
- dateTimeFilter: [{ type: Input, args: ['owlDateTimeFilter',] }],
2801
- minDateTime: [{ type: Input, args: ['min',] }],
2802
- maxDateTime: [{ type: Input, args: ['max',] }],
2803
- value: [{ type: Input }],
2804
- values: [{ type: Input }],
2805
- yearSelected: [{ type: Output }],
2806
- monthSelected: [{ type: Output }],
2807
- owlDTInlineClass: [{ type: HostBinding, args: ['class.owl-dt-inline',] }]
2808
- };
2953
+ OwlDateTimeInlineComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeInlineComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: DateTimeAdapter, optional: true }, { token: OWL_DATE_TIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Component });
2954
+ OwlDateTimeInlineComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlDateTimeInlineComponent, selector: "owl-date-time-inline", inputs: { pickerType: "pickerType", disabled: "disabled", selectMode: "selectMode", startAt: "startAt", dateTimeFilter: ["owlDateTimeFilter", "dateTimeFilter"], minDateTime: ["min", "minDateTime"], maxDateTime: ["max", "maxDateTime"], value: "value", values: "values" }, outputs: { yearSelected: "yearSelected", monthSelected: "monthSelected" }, host: { properties: { "class.owl-dt-inline": "this.owlDTInlineClass" } }, providers: [OWL_DATETIME_VALUE_ACCESSOR$1], viewQueries: [{ propertyName: "container", first: true, predicate: OwlDateTimeContainerComponent, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<owl-date-time-container></owl-date-time-container>\n", styles: [""], components: [{ type: OwlDateTimeContainerComponent, selector: "owl-date-time-container", exportAs: ["owlDateTimeContainer"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2955
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeInlineComponent, decorators: [{
2956
+ type: Component,
2957
+ args: [{ selector: 'owl-date-time-inline', changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, providers: [OWL_DATETIME_VALUE_ACCESSOR$1], template: "<owl-date-time-container></owl-date-time-container>\n", styles: [""] }]
2958
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
2959
+ type: Optional
2960
+ }] }, { type: undefined, decorators: [{
2961
+ type: Optional
2962
+ }, {
2963
+ type: Inject,
2964
+ args: [OWL_DATE_TIME_FORMATS]
2965
+ }] }]; }, propDecorators: { container: [{
2966
+ type: ViewChild,
2967
+ args: [OwlDateTimeContainerComponent, { static: true }]
2968
+ }], pickerType: [{
2969
+ type: Input
2970
+ }], disabled: [{
2971
+ type: Input
2972
+ }], selectMode: [{
2973
+ type: Input
2974
+ }], startAt: [{
2975
+ type: Input
2976
+ }], dateTimeFilter: [{
2977
+ type: Input,
2978
+ args: ['owlDateTimeFilter']
2979
+ }], minDateTime: [{
2980
+ type: Input,
2981
+ args: ['min']
2982
+ }], maxDateTime: [{
2983
+ type: Input,
2984
+ args: ['max']
2985
+ }], value: [{
2986
+ type: Input
2987
+ }], values: [{
2988
+ type: Input
2989
+ }], yearSelected: [{
2990
+ type: Output
2991
+ }], monthSelected: [{
2992
+ type: Output
2993
+ }], owlDTInlineClass: [{
2994
+ type: HostBinding,
2995
+ args: ['class.owl-dt-inline']
2996
+ }] } });
2809
2997
 
2810
- let uniqueId = 0;
2811
- class OwlDialogConfig {
2812
- constructor() {
2813
- /**
2814
- * ID of the element that describes the dialog.
2815
- */
2816
- this.ariaDescribedBy = null;
2998
+ const OWL_DATETIME_VALUE_ACCESSOR = {
2999
+ provide: NG_VALUE_ACCESSOR,
3000
+ useExisting: forwardRef(() => OwlDateTimeInputDirective),
3001
+ multi: true
3002
+ };
3003
+ const OWL_DATETIME_VALIDATORS = {
3004
+ provide: NG_VALIDATORS,
3005
+ useExisting: forwardRef(() => OwlDateTimeInputDirective),
3006
+ multi: true
3007
+ };
3008
+ class OwlDateTimeInputDirective {
3009
+ constructor(elmRef, renderer, dateTimeAdapter, dateTimeFormats) {
3010
+ this.elmRef = elmRef;
3011
+ this.renderer = renderer;
3012
+ this.dateTimeAdapter = dateTimeAdapter;
3013
+ this.dateTimeFormats = dateTimeFormats;
2817
3014
  /**
2818
- * Whether to focus the dialog when the dialog is opened
3015
+ * The picker's select mode
2819
3016
  */
2820
- this.autoFocus = true;
2821
- /** Whether the dialog has a backdrop. */
2822
- this.hasBackdrop = true;
2823
- /** Data being injected into the child component. */
2824
- this.data = null;
2825
- /** Whether the user can use escape or clicking outside to close a modal. */
2826
- this.disableClose = false;
3017
+ this._selectMode = 'single';
2827
3018
  /**
2828
- * The ARIA role of the dialog element.
3019
+ * The character to separate the 'from' and 'to' in input value
2829
3020
  */
2830
- this.role = 'dialog';
2831
- /**
2832
- * Custom class for the pane
2833
- * */
2834
- this.paneClass = '';
2835
- /**
2836
- * Mouse Event
2837
- * */
2838
- this.event = null;
2839
- /**
2840
- * Custom class for the backdrop
2841
- * */
2842
- this.backdropClass = '';
3021
+ this.rangeSeparator = '~';
3022
+ this._values = [];
2843
3023
  /**
2844
- * Whether the dialog should close when the user goes backwards/forwards in history.
3024
+ * Callback to invoke when `change` event is fired on this `<input>`
2845
3025
  * */
2846
- this.closeOnNavigation = true;
2847
- /** Width of the dialog. */
2848
- this.width = '';
2849
- /** Height of the dialog. */
2850
- this.height = '';
3026
+ this.dateTimeChange = new EventEmitter();
2851
3027
  /**
2852
- * The max-width of the overlay panel.
2853
- * If a number is provided, pixel units are assumed.
3028
+ * Callback to invoke when an `input` event is fired on this `<input>`.
2854
3029
  * */
2855
- this.maxWidth = '85vw';
3030
+ this.dateTimeInput = new EventEmitter();
3031
+ this.dtPickerSub = Subscription.EMPTY;
3032
+ this.localeSub = Subscription.EMPTY;
3033
+ this.lastValueValid = true;
3034
+ this.onModelChange = () => { };
3035
+ this.onModelTouched = () => { };
3036
+ this.validatorOnChange = () => { };
3037
+ /** The form control validator for whether the input parses. */
3038
+ this.parseValidator = () => this.lastValueValid
3039
+ ? null
3040
+ : { owlDateTimeParse: { text: this.elmRef.nativeElement.value } };
3041
+ /** The form control validator for the min date. */
3042
+ this.minValidator = (control) => {
3043
+ if (this.isInSingleMode) {
3044
+ const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
3045
+ return !this.min ||
3046
+ !controlValue ||
3047
+ this.dateTimeAdapter.compare(this.min, controlValue) <= 0
3048
+ ? null
3049
+ : { owlDateTimeMin: { min: this.min, actual: controlValue } };
3050
+ }
3051
+ else if (this.isInRangeMode && control.value) {
3052
+ const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
3053
+ const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
3054
+ return !this.min ||
3055
+ !controlValueFrom ||
3056
+ !controlValueTo ||
3057
+ this.dateTimeAdapter.compare(this.min, controlValueFrom) <= 0
3058
+ ? null
3059
+ : {
3060
+ owlDateTimeMin: {
3061
+ min: this.min,
3062
+ actual: [controlValueFrom, controlValueTo]
3063
+ }
3064
+ };
3065
+ }
3066
+ };
3067
+ /** The form control validator for the max date. */
3068
+ this.maxValidator = (control) => {
3069
+ if (this.isInSingleMode) {
3070
+ const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
3071
+ return !this.max ||
3072
+ !controlValue ||
3073
+ this.dateTimeAdapter.compare(this.max, controlValue) >= 0
3074
+ ? null
3075
+ : { owlDateTimeMax: { max: this.max, actual: controlValue } };
3076
+ }
3077
+ else if (this.isInRangeMode && control.value) {
3078
+ const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
3079
+ const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
3080
+ return !this.max ||
3081
+ !controlValueFrom ||
3082
+ !controlValueTo ||
3083
+ this.dateTimeAdapter.compare(this.max, controlValueTo) >= 0
3084
+ ? null
3085
+ : {
3086
+ owlDateTimeMax: {
3087
+ max: this.max,
3088
+ actual: [controlValueFrom, controlValueTo]
3089
+ }
3090
+ };
3091
+ }
3092
+ };
3093
+ /** The form control validator for the date filter. */
3094
+ this.filterValidator = (control) => {
3095
+ const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
3096
+ return !this._dateTimeFilter ||
3097
+ !controlValue ||
3098
+ this._dateTimeFilter(controlValue)
3099
+ ? null
3100
+ : { owlDateTimeFilter: true };
3101
+ };
2856
3102
  /**
2857
- * The scroll strategy when the dialog is open
2858
- * Learn more this from https://material.angular.io/cdk/overlay/overview#scroll-strategies
3103
+ * The form control validator for the range.
3104
+ * Check whether the 'before' value is before the 'to' value
2859
3105
  * */
2860
- this.scrollStrategy = new NoopScrollStrategy();
2861
- this.id = `owl-dialog-${uniqueId++}`;
2862
- }
2863
- }
2864
-
2865
- class OwlDialogRef {
2866
- constructor(overlayRef, container, id, location) {
2867
- this.overlayRef = overlayRef;
2868
- this.container = container;
2869
- this.id = id;
2870
- this._beforeClose$ = new Subject();
2871
- this._afterOpen$ = new Subject();
2872
- this._afterClosed$ = new Subject();
2873
- /** Subscription to changes in the user's location. */
2874
- this.locationChanged = Subscription.EMPTY;
2875
- /** Whether the user is allowed to close the dialog. */
2876
- this.disableClose = this.container.config.disableClose;
2877
- this.container.animationStateChanged
2878
- .pipe(filter((event) => event.phaseName === 'done' && event.toState === 'enter'), take(1))
2879
- .subscribe(() => {
2880
- this._afterOpen$.next();
2881
- this._afterOpen$.complete();
2882
- });
2883
- this.container.animationStateChanged
2884
- .pipe(filter((event) => event.phaseName === 'done' && event.toState === 'exit'), take(1))
2885
- .subscribe(() => {
2886
- this.overlayRef.dispose();
2887
- this.locationChanged.unsubscribe();
2888
- this._afterClosed$.next(this.result);
2889
- this._afterClosed$.complete();
2890
- this.componentInstance = null;
2891
- });
2892
- this.overlayRef.keydownEvents()
2893
- .pipe(filter(event => event.keyCode === ESCAPE && !this.disableClose))
2894
- .subscribe(() => this.close());
2895
- if (location) {
2896
- this.locationChanged = location.subscribe(() => {
2897
- if (this.container.config.closeOnNavigation) {
2898
- this.close();
2899
- }
2900
- });
2901
- }
2902
- }
2903
- close(dialogResult) {
2904
- this.result = dialogResult;
2905
- this.container.animationStateChanged
2906
- .pipe(filter((event) => event.phaseName === 'start'), take(1))
2907
- .subscribe(() => {
2908
- this._beforeClose$.next(dialogResult);
2909
- this._beforeClose$.complete();
2910
- this.overlayRef.detachBackdrop();
2911
- });
2912
- this.container.startExitAnimation();
3106
+ this.rangeValidator = (control) => {
3107
+ if (this.isInSingleMode || !control.value) {
3108
+ return null;
3109
+ }
3110
+ const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
3111
+ const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
3112
+ return !controlValueFrom ||
3113
+ !controlValueTo ||
3114
+ this.dateTimeAdapter.compare(controlValueFrom, controlValueTo) <= 0
3115
+ ? null
3116
+ : { owlDateTimeRange: true };
3117
+ };
3118
+ /** The combined form control validator for this input. */
3119
+ this.validator = Validators.compose([
3120
+ this.parseValidator,
3121
+ this.minValidator,
3122
+ this.maxValidator,
3123
+ this.filterValidator,
3124
+ this.rangeValidator
3125
+ ]);
3126
+ /** Emits when the value changes (either due to user input or programmatic change). */
3127
+ this.valueChange = new EventEmitter();
3128
+ /** Emits when the disabled state has changed */
3129
+ this.disabledChange = new EventEmitter();
3130
+ if (!this.dateTimeAdapter) {
3131
+ throw Error('OwlDateTimePicker: No provider found for DateTimePicker. You must import one of the following ' +
3132
+ 'modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ' +
3133
+ 'custom implementation.');
3134
+ }
3135
+ if (!this.dateTimeFormats) {
3136
+ throw Error('OwlDateTimePicker: No provider found for OWL_DATE_TIME_FORMATS. You must import one of the following ' +
3137
+ 'modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ' +
3138
+ 'custom implementation.');
3139
+ }
3140
+ this.localeSub = this.dateTimeAdapter.localeChanges.subscribe(() => {
3141
+ this.value = this.value;
3142
+ });
2913
3143
  }
2914
3144
  /**
2915
- * Gets an observable that emits when the overlay's backdrop has been clicked.
2916
- */
2917
- backdropClick() {
2918
- return this.overlayRef.backdropClick();
3145
+ * The date time picker that this input is associated with.
3146
+ * */
3147
+ set owlDateTime(value) {
3148
+ this.registerDateTimePicker(value);
2919
3149
  }
2920
3150
  /**
2921
- * Gets an observable that emits when keydown events are targeted on the overlay.
3151
+ * A function to filter date time
2922
3152
  */
2923
- keydownEvents() {
2924
- return this.overlayRef.keydownEvents();
3153
+ set owlDateTimeFilter(filter) {
3154
+ this._dateTimeFilter = filter;
3155
+ this.validatorOnChange();
2925
3156
  }
2926
- /**
2927
- * Updates the dialog's position.
2928
- * @param position New dialog position.
2929
- */
2930
- updatePosition(position) {
2931
- const strategy = this.getPositionStrategy();
2932
- if (position && (position.left || position.right)) {
2933
- position.left ? strategy.left(position.left) : strategy.right(position.right);
2934
- }
2935
- else {
2936
- strategy.centerHorizontally();
2937
- }
2938
- if (position && (position.top || position.bottom)) {
2939
- position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
3157
+ get dateTimeFilter() {
3158
+ return this._dateTimeFilter;
3159
+ }
3160
+ get disabled() {
3161
+ return !!this._disabled;
3162
+ }
3163
+ set disabled(value) {
3164
+ const newValue = coerceBooleanProperty(value);
3165
+ const element = this.elmRef.nativeElement;
3166
+ if (this._disabled !== newValue) {
3167
+ this._disabled = newValue;
3168
+ this.disabledChange.emit(newValue);
2940
3169
  }
2941
- else {
2942
- strategy.centerVertically();
3170
+ // We need to null check the `blur` method, because it's undefined during SSR.
3171
+ if (newValue && element.blur) {
3172
+ // Normally, native input elements automatically blur if they turn disabled. This behavior
3173
+ // is problematic, because it would mean that it triggers another change detection cycle,
3174
+ // which then causes a changed after checked error if the input element was focused before.
3175
+ element.blur();
2943
3176
  }
2944
- this.overlayRef.updatePosition();
2945
- return this;
2946
3177
  }
2947
- /**
2948
- * Updates the dialog's width and height.
2949
- * @param width New width of the dialog.
2950
- * @param height New height of the dialog.
2951
- */
2952
- updateSize(width = 'auto', height = 'auto') {
2953
- this.getPositionStrategy().width(width).height(height);
2954
- this.overlayRef.updatePosition();
2955
- return this;
3178
+ get min() {
3179
+ return this._min;
2956
3180
  }
2957
- isAnimating() {
2958
- return this.container.isAnimating;
3181
+ set min(value) {
3182
+ this._min = this.getValidDate(this.dateTimeAdapter.deserialize(value));
3183
+ this.validatorOnChange();
2959
3184
  }
2960
- afterOpen() {
2961
- return this._afterOpen$.asObservable();
3185
+ get max() {
3186
+ return this._max;
2962
3187
  }
2963
- beforeClose() {
2964
- return this._beforeClose$.asObservable();
3188
+ set max(value) {
3189
+ this._max = this.getValidDate(this.dateTimeAdapter.deserialize(value));
3190
+ this.validatorOnChange();
2965
3191
  }
2966
- afterClosed() {
2967
- return this._afterClosed$.asObservable();
3192
+ get selectMode() {
3193
+ return this._selectMode;
2968
3194
  }
2969
- /** Fetches the position strategy object from the overlay ref. */
2970
- getPositionStrategy() {
2971
- return this.overlayRef.getConfig().positionStrategy;
3195
+ set selectMode(mode) {
3196
+ if (mode !== 'single' &&
3197
+ mode !== 'range' &&
3198
+ mode !== 'rangeFrom' &&
3199
+ mode !== 'rangeTo') {
3200
+ throw Error('OwlDateTime Error: invalid selectMode value!');
3201
+ }
3202
+ this._selectMode = mode;
2972
3203
  }
2973
- }
2974
-
2975
- /**
2976
- * Extends an object with the *enumerable* and *own* properties of one or more source objects,
2977
- * similar to Object.assign.
2978
- *
2979
- * @param dest The object which will have properties copied to it.
2980
- * @param sources The source objects from which properties will be copied.
2981
- */
2982
- function extendObject(dest, ...sources) {
2983
- if (dest == null) {
2984
- throw TypeError('Cannot convert undefined or null to object');
3204
+ get value() {
3205
+ return this._value;
2985
3206
  }
2986
- for (const source of sources) {
2987
- if (source != null) {
2988
- for (const key in source) {
2989
- if (source.hasOwnProperty(key)) {
2990
- dest[key] = source[key];
2991
- }
2992
- }
3207
+ set value(value) {
3208
+ value = this.dateTimeAdapter.deserialize(value);
3209
+ this.lastValueValid = !value || this.dateTimeAdapter.isValid(value);
3210
+ value = this.getValidDate(value);
3211
+ const oldDate = this._value;
3212
+ this._value = value;
3213
+ // set the input property 'value'
3214
+ this.formatNativeInputValue();
3215
+ // check if the input value changed
3216
+ if (!this.dateTimeAdapter.isEqual(oldDate, value)) {
3217
+ this.valueChange.emit(value);
2993
3218
  }
2994
3219
  }
2995
- return dest;
2996
- }
2997
-
2998
- const zoomFadeIn = {
2999
- opacity: 0,
3000
- transform: 'translateX({{ x }}) translateY({{ y }}) scale({{scale}})'
3001
- };
3002
- const zoomFadeInFrom = {
3003
- opacity: 0,
3004
- transform: 'translateX({{ x }}) translateY({{ y }}) scale({{scale}})',
3005
- transformOrigin: '{{ ox }} {{ oy }}'
3006
- };
3007
- class OwlDialogContainerComponent extends BasePortalOutlet {
3008
- constructor(changeDetector, elementRef, focusTrapFactory, document) {
3009
- super();
3010
- this.changeDetector = changeDetector;
3011
- this.elementRef = elementRef;
3012
- this.focusTrapFactory = focusTrapFactory;
3013
- this.document = document;
3014
- /** ID of the element that should be considered as the dialog's label. */
3015
- this.ariaLabelledBy = null;
3016
- /** Emits when an animation state changes. */
3017
- this.animationStateChanged = new EventEmitter();
3018
- this.isAnimating = false;
3019
- this.state = 'enter';
3020
- // for animation purpose
3021
- this.params = {
3022
- x: '0px',
3023
- y: '0px',
3024
- ox: '50%',
3025
- oy: '50%',
3026
- scale: 0
3027
- };
3028
- // A variable to hold the focused element before the dialog was open.
3029
- // This would help us to refocus back to element when the dialog was closed.
3030
- this.elementFocusedBeforeDialogWasOpened = null;
3031
- }
3032
- get config() {
3033
- return this._config;
3220
+ get values() {
3221
+ return this._values;
3034
3222
  }
3035
- get owlDialogContainerClass() {
3036
- return true;
3223
+ set values(values) {
3224
+ if (values && values.length > 0) {
3225
+ this._values = values.map(v => {
3226
+ v = this.dateTimeAdapter.deserialize(v);
3227
+ return this.getValidDate(v);
3228
+ });
3229
+ this.lastValueValid =
3230
+ (!this._values[0] ||
3231
+ this.dateTimeAdapter.isValid(this._values[0])) &&
3232
+ (!this._values[1] ||
3233
+ this.dateTimeAdapter.isValid(this._values[1]));
3234
+ }
3235
+ else {
3236
+ this._values = [];
3237
+ this.lastValueValid = true;
3238
+ }
3239
+ // set the input property 'value'
3240
+ this.formatNativeInputValue();
3241
+ this.valueChange.emit(this._values);
3037
3242
  }
3038
- get owlDialogContainerTabIndex() {
3039
- return -1;
3243
+ get elementRef() {
3244
+ return this.elmRef;
3040
3245
  }
3041
- get owlDialogContainerId() {
3042
- return this._config.id;
3246
+ get isInSingleMode() {
3247
+ return this._selectMode === 'single';
3043
3248
  }
3044
- get owlDialogContainerRole() {
3045
- return this._config.role || null;
3249
+ get isInRangeMode() {
3250
+ return (this._selectMode === 'range' ||
3251
+ this._selectMode === 'rangeFrom' ||
3252
+ this._selectMode === 'rangeTo');
3046
3253
  }
3047
- get owlDialogContainerAriaLabelledby() {
3048
- return this.ariaLabelledBy;
3254
+ get owlDateTimeInputAriaHaspopup() {
3255
+ return true;
3049
3256
  }
3050
- get owlDialogContainerAriaDescribedby() {
3051
- return this._config.ariaDescribedBy || null;
3257
+ get owlDateTimeInputAriaOwns() {
3258
+ return (this.dtPicker.opened && this.dtPicker.id) || null;
3052
3259
  }
3053
- get owlDialogContainerAnimation() {
3054
- return { value: this.state, params: this.params };
3260
+ get minIso8601() {
3261
+ return this.min ? this.dateTimeAdapter.toIso8601(this.min) : null;
3055
3262
  }
3056
- ngOnInit() { }
3057
- /**
3058
- * Attach a ComponentPortal as content to this dialog container.
3059
- */
3060
- attachComponentPortal(portal) {
3061
- if (this.portalOutlet.hasAttached()) {
3062
- throw Error('Attempting to attach dialog content after content is already attached');
3263
+ get maxIso8601() {
3264
+ return this.max ? this.dateTimeAdapter.toIso8601(this.max) : null;
3265
+ }
3266
+ get owlDateTimeInputDisabled() {
3267
+ return this.disabled;
3268
+ }
3269
+ ngOnInit() {
3270
+ if (!this.dtPicker) {
3271
+ throw Error('OwlDateTimePicker: the picker input doesn\'t have any associated owl-date-time component');
3063
3272
  }
3064
- this.savePreviouslyFocusedElement();
3065
- return this.portalOutlet.attachComponentPortal(portal);
3066
3273
  }
3067
- attachTemplatePortal(_portal) {
3068
- throw new Error('Method not implemented.');
3274
+ ngAfterContentInit() {
3275
+ this.dtPickerSub = this.dtPicker.confirmSelectedChange.subscribe((selecteds) => {
3276
+ if (Array.isArray(selecteds)) {
3277
+ this.values = selecteds;
3278
+ }
3279
+ else {
3280
+ this.value = selecteds;
3281
+ }
3282
+ this.onModelChange(selecteds);
3283
+ this.onModelTouched();
3284
+ this.dateTimeChange.emit({
3285
+ source: this,
3286
+ value: selecteds,
3287
+ input: this.elmRef.nativeElement
3288
+ });
3289
+ this.dateTimeInput.emit({
3290
+ source: this,
3291
+ value: selecteds,
3292
+ input: this.elmRef.nativeElement
3293
+ });
3294
+ });
3069
3295
  }
3070
- setConfig(config) {
3071
- this._config = config;
3072
- if (config.event) {
3073
- this.calculateZoomOrigin(config.event);
3296
+ ngOnDestroy() {
3297
+ this.dtPickerSub.unsubscribe();
3298
+ this.localeSub.unsubscribe();
3299
+ this.valueChange.complete();
3300
+ this.disabledChange.complete();
3301
+ }
3302
+ writeValue(value) {
3303
+ if (this.isInSingleMode) {
3304
+ this.value = value;
3305
+ }
3306
+ else {
3307
+ this.values = value;
3074
3308
  }
3075
3309
  }
3076
- onAnimationStart(event) {
3077
- this.isAnimating = true;
3078
- this.animationStateChanged.emit(event);
3310
+ registerOnChange(fn) {
3311
+ this.onModelChange = fn;
3079
3312
  }
3080
- onAnimationDone(event) {
3081
- if (event.toState === 'enter') {
3082
- this.trapFocus();
3313
+ registerOnTouched(fn) {
3314
+ this.onModelTouched = fn;
3315
+ }
3316
+ setDisabledState(isDisabled) {
3317
+ this.disabled = isDisabled;
3318
+ }
3319
+ validate(c) {
3320
+ return this.validator ? this.validator(c) : null;
3321
+ }
3322
+ registerOnValidatorChange(fn) {
3323
+ this.validatorOnChange = fn;
3324
+ }
3325
+ /**
3326
+ * Open the picker when user hold alt + DOWN_ARROW
3327
+ * */
3328
+ handleKeydownOnHost(event) {
3329
+ if (event.altKey && event.keyCode === DOWN_ARROW) {
3330
+ this.dtPicker.open();
3331
+ event.preventDefault();
3083
3332
  }
3084
- else if (event.toState === 'exit') {
3085
- this.restoreFocus();
3333
+ }
3334
+ handleBlurOnHost(_event) {
3335
+ this.onModelTouched();
3336
+ }
3337
+ handleInputOnHost(event) {
3338
+ const value = event.target.value;
3339
+ if (this._selectMode === 'single') {
3340
+ this.changeInputInSingleMode(value);
3341
+ }
3342
+ else if (this._selectMode === 'range') {
3343
+ this.changeInputInRangeMode(value);
3344
+ }
3345
+ else {
3346
+ this.changeInputInRangeFromToMode(value);
3086
3347
  }
3087
- this.animationStateChanged.emit(event);
3088
- this.isAnimating = false;
3089
3348
  }
3090
- startExitAnimation() {
3091
- this.state = 'exit';
3092
- this.changeDetector.markForCheck();
3349
+ handleChangeOnHost(_event) {
3350
+ let v;
3351
+ if (this.isInSingleMode) {
3352
+ v = this.value;
3353
+ }
3354
+ else if (this.isInRangeMode) {
3355
+ v = this.values;
3356
+ }
3357
+ this.dateTimeChange.emit({
3358
+ source: this,
3359
+ value: v,
3360
+ input: this.elmRef.nativeElement
3361
+ });
3093
3362
  }
3094
3363
  /**
3095
- * Calculate origin used in the `zoomFadeInFrom()`
3096
- * for animation purpose
3364
+ * Set the native input property 'value'
3097
3365
  */
3098
- calculateZoomOrigin(event) {
3099
- if (!event) {
3100
- return;
3366
+ formatNativeInputValue() {
3367
+ if (this.isInSingleMode) {
3368
+ this.renderer.setProperty(this.elmRef.nativeElement, 'value', this._value
3369
+ ? this.dateTimeAdapter.format(this._value, this.dtPicker.formatString)
3370
+ : '');
3371
+ }
3372
+ else if (this.isInRangeMode) {
3373
+ if (this._values && this.values.length > 0) {
3374
+ const from = this._values[0];
3375
+ const to = this._values[1];
3376
+ const fromFormatted = from
3377
+ ? this.dateTimeAdapter.format(from, this.dtPicker.formatString)
3378
+ : '';
3379
+ const toFormatted = to
3380
+ ? this.dateTimeAdapter.format(to, this.dtPicker.formatString)
3381
+ : '';
3382
+ if (!fromFormatted && !toFormatted) {
3383
+ this.renderer.setProperty(this.elmRef.nativeElement, 'value', null);
3384
+ }
3385
+ else {
3386
+ if (this._selectMode === 'range') {
3387
+ this.renderer.setProperty(this.elmRef.nativeElement, 'value', fromFormatted +
3388
+ ' ' +
3389
+ this.rangeSeparator +
3390
+ ' ' +
3391
+ toFormatted);
3392
+ }
3393
+ else if (this._selectMode === 'rangeFrom') {
3394
+ this.renderer.setProperty(this.elmRef.nativeElement, 'value', fromFormatted);
3395
+ }
3396
+ else if (this._selectMode === 'rangeTo') {
3397
+ this.renderer.setProperty(this.elmRef.nativeElement, 'value', toFormatted);
3398
+ }
3399
+ }
3400
+ }
3401
+ else {
3402
+ this.renderer.setProperty(this.elmRef.nativeElement, 'value', '');
3403
+ }
3101
3404
  }
3102
- const clientX = event.clientX;
3103
- const clientY = event.clientY;
3104
- const wh = window.innerWidth / 2;
3105
- const hh = window.innerHeight / 2;
3106
- const x = clientX - wh;
3107
- const y = clientY - hh;
3108
- const ox = clientX / window.innerWidth;
3109
- const oy = clientY / window.innerHeight;
3110
- this.params.x = `${x}px`;
3111
- this.params.y = `${y}px`;
3112
- this.params.ox = `${ox * 100}%`;
3113
- this.params.oy = `${oy * 100}%`;
3114
- this.params.scale = 0;
3115
3405
  return;
3116
3406
  }
3117
3407
  /**
3118
- * Save the focused element before dialog was open
3408
+ * Register the relationship between this input and its picker component
3119
3409
  */
3120
- savePreviouslyFocusedElement() {
3121
- if (this.document) {
3122
- this.elementFocusedBeforeDialogWasOpened = this.document
3123
- .activeElement;
3124
- Promise.resolve().then(() => this.elementRef.nativeElement.focus());
3410
+ registerDateTimePicker(picker) {
3411
+ if (picker) {
3412
+ this.dtPicker = picker;
3413
+ this.dtPicker.registerInput(this);
3125
3414
  }
3126
3415
  }
3127
- trapFocus() {
3128
- if (!this.focusTrap) {
3129
- this.focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement);
3416
+ /**
3417
+ * Convert a given obj to a valid date object
3418
+ */
3419
+ getValidDate(obj) {
3420
+ return this.dateTimeAdapter.isDateInstance(obj) &&
3421
+ this.dateTimeAdapter.isValid(obj)
3422
+ ? obj
3423
+ : null;
3424
+ }
3425
+ /**
3426
+ * Convert a time string to a date-time string
3427
+ * When pickerType is 'timer', the value in the picker's input is a time string.
3428
+ * The dateTimeAdapter parse fn could not parse a time string to a Date Object.
3429
+ * Therefore we need this fn to convert a time string to a date-time string.
3430
+ */
3431
+ convertTimeStringToDateTimeString(timeString, dateTime) {
3432
+ if (timeString) {
3433
+ const v = dateTime || this.dateTimeAdapter.now();
3434
+ const dateString = this.dateTimeAdapter.format(v, this.dateTimeFormats.datePickerInput);
3435
+ return dateString + ' ' + timeString;
3130
3436
  }
3131
- if (this._config.autoFocus) {
3132
- this.focusTrap.focusInitialElementWhenReady();
3437
+ else {
3438
+ return null;
3133
3439
  }
3134
3440
  }
3135
- restoreFocus() {
3136
- const toFocus = this.elementFocusedBeforeDialogWasOpened;
3137
- // We need the extra check, because IE can set the `activeElement` to null in some cases.
3138
- if (toFocus && typeof toFocus.focus === 'function') {
3139
- toFocus.focus();
3441
+ /**
3442
+ * Handle input change in single mode
3443
+ */
3444
+ changeInputInSingleMode(inputValue) {
3445
+ let value = inputValue;
3446
+ if (this.dtPicker.pickerType === 'timer') {
3447
+ value = this.convertTimeStringToDateTimeString(value, this.value);
3140
3448
  }
3141
- if (this.focusTrap) {
3142
- this.focusTrap.destroy();
3449
+ let result = this.dateTimeAdapter.parse(value, this.dateTimeFormats.parseInput);
3450
+ this.lastValueValid = !result || this.dateTimeAdapter.isValid(result);
3451
+ result = this.getValidDate(result);
3452
+ // if the newValue is the same as the oldValue, we intend to not fire the valueChange event
3453
+ // result equals to null means there is input event, but the input value is invalid
3454
+ if (!this.isSameValue(result, this._value) || result === null) {
3455
+ this._value = result;
3456
+ this.valueChange.emit(result);
3457
+ this.onModelChange(result);
3458
+ this.dateTimeInput.emit({
3459
+ source: this,
3460
+ value: result,
3461
+ input: this.elmRef.nativeElement
3462
+ });
3143
3463
  }
3144
3464
  }
3145
- }
3146
- OwlDialogContainerComponent.decorators = [
3147
- { type: Component, args: [{
3148
- selector: 'owl-dialog-container',
3149
- template: "<ng-template cdkPortalOutlet></ng-template>\n",
3150
- animations: [
3151
- trigger('slideModal', [
3152
- transition('void => enter', [
3153
- style(zoomFadeInFrom),
3154
- animate('300ms cubic-bezier(0.35, 0, 0.25, 1)', style('*')),
3155
- animate('150ms', keyframes([
3156
- style({ transform: 'scale(1)', offset: 0 }),
3157
- style({ transform: 'scale(1.05)', offset: 0.3 }),
3158
- style({ transform: 'scale(.95)', offset: 0.8 }),
3159
- style({ transform: 'scale(1)', offset: 1.0 })
3160
- ])),
3161
- animateChild()
3162
- ], {
3163
- params: {
3164
- x: '0px',
3165
- y: '0px',
3166
- ox: '50%',
3167
- oy: '50%',
3168
- scale: 1
3169
- }
3170
- }),
3171
- transition('enter => exit', [animateChild(), animate(200, style(zoomFadeIn))], { params: { x: '0px', y: '0px', ox: '50%', oy: '50%' } })
3172
- ])
3173
- ]
3174
- },] }
3175
- ];
3176
- OwlDialogContainerComponent.ctorParameters = () => [
3177
- { type: ChangeDetectorRef },
3178
- { type: ElementRef },
3179
- { type: FocusTrapFactory },
3180
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] }
3181
- ];
3182
- OwlDialogContainerComponent.propDecorators = {
3183
- portalOutlet: [{ type: ViewChild, args: [CdkPortalOutlet, { static: true },] }],
3184
- owlDialogContainerClass: [{ type: HostBinding, args: ['class.owl-dialog-container',] }],
3185
- owlDialogContainerTabIndex: [{ type: HostBinding, args: ['attr.tabindex',] }],
3186
- owlDialogContainerId: [{ type: HostBinding, args: ['attr.id',] }],
3187
- owlDialogContainerRole: [{ type: HostBinding, args: ['attr.role',] }],
3188
- owlDialogContainerAriaLabelledby: [{ type: HostBinding, args: ['attr.aria-labelledby',] }],
3189
- owlDialogContainerAriaDescribedby: [{ type: HostBinding, args: ['attr.aria-describedby',] }],
3190
- owlDialogContainerAnimation: [{ type: HostBinding, args: ['@slideModal',] }],
3191
- onAnimationStart: [{ type: HostListener, args: ['@slideModal.start', ['$event'],] }],
3192
- onAnimationDone: [{ type: HostListener, args: ['@slideModal.done', ['$event'],] }]
3193
- };
3194
-
3195
- const OWL_DIALOG_DATA = new InjectionToken('OwlDialogData');
3196
- /**
3197
- * Injection token that determines the scroll handling while the dialog is open.
3198
- * */
3199
- const OWL_DIALOG_SCROLL_STRATEGY = new InjectionToken('owl-dialog-scroll-strategy');
3200
- function OWL_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
3201
- const fn = () => overlay.scrollStrategies.block();
3202
- return fn;
3203
- }
3204
- /** @docs-private */
3205
- const OWL_DIALOG_SCROLL_STRATEGY_PROVIDER = {
3206
- provide: OWL_DIALOG_SCROLL_STRATEGY,
3207
- deps: [Overlay],
3208
- useFactory: OWL_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY
3209
- };
3210
- /** I
3211
- * njection token that can be used to specify default dialog options.
3212
- * */
3213
- const OWL_DIALOG_DEFAULT_OPTIONS = new InjectionToken('owl-dialog-default-options');
3214
- class OwlDialogService {
3215
- constructor(overlay, injector, location, scrollStrategy, defaultOptions, parentDialog, overlayContainer) {
3216
- this.overlay = overlay;
3217
- this.injector = injector;
3218
- this.location = location;
3219
- this.defaultOptions = defaultOptions;
3220
- this.parentDialog = parentDialog;
3221
- this.overlayContainer = overlayContainer;
3222
- this.ariaHiddenElements = new Map();
3223
- this._openDialogsAtThisLevel = [];
3224
- this._afterOpenAtThisLevel = new Subject();
3225
- this._afterAllClosedAtThisLevel = new Subject();
3226
- /**
3227
- * Stream that emits when all open dialog have finished closing.
3228
- * Will emit on subscribe if there are no open dialogs to begin with.
3229
- */
3230
- this.afterAllClosed = defer(() => this._openDialogsAtThisLevel.length
3231
- ? this._afterAllClosed
3232
- : this._afterAllClosed.pipe(startWith(undefined)));
3233
- this.scrollStrategy = scrollStrategy;
3234
- if (!parentDialog && location) {
3235
- location.subscribe(() => this.closeAll());
3236
- }
3237
- }
3238
- /** Keeps track of the currently-open dialogs. */
3239
- get openDialogs() {
3240
- return this.parentDialog
3241
- ? this.parentDialog.openDialogs
3242
- : this._openDialogsAtThisLevel;
3243
- }
3244
- /** Stream that emits when a dialog has been opened. */
3245
- get afterOpen() {
3246
- return this.parentDialog
3247
- ? this.parentDialog.afterOpen
3248
- : this._afterOpenAtThisLevel;
3249
- }
3250
- get _afterAllClosed() {
3251
- const parent = this.parentDialog;
3252
- return parent
3253
- ? parent._afterAllClosed
3254
- : this._afterAllClosedAtThisLevel;
3255
- }
3256
- open(componentOrTemplateRef, config) {
3257
- config = applyConfigDefaults(config, this.defaultOptions);
3258
- if (config.id && this.getDialogById(config.id)) {
3259
- throw Error(`Dialog with id "${config.id}" exists already. The dialog id must be unique.`);
3465
+ /**
3466
+ * Handle input change in rangeFrom or rangeTo mode
3467
+ */
3468
+ changeInputInRangeFromToMode(inputValue) {
3469
+ const originalValue = this._selectMode === 'rangeFrom'
3470
+ ? this._values[0]
3471
+ : this._values[1];
3472
+ if (this.dtPicker.pickerType === 'timer') {
3473
+ inputValue = this.convertTimeStringToDateTimeString(inputValue, originalValue);
3260
3474
  }
3261
- const overlayRef = this.createOverlay(config);
3262
- const dialogContainer = this.attachDialogContainer(overlayRef, config);
3263
- const dialogRef = this.attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config);
3264
- if (!this.openDialogs.length) {
3265
- this.hideNonDialogContentFromAssistiveTechnology();
3475
+ let result = this.dateTimeAdapter.parse(inputValue, this.dateTimeFormats.parseInput);
3476
+ this.lastValueValid = !result || this.dateTimeAdapter.isValid(result);
3477
+ result = this.getValidDate(result);
3478
+ // if the newValue is the same as the oldValue, we intend to not fire the valueChange event
3479
+ if ((this._selectMode === 'rangeFrom' &&
3480
+ this.isSameValue(result, this._values[0]) &&
3481
+ result) ||
3482
+ (this._selectMode === 'rangeTo' &&
3483
+ this.isSameValue(result, this._values[1]) &&
3484
+ result)) {
3485
+ return;
3266
3486
  }
3267
- this.openDialogs.push(dialogRef);
3268
- dialogRef
3269
- .afterClosed()
3270
- .subscribe(() => this.removeOpenDialog(dialogRef));
3271
- this.afterOpen.next(dialogRef);
3272
- return dialogRef;
3487
+ this._values =
3488
+ this._selectMode === 'rangeFrom'
3489
+ ? [result, this._values[1]]
3490
+ : [this._values[0], result];
3491
+ this.valueChange.emit(this._values);
3492
+ this.onModelChange(this._values);
3493
+ this.dateTimeInput.emit({
3494
+ source: this,
3495
+ value: this._values,
3496
+ input: this.elmRef.nativeElement
3497
+ });
3273
3498
  }
3274
3499
  /**
3275
- * Closes all of the currently-open dialogs.
3500
+ * Handle input change in range mode
3276
3501
  */
3277
- closeAll() {
3278
- let i = this.openDialogs.length;
3279
- while (i--) {
3280
- this.openDialogs[i].close();
3502
+ changeInputInRangeMode(inputValue) {
3503
+ const selecteds = inputValue.split(this.rangeSeparator);
3504
+ let fromString = selecteds[0];
3505
+ let toString = selecteds[1];
3506
+ if (this.dtPicker.pickerType === 'timer') {
3507
+ fromString = this.convertTimeStringToDateTimeString(fromString, this.values[0]);
3508
+ toString = this.convertTimeStringToDateTimeString(toString, this.values[1]);
3509
+ }
3510
+ let from = this.dateTimeAdapter.parse(fromString, this.dateTimeFormats.parseInput);
3511
+ let to = this.dateTimeAdapter.parse(toString, this.dateTimeFormats.parseInput);
3512
+ this.lastValueValid =
3513
+ (!from || this.dateTimeAdapter.isValid(from)) &&
3514
+ (!to || this.dateTimeAdapter.isValid(to));
3515
+ from = this.getValidDate(from);
3516
+ to = this.getValidDate(to);
3517
+ // if the newValue is the same as the oldValue, we intend to not fire the valueChange event
3518
+ if (!this.isSameValue(from, this._values[0]) ||
3519
+ !this.isSameValue(to, this._values[1]) ||
3520
+ (from === null && to === null)) {
3521
+ this._values = [from, to];
3522
+ this.valueChange.emit(this._values);
3523
+ this.onModelChange(this._values);
3524
+ this.dateTimeInput.emit({
3525
+ source: this,
3526
+ value: this._values,
3527
+ input: this.elmRef.nativeElement
3528
+ });
3281
3529
  }
3282
3530
  }
3283
3531
  /**
3284
- * Finds an open dialog by its id.
3285
- * @param id ID to use when looking up the dialog.
3532
+ * Check if the two value is the same
3286
3533
  */
3287
- getDialogById(id) {
3288
- return this.openDialogs.find(dialog => dialog.id === id);
3289
- }
3290
- attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config) {
3291
- const dialogRef = new OwlDialogRef(overlayRef, dialogContainer, config.id, this.location);
3292
- if (config.hasBackdrop) {
3293
- overlayRef.backdropClick().subscribe(() => {
3294
- if (!dialogRef.disableClose) {
3295
- dialogRef.close();
3296
- }
3297
- });
3298
- }
3299
- if (componentOrTemplateRef instanceof TemplateRef) {
3300
- }
3301
- else {
3302
- const injector = this.createInjector(config, dialogRef, dialogContainer);
3303
- const contentRef = dialogContainer.attachComponentPortal(new ComponentPortal(componentOrTemplateRef, undefined, injector));
3304
- dialogRef.componentInstance = contentRef.instance;
3534
+ isSameValue(first, second) {
3535
+ if (first && second) {
3536
+ return this.dateTimeAdapter.compare(first, second) === 0;
3305
3537
  }
3306
- dialogRef
3307
- .updateSize(config.width, config.height)
3308
- .updatePosition(config.position);
3309
- return dialogRef;
3538
+ return first == second;
3310
3539
  }
3311
- createInjector(config, dialogRef, dialogContainer) {
3312
- const userInjector = config &&
3313
- config.viewContainerRef &&
3314
- config.viewContainerRef.injector;
3315
- const injectionTokens = new WeakMap();
3316
- injectionTokens.set(OwlDialogRef, dialogRef);
3317
- injectionTokens.set(OwlDialogContainerComponent, dialogContainer);
3318
- injectionTokens.set(OWL_DIALOG_DATA, config.data);
3319
- return new PortalInjector(userInjector || this.injector, injectionTokens);
3540
+ }
3541
+ OwlDateTimeInputDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeInputDirective, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: DateTimeAdapter, optional: true }, { token: OWL_DATE_TIME_FORMATS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
3542
+ OwlDateTimeInputDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: OwlDateTimeInputDirective, selector: "input[owlDateTime]", inputs: { owlDateTime: "owlDateTime", owlDateTimeFilter: "owlDateTimeFilter", _disabled: "_disabled", min: "min", max: "max", selectMode: "selectMode", rangeSeparator: "rangeSeparator", value: "value", values: "values" }, outputs: { dateTimeChange: "dateTimeChange", dateTimeInput: "dateTimeInput" }, host: { listeners: { "keydown": "handleKeydownOnHost($event)", "blur": "handleBlurOnHost($event)", "input": "handleInputOnHost($event)", "change": "handleChangeOnHost($event)" }, properties: { "attr.aria-haspopup": "this.owlDateTimeInputAriaHaspopup", "attr.aria-owns": "this.owlDateTimeInputAriaOwns", "attr.min": "this.minIso8601", "attr.max": "this.maxIso8601", "disabled": "this.owlDateTimeInputDisabled" } }, providers: [
3543
+ OWL_DATETIME_VALUE_ACCESSOR,
3544
+ OWL_DATETIME_VALIDATORS
3545
+ ], exportAs: ["owlDateTimeInput"], ngImport: i0 });
3546
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeInputDirective, decorators: [{
3547
+ type: Directive,
3548
+ args: [{
3549
+ selector: 'input[owlDateTime]',
3550
+ exportAs: 'owlDateTimeInput',
3551
+ providers: [
3552
+ OWL_DATETIME_VALUE_ACCESSOR,
3553
+ OWL_DATETIME_VALIDATORS
3554
+ ]
3555
+ }]
3556
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: DateTimeAdapter, decorators: [{
3557
+ type: Optional
3558
+ }] }, { type: undefined, decorators: [{
3559
+ type: Optional
3560
+ }, {
3561
+ type: Inject,
3562
+ args: [OWL_DATE_TIME_FORMATS]
3563
+ }] }]; }, propDecorators: { owlDateTime: [{
3564
+ type: Input
3565
+ }], owlDateTimeFilter: [{
3566
+ type: Input
3567
+ }], _disabled: [{
3568
+ type: Input
3569
+ }], min: [{
3570
+ type: Input
3571
+ }], max: [{
3572
+ type: Input
3573
+ }], selectMode: [{
3574
+ type: Input
3575
+ }], rangeSeparator: [{
3576
+ type: Input
3577
+ }], value: [{
3578
+ type: Input
3579
+ }], values: [{
3580
+ type: Input
3581
+ }], dateTimeChange: [{
3582
+ type: Output
3583
+ }], dateTimeInput: [{
3584
+ type: Output
3585
+ }], owlDateTimeInputAriaHaspopup: [{
3586
+ type: HostBinding,
3587
+ args: ['attr.aria-haspopup']
3588
+ }], owlDateTimeInputAriaOwns: [{
3589
+ type: HostBinding,
3590
+ args: ['attr.aria-owns']
3591
+ }], minIso8601: [{
3592
+ type: HostBinding,
3593
+ args: ['attr.min']
3594
+ }], maxIso8601: [{
3595
+ type: HostBinding,
3596
+ args: ['attr.max']
3597
+ }], owlDateTimeInputDisabled: [{
3598
+ type: HostBinding,
3599
+ args: ['disabled']
3600
+ }], handleKeydownOnHost: [{
3601
+ type: HostListener,
3602
+ args: ['keydown', ['$event']]
3603
+ }], handleBlurOnHost: [{
3604
+ type: HostListener,
3605
+ args: ['blur', ['$event']]
3606
+ }], handleInputOnHost: [{
3607
+ type: HostListener,
3608
+ args: ['input', ['$event']]
3609
+ }], handleChangeOnHost: [{
3610
+ type: HostListener,
3611
+ args: ['change', ['$event']]
3612
+ }] } });
3613
+
3614
+ class OwlDateTimeTriggerDirective {
3615
+ constructor(changeDetector) {
3616
+ this.changeDetector = changeDetector;
3617
+ this.stateChanges = Subscription.EMPTY;
3320
3618
  }
3321
- createOverlay(config) {
3322
- const overlayConfig = this.getOverlayConfig(config);
3323
- return this.overlay.create(overlayConfig);
3619
+ get disabled() {
3620
+ return this._disabled === undefined ? this.dtPicker.disabled : !!this._disabled;
3324
3621
  }
3325
- attachDialogContainer(overlayRef, config) {
3326
- const containerPortal = new ComponentPortal(OwlDialogContainerComponent, config.viewContainerRef);
3327
- const containerRef = overlayRef.attach(containerPortal);
3328
- containerRef.instance.setConfig(config);
3329
- return containerRef.instance;
3622
+ set disabled(value) {
3623
+ this._disabled = value;
3330
3624
  }
3331
- getOverlayConfig(dialogConfig) {
3332
- const state = new OverlayConfig({
3333
- positionStrategy: this.overlay.position().global(),
3334
- scrollStrategy: dialogConfig.scrollStrategy || this.scrollStrategy(),
3335
- panelClass: dialogConfig.paneClass,
3336
- hasBackdrop: dialogConfig.hasBackdrop,
3337
- minWidth: dialogConfig.minWidth,
3338
- minHeight: dialogConfig.minHeight,
3339
- maxWidth: dialogConfig.maxWidth,
3340
- maxHeight: dialogConfig.maxHeight
3341
- });
3342
- if (dialogConfig.backdropClass) {
3343
- state.backdropClass = dialogConfig.backdropClass;
3344
- }
3345
- return state;
3625
+ get owlDTTriggerDisabledClass() {
3626
+ return this.disabled;
3346
3627
  }
3347
- removeOpenDialog(dialogRef) {
3348
- const index = this._openDialogsAtThisLevel.indexOf(dialogRef);
3349
- if (index > -1) {
3350
- this.openDialogs.splice(index, 1);
3351
- // If all the dialogs were closed, remove/restore the `aria-hidden`
3352
- // to a the siblings and emit to the `afterAllClosed` stream.
3353
- if (!this.openDialogs.length) {
3354
- this.ariaHiddenElements.forEach((previousValue, element) => {
3355
- if (previousValue) {
3356
- element.setAttribute('aria-hidden', previousValue);
3357
- }
3358
- else {
3359
- element.removeAttribute('aria-hidden');
3360
- }
3361
- });
3362
- this.ariaHiddenElements.clear();
3363
- this._afterAllClosed.next();
3364
- }
3628
+ ngOnInit() {
3629
+ }
3630
+ ngOnChanges(changes) {
3631
+ if (changes.datepicker) {
3632
+ this.watchStateChanges();
3365
3633
  }
3366
3634
  }
3367
- /**
3368
- * Hides all of the content that isn't an overlay from assistive technology.
3369
- */
3370
- hideNonDialogContentFromAssistiveTechnology() {
3371
- const overlayContainer = this.overlayContainer.getContainerElement();
3372
- // Ensure that the overlay container is attached to the DOM.
3373
- if (overlayContainer.parentElement) {
3374
- const siblings = overlayContainer.parentElement.children;
3375
- for (let i = siblings.length - 1; i > -1; i--) {
3376
- const sibling = siblings[i];
3377
- if (sibling !== overlayContainer &&
3378
- sibling.nodeName !== 'SCRIPT' &&
3379
- sibling.nodeName !== 'STYLE' &&
3380
- !sibling.hasAttribute('aria-live')) {
3381
- this.ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));
3382
- sibling.setAttribute('aria-hidden', 'true');
3383
- }
3384
- }
3635
+ ngAfterContentInit() {
3636
+ this.watchStateChanges();
3637
+ }
3638
+ ngOnDestroy() {
3639
+ this.stateChanges.unsubscribe();
3640
+ }
3641
+ handleClickOnHost(event) {
3642
+ if (this.dtPicker) {
3643
+ this.dtPicker.open();
3644
+ event.stopPropagation();
3385
3645
  }
3386
3646
  }
3647
+ watchStateChanges() {
3648
+ this.stateChanges.unsubscribe();
3649
+ const inputDisabled = this.dtPicker && this.dtPicker.dtInput ?
3650
+ this.dtPicker.dtInput.disabledChange : of();
3651
+ const pickerDisabled = this.dtPicker ?
3652
+ this.dtPicker.disabledChange : of();
3653
+ this.stateChanges = merge(pickerDisabled, inputDisabled)
3654
+ .subscribe(() => {
3655
+ this.changeDetector.markForCheck();
3656
+ });
3657
+ }
3387
3658
  }
3388
- OwlDialogService.decorators = [
3389
- { type: Injectable }
3390
- ];
3391
- OwlDialogService.ctorParameters = () => [
3392
- { type: Overlay },
3393
- { type: Injector },
3394
- { type: Location, decorators: [{ type: Optional }] },
3395
- { type: undefined, decorators: [{ type: Inject, args: [OWL_DIALOG_SCROLL_STRATEGY,] }] },
3396
- { type: OwlDialogConfig, decorators: [{ type: Optional }, { type: Inject, args: [OWL_DIALOG_DEFAULT_OPTIONS,] }] },
3397
- { type: OwlDialogService, decorators: [{ type: Optional }, { type: SkipSelf }] },
3398
- { type: OverlayContainer }
3399
- ];
3400
- /**
3401
- * Applies default options to the dialog config.
3402
- * @param config Config to be modified.
3403
- * @param defaultOptions Default config setting
3404
- * @returns The new configuration object.
3405
- */
3406
- function applyConfigDefaults(config, defaultOptions) {
3407
- return extendObject(new OwlDialogConfig(), config, defaultOptions);
3408
- }
3659
+ OwlDateTimeTriggerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeTriggerDirective, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Directive });
3660
+ OwlDateTimeTriggerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.0.2", type: OwlDateTimeTriggerDirective, selector: "[owlDateTimeTrigger]", inputs: { dtPicker: ["owlDateTimeTrigger", "dtPicker"], disabled: "disabled" }, host: { listeners: { "click": "handleClickOnHost($event)" }, properties: { "class.owl-dt-trigger-disabled": "this.owlDTTriggerDisabledClass" } }, usesOnChanges: true, ngImport: i0 });
3661
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeTriggerDirective, decorators: [{
3662
+ type: Directive,
3663
+ args: [{
3664
+ selector: '[owlDateTimeTrigger]'
3665
+ }]
3666
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { dtPicker: [{
3667
+ type: Input,
3668
+ args: ['owlDateTimeTrigger']
3669
+ }], disabled: [{
3670
+ type: Input
3671
+ }], owlDTTriggerDisabledClass: [{
3672
+ type: HostBinding,
3673
+ args: ['class.owl-dt-trigger-disabled']
3674
+ }], handleClickOnHost: [{
3675
+ type: HostListener,
3676
+ args: ['click', ['$event']]
3677
+ }] } });
3409
3678
 
3410
- /** Injection token that determines the scroll handling while the dtPicker is open. */
3411
- const OWL_DTPICKER_SCROLL_STRATEGY = new InjectionToken('owl-dtpicker-scroll-strategy');
3412
- /** @docs-private */
3413
- function OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
3414
- const fn = () => overlay.scrollStrategies.block();
3415
- return fn;
3416
- }
3417
- /** @docs-private */
3418
- const OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER = {
3419
- provide: OWL_DTPICKER_SCROLL_STRATEGY,
3420
- deps: [Overlay],
3421
- useFactory: OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY
3422
- };
3423
- class OwlDateTimeComponent extends OwlDateTimeDirective {
3424
- constructor(overlay, viewContainerRef, dialogService, ngZone, changeDetector, dateTimeAdapter, defaultScrollStrategy, dateTimeFormats, document) {
3425
- super(dateTimeAdapter, dateTimeFormats);
3426
- this.overlay = overlay;
3427
- this.viewContainerRef = viewContainerRef;
3428
- this.dialogService = dialogService;
3429
- this.ngZone = ngZone;
3430
- this.changeDetector = changeDetector;
3431
- this.dateTimeAdapter = dateTimeAdapter;
3432
- this.dateTimeFormats = dateTimeFormats;
3433
- this.document = document;
3434
- /** Custom class for the picker backdrop. */
3435
- this.backdropClass = [];
3436
- /** Custom class for the picker overlay pane. */
3437
- this.panelClass = [];
3679
+ let uniqueId = 0;
3680
+ class OwlDialogConfig {
3681
+ constructor() {
3438
3682
  /**
3439
- * Set the type of the dateTime picker
3440
- * 'both' -- show both calendar and timer
3441
- * 'calendar' -- show only calendar
3442
- * 'timer' -- show only timer
3683
+ * ID of the element that describes the dialog.
3443
3684
  */
3444
- this._pickerType = 'both';
3685
+ this.ariaDescribedBy = null;
3445
3686
  /**
3446
- * Whether the picker open as a dialog
3687
+ * Whether to focus the dialog when the dialog is opened
3447
3688
  */
3448
- this._pickerMode = 'popup';
3449
- /** Whether the calendar is open. */
3450
- this._opened = false;
3689
+ this.autoFocus = true;
3690
+ /** Whether the dialog has a backdrop. */
3691
+ this.hasBackdrop = true;
3692
+ /** Data being injected into the child component. */
3693
+ this.data = null;
3694
+ /** Whether the user can use escape or clicking outside to close a modal. */
3695
+ this.disableClose = false;
3451
3696
  /**
3452
- * Callback when the picker is closed
3697
+ * The ARIA role of the dialog element.
3698
+ */
3699
+ this.role = 'dialog';
3700
+ /**
3701
+ * Custom class for the pane
3453
3702
  * */
3454
- this.afterPickerClosed = new EventEmitter();
3703
+ this.paneClass = '';
3455
3704
  /**
3456
- * Callback when the picker is open
3705
+ * Mouse Event
3457
3706
  * */
3458
- this.afterPickerOpen = new EventEmitter();
3707
+ this.event = null;
3459
3708
  /**
3460
- * Emits selected year in multi-year view
3461
- * This doesn't imply a change on the selected date.
3709
+ * Custom class for the backdrop
3462
3710
  * */
3463
- this.yearSelected = new EventEmitter();
3711
+ this.backdropClass = '';
3464
3712
  /**
3465
- * Emits selected month in year view
3466
- * This doesn't imply a change on the selected date.
3713
+ * Whether the dialog should close when the user goes backwards/forwards in history.
3467
3714
  * */
3468
- this.monthSelected = new EventEmitter();
3715
+ this.closeOnNavigation = true;
3716
+ /** Width of the dialog. */
3717
+ this.width = '';
3718
+ /** Height of the dialog. */
3719
+ this.height = '';
3469
3720
  /**
3470
- * Emit when the selected value has been confirmed
3721
+ * The max-width of the overlay panel.
3722
+ * If a number is provided, pixel units are assumed.
3471
3723
  * */
3472
- this.confirmSelectedChange = new EventEmitter();
3724
+ this.maxWidth = '85vw';
3473
3725
  /**
3474
- * Emits when the date time picker is disabled.
3726
+ * The scroll strategy when the dialog is open
3727
+ * Learn more this from https://material.angular.io/cdk/overlay/overview#scroll-strategies
3475
3728
  * */
3476
- this.disabledChange = new EventEmitter();
3477
- this.dtInputSub = Subscription.EMPTY;
3478
- this.hidePickerStreamSub = Subscription.EMPTY;
3479
- this.confirmSelectedStreamSub = Subscription.EMPTY;
3480
- this.pickerOpenedStreamSub = Subscription.EMPTY;
3481
- /** The element that was focused before the date time picker was opened. */
3482
- this.focusedElementBeforeOpen = null;
3483
- this._selecteds = [];
3484
- this.defaultScrollStrategy = defaultScrollStrategy;
3729
+ this.scrollStrategy = new NoopScrollStrategy();
3730
+ this.id = `owl-dialog-${uniqueId++}`;
3485
3731
  }
3486
- get startAt() {
3487
- // If an explicit startAt is set we start there, otherwise we start at whatever the currently
3488
- // selected value is.
3489
- if (this._startAt) {
3490
- return this._startAt;
3491
- }
3492
- if (this._dtInput) {
3493
- if (this._dtInput.selectMode === 'single') {
3494
- return this._dtInput.value || null;
3495
- }
3496
- else if (this._dtInput.selectMode === 'range' ||
3497
- this._dtInput.selectMode === 'rangeFrom') {
3498
- return this._dtInput.values[0] || null;
3499
- }
3500
- else if (this._dtInput.selectMode === 'rangeTo') {
3501
- return this._dtInput.values[1] || null;
3502
- }
3503
- }
3504
- else {
3505
- return null;
3732
+ }
3733
+
3734
+ class OwlDialogRef {
3735
+ constructor(overlayRef, container, id, location) {
3736
+ this.overlayRef = overlayRef;
3737
+ this.container = container;
3738
+ this.id = id;
3739
+ this._beforeClose$ = new Subject();
3740
+ this._afterOpen$ = new Subject();
3741
+ this._afterClosed$ = new Subject();
3742
+ /** Subscription to changes in the user's location. */
3743
+ this.locationChanged = Subscription.EMPTY;
3744
+ /** Whether the user is allowed to close the dialog. */
3745
+ this.disableClose = this.container.config.disableClose;
3746
+ this.container.animationStateChanged
3747
+ .pipe(filter((event) => event.phaseName === 'done' && event.toState === 'enter'), take(1))
3748
+ .subscribe(() => {
3749
+ this._afterOpen$.next();
3750
+ this._afterOpen$.complete();
3751
+ });
3752
+ this.container.animationStateChanged
3753
+ .pipe(filter((event) => event.phaseName === 'done' && event.toState === 'exit'), take(1))
3754
+ .subscribe(() => {
3755
+ this.overlayRef.dispose();
3756
+ this.locationChanged.unsubscribe();
3757
+ this._afterClosed$.next(this.result);
3758
+ this._afterClosed$.complete();
3759
+ this.componentInstance = null;
3760
+ });
3761
+ this.overlayRef.keydownEvents()
3762
+ .pipe(filter(event => event.keyCode === ESCAPE && !this.disableClose))
3763
+ .subscribe(() => this.close());
3764
+ if (location) {
3765
+ this.locationChanged = location.subscribe(() => {
3766
+ if (this.container.config.closeOnNavigation) {
3767
+ this.close();
3768
+ }
3769
+ });
3506
3770
  }
3507
3771
  }
3508
- set startAt(date) {
3509
- this._startAt = this.getValidDate(this.dateTimeAdapter.deserialize(date));
3510
- }
3511
- get pickerType() {
3512
- return this._pickerType;
3772
+ close(dialogResult) {
3773
+ this.result = dialogResult;
3774
+ this.container.animationStateChanged
3775
+ .pipe(filter((event) => event.phaseName === 'start'), take(1))
3776
+ .subscribe(() => {
3777
+ this._beforeClose$.next(dialogResult);
3778
+ this._beforeClose$.complete();
3779
+ this.overlayRef.detachBackdrop();
3780
+ });
3781
+ this.container.startExitAnimation();
3513
3782
  }
3514
- set pickerType(val) {
3515
- if (val !== this._pickerType) {
3516
- this._pickerType = val;
3517
- if (this._dtInput) {
3518
- this._dtInput.formatNativeInputValue();
3519
- }
3520
- }
3783
+ /**
3784
+ * Gets an observable that emits when the overlay's backdrop has been clicked.
3785
+ */
3786
+ backdropClick() {
3787
+ return this.overlayRef.backdropClick();
3521
3788
  }
3522
- get pickerMode() {
3523
- return this._pickerMode;
3789
+ /**
3790
+ * Gets an observable that emits when keydown events are targeted on the overlay.
3791
+ */
3792
+ keydownEvents() {
3793
+ return this.overlayRef.keydownEvents();
3524
3794
  }
3525
- set pickerMode(mode) {
3526
- if (mode === 'popup') {
3527
- this._pickerMode = mode;
3795
+ /**
3796
+ * Updates the dialog's position.
3797
+ *
3798
+ * @param position New dialog position.
3799
+ */
3800
+ updatePosition(position) {
3801
+ const strategy = this.getPositionStrategy();
3802
+ if (position && (position.left || position.right)) {
3803
+ if (position.left)
3804
+ strategy.left(position.left);
3805
+ else
3806
+ strategy.right(position.right);
3528
3807
  }
3529
3808
  else {
3530
- this._pickerMode = 'dialog';
3809
+ strategy.centerHorizontally();
3531
3810
  }
3532
- }
3533
- get disabled() {
3534
- return this._disabled === undefined && this._dtInput
3535
- ? this._dtInput.disabled
3536
- : !!this._disabled;
3537
- }
3538
- set disabled(value) {
3539
- value = coerceBooleanProperty(value);
3540
- if (value !== this._disabled) {
3541
- this._disabled = value;
3542
- this.disabledChange.next(value);
3811
+ if (position && (position.top || position.bottom)) {
3812
+ if (position.top)
3813
+ strategy.top(position.top);
3814
+ else
3815
+ strategy.bottom(position.bottom);
3543
3816
  }
3817
+ else {
3818
+ strategy.centerVertically();
3819
+ }
3820
+ this.overlayRef.updatePosition();
3821
+ return this;
3544
3822
  }
3545
- get opened() {
3546
- return this._opened;
3823
+ /**
3824
+ * Updates the dialog's width and height.
3825
+ *
3826
+ * @param width New width of the dialog.
3827
+ * @param height New height of the dialog.
3828
+ */
3829
+ updateSize(width = 'auto', height = 'auto') {
3830
+ this.overlayRef.updateSize({ width, height });
3831
+ this.overlayRef.updatePosition();
3832
+ return this;
3547
3833
  }
3548
- set opened(val) {
3549
- val ? this.open() : this.close();
3834
+ isAnimating() {
3835
+ return this.container.isAnimating;
3550
3836
  }
3551
- get dtInput() {
3552
- return this._dtInput;
3837
+ afterOpen() {
3838
+ return this._afterOpen$.asObservable();
3553
3839
  }
3554
- get selected() {
3555
- return this._selected;
3840
+ beforeClose() {
3841
+ return this._beforeClose$.asObservable();
3556
3842
  }
3557
- set selected(value) {
3558
- this._selected = value;
3559
- this.changeDetector.markForCheck();
3843
+ afterClosed() {
3844
+ return this._afterClosed$.asObservable();
3560
3845
  }
3561
- get selecteds() {
3562
- return this._selecteds;
3846
+ /** Fetches the position strategy object from the overlay ref. */
3847
+ getPositionStrategy() {
3848
+ return this.overlayRef.getConfig().positionStrategy;
3563
3849
  }
3564
- set selecteds(values) {
3565
- this._selecteds = values;
3566
- this.changeDetector.markForCheck();
3850
+ }
3851
+
3852
+ /**
3853
+ * Extends an object with the *enumerable* and *own* properties of one or more source objects,
3854
+ * similar to Object.assign.
3855
+ *
3856
+ * @param dest The object which will have properties copied to it.
3857
+ * @param sources The source objects from which properties will be copied.
3858
+ */
3859
+ function extendObject(dest, ...sources) {
3860
+ if (dest == null) {
3861
+ throw TypeError('Cannot convert undefined or null to object');
3567
3862
  }
3568
- /** The minimum selectable date. */
3569
- get minDateTime() {
3570
- return this._dtInput && this._dtInput.min;
3863
+ for (const source of sources) {
3864
+ if (source != null) {
3865
+ for (const key in source) {
3866
+ if (source.hasOwnProperty(key)) {
3867
+ dest[key] = source[key];
3868
+ }
3869
+ }
3870
+ }
3571
3871
  }
3572
- /** The maximum selectable date. */
3573
- get maxDateTime() {
3574
- return this._dtInput && this._dtInput.max;
3872
+ return dest;
3873
+ }
3874
+
3875
+ const zoomFadeIn = {
3876
+ opacity: 0,
3877
+ transform: 'translateX({{ x }}) translateY({{ y }}) scale({{scale}})'
3878
+ };
3879
+ const zoomFadeInFrom = {
3880
+ opacity: 0,
3881
+ transform: 'translateX({{ x }}) translateY({{ y }}) scale({{scale}})',
3882
+ transformOrigin: '{{ ox }} {{ oy }}'
3883
+ };
3884
+ class OwlDialogContainerComponent extends BasePortalOutlet {
3885
+ constructor(changeDetector, elementRef, focusTrapFactory, document) {
3886
+ super();
3887
+ this.changeDetector = changeDetector;
3888
+ this.elementRef = elementRef;
3889
+ this.focusTrapFactory = focusTrapFactory;
3890
+ this.document = document;
3891
+ /** ID of the element that should be considered as the dialog's label. */
3892
+ this.ariaLabelledBy = null;
3893
+ /** Emits when an animation state changes. */
3894
+ this.animationStateChanged = new EventEmitter();
3895
+ this.isAnimating = false;
3896
+ this.state = 'enter';
3897
+ // for animation purpose
3898
+ this.params = {
3899
+ x: '0px',
3900
+ y: '0px',
3901
+ ox: '50%',
3902
+ oy: '50%',
3903
+ scale: 0
3904
+ };
3905
+ // A variable to hold the focused element before the dialog was open.
3906
+ // This would help us to refocus back to element when the dialog was closed.
3907
+ this.elementFocusedBeforeDialogWasOpened = null;
3575
3908
  }
3576
- get dateTimeFilter() {
3577
- return this._dtInput && this._dtInput.dateTimeFilter;
3909
+ get config() {
3910
+ return this._config;
3578
3911
  }
3579
- get selectMode() {
3580
- return this._dtInput.selectMode;
3912
+ get owlDialogContainerClass() {
3913
+ return true;
3581
3914
  }
3582
- get isInSingleMode() {
3583
- return this._dtInput.isInSingleMode;
3915
+ get owlDialogContainerTabIndex() {
3916
+ return -1;
3584
3917
  }
3585
- get isInRangeMode() {
3586
- return this._dtInput.isInRangeMode;
3918
+ get owlDialogContainerId() {
3919
+ return this._config.id;
3587
3920
  }
3588
- ngOnInit() { }
3589
- ngOnDestroy() {
3590
- this.close();
3591
- this.dtInputSub.unsubscribe();
3592
- this.disabledChange.complete();
3593
- if (this.popupRef) {
3594
- this.popupRef.dispose();
3595
- }
3921
+ get owlDialogContainerRole() {
3922
+ return this._config.role || null;
3596
3923
  }
3597
- registerInput(input) {
3598
- if (this._dtInput) {
3599
- throw Error('A Owl DateTimePicker can only be associated with a single input.');
3600
- }
3601
- this._dtInput = input;
3602
- this.dtInputSub = this._dtInput.valueChange.subscribe((value) => {
3603
- if (Array.isArray(value)) {
3604
- this.selecteds = value;
3605
- }
3606
- else {
3607
- this.selected = value;
3608
- }
3609
- });
3924
+ get owlDialogContainerAriaLabelledby() {
3925
+ return this.ariaLabelledBy;
3610
3926
  }
3611
- open() {
3612
- if (this._opened || this.disabled) {
3613
- return;
3614
- }
3615
- if (!this._dtInput) {
3616
- throw Error('Attempted to open an DateTimePicker with no associated input.');
3617
- }
3618
- if (this.document) {
3619
- this.focusedElementBeforeOpen = this.document.activeElement;
3620
- }
3621
- // reset the picker selected value
3622
- if (this.isInSingleMode) {
3623
- this.selected = this._dtInput.value;
3624
- }
3625
- else if (this.isInRangeMode) {
3626
- this.selecteds = this._dtInput.values;
3627
- }
3628
- // when the picker is open , we make sure the picker's current selected time value
3629
- // is the same as the _startAt time value.
3630
- if (this.selected && this.pickerType !== 'calendar' && this._startAt) {
3631
- this.selected = this.dateTimeAdapter.createDate(this.dateTimeAdapter.getYear(this.selected), this.dateTimeAdapter.getMonth(this.selected), this.dateTimeAdapter.getDate(this.selected), this.dateTimeAdapter.getHours(this._startAt), this.dateTimeAdapter.getMinutes(this._startAt), this.dateTimeAdapter.getSeconds(this._startAt));
3632
- }
3633
- this.pickerMode === 'dialog' ? this.openAsDialog() : this.openAsPopup();
3634
- this.pickerContainer.picker = this;
3635
- // Listen to picker container's hidePickerStream
3636
- this.hidePickerStreamSub = this.pickerContainer.hidePickerStream.subscribe(() => {
3637
- this.close();
3638
- });
3639
- // Listen to picker container's confirmSelectedStream
3640
- this.confirmSelectedStreamSub = this.pickerContainer.confirmSelectedStream.subscribe((event) => {
3641
- this.confirmSelect(event);
3642
- });
3927
+ get owlDialogContainerAriaDescribedby() {
3928
+ return this._config.ariaDescribedBy || null;
3929
+ }
3930
+ get owlDialogContainerAnimation() {
3931
+ return { value: this.state, params: this.params };
3643
3932
  }
3933
+ ngOnInit() { }
3644
3934
  /**
3645
- * Selects the given date
3935
+ * Attach a ComponentPortal as content to this dialog container.
3646
3936
  */
3647
- select(date) {
3648
- if (Array.isArray(date)) {
3649
- this.selecteds = [...date];
3650
- }
3651
- else {
3652
- this.selected = date;
3937
+ attachComponentPortal(portal) {
3938
+ if (this.portalOutlet.hasAttached()) {
3939
+ throw Error('Attempting to attach dialog content after content is already attached');
3653
3940
  }
3654
- /**
3655
- * Cases in which automatically confirm the select when date or dates are selected:
3656
- * 1) picker mode is NOT 'dialog'
3657
- * 2) picker type is 'calendar' and selectMode is 'single'.
3658
- * 3) picker type is 'calendar' and selectMode is 'range' and
3659
- * the 'selecteds' has 'from'(selecteds[0]) and 'to'(selecteds[1]) values.
3660
- * 4) selectMode is 'rangeFrom' and selecteds[0] has value.
3661
- * 5) selectMode is 'rangeTo' and selecteds[1] has value.
3662
- * */
3663
- if (this.pickerMode !== 'dialog' &&
3664
- this.pickerType === 'calendar' &&
3665
- ((this.selectMode === 'single' && this.selected) ||
3666
- (this.selectMode === 'rangeFrom' && this.selecteds[0]) ||
3667
- (this.selectMode === 'rangeTo' && this.selecteds[1]) ||
3668
- (this.selectMode === 'range' &&
3669
- this.selecteds[0] &&
3670
- this.selecteds[1]))) {
3671
- this.confirmSelect();
3941
+ this.savePreviouslyFocusedElement();
3942
+ return this.portalOutlet.attachComponentPortal(portal);
3943
+ }
3944
+ attachTemplatePortal(_portal) {
3945
+ throw new Error('Method not implemented.');
3946
+ }
3947
+ setConfig(config) {
3948
+ this._config = config;
3949
+ if (config.event) {
3950
+ this.calculateZoomOrigin(config.event);
3672
3951
  }
3673
3952
  }
3674
- /**
3675
- * Emits the selected year in multi-year view
3676
- * */
3677
- selectYear(normalizedYear) {
3678
- this.yearSelected.emit(normalizedYear);
3953
+ onAnimationStart(event) {
3954
+ this.isAnimating = true;
3955
+ this.animationStateChanged.emit(event);
3679
3956
  }
3680
- /**
3681
- * Emits selected month in year view
3682
- * */
3683
- selectMonth(normalizedMonth) {
3684
- this.monthSelected.emit(normalizedMonth);
3957
+ onAnimationDone(event) {
3958
+ if (event.toState === 'enter') {
3959
+ this.trapFocus();
3960
+ }
3961
+ else if (event.toState === 'exit') {
3962
+ this.restoreFocus();
3963
+ }
3964
+ this.animationStateChanged.emit(event);
3965
+ this.isAnimating = false;
3966
+ }
3967
+ startExitAnimation() {
3968
+ this.state = 'exit';
3969
+ this.changeDetector.markForCheck();
3685
3970
  }
3686
3971
  /**
3687
- * Hide the picker
3972
+ * Calculate origin used in the `zoomFadeInFrom()`
3973
+ * for animation purpose
3688
3974
  */
3689
- close() {
3690
- if (!this._opened) {
3975
+ calculateZoomOrigin(event) {
3976
+ if (!event) {
3691
3977
  return;
3692
3978
  }
3693
- if (this.popupRef && this.popupRef.hasAttached()) {
3694
- this.popupRef.detach();
3695
- }
3696
- if (this.pickerContainerPortal &&
3697
- this.pickerContainerPortal.isAttached) {
3698
- this.pickerContainerPortal.detach();
3979
+ const clientX = event.clientX;
3980
+ const clientY = event.clientY;
3981
+ const wh = window.innerWidth / 2;
3982
+ const hh = window.innerHeight / 2;
3983
+ const x = clientX - wh;
3984
+ const y = clientY - hh;
3985
+ const ox = clientX / window.innerWidth;
3986
+ const oy = clientY / window.innerHeight;
3987
+ this.params.x = `${x}px`;
3988
+ this.params.y = `${y}px`;
3989
+ this.params.ox = `${ox * 100}%`;
3990
+ this.params.oy = `${oy * 100}%`;
3991
+ this.params.scale = 0;
3992
+ return;
3993
+ }
3994
+ /**
3995
+ * Save the focused element before dialog was open
3996
+ */
3997
+ savePreviouslyFocusedElement() {
3998
+ if (this.document) {
3999
+ this.elementFocusedBeforeDialogWasOpened = this.document
4000
+ .activeElement;
4001
+ Promise.resolve().then(() => this.elementRef.nativeElement.focus());
3699
4002
  }
3700
- if (this.hidePickerStreamSub) {
3701
- this.hidePickerStreamSub.unsubscribe();
3702
- this.hidePickerStreamSub = null;
4003
+ }
4004
+ trapFocus() {
4005
+ if (!this.focusTrap) {
4006
+ this.focusTrap = this.focusTrapFactory.create(this.elementRef.nativeElement);
3703
4007
  }
3704
- if (this.confirmSelectedStreamSub) {
3705
- this.confirmSelectedStreamSub.unsubscribe();
3706
- this.confirmSelectedStreamSub = null;
4008
+ if (this._config.autoFocus) {
4009
+ this.focusTrap.focusInitialElementWhenReady();
3707
4010
  }
3708
- if (this.pickerOpenedStreamSub) {
3709
- this.pickerOpenedStreamSub.unsubscribe();
3710
- this.pickerOpenedStreamSub = null;
3711
- }
3712
- if (this.dialogRef) {
3713
- this.dialogRef.close();
3714
- this.dialogRef = null;
4011
+ }
4012
+ restoreFocus() {
4013
+ const toFocus = this.elementFocusedBeforeDialogWasOpened;
4014
+ // We need the extra check, because IE can set the `activeElement` to null in some cases.
4015
+ if (toFocus && typeof toFocus.focus === 'function') {
4016
+ toFocus.focus();
3715
4017
  }
3716
- const completeClose = () => {
3717
- if (this._opened) {
3718
- this._opened = false;
3719
- this.afterPickerClosed.emit(null);
3720
- this.focusedElementBeforeOpen = null;
3721
- }
3722
- };
3723
- if (this.focusedElementBeforeOpen &&
3724
- typeof this.focusedElementBeforeOpen.focus === 'function') {
3725
- // Because IE moves focus asynchronously, we can't count on it being restored before we've
3726
- // marked the datepicker as closed. If the event fires out of sequence and the element that
3727
- // we're refocusing opens the datepicker on focus, the user could be stuck with not being
3728
- // able to close the calendar at all. We work around it by making the logic, that marks
3729
- // the datepicker as closed, async as well.
3730
- this.focusedElementBeforeOpen.focus();
3731
- setTimeout(completeClose);
4018
+ if (this.focusTrap) {
4019
+ this.focusTrap.destroy();
3732
4020
  }
3733
- else {
3734
- completeClose();
4021
+ }
4022
+ }
4023
+ OwlDialogContainerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogContainerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i1$1.ConfigurableFocusTrapFactory }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
4024
+ OwlDialogContainerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlDialogContainerComponent, selector: "owl-dialog-container", host: { listeners: { "@slideModal.start": "onAnimationStart($event)", "@slideModal.done": "onAnimationDone($event)" }, properties: { "class.owl-dialog-container": "this.owlDialogContainerClass", "attr.tabindex": "this.owlDialogContainerTabIndex", "attr.id": "this.owlDialogContainerId", "attr.role": "this.owlDialogContainerRole", "attr.aria-labelledby": "this.owlDialogContainerAriaLabelledby", "attr.aria-describedby": "this.owlDialogContainerAriaDescribedby", "@slideModal": "this.owlDialogContainerAnimation" } }, viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet></ng-template>\n", directives: [{ type: i2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [
4025
+ trigger('slideModal', [
4026
+ transition('void => enter', [
4027
+ style(zoomFadeInFrom),
4028
+ animate('300ms cubic-bezier(0.35, 0, 0.25, 1)', style('*')),
4029
+ animate('150ms', keyframes([
4030
+ style({ transform: 'scale(1)', offset: 0 }),
4031
+ style({ transform: 'scale(1.05)', offset: 0.3 }),
4032
+ style({ transform: 'scale(.95)', offset: 0.8 }),
4033
+ style({ transform: 'scale(1)', offset: 1.0 })
4034
+ ])),
4035
+ animateChild()
4036
+ ], {
4037
+ params: {
4038
+ x: '0px',
4039
+ y: '0px',
4040
+ ox: '50%',
4041
+ oy: '50%',
4042
+ scale: 1
4043
+ }
4044
+ }),
4045
+ transition('enter => exit', [animateChild(), animate(200, style(zoomFadeIn))], { params: { x: '0px', y: '0px', ox: '50%', oy: '50%' } })
4046
+ ])
4047
+ ] });
4048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogContainerComponent, decorators: [{
4049
+ type: Component,
4050
+ args: [{ selector: 'owl-dialog-container', animations: [
4051
+ trigger('slideModal', [
4052
+ transition('void => enter', [
4053
+ style(zoomFadeInFrom),
4054
+ animate('300ms cubic-bezier(0.35, 0, 0.25, 1)', style('*')),
4055
+ animate('150ms', keyframes([
4056
+ style({ transform: 'scale(1)', offset: 0 }),
4057
+ style({ transform: 'scale(1.05)', offset: 0.3 }),
4058
+ style({ transform: 'scale(.95)', offset: 0.8 }),
4059
+ style({ transform: 'scale(1)', offset: 1.0 })
4060
+ ])),
4061
+ animateChild()
4062
+ ], {
4063
+ params: {
4064
+ x: '0px',
4065
+ y: '0px',
4066
+ ox: '50%',
4067
+ oy: '50%',
4068
+ scale: 1
4069
+ }
4070
+ }),
4071
+ transition('enter => exit', [animateChild(), animate(200, style(zoomFadeIn))], { params: { x: '0px', y: '0px', ox: '50%', oy: '50%' } })
4072
+ ])
4073
+ ], template: "<ng-template cdkPortalOutlet></ng-template>\n" }]
4074
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i0.ElementRef }, { type: i1$1.ConfigurableFocusTrapFactory }, { type: undefined, decorators: [{
4075
+ type: Optional
4076
+ }, {
4077
+ type: Inject,
4078
+ args: [DOCUMENT]
4079
+ }] }]; }, propDecorators: { portalOutlet: [{
4080
+ type: ViewChild,
4081
+ args: [CdkPortalOutlet, { static: true }]
4082
+ }], owlDialogContainerClass: [{
4083
+ type: HostBinding,
4084
+ args: ['class.owl-dialog-container']
4085
+ }], owlDialogContainerTabIndex: [{
4086
+ type: HostBinding,
4087
+ args: ['attr.tabindex']
4088
+ }], owlDialogContainerId: [{
4089
+ type: HostBinding,
4090
+ args: ['attr.id']
4091
+ }], owlDialogContainerRole: [{
4092
+ type: HostBinding,
4093
+ args: ['attr.role']
4094
+ }], owlDialogContainerAriaLabelledby: [{
4095
+ type: HostBinding,
4096
+ args: ['attr.aria-labelledby']
4097
+ }], owlDialogContainerAriaDescribedby: [{
4098
+ type: HostBinding,
4099
+ args: ['attr.aria-describedby']
4100
+ }], owlDialogContainerAnimation: [{
4101
+ type: HostBinding,
4102
+ args: ['@slideModal']
4103
+ }], onAnimationStart: [{
4104
+ type: HostListener,
4105
+ args: ['@slideModal.start', ['$event']]
4106
+ }], onAnimationDone: [{
4107
+ type: HostListener,
4108
+ args: ['@slideModal.done', ['$event']]
4109
+ }] } });
4110
+
4111
+ const OWL_DIALOG_DATA = new InjectionToken('OwlDialogData');
4112
+ /**
4113
+ * Injection token that determines the scroll handling while the dialog is open.
4114
+ * */
4115
+ const OWL_DIALOG_SCROLL_STRATEGY = new InjectionToken('owl-dialog-scroll-strategy');
4116
+ function OWL_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
4117
+ const fn = () => overlay.scrollStrategies.block();
4118
+ return fn;
4119
+ }
4120
+ /** @docs-private */
4121
+ const OWL_DIALOG_SCROLL_STRATEGY_PROVIDER = {
4122
+ provide: OWL_DIALOG_SCROLL_STRATEGY,
4123
+ deps: [Overlay],
4124
+ useFactory: OWL_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY
4125
+ };
4126
+ /** I
4127
+ * njection token that can be used to specify default dialog options.
4128
+ * */
4129
+ const OWL_DIALOG_DEFAULT_OPTIONS = new InjectionToken('owl-dialog-default-options');
4130
+ class OwlDialogService {
4131
+ constructor(overlay, injector, location, scrollStrategy, defaultOptions, parentDialog, overlayContainer) {
4132
+ this.overlay = overlay;
4133
+ this.injector = injector;
4134
+ this.location = location;
4135
+ this.defaultOptions = defaultOptions;
4136
+ this.parentDialog = parentDialog;
4137
+ this.overlayContainer = overlayContainer;
4138
+ this.ariaHiddenElements = new Map();
4139
+ this._openDialogsAtThisLevel = [];
4140
+ this._afterOpenAtThisLevel = new Subject();
4141
+ this._afterAllClosedAtThisLevel = new Subject();
4142
+ /**
4143
+ * Stream that emits when all open dialog have finished closing.
4144
+ * Will emit on subscribe if there are no open dialogs to begin with.
4145
+ */
4146
+ this.afterAllClosed = defer(() => this._openDialogsAtThisLevel.length
4147
+ ? this._afterAllClosed
4148
+ : of([undefined], this._afterAllClosed).pipe(concatAll()));
4149
+ this.scrollStrategy = scrollStrategy;
4150
+ if (!parentDialog && location) {
4151
+ location.subscribe(() => this.closeAll());
3735
4152
  }
3736
4153
  }
3737
- /**
3738
- * Confirm the selected value
3739
- */
3740
- confirmSelect(_event) {
3741
- if (this.isInSingleMode) {
3742
- const selected = this.selected || this.startAt || this.dateTimeAdapter.now();
3743
- this.confirmSelectedChange.emit(selected);
4154
+ /** Keeps track of the currently-open dialogs. */
4155
+ get openDialogs() {
4156
+ return this.parentDialog
4157
+ ? this.parentDialog.openDialogs
4158
+ : this._openDialogsAtThisLevel;
4159
+ }
4160
+ /** Stream that emits when a dialog has been opened. */
4161
+ get afterOpen() {
4162
+ return this.parentDialog
4163
+ ? this.parentDialog.afterOpen
4164
+ : this._afterOpenAtThisLevel;
4165
+ }
4166
+ get _afterAllClosed() {
4167
+ const parent = this.parentDialog;
4168
+ return parent
4169
+ ? parent._afterAllClosed
4170
+ : this._afterAllClosedAtThisLevel;
4171
+ }
4172
+ open(componentOrTemplateRef, config) {
4173
+ config = applyConfigDefaults(config, this.defaultOptions);
4174
+ if (config.id && this.getDialogById(config.id)) {
4175
+ throw Error(`Dialog with id "${config.id}" exists already. The dialog id must be unique.`);
3744
4176
  }
3745
- else if (this.isInRangeMode) {
3746
- this.confirmSelectedChange.emit(this.selecteds);
4177
+ const overlayRef = this.createOverlay(config);
4178
+ const dialogContainer = this.attachDialogContainer(overlayRef, config);
4179
+ const dialogRef = this.attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config);
4180
+ if (!this.openDialogs.length) {
4181
+ this.hideNonDialogContentFromAssistiveTechnology();
3747
4182
  }
3748
- this.close();
3749
- return;
4183
+ this.openDialogs.push(dialogRef);
4184
+ dialogRef
4185
+ .afterClosed()
4186
+ .subscribe(() => this.removeOpenDialog(dialogRef));
4187
+ this.afterOpen.next(dialogRef);
4188
+ return dialogRef;
3750
4189
  }
3751
4190
  /**
3752
- * Open the picker as a dialog
4191
+ * Closes all of the currently-open dialogs.
3753
4192
  */
3754
- openAsDialog() {
3755
- this.dialogRef = this.dialogService.open(OwlDateTimeContainerComponent, {
3756
- autoFocus: false,
3757
- backdropClass: [
3758
- 'cdk-overlay-dark-backdrop',
3759
- ...coerceArray(this.backdropClass)
3760
- ],
3761
- paneClass: ['owl-dt-dialog', ...coerceArray(this.panelClass)],
3762
- viewContainerRef: this.viewContainerRef,
3763
- scrollStrategy: this.scrollStrategy || this.defaultScrollStrategy()
3764
- });
3765
- this.pickerContainer = this.dialogRef.componentInstance;
3766
- this.dialogRef.afterOpen().subscribe(() => {
3767
- this.afterPickerOpen.emit(null);
3768
- this._opened = true;
3769
- });
3770
- this.dialogRef.afterClosed().subscribe(() => this.close());
4193
+ closeAll() {
4194
+ let i = this.openDialogs.length;
4195
+ while (i--) {
4196
+ this.openDialogs[i].close();
4197
+ }
3771
4198
  }
3772
4199
  /**
3773
- * Open the picker as popup
4200
+ * Finds an open dialog by its id.
4201
+ *
4202
+ * @param id ID to use when looking up the dialog.
3774
4203
  */
3775
- openAsPopup() {
3776
- if (!this.pickerContainerPortal) {
3777
- this.pickerContainerPortal = new ComponentPortal(OwlDateTimeContainerComponent, this.viewContainerRef);
4204
+ getDialogById(id) {
4205
+ return this.openDialogs.find(dialog => dialog.id === id);
4206
+ }
4207
+ attachDialogContent(componentOrTemplateRef, dialogContainer, overlayRef, config) {
4208
+ const dialogRef = new OwlDialogRef(overlayRef, dialogContainer, config.id, this.location);
4209
+ if (config.hasBackdrop) {
4210
+ overlayRef.backdropClick().subscribe(() => {
4211
+ if (!dialogRef.disableClose) {
4212
+ dialogRef.close();
4213
+ }
4214
+ });
3778
4215
  }
3779
- if (!this.popupRef) {
3780
- this.createPopup();
4216
+ if (componentOrTemplateRef instanceof TemplateRef) {
3781
4217
  }
3782
- if (!this.popupRef.hasAttached()) {
3783
- const componentRef = this.popupRef.attach(this.pickerContainerPortal);
3784
- this.pickerContainer = componentRef.instance;
3785
- // Update the position once the calendar has rendered.
3786
- this.ngZone.onStable
3787
- .asObservable()
3788
- .pipe(take(1))
3789
- .subscribe(() => {
3790
- this.popupRef.updatePosition();
3791
- });
3792
- // emit open stream
3793
- this.pickerOpenedStreamSub = this.pickerContainer.pickerOpenedStream
3794
- .pipe(take(1))
3795
- .subscribe(() => {
3796
- this.afterPickerOpen.emit(null);
3797
- this._opened = true;
3798
- });
4218
+ else {
4219
+ const injector = this.createInjector(config, dialogRef, dialogContainer);
4220
+ const contentRef = dialogContainer.attachComponentPortal(new ComponentPortal(componentOrTemplateRef, undefined, injector));
4221
+ dialogRef.componentInstance = contentRef.instance;
3799
4222
  }
4223
+ dialogRef
4224
+ .updateSize(config.width, config.height)
4225
+ .updatePosition(config.position);
4226
+ return dialogRef;
3800
4227
  }
3801
- createPopup() {
3802
- const overlayConfig = new OverlayConfig({
3803
- positionStrategy: this.createPopupPositionStrategy(),
3804
- hasBackdrop: true,
3805
- backdropClass: [
3806
- 'cdk-overlay-transparent-backdrop',
3807
- ...coerceArray(this.backdropClass)
4228
+ createInjector(config, dialogRef, dialogContainer) {
4229
+ const userInjector = config &&
4230
+ config.viewContainerRef &&
4231
+ config.viewContainerRef.injector;
4232
+ return Injector.create({
4233
+ providers: [
4234
+ { provide: OwlDialogRef, useValue: dialogRef },
4235
+ { provide: OwlDialogContainerComponent, useValue: dialogContainer },
4236
+ { provide: OWL_DIALOG_DATA, useValue: config.data }
3808
4237
  ],
3809
- scrollStrategy: this.scrollStrategy || this.defaultScrollStrategy(),
3810
- panelClass: ['owl-dt-popup', ...coerceArray(this.panelClass)]
4238
+ parent: userInjector || this.injector
3811
4239
  });
3812
- this.popupRef = this.overlay.create(overlayConfig);
3813
- merge(this.popupRef.backdropClick(), this.popupRef.detachments(), this.popupRef
3814
- .keydownEvents()
3815
- .pipe(filter(event => event.keyCode === ESCAPE ||
3816
- (this._dtInput &&
3817
- event.altKey &&
3818
- event.keyCode === UP_ARROW)))).subscribe(() => this.close());
4240
+ }
4241
+ createOverlay(config) {
4242
+ const overlayConfig = this.getOverlayConfig(config);
4243
+ return this.overlay.create(overlayConfig);
4244
+ }
4245
+ attachDialogContainer(overlayRef, config) {
4246
+ const containerPortal = new ComponentPortal(OwlDialogContainerComponent, config.viewContainerRef);
4247
+ const containerRef = overlayRef.attach(containerPortal);
4248
+ containerRef.instance.setConfig(config);
4249
+ return containerRef.instance;
4250
+ }
4251
+ getOverlayConfig(dialogConfig) {
4252
+ const state = new OverlayConfig({
4253
+ positionStrategy: this.overlay.position().global(),
4254
+ scrollStrategy: dialogConfig.scrollStrategy || this.scrollStrategy(),
4255
+ panelClass: dialogConfig.paneClass,
4256
+ hasBackdrop: dialogConfig.hasBackdrop,
4257
+ minWidth: dialogConfig.minWidth,
4258
+ minHeight: dialogConfig.minHeight,
4259
+ maxWidth: dialogConfig.maxWidth,
4260
+ maxHeight: dialogConfig.maxHeight
4261
+ });
4262
+ if (dialogConfig.backdropClass) {
4263
+ state.backdropClass = dialogConfig.backdropClass;
4264
+ }
4265
+ return state;
4266
+ }
4267
+ removeOpenDialog(dialogRef) {
4268
+ const index = this._openDialogsAtThisLevel.indexOf(dialogRef);
4269
+ if (index > -1) {
4270
+ this.openDialogs.splice(index, 1);
4271
+ // If all the dialogs were closed, remove/restore the `aria-hidden`
4272
+ // to a the siblings and emit to the `afterAllClosed` stream.
4273
+ if (!this.openDialogs.length) {
4274
+ this.ariaHiddenElements.forEach((previousValue, element) => {
4275
+ if (previousValue) {
4276
+ element.setAttribute('aria-hidden', previousValue);
4277
+ }
4278
+ else {
4279
+ element.removeAttribute('aria-hidden');
4280
+ }
4281
+ });
4282
+ this.ariaHiddenElements.clear();
4283
+ this._afterAllClosed.next();
4284
+ }
4285
+ }
3819
4286
  }
3820
4287
  /**
3821
- * Create the popup PositionStrategy.
3822
- * */
3823
- createPopupPositionStrategy() {
3824
- return this.overlay
3825
- .position()
3826
- .flexibleConnectedTo(this._dtInput.elementRef)
3827
- .withTransformOriginOn('.owl-dt-container')
3828
- .withFlexibleDimensions(false)
3829
- .withPush(false)
3830
- .withPositions([
3831
- {
3832
- originX: 'start',
3833
- originY: 'bottom',
3834
- overlayX: 'start',
3835
- overlayY: 'top'
3836
- },
3837
- {
3838
- originX: 'start',
3839
- originY: 'top',
3840
- overlayX: 'start',
3841
- overlayY: 'bottom'
3842
- },
3843
- {
3844
- originX: 'end',
3845
- originY: 'bottom',
3846
- overlayX: 'end',
3847
- overlayY: 'top'
3848
- },
3849
- {
3850
- originX: 'end',
3851
- originY: 'top',
3852
- overlayX: 'end',
3853
- overlayY: 'bottom'
3854
- },
3855
- {
3856
- originX: 'start',
3857
- originY: 'top',
3858
- overlayX: 'start',
3859
- overlayY: 'top',
3860
- offsetY: -176
3861
- },
3862
- {
3863
- originX: 'start',
3864
- originY: 'top',
3865
- overlayX: 'start',
3866
- overlayY: 'top',
3867
- offsetY: -352
4288
+ * Hides all of the content that isn't an overlay from assistive technology.
4289
+ */
4290
+ hideNonDialogContentFromAssistiveTechnology() {
4291
+ const overlayContainer = this.overlayContainer.getContainerElement();
4292
+ // Ensure that the overlay container is attached to the DOM.
4293
+ if (overlayContainer.parentElement) {
4294
+ const siblings = overlayContainer.parentElement.children;
4295
+ for (let i = siblings.length - 1; i > -1; i--) {
4296
+ const sibling = siblings[i];
4297
+ if (sibling !== overlayContainer &&
4298
+ sibling.nodeName !== 'SCRIPT' &&
4299
+ sibling.nodeName !== 'STYLE' &&
4300
+ !sibling.hasAttribute('aria-live')) {
4301
+ this.ariaHiddenElements.set(sibling, sibling.getAttribute('aria-hidden'));
4302
+ sibling.setAttribute('aria-hidden', 'true');
4303
+ }
3868
4304
  }
3869
- ]);
4305
+ }
3870
4306
  }
3871
4307
  }
3872
- OwlDateTimeComponent.decorators = [
3873
- { type: Component, args: [{
3874
- selector: 'owl-date-time',
3875
- exportAs: 'owlDateTime',
3876
- template: "<p>date-time-picker works!</p>\n",
3877
- changeDetection: ChangeDetectionStrategy.OnPush,
3878
- preserveWhitespaces: false,
3879
- styles: [""]
3880
- },] }
3881
- ];
3882
- OwlDateTimeComponent.ctorParameters = () => [
3883
- { type: Overlay },
3884
- { type: ViewContainerRef },
3885
- { type: OwlDialogService },
3886
- { type: NgZone },
3887
- { type: ChangeDetectorRef },
3888
- { type: DateTimeAdapter, decorators: [{ type: Optional }] },
3889
- { type: undefined, decorators: [{ type: Inject, args: [OWL_DTPICKER_SCROLL_STRATEGY,] }] },
3890
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [OWL_DATE_TIME_FORMATS,] }] },
3891
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] }
3892
- ];
3893
- OwlDateTimeComponent.propDecorators = {
3894
- backdropClass: [{ type: Input }],
3895
- panelClass: [{ type: Input }],
3896
- startAt: [{ type: Input }],
3897
- pickerType: [{ type: Input }],
3898
- pickerMode: [{ type: Input }],
3899
- disabled: [{ type: Input }],
3900
- opened: [{ type: Input }],
3901
- scrollStrategy: [{ type: Input }],
3902
- afterPickerClosed: [{ type: Output }],
3903
- afterPickerOpen: [{ type: Output }],
3904
- yearSelected: [{ type: Output }],
3905
- monthSelected: [{ type: Output }]
3906
- };
4308
+ OwlDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogService, deps: [{ token: i1$2.Overlay }, { token: i0.Injector }, { token: i1.Location, optional: true }, { token: OWL_DIALOG_SCROLL_STRATEGY }, { token: OWL_DIALOG_DEFAULT_OPTIONS, optional: true }, { token: OwlDialogService, optional: true, skipSelf: true }, { token: i1$2.OverlayContainer }], target: i0.ɵɵFactoryTarget.Injectable });
4309
+ OwlDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogService });
4310
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogService, decorators: [{
4311
+ type: Injectable
4312
+ }], ctorParameters: function () { return [{ type: i1$2.Overlay }, { type: i0.Injector }, { type: i1.Location, decorators: [{
4313
+ type: Optional
4314
+ }] }, { type: undefined, decorators: [{
4315
+ type: Inject,
4316
+ args: [OWL_DIALOG_SCROLL_STRATEGY]
4317
+ }] }, { type: OwlDialogConfig, decorators: [{
4318
+ type: Optional
4319
+ }, {
4320
+ type: Inject,
4321
+ args: [OWL_DIALOG_DEFAULT_OPTIONS]
4322
+ }] }, { type: OwlDialogService, decorators: [{
4323
+ type: Optional
4324
+ }, {
4325
+ type: SkipSelf
4326
+ }] }, { type: i1$2.OverlayContainer }]; } });
4327
+ /**
4328
+ * Applies default options to the dialog config.
4329
+ *
4330
+ * @param config Config to be modified.
4331
+ * @param defaultOptions Default config setting
4332
+ * @returns The new configuration object.
4333
+ */
4334
+ function applyConfigDefaults(config, defaultOptions) {
4335
+ return extendObject(new OwlDialogConfig(), config, defaultOptions);
4336
+ }
3907
4337
 
3908
- const OWL_DATETIME_VALUE_ACCESSOR$1 = {
3909
- provide: NG_VALUE_ACCESSOR,
3910
- useExisting: forwardRef(() => OwlDateTimeInputDirective),
3911
- multi: true
3912
- };
3913
- const OWL_DATETIME_VALIDATORS = {
3914
- provide: NG_VALIDATORS,
3915
- useExisting: forwardRef(() => OwlDateTimeInputDirective),
3916
- multi: true
4338
+ /** Injection token that determines the scroll handling while the dtPicker is open. */
4339
+ const OWL_DTPICKER_SCROLL_STRATEGY = new InjectionToken('owl-dtpicker-scroll-strategy');
4340
+ /** @docs-private */
4341
+ function OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
4342
+ const fn = () => overlay.scrollStrategies.block();
4343
+ return fn;
4344
+ }
4345
+ /** @docs-private */
4346
+ const OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER = {
4347
+ provide: OWL_DTPICKER_SCROLL_STRATEGY,
4348
+ deps: [Overlay],
4349
+ useFactory: OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY
3917
4350
  };
3918
- class OwlDateTimeInputDirective {
3919
- constructor(elmRef, renderer, dateTimeAdapter, dateTimeFormats) {
3920
- this.elmRef = elmRef;
3921
- this.renderer = renderer;
4351
+ class OwlDateTimeComponent extends OwlDateTimeDirective {
4352
+ constructor(overlay, viewContainerRef, dialogService, ngZone, changeDetector, dateTimeAdapter, defaultScrollStrategy, dateTimeFormats, document) {
4353
+ super(dateTimeAdapter, dateTimeFormats);
4354
+ this.overlay = overlay;
4355
+ this.viewContainerRef = viewContainerRef;
4356
+ this.dialogService = dialogService;
4357
+ this.ngZone = ngZone;
4358
+ this.changeDetector = changeDetector;
3922
4359
  this.dateTimeAdapter = dateTimeAdapter;
3923
4360
  this.dateTimeFormats = dateTimeFormats;
4361
+ this.document = document;
4362
+ /** Custom class for the picker backdrop. */
4363
+ this.backdropClass = [];
4364
+ /** Custom class for the picker overlay pane. */
4365
+ this.panelClass = [];
3924
4366
  /**
3925
- * The picker's select mode
4367
+ * Set the type of the dateTime picker
4368
+ * 'both' -- show both calendar and timer
4369
+ * 'calendar' -- show only calendar
4370
+ * 'timer' -- show only timer
3926
4371
  */
3927
- this._selectMode = 'single';
4372
+ this._pickerType = 'both';
3928
4373
  /**
3929
- * The character to separate the 'from' and 'to' in input value
4374
+ * Whether the picker open as a dialog
3930
4375
  */
3931
- this.rangeSeparator = '~';
3932
- this._values = [];
4376
+ this._pickerMode = 'popup';
4377
+ /** Whether the calendar is open. */
4378
+ this._opened = false;
3933
4379
  /**
3934
- * Callback to invoke when `change` event is fired on this `<input>`
4380
+ * Callback when the picker is closed
3935
4381
  * */
3936
- this.dateTimeChange = new EventEmitter();
4382
+ this.afterPickerClosed = new EventEmitter();
3937
4383
  /**
3938
- * Callback to invoke when an `input` event is fired on this `<input>`.
4384
+ * Callback when the picker is open
3939
4385
  * */
3940
- this.dateTimeInput = new EventEmitter();
3941
- this.dtPickerSub = Subscription.EMPTY;
3942
- this.localeSub = Subscription.EMPTY;
3943
- this.lastValueValid = true;
3944
- this.onModelChange = () => { };
3945
- this.onModelTouched = () => { };
3946
- this.validatorOnChange = () => { };
3947
- /** The form control validator for whether the input parses. */
3948
- this.parseValidator = () => {
3949
- return this.lastValueValid
3950
- ? null
3951
- : { owlDateTimeParse: { text: this.elmRef.nativeElement.value } };
3952
- };
3953
- /** The form control validator for the min date. */
3954
- this.minValidator = (control) => {
3955
- if (this.isInSingleMode) {
3956
- const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
3957
- return !this.min ||
3958
- !controlValue ||
3959
- this.dateTimeAdapter.compare(this.min, controlValue) <= 0
3960
- ? null
3961
- : { owlDateTimeMin: { min: this.min, actual: controlValue } };
4386
+ this.afterPickerOpen = new EventEmitter();
4387
+ /**
4388
+ * Emits selected year in multi-year view
4389
+ * This doesn't imply a change on the selected date.
4390
+ * */
4391
+ this.yearSelected = new EventEmitter();
4392
+ /**
4393
+ * Emits selected month in year view
4394
+ * This doesn't imply a change on the selected date.
4395
+ * */
4396
+ this.monthSelected = new EventEmitter();
4397
+ /**
4398
+ * Emit when the selected value has been confirmed
4399
+ * */
4400
+ this.confirmSelectedChange = new EventEmitter();
4401
+ /**
4402
+ * Emits when the date time picker is disabled.
4403
+ * */
4404
+ this.disabledChange = new EventEmitter();
4405
+ this.dtInputSub = Subscription.EMPTY;
4406
+ this.hidePickerStreamSub = Subscription.EMPTY;
4407
+ this.confirmSelectedStreamSub = Subscription.EMPTY;
4408
+ this.pickerOpenedStreamSub = Subscription.EMPTY;
4409
+ /** The element that was focused before the date time picker was opened. */
4410
+ this.focusedElementBeforeOpen = null;
4411
+ this._selecteds = [];
4412
+ this.defaultScrollStrategy = defaultScrollStrategy;
4413
+ }
4414
+ get startAt() {
4415
+ // If an explicit startAt is set we start there, otherwise we start at whatever the currently
4416
+ // selected value is.
4417
+ if (this._startAt) {
4418
+ return this._startAt;
4419
+ }
4420
+ if (this._dtInput) {
4421
+ if (this._dtInput.selectMode === 'single') {
4422
+ return this._dtInput.value || null;
3962
4423
  }
3963
- else if (this.isInRangeMode && control.value) {
3964
- const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
3965
- const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
3966
- return !this.min ||
3967
- !controlValueFrom ||
3968
- !controlValueTo ||
3969
- this.dateTimeAdapter.compare(this.min, controlValueFrom) <= 0
3970
- ? null
3971
- : {
3972
- owlDateTimeMin: {
3973
- min: this.min,
3974
- actual: [controlValueFrom, controlValueTo]
3975
- }
3976
- };
4424
+ else if (this._dtInput.selectMode === 'range' ||
4425
+ this._dtInput.selectMode === 'rangeFrom') {
4426
+ return this._dtInput.values[0] || null;
3977
4427
  }
3978
- };
3979
- /** The form control validator for the max date. */
3980
- this.maxValidator = (control) => {
3981
- if (this.isInSingleMode) {
3982
- const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
3983
- return !this.max ||
3984
- !controlValue ||
3985
- this.dateTimeAdapter.compare(this.max, controlValue) >= 0
3986
- ? null
3987
- : { owlDateTimeMax: { max: this.max, actual: controlValue } };
4428
+ else if (this._dtInput.selectMode === 'rangeTo') {
4429
+ return this._dtInput.values[1] || null;
3988
4430
  }
3989
- else if (this.isInRangeMode && control.value) {
3990
- const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
3991
- const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
3992
- return !this.max ||
3993
- !controlValueFrom ||
3994
- !controlValueTo ||
3995
- this.dateTimeAdapter.compare(this.max, controlValueTo) >= 0
3996
- ? null
3997
- : {
3998
- owlDateTimeMax: {
3999
- max: this.max,
4000
- actual: [controlValueFrom, controlValueTo]
4001
- }
4002
- };
4431
+ }
4432
+ else {
4433
+ return null;
4434
+ }
4435
+ }
4436
+ set startAt(date) {
4437
+ this._startAt = this.getValidDate(this.dateTimeAdapter.deserialize(date));
4438
+ }
4439
+ get pickerType() {
4440
+ return this._pickerType;
4441
+ }
4442
+ set pickerType(val) {
4443
+ if (val !== this._pickerType) {
4444
+ this._pickerType = val;
4445
+ if (this._dtInput) {
4446
+ this._dtInput.formatNativeInputValue();
4003
4447
  }
4004
- };
4005
- /** The form control validator for the date filter. */
4006
- this.filterValidator = (control) => {
4007
- const controlValue = this.getValidDate(this.dateTimeAdapter.deserialize(control.value));
4008
- return !this._dateTimeFilter ||
4009
- !controlValue ||
4010
- this._dateTimeFilter(controlValue)
4011
- ? null
4012
- : { owlDateTimeFilter: true };
4013
- };
4014
- /**
4015
- * The form control validator for the range.
4016
- * Check whether the 'before' value is before the 'to' value
4017
- * */
4018
- this.rangeValidator = (control) => {
4019
- if (this.isInSingleMode || !control.value) {
4020
- return null;
4021
- }
4022
- const controlValueFrom = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[0]));
4023
- const controlValueTo = this.getValidDate(this.dateTimeAdapter.deserialize(control.value[1]));
4024
- return !controlValueFrom ||
4025
- !controlValueTo ||
4026
- this.dateTimeAdapter.compare(controlValueFrom, controlValueTo) <= 0
4027
- ? null
4028
- : { owlDateTimeRange: true };
4029
- };
4030
- /** The combined form control validator for this input. */
4031
- this.validator = Validators.compose([
4032
- this.parseValidator,
4033
- this.minValidator,
4034
- this.maxValidator,
4035
- this.filterValidator,
4036
- this.rangeValidator
4037
- ]);
4038
- /** Emits when the value changes (either due to user input or programmatic change). */
4039
- this.valueChange = new EventEmitter();
4040
- /** Emits when the disabled state has changed */
4041
- this.disabledChange = new EventEmitter();
4042
- if (!this.dateTimeAdapter) {
4043
- throw Error(`OwlDateTimePicker: No provider found for DateTimePicker. You must import one of the following ` +
4044
- `modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ` +
4045
- `custom implementation.`);
4046
4448
  }
4047
- if (!this.dateTimeFormats) {
4048
- throw Error(`OwlDateTimePicker: No provider found for OWL_DATE_TIME_FORMATS. You must import one of the following ` +
4049
- `modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a ` +
4050
- `custom implementation.`);
4051
- }
4052
- this.localeSub = this.dateTimeAdapter.localeChanges.subscribe(() => {
4053
- this.value = this.value;
4054
- });
4055
- }
4056
- /**
4057
- * The date time picker that this input is associated with.
4058
- * */
4059
- set owlDateTime(value) {
4060
- this.registerDateTimePicker(value);
4061
4449
  }
4062
- /**
4063
- * A function to filter date time
4064
- */
4065
- set owlDateTimeFilter(filter) {
4066
- this._dateTimeFilter = filter;
4067
- this.validatorOnChange();
4450
+ get pickerMode() {
4451
+ return this._pickerMode;
4068
4452
  }
4069
- get dateTimeFilter() {
4070
- return this._dateTimeFilter;
4453
+ set pickerMode(mode) {
4454
+ if (mode === 'popup') {
4455
+ this._pickerMode = mode;
4456
+ }
4457
+ else {
4458
+ this._pickerMode = 'dialog';
4459
+ }
4071
4460
  }
4072
4461
  get disabled() {
4073
- return !!this._disabled;
4462
+ return this._disabled === undefined && this._dtInput
4463
+ ? this._dtInput.disabled
4464
+ : !!this._disabled;
4074
4465
  }
4075
4466
  set disabled(value) {
4076
- const newValue = coerceBooleanProperty(value);
4077
- const element = this.elmRef.nativeElement;
4078
- if (this._disabled !== newValue) {
4079
- this._disabled = newValue;
4080
- this.disabledChange.emit(newValue);
4081
- }
4082
- // We need to null check the `blur` method, because it's undefined during SSR.
4083
- if (newValue && element.blur) {
4084
- // Normally, native input elements automatically blur if they turn disabled. This behavior
4085
- // is problematic, because it would mean that it triggers another change detection cycle,
4086
- // which then causes a changed after checked error if the input element was focused before.
4087
- element.blur();
4467
+ value = coerceBooleanProperty(value);
4468
+ if (value !== this._disabled) {
4469
+ this._disabled = value;
4470
+ this.disabledChange.next(value);
4088
4471
  }
4089
4472
  }
4090
- get min() {
4091
- return this._min;
4473
+ get opened() {
4474
+ return this._opened;
4092
4475
  }
4093
- set min(value) {
4094
- this._min = this.getValidDate(this.dateTimeAdapter.deserialize(value));
4095
- this.validatorOnChange();
4476
+ set opened(val) {
4477
+ if (val)
4478
+ this.open();
4479
+ else
4480
+ this.close();
4096
4481
  }
4097
- get max() {
4098
- return this._max;
4482
+ get dtInput() {
4483
+ return this._dtInput;
4099
4484
  }
4100
- set max(value) {
4101
- this._max = this.getValidDate(this.dateTimeAdapter.deserialize(value));
4102
- this.validatorOnChange();
4485
+ get selected() {
4486
+ return this._selected;
4103
4487
  }
4104
- get selectMode() {
4105
- return this._selectMode;
4488
+ set selected(value) {
4489
+ this._selected = value;
4490
+ this.changeDetector.markForCheck();
4106
4491
  }
4107
- set selectMode(mode) {
4108
- if (mode !== 'single' &&
4109
- mode !== 'range' &&
4110
- mode !== 'rangeFrom' &&
4111
- mode !== 'rangeTo') {
4112
- throw Error('OwlDateTime Error: invalid selectMode value!');
4113
- }
4114
- this._selectMode = mode;
4492
+ get selecteds() {
4493
+ return this._selecteds;
4115
4494
  }
4116
- get value() {
4117
- return this._value;
4495
+ set selecteds(values) {
4496
+ this._selecteds = values;
4497
+ this.changeDetector.markForCheck();
4118
4498
  }
4119
- set value(value) {
4120
- value = this.dateTimeAdapter.deserialize(value);
4121
- this.lastValueValid = !value || this.dateTimeAdapter.isValid(value);
4122
- value = this.getValidDate(value);
4123
- const oldDate = this._value;
4124
- this._value = value;
4125
- // set the input property 'value'
4126
- this.formatNativeInputValue();
4127
- // check if the input value changed
4128
- if (!this.dateTimeAdapter.isEqual(oldDate, value)) {
4129
- this.valueChange.emit(value);
4130
- }
4499
+ /** The minimum selectable date. */
4500
+ get minDateTime() {
4501
+ return this._dtInput && this._dtInput.min;
4131
4502
  }
4132
- get values() {
4133
- return this._values;
4503
+ /** The maximum selectable date. */
4504
+ get maxDateTime() {
4505
+ return this._dtInput && this._dtInput.max;
4134
4506
  }
4135
- set values(values) {
4136
- if (values && values.length > 0) {
4137
- this._values = values.map(v => {
4138
- v = this.dateTimeAdapter.deserialize(v);
4139
- return this.getValidDate(v);
4140
- });
4141
- this.lastValueValid =
4142
- (!this._values[0] ||
4143
- this.dateTimeAdapter.isValid(this._values[0])) &&
4144
- (!this._values[1] ||
4145
- this.dateTimeAdapter.isValid(this._values[1]));
4146
- }
4147
- else {
4148
- this._values = [];
4149
- this.lastValueValid = true;
4150
- }
4151
- // set the input property 'value'
4152
- this.formatNativeInputValue();
4153
- this.valueChange.emit(this._values);
4507
+ get dateTimeFilter() {
4508
+ return this._dtInput && this._dtInput.dateTimeFilter;
4154
4509
  }
4155
- get elementRef() {
4156
- return this.elmRef;
4510
+ get selectMode() {
4511
+ return this._dtInput.selectMode;
4157
4512
  }
4158
4513
  get isInSingleMode() {
4159
- return this._selectMode === 'single';
4514
+ return this._dtInput.isInSingleMode;
4160
4515
  }
4161
4516
  get isInRangeMode() {
4162
- return (this._selectMode === 'range' ||
4163
- this._selectMode === 'rangeFrom' ||
4164
- this._selectMode === 'rangeTo');
4165
- }
4166
- get owlDateTimeInputAriaHaspopup() {
4167
- return true;
4168
- }
4169
- get owlDateTimeInputAriaOwns() {
4170
- return (this.dtPicker.opened && this.dtPicker.id) || null;
4171
- }
4172
- get minIso8601() {
4173
- return this.min ? this.dateTimeAdapter.toIso8601(this.min) : null;
4174
- }
4175
- get maxIso8601() {
4176
- return this.max ? this.dateTimeAdapter.toIso8601(this.max) : null;
4177
- }
4178
- get owlDateTimeInputDisabled() {
4179
- return this.disabled;
4517
+ return this._dtInput.isInRangeMode;
4180
4518
  }
4181
- ngOnInit() {
4182
- if (!this.dtPicker) {
4183
- throw Error(`OwlDateTimePicker: the picker input doesn't have any associated owl-date-time component`);
4519
+ ngOnInit() { }
4520
+ ngOnDestroy() {
4521
+ this.close();
4522
+ this.dtInputSub.unsubscribe();
4523
+ this.disabledChange.complete();
4524
+ if (this.popupRef) {
4525
+ this.popupRef.dispose();
4184
4526
  }
4185
4527
  }
4186
- ngAfterContentInit() {
4187
- this.dtPickerSub = this.dtPicker.confirmSelectedChange.subscribe((selecteds) => {
4188
- if (Array.isArray(selecteds)) {
4189
- this.values = selecteds;
4528
+ registerInput(input) {
4529
+ if (this._dtInput) {
4530
+ throw Error('A Owl DateTimePicker can only be associated with a single input.');
4531
+ }
4532
+ this._dtInput = input;
4533
+ this.dtInputSub = this._dtInput.valueChange.subscribe((value) => {
4534
+ if (Array.isArray(value)) {
4535
+ this.selecteds = value;
4190
4536
  }
4191
4537
  else {
4192
- this.value = selecteds;
4538
+ this.selected = value;
4193
4539
  }
4194
- this.onModelChange(selecteds);
4195
- this.onModelTouched();
4196
- this.dateTimeChange.emit({
4197
- source: this,
4198
- value: selecteds,
4199
- input: this.elmRef.nativeElement
4200
- });
4201
- this.dateTimeInput.emit({
4202
- source: this,
4203
- value: selecteds,
4204
- input: this.elmRef.nativeElement
4205
- });
4206
4540
  });
4207
4541
  }
4208
- ngOnDestroy() {
4209
- this.dtPickerSub.unsubscribe();
4210
- this.localeSub.unsubscribe();
4211
- this.valueChange.complete();
4212
- this.disabledChange.complete();
4213
- }
4214
- writeValue(value) {
4542
+ open() {
4543
+ if (this._opened || this.disabled) {
4544
+ return;
4545
+ }
4546
+ if (!this._dtInput) {
4547
+ throw Error('Attempted to open an DateTimePicker with no associated input.');
4548
+ }
4549
+ if (this.document) {
4550
+ this.focusedElementBeforeOpen = this.document.activeElement;
4551
+ }
4552
+ // reset the picker selected value
4215
4553
  if (this.isInSingleMode) {
4216
- this.value = value;
4554
+ this.selected = this._dtInput.value;
4217
4555
  }
4218
- else {
4219
- this.values = value;
4556
+ else if (this.isInRangeMode) {
4557
+ this.selecteds = this._dtInput.values;
4220
4558
  }
4221
- }
4222
- registerOnChange(fn) {
4223
- this.onModelChange = fn;
4224
- }
4225
- registerOnTouched(fn) {
4226
- this.onModelTouched = fn;
4227
- }
4228
- setDisabledState(isDisabled) {
4229
- this.disabled = isDisabled;
4230
- }
4231
- validate(c) {
4232
- return this.validator ? this.validator(c) : null;
4233
- }
4234
- registerOnValidatorChange(fn) {
4235
- this.validatorOnChange = fn;
4236
- }
4237
- /**
4238
- * Open the picker when user hold alt + DOWN_ARROW
4239
- * */
4240
- handleKeydownOnHost(event) {
4241
- if (event.altKey && event.keyCode === DOWN_ARROW) {
4242
- this.dtPicker.open();
4243
- event.preventDefault();
4244
- }
4245
- }
4246
- handleBlurOnHost(_event) {
4247
- this.onModelTouched();
4248
- }
4249
- handleInputOnHost(event) {
4250
- const value = event.target.value;
4251
- if (this._selectMode === 'single') {
4252
- this.changeInputInSingleMode(value);
4253
- }
4254
- else if (this._selectMode === 'range') {
4255
- this.changeInputInRangeMode(value);
4256
- }
4257
- else {
4258
- this.changeInputInRangeFromToMode(value);
4259
- }
4260
- }
4261
- handleChangeOnHost(_event) {
4262
- let v;
4263
- if (this.isInSingleMode) {
4264
- v = this.value;
4265
- }
4266
- else if (this.isInRangeMode) {
4267
- v = this.values;
4559
+ // when the picker is open , we make sure the picker's current selected time value
4560
+ // is the same as the _startAt time value.
4561
+ if (this.selected && this.pickerType !== 'calendar' && this._startAt) {
4562
+ this.selected = this.dateTimeAdapter.createDate(this.dateTimeAdapter.getYear(this.selected), this.dateTimeAdapter.getMonth(this.selected), this.dateTimeAdapter.getDate(this.selected), this.dateTimeAdapter.getHours(this._startAt), this.dateTimeAdapter.getMinutes(this._startAt), this.dateTimeAdapter.getSeconds(this._startAt));
4268
4563
  }
4269
- this.dateTimeChange.emit({
4270
- source: this,
4271
- value: v,
4272
- input: this.elmRef.nativeElement
4564
+ if (this.pickerMode === 'dialog')
4565
+ this.openAsDialog();
4566
+ else
4567
+ this.openAsPopup();
4568
+ this.pickerContainer.picker = this;
4569
+ // Listen to picker container's hidePickerStream
4570
+ this.hidePickerStreamSub = this.pickerContainer.hidePickerStream.subscribe(() => {
4571
+ this.close();
4572
+ });
4573
+ // Listen to picker container's confirmSelectedStream
4574
+ this.confirmSelectedStreamSub = this.pickerContainer.confirmSelectedStream.subscribe((event) => {
4575
+ this.confirmSelect(event);
4273
4576
  });
4274
4577
  }
4275
4578
  /**
4276
- * Set the native input property 'value'
4579
+ * Selects the given date
4277
4580
  */
4278
- formatNativeInputValue() {
4279
- if (this.isInSingleMode) {
4280
- this.renderer.setProperty(this.elmRef.nativeElement, 'value', this._value
4281
- ? this.dateTimeAdapter.format(this._value, this.dtPicker.formatString)
4282
- : '');
4581
+ select(date) {
4582
+ if (Array.isArray(date)) {
4583
+ this.selecteds = [...date];
4283
4584
  }
4284
- else if (this.isInRangeMode) {
4285
- if (this._values && this.values.length > 0) {
4286
- const from = this._values[0];
4287
- const to = this._values[1];
4288
- const fromFormatted = from
4289
- ? this.dateTimeAdapter.format(from, this.dtPicker.formatString)
4290
- : '';
4291
- const toFormatted = to
4292
- ? this.dateTimeAdapter.format(to, this.dtPicker.formatString)
4293
- : '';
4294
- if (!fromFormatted && !toFormatted) {
4295
- this.renderer.setProperty(this.elmRef.nativeElement, 'value', null);
4296
- }
4297
- else {
4298
- if (this._selectMode === 'range') {
4299
- this.renderer.setProperty(this.elmRef.nativeElement, 'value', fromFormatted +
4300
- ' ' +
4301
- this.rangeSeparator +
4302
- ' ' +
4303
- toFormatted);
4304
- }
4305
- else if (this._selectMode === 'rangeFrom') {
4306
- this.renderer.setProperty(this.elmRef.nativeElement, 'value', fromFormatted);
4307
- }
4308
- else if (this._selectMode === 'rangeTo') {
4309
- this.renderer.setProperty(this.elmRef.nativeElement, 'value', toFormatted);
4310
- }
4311
- }
4312
- }
4313
- else {
4314
- this.renderer.setProperty(this.elmRef.nativeElement, 'value', '');
4315
- }
4585
+ else {
4586
+ this.selected = date;
4587
+ }
4588
+ /**
4589
+ * Cases in which automatically confirm the select when date or dates are selected:
4590
+ * 1) picker mode is NOT 'dialog'
4591
+ * 2) picker type is 'calendar' and selectMode is 'single'.
4592
+ * 3) picker type is 'calendar' and selectMode is 'range' and
4593
+ * the 'selecteds' has 'from'(selecteds[0]) and 'to'(selecteds[1]) values.
4594
+ * 4) selectMode is 'rangeFrom' and selecteds[0] has value.
4595
+ * 5) selectMode is 'rangeTo' and selecteds[1] has value.
4596
+ * */
4597
+ if (this.pickerMode !== 'dialog' &&
4598
+ this.pickerType === 'calendar' &&
4599
+ ((this.selectMode === 'single' && this.selected) ||
4600
+ (this.selectMode === 'rangeFrom' && this.selecteds[0]) ||
4601
+ (this.selectMode === 'rangeTo' && this.selecteds[1]) ||
4602
+ (this.selectMode === 'range' &&
4603
+ this.selecteds[0] &&
4604
+ this.selecteds[1]))) {
4605
+ this.confirmSelect();
4316
4606
  }
4317
- return;
4318
4607
  }
4319
4608
  /**
4320
- * Register the relationship between this input and its picker component
4321
- */
4322
- registerDateTimePicker(picker) {
4323
- if (picker) {
4324
- this.dtPicker = picker;
4325
- this.dtPicker.registerInput(this);
4326
- }
4609
+ * Emits the selected year in multi-year view
4610
+ * */
4611
+ selectYear(normalizedYear) {
4612
+ this.yearSelected.emit(normalizedYear);
4327
4613
  }
4328
4614
  /**
4329
- * Convert a given obj to a valid date object
4330
- */
4331
- getValidDate(obj) {
4332
- return this.dateTimeAdapter.isDateInstance(obj) &&
4333
- this.dateTimeAdapter.isValid(obj)
4334
- ? obj
4335
- : null;
4615
+ * Emits selected month in year view
4616
+ * */
4617
+ selectMonth(normalizedMonth) {
4618
+ this.monthSelected.emit(normalizedMonth);
4336
4619
  }
4337
4620
  /**
4338
- * Convert a time string to a date-time string
4339
- * When pickerType is 'timer', the value in the picker's input is a time string.
4340
- * The dateTimeAdapter parse fn could not parse a time string to a Date Object.
4341
- * Therefore we need this fn to convert a time string to a date-time string.
4621
+ * Hide the picker
4342
4622
  */
4343
- convertTimeStringToDateTimeString(timeString, dateTime) {
4344
- if (timeString) {
4345
- const v = dateTime || this.dateTimeAdapter.now();
4346
- const dateString = this.dateTimeAdapter.format(v, this.dateTimeFormats.datePickerInput);
4347
- return dateString + ' ' + timeString;
4623
+ close() {
4624
+ if (!this._opened) {
4625
+ return;
4348
4626
  }
4349
- else {
4350
- return null;
4627
+ if (this.popupRef && this.popupRef.hasAttached()) {
4628
+ this.popupRef.detach();
4351
4629
  }
4352
- }
4353
- /**
4354
- * Handle input change in single mode
4355
- */
4356
- changeInputInSingleMode(inputValue) {
4357
- let value = inputValue;
4358
- if (this.dtPicker.pickerType === 'timer') {
4359
- value = this.convertTimeStringToDateTimeString(value, this.value);
4630
+ if (this.pickerContainerPortal &&
4631
+ this.pickerContainerPortal.isAttached) {
4632
+ this.pickerContainerPortal.detach();
4360
4633
  }
4361
- let result = this.dateTimeAdapter.parse(value, this.dateTimeFormats.parseInput);
4362
- this.lastValueValid = !result || this.dateTimeAdapter.isValid(result);
4363
- result = this.getValidDate(result);
4364
- // if the newValue is the same as the oldValue, we intend to not fire the valueChange event
4365
- // result equals to null means there is input event, but the input value is invalid
4366
- if (!this.isSameValue(result, this._value) || result === null) {
4367
- this._value = result;
4368
- this.valueChange.emit(result);
4369
- this.onModelChange(result);
4370
- this.dateTimeInput.emit({
4371
- source: this,
4372
- value: result,
4373
- input: this.elmRef.nativeElement
4374
- });
4634
+ if (this.hidePickerStreamSub) {
4635
+ this.hidePickerStreamSub.unsubscribe();
4636
+ this.hidePickerStreamSub = null;
4637
+ }
4638
+ if (this.confirmSelectedStreamSub) {
4639
+ this.confirmSelectedStreamSub.unsubscribe();
4640
+ this.confirmSelectedStreamSub = null;
4641
+ }
4642
+ if (this.pickerOpenedStreamSub) {
4643
+ this.pickerOpenedStreamSub.unsubscribe();
4644
+ this.pickerOpenedStreamSub = null;
4645
+ }
4646
+ if (this.dialogRef) {
4647
+ this.dialogRef.close();
4648
+ this.dialogRef = null;
4649
+ }
4650
+ const completeClose = () => {
4651
+ if (this._opened) {
4652
+ this._opened = false;
4653
+ this.afterPickerClosed.emit(null);
4654
+ this.focusedElementBeforeOpen = null;
4655
+ }
4656
+ };
4657
+ if (this.focusedElementBeforeOpen &&
4658
+ typeof this.focusedElementBeforeOpen.focus === 'function') {
4659
+ // Because IE moves focus asynchronously, we can't count on it being restored before we've
4660
+ // marked the datepicker as closed. If the event fires out of sequence and the element that
4661
+ // we're refocusing opens the datepicker on focus, the user could be stuck with not being
4662
+ // able to close the calendar at all. We work around it by making the logic, that marks
4663
+ // the datepicker as closed, async as well.
4664
+ this.focusedElementBeforeOpen.focus();
4665
+ setTimeout(completeClose);
4666
+ }
4667
+ else {
4668
+ completeClose();
4375
4669
  }
4376
4670
  }
4377
4671
  /**
4378
- * Handle input change in rangeFrom or rangeTo mode
4672
+ * Confirm the selected value
4379
4673
  */
4380
- changeInputInRangeFromToMode(inputValue) {
4381
- const originalValue = this._selectMode === 'rangeFrom'
4382
- ? this._values[0]
4383
- : this._values[1];
4384
- if (this.dtPicker.pickerType === 'timer') {
4385
- inputValue = this.convertTimeStringToDateTimeString(inputValue, originalValue);
4674
+ confirmSelect(_event) {
4675
+ if (this.isInSingleMode) {
4676
+ const selected = this.selected || this.startAt || this.dateTimeAdapter.now();
4677
+ this.confirmSelectedChange.emit(selected);
4386
4678
  }
4387
- let result = this.dateTimeAdapter.parse(inputValue, this.dateTimeFormats.parseInput);
4388
- this.lastValueValid = !result || this.dateTimeAdapter.isValid(result);
4389
- result = this.getValidDate(result);
4390
- // if the newValue is the same as the oldValue, we intend to not fire the valueChange event
4391
- if ((this._selectMode === 'rangeFrom' &&
4392
- this.isSameValue(result, this._values[0]) &&
4393
- result) ||
4394
- (this._selectMode === 'rangeTo' &&
4395
- this.isSameValue(result, this._values[1]) &&
4396
- result)) {
4397
- return;
4679
+ else if (this.isInRangeMode) {
4680
+ this.confirmSelectedChange.emit(this.selecteds);
4398
4681
  }
4399
- this._values =
4400
- this._selectMode === 'rangeFrom'
4401
- ? [result, this._values[1]]
4402
- : [this._values[0], result];
4403
- this.valueChange.emit(this._values);
4404
- this.onModelChange(this._values);
4405
- this.dateTimeInput.emit({
4406
- source: this,
4407
- value: this._values,
4408
- input: this.elmRef.nativeElement
4409
- });
4682
+ this.close();
4683
+ return;
4410
4684
  }
4411
4685
  /**
4412
- * Handle input change in range mode
4686
+ * Open the picker as a dialog
4413
4687
  */
4414
- changeInputInRangeMode(inputValue) {
4415
- const selecteds = inputValue.split(this.rangeSeparator);
4416
- let fromString = selecteds[0];
4417
- let toString = selecteds[1];
4418
- if (this.dtPicker.pickerType === 'timer') {
4419
- fromString = this.convertTimeStringToDateTimeString(fromString, this.values[0]);
4420
- toString = this.convertTimeStringToDateTimeString(toString, this.values[1]);
4421
- }
4422
- let from = this.dateTimeAdapter.parse(fromString, this.dateTimeFormats.parseInput);
4423
- let to = this.dateTimeAdapter.parse(toString, this.dateTimeFormats.parseInput);
4424
- this.lastValueValid =
4425
- (!from || this.dateTimeAdapter.isValid(from)) &&
4426
- (!to || this.dateTimeAdapter.isValid(to));
4427
- from = this.getValidDate(from);
4428
- to = this.getValidDate(to);
4429
- // if the newValue is the same as the oldValue, we intend to not fire the valueChange event
4430
- if (!this.isSameValue(from, this._values[0]) ||
4431
- !this.isSameValue(to, this._values[1]) ||
4432
- (from === null && to === null)) {
4433
- this._values = [from, to];
4434
- this.valueChange.emit(this._values);
4435
- this.onModelChange(this._values);
4436
- this.dateTimeInput.emit({
4437
- source: this,
4438
- value: this._values,
4439
- input: this.elmRef.nativeElement
4440
- });
4441
- }
4688
+ openAsDialog() {
4689
+ this.dialogRef = this.dialogService.open(OwlDateTimeContainerComponent, {
4690
+ autoFocus: false,
4691
+ backdropClass: [
4692
+ 'cdk-overlay-dark-backdrop',
4693
+ ...coerceArray(this.backdropClass)
4694
+ ],
4695
+ paneClass: ['owl-dt-dialog', ...coerceArray(this.panelClass)],
4696
+ viewContainerRef: this.viewContainerRef,
4697
+ scrollStrategy: this.scrollStrategy || this.defaultScrollStrategy()
4698
+ });
4699
+ this.pickerContainer = this.dialogRef.componentInstance;
4700
+ this.dialogRef.afterOpen().subscribe(() => {
4701
+ this.afterPickerOpen.emit(null);
4702
+ this._opened = true;
4703
+ });
4704
+ this.dialogRef.afterClosed().subscribe(() => this.close());
4442
4705
  }
4443
4706
  /**
4444
- * Check if the two value is the same
4707
+ * Open the picker as popup
4445
4708
  */
4446
- isSameValue(first, second) {
4447
- if (first && second) {
4448
- return this.dateTimeAdapter.compare(first, second) === 0;
4709
+ openAsPopup() {
4710
+ if (!this.pickerContainerPortal) {
4711
+ this.pickerContainerPortal = new ComponentPortal(OwlDateTimeContainerComponent, this.viewContainerRef);
4449
4712
  }
4450
- return first == second;
4451
- }
4452
- }
4453
- OwlDateTimeInputDirective.decorators = [
4454
- { type: Directive, args: [{
4455
- selector: 'input[owlDateTime]',
4456
- exportAs: 'owlDateTimeInput',
4457
- providers: [
4458
- OWL_DATETIME_VALUE_ACCESSOR$1,
4459
- OWL_DATETIME_VALIDATORS
4460
- ]
4461
- },] }
4462
- ];
4463
- OwlDateTimeInputDirective.ctorParameters = () => [
4464
- { type: ElementRef },
4465
- { type: Renderer2 },
4466
- { type: DateTimeAdapter, decorators: [{ type: Optional }] },
4467
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [OWL_DATE_TIME_FORMATS,] }] }
4468
- ];
4469
- OwlDateTimeInputDirective.propDecorators = {
4470
- owlDateTime: [{ type: Input }],
4471
- owlDateTimeFilter: [{ type: Input }],
4472
- _disabled: [{ type: Input }],
4473
- min: [{ type: Input }],
4474
- max: [{ type: Input }],
4475
- selectMode: [{ type: Input }],
4476
- rangeSeparator: [{ type: Input }],
4477
- value: [{ type: Input }],
4478
- values: [{ type: Input }],
4479
- dateTimeChange: [{ type: Output }],
4480
- dateTimeInput: [{ type: Output }],
4481
- owlDateTimeInputAriaHaspopup: [{ type: HostBinding, args: ['attr.aria-haspopup',] }],
4482
- owlDateTimeInputAriaOwns: [{ type: HostBinding, args: ['attr.aria-owns',] }],
4483
- minIso8601: [{ type: HostBinding, args: ['attr.min',] }],
4484
- maxIso8601: [{ type: HostBinding, args: ['attr.max',] }],
4485
- owlDateTimeInputDisabled: [{ type: HostBinding, args: ['disabled',] }],
4486
- handleKeydownOnHost: [{ type: HostListener, args: ['keydown', ['$event'],] }],
4487
- handleBlurOnHost: [{ type: HostListener, args: ['blur', ['$event'],] }],
4488
- handleInputOnHost: [{ type: HostListener, args: ['input', ['$event'],] }],
4489
- handleChangeOnHost: [{ type: HostListener, args: ['change', ['$event'],] }]
4490
- };
4491
-
4492
- class OwlDateTimeTriggerDirective {
4493
- constructor(changeDetector) {
4494
- this.changeDetector = changeDetector;
4495
- this.stateChanges = Subscription.EMPTY;
4496
- }
4497
- get disabled() {
4498
- return this._disabled === undefined ? this.dtPicker.disabled : !!this._disabled;
4499
- }
4500
- set disabled(value) {
4501
- this._disabled = value;
4502
- }
4503
- get owlDTTriggerDisabledClass() {
4504
- return this.disabled;
4505
- }
4506
- ngOnInit() {
4507
- }
4508
- ngOnChanges(changes) {
4509
- if (changes.datepicker) {
4510
- this.watchStateChanges();
4713
+ if (!this.popupRef) {
4714
+ this.createPopup();
4511
4715
  }
4512
- }
4513
- ngAfterContentInit() {
4514
- this.watchStateChanges();
4515
- }
4516
- ngOnDestroy() {
4517
- this.stateChanges.unsubscribe();
4518
- }
4519
- handleClickOnHost(event) {
4520
- if (this.dtPicker) {
4521
- this.dtPicker.open();
4522
- event.stopPropagation();
4716
+ if (!this.popupRef.hasAttached()) {
4717
+ const componentRef = this.popupRef.attach(this.pickerContainerPortal);
4718
+ this.pickerContainer = componentRef.instance;
4719
+ // Update the position once the calendar has rendered.
4720
+ this.ngZone.onStable
4721
+ .asObservable()
4722
+ .pipe(take(1))
4723
+ .subscribe(() => {
4724
+ this.popupRef.updatePosition();
4725
+ });
4726
+ // emit open stream
4727
+ this.pickerOpenedStreamSub = this.pickerContainer.pickerOpenedStream
4728
+ .pipe(take(1))
4729
+ .subscribe(() => {
4730
+ this.afterPickerOpen.emit(null);
4731
+ this._opened = true;
4732
+ });
4523
4733
  }
4524
4734
  }
4525
- watchStateChanges() {
4526
- this.stateChanges.unsubscribe();
4527
- const inputDisabled = this.dtPicker && this.dtPicker.dtInput ?
4528
- this.dtPicker.dtInput.disabledChange : of();
4529
- const pickerDisabled = this.dtPicker ?
4530
- this.dtPicker.disabledChange : of();
4531
- this.stateChanges = merge(pickerDisabled, inputDisabled)
4532
- .subscribe(() => {
4533
- this.changeDetector.markForCheck();
4735
+ createPopup() {
4736
+ const overlayConfig = new OverlayConfig({
4737
+ positionStrategy: this.createPopupPositionStrategy(),
4738
+ hasBackdrop: true,
4739
+ backdropClass: [
4740
+ 'cdk-overlay-transparent-backdrop',
4741
+ ...coerceArray(this.backdropClass)
4742
+ ],
4743
+ scrollStrategy: this.scrollStrategy || this.defaultScrollStrategy(),
4744
+ panelClass: ['owl-dt-popup', ...coerceArray(this.panelClass)]
4534
4745
  });
4746
+ this.popupRef = this.overlay.create(overlayConfig);
4747
+ merge(this.popupRef.backdropClick(), this.popupRef.detachments(), this.popupRef
4748
+ .keydownEvents()
4749
+ .pipe(filter(event => event.keyCode === ESCAPE ||
4750
+ (this._dtInput &&
4751
+ event.altKey &&
4752
+ event.keyCode === UP_ARROW)))).subscribe(() => this.close());
4535
4753
  }
4536
- }
4537
- OwlDateTimeTriggerDirective.decorators = [
4538
- { type: Directive, args: [{
4539
- selector: '[owlDateTimeTrigger]'
4540
- },] }
4541
- ];
4542
- OwlDateTimeTriggerDirective.ctorParameters = () => [
4543
- { type: ChangeDetectorRef }
4544
- ];
4545
- OwlDateTimeTriggerDirective.propDecorators = {
4546
- dtPicker: [{ type: Input, args: ['owlDateTimeTrigger',] }],
4547
- disabled: [{ type: Input }],
4548
- owlDTTriggerDisabledClass: [{ type: HostBinding, args: ['class.owl-dt-trigger-disabled',] }],
4549
- handleClickOnHost: [{ type: HostListener, args: ['click', ['$event'],] }]
4550
- };
4551
-
4552
- class OwlDialogModule {
4553
- }
4554
- OwlDialogModule.decorators = [
4555
- { type: NgModule, args: [{
4556
- imports: [CommonModule, A11yModule, OverlayModule, PortalModule],
4557
- exports: [],
4558
- declarations: [
4559
- OwlDialogContainerComponent
4560
- ],
4561
- providers: [
4562
- OWL_DIALOG_SCROLL_STRATEGY_PROVIDER,
4563
- OwlDialogService
4564
- ],
4565
- entryComponents: [
4566
- OwlDialogContainerComponent
4567
- ]
4568
- },] }
4569
- ];
4570
-
4571
- class NumberFixedLenPipe {
4572
- transform(num, len) {
4573
- const number = Math.floor(num);
4574
- const length = Math.floor(len);
4575
- if (num === null || isNaN(number) || isNaN(length)) {
4576
- return num;
4577
- }
4578
- let numString = number.toString();
4579
- while (numString.length < length) {
4580
- numString = '0' + numString;
4581
- }
4582
- return numString;
4754
+ /**
4755
+ * Create the popup PositionStrategy.
4756
+ * */
4757
+ createPopupPositionStrategy() {
4758
+ return this.overlay
4759
+ .position()
4760
+ .flexibleConnectedTo(this._dtInput.elementRef)
4761
+ .withTransformOriginOn('.owl-dt-container')
4762
+ .withFlexibleDimensions(false)
4763
+ .withPush(false)
4764
+ .withPositions([
4765
+ {
4766
+ originX: 'start',
4767
+ originY: 'bottom',
4768
+ overlayX: 'start',
4769
+ overlayY: 'top'
4770
+ },
4771
+ {
4772
+ originX: 'start',
4773
+ originY: 'top',
4774
+ overlayX: 'start',
4775
+ overlayY: 'bottom'
4776
+ },
4777
+ {
4778
+ originX: 'end',
4779
+ originY: 'bottom',
4780
+ overlayX: 'end',
4781
+ overlayY: 'top'
4782
+ },
4783
+ {
4784
+ originX: 'end',
4785
+ originY: 'top',
4786
+ overlayX: 'end',
4787
+ overlayY: 'bottom'
4788
+ },
4789
+ {
4790
+ originX: 'start',
4791
+ originY: 'top',
4792
+ overlayX: 'start',
4793
+ overlayY: 'top',
4794
+ offsetY: -176
4795
+ },
4796
+ {
4797
+ originX: 'start',
4798
+ originY: 'top',
4799
+ overlayX: 'start',
4800
+ overlayY: 'top',
4801
+ offsetY: -352
4802
+ }
4803
+ ]);
4583
4804
  }
4584
4805
  }
4585
- NumberFixedLenPipe.decorators = [
4586
- { type: Pipe, args: [{
4587
- name: 'numberFixedLen'
4588
- },] }
4589
- ];
4806
+ OwlDateTimeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeComponent, deps: [{ token: i1$2.Overlay }, { token: i0.ViewContainerRef }, { token: OwlDialogService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: DateTimeAdapter, optional: true }, { token: OWL_DTPICKER_SCROLL_STRATEGY }, { token: OWL_DATE_TIME_FORMATS, optional: true }, { token: DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Component });
4807
+ OwlDateTimeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.2", type: OwlDateTimeComponent, selector: "owl-date-time", inputs: { backdropClass: "backdropClass", panelClass: "panelClass", startAt: "startAt", pickerType: "pickerType", pickerMode: "pickerMode", disabled: "disabled", opened: "opened", scrollStrategy: "scrollStrategy" }, outputs: { afterPickerClosed: "afterPickerClosed", afterPickerOpen: "afterPickerOpen", yearSelected: "yearSelected", monthSelected: "monthSelected" }, exportAs: ["owlDateTime"], usesInheritance: true, ngImport: i0, template: "<p>date-time-picker works!</p>\n", styles: [""], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4808
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeComponent, decorators: [{
4809
+ type: Component,
4810
+ args: [{ selector: 'owl-date-time', exportAs: 'owlDateTime', changeDetection: ChangeDetectionStrategy.OnPush, preserveWhitespaces: false, template: "<p>date-time-picker works!</p>\n", styles: [""] }]
4811
+ }], ctorParameters: function () { return [{ type: i1$2.Overlay }, { type: i0.ViewContainerRef }, { type: OwlDialogService }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: DateTimeAdapter, decorators: [{
4812
+ type: Optional
4813
+ }] }, { type: undefined, decorators: [{
4814
+ type: Inject,
4815
+ args: [OWL_DTPICKER_SCROLL_STRATEGY]
4816
+ }] }, { type: undefined, decorators: [{
4817
+ type: Optional
4818
+ }, {
4819
+ type: Inject,
4820
+ args: [OWL_DATE_TIME_FORMATS]
4821
+ }] }, { type: undefined, decorators: [{
4822
+ type: Optional
4823
+ }, {
4824
+ type: Inject,
4825
+ args: [DOCUMENT]
4826
+ }] }]; }, propDecorators: { backdropClass: [{
4827
+ type: Input
4828
+ }], panelClass: [{
4829
+ type: Input
4830
+ }], startAt: [{
4831
+ type: Input
4832
+ }], pickerType: [{
4833
+ type: Input
4834
+ }], pickerMode: [{
4835
+ type: Input
4836
+ }], disabled: [{
4837
+ type: Input
4838
+ }], opened: [{
4839
+ type: Input
4840
+ }], scrollStrategy: [{
4841
+ type: Input
4842
+ }], afterPickerClosed: [{
4843
+ type: Output
4844
+ }], afterPickerOpen: [{
4845
+ type: Output
4846
+ }], yearSelected: [{
4847
+ type: Output
4848
+ }], monthSelected: [{
4849
+ type: Output
4850
+ }] } });
4590
4851
 
4591
- class OwlTimerBoxComponent {
4592
- constructor() {
4593
- this.showDivider = false;
4594
- this.step = 1;
4595
- this.valueChange = new EventEmitter();
4596
- this.inputChange = new EventEmitter();
4597
- this.inputStream = new Subject();
4598
- this.inputStreamSub = Subscription.EMPTY;
4599
- }
4600
- get displayValue() {
4601
- return this.boxValue || this.value;
4602
- }
4603
- get owlDTTimerBoxClass() {
4604
- return true;
4605
- }
4606
- ngOnInit() {
4607
- this.inputStreamSub = this.inputStream.pipe(debounceTime(500), distinctUntilChanged()).subscribe((val) => {
4608
- if (val) {
4609
- const inputValue = coerceNumberProperty(val, 0);
4610
- this.updateValueViaInput(inputValue);
4611
- }
4612
- });
4613
- }
4614
- ngOnDestroy() {
4615
- this.inputStreamSub.unsubscribe();
4616
- }
4617
- upBtnClicked() {
4618
- this.updateValue(this.value + this.step);
4619
- }
4620
- downBtnClicked() {
4621
- this.updateValue(this.value - this.step);
4622
- }
4623
- handleInputChange(val) {
4624
- this.inputStream.next(val);
4625
- }
4626
- updateValue(value) {
4627
- this.valueChange.emit(value);
4628
- }
4629
- updateValueViaInput(value) {
4630
- if (value > this.max || value < this.min) {
4631
- return;
4632
- }
4633
- this.inputChange.emit(value);
4634
- }
4852
+ class OwlDialogModule {
4635
4853
  }
4636
- OwlTimerBoxComponent.decorators = [
4637
- { type: Component, args: [{
4638
- exportAs: 'owlDateTimeTimerBox',
4639
- selector: 'owl-date-time-timer-box',
4640
- template: "<div *ngIf=\"showDivider\"\n class=\"owl-dt-timer-divider\"\n aria-hidden=\"true\"></div>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"upBtnDisabled\"\n [attr.aria-label]=\"upBtnAriaLabel\"\n (click)=\"upBtnClicked()\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Up\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path d=\"M248.292,106.406l194.281,194.29c12.365,12.359,12.365,32.391,0,44.744c-12.354,12.354-32.391,12.354-44.744,0\n L225.923,173.529L54.018,345.44c-12.36,12.354-32.395,12.354-44.748,0c-12.359-12.354-12.359-32.391,0-44.75L203.554,106.4\n c6.18-6.174,14.271-9.259,22.369-9.259C234.018,97.141,242.115,100.232,248.292,106.406z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n<label class=\"owl-dt-timer-content\">\n <input class=\"owl-dt-timer-input\"\n maxlength=\"2\"\n [value]=\"displayValue | numberFixedLen : 2\"\n (input)=\"handleInputChange(valueInput.value)\"\n #valueInput>\n <span class=\"owl-hidden-accessible\">{{inputLabel}}</span>\n</label>\n<button class=\"owl-dt-control-button owl-dt-control-arrow-button\"\n type=\"button\"\n tabindex=\"-1\"\n [disabled]=\"downBtnDisabled\"\n [attr.aria-label]=\"downBtnAriaLabel\"\n (click)=\"downBtnClicked()\">\n <span class=\"owl-dt-control-button-content\"\n tabindex=\"-1\">\n <!-- <editor-fold desc=\"SVG Arrow Down\"> -->\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n version=\"1.1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 451.847 451.846\"\n style=\"enable-background:new 0 0 451.847 451.846;\"\n xml:space=\"preserve\"\n width=\"100%\"\n height=\"100%\">\n <path\n d=\"M225.923,354.706c-8.098,0-16.195-3.092-22.369-9.263L9.27,151.157c-12.359-12.359-12.359-32.397,0-44.751\n c12.354-12.354,32.388-12.354,44.748,0l171.905,171.915l171.906-171.909c12.359-12.354,32.391-12.354,44.744,0\n c12.365,12.354,12.365,32.392,0,44.751L248.292,345.449C242.115,351.621,234.018,354.706,225.923,354.706z\" />\n </svg>\n <!-- </editor-fold> -->\n </span>\n</button>\n",
4641
- preserveWhitespaces: false,
4642
- changeDetection: ChangeDetectionStrategy.OnPush,
4643
- styles: [""]
4644
- },] }
4645
- ];
4646
- OwlTimerBoxComponent.ctorParameters = () => [];
4647
- OwlTimerBoxComponent.propDecorators = {
4648
- showDivider: [{ type: Input }],
4649
- upBtnAriaLabel: [{ type: Input }],
4650
- upBtnDisabled: [{ type: Input }],
4651
- downBtnAriaLabel: [{ type: Input }],
4652
- downBtnDisabled: [{ type: Input }],
4653
- boxValue: [{ type: Input }],
4654
- value: [{ type: Input }],
4655
- min: [{ type: Input }],
4656
- max: [{ type: Input }],
4657
- step: [{ type: Input }],
4658
- inputLabel: [{ type: Input }],
4659
- valueChange: [{ type: Output }],
4660
- inputChange: [{ type: Output }],
4661
- owlDTTimerBoxClass: [{ type: HostBinding, args: ['class.owl-dt-timer-box',] }]
4662
- };
4854
+ OwlDialogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4855
+ OwlDialogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogModule, declarations: [OwlDialogContainerComponent], imports: [CommonModule, A11yModule, OverlayModule, PortalModule] });
4856
+ OwlDialogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogModule, providers: [
4857
+ OWL_DIALOG_SCROLL_STRATEGY_PROVIDER,
4858
+ OwlDialogService
4859
+ ], imports: [[CommonModule, A11yModule, OverlayModule, PortalModule]] });
4860
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDialogModule, decorators: [{
4861
+ type: NgModule,
4862
+ args: [{
4863
+ imports: [CommonModule, A11yModule, OverlayModule, PortalModule],
4864
+ exports: [],
4865
+ declarations: [
4866
+ OwlDialogContainerComponent
4867
+ ],
4868
+ providers: [
4869
+ OWL_DIALOG_SCROLL_STRATEGY_PROVIDER,
4870
+ OwlDialogService
4871
+ ],
4872
+ entryComponents: [
4873
+ OwlDialogContainerComponent
4874
+ ]
4875
+ }]
4876
+ }] });
4663
4877
 
4664
4878
  class OwlDateTimeModule {
4665
4879
  }
4666
- OwlDateTimeModule.decorators = [
4667
- { type: NgModule, args: [{
4668
- imports: [CommonModule, OverlayModule, OwlDialogModule, A11yModule],
4669
- exports: [
4670
- OwlCalendarComponent,
4671
- OwlTimerComponent,
4672
- OwlDateTimeTriggerDirective,
4673
- OwlDateTimeInputDirective,
4674
- OwlDateTimeComponent,
4675
- OwlDateTimeInlineComponent,
4676
- OwlMultiYearViewComponent,
4677
- OwlYearViewComponent,
4678
- OwlMonthViewComponent
4679
- ],
4680
- declarations: [
4681
- OwlDateTimeTriggerDirective,
4682
- OwlDateTimeInputDirective,
4683
- OwlDateTimeComponent,
4684
- OwlDateTimeContainerComponent,
4685
- OwlMultiYearViewComponent,
4686
- OwlYearViewComponent,
4687
- OwlMonthViewComponent,
4688
- OwlTimerComponent,
4689
- OwlTimerBoxComponent,
4690
- OwlCalendarComponent,
4691
- OwlCalendarBodyComponent,
4692
- NumberFixedLenPipe,
4693
- OwlDateTimeInlineComponent
4694
- ],
4695
- providers: [
4696
- OwlDateTimeIntl,
4697
- OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER
4698
- ],
4699
- entryComponents: [
4700
- OwlDateTimeContainerComponent
4701
- ]
4702
- },] }
4703
- ];
4880
+ OwlDateTimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4881
+ OwlDateTimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeModule, declarations: [OwlDateTimeTriggerDirective,
4882
+ OwlDateTimeInputDirective,
4883
+ OwlDateTimeComponent,
4884
+ OwlDateTimeContainerComponent,
4885
+ OwlMultiYearViewComponent,
4886
+ OwlYearViewComponent,
4887
+ OwlMonthViewComponent,
4888
+ OwlTimerComponent,
4889
+ OwlTimerBoxComponent,
4890
+ OwlCalendarComponent,
4891
+ OwlCalendarBodyComponent,
4892
+ NumberFixedLenPipe,
4893
+ OwlDateTimeInlineComponent], imports: [CommonModule, OverlayModule, OwlDialogModule, A11yModule], exports: [OwlCalendarComponent,
4894
+ OwlTimerComponent,
4895
+ OwlDateTimeTriggerDirective,
4896
+ OwlDateTimeInputDirective,
4897
+ OwlDateTimeComponent,
4898
+ OwlDateTimeInlineComponent,
4899
+ OwlMultiYearViewComponent,
4900
+ OwlYearViewComponent,
4901
+ OwlMonthViewComponent] });
4902
+ OwlDateTimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeModule, providers: [
4903
+ OwlDateTimeIntl,
4904
+ OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER
4905
+ ], imports: [[CommonModule, OverlayModule, OwlDialogModule, A11yModule]] });
4906
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.2", ngImport: i0, type: OwlDateTimeModule, decorators: [{
4907
+ type: NgModule,
4908
+ args: [{
4909
+ imports: [CommonModule, OverlayModule, OwlDialogModule, A11yModule],
4910
+ exports: [
4911
+ OwlCalendarComponent,
4912
+ OwlTimerComponent,
4913
+ OwlDateTimeTriggerDirective,
4914
+ OwlDateTimeInputDirective,
4915
+ OwlDateTimeComponent,
4916
+ OwlDateTimeInlineComponent,
4917
+ OwlMultiYearViewComponent,
4918
+ OwlYearViewComponent,
4919
+ OwlMonthViewComponent
4920
+ ],
4921
+ declarations: [
4922
+ OwlDateTimeTriggerDirective,
4923
+ OwlDateTimeInputDirective,
4924
+ OwlDateTimeComponent,
4925
+ OwlDateTimeContainerComponent,
4926
+ OwlMultiYearViewComponent,
4927
+ OwlYearViewComponent,
4928
+ OwlMonthViewComponent,
4929
+ OwlTimerComponent,
4930
+ OwlTimerBoxComponent,
4931
+ OwlCalendarComponent,
4932
+ OwlCalendarBodyComponent,
4933
+ NumberFixedLenPipe,
4934
+ OwlDateTimeInlineComponent
4935
+ ],
4936
+ providers: [
4937
+ OwlDateTimeIntl,
4938
+ OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER
4939
+ ],
4940
+ entryComponents: [
4941
+ OwlDateTimeContainerComponent
4942
+ ]
4943
+ }]
4944
+ }] });
4704
4945
 
4705
4946
  /**
4706
4947
  * Generated bundle index. Do not edit.
4707
4948
  */
4708
4949
 
4709
- export { DateTimeAdapter, OWL_DATE_TIME_FORMATS, OWL_DATE_TIME_LOCALE, OWL_DATE_TIME_LOCALE_PROVIDER, OwlCalendarComponent, OwlDateTimeComponent, OwlDateTimeInlineComponent, OwlDateTimeInputDirective, OwlDateTimeIntl, OwlDateTimeModule, OwlDateTimeTriggerDirective, OwlMonthViewComponent, OwlMultiYearViewComponent, OwlTimerComponent, OwlYearViewComponent, OWL_DATE_TIME_LOCALE_FACTORY as ɵa, OWL_DATETIME_VALUE_ACCESSOR as ɵb, OWL_DATETIME_VALUE_ACCESSOR$1 as ɵc, OWL_DATETIME_VALIDATORS as ɵd, OWL_DTPICKER_SCROLL_STRATEGY as ɵe, OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY as ɵf, OWL_DTPICKER_SCROLL_STRATEGY_PROVIDER as ɵg, OwlCalendarBodyComponent as ɵh, OwlDateTimeDirective as ɵi, OwlDateTimeContainerComponent as ɵj, owlDateTimePickerAnimations as ɵk, OWL_DIALOG_SCROLL_STRATEGY as ɵl, OWL_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY as ɵm, OWL_DIALOG_SCROLL_STRATEGY_PROVIDER as ɵn, OWL_DIALOG_DEFAULT_OPTIONS as ɵo, OwlDialogService as ɵp, OwlDialogConfig as ɵq, OwlDialogModule as ɵr, OwlDialogContainerComponent as ɵs, OwlTimerBoxComponent as ɵt, NumberFixedLenPipe as ɵu };
4710
- //# sourceMappingURL=nxt-pick-datetime.js.map
4950
+ export { DateTimeAdapter, OWL_DATE_TIME_FORMATS, OWL_DATE_TIME_LOCALE, OWL_DATE_TIME_LOCALE_PROVIDER, OwlCalendarComponent, OwlDateTimeComponent, OwlDateTimeInlineComponent, OwlDateTimeInputDirective, OwlDateTimeIntl, OwlDateTimeModule, OwlDateTimeTriggerDirective, OwlMonthViewComponent, OwlMultiYearViewComponent, OwlTimerComponent, OwlYearViewComponent };