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

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 (138) hide show
  1. package/dist/cdn/js/kendo-angular-gantt.js +2 -2
  2. package/dist/cdn/main.js +1 -29
  3. package/dist/es/common/touch-enabled.js +9 -0
  4. package/dist/es/dependencies/utils.js +34 -0
  5. package/dist/es/dragging/dependency-drag-create.directive.js +347 -0
  6. package/dist/es/dragging/drag-validation-tooltip.component.js +27 -0
  7. package/dist/es/editing/dependencies-table.component.js +1 -1
  8. package/dist/es/editing/edit-dialog.component.js +3 -3
  9. package/dist/es/editing/edit.service.js +4 -2
  10. package/dist/es/editing/task-fields.component.js +1 -1
  11. package/dist/es/editing/{util.js → utils.js} +0 -0
  12. package/dist/es/gantt.component.js +313 -28
  13. package/dist/es/gantt.module.js +23 -6
  14. package/dist/es/index.js +5 -0
  15. package/dist/es/main.js +1 -0
  16. package/dist/es/models/events/dependency-add-event.interface.js +4 -0
  17. package/dist/es/models/events/task-delete-event.interface.js +4 -0
  18. package/dist/es/models/view-item.interface.js +4 -0
  19. package/dist/es/navigation/navigation-models.js +4 -0
  20. package/dist/es/navigation/navigation.service.js +390 -0
  21. package/dist/es/navigation/utils.js +77 -0
  22. package/dist/es/package-metadata.js +1 -1
  23. package/dist/es/rendering/gantt-milestone-task.component.js +12 -6
  24. package/dist/es/rendering/gantt-summary-task.component.js +27 -6
  25. package/dist/es/rendering/gantt-task-base.js +84 -22
  26. package/dist/es/rendering/gantt-task.component.js +13 -8
  27. package/dist/es/rendering/gantt-tasks-table-body.component.js +13 -5
  28. package/dist/es/scrolling/drag-scroll-settings.js +20 -0
  29. package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
  30. package/dist/es/scrolling/timeline-scroll.service.js +39 -0
  31. package/dist/es/scrolling/utils.js +80 -0
  32. package/dist/es/timeline/gantt-timeline.component.js +50 -4
  33. package/dist/es/toolbar/toolbar.component.js +12 -13
  34. package/dist/es/toolbar/view-selector.component.js +1 -1
  35. package/dist/es/utils.js +153 -12
  36. package/dist/es2015/common/touch-enabled.d.ts +9 -0
  37. package/dist/es2015/common/touch-enabled.js +9 -0
  38. package/dist/es2015/dependencies/utils.d.ts +15 -0
  39. package/dist/es2015/dependencies/utils.js +34 -0
  40. package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
  41. package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
  42. package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
  43. package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
  44. package/dist/es2015/editing/dependencies-table.component.js +1 -1
  45. package/dist/es2015/editing/edit-dialog.component.d.ts +1 -1
  46. package/dist/es2015/editing/edit-dialog.component.js +12 -4
  47. package/dist/es2015/editing/edit.service.d.ts +2 -3
  48. package/dist/es2015/editing/edit.service.js +4 -2
  49. package/dist/es2015/editing/task-fields.component.js +1 -1
  50. package/dist/es2015/editing/{util.d.ts → utils.d.ts} +2 -2
  51. package/dist/es2015/editing/{util.js → utils.js} +0 -0
  52. package/dist/es2015/gantt.component.d.ts +112 -17
  53. package/dist/es2015/gantt.component.js +292 -30
  54. package/dist/es2015/gantt.module.js +23 -6
  55. package/dist/es2015/index.d.ts +5 -0
  56. package/dist/es2015/index.js +5 -0
  57. package/dist/es2015/index.metadata.json +1 -1
  58. package/dist/es2015/main.d.ts +1 -0
  59. package/dist/es2015/main.js +1 -0
  60. package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
  61. package/dist/es2015/models/events/dependency-add-event.interface.js +4 -0
  62. package/dist/es2015/models/events/task-click-event.interface.d.ts +3 -3
  63. package/dist/es2015/models/events/task-delete-event.interface.d.ts +21 -0
  64. package/dist/es2015/models/events/task-delete-event.interface.js +4 -0
  65. package/dist/es2015/models/events/task-edit-event.interface.d.ts +27 -10
  66. package/dist/es2015/models/models.d.ts +4 -0
  67. package/dist/es2015/models/view-item.interface.d.ts +35 -0
  68. package/dist/es2015/models/view-item.interface.js +4 -0
  69. package/dist/es2015/navigation/navigation-models.d.ts +34 -0
  70. package/dist/es2015/navigation/navigation-models.js +4 -0
  71. package/dist/es2015/navigation/navigation.service.d.ts +126 -0
  72. package/dist/es2015/navigation/navigation.service.js +355 -0
  73. package/dist/es2015/navigation/utils.d.ts +26 -0
  74. package/dist/es2015/navigation/utils.js +69 -0
  75. package/dist/es2015/package-metadata.js +1 -1
  76. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +3 -1
  77. package/dist/es2015/rendering/gantt-milestone-task.component.js +35 -8
  78. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +5 -1
  79. package/dist/es2015/rendering/gantt-summary-task.component.js +47 -8
  80. package/dist/es2015/rendering/gantt-task-base.d.ts +20 -6
  81. package/dist/es2015/rendering/gantt-task-base.js +75 -22
  82. package/dist/es2015/rendering/gantt-task.component.d.ts +4 -2
  83. package/dist/es2015/rendering/gantt-task.component.js +47 -13
  84. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +6 -3
  85. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +27 -9
  86. package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
  87. package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
  88. package/dist/es2015/scrolling/scroll-sync.service.d.ts +1 -1
  89. package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
  90. package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
  91. package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
  92. package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
  93. package/dist/es2015/scrolling/utils.d.ts +29 -0
  94. package/dist/es2015/scrolling/utils.js +80 -0
  95. package/dist/es2015/timeline/gantt-timeline.component.d.ts +29 -4
  96. package/dist/es2015/timeline/gantt-timeline.component.js +67 -5
  97. package/dist/es2015/toolbar/toolbar.component.d.ts +4 -5
  98. package/dist/es2015/toolbar/toolbar.component.js +12 -13
  99. package/dist/es2015/toolbar/view-selector.component.js +3 -1
  100. package/dist/es2015/utils.d.ts +77 -8
  101. package/dist/es2015/utils.js +153 -12
  102. package/dist/fesm2015/index.js +3033 -1367
  103. package/dist/fesm5/index.js +2447 -830
  104. package/dist/npm/common/touch-enabled.js +11 -0
  105. package/dist/npm/dependencies/utils.js +34 -0
  106. package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
  107. package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
  108. package/dist/npm/editing/dependencies-table.component.js +1 -1
  109. package/dist/npm/editing/edit-dialog.component.js +3 -3
  110. package/dist/npm/editing/edit.service.js +4 -2
  111. package/dist/npm/editing/task-fields.component.js +1 -1
  112. package/dist/npm/editing/{util.js → utils.js} +0 -0
  113. package/dist/npm/gantt.component.js +315 -30
  114. package/dist/npm/gantt.module.js +22 -5
  115. package/dist/npm/index.js +10 -0
  116. package/dist/npm/main.js +2 -0
  117. package/dist/npm/models/events/dependency-add-event.interface.js +6 -0
  118. package/dist/npm/models/events/task-delete-event.interface.js +6 -0
  119. package/dist/npm/models/view-item.interface.js +6 -0
  120. package/dist/npm/navigation/navigation-models.js +6 -0
  121. package/dist/npm/navigation/navigation.service.js +392 -0
  122. package/dist/npm/navigation/utils.js +79 -0
  123. package/dist/npm/package-metadata.js +1 -1
  124. package/dist/npm/rendering/gantt-milestone-task.component.js +11 -5
  125. package/dist/npm/rendering/gantt-summary-task.component.js +26 -5
  126. package/dist/npm/rendering/gantt-task-base.js +84 -22
  127. package/dist/npm/rendering/gantt-task.component.js +12 -7
  128. package/dist/npm/rendering/gantt-tasks-table-body.component.js +13 -5
  129. package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
  130. package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
  131. package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
  132. package/dist/npm/scrolling/utils.js +83 -0
  133. package/dist/npm/timeline/gantt-timeline.component.js +49 -3
  134. package/dist/npm/toolbar/toolbar.component.js +10 -11
  135. package/dist/npm/toolbar/view-selector.component.js +1 -1
  136. package/dist/npm/utils.js +153 -12
  137. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  138. package/package.json +23 -21
