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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/dist/cdn/js/kendo-angular-gantt.js +2 -2
  2. package/dist/cdn/main.js +4 -4
  3. package/dist/es/common/touch-enabled.js +9 -0
  4. package/dist/es/dependencies/utils.js +40 -5
  5. package/dist/es/dragging/dependency-drag-create.directive.js +347 -0
  6. package/dist/es/dragging/drag-validation-tooltip.component.js +27 -0
  7. package/dist/es/editing/add-task.component.js +94 -0
  8. package/dist/es/editing/dependencies-table.component.js +131 -0
  9. package/dist/es/editing/edit-dialog.component.js +39 -8
  10. package/dist/es/editing/edit.service.js +92 -8
  11. package/dist/es/editing/task-fields.component.js +43 -0
  12. package/dist/es/editing/{util.js → utils.js} +0 -0
  13. package/dist/es/gantt.component.js +408 -56
  14. package/dist/es/gantt.module.js +37 -9
  15. package/dist/es/index.js +9 -0
  16. package/dist/es/localization/gantt-localization.service.js +26 -0
  17. package/dist/es/localization/messages.js +45 -1
  18. package/dist/es/main.js +1 -0
  19. package/dist/es/models/dependency-type.enum.js +16 -0
  20. package/dist/es/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
  21. package/dist/es/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
  22. package/dist/es/models/events/{remove-event.interface.js → task-delete-event.interface.js} +0 -0
  23. package/dist/es/models/models.js +1 -0
  24. package/dist/es/models/{toolbar-position.js → toolbar-settings.js} +0 -0
  25. package/dist/{es2015/models/events/add-event.interface.js → es/models/view-item.interface.js} +0 -0
  26. package/dist/{es2015/models/events/edit-event.interface.js → es/navigation/navigation-models.js} +0 -0
  27. package/dist/es/navigation/navigation.service.js +390 -0
  28. package/dist/es/navigation/utils.js +77 -0
  29. package/dist/es/package-metadata.js +1 -1
  30. package/dist/es/rendering/gantt-milestone-task.component.js +12 -6
  31. package/dist/es/rendering/gantt-summary-task.component.js +27 -6
  32. package/dist/es/rendering/gantt-task-base.js +84 -22
  33. package/dist/es/rendering/gantt-task.component.js +13 -8
  34. package/dist/es/rendering/gantt-tasks-table-body.component.js +13 -5
  35. package/dist/es/scrolling/drag-scroll-settings.js +20 -0
  36. package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
  37. package/dist/es/scrolling/timeline-scroll.service.js +39 -0
  38. package/dist/es/scrolling/utils.js +80 -0
  39. package/dist/es/timeline/gantt-timeline.component.js +50 -4
  40. package/dist/es/toolbar/toolbar.component.js +20 -13
  41. package/dist/es/toolbar/view-selector.component.js +1 -1
  42. package/dist/es/utils.js +153 -12
  43. package/dist/es2015/common/touch-enabled.d.ts +9 -0
  44. package/dist/es2015/common/touch-enabled.js +9 -0
  45. package/dist/es2015/dependencies/utils.d.ts +15 -0
  46. package/dist/es2015/dependencies/utils.js +40 -5
  47. package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
  48. package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
  49. package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
  50. package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
  51. package/dist/es2015/editing/add-task.component.d.ts +45 -0
  52. package/dist/es2015/editing/add-task.component.js +102 -0
  53. package/dist/es2015/editing/dependencies-table.component.d.ts +39 -0
  54. package/dist/es2015/editing/dependencies-table.component.js +160 -0
  55. package/dist/es2015/editing/edit-dialog.component.d.ts +11 -4
  56. package/dist/es2015/editing/edit-dialog.component.js +66 -36
  57. package/dist/es2015/editing/edit.service.d.ts +24 -4
  58. package/dist/es2015/editing/edit.service.js +81 -11
  59. package/dist/es2015/editing/task-fields.component.d.ts +22 -0
  60. package/dist/es2015/editing/task-fields.component.js +67 -0
  61. package/dist/es2015/editing/{util.d.ts → utils.d.ts} +2 -2
  62. package/dist/es2015/editing/{util.js → utils.js} +0 -0
  63. package/dist/es2015/gantt.component.d.ts +134 -31
  64. package/dist/es2015/gantt.component.js +419 -61
  65. package/dist/es2015/gantt.module.js +37 -9
  66. package/dist/es2015/index.d.ts +9 -0
  67. package/dist/es2015/index.js +9 -0
  68. package/dist/es2015/index.metadata.json +1 -1
  69. package/dist/es2015/{models/events/edit-event.interface.d.ts → localization/gantt-localization.service.d.ts} +6 -10
  70. package/dist/es2015/localization/gantt-localization.service.js +25 -0
  71. package/dist/es2015/localization/messages.d.ts +46 -2
  72. package/dist/es2015/localization/messages.js +45 -1
  73. package/dist/es2015/main.d.ts +1 -0
  74. package/dist/es2015/main.js +1 -0
  75. package/dist/es2015/models/dependency-type.enum.d.ts +1 -1
  76. package/dist/es2015/models/dependency-type.enum.js +16 -0
  77. package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
  78. package/dist/es2015/models/events/{remove-event.interface.js → dependency-add-event.interface.js} +0 -0
  79. package/dist/es2015/models/events/task-add-event.interface.d.ts +31 -0
  80. package/dist/es2015/models/{toolbar-position.js → events/task-add-event.interface.js} +0 -0
  81. package/dist/es2015/models/events/task-click-event.interface.d.ts +3 -3
  82. package/dist/es2015/models/events/task-delete-event.interface.d.ts +21 -0
  83. package/dist/es2015/models/events/task-delete-event.interface.js +4 -0
  84. package/dist/es2015/models/events/task-edit-event.interface.d.ts +36 -6
  85. package/dist/es2015/models/models.d.ts +6 -3
  86. package/dist/es2015/models/models.js +1 -0
  87. package/dist/es2015/models/toolbar-settings.d.ts +29 -0
  88. package/dist/es2015/models/toolbar-settings.js +4 -0
  89. package/dist/es2015/models/view-item.interface.d.ts +35 -0
  90. package/dist/es2015/models/view-item.interface.js +4 -0
  91. package/dist/es2015/navigation/navigation-models.d.ts +34 -0
  92. package/dist/es2015/navigation/navigation-models.js +4 -0
  93. package/dist/es2015/navigation/navigation.service.d.ts +126 -0
  94. package/dist/es2015/navigation/navigation.service.js +355 -0
  95. package/dist/es2015/navigation/utils.d.ts +26 -0
  96. package/dist/es2015/navigation/utils.js +69 -0
  97. package/dist/es2015/package-metadata.js +1 -1
  98. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +3 -1
  99. package/dist/es2015/rendering/gantt-milestone-task.component.js +35 -8
  100. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +5 -1
  101. package/dist/es2015/rendering/gantt-summary-task.component.js +47 -8
  102. package/dist/es2015/rendering/gantt-task-base.d.ts +20 -6
  103. package/dist/es2015/rendering/gantt-task-base.js +75 -22
  104. package/dist/es2015/rendering/gantt-task.component.d.ts +4 -2
  105. package/dist/es2015/rendering/gantt-task.component.js +47 -13
  106. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +6 -3
  107. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +27 -9
  108. package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
  109. package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
  110. package/dist/es2015/scrolling/scroll-sync.service.d.ts +1 -1
  111. package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
  112. package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
  113. package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
  114. package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
  115. package/dist/es2015/scrolling/utils.d.ts +29 -0
  116. package/dist/es2015/scrolling/utils.js +80 -0
  117. package/dist/es2015/timeline/gantt-timeline.component.d.ts +29 -4
  118. package/dist/es2015/timeline/gantt-timeline.component.js +67 -5
  119. package/dist/es2015/toolbar/toolbar-template.directive.d.ts +1 -1
  120. package/dist/es2015/toolbar/toolbar.component.d.ts +6 -5
  121. package/dist/es2015/toolbar/toolbar.component.js +22 -13
  122. package/dist/es2015/toolbar/view-selector.component.js +3 -1
  123. package/dist/es2015/utils.d.ts +77 -8
  124. package/dist/es2015/utils.js +153 -12
  125. package/dist/fesm2015/index.js +5258 -3012
  126. package/dist/fesm5/index.js +2862 -733
  127. package/dist/npm/common/touch-enabled.js +11 -0
  128. package/dist/npm/dependencies/utils.js +40 -5
  129. package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
  130. package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
  131. package/dist/npm/editing/add-task.component.js +96 -0
  132. package/dist/npm/editing/dependencies-table.component.js +133 -0
  133. package/dist/npm/editing/edit-dialog.component.js +38 -7
  134. package/dist/npm/editing/edit.service.js +91 -7
  135. package/dist/npm/editing/task-fields.component.js +45 -0
  136. package/dist/npm/editing/{util.js → utils.js} +0 -0
  137. package/dist/npm/gantt.component.js +409 -57
  138. package/dist/npm/gantt.module.js +35 -7
  139. package/dist/npm/index.js +18 -0
  140. package/dist/npm/localization/gantt-localization.service.js +28 -0
  141. package/dist/npm/localization/messages.js +45 -1
  142. package/dist/npm/main.js +2 -0
  143. package/dist/npm/models/dependency-type.enum.js +16 -0
  144. package/dist/npm/models/events/{add-event.interface.js → dependency-add-event.interface.js} +0 -0
  145. package/dist/npm/models/events/{edit-event.interface.js → task-add-event.interface.js} +0 -0
  146. package/dist/npm/models/events/{remove-event.interface.js → task-delete-event.interface.js} +0 -0
  147. package/dist/npm/models/models.js +2 -0
  148. package/dist/npm/models/{toolbar-position.js → toolbar-settings.js} +0 -0
  149. package/dist/npm/models/view-item.interface.js +6 -0
  150. package/dist/npm/navigation/navigation-models.js +6 -0
  151. package/dist/npm/navigation/navigation.service.js +392 -0
  152. package/dist/npm/navigation/utils.js +79 -0
  153. package/dist/npm/package-metadata.js +1 -1
  154. package/dist/npm/rendering/gantt-milestone-task.component.js +11 -5
  155. package/dist/npm/rendering/gantt-summary-task.component.js +26 -5
  156. package/dist/npm/rendering/gantt-task-base.js +84 -22
  157. package/dist/npm/rendering/gantt-task.component.js +12 -7
  158. package/dist/npm/rendering/gantt-tasks-table-body.component.js +13 -5
  159. package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
  160. package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
  161. package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
  162. package/dist/npm/scrolling/utils.js +83 -0
  163. package/dist/npm/timeline/gantt-timeline.component.js +49 -3
  164. package/dist/npm/toolbar/toolbar.component.js +18 -11
  165. package/dist/npm/toolbar/view-selector.component.js +1 -1
  166. package/dist/npm/utils.js +153 -12
  167. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  168. package/package.json +7 -4
  169. package/dist/es2015/models/events/add-event.interface.d.ts +0 -16
  170. package/dist/es2015/models/events/remove-event.interface.d.ts +0 -16
  171. package/dist/es2015/models/toolbar-position.d.ts +0 -9
