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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/cdn/js/kendo-angular-gantt.js +2 -2
  2. package/dist/cdn/main.js +1 -29
  3. package/dist/es/common/touch-enabled.js +9 -0
  4. package/dist/es/dependencies/utils.js +34 -0
  5. package/dist/es/dragging/dependency-drag-create.directive.js +347 -0
  6. package/dist/es/dragging/drag-validation-tooltip.component.js +27 -0
  7. package/dist/es/editing/dependencies-table.component.js +1 -1
  8. package/dist/es/editing/edit-dialog.component.js +3 -3
  9. package/dist/es/editing/edit.service.js +4 -2
  10. package/dist/es/editing/task-fields.component.js +1 -1
  11. package/dist/es/editing/{util.js → utils.js} +0 -0
  12. package/dist/es/gantt.component.js +313 -28
  13. package/dist/es/gantt.module.js +23 -6
  14. package/dist/es/index.js +5 -0
  15. package/dist/es/main.js +1 -0
  16. package/dist/es/models/events/dependency-add-event.interface.js +4 -0
  17. package/dist/es/models/events/task-delete-event.interface.js +4 -0
  18. package/dist/es/models/view-item.interface.js +4 -0
  19. package/dist/es/navigation/navigation-models.js +4 -0
  20. package/dist/es/navigation/navigation.service.js +390 -0
  21. package/dist/es/navigation/utils.js +77 -0
  22. package/dist/es/package-metadata.js +1 -1
  23. package/dist/es/rendering/gantt-milestone-task.component.js +12 -6
  24. package/dist/es/rendering/gantt-summary-task.component.js +27 -6
  25. package/dist/es/rendering/gantt-task-base.js +84 -22
  26. package/dist/es/rendering/gantt-task.component.js +13 -8
  27. package/dist/es/rendering/gantt-tasks-table-body.component.js +13 -5
  28. package/dist/es/scrolling/drag-scroll-settings.js +20 -0
  29. package/dist/es/scrolling/timeline-scroll.directive.js +89 -0
  30. package/dist/es/scrolling/timeline-scroll.service.js +39 -0
  31. package/dist/es/scrolling/utils.js +80 -0
  32. package/dist/es/timeline/gantt-timeline.component.js +50 -4
  33. package/dist/es/toolbar/toolbar.component.js +12 -13
  34. package/dist/es/toolbar/view-selector.component.js +1 -1
  35. package/dist/es/utils.js +153 -12
  36. package/dist/es2015/common/touch-enabled.d.ts +9 -0
  37. package/dist/es2015/common/touch-enabled.js +9 -0
  38. package/dist/es2015/dependencies/utils.d.ts +15 -0
  39. package/dist/es2015/dependencies/utils.js +34 -0
  40. package/dist/es2015/dragging/dependency-drag-create.directive.d.ts +72 -0
  41. package/dist/es2015/dragging/dependency-drag-create.directive.js +324 -0
  42. package/dist/es2015/dragging/drag-validation-tooltip.component.d.ts +29 -0
  43. package/dist/es2015/dragging/drag-validation-tooltip.component.js +76 -0
  44. package/dist/es2015/editing/dependencies-table.component.js +1 -1
  45. package/dist/es2015/editing/edit-dialog.component.d.ts +1 -1
  46. package/dist/es2015/editing/edit-dialog.component.js +12 -4
  47. package/dist/es2015/editing/edit.service.d.ts +2 -3
  48. package/dist/es2015/editing/edit.service.js +4 -2
  49. package/dist/es2015/editing/task-fields.component.js +1 -1
  50. package/dist/es2015/editing/{util.d.ts → utils.d.ts} +2 -2
  51. package/dist/es2015/editing/{util.js → utils.js} +0 -0
  52. package/dist/es2015/gantt.component.d.ts +112 -17
  53. package/dist/es2015/gantt.component.js +292 -30
  54. package/dist/es2015/gantt.module.js +23 -6
  55. package/dist/es2015/index.d.ts +5 -0
  56. package/dist/es2015/index.js +5 -0
  57. package/dist/es2015/index.metadata.json +1 -1
  58. package/dist/es2015/main.d.ts +1 -0
  59. package/dist/es2015/main.js +1 -0
  60. package/dist/es2015/models/events/dependency-add-event.interface.d.ts +26 -0
  61. package/dist/es2015/models/events/dependency-add-event.interface.js +4 -0
  62. package/dist/es2015/models/events/task-click-event.interface.d.ts +3 -3
  63. package/dist/es2015/models/events/task-delete-event.interface.d.ts +21 -0
  64. package/dist/es2015/models/events/task-delete-event.interface.js +4 -0
  65. package/dist/es2015/models/events/task-edit-event.interface.d.ts +27 -10
  66. package/dist/es2015/models/models.d.ts +4 -0
  67. package/dist/es2015/models/view-item.interface.d.ts +35 -0
  68. package/dist/es2015/models/view-item.interface.js +4 -0
  69. package/dist/es2015/navigation/navigation-models.d.ts +34 -0
  70. package/dist/es2015/navigation/navigation-models.js +4 -0
  71. package/dist/es2015/navigation/navigation.service.d.ts +126 -0
  72. package/dist/es2015/navigation/navigation.service.js +355 -0
  73. package/dist/es2015/navigation/utils.d.ts +26 -0
  74. package/dist/es2015/navigation/utils.js +69 -0
  75. package/dist/es2015/package-metadata.js +1 -1
  76. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +3 -1
  77. package/dist/es2015/rendering/gantt-milestone-task.component.js +35 -8
  78. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +5 -1
  79. package/dist/es2015/rendering/gantt-summary-task.component.js +47 -8
  80. package/dist/es2015/rendering/gantt-task-base.d.ts +20 -6
  81. package/dist/es2015/rendering/gantt-task-base.js +75 -22
  82. package/dist/es2015/rendering/gantt-task.component.d.ts +4 -2
  83. package/dist/es2015/rendering/gantt-task.component.js +47 -13
  84. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +6 -3
  85. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +27 -9
  86. package/dist/es2015/scrolling/drag-scroll-settings.d.ts +47 -0
  87. package/dist/es2015/scrolling/drag-scroll-settings.js +20 -0
  88. package/dist/es2015/scrolling/scroll-sync.service.d.ts +1 -1
  89. package/dist/es2015/scrolling/timeline-scroll.directive.d.ts +24 -0
  90. package/dist/es2015/scrolling/timeline-scroll.directive.js +78 -0
  91. package/dist/es2015/scrolling/timeline-scroll.service.d.ts +20 -0
  92. package/dist/es2015/scrolling/timeline-scroll.service.js +44 -0
  93. package/dist/es2015/scrolling/utils.d.ts +29 -0
  94. package/dist/es2015/scrolling/utils.js +80 -0
  95. package/dist/es2015/timeline/gantt-timeline.component.d.ts +29 -4
  96. package/dist/es2015/timeline/gantt-timeline.component.js +67 -5
  97. package/dist/es2015/toolbar/toolbar.component.d.ts +4 -5
  98. package/dist/es2015/toolbar/toolbar.component.js +12 -13
  99. package/dist/es2015/toolbar/view-selector.component.js +3 -1
  100. package/dist/es2015/utils.d.ts +77 -8
  101. package/dist/es2015/utils.js +153 -12
  102. package/dist/fesm2015/index.js +3033 -1367
  103. package/dist/fesm5/index.js +2447 -830
  104. package/dist/npm/common/touch-enabled.js +11 -0
  105. package/dist/npm/dependencies/utils.js +34 -0
  106. package/dist/npm/dragging/dependency-drag-create.directive.js +349 -0
  107. package/dist/npm/dragging/drag-validation-tooltip.component.js +29 -0
  108. package/dist/npm/editing/dependencies-table.component.js +1 -1
  109. package/dist/npm/editing/edit-dialog.component.js +3 -3
  110. package/dist/npm/editing/edit.service.js +4 -2
  111. package/dist/npm/editing/task-fields.component.js +1 -1
  112. package/dist/npm/editing/{util.js → utils.js} +0 -0
  113. package/dist/npm/gantt.component.js +315 -30
  114. package/dist/npm/gantt.module.js +22 -5
  115. package/dist/npm/index.js +10 -0
  116. package/dist/npm/main.js +2 -0
  117. package/dist/npm/models/events/dependency-add-event.interface.js +6 -0
  118. package/dist/npm/models/events/task-delete-event.interface.js +6 -0
  119. package/dist/npm/models/view-item.interface.js +6 -0
  120. package/dist/npm/navigation/navigation-models.js +6 -0
  121. package/dist/npm/navigation/navigation.service.js +392 -0
  122. package/dist/npm/navigation/utils.js +79 -0
  123. package/dist/npm/package-metadata.js +1 -1
  124. package/dist/npm/rendering/gantt-milestone-task.component.js +11 -5
  125. package/dist/npm/rendering/gantt-summary-task.component.js +26 -5
  126. package/dist/npm/rendering/gantt-task-base.js +84 -22
  127. package/dist/npm/rendering/gantt-task.component.js +12 -7
  128. package/dist/npm/rendering/gantt-tasks-table-body.component.js +13 -5
  129. package/dist/npm/scrolling/drag-scroll-settings.js +22 -0
  130. package/dist/npm/scrolling/timeline-scroll.directive.js +91 -0
  131. package/dist/npm/scrolling/timeline-scroll.service.js +41 -0
  132. package/dist/npm/scrolling/utils.js +83 -0
  133. package/dist/npm/timeline/gantt-timeline.component.js +49 -3
  134. package/dist/npm/toolbar/toolbar.component.js +10 -11
  135. package/dist/npm/toolbar/view-selector.component.js +1 -1
  136. package/dist/npm/utils.js +153 -12
  137. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  138. package/package.json +23 -21
