@progress/kendo-angular-gantt 0.2.1-dev.202112091741 → 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 (158) hide show
  1. package/dist/cdn/js/kendo-angular-gantt.js +2 -2
  2. package/dist/cdn/main.js +4 -4
  3. package/dist/es/common/touch-enabled.js +9 -0
  4. package/dist/es/dependencies/utils.js +40 -5
  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/add-task.component.js +94 -0
  8. package/dist/es/editing/dependencies-table.component.js +131 -0
  9. package/dist/es/editing/edit-dialog.component.js +37 -6
  10. package/dist/es/editing/edit.service.js +89 -7
  11. package/dist/es/editing/task-fields.component.js +43 -0
  12. package/dist/es/editing/{util.js → utils.js} +0 -0
  13. package/dist/es/expanded-state/expandable.directive.js +4 -6
  14. package/dist/es/gantt.component.js +230 -45
  15. package/dist/es/gantt.module.js +36 -10
  16. package/dist/es/index.js +8 -1
  17. package/dist/es/localization/gantt-localization.service.js +26 -0
  18. package/dist/es/localization/messages.js +45 -1
  19. package/dist/es/main.js +1 -0
  20. package/dist/es/models/dependency-type.enum.js +16 -0
  21. package/dist/es/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
  22. package/dist/es/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
  23. package/dist/es/models/models.js +1 -0
  24. package/dist/es/models/{events/remove-event.interface.js → toolbar-settings.js} +0 -0
  25. package/dist/es/models/{toolbar-position.js → view-item.interface.js} +0 -0
  26. package/dist/es/package-metadata.js +1 -1
  27. package/dist/es/rendering/gantt-milestone-task.component.js +7 -4
  28. package/dist/es/rendering/gantt-summary-task.component.js +7 -4
  29. package/dist/es/rendering/gantt-task-base.js +30 -19
  30. package/dist/es/rendering/gantt-task.component.js +8 -6
  31. package/dist/es/rendering/gantt-tasks-table-body.component.js +5 -1
  32. package/dist/es/scrolling/drag-scroll-settings.js +20 -0
  33. package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
  34. package/dist/es/scrolling/timeline-scroll.service.js +39 -0
  35. package/dist/es/scrolling/utils.js +80 -0
  36. package/dist/es/timeline/gantt-timeline.component.js +45 -3
  37. package/dist/es/toolbar/toolbar.component.js +9 -1
  38. package/dist/es/utils.js +143 -12
  39. package/dist/es2015/common/touch-enabled.d.ts +9 -0
  40. package/dist/es2015/common/touch-enabled.js +9 -0
  41. package/dist/es2015/dependencies/utils.d.ts +15 -0
  42. package/dist/es2015/dependencies/utils.js +40 -5
  43. package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
  44. package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
  45. package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
  46. package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
  47. package/dist/es2015/editing/add-task.component.d.ts +45 -0
  48. package/dist/es2015/editing/add-task.component.js +102 -0
  49. package/dist/es2015/editing/dependencies-table.component.d.ts +39 -0
  50. package/dist/es2015/editing/dependencies-table.component.js +160 -0
  51. package/dist/es2015/editing/edit-dialog.component.d.ts +10 -3
  52. package/dist/es2015/editing/edit-dialog.component.js +55 -33
  53. package/dist/es2015/editing/edit.service.d.ts +24 -3
  54. package/dist/es2015/editing/edit.service.js +78 -10
  55. package/dist/es2015/editing/task-fields.component.d.ts +22 -0
  56. package/dist/es2015/editing/task-fields.component.js +67 -0
  57. package/dist/es2015/editing/{util.d.ts → utils.d.ts} +0 -0
  58. package/dist/es2015/editing/{util.js → utils.js} +0 -0
  59. package/dist/es2015/expanded-state/expandable.directive.d.ts +1 -2
  60. package/dist/es2015/expanded-state/expandable.directive.js +2 -7
  61. package/dist/es2015/gantt.component.d.ts +62 -18
  62. package/dist/es2015/gantt.component.js +290 -43
  63. package/dist/es2015/gantt.module.js +36 -10
  64. package/dist/es2015/index.d.ts +8 -1
  65. package/dist/es2015/index.js +8 -1
  66. package/dist/es2015/index.metadata.json +1 -1
  67. package/dist/es2015/localization/{treelist-messages.directive.d.ts → gantt-localization.service.d.ts} +4 -3
  68. package/dist/es2015/localization/gantt-localization.service.js +25 -0
  69. package/dist/es2015/localization/messages.d.ts +46 -2
  70. package/dist/es2015/localization/messages.js +45 -1
  71. package/dist/es2015/main.d.ts +1 -0
  72. package/dist/es2015/main.js +1 -0
  73. package/dist/es2015/models/dependency-type.enum.d.ts +1 -1
  74. package/dist/es2015/models/dependency-type.enum.js +16 -0
  75. package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
  76. package/dist/es2015/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
  77. package/dist/es2015/models/events/task-add-event.interface.d.ts +31 -0
  78. package/dist/es2015/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
  79. package/dist/es2015/models/events/task-edit-event.interface.d.ts +17 -4
  80. package/dist/es2015/models/models.d.ts +4 -3
  81. package/dist/es2015/models/models.js +1 -0
  82. package/dist/es2015/models/toolbar-settings.d.ts +29 -0
  83. package/dist/es2015/models/{events/remove-event.interface.js → toolbar-settings.js} +0 -0
  84. package/dist/es2015/models/view-item.interface.d.ts +35 -0
  85. package/dist/es2015/models/{toolbar-position.js → view-item.interface.js} +0 -0
  86. package/dist/es2015/package-metadata.js +1 -1
  87. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +2 -1
  88. package/dist/es2015/rendering/gantt-milestone-task.component.js +18 -5
  89. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +2 -1
  90. package/dist/es2015/rendering/gantt-summary-task.component.js +18 -5
  91. package/dist/es2015/rendering/gantt-task-base.d.ts +11 -5
  92. package/dist/es2015/rendering/gantt-task-base.js +30 -19
  93. package/dist/es2015/rendering/gantt-task.component.d.ts +2 -1
  94. package/dist/es2015/rendering/gantt-task.component.js +19 -7
  95. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +1 -0
  96. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +10 -3
  97. package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
  98. package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
  99. package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
  100. package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
  101. package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
  102. package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
  103. package/dist/es2015/scrolling/utils.d.ts +29 -0
  104. package/dist/es2015/scrolling/utils.js +80 -0
  105. package/dist/es2015/timeline/gantt-timeline.component.d.ts +25 -2
  106. package/dist/es2015/timeline/gantt-timeline.component.js +56 -3
  107. package/dist/es2015/toolbar/toolbar-template.directive.d.ts +1 -1
  108. package/dist/es2015/toolbar/toolbar.component.d.ts +2 -0
  109. package/dist/es2015/toolbar/toolbar.component.js +10 -0
  110. package/dist/es2015/utils.d.ts +70 -8
  111. package/dist/es2015/utils.js +143 -12
  112. package/dist/fesm2015/index.js +1981 -424
  113. package/dist/fesm5/index.js +1784 -391
  114. package/dist/npm/common/touch-enabled.js +11 -0
  115. package/dist/npm/dependencies/utils.js +40 -5
  116. package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
  117. package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
  118. package/dist/npm/editing/add-task.component.js +96 -0
  119. package/dist/npm/editing/dependencies-table.component.js +133 -0
  120. package/dist/npm/editing/edit-dialog.component.js +36 -5
  121. package/dist/npm/editing/edit.service.js +88 -6
  122. package/dist/npm/editing/task-fields.component.js +45 -0
  123. package/dist/npm/editing/{util.js → utils.js} +0 -0
  124. package/dist/npm/expanded-state/expandable.directive.js +3 -5
  125. package/dist/npm/gantt.component.js +231 -46
  126. package/dist/npm/gantt.module.js +34 -8
  127. package/dist/npm/index.js +16 -2
  128. package/dist/npm/localization/gantt-localization.service.js +28 -0
  129. package/dist/npm/localization/messages.js +45 -1
  130. package/dist/npm/main.js +2 -0
  131. package/dist/npm/models/dependency-type.enum.js +16 -0
  132. package/dist/npm/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
  133. package/dist/npm/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
  134. package/dist/npm/models/models.js +2 -0
  135. package/dist/npm/models/{events/remove-event.interface.js → toolbar-settings.js} +0 -0
  136. package/dist/npm/models/{toolbar-position.js → view-item.interface.js} +0 -0
  137. package/dist/npm/package-metadata.js +1 -1
  138. package/dist/npm/rendering/gantt-milestone-task.component.js +6 -3
  139. package/dist/npm/rendering/gantt-summary-task.component.js +6 -3
  140. package/dist/npm/rendering/gantt-task-base.js +30 -19
  141. package/dist/npm/rendering/gantt-task.component.js +7 -5
  142. package/dist/npm/rendering/gantt-tasks-table-body.component.js +5 -1
  143. package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
  144. package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
  145. package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
  146. package/dist/npm/scrolling/utils.js +83 -0
  147. package/dist/npm/timeline/gantt-timeline.component.js +44 -2
  148. package/dist/npm/toolbar/toolbar.component.js +9 -1
  149. package/dist/npm/utils.js +143 -12
  150. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  151. package/package.json +9 -6
  152. package/dist/es/localization/treelist-messages.directive.js +0 -31
  153. package/dist/es2015/localization/treelist-messages.directive.js +0 -29
  154. package/dist/es2015/models/events/add-event.interface.d.ts +0 -16
  155. package/dist/es2015/models/events/edit-event.interface.d.ts +0 -19
  156. package/dist/es2015/models/events/remove-event.interface.d.ts +0 -16
  157. package/dist/es2015/models/toolbar-position.d.ts +0 -9
  158. package/dist/npm/localization/treelist-messages.directive.js +0 -33
