@progress/kendo-angular-dateinputs 5.2.3 → 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 (50) 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 +37 -2
  4. package/dist/es/calendar/header.component.js +3 -4
  5. package/dist/es/calendar/horizontal-view-list.component.js +3 -1
  6. package/dist/es/calendar/multiview-calendar.component.js +40 -3
  7. package/dist/es/calendar/services/century-view.service.js +7 -1
  8. package/dist/es/calendar/services/decade-view.service.js +6 -1
  9. package/dist/es/calendar/services/month-view.service.js +3 -0
  10. package/dist/es/calendar/services/year-view.service.js +5 -1
  11. package/dist/es/daterange/date-range-input.js +3 -3
  12. package/dist/es/daterange/date-range-popup.component.js +2 -2
  13. package/dist/es/daterange/date-range-selection.directive.js +1 -1
  14. package/dist/es/package-metadata.js +1 -1
  15. package/dist/es2015/calendar/calendar.component.d.ts +18 -0
  16. package/dist/es2015/calendar/calendar.component.js +38 -2
  17. package/dist/es2015/calendar/header.component.js +3 -4
  18. package/dist/es2015/calendar/horizontal-view-list.component.js +3 -1
  19. package/dist/es2015/calendar/models/view-service.interface.d.ts +1 -0
  20. package/dist/es2015/calendar/multiview-calendar.component.d.ts +20 -1
  21. package/dist/es2015/calendar/multiview-calendar.component.js +42 -5
  22. package/dist/es2015/calendar/services/century-view.service.d.ts +1 -0
  23. package/dist/es2015/calendar/services/century-view.service.js +7 -1
  24. package/dist/es2015/calendar/services/decade-view.service.d.ts +1 -0
  25. package/dist/es2015/calendar/services/decade-view.service.js +6 -1
  26. package/dist/es2015/calendar/services/month-view.service.d.ts +1 -0
  27. package/dist/es2015/calendar/services/month-view.service.js +3 -0
  28. package/dist/es2015/calendar/services/year-view.service.d.ts +1 -0
  29. package/dist/es2015/calendar/services/year-view.service.js +5 -1
  30. package/dist/es2015/daterange/date-range-input.js +3 -3
  31. package/dist/es2015/daterange/date-range-popup.component.js +2 -2
  32. package/dist/es2015/daterange/date-range-selection.directive.js +1 -1
  33. package/dist/es2015/index.metadata.json +1 -1
  34. package/dist/es2015/package-metadata.js +1 -1
  35. package/dist/fesm2015/index.js +112 -20
  36. package/dist/fesm5/index.js +109 -18
  37. package/dist/npm/calendar/calendar.component.js +37 -2
  38. package/dist/npm/calendar/header.component.js +3 -4
  39. package/dist/npm/calendar/horizontal-view-list.component.js +3 -1
  40. package/dist/npm/calendar/multiview-calendar.component.js +40 -3
  41. package/dist/npm/calendar/services/century-view.service.js +6 -0
  42. package/dist/npm/calendar/services/decade-view.service.js +5 -0
  43. package/dist/npm/calendar/services/month-view.service.js +3 -0
  44. package/dist/npm/calendar/services/year-view.service.js +4 -0
  45. package/dist/npm/daterange/date-range-input.js +3 -3
  46. package/dist/npm/daterange/date-range-popup.component.js +2 -2
  47. package/dist/npm/daterange/date-range-selection.directive.js +1 -1
  48. package/dist/npm/package-metadata.js +1 -1
  49. package/dist/systemjs/kendo-angular-dateinputs.js +1 -1
  50. package/package.json +5 -5
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-dateinputs',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1631623618,
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
  };
@@ -6,7 +6,7 @@ import { __decorate, __metadata, __param } from 'tslib';
6
6
  import { Injectable, EventEmitter, Injector, InjectionToken, Input, Output, HostBinding, Component, Inject, ElementRef, Renderer2, NgZone, TemplateRef, ViewChild, ChangeDetectionStrategy, ChangeDetectorRef, isDevMode, Directive, forwardRef, ContentChild, Optional, ViewContainerRef, HostListener, ViewChildren, QueryList, ContentChildren, IterableDiffers, NgModule } from '@angular/core';
7
7
  import { NG_VALUE_ACCESSOR, NG_VALIDATORS, NgControl } from '@angular/forms';
8
8
  import { LocalizationService, L10N_PREFIX, RTL, ComponentMessages } from '@progress/kendo-angular-l10n';
