@progress/kendo-angular-scheduler 2.2.0-dev.202111260859 → 2.2.0-dev.202112171600

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 (79) 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/events/slot-drag-end-event.js +17 -0
  4. package/dist/es/events/slot-drag-event.js +18 -0
  5. package/dist/es/events/slot-drag-start-event.js +24 -0
  6. package/dist/es/events.js +3 -0
  7. package/dist/es/index.js +1 -0
  8. package/dist/es/package-metadata.js +1 -1
  9. package/dist/es/scheduler.component.js +73 -1
  10. package/dist/es/scheduler.module.js +2 -0
  11. package/dist/es/types/slot-selection.js +23 -0
  12. package/dist/es/types.js +1 -0
  13. package/dist/es/views/common/base-view.js +102 -8
  14. package/dist/es/views/common/slot-selectable.directive.js +117 -0
  15. package/dist/es/views/day-time/day-time-view.component.js +1 -1
  16. package/dist/es/views/day-time/day-time.module.js +2 -1
  17. package/dist/es/views/month/month-view-renderer.component.js +9 -5
  18. package/dist/es/views/multi-day/multi-day-view-renderer.component.js +3 -3
  19. package/dist/es/views/timeline/timeline-multi-day-view.component.js +1 -1
  20. package/dist/es/views/utils.js +49 -0
  21. package/dist/es/views/view-state.service.js +18 -0
  22. package/dist/es2015/events/slot-drag-end-event.d.ts +10 -0
  23. package/dist/es2015/events/slot-drag-end-event.js +10 -0
  24. package/dist/es2015/events/slot-drag-event.d.ts +39 -0
  25. package/dist/es2015/events/slot-drag-event.js +16 -0
  26. package/dist/es2015/events/slot-drag-start-event.d.ts +41 -0
  27. package/dist/es2015/events/slot-drag-start-event.js +19 -0
  28. package/dist/es2015/events.d.ts +3 -0
  29. package/dist/es2015/events.js +3 -0
  30. package/dist/es2015/index.d.ts +2 -0
  31. package/dist/es2015/index.js +1 -0
  32. package/dist/es2015/index.metadata.json +1 -1
  33. package/dist/es2015/package-metadata.js +1 -1
  34. package/dist/es2015/scheduler.component.d.ts +27 -0
  35. package/dist/es2015/scheduler.component.js +73 -1
  36. package/dist/es2015/scheduler.module.js +2 -0
  37. package/dist/es2015/types/datepicker-options.interface.d.ts +5 -5
  38. package/dist/es2015/types/slot-selection.d.ts +71 -0
  39. package/dist/es2015/types/slot-selection.js +19 -0
  40. package/dist/es2015/types.d.ts +2 -0
  41. package/dist/es2015/types.js +1 -0
  42. package/dist/es2015/views/common/base-view.d.ts +26 -5
  43. package/dist/es2015/views/common/base-view.js +102 -8
  44. package/dist/es2015/views/common/slot-selectable.directive.d.ts +45 -0
  45. package/dist/es2015/views/common/slot-selectable.directive.js +112 -0
  46. package/dist/es2015/views/day-time/day-time-view.component.js +1 -1
  47. package/dist/es2015/views/day-time/day-time.module.js +2 -1
  48. package/dist/es2015/views/month/month-view-renderer.component.d.ts +3 -2
  49. package/dist/es2015/views/month/month-view-renderer.component.js +17 -7
  50. package/dist/es2015/views/multi-day/multi-day-view-renderer.component.d.ts +1 -1
  51. package/dist/es2015/views/multi-day/multi-day-view-renderer.component.js +22 -4
  52. package/dist/es2015/views/timeline/timeline-multi-day-view.component.js +8 -1
  53. package/dist/es2015/views/utils.d.ts +29 -0
  54. package/dist/es2015/views/utils.js +49 -0
  55. package/dist/es2015/views/view-state.service.d.ts +24 -1
  56. package/dist/es2015/views/view-state.service.js +18 -0
  57. package/dist/fesm2015/index.js +1636 -1221
  58. package/dist/fesm5/index.js +1785 -1384
  59. package/dist/npm/events/slot-drag-end-event.js +19 -0
  60. package/dist/npm/events/slot-drag-event.js +20 -0
  61. package/dist/npm/events/slot-drag-start-event.js +26 -0
  62. package/dist/npm/events.js +6 -0
  63. package/dist/npm/index.js +2 -0
  64. package/dist/npm/package-metadata.js +1 -1
  65. package/dist/npm/scheduler.component.js +73 -1
  66. package/dist/npm/scheduler.module.js +2 -0
  67. package/dist/npm/types/slot-selection.js +25 -0
  68. package/dist/npm/types.js +2 -0
  69. package/dist/npm/views/common/base-view.js +101 -7
  70. package/dist/npm/views/common/slot-selectable.directive.js +119 -0
  71. package/dist/npm/views/day-time/day-time-view.component.js +1 -1
  72. package/dist/npm/views/day-time/day-time.module.js +2 -1
  73. package/dist/npm/views/month/month-view-renderer.component.js +8 -4
  74. package/dist/npm/views/multi-day/multi-day-view-renderer.component.js +3 -3
  75. package/dist/npm/views/timeline/timeline-multi-day-view.component.js +1 -1
  76. package/dist/npm/views/utils.js +53 -0
  77. package/dist/npm/views/view-state.service.js +18 -0
  78. package/dist/systemjs/kendo-angular-scheduler.js +1 -1
  79. package/package.json +9 -7