@@ -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,13 @@ 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
50
  tslib_1.__decorate([
51
51
  Input(),
52
52
  tslib_1.__metadata("design:type", Boolean)
@@ -63,10 +63,9 @@ var ToolbarComponent = /** @class */ (function () {
63
63
  ToolbarComponent = tslib_1.__decorate([
64
64
  Component({
65
65
  selector: 'kendo-gantt-toolbar',
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 "
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 "
67
67
  }),
68
- tslib_1.__metadata("design:paramtypes", [GanttComponent,
69
- ScrollSyncService])
68
+ tslib_1.__metadata("design:paramtypes", [GanttComponent])
70
69
  ], ToolbarComponent);
71
70
  return ToolbarComponent;
72
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-dropdownlist k-picker k-rounded-md 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;
@@ -13,6 +13,9 @@ export const getOffsetRelativeToParent = (element, targetParent) => {
13
13
  top: 0,
14
14
  left: 0
15
15
  };
16
+ if (!targetParent.contains(element)) {
17
+ return offset;
18
+ }
16
19
  let offsetParent = element;
17
20
  while (offsetParent && offsetParent !== targetParent) {
18
21
  offset.top += offsetParent.offsetTop;
@@ -162,4 +165,35 @@ const getArrowEast = (top, left, arrowSize) => {
162
165
  return points;
163
166
  };
164
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
+ };
165
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
+ }