@progress/kendo-angular-gantt 0.2.1-dev.202112101349 → 0.3.0-dev.202201190830

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 (171) 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 +39 -8
  10. package/dist/es/editing/edit.service.js +92 -8
  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/gantt.component.js +408 -56
  14. package/dist/es/gantt.module.js +37 -9
  15. package/dist/es/index.js +9 -0
  16. package/dist/es/localization/gantt-localization.service.js +26 -0
  17. package/dist/es/localization/messages.js +45 -1
  18. package/dist/es/main.js +1 -0
  19. package/dist/es/models/dependency-type.enum.js +16 -0
  20. package/dist/es/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
  21. package/dist/es/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
  22. package/dist/es/models/events/{remove-event.interface.js → task-delete-event.interface.js} +0 -0
  23. package/dist/es/models/models.js +1 -0
  24. package/dist/es/models/{toolbar-position.js → toolbar-settings.js} +0 -0
  25. package/dist/{es2015/models/events/add-event.interface.js → es/models/view-item.interface.js} +0 -0
  26. package/dist/{es2015/models/events/edit-event.interface.js → es/navigation/navigation-models.js} +0 -0
  27. package/dist/es/navigation/navigation.service.js +390 -0
  28. package/dist/es/navigation/utils.js +77 -0
  29. package/dist/es/package-metadata.js +1 -1
  30. package/dist/es/rendering/gantt-milestone-task.component.js +12 -6
  31. package/dist/es/rendering/gantt-summary-task.component.js +27 -6
  32. package/dist/es/rendering/gantt-task-base.js +84 -22
  33. package/dist/es/rendering/gantt-task.component.js +13 -8
  34. package/dist/es/rendering/gantt-tasks-table-body.component.js +13 -5
  35. package/dist/es/scrolling/drag-scroll-settings.js +20 -0
  36. package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
  37. package/dist/es/scrolling/timeline-scroll.service.js +39 -0
  38. package/dist/es/scrolling/utils.js +80 -0
  39. package/dist/es/timeline/gantt-timeline.component.js +50 -4
  40. package/dist/es/toolbar/toolbar.component.js +20 -13
  41. package/dist/es/toolbar/view-selector.component.js +1 -1
  42. package/dist/es/utils.js +153 -12
  43. package/dist/es2015/common/touch-enabled.d.ts +9 -0
  44. package/dist/es2015/common/touch-enabled.js +9 -0
  45. package/dist/es2015/dependencies/utils.d.ts +15 -0
  46. package/dist/es2015/dependencies/utils.js +40 -5
  47. package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
  48. package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
  49. package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
  50. package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
  51. package/dist/es2015/editing/add-task.component.d.ts +45 -0
  52. package/dist/es2015/editing/add-task.component.js +102 -0
  53. package/dist/es2015/editing/dependencies-table.component.d.ts +39 -0
  54. package/dist/es2015/editing/dependencies-table.component.js +160 -0
  55. package/dist/es2015/editing/edit-dialog.component.d.ts +11 -4
  56. package/dist/es2015/editing/edit-dialog.component.js +66 -36
  57. package/dist/es2015/editing/edit.service.d.ts +24 -4
  58. package/dist/es2015/editing/edit.service.js +81 -11
  59. package/dist/es2015/editing/task-fields.component.d.ts +22 -0
  60. package/dist/es2015/editing/task-fields.component.js +67 -0
  61. package/dist/es2015/editing/{util.d.ts → utils.d.ts} +2 -2
  62. package/dist/es2015/editing/{util.js → utils.js} +0 -0
  63. package/dist/es2015/gantt.component.d.ts +134 -31
  64. package/dist/es2015/gantt.component.js +419 -61
  65. package/dist/es2015/gantt.module.js +37 -9
  66. package/dist/es2015/index.d.ts +9 -0
  67. package/dist/es2015/index.js +9 -0
  68. package/dist/es2015/index.metadata.json +1 -1
  69. package/dist/es2015/{models/events/edit-event.interface.d.ts → localization/gantt-localization.service.d.ts} +6 -10
  70. package/dist/es2015/localization/gantt-localization.service.js +25 -0
  71. package/dist/es2015/localization/messages.d.ts +46 -2
  72. package/dist/es2015/localization/messages.js +45 -1
  73. package/dist/es2015/main.d.ts +1 -0
  74. package/dist/es2015/main.js +1 -0
  75. package/dist/es2015/models/dependency-type.enum.d.ts +1 -1
  76. package/dist/es2015/models/dependency-type.enum.js +16 -0
  77. package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
  78. package/dist/es2015/models/events/{remove-event.interface.js → dependency-add-event.interface.js} +0 -0
  79. package/dist/es2015/models/events/task-add-event.interface.d.ts +31 -0
  80. package/dist/es2015/models/{toolbar-position.js → events/task-add-event.interface.js} +0 -0
  81. package/dist/es2015/models/events/task-click-event.interface.d.ts +3 -3
  82. package/dist/es2015/models/events/task-delete-event.interface.d.ts +21 -0
  83. package/dist/es2015/models/events/task-delete-event.interface.js +4 -0
  84. package/dist/es2015/models/events/task-edit-event.interface.d.ts +36 -6
  85. package/dist/es2015/models/models.d.ts +6 -3
  86. package/dist/es2015/models/models.js +1 -0
  87. package/dist/es2015/models/toolbar-settings.d.ts +29 -0
  88. package/dist/es2015/models/toolbar-settings.js +4 -0
  89. package/dist/es2015/models/view-item.interface.d.ts +35 -0
  90. package/dist/es2015/models/view-item.interface.js +4 -0
  91. package/dist/es2015/navigation/navigation-models.d.ts +34 -0
  92. package/dist/es2015/navigation/navigation-models.js +4 -0
  93. package/dist/es2015/navigation/navigation.service.d.ts +126 -0
  94. package/dist/es2015/navigation/navigation.service.js +355 -0
  95. package/dist/es2015/navigation/utils.d.ts +26 -0
  96. package/dist/es2015/navigation/utils.js +69 -0
  97. package/dist/es2015/package-metadata.js +1 -1
  98. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +3 -1
  99. package/dist/es2015/rendering/gantt-milestone-task.component.js +35 -8
  100. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +5 -1
  101. package/dist/es2015/rendering/gantt-summary-task.component.js +47 -8
  102. package/dist/es2015/rendering/gantt-task-base.d.ts +20 -6
  103. package/dist/es2015/rendering/gantt-task-base.js +75 -22
  104. package/dist/es2015/rendering/gantt-task.component.d.ts +4 -2
  105. package/dist/es2015/rendering/gantt-task.component.js +47 -13
  106. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +6 -3
  107. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +27 -9
  108. package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
  109. package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
  110. package/dist/es2015/scrolling/scroll-sync.service.d.ts +1 -1
  111. package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
  112. package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
  113. package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
  114. package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
  115. package/dist/es2015/scrolling/utils.d.ts +29 -0
  116. package/dist/es2015/scrolling/utils.js +80 -0
  117. package/dist/es2015/timeline/gantt-timeline.component.d.ts +29 -4
  118. package/dist/es2015/timeline/gantt-timeline.component.js +67 -5
  119. package/dist/es2015/toolbar/toolbar-template.directive.d.ts +1 -1
  120. package/dist/es2015/toolbar/toolbar.component.d.ts +6 -5
  121. package/dist/es2015/toolbar/toolbar.component.js +22 -13
  122. package/dist/es2015/toolbar/view-selector.component.js +3 -1
  123. package/dist/es2015/utils.d.ts +77 -8
  124. package/dist/es2015/utils.js +153 -12
  125. package/dist/fesm2015/index.js +5258 -3012
  126. package/dist/fesm5/index.js +2862 -733
  127. package/dist/npm/common/touch-enabled.js +11 -0
  128. package/dist/npm/dependencies/utils.js +40 -5
  129. package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
  130. package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
  131. package/dist/npm/editing/add-task.component.js +96 -0
  132. package/dist/npm/editing/dependencies-table.component.js +133 -0
  133. package/dist/npm/editing/edit-dialog.component.js +38 -7
  134. package/dist/npm/editing/edit.service.js +91 -7
  135. package/dist/npm/editing/task-fields.component.js +45 -0
  136. package/dist/npm/editing/{util.js → utils.js} +0 -0
  137. package/dist/npm/gantt.component.js +409 -57
  138. package/dist/npm/gantt.module.js +35 -7
  139. package/dist/npm/index.js +18 -0
  140. package/dist/npm/localization/gantt-localization.service.js +28 -0
  141. package/dist/npm/localization/messages.js +45 -1
  142. package/dist/npm/main.js +2 -0
  143. package/dist/npm/models/dependency-type.enum.js +16 -0
  144. package/dist/npm/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
  145. package/dist/npm/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
  146. package/dist/npm/models/events/{remove-event.interface.js → task-delete-event.interface.js} +0 -0
  147. package/dist/npm/models/models.js +2 -0
  148. package/dist/npm/models/{toolbar-position.js → toolbar-settings.js} +0 -0
  149. package/dist/npm/models/view-item.interface.js +6 -0
  150. package/dist/npm/navigation/navigation-models.js +6 -0
  151. package/dist/npm/navigation/navigation.service.js +392 -0
  152. package/dist/npm/navigation/utils.js +79 -0
  153. package/dist/npm/package-metadata.js +1 -1
  154. package/dist/npm/rendering/gantt-milestone-task.component.js +11 -5
  155. package/dist/npm/rendering/gantt-summary-task.component.js +26 -5
  156. package/dist/npm/rendering/gantt-task-base.js +84 -22
  157. package/dist/npm/rendering/gantt-task.component.js +12 -7
  158. package/dist/npm/rendering/gantt-tasks-table-body.component.js +13 -5
  159. package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
  160. package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
  161. package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
  162. package/dist/npm/scrolling/utils.js +83 -0
  163. package/dist/npm/timeline/gantt-timeline.component.js +49 -3
  164. package/dist/npm/toolbar/toolbar.component.js +18 -11
  165. package/dist/npm/toolbar/view-selector.component.js +1 -1
  166. package/dist/npm/utils.js +153 -12
  167. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  168. package/package.json +7 -4
  169. package/dist/es2015/models/events/add-event.interface.d.ts +0 -16
  170. package/dist/es2015/models/events/remove-event.interface.d.ts +0 -16
  171. package/dist/es2015/models/toolbar-position.d.ts +0 -9
