@progress/kendo-angular-dateinputs 5.2.4-dev.202110060847 → 5.3.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 (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 +33 -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 +17 -0
  16. package/dist/es2015/calendar/calendar.component.js +34 -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 +108 -20
  36. package/dist/fesm5/index.js +105 -18
  37. package/dist/npm/calendar/calendar.component.js +33 -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
@@ -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)).
@@ -190,7 +195,7 @@ let MultiViewCalendarComponent = class MultiViewCalendarComponent {
190
195
  this.minValidateFn = noop;
191
196
  this.maxValidateFn = noop;
192
197
  this.disabledDatesRangeValidateFn = noop;
193
- this.subscriptions = new Subscription(() => { });
198
+ this.subscriptions = new Subscription();
194
199
  this.setClasses(element.nativeElement);
195
200
  }
196
201
  /**
@@ -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;
@@ -6,7 +6,7 @@ import * as tslib_1 from "tslib";
6
6
  /* tslint:disable:object-literal-sort-keys */
7
7
  import { Injectable } from '@angular/core';
8
8
  import { IntlService } from '@progress/kendo-angular-intl';
9
- import { addMonths, addYears, cloneDate, createDate, durationInYears, firstMonthOfYear, lastMonthOfYear } from '@progress/kendo-date-math';
9
+ import { addMonths, addYears, cloneDate, createDate, durationInYears, firstMonthOfYear, lastDayOfMonth, lastMonthOfYear } 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';
@@ -136,6 +136,10 @@ let YearViewService = class YearViewService {
136
136
  }
137
137
  return createDate(date.getFullYear(), 0, 1);
138
138
  }
139
+ lastDayOfPeriod(date) {
140
+ const month = lastMonthOfYear(date);
141
+ return lastDayOfMonth(month);
142
+ }
139
143
  isRangeStart(value) {
140
144
  return value.getFullYear() % 10 === 0;
141
145
  }
@@ -19,8 +19,8 @@ export class DateRangeInput {
19
19
  this.renderer = renderer;
20
20
  this.zone = zone;
21
21
  this.navigateCalendarOnFocus = false;
22
- this.popupSubscriptions = new Subscription(() => { });
23
- this.subscriptions = new Subscription(() => { });
22
+ this.popupSubscriptions = new Subscription();
23
+ this.subscriptions = new Subscription();
24
24
  }
25
25
  get isActiveEnd() {
26
26
  return this.dateRangeService.activeRangeEnd === this.activeRangeEnd;
@@ -69,7 +69,7 @@ export class DateRangeInput {
69
69
  }
70
70
  unsubscribePopup() {
71
71
  this.popupSubscriptions.unsubscribe();
72
- this.popupSubscriptions = new Subscription(() => { });
72
+ this.popupSubscriptions = new Subscription();
73
73
  }
74
74
  activate() {
75
75
  this.dateRangeService.setActiveRangeEnd(this.activeRangeEnd);
@@ -84,8 +84,8 @@ let DateRangePopupComponent = class DateRangePopupComponent {
84
84
  * @hidden
85
85
  */
86
86
  this.popupUID = guid();
87
- this.calendarSubscriptions = new Subscription(() => { });
88
- this.popupSubscriptions = new Subscription(() => { });
87
+ this.calendarSubscriptions = new Subscription();
88
+ this.popupSubscriptions = new Subscription();
89
89
  this.resolvedPromise = Promise.resolve();
90
90
  }
91
91
  /**
@@ -38,7 +38,7 @@ let DateRangeSelectionDirective = class DateRangeSelectionDirective {
38
38
  * the section on [events]({% slug overview_multiviewcalendar %}#toc-events).
39
39
  */
40
40
  this.selectionRangeChange = new EventEmitter();
41
- this.calendarSubscriptions = new Subscription(() => { });
41
+ this.calendarSubscriptions = new Subscription();
42
42
  this.dateRangeService = this.dateRangeService || new DateRangeService();
43
43
  renderer.setAttribute(element.nativeElement, 'aria-multiselectable', 'true');
44
44
  }