@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,83 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
8
+ var drag_scroll_settings_1 = require("./drag-scroll-settings");
9
+ var utils_1 = require("../utils");
10
+ /**
11
+ * @hidden
12
+ *
13
+ * Checks if the beginning of the scrollable element is reached (top/left).
14
+ * Floors the top value.
15
+ */
16
+ var isUpperLimitReached = function (element, axis) { return Math.floor(element[axis]) <= 0; };
17
+ var ɵ0 = isUpperLimitReached;
18
+ exports.ɵ0 = ɵ0;
19
+ /**
20
+ * @hidden
21
+ *
22
+ * Checks if the end of the scrollable element is reached (bottom/right).
23
+ * Ceils the top value.
24
+ */
25
+ var isBottomLimitReached = function (element, axis) {
26
+ var elementSize = axis === drag_scroll_settings_1.ScrollAxis.Horizontal ?
27
+ element.scrollWidth - element.clientWidth :
28
+ element.scrollHeight - element.clientHeight;
29
+ return Math.ceil(element[axis]) >= elementSize;
30
+ };
31
+ var ɵ1 = isBottomLimitReached;
32
+ exports.ɵ1 = ɵ1;
33
+ /**
34
+ * @hidden
35
+ *
36
+ * Scrolls the element in the given direction by the provided step in the provided scroll axis.
37
+ *
38
+ * If the targeted scroll incrementation doesn't yield any result due to device pixel ratio issues (https://github.com/dimitar-pechev/RenderingIndependentScrollOffsets#readme),
39
+ * increments the step with 1px and again attempts to change the scrollTop of the element, until the content is actually scrolled.
40
+ *
41
+ * Cuts the operation short after 20 unsuccessful attempts to prevent infinite loops in possible corner-case scenarios.
42
+ */
43
+ exports.scrollElement = function (element, step, direction, scrollAxis) {
44
+ if (!(utils_1.isPresent(element) && kendo_angular_common_1.isDocumentAvailable())) {
45
+ return;
46
+ }
47
+ var initialScrollPosition = element[scrollAxis];
48
+ var currentStep = step;
49
+ var iterations = 0;
50
+ while (initialScrollPosition === element[scrollAxis] &&
51
+ !(direction === drag_scroll_settings_1.ScrollDirection.Backwards && isUpperLimitReached(element, scrollAxis)) &&
52
+ !(direction === drag_scroll_settings_1.ScrollDirection.Forward && isBottomLimitReached(element, scrollAxis)) &&
53
+ iterations < 20 // cut the operation short in 20 attempts - in case of a wild corner case
54
+ ) {
55
+ element[scrollAxis] += (currentStep * direction);
56
+ // try with a larger step if the current one doesn't update the scroll position successfully
57
+ currentStep += 1;
58
+ iterations += 1;
59
+ }
60
+ };
61
+ /**
62
+ * @hidden
63
+ *
64
+ * 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,
65
+ * this function extracts the visible boundaries of the provided element - fall-backing to 0 when the top/left are below 0,
66
+ * and fall-backing to the actual visible size of the container for bottom/right.
67
+ */
68
+ exports.getViewportBoundaries = function (element) {
69
+ var elementRect = element.getBoundingClientRect();
70
+ // if the beginning of the scrollable container is above/before the current viewport, fall-back to 0
71
+ var topLimit = Math.max(elementRect.top, 0);
72
+ var leftLimit = Math.max(elementRect.left, 0);
73
+ // if the end of the scrollable container is beneath/after the current viewport, fall-back to its client height
74
+ // 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
75
+ var bottomLimit = topLimit + Math.min(elementRect.bottom, element.clientHeight);
76
+ var rightLimit = leftLimit + Math.min(elementRect.right, element.clientWidth);
77
+ return {
78
+ top: topLimit,
79
+ bottom: bottomLimit,
80
+ left: leftLimit,
81
+ right: rightLimit
82
+ };
83
+ };
@@ -8,10 +8,10 @@ var tslib_1 = require("tslib");
8
8
  var core_1 = require("@angular/core");