9
- import { getDate, isEqual, cloneDate, addDays, addDecades, addCenturies, firstDecadeOfCentury, lastDecadeOfCentury, firstYearOfDecade, createDate, durationInCenturies, addYears, lastYearOfDecade, durationInDecades, addWeeks, addMonths, firstDayOfMonth, lastDayOfMonth, dayOfWeek, durationInMonths, firstMonthOfYear, lastMonthOfYear, durationInYears, weekInYear } from '@progress/kendo-date-math';
9
+ import { getDate, isEqual, cloneDate, addDays, addDecades, addCenturies, firstDecadeOfCentury, lastDecadeOfCentury, firstYearOfDecade, createDate, lastYearOfDecade, lastMonthOfYear, lastDayOfMonth, durationInCenturies, addYears, durationInDecades, addWeeks, addMonths, firstDayOfMonth, dayOfWeek, durationInMonths, firstMonthOfYear, durationInYears, weekInYear } from '@progress/kendo-date-math';
10
10
  import { isDocumentAvailable, KendoInput, guid, hasObservers, Keys, EventsModule, ResizeSensorModule } from '@progress/kendo-angular-common';
11
11
  import { validatePackage } from '@progress/kendo-licensing';
12
12
  import { IntlService, IntlModule } from '@progress/kendo-angular-intl';
@@ -23,7 +23,7 @@ const packageMetadata = {
23
23
  name: '@progress/kendo-angular-dateinputs',
24
24
  productName: 'Kendo UI for Angular',
25
25
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
26
- publishDate: 1631623618,
26
+ publishDate: 1635489253,
27
27
  version: '',
28
28
  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'
29
29
  };
@@ -534,6 +534,12 @@ let CenturyViewService = class CenturyViewService {
534
534
  const firstYear = firstYearOfDecade(firstDecadeOfCentury(date));
535
535
  return createDate(firstYear.getFullYear(), 0, 1);
536
536
  }
537
+ lastDayOfPeriod(date) {
538
+ const decade = lastDecadeOfCentury(date);
539
+ const year = lastYearOfDecade(decade);
540
+ const month = lastMonthOfYear(year);
541
+ return lastDayOfMonth(month);
542
+ }
537
543
  isRangeStart(value) {
538
544
  return value.getFullYear() % 1000 === 0;
539
545
  }
@@ -695,6 +701,11 @@ let DecadeViewService = class DecadeViewService {
695
701
  const firstYear = firstYearOfDecade(date);
696
702
  return createDate(firstYear.getFullYear(), 0, 1);
697
703
  }
704
+ lastDayOfPeriod(date) {
705
+ const year = lastYearOfDecade(date);
706
+ const month = lastMonthOfYear(year);
707
+ return lastDayOfMonth(month);
708
+ }
698
709
  isRangeStart(value) {
699
710
  return value.getFullYear() % 100 === 0;
700
711
  }
@@ -862,6 +873,9 @@ let MonthViewService = class MonthViewService {
862
873
  }
863
874
  return createDate(date.getFullYear(), date.getMonth(), 1);
864
875
  }
876
+ lastDayOfPeriod(date) {
877
+ return lastDayOfMonth(date);
878
+ }
865
879
  isRangeStart(value) {
866
880
  return !value.getMonth();
867
881
  }
@@ -1056,6 +1070,10 @@ let YearViewService = class YearViewService {
1056
1070
  }
1057
1071
  return createDate(date.getFullYear(), 0, 1);
1058
1072
  }
1073
+ lastDayOfPeriod(date) {
1074
+ const month = lastMonthOfYear(date);
1075
+ return lastDayOfMonth(month);
1076
+ }
1059
1077
  isRangeStart(value) {
1060
1078
  return value.getFullYear() % 10 === 0;
1061
1079
  }