@@ -11,8 +11,11 @@ import { Subscription } from 'rxjs';
11
11
  import { validatePackage } from '@progress/kendo-licensing';
12
12
  import { packageMetadata } from './package-metadata';
13
13
  import { anyChanged, hasObservers } from '@progress/kendo-angular-common';
14
+ import { GanttTimelineComponent } from './timeline/gantt-timeline.component';
14
15
  import { GanttColumnBase } from './columns/columns';
15
16
  import { fetchChildren, hasChildren, isSelected, rowClassCallback, taskClassCallback } from './common/default-callbacks';
17
+ import { DependencyType } from './models/models';
18
+ import { LocalizationService } from '@progress/kendo-angular-l10n';
16
19
  import { TimelineViewService } from './timeline/timeline-view.service';
17
20
  import { TimelineDayViewService } from './timeline/timeline-day-view.service';
18
21
  import { TimelineWeekViewService } from './timeline/timeline-week-view.service';
@@ -22,18 +25,25 @@ import { DependencyDomService } from './dependencies/dependency-dom.service';
22
25
  import { MappingService } from './common/mapping.service';
23
26
  import { OptionChangesService } from './common/option-changes.service';
24
27
  import { EditService } from './editing/edit.service';
25
- import { LocalizationService } from '@progress/kendo-angular-l10n';
26
- import { getClosestTaskIndex, isClearButton, isColumnGroup, isPresent, isTask, normalizeGanttData, scrollbarWidth } from './utils';
28
+ import { TimelineScrollService } from './scrolling/timeline-scroll.service';
29
+ import { GanttLocalizationService } from './localization/gantt-localization.service';
30
+ import { NavigationService } from './navigation/navigation.service';
31
+ import { areParentChild, getClosestTaskIndex, isClearButton, isColumnGroup, isPresent, isTask, normalizeGanttData, scrollbarWidth } from './utils';
27
32
  import { DEFAULT_TIMELINE_PANE_SETTINGS, DEFAULT_TREELIST_PANE_SETTINGS } from './models/splitter-pane-options.interface';
