@progress/kendo-angular-scheduler 3.0.3-dev.202203091424 → 3.1.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 (70) hide show
  1. package/dist/cdn/js/kendo-angular-scheduler.js +2 -2
  2. package/dist/cdn/main.js +1 -1
  3. package/dist/es/package-metadata.js +1 -1
  4. package/dist/es/scheduler.component.js +9 -0
  5. package/dist/es/types/ongoing-events-settings.interface.js +4 -0
  6. package/dist/es/views/common/base-view.js +3 -0
  7. package/dist/es/views/common/configuration-view-base.js +14 -0
  8. package/dist/es/views/constants.js +6 -0
  9. package/dist/es/views/day-time/day-time-view-base.js +15 -0
  10. package/dist/es/views/day-time/day-time-view.component.js +36 -2
  11. package/dist/es/views/month/month-view-renderer.component.js +47 -5
  12. package/dist/es/views/month/month-view.component.js +1 -1
  13. package/dist/es/views/multi-day/day-view.component.js +1 -1
  14. package/dist/es/views/multi-day/multi-day-view.component.js +1 -1
  15. package/dist/es/views/multi-day/week-view.component.js +1 -1
  16. package/dist/es/views/multi-day/work-week-view.component.js +1 -1
  17. package/dist/es/views/timeline/timeline-month-view.component.js +1 -1
  18. package/dist/es/views/timeline/timeline-view.component.js +1 -1
  19. package/dist/es/views/timeline/timeline-week-view.component.js +1 -1
  20. package/dist/es/views/utils.js +5 -1
  21. package/dist/es2015/index.metadata.json +1 -1
  22. package/dist/es2015/package-metadata.js +1 -1
  23. package/dist/es2015/scheduler.component.d.ts +5 -1
  24. package/dist/es2015/scheduler.component.js +9 -0
  25. package/dist/es2015/types/ongoing-events-settings.interface.d.ts +23 -0
  26. package/dist/es2015/types/ongoing-events-settings.interface.js +4 -0
  27. package/dist/es2015/types.d.ts +1 -0
  28. package/dist/es2015/views/common/base-view.d.ts +6 -0
  29. package/dist/es2015/views/common/base-view.js +3 -0
  30. package/dist/es2015/views/common/configuration-view-base.d.ts +9 -1
  31. package/dist/es2015/views/common/configuration-view-base.js +10 -0
  32. package/dist/es2015/views/constants.d.ts +6 -0
  33. package/dist/es2015/views/constants.js +6 -0
  34. package/dist/es2015/views/day-time/day-time-view-base.d.ts +9 -1
  35. package/dist/es2015/views/day-time/day-time-view-base.js +11 -0
  36. package/dist/es2015/views/day-time/day-time-view.component.d.ts +6 -0
  37. package/dist/es2015/views/day-time/day-time-view.component.js +34 -2
  38. package/dist/es2015/views/month/month-view-renderer.component.d.ts +10 -1
  39. package/dist/es2015/views/month/month-view-renderer.component.js +45 -5
  40. package/dist/es2015/views/month/month-view.component.js +1 -0
  41. package/dist/es2015/views/multi-day/day-view.component.js +1 -0
  42. package/dist/es2015/views/multi-day/multi-day-view.component.js +1 -0
  43. package/dist/es2015/views/multi-day/week-view.component.js +1 -0
  44. package/dist/es2015/views/multi-day/work-week-view.component.js +1 -0
  45. package/dist/es2015/views/timeline/timeline-month-view.component.js +1 -0
  46. package/dist/es2015/views/timeline/timeline-view.component.js +1 -0
  47. package/dist/es2015/views/timeline/timeline-week-view.component.js +1 -0
  48. package/dist/es2015/views/utils.js +5 -1
  49. package/dist/fesm2015/index.js +198 -79
  50. package/dist/fesm5/index.js +179 -56
  51. package/dist/npm/package-metadata.js +1 -1
  52. package/dist/npm/scheduler.component.js +9 -0
  53. package/dist/npm/types/ongoing-events-settings.interface.js +6 -0
  54. package/dist/npm/views/common/base-view.js +3 -0
  55. package/dist/npm/views/common/configuration-view-base.js +14 -0
  56. package/dist/npm/views/constants.js +6 -0
  57. package/dist/npm/views/day-time/day-time-view-base.js +15 -0
  58. package/dist/npm/views/day-time/day-time-view.component.js +34 -0
  59. package/dist/npm/views/month/month-view-renderer.component.js +49 -7
  60. package/dist/npm/views/month/month-view.component.js +1 -1
  61. package/dist/npm/views/multi-day/day-view.component.js +1 -1
  62. package/dist/npm/views/multi-day/multi-day-view.component.js +1 -1
  63. package/dist/npm/views/multi-day/week-view.component.js +1 -1
  64. package/dist/npm/views/multi-day/work-week-view.component.js +1 -1
  65. package/dist/npm/views/timeline/timeline-month-view.component.js +1 -1
  66. package/dist/npm/views/timeline/timeline-view.component.js +1 -1
  67. package/dist/npm/views/timeline/timeline-week-view.component.js +1 -1
  68. package/dist/npm/views/utils.js +5 -1
  69. package/dist/systemjs/kendo-angular-scheduler.js +1 -1
  70. package/package.json +1 -1
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-scheduler',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1646835692,
12
+ publishDate: 1649834643,
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
  };
