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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/cdn/js/kendo-angular-gantt.js +2 -2
  2. package/dist/cdn/main.js +4 -10
  3. package/dist/es/common/touch-enabled.js +9 -0
  4. package/dist/es/dependencies/utils.js +34 -0
  5. package/dist/es/dragging/dependency-drag-create.directive.js +347 -0
  6. package/dist/es/dragging/drag-validation-tooltip.component.js +27 -0
  7. package/dist/es/editing/{util.js → utils.js} +0 -0
  8. package/dist/es/gantt.component.js +125 -7
  9. package/dist/es/gantt.module.js +23 -6
  10. package/dist/es/index.js +4 -0
  11. package/dist/es/main.js +1 -0
  12. package/dist/es/models/events/dependency-add-event.interface.js +4 -0
  13. package/dist/es/models/view-item.interface.js +4 -0
  14. package/dist/es/package-metadata.js +1 -1
  15. package/dist/es/rendering/gantt-milestone-task.component.js +7 -4
  16. package/dist/es/rendering/gantt-summary-task.component.js +7 -4
  17. package/dist/es/rendering/gantt-task-base.js +30 -19
  18. package/dist/es/rendering/gantt-task.component.js +8 -6
  19. package/dist/es/rendering/gantt-tasks-table-body.component.js +5 -1
  20. package/dist/es/scrolling/drag-scroll-settings.js +20 -0
  21. package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
  22. package/dist/es/scrolling/timeline-scroll.service.js +39 -0
  23. package/dist/es/scrolling/utils.js +80 -0
  24. package/dist/es/timeline/gantt-timeline.component.js +45 -3
  25. package/dist/es/utils.js +143 -12
  26. package/dist/es2015/common/touch-enabled.d.ts +9 -0
  27. package/dist/es2015/common/touch-enabled.js +9 -0
  28. package/dist/es2015/dependencies/utils.d.ts +15 -0
  29. package/dist/es2015/dependencies/utils.js +34 -0
  30. package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
  31. package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
  32. package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
  33. package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
  34. package/dist/es2015/editing/{util.d.ts → utils.d.ts} +0 -0
  35. package/dist/es2015/editing/{util.js → utils.js} +0 -0
  36. package/dist/es2015/gantt.component.d.ts +39 -3
  37. package/dist/es2015/gantt.component.js +117 -6
  38. package/dist/es2015/gantt.module.js +23 -6
  39. package/dist/es2015/index.d.ts +4 -0
  40. package/dist/es2015/index.js +4 -0
  41. package/dist/es2015/index.metadata.json +1 -1
  42. package/dist/es2015/main.d.ts +1 -0
  43. package/dist/es2015/main.js +1 -0
  44. package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
  45. package/dist/es2015/models/events/dependency-add-event.interface.js +4 -0
  46. package/dist/es2015/models/models.d.ts +2 -0
  47. package/dist/es2015/models/view-item.interface.d.ts +35 -0
  48. package/dist/es2015/models/view-item.interface.js +4 -0
  49. package/dist/es2015/package-metadata.js +1 -1
  50. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +2 -1
  51. package/dist/es2015/rendering/gantt-milestone-task.component.js +18 -5
  52. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +2 -1
  53. package/dist/es2015/rendering/gantt-summary-task.component.js +18 -5
  54. package/dist/es2015/rendering/gantt-task-base.d.ts +11 -5
  55. package/dist/es2015/rendering/gantt-task-base.js +30 -19
  56. package/dist/es2015/rendering/gantt-task.component.d.ts +2 -1
  57. package/dist/es2015/rendering/gantt-task.component.js +19 -7
  58. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +1 -0
  59. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +10 -3
  60. package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
  61. package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
  62. package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
  63. package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
  64. package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
  65. package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
  66. package/dist/es2015/scrolling/utils.d.ts +29 -0
  67. package/dist/es2015/scrolling/utils.js +80 -0
  68. package/dist/es2015/timeline/gantt-timeline.component.d.ts +25 -2
  69. package/dist/es2015/timeline/gantt-timeline.component.js +56 -3
  70. package/dist/es2015/utils.d.ts +70 -8
  71. package/dist/es2015/utils.js +143 -12
  72. package/dist/fesm2015/index.js +1337 -372
  73. package/dist/fesm5/index.js +1206 -298
  74. package/dist/npm/common/touch-enabled.js +11 -0
  75. package/dist/npm/dependencies/utils.js +34 -0
  76. package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
  77. package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
  78. package/dist/npm/editing/{util.js → utils.js} +0 -0
  79. package/dist/npm/gantt.component.js +127 -9
  80. package/dist/npm/gantt.module.js +22 -5
  81. package/dist/npm/index.js +8 -0
  82. package/dist/npm/main.js +2 -0
  83. package/dist/npm/models/events/dependency-add-event.interface.js +6 -0
  84. package/dist/npm/models/view-item.interface.js +6 -0
  85. package/dist/npm/package-metadata.js +1 -1
  86. package/dist/npm/rendering/gantt-milestone-task.component.js +6 -3
  87. package/dist/npm/rendering/gantt-summary-task.component.js +6 -3
  88. package/dist/npm/rendering/gantt-task-base.js +30 -19
  89. package/dist/npm/rendering/gantt-task.component.js +7 -5
  90. package/dist/npm/rendering/gantt-tasks-table-body.component.js +5 -1
  91. package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
  92. package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
  93. package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
  94. package/dist/npm/scrolling/utils.js +83 -0
  95. package/dist/npm/timeline/gantt-timeline.component.js +44 -2
  96. package/dist/npm/utils.js +143 -12
  97. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  98. package/package.json +5 -4