28
33
  import { GanttTaskTemplateDirective } from './template-directives/task-template.directive';
29
34
  import { GanttSummaryTaskTemplateDirective } from './template-directives/summary-task-template.directive';
30
35
  import { GanttTaskContentTemplateDirective } from './template-directives/task-content-template.directive';
31
36
  import { ToolbarTemplateDirective } from './toolbar/toolbar-template.directive';
32
37
  import { ViewBase } from './timeline/view-base';
33
- import { getEditItem } from './editing/util';
34
- import { GanttLocalizationService } from './localization/gantt-localization.service';
38
+ import { getEditItem } from './editing/utils';
35
39
  const TREELIST_GROUP_COLUMNS_CLASS = 'k-gantt-treelist-nested-columns';
36
40
  const DEFAULT_VIEW = 'week';
41
+ const DEFAULT_DRAG_SCROLL_SETTINGS = {
42
+ enabled: true,
43
+ step: 3,
44
+ interval: 1,
45
+ threshold: 10
46
+ };
37
47
  /**
38
48
  * Represents the Kendo UI Gantt component for Angular.
39
49
  *
@@ -106,7 +116,7 @@ const DEFAULT_VIEW = 'week';
106
116
  * ```
107
117
  */
108
118
  let GanttComponent = GanttComponent_1 = class GanttComponent {
109
- constructor(timelineViewService, scrollSyncService, renderer, mapper, optionChangesService, dependencyDomService, editService, localizationService, hostElement, zone) {
119
+ constructor(timelineViewService, scrollSyncService, renderer, mapper, optionChangesService, dependencyDomService, editService, localizationService, hostElement, zone, navigationService) {
110
120
  this.timelineViewService = timelineViewService;
111
121
  this.scrollSyncService = scrollSyncService;
112
122
  this.renderer = renderer;
@@ -117,13 +127,33 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
117
127
  this.localizationService = localizationService;
118
128
  this.hostElement = hostElement;
119
129
  this.zone = zone;
130
+ this.navigationService = navigationService;
131
+ /**
132
+ * @hidden
133
+ */
134
+ this.roleDescription = 'Gantt Chart';
135
+ /**
136
+ * @hidden
137
+ */
138
+ this.role = 'application';
120
139
  this.hostClasses = true;
121
140
  /**
122
- * Provides a callback that determines if the given task is selected ([see example]({% slug selection_gantt %}#toc-custom-selection))
141
+ * Specifies a callback that determines if the given task is selected ([see example]({% slug selection_gantt %}#toc-custom-selection)).
123
142
  *
124
143
  * > The [`selectable`]({% slug api_gantt_ganttcomponent %}#toc-selectable) prop has to be set to `true` in order for this callback to be executed.
125
144
  */
126
145
  this.isSelected = isSelected;
146
+ /**
147
+ * Specifies a callback that determines if a new dependency is valid.
148
+ * Used when evaluating if an attempt to create a new dependency will result in a valid link between the two tasks
149
+ * [see example]({% slug editing_drag_create_dependencies_gantt %}#toc-validation).
150
+ *
151
+ * By defalut, dependencies are deemed invalid when:
152
+ * - The two tasks are in a parent-child relationship.
153
+ * - The two tasks are already dependent on one another. Only one dependency is allowed per pair.
154
+ * - The start or end times of the two tasks are incompatible with the attempted dependency type.
155
+ */
156
+ this.validateNewDependency = this.defaultValidateNewDependencyCallback.bind(this);
127
157
  /**
128
158
  * Fires when the Gantt selection is changed through user interaction.
129
159
  *
@@ -177,6 +207,12 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
177
207
  * The end of the work week (index based).
178
208
  */
179
209
  this.workWeekEnd = 5;
210
+ /**
211
+ * If set to `true`, the user can use dedicated shortcuts to interact with the Gantt.
212
+ * By default, navigation is disabled for the TreeList and Timeline parts of the component,
213
+ * ([see example]({% slug keyboard_navigation_gantt %})).
214
+ */
215
+ this.navigable = false;
180
216
  /**
181
217
  * Indicates whether the Gantt columns will be resized during initialization so that they fit their headers and row content.
182
218
  * Columns with autoSize set to false are excluded.
@@ -220,7 +256,8 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
220
256
  */
221
257
  this.cellClose = new EventEmitter();
222
258
  /**
223
- * Fires when the end user clicks the `Delete` button in the task editing dialog or the task delete icon.
259
+ * Fires when the end user clicks the `Delete` button in the task editing dialog,
260
+ * the task delete icon, or presses the `Delete` key on the keyboard when a task in the timeline is focused.
224
261
  * Use the event handler to open a confirmation dialog when necessary.
225
262
  */
226
263
  this.taskDelete = new EventEmitter();
@@ -244,6 +281,11 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
244
281
  * Fires when the user adds a task.
245
282
  */
246
283
  this.taskAdd = new EventEmitter();
284
+ /**
285
+ * Fires when the user adds a dependency via dragging
286
+ * [see example]({% slug editing_drag_create_dependencies_gantt %}#toc-basic-concepts).
287
+ */
288
+ this.dependencyAdd = new EventEmitter();
247
289
  /**
248
290
  * Fires when the sorting of the Gantt is changed.
249
291
  * You have to handle the event yourself and sort the data.
@@ -300,6 +342,15 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
300
342
  * Fires when a task is clicked.
301
343
  */
302
344
  this.taskClick = new EventEmitter();
345
+ /**
346
+ * @hidden
347
+ *
348
+ * Specifies whether the dependency drag clues will be rendered.
349
+ * Set internally by the dependency-drag-create directive.
350
+ *
351
+ * @default false
352
+ */
353
+ this.renderDependencyDragClues = false;
303
354
  /**
304
355
  * @hidden
305
356
  *
@@ -316,6 +367,7 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
316
367
  this.showConfirmationDialog = false;
317
368
  this._columns = new QueryList();
318
369
  this._data = [];
370
+ this._dragScrollSettings = Object.assign({}, DEFAULT_DRAG_SCROLL_SETTINGS);
319
371
  this._timelinePaneOptions = Object.assign({}, DEFAULT_TIMELINE_PANE_SETTINGS);
320
372
  this._treeListPaneOptions = Object.assign({}, DEFAULT_TREELIST_PANE_SETTINGS);
321
373
  this._rowClass = rowClassCallback;
@@ -340,7 +392,11 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
340
392
  }));
341
393
  this.editService.getSelectedItem = this.getFirstSelectedItem.bind(this);
342
394
  this.editServiceSubscription.add(this.editService.showEditingDialog.subscribe(show => this.showEditingDialog = show));
343
- this.editServiceSubscription.add(this.editService.showConfirmationDialog.subscribe(() => this.taskDelete.emit()));
395
+ this.editServiceSubscription.add(this.editService.taskDelete.subscribe(task => {
396
+ if (hasObservers(this.taskDelete)) {
397
+ this.zone.run(() => this.notifyTaskDelete(task));
398
+ }
399
+ }));
344
400
  this.editServiceSubscription.add(this.editService.editEvent.subscribe(args => {
345
401
  this[args.editResultType].emit({
346
402
  taskFormGroup: args.taskFormGroup,
@@ -351,6 +407,9 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
351
407
  this.showConfirmationDialog = this.showEditingDialog = false;
352
408
  this.editService.dataItem = this.editService.taskFormGroup = null;
353
409
  this.updateView();
410
+ if (this.navigable) {
411
+ this.focus();
412
+ }
354
413
  }));
355
414
  this.editServiceSubscription.add(this.editService.addEvent.subscribe(args => {
356
415
  const selectedItem = this.getFirstSelectedItem();
@@ -374,6 +433,12 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
374
433
  set toolbarTemplate(customToolbarTemplate) {
375
434
  this._customToolbarTemplate = customToolbarTemplate;
376
435
  }
436
+ get hostRoleDescriptionAttr() {
437
+ return this.roleDescription;
438
+ }
439
+ get hostRoleAttr() {
440
+ return this.role;
441
+ }
377
442
  get dir() {
378
443
  return this.direction;
379
444
  }
@@ -531,6 +596,17 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
531
596
  get taskIdField() {
532
597
  return this.mapper.taskFields.id;
533
598
  }
599
+ /**
600
+ * Specifies the settings for auto-scrolling during dragging
601
+ * when the pointer moves outside of the container bounderies
602
+ * [see example]({% slug editing_drag_create_dependencies_gantt %}#toc-auto-scrolling).
603
+ */
604
+ set dragScrollSettings(settings) {
605
+ this._dragScrollSettings = Object.assign({}, DEFAULT_DRAG_SCROLL_SETTINGS, settings);
606
+ }
607
+ get dragScrollSettings() {
608
+ return this._dragScrollSettings;
609
+ }
534
610
  /**
535
611
  * @hidden
536
612
  */
@@ -540,6 +616,15 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
540
616
  }
541
617
  return this.treeList.view.data.map(item => item.data);
542
618
  }
619
+ /**
620
+ * @hidden
621
+ */
622
+ get viewItems() {
623
+ if (!isPresent(this.treeList)) {
624
+ return [];
625
+ }
626
+ return this.treeList.view.data;
627
+ }
543
628
  /**
544
629
  * @hidden
545
630
  */
@@ -583,6 +668,12 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
583
668
  get viewTypes() {
584
669
  return this.views.map(view => view.type);
585
670
  }
671
+ /**
672
+ * @hidden
673
+ */
674
+ get isInEditMode() {
675
+ return this.showEditingDialog || this.showConfirmationDialog || this.treeList.isEditing();
676
+ }
586
677
  ngOnChanges(changes) {
587
678
  if (anyChanged(['data', 'activeView', 'workWeekStart', 'workWeekEnd', 'workDayStart', 'workDayEnd'], changes)) {
588
679
  this.loadTimelineData();
@@ -590,6 +681,14 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
590
681
  }
591
682
  ngAfterViewInit() {
592
683
  this.updateTreeListMargin();
684
+ if (this.navigable) {
685
+ this.navigationService.initialize({
686
+ gantt: this,
687
+ host: this.hostElement.nativeElement,
688
+ treeListElement: this.treeList.wrapper.nativeElement,
689
+ timelineElement: this.timeline.timelineContent.nativeElement
690
+ });
691
+ }
593
692
  const leftContainer = this.treeList.wrapper.nativeElement.querySelector('kendo-treelist-list > div');
594
693
  this.scrollSyncService.registerElement(leftContainer, 'treelist');
595
694
  }
@@ -607,6 +706,34 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
607
706
  this.localizationSubscription.unsubscribe();
608
707
  }
609
708
  }