@@ -0,0 +1,77 @@
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 { Keys } from '@progress/kendo-angular-common';
6
+ // TODO: add those keys to `import { Keys } from '@progress/kendo-angular-common';`
7
+ var NumpadKeys;
8
+ (function (NumpadKeys) {
9
+ NumpadKeys[NumpadKeys["Digit1"] = 97] = "Digit1";
10
+ NumpadKeys[NumpadKeys["Digit2"] = 98] = "Digit2";
11
+ NumpadKeys[NumpadKeys["Digit3"] = 99] = "Digit3";
12
+ NumpadKeys[NumpadKeys["Digit4"] = 100] = "Digit4";
13
+ })(NumpadKeys || (NumpadKeys = {}));
14
+ /**
15
+ * @hidden
16
+ */
17
+ export var isArrowUpDownKey = function (keyCode) { return [
18
+ Keys.ArrowUp,
19
+ Keys.ArrowDown
20
+ ].some(function (arrowKeyCode) {
21
+ return keyCode === arrowKeyCode;
22
+ }); };
23
+ /**
24
+ * @hidden
25
+ */
26
+ export var isNavigationKey = function (keyCode) { return [
27
+ Keys.ArrowUp,
28
+ Keys.ArrowDown,
29
+ Keys.Home,
30
+ Keys.End
31
+ ].some(function (navigationKeyCode) {
32
+ return keyCode === navigationKeyCode;
33
+ }); };
34
+ /**
35
+ * @hidden
36
+ */
37
+ export var isExpandCollapseKey = function (keyCode, altKey) {
38
+ return altKey && [
39
+ Keys.ArrowLeft,
40
+ Keys.ArrowRight
41
+ ].some(function (navigationKeyCode) {
42
+ return keyCode === navigationKeyCode;
43
+ });
44
+ };
45
+ /**
46
+ * @hidden
47
+ */
48
+ export var isViewDigitKey = function (keyCode) { return [
49
+ Keys.Digit1,
50
+ NumpadKeys.Digit1,
51
+ Keys.Digit2,
52
+ NumpadKeys.Digit2,
53
+ Keys.Digit3,
54
+ NumpadKeys.Digit3,
55
+ Keys.Digit4,
56
+ NumpadKeys.Digit4
57
+ ].some(function (digitKeyCode) {
58
+ return keyCode === digitKeyCode;
59
+ }); };
60
+ /**
61
+ * @hidden
62
+ *
63
+ * Returns the corresponding view index for the pressed digit key (Digit 1 => 0, Digit 2 => 1, etc.).
64
+ */
65
+ export var getIndexFromViewDigitKeyCode = function (keyCode) {
66
+ switch (keyCode) {
67
+ case NumpadKeys.Digit1:
68
+ case Keys.Digit1: return 0;
69
+ case NumpadKeys.Digit2:
70
+ case Keys.Digit2: return 1;
71
+ case NumpadKeys.Digit3:
72
+ case Keys.Digit3: return 2;
73
+ case NumpadKeys.Digit4:
74
+ case Keys.Digit4: return 3;
75
+ default: return null;
76
+ }
77
+ };
@@ -9,7 +9,7 @@ export var packageMetadata = {
9
9
  name: '@progress/kendo-angular-gantt',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1639143747,
12
+ publishDate: 1642580546,
13
13
  version: '',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
15
15
  };
@@ -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 };