@progress/kendo-angular-gantt 0.3.0-dev.202201111723 → 0.3.0-dev.202201131518

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 (98) hide show
  1. package/dist/cdn/js/kendo-angular-gantt.js +2 -2
  2. package/dist/cdn/main.js +4 -10
  3. package/dist/es/common/touch-enabled.js +9 -0
  4. package/dist/es/dependencies/utils.js +34 -0
  5. package/dist/es/dragging/dependency-drag-create.directive.js +347 -0
  6. package/dist/es/dragging/drag-validation-tooltip.component.js +27 -0
  7. package/dist/es/editing/{util.js → utils.js} +0 -0
  8. package/dist/es/gantt.component.js +125 -7
  9. package/dist/es/gantt.module.js +23 -6
  10. package/dist/es/index.js +4 -0
  11. package/dist/es/main.js +1 -0
  12. package/dist/es/models/events/dependency-add-event.interface.js +4 -0
  13. package/dist/es/models/view-item.interface.js +4 -0
  14. package/dist/es/package-metadata.js +1 -1
  15. package/dist/es/rendering/gantt-milestone-task.component.js +7 -4
  16. package/dist/es/rendering/gantt-summary-task.component.js +7 -4
  17. package/dist/es/rendering/gantt-task-base.js +30 -19
  18. package/dist/es/rendering/gantt-task.component.js +8 -6
  19. package/dist/es/rendering/gantt-tasks-table-body.component.js +5 -1
  20. package/dist/es/scrolling/drag-scroll-settings.js +20 -0
  21. package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
  22. package/dist/es/scrolling/timeline-scroll.service.js +39 -0
  23. package/dist/es/scrolling/utils.js +80 -0
  24. package/dist/es/timeline/gantt-timeline.component.js +45 -3
  25. package/dist/es/utils.js +143 -12
  26. package/dist/es2015/common/touch-enabled.d.ts +9 -0
  27. package/dist/es2015/common/touch-enabled.js +9 -0
  28. package/dist/es2015/dependencies/utils.d.ts +15 -0
  29. package/dist/es2015/dependencies/utils.js +34 -0
  30. package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
  31. package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
  32. package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
  33. package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
  34. package/dist/es2015/editing/{util.d.ts → utils.d.ts} +0 -0
  35. package/dist/es2015/editing/{util.js → utils.js} +0 -0
  36. package/dist/es2015/gantt.component.d.ts +39 -3
  37. package/dist/es2015/gantt.component.js +117 -6
  38. package/dist/es2015/gantt.module.js +23 -6
  39. package/dist/es2015/index.d.ts +4 -0
  40. package/dist/es2015/index.js +4 -0
  41. package/dist/es2015/index.metadata.json +1 -1
  42. package/dist/es2015/main.d.ts +1 -0
  43. package/dist/es2015/main.js +1 -0
  44. package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
  45. package/dist/es2015/models/events/dependency-add-event.interface.js +4 -0
  46. package/dist/es2015/models/models.d.ts +2 -0
  47. package/dist/es2015/models/view-item.interface.d.ts +35 -0
  48. package/dist/es2015/models/view-item.interface.js +4 -0
  49. package/dist/es2015/package-metadata.js +1 -1
  50. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +2 -1
  51. package/dist/es2015/rendering/gantt-milestone-task.component.js +18 -5
  52. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +2 -1
  53. package/dist/es2015/rendering/gantt-summary-task.component.js +18 -5
  54. package/dist/es2015/rendering/gantt-task-base.d.ts +11 -5
  55. package/dist/es2015/rendering/gantt-task-base.js +30 -19
  56. package/dist/es2015/rendering/gantt-task.component.d.ts +2 -1
  57. package/dist/es2015/rendering/gantt-task.component.js +19 -7
  58. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +1 -0
  59. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +10 -3
  60. package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
  61. package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
  62. package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
  63. package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
  64. package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
  65. package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
  66. package/dist/es2015/scrolling/utils.d.ts +29 -0
  67. package/dist/es2015/scrolling/utils.js +80 -0
  68. package/dist/es2015/timeline/gantt-timeline.component.d.ts +25 -2
  69. package/dist/es2015/timeline/gantt-timeline.component.js +56 -3
  70. package/dist/es2015/utils.d.ts +70 -8
  71. package/dist/es2015/utils.js +143 -12
  72. package/dist/fesm2015/index.js +1337 -372
  73. package/dist/fesm5/index.js +1206 -298
  74. package/dist/npm/common/touch-enabled.js +11 -0
  75. package/dist/npm/dependencies/utils.js +34 -0
  76. package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
  77. package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
  78. package/dist/npm/editing/{util.js → utils.js} +0 -0
  79. package/dist/npm/gantt.component.js +127 -9
  80. package/dist/npm/gantt.module.js +22 -5
  81. package/dist/npm/index.js +8 -0
  82. package/dist/npm/main.js +2 -0
  83. package/dist/npm/models/events/dependency-add-event.interface.js +6 -0
  84. package/dist/npm/models/view-item.interface.js +6 -0
  85. package/dist/npm/package-metadata.js +1 -1
  86. package/dist/npm/rendering/gantt-milestone-task.component.js +6 -3
  87. package/dist/npm/rendering/gantt-summary-task.component.js +6 -3
  88. package/dist/npm/rendering/gantt-task-base.js +30 -19
  89. package/dist/npm/rendering/gantt-task.component.js +7 -5
  90. package/dist/npm/rendering/gantt-tasks-table-body.component.js +5 -1
  91. package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
  92. package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
  93. package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
  94. package/dist/npm/scrolling/utils.js +83 -0
  95. package/dist/npm/timeline/gantt-timeline.component.js +44 -2
  96. package/dist/npm/utils.js +143 -12
  97. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  98. package/package.json +5 -4