@@ -53,23 +53,6 @@ var GanttTaskBase = /** @class */ (function () {
53
53
  enumerable: true,
54
54
  configurable: true
55
55
  });
56
- GanttTaskBase.prototype.ngOnChanges = function (changes) {
57
- if (utils_1.isPresent(changes.dataItem)) {
58
- if (utils_1.isPresent(changes.dataItem.previousValue)) {
59
- this.dependencyDomService.unregisterTask(changes.dataItem.previousValue);
60
- }
61
- this.dependencyDomService.registerTask(this.dataItem, this.taskElement.nativeElement);
62
- }
63
- else if (utils_1.isPresent(changes.activeView)) {
64
- this.dependencyDomService.notifyChanges();
65
- }
66
- };
67
- GanttTaskBase.prototype.ngOnDestroy = function () {
68
- if (utils_1.isPresent(this.dataItem)) {
69
- this.dependencyDomService.unregisterTask(this.dataItem);
70
- }
71
- this.viewChangesSubscription.unsubscribe();
72
- };
73
56
  Object.defineProperty(GanttTaskBase.prototype, "taskWidth", {
74
57
  get: function () {
75
58
  var itemDuration = this.mapper.extractFromTask(this.dataItem, 'end') - this.mapper.extractFromTask(this.dataItem, 'start');
@@ -81,6 +64,12 @@ var GanttTaskBase = /** @class */ (function () {
81
64
  configurable: true
82
65
  });
83
66
  Object.defineProperty(GanttTaskBase.prototype, "taskOffset", {
67
+ /**
68
+ * The `left` style prop has to be applied to the host element (.k-task-wrap), as the drag clue elements are displayed on .k-task-wrap hover.
69
+ * Applying the `left` offset to the inner .k-task element leaves the .k-task-wrap element rendered with an offset of 0 somewhere on the left
70
+ * and hovering just the .k-task element doesn't expose the drag clues.
71
+ * Additionally, positioning the entire container takes care of positioning the hints as well.
72
+ */
84
73
  get: function () {
85
74
  var timeAfterViewStart = this.mapper.extractFromTask(this.dataItem, 'start') - this.viewService.viewStart;
86
75
  var offsetInSlotUnits = timeAfterViewStart / this.slotUnitDuration;
@@ -99,6 +88,23 @@ var GanttTaskBase = /** @class */ (function () {
99
88
  enumerable: true,
100
89
  configurable: true
101
90
  });
91
+ GanttTaskBase.prototype.ngOnChanges = function (changes) {
92
+ if (utils_1.isPresent(changes.dataItem)) {
93
+ if (utils_1.isPresent(changes.dataItem.previousValue)) {
94
+ this.dependencyDomService.unregisterTask(changes.dataItem.previousValue);
95
+ }
96
+ this.dependencyDomService.registerTask(this.dataItem, this.taskElement.nativeElement);
97
+ }
98
+ else if (utils_1.isPresent(changes.activeView)) {
99
+ this.dependencyDomService.notifyChanges();
100
+ }
101
+ };
102
+ GanttTaskBase.prototype.ngOnDestroy = function () {
103
+ if (utils_1.isPresent(this.dataItem)) {
104
+ this.dependencyDomService.unregisterTask(this.dataItem);
105
+ }
106
+ this.viewChangesSubscription.unsubscribe();
107
+ };
102
108
  tslib_1.__decorate([
103
109
  core_1.HostBinding('class.k-task-wrap'),
104
110
  tslib_1.__metadata("design:type", Boolean)
@@ -113,8 +119,8 @@ var GanttTaskBase = /** @class */ (function () {
113
119
  ], GanttTaskBase.prototype, "dataItem", void 0);
114
120
  tslib_1.__decorate([
115
121
  core_1.Input(),
116
- tslib_1.__metadata("design:type", Number)
117
- ], GanttTaskBase.prototype, "index", void 0);
122
+ tslib_1.__metadata("design:type", Boolean)
123
+ ], GanttTaskBase.prototype, "renderDependencyDragClues", void 0);
118
124
  tslib_1.__decorate([
119
125
  core_1.Input(),
120
126
  tslib_1.__metadata("design:type", Function)
@@ -127,6 +133,11 @@ var GanttTaskBase = /** @class */ (function () {
127
133
  core_1.Input(),
128
134
  tslib_1.__metadata("design:type", Function)
129
135
  ], GanttTaskBase.prototype, "taskClass", void 0);
136
+ tslib_1.__decorate([
137
+ core_1.HostBinding('style.left.px'),
138
+ tslib_1.__metadata("design:type", Number),
139
+ tslib_1.__metadata("design:paramtypes", [])
140
+ ], GanttTaskBase.prototype, "taskOffset", null);
130
141
  return GanttTaskBase;
131
142
  }());
132
143
  exports.GanttTaskBase = GanttTaskBase;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
8
  var core_1 = require("@angular/core");
9
9
  var mapping_service_1 = require("../common/mapping.service");
10
+ var touch_enabled_1 = require("../common/touch-enabled");
10
11
  var dependency_dom_service_1 = require("../dependencies/dependency-dom.service");
11
12
  var option_changes_service_1 = require("../common/option-changes.service");
12
13
  var timeline_view_service_1 = require("./../timeline/timeline-view.service");
@@ -17,9 +18,10 @@ var edit_service_1 = require("../editing/edit.service");
17
18
  */
18
19
  var GanttTaskComponent = /** @class */ (function (_super) {
19
20
  tslib_1.__extends(GanttTaskComponent, _super);
20
- function GanttTaskComponent(mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, editService) {
21
+ function GanttTaskComponent(editService, touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) {
21
22
  var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) || this;
22
23
  _this.editService = editService;
24
+ _this.touchEnabled = touchEnabled;
23
25
  return _this;
24
26
  }
25
27
  GanttTaskComponent_1 = GanttTaskComponent;
@@ -45,14 +47,14 @@ var GanttTaskComponent = /** @class */ (function (_super) {
45
47
  useExisting: core_1.forwardRef(function () { return GanttTaskComponent_1; })
46
48
  }
47
49
  ],
48
- template: "\n <div\n #task\n class=\"k-task k-task-single\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.width.px]=\"taskWidth\"\n [style.left.px]=\"taskOffset\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [attr.data-task-index]=\"index\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n >\n <ng-container *ngIf=\"!taskTemplate\">\n <div\n class=\"k-task-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n >\n </div>\n <div class=\"k-task-content\">\n <div class=\"k-task-template\">\n <ng-container *ngIf=\"!taskContentTemplate; else taskContent\">\n {{ mapper.extractFromTask(dataItem, 'title') }}\n </ng-container>\n <ng-template\n #taskContent\n [ngTemplateOutlet]=\"taskContentTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"\n >\n </ng-template>\n </div>\n <span class=\"k-task-actions\">\n <span\n (click)=\"onTaskDelete()\"\n class=\"k-link k-task-delete\">\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </span>\n </div>\n </ng-container>\n <ng-template\n *ngIf=\"taskTemplate\"\n [ngTemplateOutlet]=\"taskTemplate\"\n [ngTemplateOutletContext]=\"{\n $implicit: dataItem,\n elementWidth: taskWidth\n }\"\n >\n </ng-template>\n </div>\n "
50
+ template: "\n <div\n #task\n class=\"k-task k-task-single\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.width.px]=\"taskWidth\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n >\n <ng-container *ngIf=\"!taskTemplate\">\n <div\n class=\"k-task-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n >\n </div>\n <div class=\"k-task-content\">\n <div class=\"k-task-template\">\n <ng-container *ngIf=\"!taskContentTemplate; else taskContent\">\n {{ mapper.extractFromTask(dataItem, 'title') }}\n </ng-container>\n <ng-template\n #taskContent\n [ngTemplateOutlet]=\"taskContentTemplate\"\n [ngTemplateOutletContext]=\"{ $implicit: dataItem }\"\n >\n </ng-template>\n </div>\n <span class=\"k-task-actions\">\n <span\n (click)=\"onTaskDelete()\"\n class=\"k-link k-task-delete\">\n <span class=\"k-icon k-i-close\"></span>\n </span>\n </span>\n </div>\n </ng-container>\n <ng-template\n *ngIf=\"taskTemplate\"\n [ngTemplateOutlet]=\"taskTemplate\"\n [ngTemplateOutletContext]=\"{\n $implicit: dataItem,\n elementWidth: taskWidth\n }\"\n >\n </ng-template>\n </div>\n <ng-container *ngIf=\"renderDependencyDragClues\">\n <div\n class=\"k-task-dot k-task-start k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n <div\n class=\"k-task-dot k-task-end k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n </ng-container>\n "
49
51
  }),
50
- tslib_1.__metadata("design:paramtypes", [mapping_service_1.MappingService,
52
+ tslib_1.__param(1, core_1.Inject(touch_enabled_1.TOUCH_ENABLED)),
53
+ tslib_1.__metadata("design:paramtypes", [edit_service_1.EditService, Boolean, mapping_service_1.MappingService,
51
54
  timeline_view_service_1.TimelineViewService,
52
55
  dependency_dom_service_1.DependencyDomService,
53
56
  option_changes_service_1.OptionChangesService,
54
- core_1.ChangeDetectorRef,
55
- edit_service_1.EditService])
57
+ core_1.ChangeDetectorRef])
56
58
  ], GanttTaskComponent);
57
59
  return GanttTaskComponent;
58
60
  }(gantt_task_base_1.GanttTaskBase));
@@ -69,10 +69,14 @@ var GanttTasksTableBodyComponent = /** @class */ (function () {
69
69
  core_1.Input(),
70
70
  tslib_1.__metadata("design:type", Function)
71
71
  ], GanttTasksTableBodyComponent.prototype, "isTaskSelected", void 0);
72
+ tslib_1.__decorate([
73
+ core_1.Input(),
74
+ tslib_1.__metadata("design:type", Boolean)
75
+ ], GanttTasksTableBodyComponent.prototype, "renderDependencyDragClues", void 0);
72
76
  GanttTasksTableBodyComponent = tslib_1.__decorate([
73
77
  core_1.Component({
74
78
  selector: '[kendoGanttTasksTableBody]',
75
- template: "\n <tr #timelineRow *ngFor=\"let item of rows; let index = index\">\n <td>\n <kendo-gantt-milestone-task\n *ngIf=\"isMileStone(item); else task\"\n [dataItem]=\"item\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [index]=\"index\"\n >\n </kendo-gantt-milestone-task>\n <ng-template #task>\n <kendo-gantt-summary-task\n *ngIf=\"hasChildren(item)\"\n [dataItem]=\"item\"\n [template]=\"summaryTaskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [index]=\"index\"\n >\n </kendo-gantt-summary-task>\n <kendo-gantt-task\n *ngIf=\"!hasChildren(item)\"\n [dataItem]=\"item\"\n [taskContentTemplate]=\"taskContentTemplate\"\n [taskTemplate]=\"taskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [index]=\"index\"\n >\n </kendo-gantt-task>\n </ng-template>\n </td>\n </tr>\n "
79
+ template: "\n <tr #timelineRow *ngFor=\"let item of rows; let index = index\">\n <td>\n <kendo-gantt-milestone-task\n *ngIf=\"isMileStone(item); else task\"\n [dataItem]=\"item\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [attr.data-task-index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-milestone-task>\n <ng-template #task>\n <kendo-gantt-summary-task\n *ngIf=\"hasChildren(item)\"\n [dataItem]=\"item\"\n [template]=\"summaryTaskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [attr.data-task-index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-summary-task>\n <kendo-gantt-task\n *ngIf=\"!hasChildren(item)\"\n [dataItem]=\"item\"\n [taskContentTemplate]=\"taskContentTemplate\"\n [taskTemplate]=\"taskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [isSelected]=\"isTaskSelected\"\n [attr.data-task-index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-task>\n </ng-template>\n </td>\n </tr>\n "
76
80
  }),
77
81
  tslib_1.__metadata("design:paramtypes", [dependency_dom_service_1.DependencyDomService,
78
82
  mapping_service_1.MappingService])
@@ -0,0 +1,22 @@
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
+ /**
8
+ * @hidden
9
+ */
10
+ var ScrollDirection;
11
+ (function (ScrollDirection) {
12
+ ScrollDirection[ScrollDirection["Backwards"] = -1] = "Backwards";
13
+ ScrollDirection[ScrollDirection["Forward"] = 1] = "Forward";
14
+ })(ScrollDirection = exports.ScrollDirection || (exports.ScrollDirection = {}));
15
+ /**
16
+ * @hidden
17
+ */
18
+ var ScrollAxis;
19
+ (function (ScrollAxis) {
20
+ ScrollAxis["Vertical"] = "scrollTop";
21
+ ScrollAxis["Horizontal"] = "scrollLeft";
22
+ })(ScrollAxis = exports.ScrollAxis || (exports.ScrollAxis = {}));
@@ -0,0 +1,91 @@
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 tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var rxjs_1 = require("rxjs");
10
+ var utils_1 = require("../utils");
11
+ var drag_scroll_settings_1 = require("./drag-scroll-settings");
12
+ var timeline_scroll_service_1 = require("./timeline-scroll.service");
13
+ var utils_2 = require("./utils");
14
+ /**
15
+ * @hidden
16
+ */
17
+ var TimelineScrollableDirective = /** @class */ (function () {
18
+ function TimelineScrollableDirective(timelineScrollableContainer, scrollService, zone) {
19
+ this.timelineScrollableContainer = timelineScrollableContainer;
20
+ this.scrollService = scrollService;
21
+ this.zone = zone;
22
+ this.subscriptions = new rxjs_1.Subscription();
23
+ this.subscriptions.add(this.scrollService.horizontalScroll
24
+ .subscribe(this.scrollHorizontallyTo.bind(this)));
25
+ this.subscriptions.add(this.scrollService.verticalScroll
26
+ .subscribe(this.scrollVerticallyTo.bind(this)));
27
+ this.subscriptions.add(this.scrollService.scrollCancel
28
+ .subscribe(this.cancelScroll.bind(this)));
29
+ }
30
+ TimelineScrollableDirective.prototype.ngOnDestroy = function () {
31
+ this.subscriptions.unsubscribe();
32
+ };
33
+ TimelineScrollableDirective.prototype.scrollHorizontallyTo = function (left) {
34
+ var _this = this;
35
+ this.zone.runOutsideAngular(function () {
36
+ var container = _this.timelineScrollableContainer.nativeElement;
37
+ var visibleBoundaries = utils_2.getViewportBoundaries(container);
38
+ if (left < visibleBoundaries.left + _this.scrollSettings.threshold) {
39
+ _this.horizontalScrollInterval = setInterval(function () {
40
+ return utils_2.scrollElement(container, _this.scrollSettings.step, drag_scroll_settings_1.ScrollDirection.Backwards, drag_scroll_settings_1.ScrollAxis.Horizontal);
41
+ }, _this.scrollSettings.interval);
42
+ }
43
+ else if (left > visibleBoundaries.right - _this.scrollSettings.threshold) {
44
+ _this.horizontalScrollInterval = setInterval(function () {
45
+ return utils_2.scrollElement(container, _this.scrollSettings.step, drag_scroll_settings_1.ScrollDirection.Forward, drag_scroll_settings_1.ScrollAxis.Horizontal);
46
+ }, _this.scrollSettings.interval);
47
+ }
48
+ });
49
+ };
50
+ TimelineScrollableDirective.prototype.scrollVerticallyTo = function (top) {
51
+ var _this = this;
52
+ this.zone.runOutsideAngular(function () {
53
+ var container = _this.timelineScrollableContainer.nativeElement;
54
+ var visibleBoundaries = utils_2.getViewportBoundaries(container);
55
+ if (top < visibleBoundaries.top + _this.scrollSettings.threshold) {
56
+ _this.verticalScrollInterval = setInterval(function () {
57
+ return utils_2.scrollElement(container, _this.scrollSettings.step, drag_scroll_settings_1.ScrollDirection.Backwards, drag_scroll_settings_1.ScrollAxis.Vertical);
58
+ }, _this.scrollSettings.interval);
59
+ }
60
+ else if (top > visibleBoundaries.bottom - _this.scrollSettings.threshold) {
61
+ _this.verticalScrollInterval = setInterval(function () {
62
+ return utils_2.scrollElement(container, _this.scrollSettings.step, drag_scroll_settings_1.ScrollDirection.Forward, drag_scroll_settings_1.ScrollAxis.Vertical);
63
+ }, _this.scrollSettings.interval);
64
+ }
65
+ });
66
+ };
67
+ TimelineScrollableDirective.prototype.cancelScroll = function () {
68
+ if (utils_1.isPresent(this.verticalScrollInterval)) {
69
+ clearInterval(this.verticalScrollInterval);
70
+ this.verticalScrollInterval = null;
71
+ }
72
+ if (utils_1.isPresent(this.horizontalScrollInterval)) {
73
+ clearInterval(this.horizontalScrollInterval);
74
+ this.horizontalScrollInterval = null;
75
+ }
76
+ };
77
+ tslib_1.__decorate([
78
+ core_1.Input(),
79
+ tslib_1.__metadata("design:type", Object)
80
+ ], TimelineScrollableDirective.prototype, "scrollSettings", void 0);
81
+ TimelineScrollableDirective = tslib_1.__decorate([
82
+ core_1.Directive({
83
+ selector: '[kendoGanttTimelineScrollable]'
84
+ }),
85
+ tslib_1.__metadata("design:paramtypes", [core_1.ElementRef,
86
+ timeline_scroll_service_1.TimelineScrollService,
87
+ core_1.NgZone])
88
+ ], TimelineScrollableDirective);
89
+ return TimelineScrollableDirective;
90
+ }());
91
+ exports.TimelineScrollableDirective = TimelineScrollableDirective;
@@ -0,0 +1,41 @@
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 tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var rxjs_1 = require("rxjs");
10
+ /**
11
+ * @hidden
12
+ *
13
+ * Notifies the timeline-scroll.directive to scroll into view to requested coordinates.
14
+ * The scrolling is performed based on client (viewport) coordinates.
15
+ */
16
+ var TimelineScrollService = /** @class */ (function () {
17
+ function TimelineScrollService() {
18
+ this.horizontalScroll = new rxjs_1.Subject();
19
+ this.verticalScroll = new rxjs_1.Subject();
20
+ this.scrollCancel = new rxjs_1.Subject();
21
+ }
22
+ TimelineScrollService.prototype.ngOnDestroy = function () {
23
+ this.horizontalScroll.complete();
24
+ this.verticalScroll.complete();
25
+ this.scrollCancel.complete();
26
+ };
27
+ TimelineScrollService.prototype.requestHorizontalScroll = function (clientTop) {
28
+ this.horizontalScroll.next(clientTop);
29
+ };
30
+ TimelineScrollService.prototype.requestVerticalScroll = function (clientLeft) {
31
+ this.verticalScroll.next(clientLeft);
32
+ };
33
+ TimelineScrollService.prototype.requestScrollCancel = function () {
34
+ this.scrollCancel.next();
35
+ };
36
+ TimelineScrollService = tslib_1.__decorate([
37
+ core_1.Injectable()
38
+ ], TimelineScrollService);
39
+ return TimelineScrollService;
40
+ }());
41
+ exports.TimelineScrollService = TimelineScrollService;
@@ -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,