@@ -0,0 +1,19 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var slot_drag_event_1 = require("./slot-drag-event");
9
+ /**
10
+ * Arguments for the `slotDragEnd` event.
11
+ */
12
+ var SlotDragEndEvent = /** @class */ (function (_super) {
13
+ tslib_1.__extends(SlotDragEndEvent, _super);
14
+ function SlotDragEndEvent() {
15
+ return _super !== null && _super.apply(this, arguments) || this;
16
+ }
17
+ return SlotDragEndEvent;
18
+ }(slot_drag_event_1.SlotDragEvent));
19
+ exports.SlotDragEndEvent = SlotDragEndEvent;
@@ -0,0 +1,20 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ /**
8
+ * Arguments for the `slotDrag` event.
9
+ */
10
+ var SlotDragEvent = /** @class */ (function () {
11
+ /**
12
+ * @hidden
13
+ */
14
+ function SlotDragEvent(sender, args) {
15
+ this.sender = sender;
16
+ Object.assign(this, args);
17
+ }
18
+ return SlotDragEvent;
19
+ }());
20
+ exports.SlotDragEvent = SlotDragEvent;
@@ -0,0 +1,26 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var preventable_event_1 = require("./preventable-event");
9
+ /**
10
+ * Arguments for the `slotDragStart` event.
11
+ * The event is preventable and if prevented, subsequent `slotDrag`, `slotDragEnd`, and `slotSelectionChange` will not be fired.
12
+ */
13
+ var SlotDragStartEvent = /** @class */ (function (_super) {
14
+ tslib_1.__extends(SlotDragStartEvent, _super);
15
+ /**
16
+ * @hidden
17
+ */
18
+ function SlotDragStartEvent(sender, args) {
19
+ var _this = _super.call(this) || this;
20
+ _this.sender = sender;
21
+ Object.assign(_this, args);
22
+ return _this;
23
+ }
24
+ return SlotDragStartEvent;
25
+ }(preventable_event_1.PreventableEvent));
26
+ exports.SlotDragStartEvent = SlotDragStartEvent;
@@ -40,3 +40,9 @@ var edit_event_1 = require("./events/edit-event");
40
40
  exports.EditEvent = edit_event_1.EditEvent;
41
41
  var add_event_1 = require("./events/add-event");
42
42
  exports.AddEvent = add_event_1.AddEvent;
43
+ var slot_drag_start_event_1 = require("./events/slot-drag-start-event");
44
+ exports.SlotDragStartEvent = slot_drag_start_event_1.SlotDragStartEvent;
45
+ var slot_drag_event_1 = require("./events/slot-drag-event");
46
+ exports.SlotDragEvent = slot_drag_event_1.SlotDragEvent;
47
+ var slot_drag_end_event_1 = require("./events/slot-drag-end-event");
48
+ exports.SlotDragEndEvent = slot_drag_end_event_1.SlotDragEndEvent;
package/dist/npm/index.js CHANGED
@@ -120,6 +120,8 @@ var resize_hint_component_1 = require("./views/common/resize-hint.component");
120
120
  exports.ResizeHintComponent = resize_hint_component_1.ResizeHintComponent
121
121
  var resource_iterator_pipe_1 = require("./views/common/resource-iterator.pipe");
122
122
  exports.ResourceIteratorPipe = resource_iterator_pipe_1.ResourceIteratorPipe
123
+ var slot_selectable_directive_1 = require("./views/common/slot-selectable.directive");
124
+ exports.SlotSelectableDirective = slot_selectable_directive_1.SlotSelectableDirective
123
125
  var view_footer_component_1 = require("./views/common/view-footer.component");
124
126
  exports.ViewFooterComponent = view_footer_component_1.ViewFooterComponent
125
127
  var views_shared_module_1 = require("./views/common/views-shared.module");
@@ -11,7 +11,7 @@ exports.packageMetadata = {
11
11
  name: '@progress/kendo-angular-scheduler',
12
12
  productName: 'Kendo UI for Angular',
13
13
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
14
- publishDate: 1637916885,
14
+ publishDate: 1639756470,
15
15
  version: '',
16
16
  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'
17
17
  };
@@ -44,6 +44,9 @@ var loading_component_1 = require("./loading.component");
44
44
  var navigation_1 = require("./navigation");
