@progress/kendo-angular-dateinputs 5.2.4-dev.202110261444 → 5.3.0-dev.202110290637

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 (35) hide show
  1. package/dist/cdn/js/kendo-angular-dateinputs.js +1 -1
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/calendar/calendar.component.js +33 -2
  4. package/dist/es/calendar/multiview-calendar.component.js +39 -2
  5. package/dist/es/calendar/services/century-view.service.js +7 -1
  6. package/dist/es/calendar/services/decade-view.service.js +6 -1
  7. package/dist/es/calendar/services/month-view.service.js +3 -0
  8. package/dist/es/calendar/services/year-view.service.js +5 -1
  9. package/dist/es/package-metadata.js +1 -1
  10. package/dist/es2015/calendar/calendar.component.d.ts +17 -0
  11. package/dist/es2015/calendar/calendar.component.js +34 -2
  12. package/dist/es2015/calendar/models/view-service.interface.d.ts +1 -0
  13. package/dist/es2015/calendar/multiview-calendar.component.d.ts +20 -1
  14. package/dist/es2015/calendar/multiview-calendar.component.js +41 -4
  15. package/dist/es2015/calendar/services/century-view.service.d.ts +1 -0
  16. package/dist/es2015/calendar/services/century-view.service.js +7 -1
  17. package/dist/es2015/calendar/services/decade-view.service.d.ts +1 -0
  18. package/dist/es2015/calendar/services/decade-view.service.js +6 -1
  19. package/dist/es2015/calendar/services/month-view.service.d.ts +1 -0
  20. package/dist/es2015/calendar/services/month-view.service.js +3 -0
  21. package/dist/es2015/calendar/services/year-view.service.d.ts +1 -0
  22. package/dist/es2015/calendar/services/year-view.service.js +5 -1
  23. package/dist/es2015/index.metadata.json +1 -1
  24. package/dist/es2015/package-metadata.js +1 -1
  25. package/dist/fesm2015/index.js +95 -8
  26. package/dist/fesm5/index.js +92 -6
  27. package/dist/npm/calendar/calendar.component.js +33 -2
  28. package/dist/npm/calendar/multiview-calendar.component.js +39 -2
  29. package/dist/npm/calendar/services/century-view.service.js +6 -0
  30. package/dist/npm/calendar/services/decade-view.service.js +5 -0
  31. package/dist/npm/calendar/services/month-view.service.js +3 -0
  32. package/dist/npm/calendar/services/year-view.service.js +4 -0
  33. package/dist/npm/package-metadata.js +1 -1
  34. package/dist/systemjs/kendo-angular-dateinputs.js +1 -1
  35. package/package.json +1 -1