@@ -9,7 +9,7 @@ import { Day } from '@progress/kendo-date-math';
9
9
  import { Observable } from 'rxjs';
10
10
  import { DateChangeEvent, NavigateEvent, SlotClickEvent, EventClickEvent } from './events';
11
11
  import { ToolbarTemplateDirective } from './toolbar/toolbar-template.directive';
12
- import { DateRange, Group, NavigationAction, Resource, SchedulerModelFields, SchedulerView, EditMode, CrudOperation, EditableSettings, CurrentTimeSettings, SlotClassArgs, EventStyleArgs, SchedulerSlot } from './types';
12
+ import { DateRange, Group, NavigationAction, Resource, SchedulerModelFields, SchedulerView, EditMode, CrudOperation, EditableSettings, CurrentTimeSettings, OngoingEventsSettings, SlotClassArgs, EventStyleArgs, SchedulerSlot } from './types';
13
13
  import { AgendaDateTemplateDirective } from './views/templates/agenda-date-template.directive';
14
14
  import { AgendaTimeTemplateDirective } from './views/templates/agenda-time-template.directive';
15
15
  import { AllDayEventTemplateDirective } from './views/templates/all-day-event-template.directive';
@@ -208,6 +208,10 @@ export declare class SchedulerComponent implements AfterContentInit, OnDestroy,
208
208
  * Specifies the Scheduler current time marker settings.
209
209
  */
210
210
  currentTimeMarker: boolean | CurrentTimeSettings;
211
+ /**
212
+ * Specifies the settings for the ongoing events highlight of the Scheduler.
213
+ */
214
+ highlightOngoingEvents: boolean | OngoingEventsSettings;
211
215
  /**
212
216
  * Defines a function that is executed for every slot in the view.
213
217
  * The function returns a value which is supported by [`ngClass`]({{ site.data.urls.angular['ngclassapi'] }}).
@@ -145,6 +145,10 @@ let SchedulerComponent = class SchedulerComponent {
145
145
  * Specifies the Scheduler current time marker settings.
146
146
  */
147
147
  this.currentTimeMarker = true;
148
+ /**
149
+ * Specifies the settings for the ongoing events highlight of the Scheduler.
150
+ */
151
+ this.highlightOngoingEvents = true;
148
152
  /**
149
153
  * A callback that executes for each slot of the Scheduler view.
150
154
  * If it returns `true`, the `k-state-selected` CSS class will be added to the cell, making it visibly selected.
@@ -716,6 +720,7 @@ let SchedulerComponent = class SchedulerComponent {
716
720
  selectable: this.selectable,
717
721
  timezone: this.timezone,
718
722
  currentTimeMarker: this.currentTimeMarker,
723
+ highlightOngoingEvents: this.highlightOngoingEvents,
719
724
  slotClass: this.slotClass,
720
725
  slotFill: this.slotFill,
721
726
  columnWidth: this.columnWidth,
@@ -975,6 +980,10 @@ tslib_1.__decorate([
975
980
  Input(),
976
981
  tslib_1.__metadata("design:type", Object)
977
982
  ], SchedulerComponent.prototype, "currentTimeMarker", void 0);
983
+ tslib_1.__decorate([
984
+ Input(),
985
+ tslib_1.__metadata("design:type", Object)
986
+ ], SchedulerComponent.prototype, "highlightOngoingEvents", void 0);
978
987
  tslib_1.__decorate([
979
988
  Input(),
980
989
  tslib_1.__metadata("design:type", Function)
@@ -0,0 +1,23 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ /**
6
+ * The settings for the ongoing events highlight.
7
+ */
8
+ export interface OngoingEventsSettings {
9
+ /**
10
+ * The update interval (in milliseconds) of the ongoing events highlight.
11
+ * Defaults to `60000` (a minute).
12
+ */
13
+ updateInterval?: number;
14
+ /**
15
+ * Specifies if the ongoing events will be highlighted.
16
+ * Defaults to `true`.
17
+ */
18
+ enabled?: boolean;
19
+ /**
20
+ * Specifies a custom CSS class applied to ongoing events.
21
+ */
22
+ cssClass?: string;
23
+ }
@@ -0,0 +1,4 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
@@ -23,3 +23,4 @@ export { NumericTextBoxOptions } from './types/numeric-options.interface';
23
23
  export { DatePickerOptions } from './types/datepicker-options.interface';
24
24
  export { SlotRange } from './types/slot-selection';