45
45
  var dom_events_service_1 = require("./views/common/dom-events.service");
46
46
  var dom_queries_1 = require("./common/dom-queries");
47
+ var utils_1 = require("./views/utils");
48
+ var slot_drag_event_1 = require("./events/slot-drag-event");
49
+ var slot_drag_end_event_1 = require("./events/slot-drag-end-event");
47
50
  var todayDate = function () { return kendo_date_math_1.getDate(new Date()); };
48
51
  var ɵ0 = todayDate;
49
52
  exports.ɵ0 = ɵ0;
@@ -88,6 +91,12 @@ var SchedulerComponent = /** @class */ (function () {
88
91
  * Specifies if the Scheduler is editable.
89
92
  */
90
93
  this.editable = false;
94
+ /**
95
+ * Specifies if the Scheduler's day or time slots are selectable ([see example]({% slug slotselection_scheduler %}#toc-custom-callback)).
96
+ *
97
+ * When this input is set to `true`, the Scheduler component will emit [`slotDragStart`]({% slug api_scheduler_schedulercomponent %}#toc-slotdragstart), [`slotDrag`]({% slug api_scheduler_schedulercomponent %}#toc-slotdrag), and [`slotDragEnd`]({% slug api_scheduler_schedulercomponent %}#toc-slotdragend) events upon user interaction.
98
+ */
99
+ this.selectable = false;
91
100
  /**
92
101
  * The height of the events in the **Month** and **Timeline** views, and the height of the **All day** events in the **Day** and **Week** views.
93
102
  */
@@ -139,6 +148,11 @@ var SchedulerComponent = /** @class */ (function () {
139
148
  * Specifies the Scheduler current time marker settings.
140
149
  */
141
150
  this.currentTimeMarker = true;
151
+ /**
152
+ * A callback that executes for each slot of the Scheduler view.
153
+ * If it returns `true`, the `k-state-selected` CSS class will be added to the cell, making it visibly selected.
154
+ */
155
+ this.isSlotSelected = utils_1.alwaysFalse;
142
156
  /**
143
157
  * @hidden
144
158
  */
@@ -213,6 +227,18 @@ var SchedulerComponent = /** @class */ (function () {
213
227
  * Fires when the user stops dragging a Scheduler event.
214
228
  */
215
229
  this.dragEnd = new core_1.EventEmitter();
230
+ /**
231
+ * Fires when the user starts drag-selecting a Scheduler slot range.
232
+ */
233
+ this.slotDragStart = new core_1.EventEmitter();
234
+ /**
235
+ * Fires when the user is drag-selecting a Scheduler slot range.
236
+ */
237
+ this.slotDrag = new core_1.EventEmitter();
238
+ /**
239
+ * Fires when the user stops drag-selecting a Scheduler slot range.
240
+ */
241
+ this.slotDragEnd = new core_1.EventEmitter();
216
242
  /**
217
243
  * Fires when the user clicks the **PDF export** command button.
218
244
  */
@@ -403,6 +429,30 @@ var SchedulerComponent = /** @class */ (function () {
403
429
  _this.resizeSensor.acceptSize();
404
430
  }
405
431
  }));
432
+ this.subs.add(this.viewState.slotSelectionStart
433
+ .subscribe(function (e) {
434
+ if (kendo_angular_common_2.hasObservers(_this.slotDragStart)) {
435
+ _this.zone.run(function () {
436
+ _this.slotDragStart.emit(Object.assign(e, { sender: _this }));
437
+ });
438
+ }
439
+ }));
440
+ this.subs.add(this.viewState.slotSelectionDrag
441
+ .subscribe(function (value) {
442
+ if (kendo_angular_common_2.hasObservers(_this.slotDrag)) {
443
+ _this.zone.run(function () {
444
+ _this.slotDrag.emit(new slot_drag_event_1.SlotDragEvent(_this, value));
445
+ });
446
+ }
447
+ }));
448
+ this.subs.add(this.viewState.slotSelectionEnd
449
+ .subscribe(function (value) {
450
+ if (kendo_angular_common_2.hasObservers(_this.slotDragEnd)) {
451
+ _this.zone.run(function () {
452
+ _this.slotDragEnd.emit(new slot_drag_end_event_1.SlotDragEndEvent(_this, value));
453
+ });
454
+ }
455
+ }));
406
456
  this.onViewIndexChange();
407
457
  this.notifyOptionsChange = this.notifyOptionsChange.bind(this);
408
458
  this.subs.add(this.allDayEventTemplate.changes.subscribe(this.notifyOptionsChange));
@@ -454,7 +504,7 @@ var SchedulerComponent = /** @class */ (function () {
454
504
  if (kendo_angular_common_2.anyChanged([
455
505
  'group', 'resources', 'min', 'max', 'showWorkHours', 'startTime', 'scrollTime', 'endTime', 'eventHeight',
456
506
  'workDayStart', 'workDayEnd', 'workWeekStart', 'workWeekEnd', 'weekStart', 'slotDuration', 'slotDivisions',
457
- 'editable', 'timezone', 'slotClass', 'slotFill', 'columnWidth', 'eventClass', 'eventStyles'
507
+ 'editable', 'timezone', 'slotClass', 'slotFill', 'columnWidth', 'eventClass', 'eventStyles', 'isSlotSelected', 'selectable'
458
508
  ], changes)) {
459
509
  this.notifyOptionsChange(changes);
460
510
  }
@@ -707,6 +757,7 @@ var SchedulerComponent = /** @class */ (function () {
707
757
  slotDivisions: this.slotDivisions,
708
758
  eventHeight: this.eventHeight,
709
759
  editable: this.editable,
760
+ selectable: this.selectable,
710
761
  timezone: this.timezone,
711
762
  currentTimeMarker: this.currentTimeMarker,
712
763
  slotClass: this.slotClass,
@@ -714,6 +765,7 @@ var SchedulerComponent = /** @class */ (function () {
714
765
  columnWidth: this.columnWidth,
715
766
  eventClass: this.eventClass,
716
767
  eventStyles: this.eventStyles,
768
+ isSlotSelected: this.isSlotSelected,
717
769
  changes: changes
718
770
  });
719
771
  };
@@ -867,6 +919,10 @@ var SchedulerComponent = /** @class */ (function () {
867
919
  core_1.Input(),
868
920
  tslib_1.__metadata("design:type", Object)
869
921
  ], SchedulerComponent.prototype, "editable", void 0);
922
+ tslib_1.__decorate([
923
+ core_1.Input(),
924
+ tslib_1.__metadata("design:type", Boolean)
925
+ ], SchedulerComponent.prototype, "selectable", void 0);
870
926
  tslib_1.__decorate([
871
927
  core_1.Input(),
872
928
  tslib_1.__metadata("design:type", Date)
@@ -980,6 +1036,10 @@ var SchedulerComponent = /** @class */ (function () {
980
1036
  core_1.Input(),
981
1037
  tslib_1.__metadata("design:type", Function)
982
1038
  ], SchedulerComponent.prototype, "eventStyles", void 0);
1039
+ tslib_1.__decorate([
1040
+ core_1.Input(),
1041
+ tslib_1.__metadata("design:type", Function)
1042
+ ], SchedulerComponent.prototype, "isSlotSelected", void 0);
983
1043
  tslib_1.__decorate([
984
1044
  core_1.Output(),
985
1045
  tslib_1.__metadata("design:type", core_1.EventEmitter)
@@ -1052,6 +1112,18 @@ var SchedulerComponent = /** @class */ (function () {
1052
1112
  core_1.Output(),
1053
1113
  tslib_1.__metadata("design:type", core_1.EventEmitter)
1054
1114
  ], SchedulerComponent.prototype, "dragEnd", void 0);
1115
+ tslib_1.__decorate([
1116
+ core_1.Output(),
1117
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
1118
+ ], SchedulerComponent.prototype, "slotDragStart", void 0);
1119
+ tslib_1.__decorate([
1120
+ core_1.Output(),
1121
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
1122
+ ], SchedulerComponent.prototype, "slotDrag", void 0);
1123
+ tslib_1.__decorate([
1124
+ core_1.Output(),
1125
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
1126
+ ], SchedulerComponent.prototype, "slotDragEnd", void 0);
1055
1127
  tslib_1.__decorate([
1056
1128
  core_1.Output(),
1057
1129
  tslib_1.__metadata("design:type", core_1.EventEmitter)
@@ -57,6 +57,7 @@ var edit_dialog_template_directive_1 = require("./editing/edit-dialog-template.d
57
57
  var loading_component_1 = require("./loading.component");
58
58
  var shared_module_1 = require("./shared.module");
59
59
  var shortcuts_directive_1 = require("./navigation/shortcuts.directive");
60
+ var slot_selectable_directive_1 = require("./views/common/slot-selectable.directive");
60
61
  var TEMPLATES = [
61
62
  agenda_date_template_directive_1.AgendaDateTemplateDirective,
62
63
  agenda_time_template_directive_1.AgendaTimeTemplateDirective,
@@ -77,6 +78,7 @@ var declarations = [
77
78
  data_binding_directive_1.DataBindingDirective,
78
79
  shortcuts_directive_1.ShortcutsDirective,
79
80
  reactive_editing_directive_1.ReactiveEditingDirective,
81
+ slot_selectable_directive_1.SlotSelectableDirective,
80
82
  date_time_picker_component_1.SchedulerDateTimePickerComponent,
81
83
  recurrence_editor_component_1.RecurrenceEditorComponent,
82
84
  recurrence_end_rule_editor_component_1.RecurrenceEndRuleEditorComponent,
@@ -0,0 +1,25 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ /**
8
+ * The arguments for the [`isSlotSelected`]({% slug api_scheduler_schedulercomponent %}#toc-isslotselected) callback.
9
+ */
10
+ var IsSlotSelectedArgs = /** @class */ (function () {
11
+ function IsSlotSelectedArgs() {
12
+ }
13
+ return IsSlotSelectedArgs;
14
+ }());
15
+ exports.IsSlotSelectedArgs = IsSlotSelectedArgs;
16
+ /**
17
+ * @hidden
18
+ */
19
+ var slotDragEventName;
20
+ (function (slotDragEventName) {
21
+ slotDragEventName["initDragSelect"] = "initDragSelect";
22
+ slotDragEventName["dragSelect"] = "dragSelect";
23
+ slotDragEventName["refreshSlotSelection"] = "refreshSlotSelection";
24
+ slotDragEventName["dragSelectRelease"] = "dragSelectRelease";
25
+ })(slotDragEventName = exports.slotDragEventName || (exports.slotDragEventName = {}));
package/dist/npm/types.js CHANGED
@@ -10,3 +10,5 @@ var edit_mode_enum_1 = require("./types/edit-mode.enum");
10
10
  exports.EditMode = edit_mode_enum_1.EditMode;
11
11
  var crud_operation_enum_1 = require("./types/crud-operation.enum");
12
12
  exports.CrudOperation = crud_operation_enum_1.CrudOperation;
13
+ var slot_selection_1 = require("./types/slot-selection");
14
+ exports.IsSlotSelectedArgs = slot_selection_1.IsSlotSelectedArgs;
@@ -16,13 +16,15 @@ var utils_1 = require("../utils");
16
16
  var constants_1 = require("../constants");
17
17
  var kendo_draggable_1 = require("@telerik/kendo-draggable");
18
18
  var hint_container_component_1 = require("../common/hint-container.component");
19
+ var slot_selection_1 = require("../../types/slot-selection");
20
+ var slot_drag_start_event_1 = require("../../events/slot-drag-start-event");
19
21
  var SCROLL_CHANGE = 15;
20
22
  var MIN_DISTANCE = 60;
21
23
  var SCROLL_INTERVAL = 50;
22
24
  var MIN_MOVE_DISTANCE = 10;
23
25
  /** @hidden */
24
26
  var BaseView = /** @class */ (function () {
25
- function BaseView(viewContext, viewState, intl, slotService, zone, renderer, element, pdfService, localization) {
27
+ function BaseView(viewContext, viewState, intl, slotService, zone, renderer, element, pdfService, localization, cdr) {
26
28
  this.viewContext = viewContext;
27
29
  this.viewState = viewState;
28
30
  this.intl = intl;
@@ -32,6 +34,7 @@ var BaseView = /** @class */ (function () {
32
34
  this.element = element;
33
35
  this.pdfService = pdfService;
34
36
  this.localization = localization;
37
+ this.cdr = cdr;
35
38
  this.items = new rxjs_1.BehaviorSubject(null);
36
39
  this.horizontalResources = [];
37
40
  this.verticalResources = [];
@@ -45,8 +48,17 @@ var BaseView = /** @class */ (function () {
45
48
  this.spans = [];
46
49
  this.domEvents = [];
47
50
  this.resourcesCache = {};
51
+ /**
52
+ * The slot which is currently being dragged over while selecting a range of slots.
53
+ */
54
+ this.dragSelecting = null;
55
+ /**
56
+ * The slot where the drag-selecting originated. Used for flipping the start and end of the emitted range.
57
+ */
58
+ this.dragSelectOrigin = null;
48
59
  this.autoHeight = false;
49
60
  this.rtl = false;
61
+ this.isSlotSelected = function () { return false; };
50
62
  this.setSlotClass = this.setSlotClass.bind(this);
51
63
  this.setHintClass = this.setHintClass.bind(this);
52
64
  this.weekStart = intl.firstDay();
@@ -177,6 +189,20 @@ var BaseView = /** @class */ (function () {
177
189
  }
178
190
  return result;
179
191
  };
192
+ // Similar to https://tc39.es/proposal-temporal/docs/plaindate.html
193
+ // Stores a "plain date" in the UTC parts of a regular `Date`.
194
+ BaseView.prototype.toPlainDate = function (date) {
195
+ var result = utils_1.toUTCDateTime(this.convertDate(date));
196
+ return result;
197
+ };
198
+ // Similar to https://tc39.es/proposal-temporal/docs/plaindatetime.html
199
+ // Stores a "plain date-time" in the UTC parts of a regular `Date`.
200
+ BaseView.prototype.toPlainDateTime = function (date, time) {
201
+ if (!date || !time) {
202
+ return null;
203
+ }
204
+ return this.toPlainDate(utils_1.dateWithTime(date, time));
205
+ };
180
206
  BaseView.prototype.optionsChange = function (options) {
181
207
  this.schedulerEventTemplate = options.eventTemplate;
182
208
  this.schedulerGroupHeaderTemplate = options.groupHeaderTemplate;
@@ -184,6 +210,8 @@ var BaseView = /** @class */ (function () {
184
210
  this.max = options.max;
185
211
  this.editable = options.editable;
186
212
  this.timezone = options.timezone;
213
+ this.selectable = options.selectable;
214
+ this.isSlotSelected = options.isSlotSelected;
187
215
  if (!options.changes || kendo_angular_common_1.anyChanged(['group', 'resources'], options.changes, false) ||
188
216
  options.group !== this.group || options.resources !== this.resources) {
189
217
  this.group = options.group;
@@ -210,6 +238,7 @@ var BaseView = /** @class */ (function () {
210
238
  this.toggleElement(true);
211
239
  this.reflow();
212
240
  this.viewState.notifyLayoutEnd();
241
+ this.viewState.emitEvent(slot_selection_1.slotDragEventName.refreshSlotSelection);
213
242
  };
214
243
  BaseView.prototype.assignResources = function () {
215
244
  utils_1.assignTasksResources(this.tasks, {
@@ -251,16 +280,16 @@ var BaseView = /** @class */ (function () {
251
280
  });
252
281
  };
253
282
  BaseView.prototype.onPress = function (args) {
254
- var resizable = this.editable && this.editable.resize !== false;
255
- var draggable = this.editable && this.editable.drag !== false;
283
+ var editResizable = this.editable && this.editable.resize !== false;
284
+ var editDraggable = this.editable && this.editable.drag !== false;
256
285
  var target = args.originalEvent.target;
257
286
  if (dom_queries_1.hasClasses(target, 'k-resize-handle')) {
258
- if (!resizable) {
287
+ if (!editResizable) {
259
288
  return;
260
289
  }
261
290
  this.initResize(args);
262
291
  }
263
- else if (draggable) {
292
+ else if (editDraggable) {
264
293
  var task = this.targetTask(target);
265
294
  if (task) {
266
295
  if (!args.isTouch) {
@@ -270,6 +299,9 @@ var BaseView = /** @class */ (function () {
270
299
  this.pressTarget = task;
271
300
  }
272
301
  }
302
+ if (this.selectable) {
303
+ this.initDragSelect(args);
304
+ }
273
305
  this.dragArgs = args;
274
306
  };
275
307
  BaseView.prototype.onDrag = function (args) {
@@ -284,12 +316,15 @@ var BaseView = /** @class */ (function () {
284
316
  args.originalEvent.preventDefault();
285
317
  this.scrollContainer(this.drag, args);
286
318
  }
319
+ if (this.dragSelecting) {
320
+ this.dragSelect(args);
321
+ }
287
322
  }
288
323
  this.dragArgs = args;
289
324
  };
290
- BaseView.prototype.onRelease = function () {
325
+ BaseView.prototype.onRelease = function (args) {
291
326
  clearInterval(this.scrollInterval);
292
- var _a = this, resizing = _a.resizing, dragging = _a.dragging;
327
+ var _a = this, resizing = _a.resizing, dragging = _a.dragging, dragSelecting = _a.dragSelecting;
293
328
  if (resizing) {
294
329
  this.emitEvent('resizeEnd', {
295
330
  event: resizing.task.event,
@@ -316,6 +351,20 @@ var BaseView = /** @class */ (function () {
316
351
  this.resizing = null;
317
352
  this.dragging = null;
318
353
  }
354
+ if (dragSelecting) {
355
+ var _b = utils_1.normaliseRangeStartAndEnd(this.dragSelectOrigin, this.dragSelecting), start = _b.start, end = _b.end;
356
+ var range = {
357
+ start: this.convertDate(start),
358
+ end: this.convertDate(end),
359
+ isAllDay: this.dragSelecting.isDaySlot,
360
+ resources: this.resourcesByIndex(this.dragSelecting.id.resourceIndex),
361
+ originalEvent: args.originalEvent
362
+ };
363
+ this.viewState.notifySlotSelectionEnd(range);
364
+ this.dragSelectOrigin = null;
365
+ this.dragSelecting = null;
366
+ this.cdr.markForCheck();
367
+ }
319
368
  this.container = null;
320
369
  this.dragArgs = null;
321
370
  this.pressLocation = null;
@@ -467,6 +516,51 @@ var BaseView = /** @class */ (function () {
467
516
  this.updateHintContainer();
468
517
  }
469
518
  };
519
+ BaseView.prototype.initDragSelect = function (args) {
520
+ this.updateDragContainer(args);
521
+ if (!this.containerOffset) {
522
+ return;
523
+ }
524
+ var _a = this.coordinatesOffset(args.pageX, args.pageY), x = _a.x, y = _a.y;
525
+ var slot = this.slotByPosition(x, y, this.container);
526
+ if (!slot) {
527
+ return;
528
+ }
529
+ var range = {
530
+ start: this.convertDate(slot.start),
531
+ end: this.convertDate(slot.end),
532
+ isAllDay: slot.isDaySlot,
533
+ resources: this.resourcesByIndex(slot.id.resourceIndex),
534
+ originalEvent: args.originalEvent
535
+ };
536
+ var slotDragStartEvent = new slot_drag_start_event_1.SlotDragStartEvent(null, range);
537
+ this.viewState.notifySlotSelectionStart(slotDragStartEvent);
538
+ if (!slotDragStartEvent.isDefaultPrevented()) {
539
+ this.dragSelecting = slot;
540
+ this.dragSelectOrigin = slot;
541
+ this.cdr.markForCheck();
542
+ }
543
+ };
544
+ BaseView.prototype.dragSelect = function (args) {
545
+ var _a = this.coordinatesOffset(args.pageX, args.pageY), x = _a.x, y = _a.y;
546
+ var slot = this.slotByPosition(x, y, this.container);
547
+ if (!slot) {
548
+ return;
549
+ }
550
+ if (this.dragSelecting !== slot) {
551
+ this.dragSelecting = slot;
552
+ var _b = utils_1.normaliseRangeStartAndEnd(this.dragSelectOrigin, this.dragSelecting), start = _b.start, end = _b.end;
553
+ var range = {
554
+ start: this.convertDate(start),
555
+ end: this.convertDate(end),
556
+ isAllDay: slot.isDaySlot,
557
+ resources: this.resourcesByIndex(slot.id.resourceIndex),
558
+ originalEvent: args.originalEvent
559
+ };
560
+ this.viewState.notifySlotSelectionDrag(range);
561
+ this.cdr.markForCheck();
562
+ }
563
+ };
470
564
  BaseView.prototype.dragHintClasses = function () {
471
565
  var hintClass = this.dragging.hintClass;
472
566
  var result = [];
@@ -0,0 +1,119 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var rxjs_1 = require("rxjs");
10
+ var utils_1 = require("../utils");
11
+ var scheduler_component_1 = require("../../scheduler.component");
12
+ var operators_1 = require("rxjs/operators");
13
+ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
14
+ /**
15
+ * A directive which manages the in-memory selection state of the Scheduler slots
16
+ * ([see example]({% slug slotselection_scheduler %}#toc-built-in-directive)).
17
+ */
18
+ var SlotSelectableDirective = /** @class */ (function () {
19
+ function SlotSelectableDirective(scheduler, cdr) {
20
+ var _this = this;
21
+ this.scheduler = scheduler;
22
+ this.cdr = cdr;
23
+ /**
24
+ * Fires when the currently selected slot range has changed through user interaction.
25
+ */
26
+ this.slotSelectionChange = new core_1.EventEmitter();
27
+ this.selectedRange = null;
28
+ this.slotSelectionChangeSource = new core_1.EventEmitter();
29
+ this.subscriptions = new rxjs_1.Subscription();
30
+ this.scheduler.selectable = true;
31
+ this.subscriptions.add(this.slotSelectionChangeSource
32
+ .pipe(operators_1.distinctUntilChanged(utils_1.isSameRange)).subscribe(function (v) {
33
+ _this.slotSelectionChange.emit(v);
34
+ }));
35
+ var start$ = this.scheduler.slotDragStart;
36
+ var drag$ = this.scheduler.slotDrag;
37
+ var end$ = this.scheduler.slotDragEnd;
38
+ var startSource = start$.pipe(operators_1.filter(function (e) { return !e.isDefaultPrevented(); }));
39
+ this.subscriptions.add(startSource.subscribe(function (e) { return _this.initDragSelect(e); }));
40
+ this.subscriptions.add(drag$.subscribe(function (e) { return _this.onDrag(e); }));
41
+ this.subscriptions.add(end$.subscribe(function () { return _this.onRelease(); }));
42
+ }
43
+ SlotSelectableDirective.prototype.ngOnInit = function () {
44
+ this.scheduler.isSlotSelected = this.isSlotSelected.bind(this);
45
+ };
46
+ SlotSelectableDirective.prototype.ngOnChanges = function (changes) {
47
+ if (kendo_angular_common_1.isChanged("slotSelection", changes, false)) {
48
+ /**
49
+ * The default values for resources below are necessarry because this is not fixed yet: https://github.com/telerik/kendo-angular-scheduler/pull/338
50
+ */
51
+ var resources = this.scheduler.resources ? [this.scheduler.resources[0].data[0]] : [undefined];
52
+ this.selectedRange = Object.assign({}, { isAllDay: false, resources: resources }, changes.slotSelection.currentValue);
53
+ this.cdr.markForCheck();
54
+ }
55
+ };
56
+ SlotSelectableDirective.prototype.ngOnDestroy = function () {
57
+ this.subscriptions.unsubscribe();
58
+ };
59
+ SlotSelectableDirective.prototype.isSlotSelected = function (_a) {
60
+ var start = _a.start, end = _a.end, isAllDay = _a.isAllDay, resources = _a.resources;
61
+ if (!start || !end || !this.selectedRange) {
62
+ return false;
63
+ }
64
+ var match = utils_1.resourcesMatch(this.selectedRange.resources, resources, true);
65
+ if (!match) {
66
+ return false; // Limit selection to the grouped resource where the drag started.
67
+ }
68
+ return this.selectedRange && isAllDay === this.selectedRange.isAllDay && this.isInRange(start, end);
69
+ };
70
+ SlotSelectableDirective.prototype.initDragSelect = function (_a) {
71
+ var start = _a.start, end = _a.end, isAllDay = _a.isAllDay, resources = _a.resources, originalEvent = _a.originalEvent;
72
+ this.selectionOriginResources = resources.slice();
73
+ this.selectedRange = { start: start, end: end, isAllDay: isAllDay, resources: resources.slice(), originalEvent: originalEvent };
74
+ this.cdr.markForCheck();
75
+ };
76
+ SlotSelectableDirective.prototype.onDrag = function (_a) {
77
+ var start = _a.start, end = _a.end, resources = _a.resources;
78
+ var match = utils_1.resourcesMatch(this.selectionOriginResources, resources, false); // Not strict - allow matching [ undefined ] and [ undefined ]
79
+ if (!match) {
80
+ return; // Don't change selection when dragging over a different grouped resource's cells.
81
+ }
82
+ this.selectedRange.start = start;
83
+ this.selectedRange.end = end;
84
+ this.cdr.markForCheck();
85
+ };
86
+ SlotSelectableDirective.prototype.onRelease = function () {
87
+ this.selectionOriginResources = null;
88
+ if (this.selectedRange) {
89
+ this.slotSelectionChangeSource.emit(this.selectedRange);
90
+ }
91
+ };
92
+ /**
93
+ * @hidden
94
+ * Checks if the selected range contains a local date range.
95
+ */
96
+ SlotSelectableDirective.prototype.isInRange = function (start, end) {
97
+ if (!this.selectedRange) {
98
+ return;
99
+ }
100
+ return utils_1.intersects(start, end, this.selectedRange.start, this.selectedRange.end);
101
+ };
102
+ tslib_1.__decorate([
103
+ core_1.Input(),
104
+ tslib_1.__metadata("design:type", Object)
105
+ ], SlotSelectableDirective.prototype, "slotSelection", void 0);
106
+ tslib_1.__decorate([
107
+ core_1.Output(),
108
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
109
+ ], SlotSelectableDirective.prototype, "slotSelectionChange", void 0);
110
+ SlotSelectableDirective = tslib_1.__decorate([
111
+ core_1.Directive({
112
+ selector: '[kendoSchedulerSlotSelectable]'
113
+ }),
114
+ tslib_1.__metadata("design:paramtypes", [scheduler_component_1.SchedulerComponent,
115
+ core_1.ChangeDetectorRef])
116
+ ], SlotSelectableDirective);
117
+ return SlotSelectableDirective;
118
+ }());
119
+ exports.SlotSelectableDirective = SlotSelectableDirective;
@@ -30,7 +30,7 @@ exports.ɵ2 = ɵ2;
30
30
  var DayTimeViewComponent = /** @class */ (function (_super) {
31
31
  tslib_1.__extends(DayTimeViewComponent, _super);
32
32
  function DayTimeViewComponent(changeDetector, viewContext, viewState, intl, slotService, zone, renderer, element, pdfService, localization) {
33
- var _this = _super.call(this, viewContext, viewState, intl, slotService, zone, renderer, element, pdfService, localization) || this;
33
+ var _this = _super.call(this, viewContext, viewState, intl, slotService, zone, renderer, element, pdfService, localization, changeDetector) || this;
34
34
  _this.changeDetector = changeDetector;
35
35
  _this.numberOfDays = 1;
36
36
  _this.startTime = '00:00';
@@ -10,6 +10,7 @@ var common_1 = require("@angular/common");
10
10
  var shared_module_1 = require("../../shared.module");
11
11
  var event_slot_directive_1 = require("./event-slot.directive");
12
12
  var day_time_view_item_component_1 = require("./day-time-view-item.component");
13
+ var views_shared_module_1 = require("../common/views-shared.module");
13
14
  var DIRECTIVES = [event_slot_directive_1.TimeSlotDirective, event_slot_directive_1.DaySlotDirective, day_time_view_item_component_1.DayTimeViewItemComponent];
14
15
  /**
15
16
  * @hidden
@@ -19,7 +20,7 @@ var DayTimeModule = /** @class */ (function () {
19
20
  }
20
21
  DayTimeModule = tslib_1.__decorate([
21
22
  core_1.NgModule({
22
- imports: [common_1.CommonModule, shared_module_1.SharedModule],
23
+ imports: [common_1.CommonModule, shared_module_1.SharedModule, views_shared_module_1.ViewsSharedModule],
23
24
  exports: [
24
25
  DIRECTIVES
25
26
  ],