@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,8 +3,10 @@
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, forwardRef, HostBinding, ChangeDetectorRef } from '@angular/core';
6
+ import { Component, forwardRef, HostBinding, ChangeDetectorRef, Inject } from '@angular/core';
7
7
  import { MappingService } from '../common/mapping.service';
8
+ import { NavigationService } from '../navigation/navigation.service';
9
+ import { TOUCH_ENABLED } from '../common/touch-enabled';
8
10
  import { DependencyDomService } from '../dependencies/dependency-dom.service';
9
11
  import { OptionChangesService } from '../common/option-changes.service';
10
12
  import { TimelineViewService } from './../timeline/timeline-view.service';
@@ -14,8 +16,9 @@ import { GanttTaskBase } from './gantt-task-base';
14
16
  */
15
17
  var GanttMilestoneTaskComponent = /** @class */ (function (_super) {
16
18
  tslib_1.__extends(GanttMilestoneTaskComponent, _super);
17
- function GanttMilestoneTaskComponent(mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) {
18
- var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) || this;
19
+ function GanttMilestoneTaskComponent(touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) {
20
+ var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) || this;
21
+ _this.touchEnabled = touchEnabled;
19
22
  _this.milestoneWrapperClass = true;
20
23
  return _this;
21
24
  }
@@ -34,13 +37,16 @@ var GanttMilestoneTaskComponent = /** @class */ (function (_super) {
34
37
  useExisting: forwardRef(function () { return GanttMilestoneTaskComponent_1; })
35
38
  }
36
39
  ],
37
- template: "\n <div\n #task\n class=\"k-task k-task-milestone\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.left.px]=\"taskOffset\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n [attr.data-task-index]=\"index\"\n >\n </div>\n "
40
+ template: "\n <div\n #task\n role=\"treeitem\"\n class=\"k-task k-task-milestone\"\n [ngClass]=\"taskClass(dataItem)\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n [attr.aria-selected]=\"ariaSelected\"\n [attr.aria-level]=\"level + 1\"\n >\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 ",
41
+ styles: ["\n .k-task.k-focus {\n box-shadow: 0 0 4px 3px grey;\n outline: none;\n }\n .k-task.k-focus.k-state-selected {\n box-shadow: 0 0 4px 3px #ffaea8;\n }\n "]
38
42
  }),
39
- tslib_1.__metadata("design:paramtypes", [MappingService,
43
+ tslib_1.__param(0, Inject(TOUCH_ENABLED)),
44
+ tslib_1.__metadata("design:paramtypes", [Boolean, MappingService,
40
45
  TimelineViewService,
41
46
  DependencyDomService,
42
47
  OptionChangesService,
43
- ChangeDetectorRef])
48
+ ChangeDetectorRef,
49
+ NavigationService])
44
50
  ], GanttMilestoneTaskComponent);
45
51
  return GanttMilestoneTaskComponent;
46
52
  }(GanttTaskBase));
@@ -3,23 +3,37 @@
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 { ChangeDetectorRef, Component, forwardRef, HostBinding, Input, TemplateRef } from '@angular/core';
6
+ import { ChangeDetectorRef, Component, forwardRef, HostBinding, Inject, Input, TemplateRef } from '@angular/core';
7
7
  import { MappingService } from '../common/mapping.service';
8
+ import { NavigationService } from '../navigation/navigation.service';
9
+ import { TOUCH_ENABLED } from '../common/touch-enabled';
8
10
  import { DependencyDomService } from '../dependencies/dependency-dom.service';
9
11
  import { OptionChangesService } from '../common/option-changes.service';
10
12
  import { TimelineViewService } from './../timeline/timeline-view.service';
11
13
  import { GanttTaskBase } from './gantt-task-base';
14
+ import { isPresent } from '../utils';
12
15
  /**
13
16
  * @hidden
14
17
  */
