@progress/kendo-angular-gantt 2.0.0-next.202204011501 → 2.0.0-next.202204121507

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 (229) hide show
  1. package/binding-directives/flat-binding.directive.d.ts +24 -0
  2. package/binding-directives/hierarchy-binding.directive.d.ts +22 -0
  3. package/bundles/kendo-angular-gantt.umd.js +1 -1
  4. package/columns/cell-template.directive.d.ts +28 -0
  5. package/columns/column-base.d.ts +85 -0
  6. package/columns/column-group.component.d.ts +103 -0
  7. package/columns/column-menu-template.directive.d.ts +22 -0
  8. package/columns/column.component.d.ts +130 -0
  9. package/columns/columns.d.ts +15 -0
  10. package/columns/edit-template.directive.d.ts +26 -0
  11. package/columns/filter-cell-template.directive.d.ts +21 -0
  12. package/columns/filter-menu-template.directive.d.ts +20 -0
  13. package/columns/footer-template.directive.d.ts +24 -0
  14. package/columns/header-template.directive.d.ts +22 -0
  15. package/columns/span-column.component.d.ts +112 -0
  16. package/common/default-callbacks.d.ts +25 -0
  17. package/common/mapping.service.d.ts +38 -0
  18. package/common/option-changes.service.d.ts +17 -0
  19. package/common/touch-enabled.d.ts +9 -0
  20. package/dependencies/dependency-dom.service.d.ts +46 -0
  21. package/dependencies/dom-dependency-args.d.ts +24 -0
  22. package/dependencies/gantt-dependency.directive.d.ts +29 -0
  23. package/dependencies/utils.d.ts +53 -0
  24. package/dragging/dependency-drag-create.directive.d.ts +75 -0
  25. package/dragging/drag-validation-tooltip.component.d.ts +32 -0
  26. package/editing/add-task.component.d.ts +47 -0
  27. package/editing/dependencies-table.component.d.ts +42 -0
  28. package/editing/edit-dialog.component.d.ts +33 -0
  29. package/editing/edit.service.d.ts +44 -0
  30. package/editing/task-fields.component.d.ts +25 -0
  31. package/editing/utils.d.ts +10 -0
  32. package/esm2015/binding-directives/flat-binding.directive.js +34 -0
  33. package/esm2015/binding-directives/hierarchy-binding.directive.js +32 -0
  34. package/esm2015/columns/cell-template.directive.js +37 -0
  35. package/esm2015/columns/column-base.js +52 -0
  36. package/esm2015/columns/column-group.component.js +94 -0
  37. package/esm2015/columns/column-menu-template.directive.js +31 -0
  38. package/esm2015/columns/column.component.js +133 -0
  39. package/esm2015/columns/columns.js +15 -0
  40. package/esm2015/columns/edit-template.directive.js +35 -0
  41. package/esm2015/columns/filter-cell-template.directive.js +30 -0
  42. package/esm2015/columns/filter-menu-template.directive.js +29 -0
  43. package/esm2015/columns/footer-template.directive.js +33 -0
  44. package/esm2015/columns/header-template.directive.js +31 -0
  45. package/esm2015/columns/span-column.component.js +86 -0
  46. package/esm2015/common/default-callbacks.js +25 -0
  47. package/esm2015/common/mapping.service.js +64 -0
  48. package/esm2015/common/option-changes.service.js +26 -0
  49. package/esm2015/common/touch-enabled.js +9 -0
  50. package/esm2015/dependencies/dependency-dom.service.js +70 -0
  51. package/esm2015/dependencies/dom-dependency-args.js +5 -0
  52. package/esm2015/dependencies/gantt-dependency.directive.js +82 -0
  53. package/esm2015/dependencies/utils.js +195 -0
  54. package/esm2015/dragging/dependency-drag-create.directive.js +318 -0
  55. package/esm2015/dragging/drag-validation-tooltip.component.js +90 -0
  56. package/esm2015/editing/add-task.component.js +109 -0
  57. package/esm2015/editing/dependencies-table.component.js +196 -0
  58. package/esm2015/editing/edit-dialog.component.js +170 -0
  59. package/esm2015/editing/edit.service.js +111 -0
  60. package/esm2015/editing/task-fields.component.js +101 -0
  61. package/esm2015/editing/utils.js +15 -0
  62. package/esm2015/expanded-state/expand-event.js +9 -0
  63. package/esm2015/expanded-state/expandable.directive.js +23 -0
  64. package/esm2015/gantt.component.js +2227 -0
  65. package/esm2015/gantt.module.js +264 -0
  66. package/esm2015/kendo-angular-gantt.js +8 -0
  67. package/esm2015/localization/custom-messages.component.js +41 -0
  68. package/esm2015/localization/gantt-localization.service.js +25 -0
  69. package/esm2015/localization/localized-messages.directive.js +36 -0
  70. package/esm2015/localization/messages.js +157 -0
  71. package/esm2015/main.js +37 -0
  72. package/esm2015/models/cell-content-type.interface.js +5 -0
  73. package/esm2015/models/class-callbacks.js +5 -0
  74. package/esm2015/models/column-menu-settings.interface.js +5 -0
  75. package/esm2015/models/column-reorder-config.js +5 -0
  76. package/esm2015/models/date-range.interface.js +5 -0
  77. package/esm2015/models/dependency-type.enum.js +20 -0
  78. package/esm2015/models/events/cell-click-event.interface.js +5 -0
  79. package/esm2015/models/events/cell-close-event.interface.js +14 -0
  80. package/esm2015/models/events/click-event.interface.js +5 -0
  81. package/esm2015/models/events/column-locked-change-event.interface.js +5 -0
  82. package/esm2015/models/events/column-reorder-event.interface.js +5 -0
  83. package/esm2015/models/events/column-resize-event.interface.js +5 -0
  84. package/esm2015/models/events/column-visibility-change-event.interface.js +5 -0
  85. package/esm2015/models/events/data-state-change-event.interface.js +5 -0
  86. package/esm2015/models/events/dependency-add-event.interface.js +5 -0
  87. package/esm2015/models/events/selected-view-change-event.interface.js +5 -0
  88. package/esm2015/models/events/task-add-event.interface.js +5 -0
  89. package/esm2015/models/events/task-click-event.interface.js +5 -0
  90. package/esm2015/models/events/task-delete-event.interface.js +5 -0
  91. package/esm2015/models/events/task-edit-event.interface.js +5 -0
  92. package/esm2015/models/events/task-move-end-event.interface.js +5 -0
  93. package/esm2015/models/events/task-move-event.interface.js +5 -0
  94. package/esm2015/models/events/task-move-start-event.interface.js +5 -0
  95. package/esm2015/models/events/task-resize-end-event.interface.js +5 -0
  96. package/esm2015/models/events/task-resize-event.interface.js +5 -0
  97. package/esm2015/models/events/task-resize-start-event.interface.js +5 -0
  98. package/esm2015/models/filterable-settings.js +5 -0
  99. package/esm2015/models/gantt-dependency-model-fields.interface.js +13 -0
  100. package/esm2015/models/gantt-dependency.interface.js +5 -0
  101. package/esm2015/models/gantt-task-model-fields.interface.js +15 -0
  102. package/esm2015/models/gantt-task.interface.js +5 -0
  103. package/esm2015/models/models.js +7 -0
  104. package/esm2015/models/slot.interface.js +5 -0
  105. package/esm2015/models/sort-settings.js +17 -0
  106. package/esm2015/models/splitter-pane-options.interface.js +20 -0
  107. package/esm2015/models/timeline-options.interface.js +5 -0
  108. package/esm2015/models/timeline-view.js +5 -0
  109. package/esm2015/models/toolbar-settings.js +5 -0
  110. package/esm2015/models/view-item.interface.js +5 -0
  111. package/esm2015/navigation/navigation-models.js +5 -0
  112. package/esm2015/navigation/navigation.service.js +265 -0
  113. package/esm2015/navigation/utils.js +69 -0
  114. package/esm2015/package-metadata.js +15 -0
  115. package/esm2015/rendering/gantt-header-table-body.component.js +42 -0
  116. package/esm2015/rendering/gantt-milestone-task.component.js +107 -0
  117. package/esm2015/rendering/gantt-summary-task.component.js +158 -0
  118. package/esm2015/rendering/gantt-task-base.js +148 -0
  119. package/esm2015/rendering/gantt-task.component.js +204 -0
  120. package/esm2015/rendering/gantt-tasks-table-body.component.js +160 -0
  121. package/esm2015/scrolling/drag-scroll-settings.js +20 -0
  122. package/esm2015/scrolling/scroll-sync.service.js +80 -0
  123. package/esm2015/scrolling/timeline-scroll.directive.js +75 -0
  124. package/esm2015/scrolling/timeline-scroll.service.js +39 -0
  125. package/esm2015/scrolling/utils.js +77 -0
  126. package/esm2015/selection/selectable.directive.js +112 -0
  127. package/esm2015/selection/selection-change-event.js +5 -0
  128. package/esm2015/template-directives/summary-task-template.directive.js +50 -0
  129. package/esm2015/template-directives/task-content-template.directive.js +45 -0
  130. package/esm2015/template-directives/task-template.directive.js +48 -0
  131. package/esm2015/timeline/gantt-timeline.component.js +334 -0
  132. package/esm2015/timeline/timeline-base-view.service.js +160 -0
  133. package/esm2015/timeline/timeline-day-view.component.js +38 -0
  134. package/esm2015/timeline/timeline-day-view.service.js +66 -0
  135. package/esm2015/timeline/timeline-month-view.component.js +38 -0
  136. package/esm2015/timeline/timeline-month-view.service.js +64 -0
  137. package/esm2015/timeline/timeline-view.service.js +35 -0
  138. package/esm2015/timeline/timeline-week-view.component.js +38 -0
  139. package/esm2015/timeline/timeline-week-view.service.js +60 -0
  140. package/esm2015/timeline/view-base.js +45 -0
  141. package/esm2015/toolbar/toolbar-template.directive.js +127 -0
  142. package/esm2015/toolbar/toolbar.component.js +94 -0
  143. package/esm2015/toolbar/view-selector.component.js +96 -0
  144. package/esm2015/utils.js +293 -0
  145. package/expanded-state/expand-event.d.ts +13 -0
  146. package/expanded-state/expandable.directive.d.ts +20 -0
  147. package/fesm2015/kendo-angular-gantt.js +7706 -0
  148. package/gantt.component.d.ts +750 -0
  149. package/gantt.module.d.ts +94 -0
  150. package/kendo-angular-gantt.d.ts +9 -0
  151. package/localization/custom-messages.component.d.ts +18 -0
  152. package/localization/gantt-localization.service.d.ts +18 -0
  153. package/localization/localized-messages.directive.d.ts +16 -0
  154. package/localization/messages.d.ts +293 -0
  155. package/main.d.ts +39 -0
  156. package/models/cell-content-type.interface.d.ts +10 -0
  157. package/models/class-callbacks.d.ts +43 -0
  158. package/models/column-menu-settings.interface.d.ts +26 -0
  159. package/models/column-reorder-config.d.ts +10 -0
  160. package/models/date-range.interface.d.ts +19 -0
  161. package/models/dependency-type.enum.d.ts +19 -0
  162. package/models/events/cell-click-event.interface.d.ts +43 -0
  163. package/models/events/cell-close-event.interface.d.ts +48 -0
  164. package/models/events/click-event.interface.d.ts +23 -0
  165. package/models/events/column-locked-change-event.interface.d.ts +16 -0
  166. package/models/events/column-reorder-event.interface.d.ts +10 -0
  167. package/models/events/column-resize-event.interface.d.ts +10 -0
  168. package/models/events/column-visibility-change-event.interface.d.ts +14 -0
  169. package/models/events/data-state-change-event.interface.d.ts +10 -0
  170. package/models/events/dependency-add-event.interface.d.ts +26 -0
  171. package/models/events/selected-view-change-event.interface.d.ts +19 -0
  172. package/models/events/task-add-event.interface.d.ts +31 -0
  173. package/models/events/task-click-event.interface.d.ts +30 -0
  174. package/models/events/task-delete-event.interface.d.ts +21 -0
  175. package/models/events/task-edit-event.interface.d.ts +76 -0
  176. package/models/events/task-move-end-event.interface.d.ts +12 -0
  177. package/models/events/task-move-event.interface.d.ts +23 -0
  178. package/models/events/task-move-start-event.interface.d.ts +15 -0
  179. package/models/events/task-resize-end-event.interface.d.ts +12 -0
  180. package/models/events/task-resize-event.interface.d.ts +23 -0
  181. package/models/events/task-resize-start-event.interface.d.ts +15 -0
  182. package/models/filterable-settings.d.ts +10 -0
  183. package/models/gantt-dependency-model-fields.interface.d.ts +35 -0
  184. package/models/gantt-dependency.interface.d.ts +26 -0
  185. package/models/gantt-task-model-fields.interface.d.ts +42 -0
  186. package/models/gantt-task.interface.d.ts +31 -0
  187. package/models/models.d.ts +42 -0
  188. package/models/slot.interface.d.ts +31 -0
  189. package/models/sort-settings.d.ts +42 -0
  190. package/models/splitter-pane-options.interface.d.ts +54 -0
  191. package/models/timeline-options.interface.d.ts +41 -0
  192. package/models/timeline-view.d.ts +8 -0
  193. package/models/toolbar-settings.d.ts +29 -0
  194. package/models/view-item.interface.d.ts +35 -0
  195. package/navigation/navigation-models.d.ts +38 -0
  196. package/navigation/navigation.service.d.ts +130 -0
  197. package/navigation/utils.d.ts +26 -0
  198. package/package-metadata.d.ts +9 -0
  199. package/package.json +9 -13
  200. package/rendering/gantt-header-table-body.component.d.ts +14 -0
  201. package/rendering/gantt-milestone-task.component.d.ts +22 -0
  202. package/rendering/gantt-summary-task.component.d.ts +25 -0
  203. package/rendering/gantt-task-base.d.ts +59 -0
  204. package/rendering/gantt-task.component.d.ts +26 -0
  205. package/rendering/gantt-tasks-table-body.component.d.ts +33 -0
  206. package/scrolling/drag-scroll-settings.d.ts +47 -0
  207. package/scrolling/scroll-sync.service.d.ts +33 -0
  208. package/scrolling/timeline-scroll.directive.d.ts +27 -0
  209. package/scrolling/timeline-scroll.service.d.ts +23 -0
  210. package/scrolling/utils.d.ts +29 -0
  211. package/selection/selectable.directive.d.ts +45 -0
  212. package/selection/selection-change-event.d.ts +25 -0
  213. package/template-directives/summary-task-template.directive.d.ts +41 -0
  214. package/template-directives/task-content-template.directive.d.ts +36 -0
  215. package/template-directives/task-template.directive.d.ts +39 -0
  216. package/timeline/gantt-timeline.component.d.ts +67 -0
  217. package/timeline/timeline-base-view.service.d.ts +77 -0
  218. package/timeline/timeline-day-view.component.d.ts +18 -0
  219. package/timeline/timeline-day-view.service.d.ts +38 -0
  220. package/timeline/timeline-month-view.component.d.ts +18 -0
  221. package/timeline/timeline-month-view.service.d.ts +38 -0
  222. package/timeline/timeline-view.service.d.ts +19 -0
  223. package/timeline/timeline-week-view.component.d.ts +18 -0
  224. package/timeline/timeline-week-view.service.d.ts +38 -0
  225. package/timeline/view-base.d.ts +34 -0
  226. package/toolbar/toolbar-template.directive.d.ts +112 -0
  227. package/toolbar/toolbar.component.d.ts +29 -0
  228. package/toolbar/view-selector.component.d.ts +43 -0
  229. package/utils.d.ts +166 -0