@@ -51,23 +51,6 @@ var GanttTaskBase = /** @class */ (function () {
51
51
  enumerable: true,
52
52
  configurable: true
53
53
  });
54
- GanttTaskBase.prototype.ngOnChanges = function (changes) {
55
- if (isPresent(changes.dataItem)) {
56
- if (isPresent(changes.dataItem.previousValue)) {
57
- this.dependencyDomService.unregisterTask(changes.dataItem.previousValue);
58
- }
59
- this.dependencyDomService.registerTask(this.dataItem, this.taskElement.nativeElement);
60
- }
61
- else if (isPresent(changes.activeView)) {
62
- this.dependencyDomService.notifyChanges();
63
- }
64
- };
65
- GanttTaskBase.prototype.ngOnDestroy = function () {
66
- if (isPresent(this.dataItem)) {
67
- this.dependencyDomService.unregisterTask(this.dataItem);
68
- }
69
- this.viewChangesSubscription.unsubscribe();
70
- };
71
54
  Object.defineProperty(GanttTaskBase.prototype, "taskWidth", {
72
55
  get: function () {
73
56
  var itemDuration = this.mapper.extractFromTask(this.dataItem, 'end') - this.mapper.extractFromTask(this.dataItem, 'start');
@@ -79,6 +62,12 @@ var GanttTaskBase = /** @class */ (function () {
79
62
  configurable: true
80
63
  });
81
64
  Object.defineProperty(GanttTaskBase.prototype, "taskOffset", {
65
+ /**
66
+ * The `left` style prop has to be applied to the host element (.k-task-wrap), as the drag clue elements are displayed on .k-task-wrap hover.
67
+ * Applying the `left` offset to the inner .k-task element leaves the .k-task-wrap element rendered with an offset of 0 somewhere on the left
68
+ * and hovering just the .k-task element doesn't expose the drag clues.
69
+ * Additionally, positioning the entire container takes care of positioning the hints as well.
70
+ */
82
71
  get: function () {
83
72
  var timeAfterViewStart = this.mapper.extractFromTask(this.dataItem, 'start') - this.viewService.viewStart;
84
73
  var offsetInSlotUnits = timeAfterViewStart / this.slotUnitDuration;
@@ -97,6 +86,23 @@ var GanttTaskBase = /** @class */ (function () {
97
86
  enumerable: true,
98
87
  configurable: true
99
88
  });
89
+ GanttTaskBase.prototype.ngOnChanges = function (changes) {
90
+ if (isPresent(changes.dataItem)) {
91
+ if (isPresent(changes.dataItem.previousValue)) {
92
+ this.dependencyDomService.unregisterTask(changes.dataItem.previousValue);
93
+ }
94
+ this.dependencyDomService.registerTask(this.dataItem, this.taskElement.nativeElement);
95
+ }
96
+ else if (isPresent(changes.activeView)) {
97
+ this.dependencyDomService.notifyChanges();
98
+ }
99
+ };
100
+ GanttTaskBase.prototype.ngOnDestroy = function () {
101
+ if (isPresent(this.dataItem)) {
102
+ this.dependencyDomService.unregisterTask(this.dataItem);
103
+ }
104
+ this.viewChangesSubscription.unsubscribe();
105
+ };
100
106
  tslib_1.__decorate([
101
107
  HostBinding('class.k-task-wrap'),
102
108
  tslib_1.__metadata("design:type", Boolean)
@@ -111,8 +117,8 @@ var GanttTaskBase = /** @class */ (function () {
111
117
  ], GanttTaskBase.prototype, "dataItem", void 0);
112
118
  tslib_1.__decorate([
113
119
  Input(),
114
- tslib_1.__metadata("design:type", Number)
115
- ], GanttTaskBase.prototype, "index", void 0);
120
+ tslib_1.__metadata("design:type", Boolean)
121
+ ], GanttTaskBase.prototype, "renderDependencyDragClues", void 0);
116
122
  tslib_1.__decorate([
117
123
  Input(),
118
124
  tslib_1.__metadata("design:type", Function)
@@ -125,6 +131,11 @@ var GanttTaskBase = /** @class */ (function () {
125
131
  Input(),
126
132
  tslib_1.__metadata("design:type", Function)
127
133
  ], GanttTaskBase.prototype, "taskClass", void 0);
134
+ tslib_1.__decorate([
135
+ HostBinding('style.left.px'),
136
+ tslib_1.__metadata("design:type", Number),
137
+ tslib_1.__metadata("design:paramtypes", [])
138
+ ], GanttTaskBase.prototype, "taskOffset", null);
128
139
  return GanttTaskBase;
129
140
  }());
130
141
  export { GanttTaskBase };
@@ -3,8 +3,9 @@
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 { ChangeDetectorRef, Component, forwardRef, Input, TemplateRef } from '@angular/core';
6
+ import { ChangeDetectorRef, Component, forwardRef, Inject, Input, TemplateRef } from '@angular/core';
7
7
  import { MappingService } from '../common/mapping.service';
8
+ import { TOUCH_ENABLED } from '../common/touch-enabled';
8
9
  import { DependencyDomService } from '../dependencies/dependency-dom.service';
9
10
  import { OptionChangesService } from '../common/option-changes.service';
10
11
  import { TimelineViewService } from './../timeline/timeline-view.service';
@@ -15,9 +16,10 @@ import { EditService } from '../editing/edit.service';
15
16
  */
16
17
  var GanttTaskComponent = /** @class */ (function (_super) {
17
18
  tslib_1.__extends(GanttTaskComponent, _super);
18
- function GanttTaskComponent(mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, editService) {
19
+ function GanttTaskComponent(editService, touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) {
19
20
  var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) || this;
20
21
  _this.editService = editService;
22
+ _this.touchEnabled = touchEnabled;
21
23
  return _this;
22
24
  }
23
25
  GanttTaskComponent_1 = GanttTaskComponent;
@@ -43,14 +45,14 @@ var GanttTaskComponent = /** @class */ (function (_super) {
43
45
  useExisting: forwardRef(function () { return GanttTaskComponent_1; })
44
46
  }
45
47
  ],
46
- template: "\n <div\n #task\n class=\"k-task k-task-single\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.width.px]=\"taskWidth\"\n [style.left.px]=\"taskOffset\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [attr.data-task-index]=\"index\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n >\n <ng-container *ngIf=\"!taskTemplate\">\n <div\n class=\"k-task-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n >\n </div>\n <div class=\"k-task-content\">\n <div class=\"k-task-template\">\n <ng-container *ngIf=\"!taskContentTemplate; else taskContent\">\n {{ mapper.extractFromTask(dataItem, 'title') }}\n </ng-container>\n <ng-template\n #taskContent\n [ngTemplateOutlet]=\"taskContentTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"\n >\n </ng-template>\n </div>\n <span class=\"k-task-actions\">\n <span\n (click)=\"onTaskDelete()\"\n class=\"k-link k-task-delete\">\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </span>\n </div>\n </ng-container>\n <ng-template\n *ngIf=\"taskTemplate\"\n [ngTemplateOutlet]=\"taskTemplate\"\n [ngTemplateOutletContext]=\"{\n $implicit: dataItem,\n elementWidth: taskWidth\n }\"\n >\n </ng-template>\n </div>\n "
48
+ template: "\n <div\n #task\n class=\"k-task k-task-single\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.width.px]=\"taskWidth\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n >\n <ng-container *ngIf=\"!taskTemplate\">\n <div\n class=\"k-task-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n >\n </div>\n <div class=\"k-task-content\">\n <div class=\"k-task-template\">\n <ng-container *ngIf=\"!taskContentTemplate; else taskContent\">\n {{ mapper.extractFromTask(dataItem, 'title') }}\n </ng-container>\n <ng-template\n #taskContent\n [ngTemplateOutlet]=\"taskContentTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"\n >\n </ng-template>\n </div>\n <span class=\"k-task-actions\">\n <span\n (click)=\"onTaskDelete()\"\n class=\"k-link k-task-delete\">\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </span>\n </div>\n </ng-container>\n <ng-template\n *ngIf=\"taskTemplate\"\n [ngTemplateOutlet]=\"taskTemplate\"\n [ngTemplateOutletContext]=\"{\n $implicit: dataItem,\n elementWidth: taskWidth\n }\"\n >\n </ng-template>\n </div>\n <ng-container *ngIf=\"renderDependencyDragClues\">\n <div\n class=\"k-task-dot k-task-start k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n <div\n class=\"k-task-dot k-task-end k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n </ng-container>\n "
47
49
  }),
48
- tslib_1.__metadata("design:paramtypes", [MappingService,
50
+ tslib_1.__param(1, Inject(TOUCH_ENABLED)),
51
+ tslib_1.__metadata("design:paramtypes", [EditService, Boolean, MappingService,
49
52
  TimelineViewService,
50
53
  DependencyDomService,
51
54
  OptionChangesService,
52
- ChangeDetectorRef,
53
- EditService])
55
+ ChangeDetectorRef])
54
56
  ], GanttTaskComponent);
55
57
  return GanttTaskComponent;
56
58
  }(GanttTaskBase));
@@ -67,10 +67,14 @@ var GanttTasksTableBodyComponent = /** @class */ (function () {
67
67
  Input(),
68
68
  tslib_1.__metadata("design:type", Function)
69
69
  ], GanttTasksTableBodyComponent.prototype, "isTaskSelected", void 0);
70
+ tslib_1.__decorate([
71
+ Input(),
72
+ tslib_1.__metadata("design:type", Boolean)
73
+ ], GanttTasksTableBodyComponent.prototype, "renderDependencyDragClues", void 0);
70
74
  GanttTasksTableBodyComponent = tslib_1.__decorate([
71
75
  Component({
72
76
  selector: '[kendoGanttTasksTableBody]',
73
- template: "\n <tr #timelineRow *ngFor=\"let item of rows; let index = index\">\n <td>\n <kendo-gantt-milestone-task\n *ngIf=\"isMileStone(item); else task\"\n [dataItem]=\"item\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [index]=\"index\"\n >\n </kendo-gantt-milestone-task>\n <ng-template #task>\n <kendo-gantt-summary-task\n *ngIf=\"hasChildren(item)\"\n [dataItem]=\"item\"\n [template]=\"summaryTaskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [index]=\"index\"\n >\n </kendo-gantt-summary-task>\n <kendo-gantt-task\n *ngIf=\"!hasChildren(item)\"\n [dataItem]=\"item\"\n [taskContentTemplate]=\"taskContentTemplate\"\n [taskTemplate]=\"taskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [index]=\"index\"\n >\n </kendo-gantt-task>\n </ng-template>\n </td>\n </tr>\n "
77
+ template: "\n <tr #timelineRow *ngFor=\"let item of rows; let index = index\">\n <td>\n <kendo-gantt-milestone-task\n *ngIf=\"isMileStone(item); else task\"\n [dataItem]=\"item\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [attr.data-task-index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-milestone-task>\n <ng-template #task>\n <kendo-gantt-summary-task\n *ngIf=\"hasChildren(item)\"\n [dataItem]=\"item\"\n [template]=\"summaryTaskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [attr.data-task-index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-summary-task>\n <kendo-gantt-task\n *ngIf=\"!hasChildren(item)\"\n [dataItem]=\"item\"\n [taskContentTemplate]=\"taskContentTemplate\"\n [taskTemplate]=\"taskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [attr.data-task-index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-task>\n </ng-template>\n </td>\n </tr>\n "
74
78
  }),
75
79
  tslib_1.__metadata("design:paramtypes", [DependencyDomService,
76
80
  MappingService])
@@ -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
+ /**
6
+ * @hidden
7
+ */
8
+ export var ScrollDirection;
9
+ (function (ScrollDirection) {
10
+ ScrollDirection[ScrollDirection["Backwards"] = -1] = "Backwards";
11
+ ScrollDirection[ScrollDirection["Forward"] = 1] = "Forward";
12
+ })(ScrollDirection || (ScrollDirection = {}));
13
+ /**
14
+ * @hidden
15
+ */
16
+ export var ScrollAxis;
17
+ (function (ScrollAxis) {
18
+ ScrollAxis["Vertical"] = "scrollTop";
19
+ ScrollAxis["Horizontal"] = "scrollLeft";
20
+ })(ScrollAxis || (ScrollAxis = {}));
@@ -0,0 +1,89 @@
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
+ import * as tslib_1 from "tslib";
6
+ import { Directive, ElementRef, Input, NgZone } from '@angular/core';
7
+ import { Subscription } from 'rxjs';
8
+ import { isPresent } from '../utils';
9
+ import { ScrollAxis, ScrollDirection } from './drag-scroll-settings';
10
+ import { TimelineScrollService } from './timeline-scroll.service';
11
+ import { getViewportBoundaries, scrollElement } from './utils';
12
+ /**
13
+ * @hidden
14
+ */
15
+ var TimelineScrollableDirective = /** @class */ (function () {
16
+ function TimelineScrollableDirective(timelineScrollableContainer, scrollService, zone) {
17
+ this.timelineScrollableContainer = timelineScrollableContainer;
18
+ this.scrollService = scrollService;
19
+ this.zone = zone;
20
+ this.subscriptions = new Subscription();
21
+ this.subscriptions.add(this.scrollService.horizontalScroll
22
+ .subscribe(this.scrollHorizontallyTo.bind(this)));
23
+ this.subscriptions.add(this.scrollService.verticalScroll
24
+ .subscribe(this.scrollVerticallyTo.bind(this)));
25
+ this.subscriptions.add(this.scrollService.scrollCancel
26
+ .subscribe(this.cancelScroll.bind(this)));
27
+ }
28
+ TimelineScrollableDirective.prototype.ngOnDestroy = function () {
29
+ this.subscriptions.unsubscribe();
30
+ };
31
+ TimelineScrollableDirective.prototype.scrollHorizontallyTo = function (left) {
32
+ var _this = this;
33
+ this.zone.runOutsideAngular(function () {
34
+ var container = _this.timelineScrollableContainer.nativeElement;
35
+ var visibleBoundaries = getViewportBoundaries(container);
36
+ if (left < visibleBoundaries.left + _this.scrollSettings.threshold) {
37
+ _this.horizontalScrollInterval = setInterval(function () {
38
+ return scrollElement(container, _this.scrollSettings.step, ScrollDirection.Backwards, ScrollAxis.Horizontal);
39
+ }, _this.scrollSettings.interval);
40
+ }
41
+ else if (left > visibleBoundaries.right - _this.scrollSettings.threshold) {
42
+ _this.horizontalScrollInterval = setInterval(function () {
43
+ return scrollElement(container, _this.scrollSettings.step, ScrollDirection.Forward, ScrollAxis.Horizontal);
44
+ }, _this.scrollSettings.interval);
45
+ }
46
+ });
47
+ };
48
+ TimelineScrollableDirective.prototype.scrollVerticallyTo = function (top) {
49
+ var _this = this;
50
+ this.zone.runOutsideAngular(function () {
51
+ var container = _this.timelineScrollableContainer.nativeElement;
52
+ var visibleBoundaries = getViewportBoundaries(container);
53
+ if (top < visibleBoundaries.top + _this.scrollSettings.threshold) {
54
+ _this.verticalScrollInterval = setInterval(function () {
55
+ return scrollElement(container, _this.scrollSettings.step, ScrollDirection.Backwards, ScrollAxis.Vertical);
56
+ }, _this.scrollSettings.interval);
57
+ }
58
+ else if (top > visibleBoundaries.bottom - _this.scrollSettings.threshold) {
59
+ _this.verticalScrollInterval = setInterval(function () {
60
+ return scrollElement(container, _this.scrollSettings.step, ScrollDirection.Forward, ScrollAxis.Vertical);
61
+ }, _this.scrollSettings.interval);
62
+ }
63
+ });
64
+ };
65
+ TimelineScrollableDirective.prototype.cancelScroll = function () {
66
+ if (isPresent(this.verticalScrollInterval)) {
67
+ clearInterval(this.verticalScrollInterval);
68
+ this.verticalScrollInterval = null;
69
+ }
70
+ if (isPresent(this.horizontalScrollInterval)) {
71
+ clearInterval(this.horizontalScrollInterval);
72
+ this.horizontalScrollInterval = null;
73
+ }
74
+ };
75
+ tslib_1.__decorate([
76
+ Input(),
77
+ tslib_1.__metadata("design:type", Object)
78
+ ], TimelineScrollableDirective.prototype, "scrollSettings", void 0);
79
+ TimelineScrollableDirective = tslib_1.__decorate([
80
+ Directive({
81
+ selector: '[kendoGanttTimelineScrollable]'
82
+ }),
83
+ tslib_1.__metadata("design:paramtypes", [ElementRef,
84
+ TimelineScrollService,
85
+ NgZone])
86
+ ], TimelineScrollableDirective);
87
+ return TimelineScrollableDirective;
88
+ }());
89
+ export { TimelineScrollableDirective };
@@ -0,0 +1,39 @@
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
+ import * as tslib_1 from "tslib";
6
+ import { Injectable } from '@angular/core';
7
+ import { Subject } from 'rxjs';
8
+ /**
9
+ * @hidden
10
+ *
11
+ * Notifies the timeline-scroll.directive to scroll into view to requested coordinates.
12
+ * The scrolling is performed based on client (viewport) coordinates.
13
+ */
14
+ var TimelineScrollService = /** @class */ (function () {
15
+ function TimelineScrollService() {
16
+ this.horizontalScroll = new Subject();
17
+ this.verticalScroll = new Subject();
18
+ this.scrollCancel = new Subject();
19
+ }
20
+ TimelineScrollService.prototype.ngOnDestroy = function () {
21
+ this.horizontalScroll.complete();
22
+ this.verticalScroll.complete();
23
+ this.scrollCancel.complete();
24
+ };
25
+ TimelineScrollService.prototype.requestHorizontalScroll = function (clientTop) {
26
+ this.horizontalScroll.next(clientTop);
27
+ };
28
+ TimelineScrollService.prototype.requestVerticalScroll = function (clientLeft) {
29
+ this.verticalScroll.next(clientLeft);
30
+ };
31
+ TimelineScrollService.prototype.requestScrollCancel = function () {
32
+ this.scrollCancel.next();
33
+ };
34
+ TimelineScrollService = tslib_1.__decorate([
35
+ Injectable()
36
+ ], TimelineScrollService);
37
+ return TimelineScrollService;
38
+ }());
39
+ export { TimelineScrollService };
@@ -0,0 +1,80 @@
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
+ import { isDocumentAvailable } from '@progress/kendo-angular-common';
6
+ import { ScrollAxis, ScrollDirection } from './drag-scroll-settings';
7
+ import { isPresent } from '../utils';
8
+ /**
9
+ * @hidden
10
+ *
11
+ * Checks if the beginning of the scrollable element is reached (top/left).
12
+ * Floors the top value.
13
+ */
14
+ var isUpperLimitReached = function (element, axis) { return Math.floor(element[axis]) <= 0; };
15
+ var ɵ0 = isUpperLimitReached;
16
+ /**
17
+ * @hidden
18
+ *
19
+ * Checks if the end of the scrollable element is reached (bottom/right).
20
+ * Ceils the top value.
21
+ */
22
+ var isBottomLimitReached = function (element, axis) {
23
+ var elementSize = axis === ScrollAxis.Horizontal ?
24
+ element.scrollWidth - element.clientWidth :
25
+ element.scrollHeight - element.clientHeight;
26
+ return Math.ceil(element[axis]) >= elementSize;
27
+ };
28
+ var ɵ1 = isBottomLimitReached;
29
+ /**
30
+ * @hidden
31
+ *
32
+ * Scrolls the element in the given direction by the provided step in the provided scroll axis.
33
+ *
34
+ * If the targeted scroll incrementation doesn't yield any result due to device pixel ratio issues (https://github.com/dimitar-pechev/RenderingIndependentScrollOffsets#readme),
35
+ * increments the step with 1px and again attempts to change the scrollTop of the element, until the content is actually scrolled.
36
+ *
37
+ * Cuts the operation short after 20 unsuccessful attempts to prevent infinite loops in possible corner-case scenarios.
38
+ */
39
+ export var scrollElement = function (element, step, direction, scrollAxis) {
40
+ if (!(isPresent(element) && isDocumentAvailable())) {
41
+ return;
42
+ }
43
+ var initialScrollPosition = element[scrollAxis];
44
+ var currentStep = step;
45
+ var iterations = 0;
46
+ while (initialScrollPosition === element[scrollAxis] &&
47
+ !(direction === ScrollDirection.Backwards && isUpperLimitReached(element, scrollAxis)) &&
48
+ !(direction === ScrollDirection.Forward && isBottomLimitReached(element, scrollAxis)) &&
49
+ iterations < 20 // cut the operation short in 20 attempts - in case of a wild corner case
50
+ ) {
51
+ element[scrollAxis] += (currentStep * direction);
52
+ // try with a larger step if the current one doesn't update the scroll position successfully
53
+ currentStep += 1;
54
+ iterations += 1;
55
+ }
56
+ };
57
+ /**
58
+ * @hidden
59
+ *
60
+ * As client coordinates are not restricted to the range 0px - {viewportSize}px, but can have negative starting values or ending values greater than the viewport size,
61
+ * this function extracts the visible boundaries of the provided element - fall-backing to 0 when the top/left are below 0,
62
+ * and fall-backing to the actual visible size of the container for bottom/right.
63
+ */
64
+ export var getViewportBoundaries = function (element) {
65
+ var elementRect = element.getBoundingClientRect();
66
+ // if the beginning of the scrollable container is above/before the current viewport, fall-back to 0
67
+ var topLimit = Math.max(elementRect.top, 0);
68
+ var leftLimit = Math.max(elementRect.left, 0);
69
+ // if the end of the scrollable container is beneath/after the current viewport, fall-back to its client height
70
+ // add the distance from the start of the viewport to the beginning of the container to ensure scrolling bottom begins when the actual end of the container is reached
71
+ var bottomLimit = topLimit + Math.min(elementRect.bottom, element.clientHeight);
72
+ var rightLimit = leftLimit + Math.min(elementRect.right, element.clientWidth);
73
+ return {
74
+ top: topLimit,
75
+ bottom: bottomLimit,
76
+ left: leftLimit,
77
+ right: rightLimit
78
+ };
79
+ };
80
+ export { ɵ0, ɵ1 };
@@ -3,13 +3,13 @@
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, ElementRef, HostBinding, Input, NgZone, Renderer2, TemplateRef, ViewChild } from '@angular/core';
6
+ import { Component, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
7
7
  import { Subscription } from 'rxjs';
8
8
  import { filter, map, switchMap, take } from 'rxjs/operators';
9
+ import { isDocumentAvailable } from '@progress/kendo-angular-common';
9
10
  import { ScrollSyncService } from '../scrolling/scroll-sync.service';
10
11
  import { DependencyDomService } from '../dependencies/dependency-dom.service';
11
12
  import { isPresent } from '../utils';
12
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
13
13
  /**
14
14
  * @hidden
15
15
  */
@@ -22,6 +22,10 @@ var GanttTimelineComponent = /** @class */ (function () {
22
22
  this.zone = zone;
23
23
  this.hostClass = true;
24
24
  this.dependencies = [];
25
+ // as all drag-and-drop operations are on the timeline container, use a single draggable instance
26
+ this.timelineContainerPress = new EventEmitter();
27
+ this.timelineContainerDrag = new EventEmitter();
28
+ this.timelineContainerRelease = new EventEmitter();
25
29
  this.subscriptions = new Subscription();
26
30
  this.subscriptions.add(
27
31
  // task changes indicates change in row content, number, height, etc.
@@ -34,6 +38,16 @@ var GanttTimelineComponent = /** @class */ (function () {
34
38
  _this.renderer.setStyle(_this.timelineColumns.nativeElement, 'height', (_this.rows || []).length * timelineRowHeight + "px");
35
39
  }));
36
40
  }
41
+ Object.defineProperty(GanttTimelineComponent.prototype, "draggableEnabled", {
42
+ /**
43
+ * Specifies whether the draggable will attach or detach its pointer event listeners.
44
+ */
45
+ get: function () {
46
+ return this.renderDependencyDragClues;
47
+ },
48
+ enumerable: true,
49
+ configurable: true
50
+ });
37
51
  GanttTimelineComponent.prototype.ngAfterViewInit = function () {
38
52
  var timelineHeader = this.timelineHeaderWrap.nativeElement;
39
53
  var rightContainer = this.timelineContent.nativeElement;
@@ -63,6 +77,14 @@ var GanttTimelineComponent = /** @class */ (function () {
63
77
  ViewChild('tasksContainer', { static: true }),
64
78
  tslib_1.__metadata("design:type", ElementRef)
65
79
  ], GanttTimelineComponent.prototype, "tasksContainer", void 0);
80
+ tslib_1.__decorate([
81
+ ViewChild('dragPopupContainer', { static: false, read: ViewContainerRef }),
82
+ tslib_1.__metadata("design:type", ViewContainerRef)
83
+ ], GanttTimelineComponent.prototype, "dragPopupContainer", void 0);
84
+ tslib_1.__decorate([
85
+ ViewChild('dependencyDragCreatePolyline', { static: false }),
86
+ tslib_1.__metadata("design:type", ElementRef)
87
+ ], GanttTimelineComponent.prototype, "dependencyDragCreatePolyline", void 0);
66
88
  tslib_1.__decorate([
67
89
  HostBinding('class.k-gantt-timeline'),
68
90
  tslib_1.__metadata("design:type", Boolean)
@@ -107,6 +129,14 @@ var GanttTimelineComponent = /** @class */ (function () {
107
129
  Input(),
108
130
  tslib_1.__metadata("design:type", Function)
109
131
  ], GanttTimelineComponent.prototype, "isTaskSelected", void 0);
132
+ tslib_1.__decorate([
133
+ Input(),
134
+ tslib_1.__metadata("design:type", Boolean)
135
+ ], GanttTimelineComponent.prototype, "renderDependencyDragClues", void 0);
136
+ tslib_1.__decorate([
137
+ Input(),
138
+ tslib_1.__metadata("design:type", Object)
139
+ ], GanttTimelineComponent.prototype, "dragScrollSettings", void 0);
110
140
  tslib_1.__decorate([
111
141
  Input(),
112
142
  tslib_1.__metadata("design:type", Function)
@@ -115,10 +145,22 @@ var GanttTimelineComponent = /** @class */ (function () {
115
145
  Input(),
116
146
  tslib_1.__metadata("design:type", Array)
117
147
  ], GanttTimelineComponent.prototype, "dependencies", void 0);
148
+ tslib_1.__decorate([
149
+ Output(),
150
+ tslib_1.__metadata("design:type", EventEmitter)
151
+ ], GanttTimelineComponent.prototype, "timelineContainerPress", void 0);
152
+ tslib_1.__decorate([
153
+ Output(),
154
+ tslib_1.__metadata("design:type", EventEmitter)
155
+ ], GanttTimelineComponent.prototype, "timelineContainerDrag", void 0);
156
+ tslib_1.__decorate([
157
+ Output(),
158
+ tslib_1.__metadata("design:type", EventEmitter)
159
+ ], GanttTimelineComponent.prototype, "timelineContainerRelease", void 0);
118
160
  GanttTimelineComponent = tslib_1.__decorate([
119
161
  Component({
120
162
  selector: 'kendo-gantt-timeline',
121
- template: "\n <div class=\"k-timeline k-grid k-widget\">\n <div class=\"k-grid-header\">\n <div #timelineHeaderWrap class=\"k-grid-header-wrap\">\n <table\n role=\"presentation\"\n [style.width.px]=\"tableWidth\"\n >\n <tbody\n kendoGanttHeaderTableBody\n [groupSlots]=\"groupSlots\"\n [slots]=\"slots\">\n </tbody>\n </table>\n </div>\n </div>\n <div #timelineContent class=\"k-grid-content\">\n <div class=\"k-gantt-tables\">\n <table\n class=\"k-gantt-rows\"\n [style.width.px]=\"tableWidth\"\n role=\"presentation\"\n >\n <tbody>\n <tr *ngFor=\"let item of rows; let i = index;\"\n [class.k-alt]=\"i % 2\"\n >\n <td></td>\n </tr>\n </tbody>\n </table>\n\n <table\n #timelineColumns\n class=\"k-gantt-columns\"\n role=\"presentation\"\n [style.width.px]=\"tableWidth\"\n >\n <colgroup>\n <col *ngFor=\"let item of slots\">\n </colgroup>\n\n <tbody>\n <tr>\n <td *ngFor=\"let item of slots\"\n [class.k-nonwork-hour]=\"isNonWorking(item)\"\n >\n </td>\n </tr>\n </tbody>\n </table>\n\n <table\n #tasksContainer\n class=\"k-gantt-tasks\"\n role=\"presentation\"\n style=\"border-collapse: collapse;\"\n [style.width.px]=\"tableWidth\"\n >\n <tbody\n kendoGanttTasksTableBody\n [rows]=\"rows\"\n [activeView]=\"activeView\"\n [taskContentTemplate]=\"taskContentTemplate\"\n [taskTemplate]=\"taskTemplate\"\n [summaryTaskTemplate]=\"summaryTaskTemplate\"\n [taskClass]=\"taskClass\"\n [hasChildren]=\"hasChildren\"\n [isTaskSelected]=\"isTaskSelected\"\n >\n </tbody>\n </table>\n </div>\n <svg class=\"k-gantt-dependencies-svg\">\n <polyline\n *ngFor=\"let dependency of dependencies\"\n kendoGanttDependency\n [dependency]=\"dependency\"\n />\n </svg>\n </div>\n </div>\n "
163
+ template: "\n <div class=\"k-timeline k-grid k-widget\">\n <div class=\"k-grid-header\">\n <div #timelineHeaderWrap class=\"k-grid-header-wrap\">\n <table\n role=\"presentation\"\n [style.width.px]=\"tableWidth\"\n >\n <tbody\n kendoGanttHeaderTableBody\n [groupSlots]=\"groupSlots\"\n [slots]=\"slots\">\n </tbody>\n </table>\n </div>\n </div>\n <div\n #timelineContent\n class=\"k-grid-content\"\n kendoGanttTimelineScrollable\n [scrollSettings]=\"dragScrollSettings\"\n kendoDraggable\n [enableDrag]=\"draggableEnabled\"\n (kendoPress)=\"timelineContainerPress.emit($event)\"\n (kendoDrag)=\"timelineContainerDrag.emit($event)\"\n (kendoRelease)=\"timelineContainerRelease.emit($event)\"\n >\n <div class=\"k-gantt-tables\">\n <table\n class=\"k-gantt-rows\"\n [style.width.px]=\"tableWidth\"\n role=\"presentation\"\n >\n <tbody>\n <tr *ngFor=\"let item of rows; let i = index;\"\n [class.k-alt]=\"i % 2\"\n >\n <td></td>\n </tr>\n </tbody>\n </table>\n\n <table\n #timelineColumns\n class=\"k-gantt-columns\"\n role=\"presentation\"\n [style.width.px]=\"tableWidth\"\n >\n <colgroup>\n <col *ngFor=\"let item of slots\">\n </colgroup>\n\n <tbody>\n <tr>\n <td *ngFor=\"let item of slots\"\n [class.k-nonwork-hour]=\"isNonWorking(item)\"\n >\n </td>\n </tr>\n </tbody>\n </table>\n\n <table\n #tasksContainer\n class=\"k-gantt-tasks\"\n role=\"presentation\"\n style=\"border-collapse: collapse;\"\n [style.width.px]=\"tableWidth\"\n >\n <tbody\n kendoGanttTasksTableBody\n [rows]=\"rows\"\n [activeView]=\"activeView\"\n [taskContentTemplate]=\"taskContentTemplate\"\n [taskTemplate]=\"taskTemplate\"\n [summaryTaskTemplate]=\"summaryTaskTemplate\"\n [taskClass]=\"taskClass\"\n [hasChildren]=\"hasChildren\"\n [isTaskSelected]=\"isTaskSelected\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </tbody>\n </table>\n </div>\n <svg class=\"k-gantt-dependencies-svg\">\n <polyline\n *ngFor=\"let dependency of dependencies\"\n kendoGanttDependency\n [dependency]=\"dependency\"\n />\n <polyline #dependencyDragCreatePolyline />\n </svg>\n\n <!-- placeholder for the dependency drag popup; its position is not arbitrary - the popup is intended to be absolutely positioned inside the .k-grid-content element -->\n <ng-container #dragPopupContainer></ng-container>\n </div>\n </div>\n "
122
164
  }),
123
165
  tslib_1.__metadata("design:paramtypes", [ScrollSyncService,
124
166
  DependencyDomService,