709
+ /**
710
+ * Focuses the last active cell or task in the Gantt.
711
+ * If no item has previously been focused, the first cell of the TreeList part will receive focus,
712
+ * ([see example]({% slug keyboard_navigation_gantt %}#toc-controlling-the-focus)).
713
+ */
714
+ focus() {
715
+ if (this.navigable) {
716
+ this.navigationService.focusLastActiveItem();
717
+ }
718
+ }
719
+ /**
720
+ * Focuses the targeted cell in the TreeList part of the component,
721
+ * ([see example]({% slug keyboard_navigation_gantt %}#toc-controlling-the-focus)).
722
+ */
723
+ focusCell(rowIndex, colIndex) {
724
+ if (this.navigable) {
725
+ this.navigationService.focusCell(rowIndex, colIndex);
726
+ }
727
+ }
728
+ /**
729
+ * Focuses the targeted task in the Timeline part of the component,
730
+ * ([see example]({% slug keyboard_navigation_gantt %}#toc-controlling-the-focus)).
731
+ */
732
+ focusTask(taskIndex) {
733
+ if (this.navigable) {
734
+ this.navigationService.focusTask(taskIndex);
735
+ }
736
+ }
610
737
  /**
611
738
  * Applies the minimum possible width for the specified column,
612
739
  * so that the whole text fits without wrapping. This method expects the Gantt
@@ -691,6 +818,15 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
691
818
  openConfirmationDialog() {
692
819
  this.showConfirmationDialog = true;
693
820
  }
821
+ /**
822
+ * @hidden
823
+ */
824
+ handleConfirmationDialogClose() {
825
+ this.showConfirmationDialog = false;
826
+ if (this.navigable) {
827
+ this.focus();
828
+ }
829
+ }
694
830
  /**
695
831
  * Opens a cell for editing.
696
832
  */