@@ -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,
@@ -47,6 +47,14 @@ var ToolbarComponent = /** @class */ (function () {
47
47
  this.gantt.activeViewChange.emit(e);
48
48
  this.scrollSyncService.resetTimelineScrollLeft();
49
49
  };
50
+ tslib_1.__decorate([
51
+ Input(),
52
+ tslib_1.__metadata("design:type", Boolean)
53
+ ], ToolbarComponent.prototype, "showAddTask", void 0);
54
+ tslib_1.__decorate([
55
+ Input(),
56
+ tslib_1.__metadata("design:type", Boolean)
57
+ ], ToolbarComponent.prototype, "showViewSelector", void 0);
50
58
  tslib_1.__decorate([
51
59
  Input(),
52
60
  tslib_1.__metadata("design:type", String),
@@ -55,7 +63,7 @@ var ToolbarComponent = /** @class */ (function () {
55
63
  ToolbarComponent = tslib_1.__decorate([
56
64
  Component({
57
65
  selector: 'kendo-gantt-toolbar',
58
- template: "\n <ng-container *ngIf=\"!renderTemplate\">\n <span class=\"k-spacer k-toolbar-spacer\"></span>\n <kendo-gantt-view-selector\n [views]=\"gantt.viewTypes\"\n [activeView]=\"gantt.activeView\"\n (activeViewChange)=\"onViewChange($event)\"></kendo-gantt-view-selector>\n </ng-container>\n <ng-template\n *ngIf=\"renderTemplate\"\n [ngTemplateOutlet]=\"toolbarTemplateRef\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-template>\n "
66
+ template: "\n <ng-container *ngIf=\"!renderTemplate\">\n <kendo-gantt-add-task *ngIf=\"showAddTask\"></kendo-gantt-add-task>\n <span class=\"k-spacer k-toolbar-spacer\"></span>\n <kendo-gantt-view-selector\n *ngIf=\"showViewSelector\"\n [views]=\"gantt.viewTypes\"\n [activeView]=\"gantt.activeView\"\n (activeViewChange)=\"onViewChange($event)\"></kendo-gantt-view-selector>\n </ng-container>\n <ng-template\n *ngIf=\"renderTemplate\"\n [ngTemplateOutlet]=\"toolbarTemplateRef\"\n [ngTemplateOutletContext]=\"context\"\n >\n </ng-template>\n "
59
67
  }),
60
68
  tslib_1.__metadata("design:paramtypes", [GanttComponent,
61
69
  ScrollSyncService])
package/dist/es/utils.js CHANGED
@@ -4,6 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { isDocumentAvailable, closestInScope, matchesClasses } from '@progress/kendo-angular-common';
6
6
  import { addDays, addWeeks, cloneDate, firstDayInWeek } from '@progress/kendo-date-math';
7
+ import { DependencyType } from './models/dependency-type.enum';
7
8
  /**
8
9
  * @hidden
9
10
  */
@@ -110,24 +111,43 @@ export var isNumber = function (contender) { return typeof contender === 'number
110
111
  * @hidden
111
112
  */
112
113
  export var isString = function (contender) { return typeof contender === 'string'; };
114
+ /**
115
+ * @hidden
116
+ *
117
+ * Gets the closest timeline task wrapper element from an event target.
118
+ * Restricts the search up to the provided parent element from the second param.
119
+ */
120
+ export var getClosestTaskWrapper = function (element, parentScope) {
121
+ return closestInScope(element, matchesClasses('k-task-wrap'), parentScope);
122
+ };
123
+ /**
124
+ * @hidden
125
+ *
126
+ * Checks whether the queried item or its parent items has a `k-task-wrap` selector.
127
+ * Restricts the search up to the provided parent element from the second param.
128
+ */
129
+ export var isTaskWrapper = function (contender, parentScope) {
130
+ var taskWrapper = closestInScope(contender, matchesClasses('k-task-wrap'), parentScope);
131
+ return isPresent(taskWrapper);
132
+ };
113
133
  /**
114
134
  * @hidden
115
135
  *
116
136
  * Gets the closest timeline task element from an event target.
117
- * Restricts the search up to the provided gantt element from the second param.
137
+ * Restricts the search up to the provided parent element from the second param.
118
138
  */
119
- export var getClosestTask = function (element, gantt) {
120
- return closestInScope(element, matchesClasses('k-task'), gantt);
139
+ export var getClosestTask = function (element, parentScope) {
140
+ return closestInScope(element, matchesClasses('k-task'), parentScope);
121
141
  };
122
142
  /**
123
143
  * @hidden
124
144
  *
125
145
  * Gets the closest timeline task element index from an event target.
126
146
  * Uses the `data-task-index` attribute assigned to each task.
127
- * Restricts the search up to the provided gantt element from the second param.
147
+ * Restricts the search up to the provided parent element from the second param.
128
148
  */
129
- export var getClosestTaskIndex = function (element, gantt) {
130
- var task = closestInScope(element, matchesClasses('k-task'), gantt);
149
+ export var getClosestTaskIndex = function (element, parentScope) {
150
+ var task = closestInScope(element, matchesClasses('k-task-wrap'), parentScope);
131
151
  if (!isPresent(task)) {
132
152
  return null;
133
153
  }
@@ -137,19 +157,130 @@ export var getClosestTaskIndex = function (element, gantt) {
137
157
  * @hidden
138
158
  *
139
159
  * Checks whether the queried item or its parent items has a `k-task` selector.
140
- * Restricts the search up to the provided gantt element from the second param.
160
+ * Restricts the search up to the provided parent element from the second param.
141
161
  */
142
- export var isTask = function (contender, gantt) {
143
- var task = closestInScope(contender, matchesClasses('k-task'), gantt);
162
+ export var isTask = function (contender, parentScope) {
163
+ var task = closestInScope(contender, matchesClasses('k-task'), parentScope);
144
164
  return isPresent(task);
145
165
  };
146
166
  /**
147
167
  * @hidden
148
168
  *
149
169
  * Checks whether the queried item or its parent items has a `k-task-actions` selector - used for the clear button.
150
- * Restricts the search up to the provided gantt element from the second param.
170
+ * Restricts the search up to the provided parent element from the second param.
151
171
  */
152
- export var isClearButton = function (contender, gantt) {
153
- var clearButtonContainer = closestInScope(contender, matchesClasses('k-task-actions'), gantt);
172
+ export var isClearButton = function (contender, parentScope) {
173
+ var clearButtonContainer = closestInScope(contender, matchesClasses('k-task-actions'), parentScope);
154
174
  return isPresent(clearButtonContainer);
155
175
  };
176
+ /**
177
+ * @hidden
178
+ *
179
+ * Checks whether the queried item has a `k-task-dot` selector - used for the dependency drag clues.
180
+ */
181
+ export var isDependencyDragClue = function (element) {
182
+ if (!isPresent(element)) {
183
+ return false;
184
+ }
185
+ return element.classList.contains('k-task-dot');
186
+ };
187
+ /**
188
+ * @hidden
189
+ *
190
+ * Checks whether the queried item has a `k-task-dot` & `k-task-start` selector - used for the dependency drag start clues.
191
+ */
192
+ export var isDependencyDragStartClue = function (element) {
193
+ if (!isPresent(element)) {
194
+ return false;
195
+ }
196
+ return element.classList.contains('k-task-dot') && element.classList.contains('k-task-start');
197
+ };
198
+ /**
199
+ * @hidden
200
+ *
201
+ * Gets the `DependencyType` for an attempted dependency create from the provided two elements.
202
+ * The two linked drag clue HTML elements are used to extract this data (via their CSS classes).
203
+ */
204
+ export var getDependencyTypeFromTargetTasks = function (fromTaskClue, toTaskClue) {
205
+ if (!isDependencyDragClue(fromTaskClue) || !isDependencyDragClue(toTaskClue)) {
206
+ return null;
207
+ }
208
+ var fromTaskType = isDependencyDragStartClue(fromTaskClue) ? 'S' : 'F';
209
+ var toTaskType = isDependencyDragStartClue(toTaskClue) ? 'S' : 'F';
210
+ var dependencyTypeName = "" + fromTaskType + toTaskType;
211
+ switch (dependencyTypeName) {
212
+ case 'FF': return DependencyType.FF;
213
+ case 'FS': return DependencyType.FS;
214
+ case 'SF': return DependencyType.SF;
215
+ case 'SS': return DependencyType.SS;
216
+ default: return null;
217
+ }
218
+ };
219
+ /**
220
+ * @hidden
221
+ *
222
+ * Checks whether the two provided drag clues belong to the same task element.
223
+ */
224
+ export var sameTaskClues = function (fromTaskClue, toTaskClue, parentScope) {
225
+ if (!isPresent(fromTaskClue) || !isPresent(toTaskClue)) {
226
+ return false;
227
+ }
228
+ var fromTaskWrapper = getClosestTaskWrapper(fromTaskClue, parentScope);
229
+ var toTaskWrapper = getClosestTaskWrapper(toTaskClue, parentScope);
230
+ return fromTaskWrapper === toTaskWrapper;
231
+ };
232
+ /**
233
+ * @hidden
234
+ *
235
+ * Fits a contender number between a min and max range.
236
+ * If the contender is below the min value, the min value is returned.
237
+ * If the contender is above the max value, the max value is returned.
238
+ */
239
+ export var fitToRange = function (contender, min, max) {
240
+ if (contender > max) {
241
+ return max;
242
+ }
243
+ else if (contender < min) {
244
+ return min;
245
+ }
246
+ else {
247
+ return contender;
248
+ }
249
+ };
250
+ /**
251
+ * @hidden
252
+ *
253
+ * Checks whether either of the two provided tasks is a parent of the other.
254
+ */
255
+ export var areParentChild = function (taskA, taskB) {
256
+ var parentChildRelationship = false;
257
+ var taskAParent = taskA;
258
+ while (isPresent(taskAParent) && isPresent(taskAParent.data)) {
259
+ if (taskAParent.data === taskB.data) {
260
+ parentChildRelationship = true;
261
+ break;
262
+ }
263
+ taskAParent = taskAParent.parent;
264
+ }
265
+ var taskBParent = taskB;
266
+ while (!parentChildRelationship && isPresent(taskBParent) && isPresent(taskBParent.data)) {
267
+ if (taskBParent.data === taskA.data) {
268
+ parentChildRelationship = true;
269
+ break;
270
+ }
271
+ taskBParent = taskBParent.parent;
272
+ }
273
+ return parentChildRelationship;
274
+ };
275
+ /**
276
+ * @hidden
277
+ *
278
+ * Extracts an element from the provided client coords.
279
+ * Using the `event.target` is not reliable under mobile devices with the current implementation of the draggable, so use this instead.
280
+ */
281
+ export var elementFromPoint = function (clientX, clientY) {
282
+ if (!isDocumentAvailable()) {
283
+ return null;
284
+ }
285
+ return document.elementFromPoint(clientX, clientY);
286
+ };
@@ -0,0 +1,9 @@
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 { InjectionToken } from '@angular/core';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export declare const TOUCH_ENABLED: InjectionToken<boolean>;
@@ -0,0 +1,9 @@
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 { InjectionToken } from '@angular/core';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export const TOUCH_ENABLED = new InjectionToken('gantt-touch-enabled');
@@ -36,3 +36,18 @@ export declare const getElementRect: (element: HTMLElement, relativeContainer: H
36
36
  * @hidden
37
37
  */
38
38
  export declare const dependencyCoordinates: (from: Rectangle, to: Rectangle, rowHeight: number, type: DependencyType, minDistanceBeforeTurn: number, arrowSize: number) => Position[];
39
+ /**
40
+ * @hidden
41
+ *
42
+ * Translates the provided client `left` and `top` coords to coords relative to the provided container.
43
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSSOM_View/Coordinate_systems#standard_cssom_coordinate_systems
44
+ */
45
+ export declare const clientToOffsetCoords: (clientLeft: number, clientTop: number, offsetContainer: Element) => Position;
46
+ /**
47
+ * @hidden
48
+ *
49
+ * Retrieves the `left` and `top` values of the center of the provided element.
50
+ * The retrieved values are relative to the current viewport (client values).
51
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSSOM_View/Coordinate_systems#standard_cssom_coordinate_systems
52
+ */
53
+ export declare const getElementClientCenterCoords: (element: Element) => Position;
@@ -2,6 +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 { DependencyType } from '../models/dependency-type.enum';
5
6
  /**
6
7
  * @hidden
7
8
  *
@@ -12,6 +13,9 @@ export const getOffsetRelativeToParent = (element, targetParent) => {
12
13
  top: 0,
13
14
  left: 0
14
15
  };
16
+ if (!targetParent.contains(element)) {
17
+ return offset;
18
+ }
15
19
  let offsetParent = element;
16
20
  while (offsetParent && offsetParent !== targetParent) {
17
21
  offset.top += offsetParent.offsetTop;
@@ -45,9 +49,9 @@ export const dependencyCoordinates = (from, to, rowHeight, type, minDistanceBefo
45
49
  | |
46
50
  [[[]]]- -[[[]]]
47
51
  */
48
- if (type === 0 /* FF */ || type === 3 /* SS */) {
52
+ if (type === DependencyType.FF || type === DependencyType.SS) {
49
53
  // polyline start from first task
50
- const dir = type === 3 /* SS */ ? 'left' : 'right';
54
+ const dir = type === DependencyType.SS ? 'left' : 'right';
51
55
  top = from.top;
52
56
  left = from[dir];
53
57
  points.push({ top, left });
@@ -73,9 +77,9 @@ export const dependencyCoordinates = (from, to, rowHeight, type, minDistanceBefo
73
77
  |
74
78
  -[[[]]]
75
79
  */
76
- const startDir = type === 2 /* SF */ ? 'left' : 'right';
77
- const endDir = type === 2 /* SF */ ? 'right' : 'left';
78
- const additionalTurn = type === 2 /* SF */
80
+ const startDir = type === DependencyType.SF ? 'left' : 'right';
81
+ const endDir = type === DependencyType.SF ? 'right' : 'left';
82
+ const additionalTurn = type === DependencyType.SF
79
83
  ? from[startDir] - minDistanceBeforeTurn * 2 < to[endDir]
80
84
  : from[startDir] + minDistanceBeforeTurn * 2 > to[endDir];
81
85
  // polyline start from first task
@@ -161,4 +165,35 @@ const getArrowEast = (top, left, arrowSize) => {
161
165
  return points;
162
166
  };
163
167
  const ɵ2 = getArrowEast;
168
+ /**
169
+ * @hidden
170
+ *
171
+ * Translates the provided client `left` and `top` coords to coords relative to the provided container.
172
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSSOM_View/Coordinate_systems#standard_cssom_coordinate_systems
173
+ */
174
+ export const clientToOffsetCoords = (clientLeft, clientTop, offsetContainer) => {
175
+ // client (viewport) coordinates of the target container
176
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#value
177
+ const offsetContainerClientRect = offsetContainer.getBoundingClientRect();
178
+ return {
179
+ left: clientLeft - offsetContainerClientRect.left + offsetContainer.scrollLeft,
180
+ top: clientTop - offsetContainerClientRect.top + offsetContainer.scrollTop
181
+ };
182
+ };
183
+ /**
184
+ * @hidden
185
+ *
186
+ * Retrieves the `left` and `top` values of the center of the provided element.
187
+ * The retrieved values are relative to the current viewport (client values).
188
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSSOM_View/Coordinate_systems#standard_cssom_coordinate_systems
189
+ */
190
+ export const getElementClientCenterCoords = (element) => {
191
+ // client (viewport) coordinates of the targeted element
192
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#value
193
+ const { left, top, width, height } = element.getBoundingClientRect();
194
+ return {
195
+ left: left + (width / 2),
196
+ top: top + (height / 2)
197
+ };
198
+ };
164
199
  export { ɵ0, ɵ1, ɵ2 };
@@ -0,0 +1,72 @@
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 { AfterViewInit, NgZone, OnDestroy, Renderer2 } from '@angular/core';
6
+ import { PopupService } from '@progress/kendo-angular-popup';
7
+ import { GanttComponent } from '../gantt.component';
8
+ import { MappingService } from '../common/mapping.service';
9
+ import { TimelineScrollService } from '../scrolling/timeline-scroll.service';
10
+ /**
11
+ * A directive which enables the creation of new dependencies via dragging.
12
+ */
13
+ export declare class DependencyDragCreateDirective implements AfterViewInit, OnDestroy {
14
+ private gantt;
15
+ private zone;
16
+ private renderer;
17
+ private mapper;
18
+ private popupService;
19
+ private timelineScrollService;
20
+ /**
21
+ * Specifies whether the validation tooltip will be displayed during drag operations.
22
+ *
23
+ * @default true
24
+ */
25
+ displayValidationTooltip: boolean;
26
+ private readonly container;
27
+ private readonly polyline;
28
+ private readonly popupContainer;
29
+ /**
30
+ * Points to the drag clue where the dragging started (the FROM task).
31
+ * Used to attach/detach classes to the target element and its task wrapper parent element.
32
+ */
33
+ private fromTaskClue;
34
+ /**
35
+ * The drag start element coords will be the same through the enitre dragging session, so compute them on press and cache them.
36
+ */
37
+ private polylineStartCoords;
38
+ /**
39
+ * Stored during dragging to be consumed by the container scroll subscription.
40
+ * The scroll event doesn't expose the current pointer position, so it has to be stored separately.
41
+ */
42
+ private currentPointerClientCoords;
43
+ private scrollListenerDisposer;
44
+ private dragPopup;
45
+ private dragSubscriptions;
46
+ constructor(gantt: GanttComponent, zone: NgZone, renderer: Renderer2, mapper: MappingService, popupService: PopupService, timelineScrollService: TimelineScrollService);
47
+ ngAfterViewInit(): void;
48
+ ngOnDestroy(): void;
49
+ private subscribeDraggable;
50
+ private unsubscribeDraggable;
51
+ private handlePress;
52
+ private handleDrag;
53
+ private handleRelease;
54
+ private updatePolyline;
55
+ private clearPolyline;
56
+ private assignDragStartClasses;
57
+ private removeDragStartClasses;
58
+ private scrollPointIntoView;
59
+ private cancelScroll;
60
+ private addScrollListener;
61
+ private removeScrollListener;
62
+ private openDragPopup;
63
+ private updateDragPopup;
64
+ private closeDragPopup;
65
+ private extractTaskName;
66
+ private getTooltipContext;
67
+ /**
68
+ * Restricts the popup position to not go below the scroll height or width of the container.
69
+ * Flips the position of the popup when there's not enough vertical space in the visible part of the container to render the popup.
70
+ */
71
+ private normalizePopupPosition;
72
+ }