@@ -3046,6 +3064,11 @@ let CalendarComponent = class CalendarComponent {
3046
3064
  * ([more information and example]({% slug overview_calendar %}#toc-events)).
3047
3065
  */
3048
3066
  this.activeViewChange = new EventEmitter();
3067
+ /**
3068
+ * Fires when navigating in the currently active view
3069
+ * ([more information and example]({% slug events_calendar %})).
3070
+ */
3071
+ this.navigate = new EventEmitter();
3049
3072
  /**
3050
3073
  * Fires when the active view date is changed
3051
3074
  * ([more information and example]({% slug overview_calendar %}#toc-events)).
@@ -3087,6 +3110,14 @@ let CalendarComponent = class CalendarComponent {
3087
3110
  * > If the Calendar is out of the min or max range, it normalizes the defined `focusedDate`.
3088
3111
  */
3089
3112
  set focusedDate(focusedDate) {
3113
+ if (this.activeViewDate && !isEqual(this._focusedDate, focusedDate)) {
3114
+ const service = this.bus.service(this.activeViewEnum);
3115
+ const lastDayInPeriod = service.lastDayOfPeriod(this.activeViewDate);
3116
+ const isFocusedDateInRange = service.isInRange(focusedDate, this.activeViewDate, lastDayInPeriod);
3117
+ if (!isFocusedDateInRange) {
3118
+ this.emitNavigate(focusedDate);
3119
+ }
3120
+ }
3090
3121
  this._focusedDate = focusedDate || getToday();
3091
3122
  this.setAriaActivedescendant();
3092
3123
  }
@@ -3155,6 +3186,10 @@ let CalendarComponent = class CalendarComponent {
3155
3186
  */
3156
3187
  set disabledDates(value) {
3157
3188
  this.disabledDatesService.initialize(value);
3189
+ this._disabledDates = value;
3190
+ }
3191
+ get disabledDates() {
3192
+ return this._disabledDates;
3158
3193
  }
3159
3194
  /**
3160
3195
  * Specifies the Calendar type.
@@ -3237,7 +3272,7 @@ let CalendarComponent = class CalendarComponent {
3237
3272
  return 'grid';
3238
3273
  }
3239
3274
  get calendarTabIndex() {
3240
- return this.disabled ? undefined : this.tabIndex;
3275
+ return this.disabled || this.type === 'classic' ? undefined : this.tabIndex;
3241
3276
  }
3242
3277
  get ariaDisabled() {
3243
3278
  return this.disabled;
@@ -3457,6 +3492,13 @@ let CalendarComponent = class CalendarComponent {
3457
3492
  return null;
3458
3493
  }
3459
3494
  }
3495
+ /**
3496
+ * @hidden
3497
+ */
3498
+ emitNavigate(focusedDate) {
3499
+ const activeView = CalendarViewEnum[this.activeViewEnum];
3500
+ this.navigate.emit({ activeView, focusedDate });
3501
+ }
3460
3502
  /**
3461
3503
  * @hidden
3462
3504
  */
@@ -3467,6 +3509,13 @@ let CalendarComponent = class CalendarComponent {
3467
3509
  });
3468
3510
  }
3469
3511
  }
3512
+ /**
3513
+ * @hidden
3514
+ */
3515
+ handleActiveDateChange(date) {
3516
+ this.activeViewDate = date;
3517
+ this.emitEvent(this.activeViewDateChange, date);
3518
+ }
3470
3519
  /**
3471
3520
  * @hidden
3472
3521
  */
@@ -3708,6 +3757,10 @@ __decorate([
3708
3757
  Output(),
3709
3758
  __metadata("design:type", EventEmitter)
3710
3759
  ], CalendarComponent.prototype, "activeViewChange", void 0);
3760
+ __decorate([
3761
+ Output(),
3762
+ __metadata("design:type", EventEmitter)
3763
+ ], CalendarComponent.prototype, "navigate", void 0);
3711
3764
  __decorate([
3712
3765
  Output(),
3713
3766
  __metadata("design:type", EventEmitter)
@@ -3879,7 +3932,7 @@ CalendarComponent = __decorate([
3879
3932
  })"
3880
3933
  (cellClick)="handleCellClick($event)"
3881
3934
  (weekNumberCellClick)="handleWeekNumberClick($event)"
3882
- (activeDateChange)="emitEvent(activeViewDateChange, $event)"
3935
+ (activeDateChange)="handleActiveDateChange($event)"
3883
3936
  (pageChange)="onPageChange()"
3884
3937
  >
3885
3938
  </kendo-calendar-viewlist>
@@ -3909,6 +3962,7 @@ CalendarComponent = __decorate([
3909
3962
  [value]="value"
3910
3963
  [disabledDates]="disabledDates"
3911
3964
  (activeViewChange)="handleActiveViewChange($event)"
3965
+ (navigate)="navigate.emit($event)"
3912
3966
  (valueChange)="handleMultiViewCalendarValueChange($event, multiviewcalendar.focusedDate)"
3913
3967
  >
3914
3968
  <kendo-multiviewcalendar-messages
@@ -9132,7 +9186,9 @@ __decorate([
9132
9186
  ], HorizontalViewListComponent.prototype, "activeDateChange", void 0);
9133
9187
  __decorate([
9134
9188
  HostBinding("class.k-calendar-view"),
9135
- HostBinding("class.k-justify-align-start"),
9189
+ HostBinding("class.k-hstack"),
9190
+ HostBinding("class.k-align-items-start"),
9191
+ HostBinding("class.k-justify-content-center"),
9136
9192
  __metadata("design:type", Boolean)
9137
9193
  ], HorizontalViewListComponent.prototype, "getComponentClass", void 0);
9138
9194
  __decorate([
@@ -9387,6 +9443,11 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
9387
9443
  * ([more information and example]({% slug overview_multiviewcalendar %}#toc-events)).
9388
9444
  */
9389
9445
  this.activeViewChange = new EventEmitter();
9446
+ /**
9447
+ * Fires when navigating in the currently active view
9448
+ * ([more information and example]({% slug events_multiviewcalendar %})).
9449
+ */
9450
+ this.navigate = new EventEmitter();
9390
9451
  /**
9391
9452
  * Fires when a view cell is entered
9392
9453
  * ([more information and example]({% slug overview_multiviewcalendar %}#toc-events)).
@@ -9419,7 +9480,7 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
9419
9480
  this.minValidateFn = noop;
9420
9481
  this.maxValidateFn = noop;
9421
9482
  this.disabledDatesRangeValidateFn = noop;
9422
- this.subscriptions = new Subscription(() => { });
9483
+ this.subscriptions = new Subscription();
9423
9484
  this.setClasses(element.nativeElement);
9424
9485
  }
9425
9486
  /**
@@ -9631,6 +9692,10 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
9631
9692
  }
9632
9693
  this.focusedDate = candidate;
9633
9694
  event.preventDefault();
9695
+ const isSameView = this.bus.service(this.activeViewEnum).isInArray(this.focusedDate, this.viewList.dates);
9696
+ if (!isSameView) {
9697
+ this.emitNavigate(this.focusedDate);
9698
+ }
9634
9699
  }
9635
9700
  ngOnInit() {
9636
9701
  this.subscriptions.add(this.bus.viewChanged.subscribe(({ view }) => {
@@ -9716,6 +9781,18 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
9716
9781
  this.onControlChange(this.parseSelectionToValue(availableDates));
9717
9782
  this.valueChange.emit(this.parseSelectionToValue(availableDates));
9718
9783
  }
9784
+ /**
9785
+ * @hidden
9786
+ */
9787
+ handleTodayButtonClick(args) {
9788
+ const todayDate = args.focusedDate;
9789
+ const isSameView = this.bus.service(this.activeViewEnum).isInArray(todayDate, this.viewList.dates);
9790
+ const isBottomView = !this.bus.canMoveDown(this.activeViewEnum);
9791
+ if (!isSameView && isBottomView) {
9792
+ this.emitNavigate(todayDate);
9793
+ }
9794
+ this.handleDateChange(args);
9795
+ }
9719
9796
  /**
9720
9797
  * @hidden
9721
9798
  */
@@ -9782,9 +9859,17 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
9782
9859
  /**
9783
9860
  * @hidden
9784
9861
  */
9785
- navigate(action) {
9862
+ navigateView(action) {
9786
9863
  this.focusedDate = this.viewList.navigate(action);
9787
9864
  this.updateButtonState();
9865
+ this.emitNavigate(this.focusedDate);
9866
+ }
9867
+ /**
9868
+ * @hidden
9869
+ */
9870
+ emitNavigate(focusedDate) {
9871
+ const activeView = CalendarViewEnum[this.activeViewEnum];
9872
+ this.navigate.emit({ activeView, focusedDate });
9788
9873
  }
9789
9874
  /**
9790
9875
  * @hidden
@@ -9801,6 +9886,10 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
9801
9886
  */
9802
9887
  handleCellClick({ date, modifiers }) {
9803
9888
  this.performSelection(date, modifiers);
9889
+ const isSameView = this.bus.service(this.activeViewEnum).isInArray(this.focusedDate, this.viewList.dates);
9890
+ if (!isSameView) {
9891
+ this.emitNavigate(this.focusedDate);
9892
+ }
9804
9893
  }
9805
9894
  /**
9806
9895
  * @hidden
@@ -9972,6 +10061,10 @@ __decorate([
9972
10061
  Output(),
9973
10062
  __metadata("design:type", EventEmitter)
9974
10063
  ], MultiViewCalendarComponent.prototype, "activeViewChange", void 0);
10064
+ __decorate([
10065
+ Output(),
10066
+ __metadata("design:type", EventEmitter)
10067
+ ], MultiViewCalendarComponent.prototype, "navigate", void 0);
9975
10068
  __decorate([
9976
10069
  Output(),
9977
10070
  __metadata("design:type", EventEmitter)
@@ -10159,9 +10252,9 @@ MultiViewCalendarComponent = __decorate([
10159
10252
  [isPrevDisabled]="isPrevDisabled"
10160
10253
  [isNextDisabled]="isNextDisabled"
10161
10254
  [showNavigationButtons]="true"
10162
- (todayButtonClick)="handleDateChange({ selectedDates: [$event], focusedDate: $event })"
10163
- (prevButtonClick)="navigate(prevView)"
10164
- (nextButtonClick)="navigate(nextView)"
10255
+ (todayButtonClick)="handleTodayButtonClick({ selectedDates: [$event], focusedDate: $event })"
10256
+ (prevButtonClick)="navigateView(prevView)"
10257
+ (nextButtonClick)="navigateView(nextView)"
10165
10258
  >
10166
10259
  </kendo-calendar-header>
10167
10260
  <kendo-calendar-horizontal
@@ -10463,8 +10556,8 @@ let DateRangePopupComponent = class DateRangePopupComponent {
10463
10556
  * @hidden
10464
10557
  */
10465
10558
  this.popupUID = guid();
10466
- this.calendarSubscriptions = new Subscription(() => { });
10467
- this.popupSubscriptions = new Subscription(() => { });
10559
+ this.calendarSubscriptions = new Subscription();
10560
+ this.popupSubscriptions = new Subscription();
10468
10561
  this.resolvedPromise = Promise.resolve();
10469
10562
  }
10470
10563
  /**
@@ -10824,8 +10917,8 @@ class DateRangeInput {
10824
10917
  this.renderer = renderer;
10825
10918
  this.zone = zone;
10826
10919
  this.navigateCalendarOnFocus = false;
10827
- this.popupSubscriptions = new Subscription(() => { });
10828
- this.subscriptions = new Subscription(() => { });
10920
+ this.popupSubscriptions = new Subscription();
10921
+ this.subscriptions = new Subscription();
10829
10922
  }
10830
10923
  get isActiveEnd() {
10831
10924
  return this.dateRangeService.activeRangeEnd === this.activeRangeEnd;
@@ -10874,7 +10967,7 @@ class DateRangeInput {
10874
10967
  }
10875
10968
  unsubscribePopup() {
10876
10969
  this.popupSubscriptions.unsubscribe();
10877
- this.popupSubscriptions = new Subscription(() => { });
10970
+ this.popupSubscriptions = new Subscription();
10878
10971
  }
10879
10972
  activate() {
10880
10973
  this.dateRangeService.setActiveRangeEnd(this.activeRangeEnd);
@@ -11112,7 +11205,7 @@ let DateRangeSelectionDirective = class DateRangeSelectionDirective {
11112
11205
  * the section on [events]({% slug overview_multiviewcalendar %}#toc-events).
11113
11206
  */
11114
11207
  this.selectionRangeChange = new EventEmitter();
11115
- this.calendarSubscriptions = new Subscription(() => { });
11208
+ this.calendarSubscriptions = new Subscription();
11116
11209
  this.dateRangeService = this.dateRangeService || new DateRangeService();
11117
11210
  renderer.setAttribute(element.nativeElement, 'aria-multiselectable', 'true');
11118
11211
  }
@@ -11413,10 +11506,9 @@ let HeaderComponent = class HeaderComponent {
11413
11506
  this.subscriptions = new Subscription();
11414
11507
  }
11415
11508
  ngOnInit() {
11416
- this.subscriptions
11417
- .add(this.intl.changes.subscribe(this.intlChange.bind(this)))
11418
- .add(this.localization.changes.subscribe(this.l10nChange.bind(this)))
11419
- .add(this.disabledDatesService.changes.subscribe(this.setTodayAvailability.bind(this)));
11509
+ this.subscriptions.add(this.intl.changes.subscribe(this.intlChange.bind(this)));
11510
+ this.subscriptions.add(this.localization.changes.subscribe(this.l10nChange.bind(this)));
11511
+ this.subscriptions.add(this.disabledDatesService.changes.subscribe(this.setTodayAvailability.bind(this)));
11420
11512
  }
11421
11513
  ngOnChanges(_) {
11422
11514
  const service = this.bus.service(this.activeView);