@@ -775,7 +911,7 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
775
911
  if (hasObservers(this.taskClick)) {
776
912
  const taskIndex = getClosestTaskIndex(target, gantt);
777
913
  const task = this.renderedTreeListItems[taskIndex];
778
- this.zone.run(() => this.emitTaskClick(event, task, taskIndex));
914
+ this.zone.run(() => this.notifyTaskClick(event, task, taskIndex));
779
915
  }
780
916
  }
781
917
  /**
@@ -793,8 +929,8 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
793
929
  if ((hasObservers(this.selectionChange) && !this.isSameSelection(selectionAction, task)) ||
794
930
  hasObservers(this.taskClick)) {
795
931
  this.zone.run(() => {
796
- this.emitSelectionChange(task, selectionAction);
797
- this.emitTaskClick(event, task, taskIndex);
932
+ this.notifySelectionChange(task, selectionAction);
933
+ this.notifyTaskClick(event, task, taskIndex);
798
934
  });
799
935
  }
800
936
  }
@@ -831,7 +967,7 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
831
967
  }
832
968
  const task = event.items.map(item => item.dataItem)[0]; // single selection only currently available
833
969
  const action = event.action;
834
- this.emitSelectionChange(task, action);
970
+ this.notifySelectionChange(task, action);
835
971
  }
836
972
  /**
837
973
  * @hidden
@@ -882,7 +1018,7 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
882
1018
  dataItem: task,
883
1019
  originalEvent: event,
884
1020
  sender: this,
885
- rowIndex: taskIndex,
1021
+ index: taskIndex,
886
1022
  type: 'dblclick'
887
1023
  }));
888
1024
  }
@@ -893,16 +1029,35 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
893
1029
  getText(token) {
894
1030
  return this.localizationService.get(token);
895
1031
  }
896
- emitTaskClick(event, dataItem, itemIndex) {
1032
+ /**
1033
+ * @hidden
1034
+ */
1035
+ changeActiveView(view) {
1036
+ if (view !== this.activeView) {
1037
+ this.activeView = view;
1038
+ this.loadTimelineData();
1039
+ this.scrollSyncService.resetTimelineScrollLeft();
1040
+ this.activeViewChange.emit(view);
1041
+ }
1042
+ }
1043
+ /**
1044
+ * @hidden
1045
+ */
1046
+ notifyTaskClick(event, dataItem, itemIndex) {
1047
+ // simulates the TreeList `cellClick` event triggered by enter press (type: 'click')
1048
+ const type = event instanceof KeyboardEvent ? 'click' : event.type;
897
1049
  this.taskClick.emit({
898
1050
  originalEvent: event,
899
1051
  dataItem: dataItem,
900
- rowIndex: itemIndex,
901
- type: event.type,
1052
+ index: itemIndex,
1053
+ type: type,
902
1054
  sender: this
903
1055
  });
904
1056
  }
905
- emitSelectionChange(dataItem, action) {
1057
+ /**
1058
+ * @hidden
1059
+ */
1060
+ notifySelectionChange(dataItem, action) {
906
1061
  if (this.isSameSelection(action, dataItem)) {
907
1062
  return;
908
1063
  }
@@ -913,6 +1068,29 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
913
1068
  });
914
1069
  this.treeList.updateView();
915
1070
  }
1071
+ /**
1072
+ * @hidden
1073
+ */
1074
+ notifyTaskDelete(task) {
1075
+ this.editService.dataItem = task;
1076
+ this.taskDelete.emit({
1077
+ item: getEditItem(task, this.treeList.view.data, this.mapper),
1078
+ sender: this
1079
+ });
1080
+ }
1081
+ /**
1082
+ * @hidden
1083
+ */
1084
+ isSameSelection(action, dataItem) {
1085
+ return action === 'select' && this.isSelected(dataItem);
1086
+ }
1087
+ /**
1088
+ * @hidden
1089
+ */
1090
+ getSelectionAction({ ctrlKey, metaKey }, dataItem) {
1091
+ const shouldToggleSelection = ctrlKey || metaKey;
1092
+ return (shouldToggleSelection && this.isSelected(dataItem)) ? 'remove' : 'select';
1093
+ }
916
1094
  updateTreeListGroupClass(columns = this.columns) {
917
1095
  if (!isPresent(this.treeList)) {
918
1096
  return;
@@ -939,23 +1117,65 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
939
1117
  }
940
1118
  return this.views.find(view => view.type === this.activeView);
941
1119
  }
