@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,24 @@
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 { ElementRef, NgZone } from '@angular/core';
6
+ import { DragScrollSettings } from './drag-scroll-settings';
7
+ import { TimelineScrollService } from './timeline-scroll.service';
8
+ /**
9
+ * @hidden
10
+ */
11
+ export declare class TimelineScrollableDirective {
12
+ private timelineScrollableContainer;
13
+ private scrollService;
14
+ private zone;
15
+ scrollSettings: DragScrollSettings;
16
+ private subscriptions;
17
+ private verticalScrollInterval;
18
+ private horizontalScrollInterval;
19
+ constructor(timelineScrollableContainer: ElementRef<Element>, scrollService: TimelineScrollService, zone: NgZone);
20
+ ngOnDestroy(): void;
21
+ private scrollHorizontallyTo;
22
+ private scrollVerticallyTo;
23
+ private cancelScroll;
24
+ }
@@ -0,0 +1,78 @@
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
+ let TimelineScrollableDirective = class TimelineScrollableDirective {
16
+ constructor(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
+ ngOnDestroy() {
29
+ this.subscriptions.unsubscribe();
30
+ }
31
+ scrollHorizontallyTo(left) {
32
+ this.zone.runOutsideAngular(() => {
33
+ const container = this.timelineScrollableContainer.nativeElement;
34
+ const visibleBoundaries = getViewportBoundaries(container);
35
+ if (left < visibleBoundaries.left + this.scrollSettings.threshold) {
36
+ this.horizontalScrollInterval = setInterval(() => scrollElement(container, this.scrollSettings.step, ScrollDirection.Backwards, ScrollAxis.Horizontal), this.scrollSettings.interval);
37
+ }
38
+ else if (left > visibleBoundaries.right - this.scrollSettings.threshold) {
39
+ this.horizontalScrollInterval = setInterval(() => scrollElement(container, this.scrollSettings.step, ScrollDirection.Forward, ScrollAxis.Horizontal), this.scrollSettings.interval);
40
+ }
41
+ });
42
+ }
43
+ scrollVerticallyTo(top) {
44
+ this.zone.runOutsideAngular(() => {
45
+ const container = this.timelineScrollableContainer.nativeElement;
46
+ const visibleBoundaries = getViewportBoundaries(container);
47
+ if (top < visibleBoundaries.top + this.scrollSettings.threshold) {
48
+ this.verticalScrollInterval = setInterval(() => scrollElement(container, this.scrollSettings.step, ScrollDirection.Backwards, ScrollAxis.Vertical), this.scrollSettings.interval);
49
+ }
50
+ else if (top > visibleBoundaries.bottom - this.scrollSettings.threshold) {
51
+ this.verticalScrollInterval = setInterval(() => scrollElement(container, this.scrollSettings.step, ScrollDirection.Forward, ScrollAxis.Vertical), this.scrollSettings.interval);
52
+ }
53
+ });
54
+ }
55
+ cancelScroll() {
56
+ if (isPresent(this.verticalScrollInterval)) {
57
+ clearInterval(this.verticalScrollInterval);
58
+ this.verticalScrollInterval = null;
59
+ }
60
+ if (isPresent(this.horizontalScrollInterval)) {
61
+ clearInterval(this.horizontalScrollInterval);
62
+ this.horizontalScrollInterval = null;
63
+ }
64
+ }
65
+ };
66
+ tslib_1.__decorate([
67
+ Input(),
68
+ tslib_1.__metadata("design:type", Object)
69
+ ], TimelineScrollableDirective.prototype, "scrollSettings", void 0);
70
+ TimelineScrollableDirective = tslib_1.__decorate([
71
+ Directive({
72
+ selector: '[kendoGanttTimelineScrollable]'
73
+ }),
74
+ tslib_1.__metadata("design:paramtypes", [ElementRef,
75
+ TimelineScrollService,
76
+ NgZone])
77
+ ], TimelineScrollableDirective);
78
+ export { TimelineScrollableDirective };
@@ -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
+ import { Subject } from 'rxjs';
6
+ /**
7
+ * @hidden
8
+ *
9
+ * Notifies the timeline-scroll.directive to scroll into view to requested coordinates.
10
+ * The scrolling is performed based on client (viewport) coordinates.
11
+ */
12
+ export declare class TimelineScrollService {
13
+ readonly horizontalScroll: Subject<number>;
14
+ readonly verticalScroll: Subject<number>;
15
+ readonly scrollCancel: Subject<any>;
16
+ ngOnDestroy(): void;
17
+ requestHorizontalScroll(clientTop: number): void;
18
+ requestVerticalScroll(clientLeft: number): void;
19
+ requestScrollCancel(): void;
20
+ }
@@ -0,0 +1,44 @@
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
+ let TimelineScrollService = class TimelineScrollService {
15
+ /**
16
+ * @hidden
17
+ *
18
+ * Notifies the timeline-scroll.directive to scroll into view to requested coordinates.
19
+ * The scrolling is performed based on client (viewport) coordinates.
20
+ */
21
+ constructor() {
22
+ this.horizontalScroll = new Subject();
23
+ this.verticalScroll = new Subject();
24
+ this.scrollCancel = new Subject();
25
+ }
26
+ ngOnDestroy() {
27
+ this.horizontalScroll.complete();
28
+ this.verticalScroll.complete();
29
+ this.scrollCancel.complete();
30
+ }
31
+ requestHorizontalScroll(clientTop) {
32
+ this.horizontalScroll.next(clientTop);
33
+ }
34
+ requestVerticalScroll(clientLeft) {
35
+ this.verticalScroll.next(clientLeft);
36
+ }
37
+ requestScrollCancel() {
38
+ this.scrollCancel.next();
39
+ }
40
+ };
41
+ TimelineScrollService = tslib_1.__decorate([
42
+ Injectable()
43
+ ], TimelineScrollService);
44
+ export { TimelineScrollService };
@@ -0,0 +1,29 @@
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 { ScrollAxis, ScrollDirection } from './drag-scroll-settings';
6
+ /**
7
+ * @hidden
8
+ *
9
+ * Scrolls the element in the given direction by the provided step in the provided scroll axis.
10
+ *
11
+ * If the targeted scroll incrementation doesn't yield any result due to device pixel ratio issues (https://github.com/dimitar-pechev/RenderingIndependentScrollOffsets#readme),
12
+ * increments the step with 1px and again attempts to change the scrollTop of the element, until the content is actually scrolled.
13
+ *
14
+ * Cuts the operation short after 20 unsuccessful attempts to prevent infinite loops in possible corner-case scenarios.
15
+ */
16
+ export declare const scrollElement: (element: Element, step: number, direction: ScrollDirection, scrollAxis: ScrollAxis) => void;
17
+ /**
18
+ * @hidden
19
+ *
20
+ * 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,
21
+ * this function extracts the visible boundaries of the provided element - fall-backing to 0 when the top/left are below 0,
22
+ * and fall-backing to the actual visible size of the container for bottom/right.
23
+ */
24
+ export declare const getViewportBoundaries: (element: Element) => {
25
+ top: number;
26
+ left: number;
27
+ right: number;
28
+ bottom: number;
29
+ };
@@ -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
+ const isUpperLimitReached = (element, axis) => Math.floor(element[axis]) <= 0;
15
+ const ɵ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
+ const isBottomLimitReached = (element, axis) => {
23
+ const elementSize = axis === ScrollAxis.Horizontal ?
24
+ element.scrollWidth - element.clientWidth :
25
+ element.scrollHeight - element.clientHeight;
26
+ return Math.ceil(element[axis]) >= elementSize;
27
+ };
28
+ const ɵ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 const scrollElement = (element, step, direction, scrollAxis) => {
40
+ if (!(isPresent(element) && isDocumentAvailable())) {
41
+ return;
42
+ }
43
+ const initialScrollPosition = element[scrollAxis];
44
+ let currentStep = step;
45
+ let 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 const getViewportBoundaries = (element) => {
65
+ const elementRect = element.getBoundingClientRect();
66
+ // if the beginning of the scrollable container is above/before the current viewport, fall-back to 0
67
+ const topLimit = Math.max(elementRect.top, 0);
68
+ const 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
+ const bottomLimit = topLimit + Math.min(elementRect.bottom, element.clientHeight);
72
+ const 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 };
@@ -2,10 +2,11 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { AfterViewInit, ElementRef, NgZone, Renderer2, TemplateRef } from '@angular/core';
5
+ import { AfterViewInit, ElementRef, EventEmitter, NgZone, Renderer2, TemplateRef, ViewContainerRef } from '@angular/core';
6
6
  import { ScrollSyncService } from '../scrolling/scroll-sync.service';
7
7
  import { DependencyDomService } from '../dependencies/dependency-dom.service';
8
- import { TimelineViewType, TaskClassFn } from '../models/models';
8
+ import { ViewItem } from '../models/view-item.interface';
9
+ import { TimelineViewType, TaskClassFn, DragScrollSettings } from '../models/models';
9
10
  /**
10
11
  * @hidden
11
12
  */
@@ -14,12 +15,26 @@ export declare class GanttTimelineComponent implements AfterViewInit {
14
15
  private dependencyDomService;
15
16
  private renderer;
16
17
  private zone;
18
+ /**
19
+ * Represents the scrollable container of the timeline content.
20
+ * Used externally by the DependencyDragCreateDirective.
21
+ */
17
22
  timelineContent: ElementRef<HTMLElement>;
18
23
  timelineColumns: ElementRef<HTMLElement>;
19
24
  timelineHeaderWrap: ElementRef<HTMLElement>;
20
25
  tasksContainer: ElementRef<HTMLElement>;
26
+ /**
27
+ * Represents the view container ref used for rendering the dependency drag popop.
28
+ * Used externally by the DependencyDragCreateDirective.
29
+ */
30
+ dragPopupContainer: ViewContainerRef;
31
+ /**
32
+ * Represents the polyline element used for rendering the dependency drag editing interaction.
33
+ * Used externally by the DependencyDragCreateDirective.
34
+ */
35
+ dependencyDragCreatePolyline: ElementRef<SVGPolylineElement>;
21
36
  hostClass: boolean;
22
- rows: any[];
37
+ rows: ViewItem[];
23
38
  slots: any[];
24
39
  groupSlots: any[];
25
40
  tableWidth: number;
@@ -28,9 +43,19 @@ export declare class GanttTimelineComponent implements AfterViewInit {
28
43
  taskTemplate: TemplateRef<any>;
29
44
  summaryTaskTemplate: TemplateRef<any>;
30
45
  taskClass: TaskClassFn;
46
+ renderDependencyDragClues: boolean;
47
+ dragScrollSettings: DragScrollSettings;
48
+ selectable: boolean;
31
49
  isTaskSelected: (item: object) => boolean;
32
- hasChildren: (item: object) => boolean;
50
+ isExpanded: (item: object) => boolean;
33
51
  dependencies: any[];
52
+ timelineContainerPress: EventEmitter<any>;
53
+ timelineContainerDrag: EventEmitter<any>;
54
+ timelineContainerRelease: EventEmitter<any>;
55
+ /**
56
+ * Specifies whether the draggable will attach or detach its pointer event listeners.
57
+ */
58
+ readonly draggableEnabled: boolean;
34
59
  private subscriptions;
35
60
  constructor(scrollSyncService: ScrollSyncService, dependencyDomService: DependencyDomService, renderer: Renderer2, zone: NgZone);
36
61
  ngAfterViewInit(): void;
@@ -3,13 +3,13 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
- import { Component, ElementRef, HostBinding, Input, NgZone, Renderer2, TemplateRef, ViewChild } from '@angular/core';
6
+ import { Component, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
7
7
  import { Subscription } from 'rxjs';
8
8
  import { filter, map, switchMap, take } from 'rxjs/operators';
9
+ import { isDocumentAvailable } from '@progress/kendo-angular-common';
9
10
  import { ScrollSyncService } from '../scrolling/scroll-sync.service';
10
11
  import { DependencyDomService } from '../dependencies/dependency-dom.service';
11
12
  import { isPresent } from '../utils';
12
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
13
13
  /**
14
14
  * @hidden
15
15
  */
@@ -21,6 +21,10 @@ let GanttTimelineComponent = class GanttTimelineComponent {
21
21
  this.zone = zone;
22
22
  this.hostClass = true;
23
23
  this.dependencies = [];
24
+ // as all drag-and-drop operations are on the timeline container, use a single draggable instance
25
+ this.timelineContainerPress = new EventEmitter();
26
+ this.timelineContainerDrag = new EventEmitter();
27
+ this.timelineContainerRelease = new EventEmitter();
24
28
  this.subscriptions = new Subscription();
25
29
  this.subscriptions.add(
26
30
  // task changes indicates change in row content, number, height, etc.
@@ -32,6 +36,12 @@ let GanttTimelineComponent = class GanttTimelineComponent {
32
36
  this.renderer.setStyle(this.timelineColumns.nativeElement, 'height', `${(this.rows || []).length * timelineRowHeight}px`);
33
37
  }));
34
38
  }
39
+ /**
40
+ * Specifies whether the draggable will attach or detach its pointer event listeners.
41
+ */
42
+ get draggableEnabled() {
43
+ return this.renderDependencyDragClues;
44
+ }
35
45
  ngAfterViewInit() {
36
46
  const timelineHeader = this.timelineHeaderWrap.nativeElement;
37
47
  const rightContainer = this.timelineContent.nativeElement;
@@ -62,6 +72,14 @@ tslib_1.__decorate([
62
72
  ViewChild('tasksContainer', { static: true }),
63
73
  tslib_1.__metadata("design:type", ElementRef)
64
74
  ], GanttTimelineComponent.prototype, "tasksContainer", void 0);
75
+ tslib_1.__decorate([
76
+ ViewChild('dragPopupContainer', { static: false, read: ViewContainerRef }),
77
+ tslib_1.__metadata("design:type", ViewContainerRef)
78
+ ], GanttTimelineComponent.prototype, "dragPopupContainer", void 0);
79
+ tslib_1.__decorate([
80
+ ViewChild('dependencyDragCreatePolyline', { static: false }),
81
+ tslib_1.__metadata("design:type", ElementRef)
82
+ ], GanttTimelineComponent.prototype, "dependencyDragCreatePolyline", void 0);
65
83
  tslib_1.__decorate([
66
84
  HostBinding('class.k-gantt-timeline'),
67
85
  tslib_1.__metadata("design:type", Boolean)
@@ -102,6 +120,18 @@ tslib_1.__decorate([
102
120
  Input(),
103
121
  tslib_1.__metadata("design:type", Function)
104
122
  ], GanttTimelineComponent.prototype, "taskClass", void 0);
123
+ tslib_1.__decorate([
124
+ Input(),
125
+ tslib_1.__metadata("design:type", Boolean)
126
+ ], GanttTimelineComponent.prototype, "renderDependencyDragClues", void 0);
127
+ tslib_1.__decorate([
128
+ Input(),
129
+ tslib_1.__metadata("design:type", Object)
130
+ ], GanttTimelineComponent.prototype, "dragScrollSettings", void 0);
131
+ tslib_1.__decorate([
132
+ Input(),
133
+ tslib_1.__metadata("design:type", Boolean)
134
+ ], GanttTimelineComponent.prototype, "selectable", void 0);
105
135
  tslib_1.__decorate([
106
136
  Input(),
107
137
  tslib_1.__metadata("design:type", Function)
@@ -109,11 +139,23 @@ tslib_1.__decorate([
109
139
  tslib_1.__decorate([
110
140
  Input(),
111
141
  tslib_1.__metadata("design:type", Function)
112
- ], GanttTimelineComponent.prototype, "hasChildren", void 0);
142
+ ], GanttTimelineComponent.prototype, "isExpanded", void 0);
113
143
  tslib_1.__decorate([
114
144
  Input(),
115
145
  tslib_1.__metadata("design:type", Array)
116
146
  ], GanttTimelineComponent.prototype, "dependencies", void 0);
147
+ tslib_1.__decorate([
148
+ Output(),
149
+ tslib_1.__metadata("design:type", EventEmitter)
150
+ ], GanttTimelineComponent.prototype, "timelineContainerPress", void 0);
151
+ tslib_1.__decorate([
152
+ Output(),
153
+ tslib_1.__metadata("design:type", EventEmitter)
154
+ ], GanttTimelineComponent.prototype, "timelineContainerDrag", void 0);
155
+ tslib_1.__decorate([
156
+ Output(),
157
+ tslib_1.__metadata("design:type", EventEmitter)
158
+ ], GanttTimelineComponent.prototype, "timelineContainerRelease", void 0);
117
159
  GanttTimelineComponent = tslib_1.__decorate([
118
160
  Component({
119
161
  selector: 'kendo-gantt-timeline',
@@ -133,7 +175,21 @@ GanttTimelineComponent = tslib_1.__decorate([
133
175
  </table>
134
176
  </div>
135
177
  </div>
136
- <div #timelineContent class="k-grid-content">
178
+ <!-- tabindex="-1" required for https://bugzilla.mozilla.org/show_bug.cgi?id=1069739 -->
179
+ <div
180
+ #timelineContent
181
+ class="k-grid-content"
182
+ tabindex="-1"
183
+ role="tree"
184
+ aria-roledescription="Timeline"
185
+ kendoGanttTimelineScrollable
186
+ [scrollSettings]="dragScrollSettings"
187
+ kendoDraggable
188
+ [enableDrag]="draggableEnabled"
189
+ (kendoPress)="timelineContainerPress.emit($event)"
190
+ (kendoDrag)="timelineContainerDrag.emit($event)"
191
+ (kendoRelease)="timelineContainerRelease.emit($event)"
192
+ >
137
193
  <div class="k-gantt-tables">
138
194
  <table
139
195
  class="k-gantt-rows"
@@ -184,8 +240,10 @@ GanttTimelineComponent = tslib_1.__decorate([
184
240
  [taskTemplate]="taskTemplate"
185
241
  [summaryTaskTemplate]="summaryTaskTemplate"
186
242
  [taskClass]="taskClass"
187
- [hasChildren]="hasChildren"
243
+ [isExpanded]="isExpanded"
244
+ [selectable]="selectable"
188
245
  [isTaskSelected]="isTaskSelected"
246
+ [renderDependencyDragClues]="renderDependencyDragClues"
189
247
  >
190
248
  </tbody>
191
249
  </table>
@@ -196,7 +254,11 @@ GanttTimelineComponent = tslib_1.__decorate([
196
254
  kendoGanttDependency
197
255
  [dependency]="dependency"
198
256
  />
257
+ <polyline #dependencyDragCreatePolyline />
199
258
  </svg>
259
+
260
+ <!-- placeholder for the dependency drag popup; its position is not arbitrary - the popup is intended to be absolutely positioned inside the .k-grid-content element -->
261
+ <ng-container #dragPopupContainer></ng-container>
200
262
  </div>
201
263
  </div>
202
264
  `
@@ -2,7 +2,7 @@
2
2
  * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { ToolbarPosition } from './../models/toolbar-position';
5
+ import { ToolbarPosition } from '../models/toolbar-settings';
6
6
  import { TemplateRef } from '@angular/core';
7
7
  /**
8
8
  * Represents the toolbar template of the Gantt.
@@ -3,20 +3,21 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { TemplateRef } from '@angular/core';
6
- import { GanttComponent } from "../gantt.component";
7
- import { ScrollSyncService } from '../scrolling/scroll-sync.service';
6
+ import { GanttComponent } from '../gantt.component';
8
7
  import { TimelineViewType } from './../models/timeline-view';
9
8
  /**
10
9
  * @hidden
11
10
  */
12
11
  export declare class ToolbarComponent {
13
12
  gantt: GanttComponent;
14
- private scrollSyncService;
15
13
  context: any;
14
+ role: string;
15
+ showAddTask: boolean;
16
+ showViewSelector: boolean;
16
17
  position: 'top' | 'bottom';
17
18
  readonly toolbarTemplateRef: TemplateRef<any>;
18
19
  readonly renderTemplate: boolean;
19
20
  private _position;
20
- constructor(gantt: GanttComponent, scrollSyncService: ScrollSyncService);
21
- onViewChange(e: TimelineViewType): void;
21
+ constructor(gantt: GanttComponent);
22
+ handleViewChange(view: TimelineViewType): void;
22
23
  }
@@ -3,17 +3,16 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as tslib_1 from "tslib";
6
- import { Component, Input } from '@angular/core';
7
- import { GanttComponent } from "../gantt.component";
8
- import { ScrollSyncService } from '../scrolling/scroll-sync.service';
6
+ import { Component, Input, HostBinding } from '@angular/core';
7
+ import { GanttComponent } from '../gantt.component';
9
8
  /**
10
9
  * @hidden
11
10
  */
12
11
  let ToolbarComponent = class ToolbarComponent {
13
- constructor(gantt, scrollSyncService) {
12
+ constructor(gantt) {
14
13
  this.gantt = gantt;
15
- this.scrollSyncService = scrollSyncService;
16
14
  this.context = {};
15
+ this.role = 'toolbar';
17
16
  }
18
17
  set position(value) {
19
18
  this.context.position = this._position = value;
@@ -29,13 +28,22 @@ let ToolbarComponent = class ToolbarComponent {
29
28
  const templatePosition = ganttToolbarTemplate ? ganttToolbarTemplate.position : null;
30
29
  return ganttToolbarTemplate && (templatePosition === 'both' || templatePosition === this.position);
31
30
  }
32
- onViewChange(e) {
33
- this.gantt.activeView = e; // TODO: may be load the timeline data directly in an activeView setter?
34
- this.gantt.loadTimelineData();
35
- this.gantt.activeViewChange.emit(e);
36
- this.scrollSyncService.resetTimelineScrollLeft();
31
+ handleViewChange(view) {
32
+ this.gantt.changeActiveView(view);
37
33
  }
38
34
  };
35
+ tslib_1.__decorate([
36
+ HostBinding('attr.role'),
37
+ tslib_1.__metadata("design:type", String)
38
+ ], ToolbarComponent.prototype, "role", void 0);
39
+ tslib_1.__decorate([
40
+ Input(),
41
+ tslib_1.__metadata("design:type", Boolean)
42
+ ], ToolbarComponent.prototype, "showAddTask", void 0);
43
+ tslib_1.__decorate([
44
+ Input(),
45
+ tslib_1.__metadata("design:type", Boolean)
46
+ ], ToolbarComponent.prototype, "showViewSelector", void 0);
39
47
  tslib_1.__decorate([
40
48
  Input(),
41
49
  tslib_1.__metadata("design:type", String),
@@ -46,11 +54,13 @@ ToolbarComponent = tslib_1.__decorate([
46
54
  selector: 'kendo-gantt-toolbar',
47
55
  template: `
48
56
  <ng-container *ngIf="!renderTemplate">
57
+ <kendo-gantt-add-task *ngIf="showAddTask"></kendo-gantt-add-task>
49
58
  <span class="k-spacer k-toolbar-spacer"></span>
50
59
  <kendo-gantt-view-selector
60
+ *ngIf="showViewSelector"
51
61
  [views]="gantt.viewTypes"
52
62
  [activeView]="gantt.activeView"
53
- (activeViewChange)="onViewChange($event)"></kendo-gantt-view-selector>
63
+ (activeViewChange)="handleViewChange($event)"></kendo-gantt-view-selector>
54
64
  </ng-container>
55
65
  <ng-template
56
66
  *ngIf="renderTemplate"
@@ -60,7 +70,6 @@ ToolbarComponent = tslib_1.__decorate([
60
70
  </ng-template>
61
71
  `
62
72
  }),
63
- tslib_1.__metadata("design:paramtypes", [GanttComponent,
64
- ScrollSyncService])
73
+ tslib_1.__metadata("design:paramtypes", [GanttComponent])
65
74
  ], ToolbarComponent);
66
75
  export { ToolbarComponent };
@@ -57,7 +57,9 @@ ViewSelectorComponent = tslib_1.__decorate([
57
57
  Component({
58
58
  selector: 'kendo-gantt-view-selector',
59
59
  template: `
60
- <select class="k-dropdown k-views-dropdown"
60
+ <select
61
+ class="k-dropdown k-views-dropdown"
62
+ aria-label="View Selector"
61
63
  [value]="activeView"
62
64
  (change)="activeViewChange.emit($event.target.value)">
63
65
  <option *ngFor="let view of views" [value]="view">{{getViewTypeText(view)}}</option>