25
25
  export { IsSlotSelectedArgs } from './types/slot-selection';
26
+ export { OngoingEventsSettings } from './types/ongoing-events-settings.interface';
@@ -47,6 +47,9 @@ export declare abstract class BaseView implements OnInit, OnChanges, AfterViewIn
47
47
  hintContainer: HintContainerComponent;
48
48
  readonly eventTemplateRef: TemplateRef<any>;
49
49
  readonly groupHeaderTemplateRef: TemplateRef<any>;
50
+ /**
51
+ * The non-all-day events.
52
+ */
50
53
  items: Subject<any[]>;
51
54
  horizontalResources: any[];
52
55
  verticalResources: any[];
@@ -61,6 +64,9 @@ export declare abstract class BaseView implements OnInit, OnChanges, AfterViewIn
61
64
  protected groupedResources: any[];
62
65
  protected spans: any[];
63
66
  protected contentHeight: any;
67
+ /**
68
+ * All events that the user provided.
69
+ */
64
70
  protected tasks: any[];
65
71
  protected group: any;
66
72
  protected resources: any[];
@@ -33,6 +33,9 @@ export class BaseView {
33
33
  this.pdfService = pdfService;
34
34
  this.localization = localization;
35
35
  this.cdr = cdr;
36
+ /**
37
+ * The non-all-day events.
38
+ */
36
39
  this.items = new BehaviorSubject(null);
37
40
  this.horizontalResources = [];
38
41
  this.verticalResources = [];
@@ -3,7 +3,7 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { TemplateRef, ChangeDetectorRef, OnDestroy } from '@angular/core';
6
- import { SchedulerView } from '../../types';
6
+ import { OngoingEventsSettings, SchedulerView } from '../../types';
7
7
  import { EventTemplateDirective, GroupHeaderTemplateDirective } from '../templates';
8
8
  import { Subscription } from 'rxjs';
9
9
  import { LocalizationService } from '@progress/kendo-angular-l10n';
@@ -36,6 +36,10 @@ export declare abstract class ConfigurationViewBase extends SchedulerView implem
36
36
  * The function returns a value which is supported by [`ngStyle`]({{ site.data.urls.angular['ngstyleapi'] }}).
37
37
  */
38
38
  eventStyles: (args: EventStyleArgs) => any;
39
+ /**
40
+ * Specifies the settings for the ongoing events highlight of the Scheduler.
41
+ */
42
+ highlightOngoingEvents: boolean | OngoingEventsSettings;
39
43
  /**
40
44
  * @hidden
41
45
  */
@@ -60,6 +64,10 @@ export declare abstract class ConfigurationViewBase extends SchedulerView implem
60
64
  * @hidden
61
65
  */
62
66
  readonly viewEventStyles: any;
67
+ /**
68
+ * @hidden
69
+ */
70
+ readonly viewHighlightOngoingEvents: any;
63
71
  /**
64
72
  * @hidden
65
73
  */
@@ -43,6 +43,12 @@ export class ConfigurationViewBase extends SchedulerView {
43
43
  get viewEventStyles() {
44
44
  return isPresent(this.eventStyles) ? this.eventStyles : this.schedulerOptions.eventStyles;
45
45
  }
46
+ /**
47
+ * @hidden
48
+ */
49
+ get viewHighlightOngoingEvents() {
50
+ return isPresent(this.highlightOngoingEvents) ? this.highlightOngoingEvents : this.schedulerOptions.highlightOngoingEvents;
51
+ }
46
52
  /**
47
53
  * @hidden
48
54
  */
@@ -71,6 +77,10 @@ tslib_1.__decorate([
71
77
  Input(),
72
78
  tslib_1.__metadata("design:type", Function)
73
79
  ], ConfigurationViewBase.prototype, "eventStyles", void 0);
80
+ tslib_1.__decorate([
81
+ Input(),
82
+ tslib_1.__metadata("design:type", Object)
83
+ ], ConfigurationViewBase.prototype, "highlightOngoingEvents", void 0);
74
84
  tslib_1.__decorate([
75
85
  ViewChild('content', { static: true }),
76
86
  tslib_1.__metadata("design:type", TemplateRef)
@@ -20,3 +20,9 @@ export { MS_PER_DAY } from '@progress/kendo-date-math';
20
20
  export declare const BORDER_WIDTH = 1;
21
21
  /** @hidden */
22
22
  export declare const DEFAULT_EVENT_HEIGHT = 25;
23
+ /** @hidden */
24
+ export declare const ONGOING_EVENT_CSS_CLASS = "k-event-ongoing";
25
+ /** @hidden */
26
+ export declare const DAYS_IN_WEEK_COUNT = 7;
27
+ /** @hidden */
28
+ export declare const WEEKS_COUNT = 6;
@@ -21,3 +21,9 @@ export { MS_PER_DAY } from '@progress/kendo-date-math';
21
21
  export const BORDER_WIDTH = 1;
22
22
  /** @hidden */
23
23
  export const DEFAULT_EVENT_HEIGHT = 25;
24
+ /** @hidden */
25
+ export const ONGOING_EVENT_CSS_CLASS = 'k-event-ongoing';
26
+ /** @hidden */
27
+ export const DAYS_IN_WEEK_COUNT = 7;
28
+ /** @hidden */
29
+ export const WEEKS_COUNT = 6;
@@ -7,7 +7,7 @@ import { ConfigurationViewBase } from '../common/configuration-view-base';
7
7
  import { TimeSlotTemplateDirective, DateHeaderTemplateDirective } from '../templates';
8
8
  import { ViewContextService } from '../view-context.service';
9
9
  import { ViewStateService } from '../view-state.service';
10
- import { CurrentTimeSettings } from '../../types';
10
+ import { CurrentTimeSettings, OngoingEventsSettings } from '../../types';
11
11
  import { Day } from '@progress/kendo-date-math';
12
12
  import { LocalizationService } from '@progress/kendo-angular-l10n';
13
13
  /**
@@ -76,6 +76,10 @@ export declare abstract class DayTimeViewBase extends ConfigurationViewBase impl
76
76
  * Specifies the settings for the current time marker of the Scheduler.
77
77
  */
78
78
  currentTimeMarker: boolean | CurrentTimeSettings;
79
+ /**
80
+ * Specifies the settings for the ongoing events highlight of the Scheduler.
81
+ */
82
+ highlightOngoingEvents: boolean | OngoingEventsSettings;
79
83
  /**
80
84
  * @hidden
81
85
  */
@@ -120,6 +124,10 @@ export declare abstract class DayTimeViewBase extends ConfigurationViewBase impl
120
124
  * @hidden
121
125
  */
122
126
  readonly viewCurrentTimeMarker: any;
127
+ /**
128
+ * @hidden
129
+ */
130
+ readonly viewHighlightOngoingEvents: any;
123
131
  /**
124
132
  * @hidden
125
133
  */
@@ -20,6 +20,7 @@ const WORK_WEEK_END = 'workWeekEnd';
20
20
  const SLOT_DURATION = 'slotDuration';
21
21
  const SLOT_DIVISIONS = 'slotDivisions';
22
22
  const CURRENT_TIME_MARKER = 'currentTimeMarker';
23
+ const HIGHLIGHT_ONGOING_EVENTS = 'highlightOngoingEvents';
23
24
  /**
24
25
  * @hidden
25
26
  */
@@ -93,6 +94,12 @@ export class DayTimeViewBase extends ConfigurationViewBase {
93
94
  get viewCurrentTimeMarker() {
94
95
  return this.optionValue(CURRENT_TIME_MARKER);
95
96
  }
97
+ /**
98
+ * @hidden
99
+ */
100
+ get viewHighlightOngoingEvents() {
101
+ return this.optionValue(HIGHLIGHT_ONGOING_EVENTS);
102
+ }
96
103
  /**
97
104
  * @hidden
98
105
  */
@@ -159,3 +166,7 @@ tslib_1.__decorate([
159
166
  Input(),
160
167
  tslib_1.__metadata("design:type", Object)
161
168
  ], DayTimeViewBase.prototype, "currentTimeMarker", void 0);
169
+ tslib_1.__decorate([
170
+ Input(),
171
+ tslib_1.__metadata("design:type", Object)
172
+ ], DayTimeViewBase.prototype, "highlightOngoingEvents", void 0);
@@ -12,6 +12,7 @@ import { IntlService } from '@progress/kendo-angular-intl';
12
12
  import { PDFService } from '../../pdf/pdf.service';
13
13
  import { BaseView } from '../common/base-view';
14
14
  import { LocalizationService } from '@progress/kendo-angular-l10n';
15
+ import { DayTimeViewItemComponent } from './day-time-view-item.component';
15
16
  /**
16
17
  * @hidden
17
18
  */
@@ -34,7 +35,9 @@ export declare abstract class DayTimeViewComponent extends BaseView implements O
34
35
  getEndDate: any;
35
36
  getNextDate: any;
36
37
  currentTimeMarker: any;
38
+ highlightOngoingEvents: any;
37
39
  currentTimeElements: QueryList<ElementRef>;
40
+ eventElements: QueryList<DayTimeViewItemComponent>;
38
41
  currentTimeArrows: QueryList<ElementRef>;
39
42
  name: string;
40
43
  workDayStartTime: any;
@@ -49,6 +52,7 @@ export declare abstract class DayTimeViewComponent extends BaseView implements O
49
52
  protected schedulerTimeSlotTemplate: any;
50
53
  protected schedulerDateHeaderTemplate: any;
51
54
  protected currentTimeTimeout: any;
55
+ protected ongoingEventsTimeout: any;
52
56
  protected currentDate: ZonedDate;
53
57
  protected verticalTime: boolean;
54
58
  protected initialUpdate: boolean;
@@ -57,12 +61,14 @@ export declare abstract class DayTimeViewComponent extends BaseView implements O
57
61
  ngOnDestroy(): void;
58
62
  verticalItem(leafIndex: number, resourceIndex: number): any;
59
63
  timeSlotClass(slot: any, date: any, resourceIndex: any): string;
64
+ protected toggleOngoingClass(): void;
60
65
  protected scrollToTime(time?: string | Date): void;
61
66
  protected optionsChange(options: any): void;
62
67
  protected updateView(): void;
63
68
  protected enableCurrentTime(): boolean;
64
69
  protected currentTime(): Date;
65
70
  protected updateCurrentTime(): void;
71
+ protected updateOngoingEvents(): void;
66
72
  protected abstract currentTimeArrowOffset(): number;
67
73
  protected positionCurrentTime(): void;
68
74
  protected bindEvents(): void;
@@ -10,9 +10,10 @@ import { fromEvent } from 'rxjs';
10
10
  import { toInvariantTime, dateInRange, setCoordinates, dateWithTime, toUTCTime, toUTCDateTime } from '../utils';
11
11
  import { createTimeSlots } from './utils';
12
12
  import { BaseView } from '../common/base-view';
13
- import { MIDNIGHT_INVARIANT, MS_PER_MINUTE } from '../constants';
14
- import { fromClick, fromDoubleClick, isNumber } from '../../common/util';
13
+ import { MIDNIGHT_INVARIANT, MS_PER_MINUTE, ONGOING_EVENT_CSS_CLASS } from '../constants';
14
+ import { fromClick, fromDoubleClick, isNumber, isPresent } from '../../common/util';
15
15
  import { rtlScrollPosition, hasClasses } from '../../common/dom-queries';
16
+ import { DayTimeViewItemComponent } from './day-time-view-item.component';
16
17
  const getStartDate = date => getDate(date);
17
18
  const ɵ0 = getStartDate;
18
19
  const getEndDate = (start, numberOfDays) => getDate(addDays(start, numberOfDays || 1));
@@ -46,6 +47,8 @@ export class DayTimeViewComponent extends BaseView {
46
47
  this.verticalTime = true;
47
48
  this.initialUpdate = true;
48
49
  this.updateCurrentTime = this.updateCurrentTime.bind(this);
50
+ this.toggleOngoingClass = this.toggleOngoingClass.bind(this);
51
+ this.updateOngoingEvents = this.updateOngoingEvents.bind(this);
49
52
  }
50
53
  get classNames() {
51
54
  return `k-scheduler-${this.name}view`;
@@ -74,6 +77,7 @@ export class DayTimeViewComponent extends BaseView {
74
77
  ngOnDestroy() {
75
78
  super.ngOnDestroy();
76
79
  clearTimeout(this.currentTimeTimeout);
80
+ clearTimeout(this.ongoingEventsTimeout);
77
81
  }
78
82
  verticalItem(leafIndex, resourceIndex) {
79
83
  const data = this.verticalResources[resourceIndex].data || [];
@@ -94,6 +98,14 @@ export class DayTimeViewComponent extends BaseView {
94
98
  });
95
99
  }
96
100
  }
101
+ toggleOngoingClass() {
102
+ const now = this.currentTime();
103
+ const cssClass = isPresent(this.highlightOngoingEvents.cssClass) ? this.highlightOngoingEvents.cssClass : ONGOING_EVENT_CSS_CLASS;
104
+ this.eventElements.forEach((event) => {
105
+ const isOngoing = dateInRange(now, event.item.start, event.item.end);
106
+ this.renderer[isOngoing ? 'addClass' : 'removeClass'](event.nativeElement, cssClass);
107
+ });
108
+ }
97
109
  scrollToTime(time = this.scrollTime) {
98
110
  let date;
99
111
  if (typeof time === 'string') {
@@ -121,6 +133,7 @@ export class DayTimeViewComponent extends BaseView {
121
133
  updateView() {
122
134
  super.updateView();
123
135
  this.updateCurrentTime();
136
+ this.updateOngoingEvents();
124
137
  if (this.initialUpdate) {
125
138
  this.scrollToTime();
126
139
  this.initialUpdate = false;
@@ -159,6 +172,17 @@ export class DayTimeViewComponent extends BaseView {
159
172
  this.positionCurrentTime();
160
173
  }
161
174
  }
175
+ updateOngoingEvents() {
176
+ const disabled = !this.highlightOngoingEvents || this.highlightOngoingEvents.enabled === false;
177
+ if (!isDocumentAvailable() || disabled) {
178
+ return;
179
+ }
180
+ clearTimeout(this.ongoingEventsTimeout);
181
+ this.zone.runOutsideAngular(() => {
182
+ this.ongoingEventsTimeout = setTimeout(this.updateOngoingEvents, this.highlightOngoingEvents.updateInterval || MS_PER_MINUTE);
183
+ });
184
+ this.toggleOngoingClass();
185
+ }
162
186
  positionCurrentTime() {
163
187
  if (this.currentTimeElements && this.currentTimeElements.length) {
164
188
  const date = this.currentDate.toUTCDate();
@@ -372,10 +396,18 @@ tslib_1.__decorate([
372
396
  Input(),
373
397
  tslib_1.__metadata("design:type", Object)
374
398
  ], DayTimeViewComponent.prototype, "currentTimeMarker", void 0);
399
+ tslib_1.__decorate([
400
+ Input(),
401
+ tslib_1.__metadata("design:type", Object)
402
+ ], DayTimeViewComponent.prototype, "highlightOngoingEvents", void 0);
375
403
  tslib_1.__decorate([
376
404
  ViewChildren('currentTimeMarker'),
377
405
  tslib_1.__metadata("design:type", QueryList)
378
406
  ], DayTimeViewComponent.prototype, "currentTimeElements", void 0);
407
+ tslib_1.__decorate([
408
+ ViewChildren(DayTimeViewItemComponent),
409
+ tslib_1.__metadata("design:type", QueryList)
410
+ ], DayTimeViewComponent.prototype, "eventElements", void 0);
379
411
  tslib_1.__decorate([
380
412
  ViewChildren('currentTimeArrow'),
381
413
  tslib_1.__metadata("design:type", QueryList)
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { OnChanges, NgZone, ElementRef, Renderer2, TemplateRef, ChangeDetectorRef } from '@angular/core';
5
+ import { OnChanges, NgZone, ElementRef, Renderer2, TemplateRef, ChangeDetectorRef, QueryList } from '@angular/core';
6
6
  import { IntlService } from '@progress/kendo-angular-intl';
7
7
  import { DateRange, NavigationAction, ViewItem } from '../../types';
8
8
  import { ViewContextService } from '../view-context.service';
@@ -11,17 +11,23 @@ import { MonthSlotService } from './month-slot.service';
11
11
  import { BaseView } from '../common/base-view';
12
12
  import { PDFService } from '../../pdf/pdf.service';
13
13
  import { LocalizationService } from '@progress/kendo-angular-l10n';
14
+ import { MonthViewItemComponent } from './month-view-item.component';
14
15
  /**
15
16
  * @hidden
16
17
  */
17
18
  export declare class MonthViewRendererComponent extends BaseView implements OnChanges {
18
19
  monthDaySlotTemplate: TemplateRef<any>;
20
+ highlightOngoingEvents: any;
19
21
  resizeHintFormat: any;
20
22
  weeks: any[];
23
+ eventElements: QueryList<MonthViewItemComponent>;
21
24
  readonly monthDaySlotTemplateRef: TemplateRef<any>;
25
+ protected ongoingEventsTimeout: any;
22
26
  private schedulerMonthDaySlotTemplate;
23
27
  constructor(viewContext: ViewContextService, viewState: ViewStateService, intl: IntlService, slotService: MonthSlotService, zone: NgZone, element: ElementRef, renderer: Renderer2, pdfService: PDFService, localization: LocalizationService, changeDetector: ChangeDetectorRef);
24
28
  ngOnChanges(changes: any): void;
29
+ ngAfterViewInit(): void;
30
+ ngOnDestroy(): void;
25
31
  horizontalColspan(resourceIndex: number): any;
26
32
  verticalRowspan(resourceIndex: number): any;
27
33
  verticalItem(leafIndex: number, resourceIndex: number): any;
@@ -40,5 +46,8 @@ export declare class MonthViewRendererComponent extends BaseView implements OnCh
40
46
  protected dragRanges(slot: any): any;
41
47
  protected dragHintSize(first: any, last: any): any;
42
48
  protected slotByPosition(x: number, y: number): any;
49
+ protected updateOngoingEvents(): void;
50
+ protected currentTime(): Date;
51
+ protected toggleOngoingClass(): void;
43
52
  private createDaySlots;
44
53
  }
@@ -3,21 +3,22 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
- import { Component, Input, NgZone, ElementRef, Renderer2, TemplateRef, ChangeDetectorRef } from '@angular/core';
6
+ import { Component, Input, NgZone, ElementRef, Renderer2, TemplateRef, ChangeDetectorRef, QueryList, ViewChildren } from '@angular/core';
7
7
  import { IntlService } from '@progress/kendo-angular-intl';
8
- import { isChanged } from '@progress/kendo-angular-common';
8
+ import { isChanged, isDocumentAvailable } from '@progress/kendo-angular-common';
9
9
  import { addDays, addMonths, firstDayInWeek, firstDayOfMonth, getDate, toLocalDate } from '@progress/kendo-date-math';
10
10
  import { ViewContextService } from '../view-context.service';
11
11
  import { ViewStateService } from '../view-state.service';
12
12
  import { closestInScope, hasClasses } from '../../common/dom-queries';
13
13
  import { MonthSlotService } from './month-slot.service';
14
14
  import { updateTaskData, createTasks } from './utils';
15
- import { toPx } from '../utils';
15
+ import { toPx, dateInRange } from '../utils';
16
16
  import { BaseView } from '../common/base-view';
17
17
  import { PDFService } from '../../pdf/pdf.service';
18
18
  import { LocalizationService } from '@progress/kendo-angular-l10n';
19
- const DAYS_IN_WEEK_COUNT = 7;
20
- const WEEKS_COUNT = 6;
19
+ import { MonthViewItemComponent } from './month-view-item.component';
20
+ import { isPresent } from '../../common/util';
21
+ import { DAYS_IN_WEEK_COUNT, WEEKS_COUNT, MS_PER_MINUTE, ONGOING_EVENT_CSS_CLASS } from '../constants';
21
22
  /**
22
23
  * @hidden
23
24
  */
@@ -26,6 +27,7 @@ let MonthViewRendererComponent = class MonthViewRendererComponent extends BaseVi
26
27
  super(viewContext, viewState, intl, slotService, zone, renderer, element, pdfService, localization, changeDetector);
27
28
  this.resizeHintFormat = { skeleton: 'Md' };
28
29
  this.weeks = [];
30
+ this.updateOngoingEvents = this.updateOngoingEvents.bind(this);
29
31
  }
30
32
  get monthDaySlotTemplateRef() {
31
33
  return this.monthDaySlotTemplate || (this.schedulerMonthDaySlotTemplate || {}).templateRef;
@@ -36,6 +38,14 @@ let MonthViewRendererComponent = class MonthViewRendererComponent extends BaseVi
36
38
  }
37
39
  super.ngOnChanges(changes);
38
40
  }
41
+ ngAfterViewInit() {
42
+ this.updateOngoingEvents();
43
+ super.ngAfterViewInit();
44
+ }
45
+ ngOnDestroy() {
46
+ clearTimeout(this.ongoingEventsTimeout);
47
+ super.ngOnDestroy();
48
+ }
39
49
  horizontalColspan(resourceIndex) {
40
50
  const resources = this.horizontalResources;
41
51
  let result = DAYS_IN_WEEK_COUNT;
@@ -163,6 +173,28 @@ let MonthViewRendererComponent = class MonthViewRendererComponent extends BaseVi
163
173
  slotByPosition(x, y) {
164
174
  return this.slotService.slotByPosition(x, y);
165
175
  }
176
+ updateOngoingEvents() {
177
+ const disabled = !this.highlightOngoingEvents || this.highlightOngoingEvents.enabled === false;
178
+ if (!isDocumentAvailable() || disabled) {
179
+ return;
180
+ }
181
+ clearTimeout(this.ongoingEventsTimeout);
182
+ this.zone.runOutsideAngular(() => {
183
+ this.ongoingEventsTimeout = setTimeout(this.updateOngoingEvents, this.highlightOngoingEvents.updateInterval || MS_PER_MINUTE);
184
+ });
185
+ this.toggleOngoingClass();
186
+ }
187
+ currentTime() {
188
+ return new Date();
189
+ }
190
+ toggleOngoingClass() {
191
+ const now = this.currentTime();
192
+ const cssClass = isPresent(this.highlightOngoingEvents.cssClass) ? this.highlightOngoingEvents.cssClass : ONGOING_EVENT_CSS_CLASS;
193
+ this.eventElements.forEach((event) => {
194
+ const isOngoing = dateInRange(now, event.item.start, event.item.end);
195
+ this.renderer[isOngoing ? 'addClass' : 'removeClass'](event.nativeElement, cssClass);
196
+ });
197
+ }
166
198
  createDaySlots({ start }) {
167
199
  const weeks = [];
168
200
  let date = start;
@@ -181,6 +213,14 @@ tslib_1.__decorate([
181
213
  Input(),
182
214
  tslib_1.__metadata("design:type", TemplateRef)
183
215
  ], MonthViewRendererComponent.prototype, "monthDaySlotTemplate", void 0);
216
+ tslib_1.__decorate([
217
+ Input(),
218
+ tslib_1.__metadata("design:type", Object)
219
+ ], MonthViewRendererComponent.prototype, "highlightOngoingEvents", void 0);
220
+ tslib_1.__decorate([
221
+ ViewChildren(MonthViewItemComponent),
222
+ tslib_1.__metadata("design:type", QueryList)
223
+ ], MonthViewRendererComponent.prototype, "eventElements", void 0);
184
224
  MonthViewRendererComponent = tslib_1.__decorate([
185
225
  Component({
186
226
  // tslint:disable-next-line:component-selector
@@ -85,6 +85,7 @@ MonthViewComponent = MonthViewComponent_1 = tslib_1.__decorate([
85
85
  [monthDaySlotTemplate]="monthDaySlotTemplate?.templateRef"
86
86
  [selectedDateFormat]="selectedDateFormat"
87
87
  [selectedShortDateFormat]="selectedShortDateFormat"
88
+ [highlightOngoingEvents]="viewHighlightOngoingEvents"
88
89
  [weekStart]="viewWeekStart">
89
90
  </month-view>
90
91
  </ng-template>
@@ -82,6 +82,7 @@ DayViewComponent = DayViewComponent_1 = tslib_1.__decorate([
82
82
  [name]="name"
83
83
  [eventHeight]="viewEventHeight"
84
84
  [currentTimeMarker]="viewCurrentTimeMarker"
85
+ [highlightOngoingEvents]="viewHighlightOngoingEvents"
85
86
  [showWorkHours]="shouldShowWorkHours"
86
87
  [scrollTime]="viewScrollTime"
87
88
  [startTime]="viewStartTime"
@@ -94,6 +94,7 @@ MultiDayViewComponent = MultiDayViewComponent_1 = tslib_1.__decorate([
94
94
  [numberOfDays]="numberOfDays"
95
95
  [eventHeight]="viewEventHeight"
96
96
  [currentTimeMarker]="viewCurrentTimeMarker"
97
+ [highlightOngoingEvents]="viewHighlightOngoingEvents"
97
98
  [showWorkHours]="shouldShowWorkHours"
98
99
  [scrollTime]="viewScrollTime"
99
100
  [startTime]="viewStartTime"
@@ -96,6 +96,7 @@ WeekViewComponent = WeekViewComponent_1 = tslib_1.__decorate([
96
96
  [getStartDate]="getStartDate"
97
97
  [eventHeight]="viewEventHeight"
98
98
  [currentTimeMarker]="viewCurrentTimeMarker"
99
+ [highlightOngoingEvents]="viewHighlightOngoingEvents"
99
100
  [showWorkHours]="shouldShowWorkHours"
100
101
  [scrollTime]="viewScrollTime"
101
102
  [startTime]="viewStartTime"
@@ -72,6 +72,7 @@ WorkWeekViewComponent = WorkWeekViewComponent_1 = tslib_1.__decorate([
72
72
  [getNextDate]="getNextDate"
73
73
  [eventHeight]="viewEventHeight"
74
74
  [currentTimeMarker]="viewCurrentTimeMarker"
75
+ [highlightOngoingEvents]="viewHighlightOngoingEvents"
75
76
  [showWorkHours]="shouldShowWorkHours"
76
77
  [scrollTime]="viewScrollTime"
77
78
  [startTime]="viewStartTime"
@@ -89,6 +89,7 @@ TimelineMonthViewComponent = TimelineMonthViewComponent_1 = tslib_1.__decorate([
89
89
  [eventHeight]="viewEventHeight"
90
90
  [columnWidth]="viewColumnWidth"
91
91
  [currentTimeMarker]="viewCurrentTimeMarker"
92
+ [highlightOngoingEvents]="viewHighlightOngoingEvents"
92
93
  [showWorkHours]="shouldShowWorkHours"
93
94
  [scrollTime]="viewScrollTime"
94
95
  [startTime]="viewStartTime"
@@ -66,6 +66,7 @@ TimelineViewComponent = TimelineViewComponent_1 = tslib_1.__decorate([
66
66
  [eventHeight]="viewEventHeight"
67
67
  [columnWidth]="viewColumnWidth"
68
68
  [currentTimeMarker]="viewCurrentTimeMarker"
69
+ [highlightOngoingEvents]="viewHighlightOngoingEvents"
69
70
  [showWorkHours]="shouldShowWorkHours"
70
71
  [scrollTime]="viewScrollTime"
71
72
  [startTime]="viewStartTime"
@@ -80,6 +80,7 @@ TimelineWeekViewComponent = TimelineWeekViewComponent_1 = tslib_1.__decorate([
80
80
  [eventHeight]="viewEventHeight"
81
81
  [columnWidth]="viewColumnWidth"
82
82
  [currentTimeMarker]="viewCurrentTimeMarker"
83
+ [highlightOngoingEvents]="viewHighlightOngoingEvents"
83
84
  [showWorkHours]="shouldShowWorkHours"
84
85
  [scrollTime]="viewScrollTime"
85
86
  [startTime]="viewStartTime"
@@ -145,7 +145,11 @@ export function eventResources(event, { taskResources, hasGroups, spans, allReso
145
145
  for (let valueIdx = 0; valueIdx < values.length; valueIdx++) {
146
146
  const dataIdx = getDataIdx(values[valueIdx], resource);
147
147
  if (dataIdx < 0) {
148
- return [{ leafIdx: hasGroups ? -1 : 0, resources: [] }];
148
+ if (hasGroups) {
149
+ // No match for this resource, but the event might still match other resources.
150
+ continue;
151
+ }
152
+ return [{ leafIdx: 0, resources: [] }];
149
153
  }
150
154
  const item = resource.data[dataIdx];
151
155
  // has groups - need all copies of the multiple resource