942
- isSameSelection(action, dataItem) {
943
- return action === 'select' && this.isSelected(dataItem);
944
- }
945
- getSelectionAction({ ctrlKey, metaKey }, dataItem) {
946
- const shouldToggleSelection = ctrlKey || metaKey;
947
- return (shouldToggleSelection && this.isSelected(dataItem)) ? 'remove' : 'select';
948
- }
949
1120
  getFirstSelectedItem() {
950
1121
  const isSelectedCallback = this.isSelected || isSelected;
951
1122
  const loadedItems = this.renderedTreeListItems || [];
952
1123
  return loadedItems.find(isSelectedCallback);
953
1124
  }
1125
+ defaultValidateNewDependencyCallback(dependency) {
1126
+ const fromTaskId = this.mapper.extractFromDependency(dependency, 'fromId');
1127
+ const toTaskId = this.mapper.extractFromDependency(dependency, 'toId');
1128
+ const fromTask = this.treeList.view.data.find(task => this.mapper.extractFromTask(task.data, 'id') === fromTaskId);
1129
+ const toTask = this.treeList.view.data.find(task => this.mapper.extractFromTask(task.data, 'id') === toTaskId);
1130
+ // mark as invalid if the attempted dependency is lacking valid from- and to-tasks
1131
+ // or when the from- and to-tasks are actually the same task
1132
+ if (!isPresent(fromTask) || !isPresent(fromTask.data) ||
1133
+ !isPresent(toTask) || !isPresent(toTask.data) ||
1134
+ fromTask.data === toTask.data) {
1135
+ return false;
1136
+ }
1137
+ const tasksDependentOnOneAnother = this.dependencies.some(current => {
1138
+ const currentFromId = this.mapper.extractFromDependency(current, 'fromId');
1139
+ const currentToId = this.mapper.extractFromDependency(current, 'toId');
1140
+ return (fromTaskId === currentFromId && toTaskId === currentToId) ||
1141
+ (toTaskId === currentFromId && fromTaskId === currentToId);
1142
+ });
1143
+ // mark as invalid if the attempted dependency is trying to connect already dependent tasks
1144
+ // mark as invalid if the two tasks are in parent-child relationship
1145
+ if (tasksDependentOnOneAnother || areParentChild(fromTask, toTask)) {
1146
+ return false;
1147
+ }
1148
+ const fromTaskStart = this.mapper.extractFromTask(fromTask.data, 'start');
1149
+ const fromTaskEnd = this.mapper.extractFromTask(fromTask.data, 'end');
1150
+ const toTaskStart = this.mapper.extractFromTask(toTask.data, 'start');
1151
+ const toTaskEnd = this.mapper.extractFromTask(toTask.data, 'end');
1152
+ // if the two tasks are available to be connected via a dependency,
1153
+ // check if their start and end time allow for the attempted dependency type
1154
+ switch (this.mapper.extractFromDependency(dependency, 'type')) {
1155
+ // finish to finish (FF) — the from-task ends before the to-task can end
1156
+ case DependencyType.FF:
1157
+ return fromTaskEnd <= toTaskEnd;
1158
+ // finish to start (FS) — the from-task ends before the to-task can begin
1159
+ case DependencyType.FS:
1160
+ return fromTaskEnd <= toTaskStart;
1161
+ // start to finish (SF) — the from-task begins before the to-task can end
1162
+ case DependencyType.SF:
1163
+ return fromTaskStart <= toTaskEnd;
1164
+ // start to start (SS) — the from-task begins before the to-task can begin
1165
+ case DependencyType.SS:
1166
+ return fromTaskStart <= toTaskStart;
1167
+ default: return false;
1168
+ }
1169
+ }
954
1170
  };
955
1171
  tslib_1.__decorate([
956
1172
  ViewChild(TreeListComponent, { static: true }),
957
1173
  tslib_1.__metadata("design:type", TreeListComponent)
958
1174
  ], GanttComponent.prototype, "treeList", void 0);