15
18
  var GanttSummaryTaskComponent = /** @class */ (function (_super) {
16
19
  tslib_1.__extends(GanttSummaryTaskComponent, _super);
17
- function GanttSummaryTaskComponent(mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) {
18
- var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) || this;
20
+ function GanttSummaryTaskComponent(touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) {
21
+ var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) || this;
22
+ _this.touchEnabled = touchEnabled;
19
23
  _this.summaryWrapperClass = true;
20
24
  return _this;
21
25
  }
22
26
  GanttSummaryTaskComponent_1 = GanttSummaryTaskComponent;
27
+ Object.defineProperty(GanttSummaryTaskComponent.prototype, "ariaExpanded", {
28
+ get: function () {
29
+ // if no callback is provided, all child items are displayed and the item is regarded as expanded
30
+ // replicates the TreeList aria-expanded behavior
31
+ var isExpanded = !isPresent(this.isExpanded) || this.isExpanded(this.dataItem);
32
+ return String(isExpanded);
33
+ },
34
+ enumerable: true,
35
+ configurable: true
36
+ });
23
37
  var GanttSummaryTaskComponent_1;
24
38
  tslib_1.__decorate([
25
39
  HostBinding('class.k-summary-wrap'),
@@ -29,6 +43,10 @@ var GanttSummaryTaskComponent = /** @class */ (function (_super) {
29
43
  Input(),
30
44
  tslib_1.__metadata("design:type", TemplateRef)
31
45
  ], GanttSummaryTaskComponent.prototype, "template", void 0);
46
+ tslib_1.__decorate([
47
+ Input(),
48
+ tslib_1.__metadata("design:type", Function)
49
+ ], GanttSummaryTaskComponent.prototype, "isExpanded", void 0);
32
50
  GanttSummaryTaskComponent = GanttSummaryTaskComponent_1 = tslib_1.__decorate([
33
51
  Component({
34
52
  selector: 'kendo-gantt-summary-task',
@@ -38,13 +56,16 @@ var GanttSummaryTaskComponent = /** @class */ (function (_super) {
38
56
  useExisting: forwardRef(function () { return GanttSummaryTaskComponent_1; })
39
57
  }
40
58
  ],
41
- template: "\n <div\n #task\n class=\"k-task k-task-summary\"\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 <div *ngIf=\"!template; else summaryTemplate\"\n class=\"k-task-summary-progress\"\n [style.width.px]=\"taskWidth\">\n <div\n class=\"k-task-summary-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n >\n </div>\n </div>\n <ng-template\n #summaryTemplate\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{\n $implicit: dataItem,\n elementWidth: taskWidth\n }\"\n >\n </ng-template>\n </div>\n "
59
+ template: "\n <div\n #task\n role=\"treeitem\"\n class=\"k-task k-task-summary\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.width.px]=\"taskWidth\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n [attr.aria-selected]=\"ariaSelected\"\n [attr.aria-expanded]=\"ariaExpanded\"\n [attr.aria-level]=\"level + 1\"\n >\n <div *ngIf=\"!template; else summaryTemplate\"\n class=\"k-task-summary-progress\"\n [style.width.px]=\"taskWidth\">\n <div\n class=\"k-task-summary-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n >\n </div>\n </div>\n <ng-template\n #summaryTemplate\n [ngTemplateOutlet]=\"template\"\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 ",
60
+ styles: ["\n .k-task.k-focus {\n box-shadow: 0 0 4px 3px grey;\n outline: none;\n }\n .k-task.k-focus.k-state-selected {\n box-shadow: 0 0 4px 3px #ffaea8;\n }\n "]
42
61
  }),
43
- tslib_1.__metadata("design:paramtypes", [MappingService,
62
+ tslib_1.__param(0, Inject(TOUCH_ENABLED)),
63
+ tslib_1.__metadata("design:paramtypes", [Boolean, MappingService,
44
64
  TimelineViewService,
45
65
  DependencyDomService,
46
66
  OptionChangesService,
47
- ChangeDetectorRef])
67
+ ChangeDetectorRef,
68
+ NavigationService])
48
69
  ], GanttSummaryTaskComponent);
49
70
  return GanttSummaryTaskComponent;
50
71
  }(GanttTaskBase));
@@ -12,24 +12,42 @@ var slotUnitDuration = {
12
12
  week: MS_PER_DAY,
13
13
  month: MS_PER_DAY * 7
14
14
  };
15
+ var FOCUSED_CLASS = 'k-focus';
15
16
  /**
16
17
  * @hidden
17
18
  */
18
19
  var GanttTaskBase = /** @class */ (function () {
19
20
  function GanttTaskBase(mapper, // left public to be available for usage in the templates
20
- timelineViewService, dependencyDomService, optionChangesService, cdr) {
21
+ timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) {
21
22
  var _this = this;
22
23
  this.mapper = mapper;
23
24
  this.timelineViewService = timelineViewService;
24
25
  this.dependencyDomService = dependencyDomService;
25
26
  this.optionChangesService = optionChangesService;
26
27
  this.cdr = cdr;
28
+ this.navigationService = navigationService;
27
29
  this.wrapperClass = true;
28
- this.viewChangesSubscription = new Subscription();
29
- this.viewChangesSubscription.add(this.optionChangesService.viewChanges.subscribe(function () {
30
- _this.cdr.markForCheck();
31
- }));
30
+ this.subscriptions = new Subscription();
31
+ this.subscriptions.add(this.optionChangesService.viewChanges
32
+ .subscribe(function () { return _this.cdr.markForCheck(); }));
33
+ this.subscriptions.add(this.navigationService.taskStatusChanges
34
+ .subscribe(this.updateActiveState.bind(this)));
32
35
  }
36
+ Object.defineProperty(GanttTaskBase.prototype, "taskIndexAttribute", {
37
+ get: function () {
38
+ return this.index;
39
+ },
40
+ enumerable: true,
41
+ configurable: true
42
+ });
43
+ Object.defineProperty(GanttTaskBase.prototype, "ariaSelected", {
44
+ get: function () {
45
+ // assinging null will not render the attribute at all (desired in selectable="false" mode)
46
+ return this.selectable ? String(this.isSelected(this.dataItem)) : null;
47
+ },
48
+ enumerable: true,
49
+ configurable: true
50
+ });
33
51
  Object.defineProperty(GanttTaskBase.prototype, "slotUnitDuration", {
34
52
  get: function () {
35
53
  return slotUnitDuration[this.activeView];
@@ -51,23 +69,6 @@ var GanttTaskBase = /** @class */ (function () {
51
69
  enumerable: true,
52
70
  configurable: true
53
71
  });
54
- GanttTaskBase.prototype.ngOnChanges = function (changes) {
55
- if (isPresent(changes.dataItem)) {
56
- if (isPresent(changes.dataItem.previousValue)) {
57
- this.dependencyDomService.unregisterTask(changes.dataItem.previousValue);
58
- }
59
- this.dependencyDomService.registerTask(this.dataItem, this.taskElement.nativeElement);
60
- }
61
- else if (isPresent(changes.activeView)) {
62
- this.dependencyDomService.notifyChanges();
63
- }
64
- };
65
- GanttTaskBase.prototype.ngOnDestroy = function () {
66
- if (isPresent(this.dataItem)) {
67
- this.dependencyDomService.unregisterTask(this.dataItem);
68
- }
69
- this.viewChangesSubscription.unsubscribe();
70
- };
71
72
  Object.defineProperty(GanttTaskBase.prototype, "taskWidth", {
72
73
  get: function () {
73
74
  var itemDuration = this.mapper.extractFromTask(this.dataItem, 'end') - this.mapper.extractFromTask(this.dataItem, 'start');
@@ -79,6 +80,12 @@ var GanttTaskBase = /** @class */ (function () {
79
80
  configurable: true
80
81
  });
81
82
  Object.defineProperty(GanttTaskBase.prototype, "taskOffset", {
83
+ /**
84
+ * 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.
85
+ * 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
86
+ * and hovering just the .k-task element doesn't expose the drag clues.
87
+ * Additionally, positioning the entire container takes care of positioning the hints as well.
88
+ */
82
89
  get: function () {
83
90
  var timeAfterViewStart = this.mapper.extractFromTask(this.dataItem, 'start') - this.viewService.viewStart;
84
91
  var offsetInSlotUnits = timeAfterViewStart / this.slotUnitDuration;
@@ -97,10 +104,48 @@ var GanttTaskBase = /** @class */ (function () {
97
104
  enumerable: true,
98
105
  configurable: true
99
106
  });
107
+ GanttTaskBase.prototype.ngOnChanges = function (changes) {
108
+ if (isPresent(changes.dataItem)) {
109
+ if (isPresent(changes.dataItem.previousValue)) {
110
+ this.dependencyDomService.unregisterTask(changes.dataItem.previousValue);
111
+ }
112
+ this.dependencyDomService.registerTask(this.dataItem, this.taskElement.nativeElement);
113
+ }
114
+ else if (isPresent(changes.activeView)) {
115
+ this.dependencyDomService.notifyChanges();
116
+ }
117
+ if (this.navigationService.enabled && isPresent(changes.index)) {
118
+ this.updateActiveState(this.navigationService.activeTask);
119
+ }
120
+ };
121
+ GanttTaskBase.prototype.ngOnDestroy = function () {
122
+ if (isPresent(this.dataItem)) {
123
+ this.dependencyDomService.unregisterTask(this.dataItem);
124
+ }
125
+ this.subscriptions.unsubscribe();
126
+ };
127
+ GanttTaskBase.prototype.updateActiveState = function (_a) {
128
+ var activeIndex = _a.activeIndex, isFocused = _a.isFocused;
129
+ var isActive = activeIndex === this.index;
130
+ var tabindex = isActive ? '0' : '-1';
131
+ this.taskElement.nativeElement.setAttribute('tabindex', tabindex);
132
+ if (isActive && isFocused) {
133
+ this.taskElement.nativeElement.focus();
134
+ this.taskElement.nativeElement.classList.add(FOCUSED_CLASS);
135
+ }
136
+ else {
137
+ this.taskElement.nativeElement.classList.remove(FOCUSED_CLASS);
138
+ }
139
+ };
100
140
  tslib_1.__decorate([
101
141
  HostBinding('class.k-task-wrap'),
102
142
  tslib_1.__metadata("design:type", Boolean)
103
143
  ], GanttTaskBase.prototype, "wrapperClass", void 0);
144
+ tslib_1.__decorate([
145
+ HostBinding('attr.data-task-index'),
146
+ tslib_1.__metadata("design:type", Number),
147
+ tslib_1.__metadata("design:paramtypes", [])
148
+ ], GanttTaskBase.prototype, "taskIndexAttribute", null);
104
149
  tslib_1.__decorate([
105
150
  ViewChild('task', { static: true }),
106
151
  tslib_1.__metadata("design:type", ElementRef)
@@ -113,6 +158,18 @@ var GanttTaskBase = /** @class */ (function () {
113
158
  Input(),
114
159
  tslib_1.__metadata("design:type", Number)
115
160
  ], GanttTaskBase.prototype, "index", void 0);
161
+ tslib_1.__decorate([
162
+ Input(),
163
+ tslib_1.__metadata("design:type", Number)
164
+ ], GanttTaskBase.prototype, "level", void 0);
165
+ tslib_1.__decorate([
166
+ Input(),
167
+ tslib_1.__metadata("design:type", Boolean)
168
+ ], GanttTaskBase.prototype, "renderDependencyDragClues", void 0);
169
+ tslib_1.__decorate([
170
+ Input(),
171
+ tslib_1.__metadata("design:type", Boolean)
172
+ ], GanttTaskBase.prototype, "selectable", void 0);
116
173
  tslib_1.__decorate([
117
174
  Input(),
118
175
  tslib_1.__metadata("design:type", Function)
@@ -125,6 +182,11 @@ var GanttTaskBase = /** @class */ (function () {
125
182
  Input(),
126
183
  tslib_1.__metadata("design:type", Function)
127
184
  ], GanttTaskBase.prototype, "taskClass", void 0);
185
+ tslib_1.__decorate([
186
+ HostBinding('style.left.px'),
187
+ tslib_1.__metadata("design:type", Number),
188
+ tslib_1.__metadata("design:paramtypes", [])
189
+ ], GanttTaskBase.prototype, "taskOffset", null);
128
190
  return GanttTaskBase;
129
191
  }());
130
192
  export { GanttTaskBase };
@@ -3,27 +3,30 @@
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 { ChangeDetectorRef, Component, forwardRef, Input, TemplateRef } from '@angular/core';
6
+ import { ChangeDetectorRef, Component, forwardRef, Inject, Input, TemplateRef } from '@angular/core';
7
7
  import { MappingService } from '../common/mapping.service';
8
+ import { NavigationService } from '../navigation/navigation.service';
9
+ import { EditService } from '../editing/edit.service';
10
+ import { TOUCH_ENABLED } from '../common/touch-enabled';
8
11
  import { DependencyDomService } from '../dependencies/dependency-dom.service';
9
12
  import { OptionChangesService } from '../common/option-changes.service';
10
13
  import { TimelineViewService } from './../timeline/timeline-view.service';
11
14
  import { GanttTaskBase } from './gantt-task-base';
12
- import { EditService } from '../editing/edit.service';
13
15
  /**
14
16
  * @hidden
15
17
  */
16
18
  var GanttTaskComponent = /** @class */ (function (_super) {
17
19
  tslib_1.__extends(GanttTaskComponent, _super);
18
- function GanttTaskComponent(mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, editService) {
19
- var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) || this;
20
+ function GanttTaskComponent(editService, touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) {
21
+ var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) || this;
20
22
  _this.editService = editService;
23
+ _this.touchEnabled = touchEnabled;
21
24
  return _this;
22
25
  }
23
26
  GanttTaskComponent_1 = GanttTaskComponent;
24
27
  GanttTaskComponent.prototype.onTaskDelete = function () {
25
28
  this.editService.dataItem = this.dataItem;
26
- this.editService.showConfirmationDialog.next();
29
+ this.editService.taskDelete.next(this.dataItem);
27
30
  };
28
31
  var GanttTaskComponent_1;
29
32
  tslib_1.__decorate([
@@ -43,14 +46,16 @@ var GanttTaskComponent = /** @class */ (function (_super) {
43
46
  useExisting: forwardRef(function () { return GanttTaskComponent_1; })
44
47
  }
45
48
  ],
46
- 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 "
49
+ template: "\n <div\n #task\n class=\"k-task k-task-single\"\n role=\"treeitem\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.width.px]=\"taskWidth\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n [attr.aria-selected]=\"ariaSelected\"\n [attr.aria-level]=\"level + 1\"\n >\n <ng-container *ngIf=\"!taskTemplate\">\n <div\n class=\"k-task-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n aria-hidden=\"true\"\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\n class=\"k-task-actions\"\n aria-hidden=\"true\"\n >\n <span\n class=\"k-link k-task-delete\"\n [kendoEventsOutsideAngular]=\"{\n click: onTaskDelete\n }\"\n [scope]=\"this\"\n >\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 ",
50
+ styles: ["\n .k-task.k-focus {\n box-shadow: 0 0 4px 3px grey;\n outline: none;\n }\n .k-task.k-focus.k-state-selected {\n box-shadow: 0 0 4px 3px #ffaea8;\n }\n "]
47
51
  }),
48
- tslib_1.__metadata("design:paramtypes", [MappingService,
52
+ tslib_1.__param(1, Inject(TOUCH_ENABLED)),
53
+ tslib_1.__metadata("design:paramtypes", [EditService, Boolean, MappingService,
49
54
  TimelineViewService,
50
55
  DependencyDomService,
51
56
  OptionChangesService,
52
57
  ChangeDetectorRef,
53
- EditService])
58
+ NavigationService])
54
59
  ], GanttTaskComponent);
55
60
  return GanttTaskComponent;
56
61
  }(GanttTaskBase));
@@ -6,8 +6,8 @@ import * as tslib_1 from "tslib";
6
6
  import { Component, Input, TemplateRef, ViewChild, ElementRef } from '@angular/core';
7
7
  import { isEqual } from '@progress/kendo-date-math';
8
8
  import { DependencyDomService } from '../dependencies/dependency-dom.service';
9
- import { isPresent } from '../utils';
10
9
  import { MappingService } from '../common/mapping.service';
10
+ import { isPresent } from '../utils';
11
11
  /**
12
12
  * @hidden
13
13
  */
@@ -27,14 +27,18 @@ var GanttTasksTableBodyComponent = /** @class */ (function () {
27
27
  enumerable: true,
28
28
  configurable: true
29
29
  });
30
- GanttTasksTableBodyComponent.prototype.isMileStone = function (task) {
31
- return !this.hasChildren(task) && isEqual(this.mapper.extractFromTask(task, 'start'), this.mapper.extractFromTask(task, 'end'));
30
+ GanttTasksTableBodyComponent.prototype.isMileStone = function (item) {
31
+ return !item.hasChildren && isEqual(this.mapper.extractFromTask(item.data, 'start'), this.mapper.extractFromTask(item.data, 'end'));
32
32
  };
33
33
  tslib_1.__decorate([
34
34
  ViewChild('timelineRow', { static: false }),
35
35
  tslib_1.__metadata("design:type", ElementRef),
36
36
  tslib_1.__metadata("design:paramtypes", [ElementRef])
37
37
  ], GanttTasksTableBodyComponent.prototype, "timelineRow", null);
38
+ tslib_1.__decorate([
39
+ Input(),
40
+ tslib_1.__metadata("design:type", Boolean)
41
+ ], GanttTasksTableBodyComponent.prototype, "selectable", void 0);
38
42
  tslib_1.__decorate([
39
43
  Input(),
40
44
  tslib_1.__metadata("design:type", Array)
@@ -62,15 +66,19 @@ var GanttTasksTableBodyComponent = /** @class */ (function () {
62
66
  tslib_1.__decorate([
63
67
  Input(),
64
68
  tslib_1.__metadata("design:type", Function)
65
- ], GanttTasksTableBodyComponent.prototype, "hasChildren", void 0);
69
+ ], GanttTasksTableBodyComponent.prototype, "isExpanded", void 0);
66
70
  tslib_1.__decorate([
67
71
  Input(),
68
72
  tslib_1.__metadata("design:type", Function)
69
73
  ], GanttTasksTableBodyComponent.prototype, "isTaskSelected", void 0);
74
+ tslib_1.__decorate([
75
+ Input(),
76
+ tslib_1.__metadata("design:type", Boolean)
77
+ ], GanttTasksTableBodyComponent.prototype, "renderDependencyDragClues", void 0);
70
78
  GanttTasksTableBodyComponent = tslib_1.__decorate([
71
79
  Component({
72
80
  selector: '[kendoGanttTasksTableBody]',
73
- 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 "
81
+ 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.data\"\n [level]=\"item.level\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [selectable]=\"selectable\"\n [isSelected]=\"isTaskSelected\"\n [index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-milestone-task>\n <ng-template #task>\n <kendo-gantt-summary-task\n *ngIf=\"item.hasChildren\"\n [dataItem]=\"item.data\"\n [level]=\"item.level\"\n [template]=\"summaryTaskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [selectable]=\"selectable\"\n [isSelected]=\"isTaskSelected\"\n [isExpanded]=\"isExpanded\"\n [index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-summary-task>\n <kendo-gantt-task\n *ngIf=\"!item.hasChildren\"\n [dataItem]=\"item.data\"\n [level]=\"item.level\"\n [taskContentTemplate]=\"taskContentTemplate\"\n [taskTemplate]=\"taskTemplate\"\n [activeView]=\"activeView\"\n [taskClass]=\"taskClass\"\n [selectable]=\"selectable\"\n [isSelected]=\"isTaskSelected\"\n [index]=\"index\"\n [renderDependencyDragClues]=\"renderDependencyDragClues\"\n >\n </kendo-gantt-task>\n </ng-template>\n </td>\n </tr>\n "
74
82
  }),
75
83
  tslib_1.__metadata("design:paramtypes", [DependencyDomService,
76
84
  MappingService])
@@ -0,0 +1,20 @@
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
+ /**
6
+ * @hidden
7
+ */
8
+ export var ScrollDirection;
9
+ (function (ScrollDirection) {
10
+ ScrollDirection[ScrollDirection["Backwards"] = -1] = "Backwards";
11
+ ScrollDirection[ScrollDirection["Forward"] = 1] = "Forward";
12
+ })(ScrollDirection || (ScrollDirection = {}));
13
+ /**
14
+ * @hidden
15
+ */
16
+ export var ScrollAxis;
17
+ (function (ScrollAxis) {
18
+ ScrollAxis["Vertical"] = "scrollTop";
19
+ ScrollAxis["Horizontal"] = "scrollLeft";
20
+ })(ScrollAxis || (ScrollAxis = {}));
@@ -0,0 +1,89 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import * as tslib_1 from "tslib";
6
+ import { Directive, ElementRef, Input, NgZone } from '@angular/core';
7
+ import { Subscription } from 'rxjs';
8
+ import { isPresent } from '../utils';
9
+ import { ScrollAxis, ScrollDirection } from './drag-scroll-settings';
10
+ import { TimelineScrollService } from './timeline-scroll.service';
11
+ import { getViewportBoundaries, scrollElement } from './utils';
12
+ /**
13
+ * @hidden
14
+ */
15
+ var TimelineScrollableDirective = /** @class */ (function () {
16
+ function TimelineScrollableDirective(timelineScrollableContainer, scrollService, zone) {
17
+ this.timelineScrollableContainer = timelineScrollableContainer;
18
+ this.scrollService = scrollService;
19
+ this.zone = zone;
20
+ this.subscriptions = new Subscription();
21
+ this.subscriptions.add(this.scrollService.horizontalScroll
22
+ .subscribe(this.scrollHorizontallyTo.bind(this)));
23
+ this.subscriptions.add(this.scrollService.verticalScroll
24
+ .subscribe(this.scrollVerticallyTo.bind(this)));
25
+ this.subscriptions.add(this.scrollService.scrollCancel
26
+ .subscribe(this.cancelScroll.bind(this)));
27
+ }
28
+ TimelineScrollableDirective.prototype.ngOnDestroy = function () {
29
+ this.subscriptions.unsubscribe();
30
+ };
31
+ TimelineScrollableDirective.prototype.scrollHorizontallyTo = function (left) {
32
+ var _this = this;
33
+ this.zone.runOutsideAngular(function () {
34
+ var container = _this.timelineScrollableContainer.nativeElement;
35
+ var visibleBoundaries = getViewportBoundaries(container);
36
+ if (left < visibleBoundaries.left + _this.scrollSettings.threshold) {
37
+ _this.horizontalScrollInterval = setInterval(function () {
38
+ return scrollElement(container, _this.scrollSettings.step, ScrollDirection.Backwards, ScrollAxis.Horizontal);
39
+ }, _this.scrollSettings.interval);
40
+ }
41
+ else if (left > visibleBoundaries.right - _this.scrollSettings.threshold) {
42
+ _this.horizontalScrollInterval = setInterval(function () {
43
+ return scrollElement(container, _this.scrollSettings.step, ScrollDirection.Forward, ScrollAxis.Horizontal);
44
+ }, _this.scrollSettings.interval);
45
+ }
46
+ });
47
+ };
48
+ TimelineScrollableDirective.prototype.scrollVerticallyTo = function (top) {
49
+ var _this = this;
50
+ this.zone.runOutsideAngular(function () {
51
+ var container = _this.timelineScrollableContainer.nativeElement;
52
+ var visibleBoundaries = getViewportBoundaries(container);
53
+ if (top < visibleBoundaries.top + _this.scrollSettings.threshold) {
54
+ _this.verticalScrollInterval = setInterval(function () {
55
+ return scrollElement(container, _this.scrollSettings.step, ScrollDirection.Backwards, ScrollAxis.Vertical);
56
+ }, _this.scrollSettings.interval);
57
+ }
58
+ else if (top > visibleBoundaries.bottom - _this.scrollSettings.threshold) {
59
+ _this.verticalScrollInterval = setInterval(function () {
60
+ return scrollElement(container, _this.scrollSettings.step, ScrollDirection.Forward, ScrollAxis.Vertical);
61
+ }, _this.scrollSettings.interval);
62
+ }
63
+ });
64
+ };
65
+ TimelineScrollableDirective.prototype.cancelScroll = function () {
66
+ if (isPresent(this.verticalScrollInterval)) {
67
+ clearInterval(this.verticalScrollInterval);
68
+ this.verticalScrollInterval = null;
69
+ }
70
+ if (isPresent(this.horizontalScrollInterval)) {
71
+ clearInterval(this.horizontalScrollInterval);
72
+ this.horizontalScrollInterval = null;
73
+ }
74
+ };
75
+ tslib_1.__decorate([
76
+ Input(),
77
+ tslib_1.__metadata("design:type", Object)
78
+ ], TimelineScrollableDirective.prototype, "scrollSettings", void 0);
79
+ TimelineScrollableDirective = tslib_1.__decorate([
80
+ Directive({
81
+ selector: '[kendoGanttTimelineScrollable]'
82
+ }),
83
+ tslib_1.__metadata("design:paramtypes", [ElementRef,
84
+ TimelineScrollService,
85
+ NgZone])
86
+ ], TimelineScrollableDirective);
87
+ return TimelineScrollableDirective;
88
+ }());
89
+ export { TimelineScrollableDirective };
@@ -0,0 +1,39 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import * as tslib_1 from "tslib";
6
+ import { Injectable } from '@angular/core';
7
+ import { Subject } from 'rxjs';
8
+ /**
9
+ * @hidden
10
+ *
11
+ * Notifies the timeline-scroll.directive to scroll into view to requested coordinates.
12
+ * The scrolling is performed based on client (viewport) coordinates.
13
+ */
14
+ var TimelineScrollService = /** @class */ (function () {
15
+ function TimelineScrollService() {
16
+ this.horizontalScroll = new Subject();
17
+ this.verticalScroll = new Subject();
18
+ this.scrollCancel = new Subject();
19
+ }
20
+ TimelineScrollService.prototype.ngOnDestroy = function () {
21
+ this.horizontalScroll.complete();
22
+ this.verticalScroll.complete();
23
+ this.scrollCancel.complete();
24
+ };
25
+ TimelineScrollService.prototype.requestHorizontalScroll = function (clientTop) {
26
+ this.horizontalScroll.next(clientTop);
27
+ };
28
+ TimelineScrollService.prototype.requestVerticalScroll = function (clientLeft) {
29
+ this.verticalScroll.next(clientLeft);
30
+ };
31
+ TimelineScrollService.prototype.requestScrollCancel = function () {
32
+ this.scrollCancel.next();
33
+ };
34
+ TimelineScrollService = tslib_1.__decorate([
35
+ Injectable()
36
+ ], TimelineScrollService);
37
+ return TimelineScrollService;
38
+ }());
39
+ export { TimelineScrollService };
@@ -0,0 +1,80 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { isDocumentAvailable } from '@progress/kendo-angular-common';
6
+ import { ScrollAxis, ScrollDirection } from './drag-scroll-settings';
7
+ import { isPresent } from '../utils';
8
+ /**
9
+ * @hidden
10
+ *
11
+ * Checks if the beginning of the scrollable element is reached (top/left).
12
+ * Floors the top value.
13
+ */
14
+ var isUpperLimitReached = function (element, axis) { return Math.floor(element[axis]) <= 0; };
15
+ var ɵ0 = isUpperLimitReached;
16
+ /**
17
+ * @hidden
18
+ *
19
+ * Checks if the end of the scrollable element is reached (bottom/right).
20
+ * Ceils the top value.
21
+ */
22
+ var isBottomLimitReached = function (element, axis) {
23
+ var elementSize = axis === ScrollAxis.Horizontal ?
24
+ element.scrollWidth - element.clientWidth :
25
+ element.scrollHeight - element.clientHeight;
26
+ return Math.ceil(element[axis]) >= elementSize;
27
+ };
28
+ var ɵ1 = isBottomLimitReached;
29
+ /**
30
+ * @hidden
31
+ *
32
+ * Scrolls the element in the given direction by the provided step in the provided scroll axis.
33
+ *
34
+ * If the targeted scroll incrementation doesn't yield any result due to device pixel ratio issues (https://github.com/dimitar-pechev/RenderingIndependentScrollOffsets#readme),
35
+ * increments the step with 1px and again attempts to change the scrollTop of the element, until the content is actually scrolled.
36
+ *
37
+ * Cuts the operation short after 20 unsuccessful attempts to prevent infinite loops in possible corner-case scenarios.
38
+ */
39
+ export var scrollElement = function (element, step, direction, scrollAxis) {
40
+ if (!(isPresent(element) && isDocumentAvailable())) {
41
+ return;
42
+ }
43
+ var initialScrollPosition = element[scrollAxis];
44
+ var currentStep = step;
45
+ var iterations = 0;
46
+ while (initialScrollPosition === element[scrollAxis] &&
47
+ !(direction === ScrollDirection.Backwards && isUpperLimitReached(element, scrollAxis)) &&
48
+ !(direction === ScrollDirection.Forward && isBottomLimitReached(element, scrollAxis)) &&
49
+ iterations < 20 // cut the operation short in 20 attempts - in case of a wild corner case
50
+ ) {
51
+ element[scrollAxis] += (currentStep * direction);
52
+ // try with a larger step if the current one doesn't update the scroll position successfully
53
+ currentStep += 1;
54
+ iterations += 1;
55
+ }
56
+ };
57
+ /**
58
+ * @hidden
59
+ *
60
+ * As client coordinates are not restricted to the range 0px - {viewportSize}px, but can have negative starting values or ending values greater than the viewport size,
61
+ * this function extracts the visible boundaries of the provided element - fall-backing to 0 when the top/left are below 0,
62
+ * and fall-backing to the actual visible size of the container for bottom/right.
63
+ */
64
+ export var getViewportBoundaries = function (element) {
65
+ var elementRect = element.getBoundingClientRect();
66
+ // if the beginning of the scrollable container is above/before the current viewport, fall-back to 0
67
+ var topLimit = Math.max(elementRect.top, 0);
68
+ var leftLimit = Math.max(elementRect.left, 0);
69
+ // if the end of the scrollable container is beneath/after the current viewport, fall-back to its client height
70
+ // add the distance from the start of the viewport to the beginning of the container to ensure scrolling bottom begins when the actual end of the container is reached
71
+ var bottomLimit = topLimit + Math.min(elementRect.bottom, element.clientHeight);
72
+ var rightLimit = leftLimit + Math.min(elementRect.right, element.clientWidth);
73
+ return {
74
+ top: topLimit,
75
+ bottom: bottomLimit,
76
+ left: leftLimit,
77
+ right: rightLimit
78
+ };
79
+ };
80
+ export { ɵ0, ɵ1 };