@@ -0,0 +1,64 @@
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 { Injectable } from '@angular/core';
6
+ import { getter } from '@progress/kendo-common';
7
+ import { DEFAULT_DEPENDENCY_MODEL_FIELDS } from '../models/gantt-dependency-model-fields.interface';
8
+ import { DEFAULT_TASK_MODEL_FIELDS } from '../models/gantt-task-model-fields.interface';
9
+ import { isPresent } from '../utils';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * @hidden
13
+ */
14
+ export class MappingService {
15
+ constructor() {
16
+ this._taskFields = Object.assign({}, DEFAULT_TASK_MODEL_FIELDS);
17
+ this._dependencyFields = Object.assign({}, DEFAULT_DEPENDENCY_MODEL_FIELDS);
18
+ }
19
+ /**
20
+ * Gets or sets the model fields for the task data items.
21
+ * Uses the default values for fields which are not specified.
22
+ */
23
+ set taskFields(fields) {
24
+ this._taskFields = Object.assign(Object.assign({}, DEFAULT_TASK_MODEL_FIELDS), fields);
25
+ }
26
+ get taskFields() {
27
+ return this._taskFields;
28
+ }
29
+ /**
30
+ * Gets or sets the model fields for the depenency data items.
31
+ * Uses the default values for fields which are not specified.
32
+ */
33
+ set dependencyFields(fields) {
34
+ this._dependencyFields = Object.assign(Object.assign({}, DEFAULT_DEPENDENCY_MODEL_FIELDS), fields);
35
+ }
36
+ get dependencyFields() {
37
+ return this._dependencyFields;
38
+ }
39
+ /**
40
+ * Retrieves the value for the specified task field.
41
+ * Supports nested fields as well (e.g. 'manager.id').
42
+ */
43
+ extractFromTask(dataItem, field) {
44
+ if (!isPresent(this.taskFields)) {
45
+ return null;
46
+ }
47
+ return getter(this.taskFields[field])(dataItem);
48
+ }
49
+ /**
50
+ * Retrieves the value for the specified dependency field.
51
+ * Supports nested fields as well (e.g. 'manager.id').
52
+ */
53
+ extractFromDependency(dataItem, field) {
54
+ if (!isPresent(this.dependencyFields)) {
55
+ return null;
56
+ }
57
+ return getter(this.dependencyFields[field])(dataItem);
58
+ }
59
+ }
60
+ MappingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MappingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
61
+ MappingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MappingService });
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: MappingService, decorators: [{
63
+ type: Injectable
64
+ }] });
@@ -0,0 +1,26 @@
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 { Injectable, EventEmitter } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * @hidden
9
+ */
10
+ export class OptionChangesService {
11
+ constructor() {
12
+ this.viewChanges = new EventEmitter();
13
+ this.columnChanges = new EventEmitter();
14
+ }
15
+ notifyColumnChanges() {
16
+ this.columnChanges.emit();
17
+ }
18
+ notifyViewChanges() {
19
+ this.viewChanges.emit();
20
+ }
21
+ }
22
+ OptionChangesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OptionChangesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
23
+ OptionChangesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OptionChangesService });
24
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: OptionChangesService, decorators: [{
25
+ type: Injectable
26
+ }] });
@@ -0,0 +1,9 @@
1
+ /**-----------------------------------------------------------------------------------------
2
+ * Copyright © 2021 Progress Software Corporation. All rights reserved.
3
+ * Licensed under commercial license. See LICENSE.md in the project root for more information
4
+ *-------------------------------------------------------------------------------------------*/
5
+ import { InjectionToken } from '@angular/core';
6
+ /**
7
+ * @hidden
8
+ */
9
+ export const TOUCH_ENABLED = new InjectionToken('gantt-touch-enabled');
@@ -0,0 +1,70 @@
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 { Injectable } from '@angular/core';
6
+ import { Subject } from 'rxjs';
7
+ import * as i0 from "@angular/core";
8
+ import * as i1 from "../common/mapping.service";
9
+ /**
10
+ * @hidden
11
+ */
12
+ export class DependencyDomService {
13
+ constructor(mapper) {
14
+ this.mapper = mapper;
15
+ this.notifier = new Subject();
16
+ /**
17
+ * Maps each rendered task to its HTML element.
18
+ * Uses the task ID field value as key.
19
+ */
20
+ this.tasks = new Map();
21
+ }
22
+ /**
23
+ * Emits each time some of the tasks or the view have changed.
24
+ * Fires also on the first change of the table rows and the parent container.
25
+ */
26
+ get taskChanges() {
27
+ return this.notifier.asObservable();
28
+ }
29
+ get dependencyDomArgs() {
30
+ return {
31
+ tasks: this.tasks,
32
+ contentContainer: this.contentContainer,
33
+ timelineRow: this.timelineRow
34
+ };
35
+ }
36
+ ngOnDestroy() {
37
+ this.tasks.clear();
38
+ this.tasks = null;
39
+ this.contentContainer = null;
40
+ }
41
+ registerTimelineRow(timelineRow) {
42
+ this.timelineRow = timelineRow;
43
+ this.notifyChanges();
44
+ }
45
+ registerContentContainer(contentContainer) {
46
+ this.contentContainer = contentContainer;
47
+ this.notifyChanges();
48
+ }
49
+ registerTask(task, element) {
50
+ const id = this.mapper.extractFromTask(task, 'id');
51
+ this.tasks.set(id, element);
52
+ this.notifyChanges();
53
+ }
54
+ unregisterTask(task) {
55
+ const id = this.mapper.extractFromTask(task, 'id');
56
+ this.tasks.delete(id);
57
+ this.notifyChanges();
58
+ }
59
+ /**
60
+ * Notifies all dependency directives that a change in one of the elements has occured.
61
+ */
62
+ notifyChanges() {
63
+ this.notifier.next(this.dependencyDomArgs);
64
+ }
65
+ }
66
+ DependencyDomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DependencyDomService, deps: [{ token: i1.MappingService }], target: i0.ɵɵFactoryTarget.Injectable });
67
+ DependencyDomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DependencyDomService });
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: DependencyDomService, decorators: [{
69
+ type: Injectable
70
+ }], ctorParameters: function () { return [{ type: i1.MappingService }]; } });
@@ -0,0 +1,5 @@
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
+ export {};
@@ -0,0 +1,82 @@
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 { Directive, Input } from '@angular/core';
6
+ import { Subscription } from 'rxjs';
7
+ import { map, switchMap, take } from 'rxjs/operators';
8
+ import { isPresent } from '../utils';
9
+ import { dependencyCoordinates, getElementRect } from './utils';
10
+ import { isDocumentAvailable } from '@progress/kendo-angular-common';
11
+ import * as i0 from "@angular/core";
12
+ import * as i1 from "../common/mapping.service";
13
+ import * as i2 from "./dependency-dom.service";
14
+ /**
15
+ * Defines the size of the arrow that will be drawn at the end of each Gantt dependency.
16
+ */
17
+ const ARROW_SIZE = 4;
18
+ /**
19
+ * Defines the distance the polyline will cover from the task element before making a turn.
20
+ */
21
+ const MIN_DISTANCE_BEFORE_TURN = 10;
22
+ /**
23
+ * @hidden
24
+ */
25
+ export class GanttDependencyDirective {
26
+ constructor(polyline, zone, renderer, mapper, dependencyDomService) {
27
+ this.polyline = polyline;
28
+ this.zone = zone;
29
+ this.renderer = renderer;
30
+ this.mapper = mapper;
31
+ this.dependencyDomService = dependencyDomService;
32
+ this.subscriptions = new Subscription();
33
+ this.subscriptions.add(dependencyDomService.taskChanges
34
+ .pipe(switchMap(changes =>
35
+ // reacts only on the very last event emission,
36
+ // ensures that the tasks are drawn in the DOM
37
+ this.zone.onStable.pipe(take(1), map(() => changes))))
38
+ .subscribe(changes => this.updatePoints(changes)));
39
+ }
40
+ ngOnDestroy() {
41
+ this.subscriptions.unsubscribe();
42
+ }
43
+ ngOnChanges(changes) {
44
+ if (isPresent(changes.dependency)) {
45
+ this.updatePoints(this.dependencyDomService.dependencyDomArgs);
46
+ }
47
+ }
48
+ updatePoints({ timelineRow, contentContainer, tasks }) {
49
+ if (!isPresent(timelineRow) || !isPresent(contentContainer) ||
50
+ !isPresent(tasks) || tasks.size === 0 ||
51
+ !tasks.has(this.mapper.extractFromDependency(this.dependency, 'fromId')) || !tasks.has(this.mapper.extractFromDependency(this.dependency, 'toId'))) {
52
+ this.clearPoints();
53
+ return;
54
+ }
55
+ const fromCoordinates = getElementRect(tasks.get(this.mapper.extractFromDependency(this.dependency, 'fromId')), contentContainer);
56
+ const toCoordinates = getElementRect(tasks.get(this.mapper.extractFromDependency(this.dependency, 'toId')), contentContainer);
57
+ const timelineRowHeight = isDocumentAvailable() ? timelineRow.getBoundingClientRect().height : 0;
58
+ const points = dependencyCoordinates(fromCoordinates, toCoordinates, timelineRowHeight, this.dependency.type, MIN_DISTANCE_BEFORE_TURN, ARROW_SIZE);
59
+ this.drawPoints(points);
60
+ }
61
+ clearPoints() {
62
+ this.renderer.setAttribute(this.polyline.nativeElement, 'points', '');
63
+ }
64
+ drawPoints(points) {
65
+ if (!isPresent(points) || points.length === 0) {
66
+ this.clearPoints();
67
+ return;
68
+ }
69
+ const parsedCoords = points.map(({ left, top }) => `${left},${top}`).join(' ');
70
+ this.renderer.setAttribute(this.polyline.nativeElement, 'points', parsedCoords);
71
+ }
72
+ }
73
+ GanttDependencyDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: GanttDependencyDirective, deps: [{ token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i1.MappingService }, { token: i2.DependencyDomService }], target: i0.ɵɵFactoryTarget.Directive });
74
+ GanttDependencyDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: GanttDependencyDirective, selector: "[kendoGanttDependency]", inputs: { dependency: "dependency" }, usesOnChanges: true, ngImport: i0 });
75
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: GanttDependencyDirective, decorators: [{
76
+ type: Directive,
77
+ args: [{
78
+ selector: '[kendoGanttDependency]'
79
+ }]
80
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i1.MappingService }, { type: i2.DependencyDomService }]; }, propDecorators: { dependency: [{
81
+ type: Input
82
+ }] } });
@@ -0,0 +1,195 @@
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 { DependencyType } from '../models/dependency-type.enum';
6
+ /**
7
+ * @hidden
8
+ *
9
+ * Gets the offset (top and left values) relative to a target element.
10
+ */
11
+ export const getOffsetRelativeToParent = (element, targetParent) => {
12
+ let offset = {
13
+ top: 0,
14
+ left: 0
15
+ };
16
+ if (!targetParent.contains(element)) {
17
+ return offset;
18
+ }
19
+ let offsetParent = element;
20
+ while (offsetParent && offsetParent !== targetParent) {
21
+ offset.top += offsetParent.offsetTop;
22
+ offset.left += offsetParent.offsetLeft;
23
+ offsetParent = offsetParent.offsetParent;
24
+ }
25
+ return offset;
26
+ };
27
+ /**
28
+ * @hidden
29
+ */
30
+ export const getElementRect = (element, relativeContainer) => {
31
+ const { top, left } = getOffsetRelativeToParent(element, relativeContainer);
32
+ return {
33
+ top: top + element.offsetHeight / 2,
34
+ left: left,
35
+ right: left + element.offsetWidth
36
+ };
37
+ };
38
+ /**
39
+ * @hidden
40
+ */
41
+ export const dependencyCoordinates = (from, to, rowHeight, type, minDistanceBeforeTurn, arrowSize) => {
42
+ const points = [];
43
+ const minTurnHeight = Math.floor(rowHeight / 2);
44
+ const drawingDown = from.top < to.top;
45
+ let top, left;
46
+ // FF and SS are composed of 4 connected polyline points (not counting the arrow)
47
+ /*
48
+ [[[]]]- -[[[]]]
49
+ | |
50
+ [[[]]]- -[[[]]]
51
+ */
52
+ if (type === DependencyType.FF || type === DependencyType.SS) {
53
+ // polyline start from first task
54
+ const dir = type === DependencyType.SS ? 'left' : 'right';
55
+ top = from.top;
56
+ left = from[dir];
57
+ points.push({ top, left });
58
+ // first turn point
59
+ left = Math[dir === 'left' ? 'min' : 'max'](from[dir], to[dir]);
60
+ left = dir === 'left' ? left - minDistanceBeforeTurn : left + minDistanceBeforeTurn;
61
+ points.push({ top, left });
62
+ // second turn point
63
+ top = to.top;
64
+ points.push({ top, left });
65
+ // second task reached
66
+ left = dir === 'left' ? to[dir] - arrowSize : to[dir] + arrowSize;
67
+ points.push({ top, left });
68
+ // arrow pointing to the second task
69
+ points.push(...getArrow(top, left, dir !== 'left', arrowSize));
70
+ }
71
+ else {
72
+ // FS and SF are composed of 4 or 6 connected polyline points (not counting the arrow), depending on the position of the tasks
73
+ /*
74
+ [[[]]]- [[[]]]-
75
+ | |
76
+ -[[[]]] -----
77
+ |
78
+ -[[[]]]
79
+ */
80
+ const startDir = type === DependencyType.SF ? 'left' : 'right';
81
+ const endDir = type === DependencyType.SF ? 'right' : 'left';
82
+ const additionalTurn = type === DependencyType.SF
83
+ ? from[startDir] - minDistanceBeforeTurn * 2 < to[endDir]
84
+ : from[startDir] + minDistanceBeforeTurn * 2 > to[endDir];
85
+ // polyline start from first task
86
+ top = from.top;
87
+ left = from[startDir];
88
+ points.push({ top, left });
89
+ // first turn point
90
+ left = startDir === 'left'
91
+ ? left - minDistanceBeforeTurn
92
+ : left + minDistanceBeforeTurn;
93
+ points.push({ top, left });
94
+ // if second task start is before the first task end in FS
95
+ // if second task end is after the first task start in SF
96
+ if (additionalTurn) {
97
+ // additional turn start
98
+ top = drawingDown
99
+ ? top + minTurnHeight
100
+ : top - minTurnHeight;
101
+ points.push({ top, left });
102
+ // additional turn end
103
+ left = startDir === 'left'
104
+ ? to[endDir] + minDistanceBeforeTurn
105
+ : to[endDir] - minDistanceBeforeTurn;
106
+ points.push({ top, left });
107
+ }
108
+ // second task level reached
109
+ top = to.top;
110
+ points.push({ top, left });
111
+ // second task element reached
112
+ left = endDir === 'left' ? to[endDir] - arrowSize : to[endDir] + arrowSize;
113
+ points.push({ top, left });
114
+ // arrow pointing to the second task
115
+ points.push(...getArrow(top, left, endDir !== 'left', arrowSize));
116
+ }
117
+ return points;
118
+ };
119
+ const getArrow = (top, left, isArrowWest, arrowSize) => {
120
+ const points = isArrowWest
121
+ ? getArrowWest(top, left, arrowSize)
122
+ : getArrowEast(top, left, arrowSize);
123
+ return points;
124
+ };
125
+ const getArrowWest = (top, left, arrowSize) => {
126
+ const points = [];
127
+ points.push({
128
+ top: top - arrowSize / 2,
129
+ left
130
+ });
131
+ points.push({
132
+ top,
133
+ left: left - arrowSize + 1
134
+ });
135
+ points.push({
136
+ top: top + arrowSize / 2,
137
+ left
138
+ });
139
+ points.push({
140
+ top,
141
+ left
142
+ });
143
+ return points;
144
+ };
145
+ const getArrowEast = (top, left, arrowSize) => {
146
+ const points = [];
147
+ points.push({
148
+ top: top + arrowSize / 2,
149
+ left
150
+ });
151
+ points.push({
152
+ top,
153
+ left: left + arrowSize - 1
154
+ });
155
+ points.push({
156
+ top: top - arrowSize / 2,
157
+ left
158
+ });
159
+ points.push({
160
+ top,
161
+ left
162
+ });
163
+ return points;
164
+ };
165
+ /**
166
+ * @hidden
167
+ *
168
+ * Translates the provided client `left` and `top` coords to coords relative to the provided container.
169
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSSOM_View/Coordinate_systems#standard_cssom_coordinate_systems
170
+ */
171
+ export const clientToOffsetCoords = (clientLeft, clientTop, offsetContainer) => {
172
+ // client (viewport) coordinates of the target container
173
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#value
174
+ const offsetContainerClientRect = offsetContainer.getBoundingClientRect();
175
+ return {
176
+ left: clientLeft - offsetContainerClientRect.left + offsetContainer.scrollLeft,
177
+ top: clientTop - offsetContainerClientRect.top + offsetContainer.scrollTop
178
+ };
179
+ };
180
+ /**
181
+ * @hidden
182
+ *
183
+ * Retrieves the `left` and `top` values of the center of the provided element.
184
+ * The retrieved values are relative to the current viewport (client values).
185
+ * https://developer.mozilla.org/en-US/docs/Web/CSS/CSSOM_View/Coordinate_systems#standard_cssom_coordinate_systems
186
+ */
187
+ export const getElementClientCenterCoords = (element) => {
188
+ // client (viewport) coordinates of the targeted element
189
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#value
190
+ const { left, top, width, height } = element.getBoundingClientRect();
191
+ return {
192
+ left: left + (width / 2),
193
+ top: top + (height / 2)
194
+ };
195
+ };