1175
+ tslib_1.__decorate([
1176
+ ViewChild(GanttTimelineComponent, { static: false }),
1177
+ tslib_1.__metadata("design:type", GanttTimelineComponent)
1178
+ ], GanttComponent.prototype, "timeline", void 0);
959
1179
  tslib_1.__decorate([
960
1180
  ContentChild(GanttTaskContentTemplateDirective, { static: true }),
961
1181
  tslib_1.__metadata("design:type", GanttTaskContentTemplateDirective)
@@ -972,6 +1192,24 @@ tslib_1.__decorate([
972
1192
  ContentChildren(ToolbarTemplateDirective),
973
1193
  tslib_1.__metadata("design:type", QueryList)
974
1194
  ], GanttComponent.prototype, "toolbarTemplateChildren", void 0);
1195
+ tslib_1.__decorate([
1196
+ Input('aria-roledescription'),
1197
+ tslib_1.__metadata("design:type", String)
1198
+ ], GanttComponent.prototype, "roleDescription", void 0);
1199
+ tslib_1.__decorate([
1200
+ HostBinding('attr.aria-roledescription'),
1201
+ tslib_1.__metadata("design:type", String),
1202
+ tslib_1.__metadata("design:paramtypes", [])
1203
+ ], GanttComponent.prototype, "hostRoleDescriptionAttr", null);
1204
+ tslib_1.__decorate([
1205
+ Input('role'),
1206
+ tslib_1.__metadata("design:type", String)
1207
+ ], GanttComponent.prototype, "role", void 0);
1208
+ tslib_1.__decorate([
1209
+ HostBinding('attr.role'),
1210
+ tslib_1.__metadata("design:type", String),
1211
+ tslib_1.__metadata("design:paramtypes", [])
1212
+ ], GanttComponent.prototype, "hostRoleAttr", null);
975
1213
  tslib_1.__decorate([
976
1214
  HostBinding('class.k-gantt'),
977
1215
  tslib_1.__metadata("design:type", Boolean)
@@ -1014,6 +1252,10 @@ tslib_1.__decorate([
1014
1252
  Input(),
1015
1253
  tslib_1.__metadata("design:type", Function)
1016
1254
  ], GanttComponent.prototype, "isSelected", void 0);
1255
+ tslib_1.__decorate([
1256
+ Input(),
1257
+ tslib_1.__metadata("design:type", Function)
1258
+ ], GanttComponent.prototype, "validateNewDependency", void 0);
1017
1259
  tslib_1.__decorate([
1018
1260
  Output(),
1019
1261
  tslib_1.__metadata("design:type", EventEmitter)
@@ -1073,6 +1315,10 @@ tslib_1.__decorate([
1073
1315
  Input(),
1074
1316
  tslib_1.__metadata("design:type", Number)
1075
1317
  ], GanttComponent.prototype, "workWeekEnd", void 0);
1318
+ tslib_1.__decorate([
1319
+ Input(),
1320
+ tslib_1.__metadata("design:type", Boolean)
1321
+ ], GanttComponent.prototype, "navigable", void 0);
1076
1322
  tslib_1.__decorate([
1077
1323
  Input(),
1078
1324
  tslib_1.__metadata("design:type", Object),
@@ -1113,6 +1359,11 @@ tslib_1.__decorate([
1113
1359
  Input(),
1114
1360
  tslib_1.__metadata("design:type", Boolean)
1115
1361
  ], GanttComponent.prototype, "columnsResizable", void 0);
1362
+ tslib_1.__decorate([
1363
+ Input(),
1364
+ tslib_1.__metadata("design:type", Object),
1365
+ tslib_1.__metadata("design:paramtypes", [Object])
1366
+ ], GanttComponent.prototype, "dragScrollSettings", null);
1116
1367
  tslib_1.__decorate([
1117
1368
  Output(),
1118
1369
  tslib_1.__metadata("design:type", EventEmitter)
@@ -1153,6 +1404,10 @@ tslib_1.__decorate([
1153
1404
  Output(),
1154
1405
  tslib_1.__metadata("design:type", EventEmitter)
1155
1406
  ], GanttComponent.prototype, "taskAdd", void 0);
1407
+ tslib_1.__decorate([
1408
+ Output(),
1409
+ tslib_1.__metadata("design:type", EventEmitter)
1410
+ ], GanttComponent.prototype, "dependencyAdd", void 0);
1156
1411
  tslib_1.__decorate([
1157
1412
  Output(),
1158
1413
  tslib_1.__metadata("design:type", EventEmitter)
@@ -1228,7 +1483,9 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1228
1483
  DependencyDomService,
1229
1484
  MappingService,
1230
1485
  OptionChangesService,
1231
- EditService
1486
+ EditService,
1487
+ TimelineScrollService,
1488
+ NavigationService
1232
1489
  ],
1233
1490
  template: `
1234
1491
  <ng-container kendoGanttLocalizedMessages
@@ -1455,6 +1712,7 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1455
1712
  [data]="data"
1456
1713
  [hasChildren]="hasChildren"
1457
1714
  [fetchChildren]="fetchChildren"
1715
+ [navigable]="navigable"
1458
1716
  [isExpanded]="isExpanded"
1459
1717
  [autoSize]="columnsAutoSize"
1460
1718
  [columnMenu]="columnMenu"
@@ -1543,7 +1801,9 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1543
1801
  [scrollable]="false">
1544
1802
  <kendo-gantt-timeline
1545
1803
  *ngIf="views && views.length"
1546
- [rows]="renderedTreeListItems"
1804
+ [renderDependencyDragClues]="renderDependencyDragClues"
1805
+ [dragScrollSettings]="dragScrollSettings"
1806
+ [rows]="viewItems"
1547
1807
  [slots]="timelineSlots"
1548
1808
  [groupSlots]="timelineGroupSlots"
1549
1809
  [tableWidth]="tableWidth"
@@ -1553,7 +1813,8 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1553
1813
  [summaryTaskTemplate]="summaryTaskTemplate?.templateRef"
1554
1814
  [taskClass]="taskClass"
1555
1815
  [dependencies]="dependencies"
1556
- [hasChildren]="hasChildren"
1816
+ [isExpanded]="isExpanded"
1817
+ [selectable]="selectable"
1557
1818
  [isTaskSelected]="isTaskSelected"
1558
1819
  [kendoEventsOutsideAngular]="{
1559
1820
  click: handleTimelineClick,
@@ -1581,12 +1842,12 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1581
1842
  [width]="575"
1582
1843
  [height]="170"
1583
1844
  [title]="getText('confirmationDialogTitle')"
1584
- (close)="showConfirmationDialog = false;">
1845
+ (close)="handleConfirmationDialogClose()">
1585
1846
  <span>{{ getText('confirmationDialogContent') }}</span>
1586
1847
  <kendo-dialog-actions layout="normal">
1587
1848
  <kendo-treelist-spacer></kendo-treelist-spacer>
1588
1849
  <button kendoButton [primary]="true" (click)="handleDeleteConfirmation()">{{ getText('deleteButtonText') }}</button>
1589
- <button kendoButton (click)="showConfirmationDialog = false;">{{ getText('cancelButtonText') }}</button>
1850
+ <button kendoButton (click)="handleConfirmationDialogClose()">{{ getText('cancelButtonText') }}</button>
1590
1851
  </kendo-dialog-actions>
1591
1852
  </kendo-dialog>
1592
1853
  `
@@ -1600,6 +1861,7 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1600
1861
  EditService,
1601
1862
  LocalizationService,
1602
1863
  ElementRef,
1603
- NgZone])
1864
+ NgZone,
1865
+ NavigationService])
1604
1866
  ], GanttComponent);
1605
1867
  export { GanttComponent };
@@ -5,11 +5,19 @@
5
5
  import * as tslib_1 from "tslib";
6
6
  import { NgModule } from '@angular/core';
7
7
  import { CommonModule } from '@angular/common';
8
+ import { ReactiveFormsModule } from '@angular/forms';
8
9
  import { SplitterModule, TabStripModule } from '@progress/kendo-angular-layout';
9
10
  import { TreeListModule } from '@progress/kendo-angular-treelist';
10
11
  import { ButtonsModule } from '@progress/kendo-angular-buttons';
11
- import { EventsModule } from '@progress/kendo-angular-common';
12
+ import { DraggableModule, EventsModule } from '@progress/kendo-angular-common';
12
13
  import { DialogModule } from '@progress/kendo-angular-dialog';
14
+ import { LabelModule } from '@progress/kendo-angular-label';
15
+ import { InputsModule } from '@progress/kendo-angular-inputs';
16
+ import { DateInputsModule } from '@progress/kendo-angular-dateinputs';
17
+ import { L10N_PREFIX } from '@progress/kendo-angular-l10n';
18
+ import { PopupModule } from '@progress/kendo-angular-popup';
19
+ import { touchEnabled } from '@progress/kendo-common';
20
+ import { TOUCH_ENABLED } from './common/touch-enabled';
13
21
  import { GanttComponent } from './gantt.component';
14
22
  import { GanttTimelineComponent } from './timeline/gantt-timeline.component';
15
23
  import { GanttTasksTableBodyComponent } from './rendering/gantt-tasks-table-body.component';
@@ -28,17 +36,15 @@ import { ToolbarComponent } from './toolbar/toolbar.component';
28
36
  import { ToolbarTemplateDirective } from './toolbar/toolbar-template.directive';
29
37
  import { ViewSelectorComponent } from './toolbar/view-selector.component';
30
38
  import { GanttDependencyDirective } from './dependencies/gantt-dependency.directive';
39
+ import { DependencyDragCreateDirective } from './dragging/dependency-drag-create.directive';
40
+ import { DragValidationTooltipComponent } from './dragging/drag-validation-tooltip.component';
41
+ import { TimelineScrollableDirective } from './scrolling/timeline-scroll.directive';
31
42
  import { GanttColumnComponent, GanttColumnGroupComponent, GanttSpanColumnComponent, FilterMenuTemplateDirective, FilterCellTemplateDirective, CellTemplateDirective, ColumnMenuTemplateDirective, FooterTemplateDirective, HeaderTemplateDirective, EditTemplateDirective } from './columns/columns';
32
43
  import { TimelineDayViewComponent } from './timeline/timeline-day-view.component';
33
44
  import { TimelineWeekViewComponent } from './timeline/timeline-week-view.component';
34
45
  import { TimelineMonthViewComponent } from './timeline/timeline-month-view.component';
35
46
  import { EditDialogComponent } from './editing/edit-dialog.component';
36
- import { ReactiveFormsModule } from '@angular/forms';
37
- import { LabelModule } from '@progress/kendo-angular-label';
38
- import { InputsModule } from '@progress/kendo-angular-inputs';
39
- import { DateInputsModule } from '@progress/kendo-angular-dateinputs';
40
47
  import { CustomMessagesComponent } from './localization/custom-messages.component';
41
- import { L10N_PREFIX } from '@progress/kendo-angular-l10n';
42
48
  import { LocalizedMessagesDirective } from './localization/localized-messages.directive';
43
49
  import { GanttAddTaskComponent } from './editing/add-task.component';
44
50
  import { GridModule } from '@progress/kendo-angular-grid';
@@ -57,6 +63,8 @@ const IMPORTED_MODULES = [
57
63
  ButtonsModule,
58
64
  DialogModule,
59
65
  EventsModule,
66
+ PopupModule,
67
+ DraggableModule,
60
68
  TabStripModule,
61
69
  GridModule,
62
70
  DropDownsModule
@@ -89,6 +97,7 @@ const DECLARATIONS = [
89
97
  FooterTemplateDirective,
90
98
  GanttExpandableDirective,
91
99
  GanttDependencyDirective,
100
+ DependencyDragCreateDirective,
92
101
  TimelineDayViewComponent,
93
102
  TimelineWeekViewComponent,
94
103
  TimelineMonthViewComponent,
@@ -97,9 +106,12 @@ const DECLARATIONS = [
97
106
  CustomMessagesComponent,
98
107
  LocalizedMessagesDirective,
99
108
  GanttAddTaskComponent,
109
+ DragValidationTooltipComponent,
110
+ TimelineScrollableDirective,
100
111
  DependenciesTableComponent,
101
112
  TaskFieldsComponent
102
113
  ];
114
+ const ɵ0 = touchEnabled;
103
115
  /**
104
116
  * Represents the [NgModule]({{ site.data.urls.angular['ngmoduleapi'] }})
105
117
  * definition for the Gantt component.
@@ -138,10 +150,15 @@ GanttModule = tslib_1.__decorate([
138
150
  imports: [...IMPORTED_MODULES],
139
151
  declarations: [...DECLARATIONS],
140
152
  exports: [...DECLARATIONS],
153
+ entryComponents: [DragValidationTooltipComponent],
141
154
  providers: [{
142
155
  provide: L10N_PREFIX,
143
156
  useValue: 'kendo.gantt'
157
+ }, {
158
+ provide: TOUCH_ENABLED,
159
+ useValue: ɵ0
144
160
  }]
145
161
  })
146
162
  ], GanttModule);
147
163
  export { GanttModule };
164
+ export { ɵ0 };