@@ -168,6 +168,11 @@ var CalendarComponent = /** @class */ (function () {
168
168
  * ([more information and example]({% slug overview_calendar %}#toc-events)).
169
169
  */
170
170
  this.activeViewChange = new EventEmitter();
171
+ /**
172
+ * Fires when navigating in the currently active view
173
+ * ([more information and example]({% slug events_calendar %})).
174
+ */
175
+ this.navigate = new EventEmitter();
171
176
  /**
172
177
  * Fires when the active view date is changed
173
178
  * ([more information and example]({% slug overview_calendar %}#toc-events)).
@@ -213,6 +218,14 @@ var CalendarComponent = /** @class */ (function () {
213
218
  * > If the Calendar is out of the min or max range, it normalizes the defined `focusedDate`.
214
219
  */
215
220
  set: function (focusedDate) {
221
+ if (this.activeViewDate && !isEqual(this._focusedDate, focusedDate)) {
222
+ var service = this.bus.service(this.activeViewEnum);
223
+ var lastDayInPeriod = service.lastDayOfPeriod(this.activeViewDate);
224
+ var isFocusedDateInRange = service.isInRange(focusedDate, this.activeViewDate, lastDayInPeriod);
225
+ if (!isFocusedDateInRange) {
226
+ this.emitNavigate(focusedDate);
227
+ }
228
+ }
216
229
  this._focusedDate = focusedDate || getToday();
217
230
  this.setAriaActivedescendant();
218
231
  },
@@ -444,7 +457,7 @@ var CalendarComponent = /** @class */ (function () {
444
457
  });
445
458
  Object.defineProperty(CalendarComponent.prototype, "calendarTabIndex", {
446
459
  get: function () {
447
- return this.disabled ? undefined : this.tabIndex;
460
+ return this.disabled || this.type === 'classic' ? undefined : this.tabIndex;
448
461
  },
449
462
  enumerable: true,
450
463
  configurable: true
@@ -678,6 +691,13 @@ var CalendarComponent = /** @class */ (function () {
678
691
  return null;
679
692
  }
680
693
  };
694
+ /**
695
+ * @hidden
696
+ */
697
+ CalendarComponent.prototype.emitNavigate = function (focusedDate) {
698
+ var activeView = CalendarViewEnum[this.activeViewEnum];
699
+ this.navigate.emit({ activeView: activeView, focusedDate: focusedDate });
700
+ };
681
701
  /**
682
702
  * @hidden
683
703
  */
@@ -688,6 +708,13 @@ var CalendarComponent = /** @class */ (function () {
688
708
  });
689
709
  }
690
710
  };
711
+ /**
712
+ * @hidden
713
+ */
714
+ CalendarComponent.prototype.handleActiveDateChange = function (date) {
715
+ this.activeViewDate = date;
716
+ this.emitEvent(this.activeViewDateChange, date);
717
+ };
691
718
  /**
692
719
  * @hidden
693
720
  */
@@ -931,6 +958,10 @@ var CalendarComponent = /** @class */ (function () {
931
958
  Output(),
932
959
  tslib_1.__metadata("design:type", EventEmitter)
933
960
  ], CalendarComponent.prototype, "activeViewChange", void 0);
961
+ tslib_1.__decorate([
962
+ Output(),
963
+ tslib_1.__metadata("design:type", EventEmitter)
964
+ ], CalendarComponent.prototype, "navigate", void 0);
934
965
  tslib_1.__decorate([
935
966
  Output(),
936
967
  tslib_1.__metadata("design:type", EventEmitter)
@@ -1060,7 +1091,7 @@ var CalendarComponent = /** @class */ (function () {
1060
1091
  SelectionService
1061
1092
  ],
1062
1093
  selector: 'kendo-calendar',
1063
- template: "\n <ng-container kendoCalendarLocalizedMessages\n i18n-today=\"kendo.calendar.today|The label for the today button in the calendar header\"\n today=\"Today\"\n\n i18n-prevButtonTitle=\"kendo.calendar.prevButtonTitle|The title of the previous button in the Classic calendar\"\n prevButtonTitle=\"Navigate to previous view\"\n\n i18n-nextButtonTitle=\"kendo.calendar.nextButtonTitle|The title of the next button in the Classic calendar\"\n nextButtonTitle=\"Navigate to next view\"\n >\n </ng-container>\n <ng-container *ngIf=\"type === 'infinite'\">\n <kendo-calendar-navigation\n *ngIf=\"navigation\"\n [activeView]=\"activeViewEnum\"\n [focusedDate]=\"focusedDate\"\n [min]=\"min\"\n [max]=\"max\"\n [templateRef]=\"navigationItemTemplate?.templateRef\"\n (valueChange)=\"handleNavigation($event)\"\n (pageChange)=\"onPageChange()\"\n >\n </kendo-calendar-navigation>\n <kendo-calendar-viewlist\n [activeView]=\"activeViewEnum\"\n [isActive]=\"isActive\"\n [cellTemplateRef]=\"activeCellTemplate()?.templateRef\"\n [headerTitleTemplateRef]=\"headerTitleTemplate?.templateRef\"\n [weekNumberTemplateRef]=\"weekNumberTemplate?.templateRef\"\n [cellUID]=\"cellUID\"\n [min]=\"min\"\n [max]=\"max\"\n [focusedDate]=\"focusedDate\"\n [weekNumber]=\"weekNumber\"\n [selectedDates]=\"selectedDates\"\n (todayButtonClick)=\"handleDateChange({\n selectedDates: [$event],\n focusedDate: $event\n })\"\n (cellClick)=\"handleCellClick($event)\"\n (weekNumberCellClick)=\"handleWeekNumberClick($event)\"\n (activeDateChange)=\"emitEvent(activeViewDateChange, $event)\"\n (pageChange)=\"onPageChange()\"\n >\n </kendo-calendar-viewlist>\n <kendo-resize-sensor (resize)=\"onResize()\"></kendo-resize-sensor>\n </ng-container>\n <ng-container *ngIf=\"type === 'classic'\">\n <kendo-multiviewcalendar\n #multiviewcalendar\n [views]=\"1\"\n [min]=\"min\"\n [max]=\"max\"\n [isActive]=\"isActive\"\n [activeView]=\"activeView\"\n [bottomView]=\"bottomView\"\n [topView]=\"topView\"\n [weekNumber]=\"weekNumber\"\n [animateNavigation]=\"animateNavigation\"\n [cellTemplate]=\"activeCellTemplate()\"\n [monthCellTemplate]=\"monthCellTemplate\"\n [yearCellTemplate]=\"yearCellTemplate\"\n [decadeCellTemplate]=\"decadeCellTemplate\"\n [centuryCellTemplate]=\"centuryCellTemplate\"\n [headerTitleTemplate]=\"headerTitleTemplate\"\n [weekNumberTemplate]=\"weekNumberTemplate\"\n [focusedDate]=\"focusedDate\"\n [selection]=\"selection\"\n [value]=\"value\"\n [disabledDates]=\"disabledDates\"\n (activeViewChange)=\"handleActiveViewChange($event)\"\n (valueChange)=\"handleMultiViewCalendarValueChange($event, multiviewcalendar.focusedDate)\"\n >\n <kendo-multiviewcalendar-messages\n [today]=\"localization.get('today')\"\n [prevButtonTitle]=\"localization.get('prevButtonTitle')\"\n [nextButtonTitle]=\"localization.get('nextButtonTitle')\"\n >\n </kendo-multiviewcalendar-messages>\n </kendo-multiviewcalendar>\n </ng-container>\n "
1094
+ template: "\n <ng-container kendoCalendarLocalizedMessages\n i18n-today=\"kendo.calendar.today|The label for the today button in the calendar header\"\n today=\"Today\"\n\n i18n-prevButtonTitle=\"kendo.calendar.prevButtonTitle|The title of the previous button in the Classic calendar\"\n prevButtonTitle=\"Navigate to previous view\"\n\n i18n-nextButtonTitle=\"kendo.calendar.nextButtonTitle|The title of the next button in the Classic calendar\"\n nextButtonTitle=\"Navigate to next view\"\n >\n </ng-container>\n <ng-container *ngIf=\"type === 'infinite'\">\n <kendo-calendar-navigation\n *ngIf=\"navigation\"\n [activeView]=\"activeViewEnum\"\n [focusedDate]=\"focusedDate\"\n [min]=\"min\"\n [max]=\"max\"\n [templateRef]=\"navigationItemTemplate?.templateRef\"\n (valueChange)=\"handleNavigation($event)\"\n (pageChange)=\"onPageChange()\"\n >\n </kendo-calendar-navigation>\n <kendo-calendar-viewlist\n [activeView]=\"activeViewEnum\"\n [isActive]=\"isActive\"\n [cellTemplateRef]=\"activeCellTemplate()?.templateRef\"\n [headerTitleTemplateRef]=\"headerTitleTemplate?.templateRef\"\n [weekNumberTemplateRef]=\"weekNumberTemplate?.templateRef\"\n [cellUID]=\"cellUID\"\n [min]=\"min\"\n [max]=\"max\"\n [focusedDate]=\"focusedDate\"\n [weekNumber]=\"weekNumber\"\n [selectedDates]=\"selectedDates\"\n (todayButtonClick)=\"handleDateChange({\n selectedDates: [$event],\n focusedDate: $event\n })\"\n (cellClick)=\"handleCellClick($event)\"\n (weekNumberCellClick)=\"handleWeekNumberClick($event)\"\n (activeDateChange)=\"handleActiveDateChange($event)\"\n (pageChange)=\"onPageChange()\"\n >\n </kendo-calendar-viewlist>\n <kendo-resize-sensor (resize)=\"onResize()\"></kendo-resize-sensor>\n </ng-container>\n <ng-container *ngIf=\"type === 'classic'\">\n <kendo-multiviewcalendar\n #multiviewcalendar\n [views]=\"1\"\n [min]=\"min\"\n [max]=\"max\"\n [isActive]=\"isActive\"\n [activeView]=\"activeView\"\n [bottomView]=\"bottomView\"\n [topView]=\"topView\"\n [weekNumber]=\"weekNumber\"\n [animateNavigation]=\"animateNavigation\"\n [cellTemplate]=\"activeCellTemplate()\"\n [monthCellTemplate]=\"monthCellTemplate\"\n [yearCellTemplate]=\"yearCellTemplate\"\n [decadeCellTemplate]=\"decadeCellTemplate\"\n [centuryCellTemplate]=\"centuryCellTemplate\"\n [headerTitleTemplate]=\"headerTitleTemplate\"\n [weekNumberTemplate]=\"weekNumberTemplate\"\n [focusedDate]=\"focusedDate\"\n [selection]=\"selection\"\n [value]=\"value\"\n [disabledDates]=\"disabledDates\"\n (activeViewChange)=\"handleActiveViewChange($event)\"\n (navigate)=\"navigate.emit($event)\"\n (valueChange)=\"handleMultiViewCalendarValueChange($event, multiviewcalendar.focusedDate)\"\n >\n <kendo-multiviewcalendar-messages\n [today]=\"localization.get('today')\"\n [prevButtonTitle]=\"localization.get('prevButtonTitle')\"\n [nextButtonTitle]=\"localization.get('nextButtonTitle')\"\n >\n </kendo-multiviewcalendar-messages>\n </kendo-multiviewcalendar>\n </ng-container>\n "
1064
1095
  }),
1065
1096
  tslib_1.__param(12, Optional()),
1066
1097
  tslib_1.__metadata("design:paramtypes", [BusViewService,
@@ -158,6 +158,11 @@ var MultiViewCalendarComponent = /** @class */ (function () {
158
158
  * ([more information and example]({% slug overview_multiviewcalendar %}#toc-events)).
159
159
  */
160
160
  this.activeViewChange = new EventEmitter();
161
+ /**
162
+ * Fires when navigating in the currently active view
163
+ * ([more information and example]({% slug events_multiviewcalendar %})).
164
+ */
165
+ this.navigate = new EventEmitter();
161
166
  /**
162
167
  * Fires when a view cell is entered
163
168
  * ([more information and example]({% slug overview_multiviewcalendar %}#toc-events)).
@@ -490,6 +495,10 @@ var MultiViewCalendarComponent = /** @class */ (function () {
490
495
  }
491
496
  this.focusedDate = candidate;
492
497
  event.preventDefault();
498
+ var isSameView = this.bus.service(this.activeViewEnum).isInArray(this.focusedDate, this.viewList.dates);
499
+ if (!isSameView) {
500
+ this.emitNavigate(this.focusedDate);
501
+ }
493
502
  };
494
503
  MultiViewCalendarComponent.prototype.ngOnInit = function () {
495
504
  var _this = this;
@@ -578,6 +587,18 @@ var MultiViewCalendarComponent = /** @class */ (function () {
578
587
  this.onControlChange(this.parseSelectionToValue(availableDates));
579
588
  this.valueChange.emit(this.parseSelectionToValue(availableDates));
580
589
  };
590
+ /**
591
+ * @hidden
592
+ */
593
+ MultiViewCalendarComponent.prototype.handleTodayButtonClick = function (args) {
594
+ var todayDate = args.focusedDate;
595
+ var isSameView = this.bus.service(this.activeViewEnum).isInArray(todayDate, this.viewList.dates);
596
+ var isBottomView = !this.bus.canMoveDown(this.activeViewEnum);
597
+ if (!isSameView && isBottomView) {
598
+ this.emitNavigate(todayDate);
599
+ }
600
+ this.handleDateChange(args);
601
+ };
581
602
  /**
582
603
  * @hidden
583
604
  */
@@ -644,9 +665,17 @@ var MultiViewCalendarComponent = /** @class */ (function () {
644
665
  /**
645
666
  * @hidden
646
667
  */
647
- MultiViewCalendarComponent.prototype.navigate = function (action) {
668
+ MultiViewCalendarComponent.prototype.navigateView = function (action) {
648
669
  this.focusedDate = this.viewList.navigate(action);
649
670
  this.updateButtonState();
671
+ this.emitNavigate(this.focusedDate);
672
+ };
673
+ /**
674
+ * @hidden
675
+ */
676
+ MultiViewCalendarComponent.prototype.emitNavigate = function (focusedDate) {
677
+ var activeView = CalendarViewEnum[this.activeViewEnum];
678
+ this.navigate.emit({ activeView: activeView, focusedDate: focusedDate });
650
679
  };
651
680
  /**
652
681
  * @hidden
@@ -664,6 +693,10 @@ var MultiViewCalendarComponent = /** @class */ (function () {
664
693
  MultiViewCalendarComponent.prototype.handleCellClick = function (_a) {
665
694
  var date = _a.date, modifiers = _a.modifiers;
666
695
  this.performSelection(date, modifiers);
696
+ var isSameView = this.bus.service(this.activeViewEnum).isInArray(this.focusedDate, this.viewList.dates);
697
+ if (!isSameView) {
698
+ this.emitNavigate(this.focusedDate);
699
+ }
667
700
  };
668
701
  /**
669
702
  * @hidden
@@ -836,6 +869,10 @@ var MultiViewCalendarComponent = /** @class */ (function () {
836
869
  Output(),
837
870
  tslib_1.__metadata("design:type", EventEmitter)
838
871
  ], MultiViewCalendarComponent.prototype, "activeViewChange", void 0);
872
+ tslib_1.__decorate([
873
+ Output(),
874
+ tslib_1.__metadata("design:type", EventEmitter)
875
+ ], MultiViewCalendarComponent.prototype, "navigate", void 0);
839
876
  tslib_1.__decorate([
840
877
  Output(),
841
878
  tslib_1.__metadata("design:type", EventEmitter)
@@ -1001,7 +1038,7 @@ var MultiViewCalendarComponent = /** @class */ (function () {
1001
1038
  SelectionService
1002
1039
  ],
1003
1040
  selector: 'kendo-multiviewcalendar',
1004
- template: "\n <ng-container kendoMultiViewCalendarLocalizedMessages\n i18n-today=\"kendo.multiviewcalendar.today|The label for the today button in the calendar header\"\n today=\"Today\"\n\n i18n-prevButtonTitle=\"kendo.multiviewcalendar.prevButtonTitle|The label for the previous button in the Multiview calendar\"\n prevButtonTitle=\"Navigate to previous view\"\n\n i18n-nextButtonTitle=\"kendo.multiviewcalendar.nextButtonTitle|The label for the next button in the Multiview calendar\"\n nextButtonTitle=\"Navigate to next view\"\n >\n </ng-container>\n <kendo-calendar-header\n [activeView]=\"activeViewEnum\"\n [currentDate]=\"activeDate\"\n [min]=\"min\"\n [max]=\"max\"\n [rangeLength]=\"views\"\n [templateRef]=\"headerTitleTemplate?.templateRef\"\n [isPrevDisabled]=\"isPrevDisabled\"\n [isNextDisabled]=\"isNextDisabled\"\n [showNavigationButtons]=\"true\"\n (todayButtonClick)=\"handleDateChange({ selectedDates: [$event], focusedDate: $event })\"\n (prevButtonClick)=\"navigate(prevView)\"\n (nextButtonClick)=\"navigate(nextView)\"\n >\n </kendo-calendar-header>\n <kendo-calendar-horizontal\n [activeView]=\"activeViewEnum\"\n [isActive]=\"isActive || isHovered\"\n [cellTemplateRef]=\"activeCellTemplate()?.templateRef\"\n [weekNumberTemplateRef]=\"weekNumberTemplate?.templateRef\"\n [cellUID]=\"cellUID\"\n [views]=\"views\"\n [min]=\"min\"\n [max]=\"max\"\n [focusedDate]=\"focusedDate\"\n [animateNavigation]=\"animateNavigation\"\n [showViewHeader]=\"showViewHeader\"\n [weekNumber]=\"weekNumber\"\n [activeRangeEnd]=\"activeRangeEnd\"\n [selectionRange]=\"selectionRange\"\n [selectedDates]=\"selectedDates\"\n (valueChange)=\"handleDateChange($event)\"\n (cellClick)=\"handleCellClick($event)\"\n (weekNumberCellClick)=\"handleWeekNumberClick($event)\"\n (cellEnter)=\"emitCellEvent(cellEnter, $event)\"\n (cellLeave)=\"emitCellEvent(cellLeave, $event)\"\n (activeDateChange)=\"setActiveDate($event)\"\n >\n </kendo-calendar-horizontal>\n "
1041
+ template: "\n <ng-container kendoMultiViewCalendarLocalizedMessages\n i18n-today=\"kendo.multiviewcalendar.today|The label for the today button in the calendar header\"\n today=\"Today\"\n\n i18n-prevButtonTitle=\"kendo.multiviewcalendar.prevButtonTitle|The label for the previous button in the Multiview calendar\"\n prevButtonTitle=\"Navigate to previous view\"\n\n i18n-nextButtonTitle=\"kendo.multiviewcalendar.nextButtonTitle|The label for the next button in the Multiview calendar\"\n nextButtonTitle=\"Navigate to next view\"\n >\n </ng-container>\n <kendo-calendar-header\n [activeView]=\"activeViewEnum\"\n [currentDate]=\"activeDate\"\n [min]=\"min\"\n [max]=\"max\"\n [rangeLength]=\"views\"\n [templateRef]=\"headerTitleTemplate?.templateRef\"\n [isPrevDisabled]=\"isPrevDisabled\"\n [isNextDisabled]=\"isNextDisabled\"\n [showNavigationButtons]=\"true\"\n (todayButtonClick)=\"handleTodayButtonClick({ selectedDates: [$event], focusedDate: $event })\"\n (prevButtonClick)=\"navigateView(prevView)\"\n (nextButtonClick)=\"navigateView(nextView)\"\n >\n </kendo-calendar-header>\n <kendo-calendar-horizontal\n [activeView]=\"activeViewEnum\"\n [isActive]=\"isActive || isHovered\"\n [cellTemplateRef]=\"activeCellTemplate()?.templateRef\"\n [weekNumberTemplateRef]=\"weekNumberTemplate?.templateRef\"\n [cellUID]=\"cellUID\"\n [views]=\"views\"\n [min]=\"min\"\n [max]=\"max\"\n [focusedDate]=\"focusedDate\"\n [animateNavigation]=\"animateNavigation\"\n [showViewHeader]=\"showViewHeader\"\n [weekNumber]=\"weekNumber\"\n [activeRangeEnd]=\"activeRangeEnd\"\n [selectionRange]=\"selectionRange\"\n [selectedDates]=\"selectedDates\"\n (valueChange)=\"handleDateChange($event)\"\n (cellClick)=\"handleCellClick($event)\"\n (weekNumberCellClick)=\"handleWeekNumberClick($event)\"\n (cellEnter)=\"emitCellEvent(cellEnter, $event)\"\n (cellLeave)=\"emitCellEvent(cellLeave, $event)\"\n (activeDateChange)=\"setActiveDate($event)\"\n >\n </kendo-calendar-horizontal>\n "
1005
1042
  }),
1006
1043
  tslib_1.__metadata("design:paramtypes", [BusViewService,
1007
1044
  ElementRef,
@@ -6,7 +6,7 @@ import * as tslib_1 from "tslib";
6
6
  var _a;
7
7
  /* tslint:disable:object-literal-sort-keys */
8
8
  import { Injectable } from '@angular/core';
9
- import { addDecades, addCenturies, cloneDate, durationInCenturies, firstYearOfDecade, firstDecadeOfCentury, lastDecadeOfCentury, createDate } from '@progress/kendo-date-math';
9
+ import { addDecades, addCenturies, cloneDate, durationInCenturies, firstYearOfDecade, firstDecadeOfCentury, lastDecadeOfCentury, createDate, lastYearOfDecade, lastMonthOfYear, lastDayOfMonth } from '@progress/kendo-date-math';
10
10
  import { Action } from '../models/navigation-action.enum';
11
11
  import { EMPTY_SELECTIONRANGE } from '../models/selection-range.interface';
12
12
  import { getToday, isInSelectionRange, range } from '../../util';
@@ -114,6 +114,12 @@ var CenturyViewService = /** @class */ (function () {
114
114
  var firstYear = firstYearOfDecade(firstDecadeOfCentury(date));
115
115
  return createDate(firstYear.getFullYear(), 0, 1);
116
116
  };
117
+ CenturyViewService.prototype.lastDayOfPeriod = function (date) {
118
+ var decade = lastDecadeOfCentury(date);
119
+ var year = lastYearOfDecade(decade);
120
+ var month = lastMonthOfYear(year);
121
+ return lastDayOfMonth(month);
122
+ };
117
123
  CenturyViewService.prototype.isRangeStart = function (value) {
118
124
  return value.getFullYear() % 1000 === 0;
119
125
  };
@@ -6,7 +6,7 @@ import * as tslib_1 from "tslib";
6
6
  var _a;
7
7
  /* tslint:disable:object-literal-sort-keys */
8
8
  import { Injectable } from '@angular/core';
9
- import { addDecades, addYears, cloneDate, durationInDecades, firstYearOfDecade, lastYearOfDecade, createDate } from '@progress/kendo-date-math';
9
+ import { addDecades, addYears, cloneDate, durationInDecades, firstYearOfDecade, lastYearOfDecade, createDate, lastMonthOfYear, lastDayOfMonth } from '@progress/kendo-date-math';
10
10
  import { Action } from '../models/navigation-action.enum';
11
11
  import { EMPTY_SELECTIONRANGE } from '../models/selection-range.interface';
12
12
  import { getToday, isInSelectionRange, range } from '../../util';
@@ -114,6 +114,11 @@ var DecadeViewService = /** @class */ (function () {
114
114
  var firstYear = firstYearOfDecade(date);
115
115
  return createDate(firstYear.getFullYear(), 0, 1);
116
116
  };
117
+ DecadeViewService.prototype.lastDayOfPeriod = function (date) {
118
+ var year = lastYearOfDecade(date);
119
+ var month = lastMonthOfYear(year);
120
+ return lastDayOfMonth(month);
121
+ };
117
122
  DecadeViewService.prototype.isRangeStart = function (value) {
118
123
  return value.getFullYear() % 100 === 0;
119
124
  };
@@ -124,6 +124,9 @@ var MonthViewService = /** @class */ (function () {
124
124
  }
125
125
  return createDate(date.getFullYear(), date.getMonth(), 1);
126
126
  };
127
+ MonthViewService.prototype.lastDayOfPeriod = function (date) {
128
+ return lastDayOfMonth(date);
129
+ };
127
130
  MonthViewService.prototype.isRangeStart = function (value) {
128
131
  return !value.getMonth();
129
132
  };
@@ -7,7 +7,7 @@ var _a;
7
7
  /* tslint:disable:object-literal-sort-keys */
8
8
  import { Injectable } from '@angular/core';
9
9
  import { IntlService } from '@progress/kendo-angular-intl';
10
- import { addMonths, addYears, cloneDate, createDate, durationInYears, firstMonthOfYear, lastMonthOfYear } from '@progress/kendo-date-math';
10
+ import { addMonths, addYears, cloneDate, createDate, durationInYears, firstMonthOfYear, lastDayOfMonth, lastMonthOfYear } from '@progress/kendo-date-math';
11
11
  import { Action } from '../models/navigation-action.enum';
12
12
  import { EMPTY_SELECTIONRANGE } from '../models/selection-range.interface';
13
13
  import { getToday, isInSelectionRange, range } from '../../util';
@@ -138,6 +138,10 @@ var YearViewService = /** @class */ (function () {
138
138
  }
139
139
  return createDate(date.getFullYear(), 0, 1);
140
140
  };
141
+ YearViewService.prototype.lastDayOfPeriod = function (date) {
142
+ var month = lastMonthOfYear(date);
143
+ return lastDayOfMonth(month);
144
+ };
141
145
  YearViewService.prototype.isRangeStart = function (value) {
142
146
  return value.getFullYear() % 10 === 0;
143
147
  };
@@ -9,7 +9,7 @@ export var packageMetadata = {
9
9
  name: '@progress/kendo-angular-dateinputs',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1635259300,
12
+ publishDate: 1635489253,
13
13
  version: '',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
15
15
  };
@@ -188,6 +188,14 @@ export declare class CalendarComponent implements ControlValueAccessor, OnChange
188
188
  * ([more information and example]({% slug overview_calendar %}#toc-events)).
189
189
  */
190
190
  activeViewChange: EventEmitter<CalendarView>;
191
+ /**
192
+ * Fires when navigating in the currently active view
193
+ * ([more information and example]({% slug events_calendar %})).
194
+ */
195
+ navigate: EventEmitter<{
196
+ activeView: CalendarView;
197
+ focusedDate: Date;
198
+ }>;
191
199
  /**
192
200
  * Fires when the active view date is changed
193
201
  * ([more information and example]({% slug overview_calendar %}#toc-events)).
@@ -295,6 +303,7 @@ export declare class CalendarComponent implements ControlValueAccessor, OnChange
295
303
  private resolvedPromise;
296
304
  private destroyed;
297
305
  private localizationChangeSubscription;
306
+ private activeViewDate;
298
307
  constructor(bus: BusViewService, dom: CalendarDOMService, element: ElementRef, navigator: NavigationService, renderer: Renderer2, cdr: ChangeDetectorRef, ngZone: NgZone, injector: Injector, scrollSyncService: ScrollSyncService, disabledDatesService: DisabledDatesService, localization: LocalizationService, selectionService: SelectionService, pickerService?: PickerService);
299
308
  ngOnInit(): void;
300
309
  ngOnChanges(changes: any): void;
@@ -378,10 +387,18 @@ export declare class CalendarComponent implements ControlValueAccessor, OnChange
378
387
  * @hidden
379
388
  */
380
389
  activeCellTemplate(): any;
390
+ /**
391
+ * @hidden
392
+ */
393
+ emitNavigate(focusedDate: Date): void;
381
394
  /**
382
395
  * @hidden
383
396
  */
384
397
  emitEvent(emitter: any, args: any): void;
398
+ /**
399
+ * @hidden
400
+ */
401
+ handleActiveDateChange(date: Date): void;
385
402
  /**
386
403
  * @hidden
387
404
  */
@@ -168,6 +168,11 @@ let CalendarComponent = class CalendarComponent {
168
168
  * ([more information and example]({% slug overview_calendar %}#toc-events)).
169
169
  */
170
170
  this.activeViewChange = new EventEmitter();
171
+ /**
172
+ * Fires when navigating in the currently active view
173
+ * ([more information and example]({% slug events_calendar %})).
174
+ */
175
+ this.navigate = new EventEmitter();
171
176
  /**
172
177
  * Fires when the active view date is changed
173
178
  * ([more information and example]({% slug overview_calendar %}#toc-events)).
@@ -209,6 +214,14 @@ let CalendarComponent = class CalendarComponent {
209
214
  * > If the Calendar is out of the min or max range, it normalizes the defined `focusedDate`.
210
215
  */
211
216
  set focusedDate(focusedDate) {
217
+ if (this.activeViewDate && !isEqual(this._focusedDate, focusedDate)) {
218
+ const service = this.bus.service(this.activeViewEnum);
219
+ const lastDayInPeriod = service.lastDayOfPeriod(this.activeViewDate);
220
+ const isFocusedDateInRange = service.isInRange(focusedDate, this.activeViewDate, lastDayInPeriod);
221
+ if (!isFocusedDateInRange) {
222
+ this.emitNavigate(focusedDate);
223
+ }
224
+ }
212
225
  this._focusedDate = focusedDate || getToday();
213
226
  this.setAriaActivedescendant();
214
227
  }
@@ -363,7 +376,7 @@ let CalendarComponent = class CalendarComponent {
363
376
  return 'grid';
364
377
  }
365
378
  get calendarTabIndex() {
366
- return this.disabled ? undefined : this.tabIndex;
379
+ return this.disabled || this.type === 'classic' ? undefined : this.tabIndex;
367
380
  }
368
381
  get ariaDisabled() {
369
382
  return this.disabled;
@@ -583,6 +596,13 @@ let CalendarComponent = class CalendarComponent {
583
596
  return null;
584
597
  }
585
598
  }
599
+ /**
600
+ * @hidden
601
+ */
602
+ emitNavigate(focusedDate) {
603
+ const activeView = CalendarViewEnum[this.activeViewEnum];
604
+ this.navigate.emit({ activeView, focusedDate });
605
+ }
586
606
  /**
587
607
  * @hidden
588
608
  */
@@ -593,6 +613,13 @@ let CalendarComponent = class CalendarComponent {
593
613
  });
594
614
  }
595
615
  }
616
+ /**
617
+ * @hidden
618
+ */
619
+ handleActiveDateChange(date) {
620
+ this.activeViewDate = date;
621
+ this.emitEvent(this.activeViewDateChange, date);
622
+ }
596
623
  /**
597
624
  * @hidden
598
625
  */
@@ -834,6 +861,10 @@ tslib_1.__decorate([
834
861
  Output(),
835
862
  tslib_1.__metadata("design:type", EventEmitter)
836
863
  ], CalendarComponent.prototype, "activeViewChange", void 0);
864
+ tslib_1.__decorate([
865
+ Output(),
866
+ tslib_1.__metadata("design:type", EventEmitter)
867
+ ], CalendarComponent.prototype, "navigate", void 0);
837
868
  tslib_1.__decorate([
838
869
  Output(),
839
870
  tslib_1.__metadata("design:type", EventEmitter)
@@ -1005,7 +1036,7 @@ CalendarComponent = tslib_1.__decorate([
1005
1036
  })"
1006
1037
  (cellClick)="handleCellClick($event)"
1007
1038
  (weekNumberCellClick)="handleWeekNumberClick($event)"
1008
- (activeDateChange)="emitEvent(activeViewDateChange, $event)"
1039
+ (activeDateChange)="handleActiveDateChange($event)"
1009
1040
  (pageChange)="onPageChange()"
1010
1041
  >
1011
1042
  </kendo-calendar-viewlist>
@@ -1035,6 +1066,7 @@ CalendarComponent = tslib_1.__decorate([
1035
1066
  [value]="value"
1036
1067
  [disabledDates]="disabledDates"
1037
1068
  (activeViewChange)="handleActiveViewChange($event)"
1069
+ (navigate)="navigate.emit($event)"
1038
1070
  (valueChange)="handleMultiViewCalendarValueChange($event, multiviewcalendar.focusedDate)"
1039
1071
  >
1040
1072
  <kendo-multiviewcalendar-messages
@@ -27,4 +27,5 @@ export interface ViewService {
27
27
  viewDate(date: Date, max: Date, viewsCount: number): Date;
28
28
  dateRange(start: Date, end: Date): Date[];
29
29
  beginningOfPeriod(date: Date): Date;
30
+ lastDayOfPeriod(date: Date): Date;
30
31
  }
@@ -187,6 +187,14 @@ export declare class MultiViewCalendarComponent implements AfterViewInit, Contro
187
187
  * ([more information and example]({% slug overview_multiviewcalendar %}#toc-events)).
188
188
  */
189
189
  activeViewChange: EventEmitter<CalendarView>;
190
+ /**
191
+ * Fires when navigating in the currently active view
192
+ * ([more information and example]({% slug events_multiviewcalendar %})).
193
+ */
194
+ navigate: EventEmitter<{
195
+ activeView: CalendarView;
196
+ focusedDate: Date;
197
+ }>;
190
198
  /**
191
199
  * Fires when a view cell is entered
192
200
  * ([more information and example]({% slug overview_multiviewcalendar %}#toc-events)).
@@ -349,6 +357,13 @@ export declare class MultiViewCalendarComponent implements AfterViewInit, Contro
349
357
  selectedDates: Date[];
350
358
  focusedDate: Date;
351
359
  }): void;
360
+ /**
361
+ * @hidden
362
+ */
363
+ handleTodayButtonClick(args: {
364
+ selectedDates: Date[];
365
+ focusedDate: Date;
366
+ }): void;
352
367
  /**
353
368
  * @hidden
354
369
  */
@@ -386,7 +401,11 @@ export declare class MultiViewCalendarComponent implements AfterViewInit, Contro
386
401
  /**
387
402
  * @hidden
388
403
  */
389
- navigate(action: Action): void;
404
+ navigateView(action: Action): void;
405
+ /**
406
+ * @hidden
407
+ */
408
+ emitNavigate(focusedDate: Date): void;
390
409
  /**
391
410
  * @hidden
392
411
  */
@@ -158,6 +158,11 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
158
158
  * ([more information and example]({% slug overview_multiviewcalendar %}#toc-events)).
159
159
  */
160
160
  this.activeViewChange = new EventEmitter();
161
+ /**
162
+ * Fires when navigating in the currently active view
163
+ * ([more information and example]({% slug events_multiviewcalendar %})).
164
+ */
165
+ this.navigate = new EventEmitter();
161
166
  /**
162
167
  * Fires when a view cell is entered
163
168
  * ([more information and example]({% slug overview_multiviewcalendar %}#toc-events)).
@@ -402,6 +407,10 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
402
407
  }
403
408
  this.focusedDate = candidate;
404
409
  event.preventDefault();
410
+ const isSameView = this.bus.service(this.activeViewEnum).isInArray(this.focusedDate, this.viewList.dates);
411
+ if (!isSameView) {
412
+ this.emitNavigate(this.focusedDate);
413
+ }
405
414
  }
406
415
  ngOnInit() {
407
416
  this.subscriptions.add(this.bus.viewChanged.subscribe(({ view }) => {
@@ -487,6 +496,18 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
487
496
  this.onControlChange(this.parseSelectionToValue(availableDates));
488
497
  this.valueChange.emit(this.parseSelectionToValue(availableDates));
489
498
  }
499
+ /**
500
+ * @hidden
501
+ */
502
+ handleTodayButtonClick(args) {
503
+ const todayDate = args.focusedDate;
504
+ const isSameView = this.bus.service(this.activeViewEnum).isInArray(todayDate, this.viewList.dates);
505
+ const isBottomView = !this.bus.canMoveDown(this.activeViewEnum);
506
+ if (!isSameView && isBottomView) {
507
+ this.emitNavigate(todayDate);
508
+ }
509
+ this.handleDateChange(args);
510
+ }
490
511
  /**
491
512
  * @hidden
492
513
  */
@@ -553,9 +574,17 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
553
574
  /**
554
575
  * @hidden
555
576
  */
556
- navigate(action) {
577
+ navigateView(action) {
557
578
  this.focusedDate = this.viewList.navigate(action);
558
579
  this.updateButtonState();
580
+ this.emitNavigate(this.focusedDate);
581
+ }
582
+ /**
583
+ * @hidden
584
+ */
585
+ emitNavigate(focusedDate) {
586
+ const activeView = CalendarViewEnum[this.activeViewEnum];
587
+ this.navigate.emit({ activeView, focusedDate });
559
588
  }
560
589
  /**
561
590
  * @hidden
@@ -572,6 +601,10 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
572
601
  */
573
602
  handleCellClick({ date, modifiers }) {
574
603
  this.performSelection(date, modifiers);
604
+ const isSameView = this.bus.service(this.activeViewEnum).isInArray(this.focusedDate, this.viewList.dates);
605
+ if (!isSameView) {
606
+ this.emitNavigate(this.focusedDate);
607
+ }
575
608
  }
576
609
  /**
577
610
  * @hidden
@@ -743,6 +776,10 @@ tslib_1.__decorate([
743
776
  Output(),
744
777
  tslib_1.__metadata("design:type", EventEmitter)
745
778
  ], MultiViewCalendarComponent.prototype, "activeViewChange", void 0);
779
+ tslib_1.__decorate([
780
+ Output(),
781
+ tslib_1.__metadata("design:type", EventEmitter)
782
+ ], MultiViewCalendarComponent.prototype, "navigate", void 0);
746
783
  tslib_1.__decorate([
747
784
  Output(),
748
785
  tslib_1.__metadata("design:type", EventEmitter)
@@ -930,9 +967,9 @@ MultiViewCalendarComponent = tslib_1.__decorate([
930
967
  [isPrevDisabled]="isPrevDisabled"
931
968
  [isNextDisabled]="isNextDisabled"
932
969
  [showNavigationButtons]="true"
933
- (todayButtonClick)="handleDateChange({ selectedDates: [$event], focusedDate: $event })"
934
- (prevButtonClick)="navigate(prevView)"
935
- (nextButtonClick)="navigate(nextView)"
970
+ (todayButtonClick)="handleTodayButtonClick({ selectedDates: [$event], focusedDate: $event })"
971
+ (prevButtonClick)="navigateView(prevView)"
972
+ (nextButtonClick)="navigateView(nextView)"
936
973
  >
937
974
  </kendo-calendar-header>
938
975
  <kendo-calendar-horizontal
@@ -16,6 +16,7 @@ export declare class CenturyViewService implements ViewService {
16
16
  isInArray(date: Date, dates: Date[]): boolean;
17
17
  isInRange(candidate: Date, min: Date, max: Date): boolean;
18
18
  beginningOfPeriod(date: Date): Date;
19
+ lastDayOfPeriod(date: Date): Date;
19
20
  isRangeStart(value: Date): boolean;
20
21
  move(value: Date, action: Action): Date;
21
22
  cellTitle(value: Date): string;
@@ -5,7 +5,7 @@
5
5
  import * as tslib_1 from "tslib";
6
6
  /* tslint:disable:object-literal-sort-keys */
7
7
  import { Injectable } from '@angular/core';
8
- import { addDecades, addCenturies, cloneDate, durationInCenturies, firstYearOfDecade, firstDecadeOfCentury, lastDecadeOfCentury, createDate } from '@progress/kendo-date-math';
8
+ import { addDecades, addCenturies, cloneDate, durationInCenturies, firstYearOfDecade, firstDecadeOfCentury, lastDecadeOfCentury, createDate, lastYearOfDecade, lastMonthOfYear, lastDayOfMonth } from '@progress/kendo-date-math';
9
9
  import { Action } from '../models/navigation-action.enum';
10
10
  import { EMPTY_SELECTIONRANGE } from '../models/selection-range.interface';
11
11
  import { getToday, isInSelectionRange, range } from '../../util';
@@ -115,6 +115,12 @@ let CenturyViewService = class CenturyViewService {
115
115
  const firstYear = firstYearOfDecade(firstDecadeOfCentury(date));
116
116
  return createDate(firstYear.getFullYear(), 0, 1);
117
117
  }
118
+ lastDayOfPeriod(date) {
119
+ const decade = lastDecadeOfCentury(date);
120
+ const year = lastYearOfDecade(decade);
121
+ const month = lastMonthOfYear(year);
122
+ return lastDayOfMonth(month);
123
+ }
118
124
  isRangeStart(value) {
119
125
  return value.getFullYear() % 1000 === 0;
120
126
  }
@@ -16,6 +16,7 @@ export declare class DecadeViewService implements ViewService {
16
16
  isInArray(date: Date, dates: Date[]): boolean;
17
17
  isInRange(candidate: Date, min: Date, max: Date): boolean;
18
18
  beginningOfPeriod(date: Date): Date;
19
+ lastDayOfPeriod(date: Date): Date;
19
20
  isRangeStart(value: Date): boolean;
20
21
  move(value: Date, action: Action): Date;
21
22
  cellTitle(value: Date): string;
@@ -5,7 +5,7 @@
5
5
  import * as tslib_1 from "tslib";
6
6
  /* tslint:disable:object-literal-sort-keys */
7
7
  import { Injectable } from '@angular/core';
8
- import { addDecades, addYears, cloneDate, durationInDecades, firstYearOfDecade, lastYearOfDecade, createDate } from '@progress/kendo-date-math';
8
+ import { addDecades, addYears, cloneDate, durationInDecades, firstYearOfDecade, lastYearOfDecade, createDate, lastMonthOfYear, lastDayOfMonth } from '@progress/kendo-date-math';
9
9
  import { Action } from '../models/navigation-action.enum';
10
10
  import { EMPTY_SELECTIONRANGE } from '../models/selection-range.interface';
11
11
  import { getToday, isInSelectionRange, range } from '../../util';
@@ -115,6 +115,11 @@ let DecadeViewService = class DecadeViewService {
115
115
  const firstYear = firstYearOfDecade(date);
116
116
  return createDate(firstYear.getFullYear(), 0, 1);
117
117
  }
118
+ lastDayOfPeriod(date) {
119
+ const year = lastYearOfDecade(date);
120
+ const month = lastMonthOfYear(year);
121
+ return lastDayOfMonth(month);
122
+ }
118
123
  isRangeStart(value) {
119
124
  return value.getFullYear() % 100 === 0;
120
125
  }
@@ -20,6 +20,7 @@ export declare class MonthViewService implements ViewService {
20
20
  isInArray(date: Date, dates: Date[]): boolean;
21
21
  isInRange(candidate: Date, min: Date, max: Date): boolean;
22
22
  beginningOfPeriod(date: Date): Date;
23
+ lastDayOfPeriod(date: Date): Date;
23
24
  isRangeStart(value: Date): boolean;
24
25
  move(value: Date, action: Action): Date;
25
26
  cellTitle(value: Date): string;
@@ -122,6 +122,9 @@ let MonthViewService = class MonthViewService {
122
122
  }
123
123
  return createDate(date.getFullYear(), date.getMonth(), 1);
124
124
  }
125
+ lastDayOfPeriod(date) {
126
+ return lastDayOfMonth(date);
127
+ }
125
128
  isRangeStart(value) {
126
129
  return !value.getMonth();
127
130
  }
@@ -19,6 +19,7 @@ export declare class YearViewService implements ViewService {
19
19
  isInArray(date: Date, dates: Date[]): boolean;
20
20
  isInRange(candidate: Date, min: Date, max: Date): boolean;
21
21
  beginningOfPeriod(date: Date): Date;
22
+ lastDayOfPeriod(date: Date): Date;
22
23
  isRangeStart(value: Date): boolean;
23
24
  move(value: Date, action: Action): Date;
24
25
  cellTitle(value: Date): string;