9
9
  var rxjs_1 = require("rxjs");
10
10
  var operators_1 = require("rxjs/operators");
11
+ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
11
12
  var scroll_sync_service_1 = require("../scrolling/scroll-sync.service");
12
13
  var dependency_dom_service_1 = require("../dependencies/dependency-dom.service");
13
14
  var utils_1 = require("../utils");
14
- var kendo_angular_common_1 = require("@progress/kendo-angular-common");
15
15
  /**
16
16
  * @hidden
17
17
  */
@@ -24,6 +24,10 @@ var GanttTimelineComponent = /** @class */ (function () {
24
24
  this.zone = zone;
25
25
  this.hostClass = true;
26
26
  this.dependencies = [];
27
+ // as all drag-and-drop operations are on the timeline container, use a single draggable instance
28
+ this.timelineContainerPress = new core_1.EventEmitter();
29
+ this.timelineContainerDrag = new core_1.EventEmitter();
30
+ this.timelineContainerRelease = new core_1.EventEmitter();
27
31
  this.subscriptions = new rxjs_1.Subscription();
28
32
  this.subscriptions.add(
29
33
  // task changes indicates change in row content, number, height, etc.
@@ -36,6 +40,16 @@ var GanttTimelineComponent = /** @class */ (function () {
36
40
  _this.renderer.setStyle(_this.timelineColumns.nativeElement, 'height', (_this.rows || []).length * timelineRowHeight + "px");
37
41
  }));
38
42
  }
43
+ Object.defineProperty(GanttTimelineComponent.prototype, "draggableEnabled", {
44
+ /**
45
+ * Specifies whether the draggable will attach or detach its pointer event listeners.
46
+ */
47
+ get: function () {
48
+ return this.renderDependencyDragClues;
49
+ },
50
+ enumerable: true,
51
+ configurable: true
52
+ });
39
53
  GanttTimelineComponent.prototype.ngAfterViewInit = function () {
40
54
  var timelineHeader = this.timelineHeaderWrap.nativeElement;
41
55
  var rightContainer = this.timelineContent.nativeElement;
@@ -65,6 +79,14 @@ var GanttTimelineComponent = /** @class */ (function () {
65
79
  core_1.ViewChild('tasksContainer', { static: true }),
66
80
  tslib_1.__metadata("design:type", core_1.ElementRef)
67
81
  ], GanttTimelineComponent.prototype, "tasksContainer", void 0);
82
+ tslib_1.__decorate([
83
+ core_1.ViewChild('dragPopupContainer', { static: false, read: core_1.ViewContainerRef }),
84
+ tslib_1.__metadata("design:type", core_1.ViewContainerRef)
85
+ ], GanttTimelineComponent.prototype, "dragPopupContainer", void 0);
86
+ tslib_1.__decorate([
87
+ core_1.ViewChild('dependencyDragCreatePolyline', { static: false }),
88
+ tslib_1.__metadata("design:type", core_1.ElementRef)
89
+ ], GanttTimelineComponent.prototype, "dependencyDragCreatePolyline", void 0);
68
90
  tslib_1.__decorate([
69
91
  core_1.HostBinding('class.k-gantt-timeline'),
70
92
  tslib_1.__metadata("design:type", Boolean)
@@ -109,6 +131,14 @@ var GanttTimelineComponent = /** @class */ (function () {
109
131
  core_1.Input(),
110
132
  tslib_1.__metadata("design:type", Function)
111
133
  ], GanttTimelineComponent.prototype, "isTaskSelected", void 0);
134
+ tslib_1.__decorate([
135
+ core_1.Input(),
136
+ tslib_1.__metadata("design:type", Boolean)
137
+ ], GanttTimelineComponent.prototype, "renderDependencyDragClues", void 0);
138
+ tslib_1.__decorate([
139
+ core_1.Input(),
140
+ tslib_1.__metadata("design:type", Object)
141
+ ], GanttTimelineComponent.prototype, "dragScrollSettings", void 0);
112
142
  tslib_1.__decorate([
113
143
  core_1.Input(),
114
144
  tslib_1.__metadata("design:type", Function)
@@ -117,10 +147,22 @@ var GanttTimelineComponent = /** @class */ (function () {
117
147
  core_1.Input(),
118
148
  tslib_1.__metadata("design:type", Array)
119
149
  ], GanttTimelineComponent.prototype, "dependencies", void 0);
150
+ tslib_1.__decorate([
151
+ core_1.Output(),
152
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
153
+ ], GanttTimelineComponent.prototype, "timelineContainerPress", void 0);
154
+ tslib_1.__decorate([
155
+ core_1.Output(),
156
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
157
+ ], GanttTimelineComponent.prototype, "timelineContainerDrag", void 0);
158
+ tslib_1.__decorate([
159
+ core_1.Output(),
160
+ tslib_1.__metadata("design:type", core_1.EventEmitter)
161
+ ], GanttTimelineComponent.prototype, "timelineContainerRelease", void 0);
120
162
  GanttTimelineComponent = tslib_1.__decorate([
121
163
  core_1.Component({
122
164
  selector: 'kendo-gantt-timeline',
123
- 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 "
165
+ 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 "
124
166
  }),
125
167
  tslib_1.__metadata("design:paramtypes", [scroll_sync_service_1.ScrollSyncService,
126
168
  dependency_dom_service_1.DependencyDomService,
@@ -49,6 +49,14 @@ var ToolbarComponent = /** @class */ (function () {
49
49
  this.gantt.activeViewChange.emit(e);
50
50
  this.scrollSyncService.resetTimelineScrollLeft();
51
51
  };
52
+ tslib_1.__decorate([
53
+ core_1.Input(),
54
+ tslib_1.__metadata("design:type", Boolean)
55
+ ], ToolbarComponent.prototype, "showAddTask", void 0);
56
+ tslib_1.__decorate([
57
+ core_1.Input(),
58
+ tslib_1.__metadata("design:type", Boolean)
59
+ ], ToolbarComponent.prototype, "showViewSelector", void 0);
52
60
  tslib_1.__decorate([
53
61
  core_1.Input(),
54
62
  tslib_1.__metadata("design:type", String),
@@ -57,7 +65,7 @@ var ToolbarComponent = /** @class */ (function () {
57
65
  ToolbarComponent = tslib_1.__decorate([
58
66
  core_1.Component({
59
67
  selector: 'kendo-gantt-toolbar',
60
- 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 "
68
+ 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 "
61
69
  }),
62
70
  tslib_1.__metadata("design:paramtypes", [gantt_component_1.GanttComponent,
63
71
  scroll_sync_service_1.ScrollSyncService])
package/dist/npm/utils.js CHANGED
@@ -6,6 +6,7 @@
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var kendo_angular_common_1 = require("@progress/kendo-angular-common");
8
8
  var kendo_date_math_1 = require("@progress/kendo-date-math");
9
+ var dependency_type_enum_1 = require("./models/dependency-type.enum");
9
10
  /**
10
11
  * @hidden
11
12
  */
@@ -112,24 +113,43 @@ exports.isNumber = function (contender) { return typeof contender === 'number' &
112
113
  * @hidden
113
114
  */
114
115
  exports.isString = function (contender) { return typeof contender === 'string'; };
116
+ /**
117
+ * @hidden
118
+ *
119
+ * Gets the closest timeline task wrapper element from an event target.
120
+ * Restricts the search up to the provided parent element from the second param.
121
+ */
122
+ exports.getClosestTaskWrapper = function (element, parentScope) {
123
+ return kendo_angular_common_1.closestInScope(element, kendo_angular_common_1.matchesClasses('k-task-wrap'), parentScope);
124
+ };
125
+ /**
126
+ * @hidden
127
+ *
128
+ * Checks whether the queried item or its parent items has a `k-task-wrap` selector.
129
+ * Restricts the search up to the provided parent element from the second param.
130
+ */
131
+ exports.isTaskWrapper = function (contender, parentScope) {
132
+ var taskWrapper = kendo_angular_common_1.closestInScope(contender, kendo_angular_common_1.matchesClasses('k-task-wrap'), parentScope);
133
+ return exports.isPresent(taskWrapper);
134
+ };
115
135
  /**
116
136
  * @hidden
117
137
  *
118
138
  * Gets the closest timeline task element from an event target.
119
- * Restricts the search up to the provided gantt element from the second param.
139
+ * Restricts the search up to the provided parent element from the second param.
120
140
  */
121
- exports.getClosestTask = function (element, gantt) {
122
- return kendo_angular_common_1.closestInScope(element, kendo_angular_common_1.matchesClasses('k-task'), gantt);
141
+ exports.getClosestTask = function (element, parentScope) {
142
+ return kendo_angular_common_1.closestInScope(element, kendo_angular_common_1.matchesClasses('k-task'), parentScope);
123
143
  };
124
144
  /**
125
145
  * @hidden
126
146
  *
127
147
  * Gets the closest timeline task element index from an event target.
128
148
  * Uses the `data-task-index` attribute assigned to each task.
129
- * Restricts the search up to the provided gantt element from the second param.
149
+ * Restricts the search up to the provided parent element from the second param.
130
150
  */
131
- exports.getClosestTaskIndex = function (element, gantt) {
132
- var task = kendo_angular_common_1.closestInScope(element, kendo_angular_common_1.matchesClasses('k-task'), gantt);
151
+ exports.getClosestTaskIndex = function (element, parentScope) {
152
+ var task = kendo_angular_common_1.closestInScope(element, kendo_angular_common_1.matchesClasses('k-task-wrap'), parentScope);
133
153
  if (!exports.isPresent(task)) {
134
154
  return null;
135
155
  }
@@ -139,19 +159,130 @@ exports.getClosestTaskIndex = function (element, gantt) {
139
159
  * @hidden
140
160
  *
141
161
  * Checks whether the queried item or its parent items has a `k-task` selector.
142
- * Restricts the search up to the provided gantt element from the second param.
162
+ * Restricts the search up to the provided parent element from the second param.
143
163
  */
144
- exports.isTask = function (contender, gantt) {
145
- var task = kendo_angular_common_1.closestInScope(contender, kendo_angular_common_1.matchesClasses('k-task'), gantt);
164
+ exports.isTask = function (contender, parentScope) {
165
+ var task = kendo_angular_common_1.closestInScope(contender, kendo_angular_common_1.matchesClasses('k-task'), parentScope);
146
166
  return exports.isPresent(task);
147
167
  };
148
168
  /**
149
169
  * @hidden
150
170
  *
151
171
  * Checks whether the queried item or its parent items has a `k-task-actions` selector - used for the clear button.
152
- * Restricts the search up to the provided gantt element from the second param.
172
+ * Restricts the search up to the provided parent element from the second param.
153
173
  */
154
- exports.isClearButton = function (contender, gantt) {
155
- var clearButtonContainer = kendo_angular_common_1.closestInScope(contender, kendo_angular_common_1.matchesClasses('k-task-actions'), gantt);
174
+ exports.isClearButton = function (contender, parentScope) {
175
+ var clearButtonContainer = kendo_angular_common_1.closestInScope(contender, kendo_angular_common_1.matchesClasses('k-task-actions'), parentScope);
156
176
  return exports.isPresent(clearButtonContainer);
157
177
  };
178
+ /**
179
+ * @hidden
180
+ *
181
+ * Checks whether the queried item has a `k-task-dot` selector - used for the dependency drag clues.
182
+ */
183
+ exports.isDependencyDragClue = function (element) {
184
+ if (!exports.isPresent(element)) {
185
+ return false;
186
+ }
187
+ return element.classList.contains('k-task-dot');
188
+ };
189
+ /**
190
+ * @hidden
191
+ *
192
+ * Checks whether the queried item has a `k-task-dot` & `k-task-start` selector - used for the dependency drag start clues.
193
+ */
194
+ exports.isDependencyDragStartClue = function (element) {
195
+ if (!exports.isPresent(element)) {
196
+ return false;
197
+ }
198
+ return element.classList.contains('k-task-dot') && element.classList.contains('k-task-start');
199
+ };
200
+ /**
201
+ * @hidden
202
+ *
203
+ * Gets the `DependencyType` for an attempted dependency create from the provided two elements.
204
+ * The two linked drag clue HTML elements are used to extract this data (via their CSS classes).
205
+ */
206
+ exports.getDependencyTypeFromTargetTasks = function (fromTaskClue, toTaskClue) {
207
+ if (!exports.isDependencyDragClue(fromTaskClue) || !exports.isDependencyDragClue(toTaskClue)) {
208
+ return null;
209
+ }
210
+ var fromTaskType = exports.isDependencyDragStartClue(fromTaskClue) ? 'S' : 'F';
211
+ var toTaskType = exports.isDependencyDragStartClue(toTaskClue) ? 'S' : 'F';
212
+ var dependencyTypeName = "" + fromTaskType + toTaskType;
213
+ switch (dependencyTypeName) {
214
+ case 'FF': return dependency_type_enum_1.DependencyType.FF;
215
+ case 'FS': return dependency_type_enum_1.DependencyType.FS;
216
+ case 'SF': return dependency_type_enum_1.DependencyType.SF;
217
+ case 'SS': return dependency_type_enum_1.DependencyType.SS;
218
+ default: return null;
219
+ }
220
+ };
221
+ /**
222
+ * @hidden
223
+ *
224
+ * Checks whether the two provided drag clues belong to the same task element.
225
+ */
226
+ exports.sameTaskClues = function (fromTaskClue, toTaskClue, parentScope) {
227
+ if (!exports.isPresent(fromTaskClue) || !exports.isPresent(toTaskClue)) {
228
+ return false;
229
+ }
230
+ var fromTaskWrapper = exports.getClosestTaskWrapper(fromTaskClue, parentScope);
231
+ var toTaskWrapper = exports.getClosestTaskWrapper(toTaskClue, parentScope);
232
+ return fromTaskWrapper === toTaskWrapper;
233
+ };
234
+ /**
235
+ * @hidden
236
+ *
237
+ * Fits a contender number between a min and max range.
238
+ * If the contender is below the min value, the min value is returned.
239
+ * If the contender is above the max value, the max value is returned.
240
+ */
241
+ exports.fitToRange = function (contender, min, max) {
242
+ if (contender > max) {
243
+ return max;
244
+ }
245
+ else if (contender < min) {
246
+ return min;
247
+ }
248
+ else {
249
+ return contender;
250
+ }
251
+ };
252
+ /**
253
+ * @hidden
254
+ *
255
+ * Checks whether either of the two provided tasks is a parent of the other.
256
+ */
257
+ exports.areParentChild = function (taskA, taskB) {
258
+ var parentChildRelationship = false;
259
+ var taskAParent = taskA;
260
+ while (exports.isPresent(taskAParent) && exports.isPresent(taskAParent.data)) {
261
+ if (taskAParent.data === taskB.data) {
262
+ parentChildRelationship = true;
263
+ break;
264
+ }
265
+ taskAParent = taskAParent.parent;
266
+ }
267
+ var taskBParent = taskB;
268
+ while (!parentChildRelationship && exports.isPresent(taskBParent) && exports.isPresent(taskBParent.data)) {
269
+ if (taskBParent.data === taskA.data) {
270
+ parentChildRelationship = true;
271
+ break;
272
+ }
273
+ taskBParent = taskBParent.parent;
274
+ }
275
+ return parentChildRelationship;
276
+ };
277
+ /**
278
+ * @hidden
279
+ *
280
+ * Extracts an element from the provided client coords.
281
+ * Using the `event.target` is not reliable under mobile devices with the current implementation of the draggable, so use this instead.
282
+ */
283
+ exports.elementFromPoint = function (clientX, clientY) {
284
+ if (!kendo_angular_common_1.isDocumentAvailable()) {
285
+ return null;
286
+ }
287
+ return document.elementFromPoint(clientX, clientY);
288
+ };