@@ -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)
@@ -103,6 +125,18 @@ var GanttTimelineComponent = /** @class */ (function () {
103
125
  Input(),
104
126
  tslib_1.__metadata("design:type", Function)
105
127
  ], GanttTimelineComponent.prototype, "taskClass", void 0);
128
+ tslib_1.__decorate([
129
+ Input(),
130
+ tslib_1.__metadata("design:type", Boolean)
131
+ ], GanttTimelineComponent.prototype, "renderDependencyDragClues", void 0);
132
+ tslib_1.__decorate([
133
+ Input(),
134
+ tslib_1.__metadata("design:type", Object)
135
+ ], GanttTimelineComponent.prototype, "dragScrollSettings", void 0);
136
+ tslib_1.__decorate([
137
+ Input(),
138
+ tslib_1.__metadata("design:type", Boolean)
139
+ ], GanttTimelineComponent.prototype, "selectable", void 0);
106
140
  tslib_1.__decorate([
107
141
  Input(),
108
142
  tslib_1.__metadata("design:type", Function)
@@ -110,15 +144,27 @@ var GanttTimelineComponent = /** @class */ (function () {
110
144
  tslib_1.__decorate([
111
145
  Input(),
112
146
  tslib_1.__metadata("design:type", Function)
113
- ], GanttTimelineComponent.prototype, "hasChildren", void 0);
147
+ ], GanttTimelineComponent.prototype, "isExpanded", void 0);
114
148
  tslib_1.__decorate([
115
149
  Input(),
116
150
  tslib_1.__metadata("design:type", Array)
117
151
  ], GanttTimelineComponent.prototype, "dependencies", void 0);
152
+ tslib_1.__decorate([
153
+ Output(),
154
+ tslib_1.__metadata("design:type", EventEmitter)
155
+ ], GanttTimelineComponent.prototype, "timelineContainerPress", void 0);
156
+ tslib_1.__decorate([
157
+ Output(),
158
+ tslib_1.__metadata("design:type", EventEmitter)
159
+ ], GanttTimelineComponent.prototype, "timelineContainerDrag", void 0);
160
+ tslib_1.__decorate([
161
+ Output(),
162
+ tslib_1.__metadata("design:type", EventEmitter)
163
+ ], GanttTimelineComponent.prototype, "timelineContainerRelease", void 0);
118
164
  GanttTimelineComponent = tslib_1.__decorate([
119
165
  Component({
120
166
  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 "
167
+ 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 <!-- tabindex=\"-1\" required for https://bugzilla.mozilla.org/show_bug.cgi?id=1069739 -->\n <div\n #timelineContent\n class=\"k-grid-content\"\n tabindex=\"-1\"\n role=\"tree\"\n aria-roledescription=\"Timeline\"\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 [isExpanded]=\"isExpanded\"\n [selectable]=\"selectable\"\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
168
  }),
123
169
  tslib_1.__metadata("design:paramtypes", [ScrollSyncService,
124
170
  DependencyDomService,
@@ -3,17 +3,16 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
- import { Component, Input } from '@angular/core';
7
- import { GanttComponent } from "../gantt.component";
8
- import { ScrollSyncService } from '../scrolling/scroll-sync.service';
6
+ import { Component, Input, HostBinding } from '@angular/core';
7
+ import { GanttComponent } from '../gantt.component';
9
8
  /**
10
9
  * @hidden
11
10
  */
12
11
  var ToolbarComponent = /** @class */ (function () {
13
- function ToolbarComponent(gantt, scrollSyncService) {
12
+ function ToolbarComponent(gantt) {
14
13
  this.gantt = gantt;
15
- this.scrollSyncService = scrollSyncService;
16
14
  this.context = {};
15
+ this.role = 'toolbar';
17
16
  }
18
17
  Object.defineProperty(ToolbarComponent.prototype, "position", {
19
18
  get: function () {
@@ -41,12 +40,21 @@ var ToolbarComponent = /** @class */ (function () {
41
40
  enumerable: true,
42
41
  configurable: true
43
42
  });
44
- ToolbarComponent.prototype.onViewChange = function (e) {
45
- this.gantt.activeView = e; // TODO: may be load the timeline data directly in an activeView setter?
46
- this.gantt.loadTimelineData();
47
- this.gantt.activeViewChange.emit(e);
48
- this.scrollSyncService.resetTimelineScrollLeft();
43
+ ToolbarComponent.prototype.handleViewChange = function (view) {
44
+ this.gantt.changeActiveView(view);
49
45
  };
46
+ tslib_1.__decorate([
47
+ HostBinding('attr.role'),
48
+ tslib_1.__metadata("design:type", String)
49
+ ], ToolbarComponent.prototype, "role", void 0);
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,10 +63,9 @@ 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)=\"handleViewChange($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
- tslib_1.__metadata("design:paramtypes", [GanttComponent,
61
- ScrollSyncService])
68
+ tslib_1.__metadata("design:paramtypes", [GanttComponent])
62
69
  ], ToolbarComponent);
63
70
  return ToolbarComponent;
64
71
  }());
@@ -55,7 +55,7 @@ var ViewSelectorComponent = /** @class */ (function () {
55
55
  ViewSelectorComponent = tslib_1.__decorate([
56
56
  Component({
57
57
  selector: 'kendo-gantt-view-selector',
58
- template: "\n <select class=\"k-dropdown k-views-dropdown\"\n [value]=\"activeView\"\n (change)=\"activeViewChange.emit($event.target.value)\">\n <option *ngFor=\"let view of views\" [value]=\"view\">{{getViewTypeText(view)}}</option>\n </select>\n <kendo-buttongroup class=\"k-gantt-views\" selection=\"single\">\n <button *ngFor=\"let view of views\"\n kendoButton\n type=\"button\"\n [selected]=\"view === activeView\"\n (click)=\"onClick(view)\">{{getViewTypeText(view)}}</button>\n </kendo-buttongroup>\n "
58
+ template: "\n <select\n class=\"k-dropdown k-views-dropdown\"\n aria-label=\"View Selector\"\n [value]=\"activeView\"\n (change)=\"activeViewChange.emit($event.target.value)\">\n <option *ngFor=\"let view of views\" [value]=\"view\">{{getViewTypeText(view)}}</option>\n </select>\n <kendo-buttongroup class=\"k-gantt-views\" selection=\"single\">\n <button *ngFor=\"let view of views\"\n kendoButton\n type=\"button\"\n [selected]=\"view === activeView\"\n (click)=\"onClick(view)\">{{getViewTypeText(view)}}</button>\n </kendo-buttongroup>\n "
59
59
  }),
60
60
  tslib_1.__metadata("design:paramtypes", [LocalizationService])
61
61
  ], ViewSelectorComponent);
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,140 @@ 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
  };
166
+ /**
167
+ * @hidden
168
+ *
169
+ * Checks whether the queried item or its parent items has a `k-toolbar` selector.
170
+ * Restricts the search up to the provided parent element from the second param.
171
+ */
172
+ export var isToolbar = function (contender, parentScope) {
173
+ var toolbar = closestInScope(contender, matchesClasses('k-gantt-toolbar'), parentScope);
174
+ return isPresent(toolbar);
175
+ };
146
176
  /**
147
177
  * @hidden
148
178
  *
149
179
  * 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.
180
+ * Restricts the search up to the provided parent element from the second param.
151
181
  */
152
- export var isClearButton = function (contender, gantt) {
153
- var clearButtonContainer = closestInScope(contender, matchesClasses('k-task-actions'), gantt);
182
+ export var isClearButton = function (contender, parentScope) {
183
+ var clearButtonContainer = closestInScope(contender, matchesClasses('k-task-actions'), parentScope);
154
184
  return isPresent(clearButtonContainer);
155
185
  };
186
+ /**
187
+ * @hidden
188
+ *
189
+ * Checks whether the queried item has a `k-task-dot` selector - used for the dependency drag clues.
190
+ */
191
+ export var isDependencyDragClue = function (element) {
192
+ if (!isPresent(element)) {
193
+ return false;
194
+ }
195
+ return element.classList.contains('k-task-dot');
196
+ };
197
+ /**
198
+ * @hidden
199
+ *
200
+ * Checks whether the queried item has a `k-task-dot` & `k-task-start` selector - used for the dependency drag start clues.
201
+ */
202
+ export var isDependencyDragStartClue = function (element) {
203
+ if (!isPresent(element)) {
204
+ return false;
205
+ }
206
+ return element.classList.contains('k-task-dot') && element.classList.contains('k-task-start');
207
+ };
208
+ /**
209
+ * @hidden
210
+ *
211
+ * Gets the `DependencyType` for an attempted dependency create from the provided two elements.
212
+ * The two linked drag clue HTML elements are used to extract this data (via their CSS classes).
213
+ */
214
+ export var getDependencyTypeFromTargetTasks = function (fromTaskClue, toTaskClue) {
215
+ if (!isDependencyDragClue(fromTaskClue) || !isDependencyDragClue(toTaskClue)) {
216
+ return null;
217
+ }
218
+ var fromTaskType = isDependencyDragStartClue(fromTaskClue) ? 'S' : 'F';
219
+ var toTaskType = isDependencyDragStartClue(toTaskClue) ? 'S' : 'F';
220
+ var dependencyTypeName = "" + fromTaskType + toTaskType;
221
+ switch (dependencyTypeName) {
222
+ case 'FF': return DependencyType.FF;
223
+ case 'FS': return DependencyType.FS;
224
+ case 'SF': return DependencyType.SF;
225
+ case 'SS': return DependencyType.SS;
226
+ default: return null;
227
+ }
228
+ };
229
+ /**
230
+ * @hidden
231
+ *
232
+ * Checks whether the two provided drag clues belong to the same task element.
233
+ */
234
+ export var sameTaskClues = function (fromTaskClue, toTaskClue, parentScope) {
235
+ if (!isPresent(fromTaskClue) || !isPresent(toTaskClue)) {
236
+ return false;
237
+ }
238
+ var fromTaskWrapper = getClosestTaskWrapper(fromTaskClue, parentScope);
239
+ var toTaskWrapper = getClosestTaskWrapper(toTaskClue, parentScope);
240
+ return fromTaskWrapper === toTaskWrapper;
241
+ };
242
+ /**
243
+ * @hidden
244
+ *
245
+ * Fits a contender number between a min and max range.
246
+ * If the contender is below the min value, the min value is returned.
247
+ * If the contender is above the max value, the max value is returned.
248
+ */
249
+ export var fitToRange = function (contender, min, max) {
250
+ if (!isPresent(contender) || contender < min) {
251
+ return min;
252
+ }
253
+ else if (contender > max) {
254
+ return max;
255
+ }
256
+ else {
257
+ return contender;
258
+ }
259
+ };
260
+ /**
261
+ * @hidden
262
+ *
263
+ * Checks whether either of the two provided tasks is a parent of the other.
264
+ */
265
+ export var areParentChild = function (taskA, taskB) {
266
+ var parentChildRelationship = false;
267
+ var taskAParent = taskA;
268
+ while (isPresent(taskAParent) && isPresent(taskAParent.data)) {
269
+ if (taskAParent.data === taskB.data) {
270
+ parentChildRelationship = true;
271
+ break;
272
+ }
273
+ taskAParent = taskAParent.parent;
274
+ }
275
+ var taskBParent = taskB;
276
+ while (!parentChildRelationship && isPresent(taskBParent) && isPresent(taskBParent.data)) {
277
+ if (taskBParent.data === taskA.data) {
278
+ parentChildRelationship = true;
279
+ break;
280
+ }
281
+ taskBParent = taskBParent.parent;
282
+ }
283
+ return parentChildRelationship;
284
+ };
285
+ /**
286
+ * @hidden
287
+ *
288
+ * Extracts an element from the provided client coords.
289
+ * Using the `event.target` is not reliable under mobile devices with the current implementation of the draggable, so use this instead.
290
+ */
291
+ export var elementFromPoint = function (clientX, clientY) {
292
+ if (!isDocumentAvailable()) {
293
+ return null;
294
+ }
295
+ return document.elementFromPoint(clientX, clientY);
296
+ };
@@ -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 };