@progress/kendo-angular-gantt 0.3.0-dev.202201131518 → 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 (82) hide show
  1. package/dist/cdn/js/kendo-angular-gantt.js +2 -2
  2. package/dist/cdn/main.js +2 -2
  3. package/dist/es/editing/edit-dialog.component.js +3 -3
  4. package/dist/es/editing/edit.service.js +4 -2
  5. package/dist/es/gantt.component.js +191 -24
  6. package/dist/es/index.js +1 -0
  7. package/dist/es/models/events/task-delete-event.interface.js +4 -0
  8. package/dist/es/navigation/navigation-models.js +4 -0
  9. package/dist/es/navigation/navigation.service.js +390 -0
  10. package/dist/es/navigation/utils.js +77 -0
  11. package/dist/es/package-metadata.js +1 -1
  12. package/dist/es/rendering/gantt-milestone-task.component.js +7 -4
  13. package/dist/es/rendering/gantt-summary-task.component.js +22 -4
  14. package/dist/es/rendering/gantt-task-base.js +57 -6
  15. package/dist/es/rendering/gantt-task.component.js +9 -6
  16. package/dist/es/rendering/gantt-tasks-table-body.component.js +9 -5
  17. package/dist/es/timeline/gantt-timeline.component.js +10 -6
  18. package/dist/es/toolbar/toolbar.component.js +12 -13
  19. package/dist/es/toolbar/view-selector.component.js +1 -1
  20. package/dist/es/utils.js +14 -4
  21. package/dist/es2015/editing/edit-dialog.component.d.ts +1 -1
  22. package/dist/es2015/editing/edit-dialog.component.js +11 -3
  23. package/dist/es2015/editing/edit.service.d.ts +2 -3
  24. package/dist/es2015/editing/edit.service.js +4 -2
  25. package/dist/es2015/editing/utils.d.ts +2 -2
  26. package/dist/es2015/gantt.component.d.ts +75 -16
  27. package/dist/es2015/gantt.component.js +177 -26
  28. package/dist/es2015/index.d.ts +1 -0
  29. package/dist/es2015/index.js +1 -0
  30. package/dist/es2015/index.metadata.json +1 -1
  31. package/dist/es2015/models/events/task-click-event.interface.d.ts +3 -3
  32. package/dist/es2015/models/events/task-delete-event.interface.d.ts +21 -0
  33. package/dist/es2015/models/events/task-delete-event.interface.js +4 -0
  34. package/dist/es2015/models/events/task-edit-event.interface.d.ts +27 -10
  35. package/dist/es2015/models/models.d.ts +2 -0
  36. package/dist/es2015/navigation/navigation-models.d.ts +34 -0
  37. package/dist/es2015/navigation/navigation-models.js +4 -0
  38. package/dist/es2015/navigation/navigation.service.d.ts +126 -0
  39. package/dist/es2015/navigation/navigation.service.js +355 -0
  40. package/dist/es2015/navigation/utils.d.ts +26 -0
  41. package/dist/es2015/navigation/utils.js +69 -0
  42. package/dist/es2015/package-metadata.js +1 -1
  43. package/dist/es2015/rendering/gantt-milestone-task.component.d.ts +2 -1
  44. package/dist/es2015/rendering/gantt-milestone-task.component.js +18 -4
  45. package/dist/es2015/rendering/gantt-summary-task.component.d.ts +4 -1
  46. package/dist/es2015/rendering/gantt-summary-task.component.js +30 -4
  47. package/dist/es2015/rendering/gantt-task-base.d.ts +10 -2
  48. package/dist/es2015/rendering/gantt-task-base.js +48 -6
  49. package/dist/es2015/rendering/gantt-task.component.d.ts +3 -2
  50. package/dist/es2015/rendering/gantt-task.component.js +31 -9
  51. package/dist/es2015/rendering/gantt-tasks-table-body.component.d.ts +5 -3
  52. package/dist/es2015/rendering/gantt-tasks-table-body.component.js +23 -12
  53. package/dist/es2015/scrolling/scroll-sync.service.d.ts +1 -1
  54. package/dist/es2015/timeline/gantt-timeline.component.d.ts +5 -3
  55. package/dist/es2015/timeline/gantt-timeline.component.js +15 -6
  56. package/dist/es2015/toolbar/toolbar.component.d.ts +4 -5
  57. package/dist/es2015/toolbar/toolbar.component.js +12 -13
  58. package/dist/es2015/toolbar/view-selector.component.js +3 -1
  59. package/dist/es2015/utils.d.ts +10 -3
  60. package/dist/es2015/utils.js +14 -4
  61. package/dist/fesm2015/index.js +2311 -1610
  62. package/dist/fesm5/index.js +1722 -1013
  63. package/dist/npm/editing/edit-dialog.component.js +3 -3
  64. package/dist/npm/editing/edit.service.js +4 -2
  65. package/dist/npm/gantt.component.js +191 -24
  66. package/dist/npm/index.js +2 -0
  67. package/dist/npm/models/events/task-delete-event.interface.js +6 -0
  68. package/dist/npm/navigation/navigation-models.js +6 -0
  69. package/dist/npm/navigation/navigation.service.js +392 -0
  70. package/dist/npm/navigation/utils.js +79 -0
  71. package/dist/npm/package-metadata.js +1 -1
  72. package/dist/npm/rendering/gantt-milestone-task.component.js +7 -4
  73. package/dist/npm/rendering/gantt-summary-task.component.js +22 -4
  74. package/dist/npm/rendering/gantt-task-base.js +57 -6
  75. package/dist/npm/rendering/gantt-task.component.js +9 -6
  76. package/dist/npm/rendering/gantt-tasks-table-body.component.js +9 -5
  77. package/dist/npm/timeline/gantt-timeline.component.js +10 -6
  78. package/dist/npm/toolbar/toolbar.component.js +10 -11
  79. package/dist/npm/toolbar/view-selector.component.js +1 -1
  80. package/dist/npm/utils.js +14 -4
  81. package/dist/systemjs/kendo-angular-gantt.js +1 -1
  82. package/package.json +1 -1
@@ -8,8 +8,9 @@ import { TreeListComponent, DataBoundTreeComponent, ExpandableTreeComponent, Sel
8
8
  import { CompositeFilterDescriptor, SortDescriptor } from '@progress/kendo-data-query';
9
9
  import { Day } from '@progress/kendo-date-math';
10
10
  import { Observable } from 'rxjs';
11
+ import { GanttTimelineComponent } from './timeline/gantt-timeline.component';
11
12
  import { GanttColumnBase } from './columns/columns';
12
- import { DataStateChangeEvent, ColumnMenuSettings, RowClassFn, TaskClassFn, ColumnVisibilityChangeEvent, ColumnResizeEvent, ColumnLockedChangeEvent, ColumnReorderEvent, ColumnReorderConfig, GanttTaskModelFields, GanttDependencyModelFields, SortSettings, CellClickEvent, TaskClickEvent, DependencyAddEvent } from './models/models';
13
+ import { DataStateChangeEvent, ColumnMenuSettings, RowClassFn, TaskClassFn, ColumnVisibilityChangeEvent, ColumnResizeEvent, ColumnLockedChangeEvent, ColumnReorderEvent, ColumnReorderConfig, GanttTaskModelFields, GanttDependencyModelFields, SortSettings, CellClickEvent, TaskClickEvent, DependencyAddEvent, TaskDeleteEvent } from './models/models';
13
14
  import { LocalizationService } from '@progress/kendo-angular-l10n';
14
15
  import { TimelineViewService } from './timeline/timeline-view.service';
15
16
  import { TimelineViewType } from './models/timeline-view';
@@ -19,12 +20,12 @@ import { DependencyDomService } from './dependencies/dependency-dom.service';
19
20
  import { MappingService } from './common/mapping.service';
20
21
  import { OptionChangesService } from './common/option-changes.service';
21
22
  import { EditService } from './editing/edit.service';
23
+ import { NavigationService } from './navigation/navigation.service';
22
24
  import { TimelinePaneOptions, TreeListPaneOptions } from './models/splitter-pane-options.interface';
23
25
  import { GanttTaskTemplateDirective } from './template-directives/task-template.directive';
24
26
  import { GanttSummaryTaskTemplateDirective } from './template-directives/summary-task-template.directive';
25
27
  import { GanttTaskContentTemplateDirective } from './template-directives/task-content-template.directive';
26
28
  import { ToolbarTemplateDirective } from './toolbar/toolbar-template.directive';
27
- import { GanttTimelineComponent } from './timeline/gantt-timeline.component';
28
29
  import { ToolbarSettings } from './models/toolbar-settings';
29
30
  import { ExpandEvent } from './expanded-state/expand-event';
30
31
  import { ViewBase } from './timeline/view-base';
@@ -32,6 +33,7 @@ import { SelectionChangeEvent } from './selection/selection-change-event';
32
33
  import { TaskEditEvent } from './models/events/task-edit-event.interface';
33
34
  import { CellCloseEvent } from './models/events/cell-close-event.interface';
34
35
  import { TaskAddEvent } from './models/events/task-add-event.interface';
36
+ import { ViewItem } from './models/view-item.interface';
35
37
  import { DragScrollSettings } from './scrolling/drag-scroll-settings';
36
38
  /**
37
39
  * Represents the Kendo UI Gantt component for Angular.
@@ -115,22 +117,24 @@ export declare class GanttComponent implements AfterContentInit, OnChanges, OnDe
115
117
  private localizationService;
116
118
  private hostElement;
117
119
  private zone;
120
+ private navigationService;
118
121
  treeList: TreeListComponent;
119
122
  timeline: GanttTimelineComponent;
120
- /**
121
- * @hidden
122
- */
123
123
  taskContentTemplate: GanttTaskContentTemplateDirective;
124
+ taskTemplate: GanttTaskTemplateDirective;
125
+ summaryTaskTemplate: GanttSummaryTaskTemplateDirective;
126
+ toolbarTemplateChildren: QueryList<ToolbarTemplateDirective>;
127
+ toolbarTemplate: ToolbarTemplateDirective;
124
128
  /**
125
129
  * @hidden
126
130
  */
127
- taskTemplate: GanttTaskTemplateDirective;
131
+ roleDescription: string;
132
+ readonly hostRoleDescriptionAttr: string;
128
133
  /**
129
134
  * @hidden
130
135
  */
131
- summaryTaskTemplate: GanttSummaryTaskTemplateDirective;
132
- toolbarTemplateChildren: QueryList<ToolbarTemplateDirective>;
133
- toolbarTemplate: ToolbarTemplateDirective;
136
+ role: string;
137
+ readonly hostRoleAttr: string;
134
138
  hostClasses: boolean;
135
139
  readonly dir: string;
136
140
  /**
@@ -261,6 +265,12 @@ export declare class GanttComponent implements AfterContentInit, OnChanges, OnDe
261
265
  * The end of the work week (index based).
262
266
  */
263
267
  workWeekEnd: Day;
268
+ /**
269
+ * If set to `true`, the user can use dedicated shortcuts to interact with the Gantt.
270
+ * By default, navigation is disabled for the TreeList and Timeline parts of the component,
271
+ * ([see example]({% slug keyboard_navigation_gantt %})).
272
+ */
273
+ navigable: boolean;
264
274
  /**
265
275
  * The options of the timeline splitter pane. By default the pane is `collapsible`,
266
276
  * `resizable`, not `collapsed`, and its `size` is `'50%'`.
@@ -339,10 +349,11 @@ export declare class GanttComponent implements AfterContentInit, OnChanges, OnDe
339
349
  */
340
350
  cellClose: EventEmitter<CellCloseEvent>;
341
351
  /**
342
- * Fires when the end user clicks the `Delete` button in the task editing dialog or the task delete icon.
352
+ * Fires when the end user clicks the `Delete` button in the task editing dialog,
353
+ * the task delete icon, or presses the `Delete` key on the keyboard when a task in the timeline is focused.
343
354
  * Use the event handler to open a confirmation dialog when necessary.
344
355
  */
345
- taskDelete: EventEmitter<any>;
356
+ taskDelete: EventEmitter<TaskDeleteEvent>;
346
357
  /**
347
358
  * Fires when an item is collapsed.
348
359
  */
@@ -428,6 +439,10 @@ export declare class GanttComponent implements AfterContentInit, OnChanges, OnDe
428
439
  * @hidden
429
440
  */
430
441
  readonly renderedTreeListItems: any[];
442
+ /**
443
+ * @hidden
444
+ */
445
+ readonly viewItems: ViewItem[];
431
446
  /**
432
447
  * @hidden
433
448
  */
@@ -490,6 +505,10 @@ export declare class GanttComponent implements AfterContentInit, OnChanges, OnDe
490
505
  * @hidden
491
506
  */
492
507
  showConfirmationDialog: boolean;
508
+ /**
509
+ * @hidden
510
+ */
511
+ readonly isInEditMode: boolean;
493
512
  private _columns;
494
513
  private _data;
495
514
  private _dragScrollSettings;
@@ -509,11 +528,27 @@ export declare class GanttComponent implements AfterContentInit, OnChanges, OnDe
509
528
  private optionChangesSubscriptions;
510
529
  private editServiceSubscription;
511
530
  private localizationSubscription;
512
- constructor(timelineViewService: TimelineViewService, scrollSyncService: ScrollSyncService, renderer: Renderer2, mapper: MappingService, optionChangesService: OptionChangesService, dependencyDomService: DependencyDomService, editService: EditService, localizationService: LocalizationService, hostElement: ElementRef<HTMLElement>, zone: NgZone);
531
+ constructor(timelineViewService: TimelineViewService, scrollSyncService: ScrollSyncService, renderer: Renderer2, mapper: MappingService, optionChangesService: OptionChangesService, dependencyDomService: DependencyDomService, editService: EditService, localizationService: LocalizationService, hostElement: ElementRef<HTMLElement>, zone: NgZone, navigationService: NavigationService);
513
532
  ngOnChanges(changes: SimpleChanges): void;
514
533
  ngAfterViewInit(): void;
515
534
  ngAfterContentInit(): void;
516
535
  ngOnDestroy(): void;
536
+ /**
537
+ * Focuses the last active cell or task in the Gantt.
538
+ * If no item has previously been focused, the first cell of the TreeList part will receive focus,
539
+ * ([see example]({% slug keyboard_navigation_gantt %}#toc-controlling-the-focus)).
540
+ */
541
+ focus(): void;
542
+ /**
543
+ * Focuses the targeted cell in the TreeList part of the component,
544
+ * ([see example]({% slug keyboard_navigation_gantt %}#toc-controlling-the-focus)).
545
+ */
546
+ focusCell(rowIndex: number, colIndex: number): void;
547
+ /**
548
+ * Focuses the targeted task in the Timeline part of the component,
549
+ * ([see example]({% slug keyboard_navigation_gantt %}#toc-controlling-the-focus)).
550
+ */
551
+ focusTask(taskIndex: number): void;
517
552
  /**
518
553
  * Applies the minimum possible width for the specified column,
519
554
  * so that the whole text fits without wrapping. This method expects the Gantt
@@ -563,6 +598,10 @@ export declare class GanttComponent implements AfterContentInit, OnChanges, OnDe
563
598
  * Opens the delete task confirmation dialog.
564
599
  */
565
600
  openConfirmationDialog(): void;
601
+ /**
602
+ * @hidden
603
+ */
604
+ handleConfirmationDialogClose(): void;
566
605
  /**
567
606
  * Opens a cell for editing.
568
607
  */
@@ -635,16 +674,36 @@ export declare class GanttComponent implements AfterContentInit, OnChanges, OnDe
635
674
  * @hidden
636
675
  */
637
676
  getText(token: string): string;
638
- private emitTaskClick;
639
- private emitSelectionChange;
677
+ /**
678
+ * @hidden
679
+ */
680
+ changeActiveView(view: TimelineViewType): void;
681
+ /**
682
+ * @hidden
683
+ */
684
+ notifyTaskClick(event: PointerEvent | KeyboardEvent, dataItem: any, itemIndex: number): void;
685
+ /**
686
+ * @hidden
687
+ */
688
+ notifySelectionChange(dataItem: any, action: 'select' | 'remove'): void;
689
+ /**
690
+ * @hidden
691
+ */
692
+ notifyTaskDelete(task: any): void;
693
+ /**
694
+ * @hidden
695
+ */
696
+ isSameSelection(action: 'select' | 'remove', dataItem: any): boolean;
697
+ /**
698
+ * @hidden
699
+ */
700
+ getSelectionAction({ ctrlKey, metaKey }: PointerEvent | KeyboardEvent, dataItem: any): 'select' | 'remove';
640
701
  private updateTreeListGroupClass;
641
702
  /**
642
703
  * Used to hide the vertical scrollbar
643
704
  */
644
705
  private updateTreeListMargin;
645
706
  private getActiveViewOptions;
646
- private isSameSelection;
647
- private getSelectionAction;
648
707
  private getFirstSelectedItem;
649
708
  private defaultValidateNewDependencyCallback;
650
709
  }
@@ -11,6 +11,7 @@ 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';
16
17
  import { DependencyType } from './models/models';
@@ -26,13 +27,13 @@ import { OptionChangesService } from './common/option-changes.service';
26
27
  import { EditService } from './editing/edit.service';
27
28
  import { TimelineScrollService } from './scrolling/timeline-scroll.service';
28
29
  import { GanttLocalizationService } from './localization/gantt-localization.service';
30
+ import { NavigationService } from './navigation/navigation.service';
29
31
  import { areParentChild, getClosestTaskIndex, isClearButton, isColumnGroup, isPresent, isTask, normalizeGanttData, scrollbarWidth } from './utils';
30
32
  import { DEFAULT_TIMELINE_PANE_SETTINGS, DEFAULT_TREELIST_PANE_SETTINGS } from './models/splitter-pane-options.interface';
31
33
  import { GanttTaskTemplateDirective } from './template-directives/task-template.directive';
32
34
  import { GanttSummaryTaskTemplateDirective } from './template-directives/summary-task-template.directive';
33
35
  import { GanttTaskContentTemplateDirective } from './template-directives/task-content-template.directive';
34
36
  import { ToolbarTemplateDirective } from './toolbar/toolbar-template.directive';
35
- import { GanttTimelineComponent } from './timeline/gantt-timeline.component';
36
37
  import { ViewBase } from './timeline/view-base';
37
38
  import { getEditItem } from './editing/utils';
38
39
  const TREELIST_GROUP_COLUMNS_CLASS = 'k-gantt-treelist-nested-columns';
@@ -115,7 +116,7 @@ const DEFAULT_DRAG_SCROLL_SETTINGS = {
115
116
  * ```
116
117
  */
117
118
  let GanttComponent = GanttComponent_1 = class GanttComponent {
118
- constructor(timelineViewService, scrollSyncService, renderer, mapper, optionChangesService, dependencyDomService, editService, localizationService, hostElement, zone) {
119
+ constructor(timelineViewService, scrollSyncService, renderer, mapper, optionChangesService, dependencyDomService, editService, localizationService, hostElement, zone, navigationService) {
119
120
  this.timelineViewService = timelineViewService;
120
121
  this.scrollSyncService = scrollSyncService;
121
122
  this.renderer = renderer;
@@ -126,6 +127,15 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
126
127
  this.localizationService = localizationService;
127
128
  this.hostElement = hostElement;
128
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';
129
139
  this.hostClasses = true;
130
140
  /**
131
141
  * Specifies a callback that determines if the given task is selected ([see example]({% slug selection_gantt %}#toc-custom-selection)).
@@ -197,6 +207,12 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
197
207
  * The end of the work week (index based).
198
208
  */
199
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;
200
216
  /**
201
217
  * Indicates whether the Gantt columns will be resized during initialization so that they fit their headers and row content.
202
218
  * Columns with autoSize set to false are excluded.
@@ -240,7 +256,8 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
240
256
  */
241
257
  this.cellClose = new EventEmitter();
242
258
  /**
243
- * 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.
244
261
  * Use the event handler to open a confirmation dialog when necessary.
245
262
  */
246
263
  this.taskDelete = new EventEmitter();
@@ -375,7 +392,11 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
375
392
  }));
376
393
  this.editService.getSelectedItem = this.getFirstSelectedItem.bind(this);
377
394
  this.editServiceSubscription.add(this.editService.showEditingDialog.subscribe(show => this.showEditingDialog = show));
378
- 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
+ }));
379
400
  this.editServiceSubscription.add(this.editService.editEvent.subscribe(args => {
380
401
  this[args.editResultType].emit({
381
402
  taskFormGroup: args.taskFormGroup,
@@ -386,6 +407,9 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
386
407
  this.showConfirmationDialog = this.showEditingDialog = false;
387
408
  this.editService.dataItem = this.editService.taskFormGroup = null;
388
409
  this.updateView();
410
+ if (this.navigable) {
411
+ this.focus();
412
+ }
389
413
  }));
390
414
  this.editServiceSubscription.add(this.editService.addEvent.subscribe(args => {
391
415
  const selectedItem = this.getFirstSelectedItem();
@@ -409,6 +433,12 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
409
433
  set toolbarTemplate(customToolbarTemplate) {
410
434
  this._customToolbarTemplate = customToolbarTemplate;
411
435
  }
436
+ get hostRoleDescriptionAttr() {
437
+ return this.roleDescription;
438
+ }
439
+ get hostRoleAttr() {
440
+ return this.role;
441
+ }
412
442
  get dir() {
413
443
  return this.direction;
414
444
  }
@@ -586,6 +616,15 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
586
616
  }
587
617
  return this.treeList.view.data.map(item => item.data);
588
618
  }
619
+ /**
620
+ * @hidden
621
+ */
622
+ get viewItems() {
623
+ if (!isPresent(this.treeList)) {
624
+ return [];
625
+ }
626
+ return this.treeList.view.data;
627
+ }
589
628
  /**
590
629
  * @hidden
591
630
  */
@@ -629,6 +668,12 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
629
668
  get viewTypes() {
630
669
  return this.views.map(view => view.type);
631
670
  }
671
+ /**
672
+ * @hidden
673
+ */
674
+ get isInEditMode() {
675
+ return this.showEditingDialog || this.showConfirmationDialog || this.treeList.isEditing();
676
+ }
632
677
  ngOnChanges(changes) {
633
678
  if (anyChanged(['data', 'activeView', 'workWeekStart', 'workWeekEnd', 'workDayStart', 'workDayEnd'], changes)) {
634
679
  this.loadTimelineData();
@@ -636,6 +681,14 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
636
681
  }
637
682
  ngAfterViewInit() {
638
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
+ }
639
692
  const leftContainer = this.treeList.wrapper.nativeElement.querySelector('kendo-treelist-list > div');
640
693
  this.scrollSyncService.registerElement(leftContainer, 'treelist');
641
694
  }
@@ -653,6 +706,34 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
653
706
  this.localizationSubscription.unsubscribe();
654
707
  }
655
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
+ }
656
737
  /**
657
738
  * Applies the minimum possible width for the specified column,
658
739
  * so that the whole text fits without wrapping. This method expects the Gantt
@@ -737,6 +818,15 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
737
818
  openConfirmationDialog() {
738
819
  this.showConfirmationDialog = true;
739
820
  }
821
+ /**
822
+ * @hidden
823
+ */
824
+ handleConfirmationDialogClose() {
825
+ this.showConfirmationDialog = false;
826
+ if (this.navigable) {
827
+ this.focus();
828
+ }
829
+ }
740
830
  /**
741
831
  * Opens a cell for editing.
742
832
  */
@@ -821,7 +911,7 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
821
911
  if (hasObservers(this.taskClick)) {
822
912
  const taskIndex = getClosestTaskIndex(target, gantt);
823
913
  const task = this.renderedTreeListItems[taskIndex];
824
- this.zone.run(() => this.emitTaskClick(event, task, taskIndex));
914
+ this.zone.run(() => this.notifyTaskClick(event, task, taskIndex));
825
915
  }
826
916
  }
827
917
  /**
@@ -839,8 +929,8 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
839
929
  if ((hasObservers(this.selectionChange) && !this.isSameSelection(selectionAction, task)) ||
840
930
  hasObservers(this.taskClick)) {
841
931
  this.zone.run(() => {
842
- this.emitSelectionChange(task, selectionAction);
843
- this.emitTaskClick(event, task, taskIndex);
932
+ this.notifySelectionChange(task, selectionAction);
933
+ this.notifyTaskClick(event, task, taskIndex);
844
934
  });
845
935
  }
846
936
  }
@@ -877,7 +967,7 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
877
967
  }
878
968
  const task = event.items.map(item => item.dataItem)[0]; // single selection only currently available
879
969
  const action = event.action;
880
- this.emitSelectionChange(task, action);
970
+ this.notifySelectionChange(task, action);
881
971
  }
882
972
  /**
883
973
  * @hidden
@@ -928,7 +1018,7 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
928
1018
  dataItem: task,
929
1019
  originalEvent: event,
930
1020
  sender: this,
931
- rowIndex: taskIndex,
1021
+ index: taskIndex,
932
1022
  type: 'dblclick'
933
1023
  }));
934
1024
  }
@@ -939,16 +1029,35 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
939
1029
  getText(token) {
940
1030
  return this.localizationService.get(token);
941
1031
  }
942
- 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;
943
1049
  this.taskClick.emit({
944
1050
  originalEvent: event,
945
1051
  dataItem: dataItem,
946
- rowIndex: itemIndex,
947
- type: event.type,
1052
+ index: itemIndex,
1053
+ type: type,
948
1054
  sender: this
949
1055
  });
950
1056
  }
951
- emitSelectionChange(dataItem, action) {
1057
+ /**
1058
+ * @hidden
1059
+ */
1060
+ notifySelectionChange(dataItem, action) {
952
1061
  if (this.isSameSelection(action, dataItem)) {
953
1062
  return;
954
1063
  }
@@ -959,6 +1068,29 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
959
1068
  });
960
1069
  this.treeList.updateView();
961
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
+ }
962
1094
  updateTreeListGroupClass(columns = this.columns) {
963
1095
  if (!isPresent(this.treeList)) {
964
1096
  return;
@@ -985,13 +1117,6 @@ let GanttComponent = GanttComponent_1 = class GanttComponent {
985
1117
  }
986
1118
  return this.views.find(view => view.type === this.activeView);
987
1119
  }
988
- isSameSelection(action, dataItem) {
989
- return action === 'select' && this.isSelected(dataItem);
990
- }
991
- getSelectionAction({ ctrlKey, metaKey }, dataItem) {
992
- const shouldToggleSelection = ctrlKey || metaKey;
993
- return (shouldToggleSelection && this.isSelected(dataItem)) ? 'remove' : 'select';
994
- }
995
1120
  getFirstSelectedItem() {
996
1121
  const isSelectedCallback = this.isSelected || isSelected;
997
1122
  const loadedItems = this.renderedTreeListItems || [];
@@ -1067,6 +1192,24 @@ tslib_1.__decorate([
1067
1192
  ContentChildren(ToolbarTemplateDirective),
1068
1193
  tslib_1.__metadata("design:type", QueryList)
1069
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);
1070
1213
  tslib_1.__decorate([
1071
1214
  HostBinding('class.k-gantt'),
1072
1215
  tslib_1.__metadata("design:type", Boolean)
@@ -1172,6 +1315,10 @@ tslib_1.__decorate([
1172
1315
  Input(),
1173
1316
  tslib_1.__metadata("design:type", Number)
1174
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);
1175
1322
  tslib_1.__decorate([
1176
1323
  Input(),
1177
1324
  tslib_1.__metadata("design:type", Object),
@@ -1337,7 +1484,8 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1337
1484
  MappingService,
1338
1485
  OptionChangesService,
1339
1486
  EditService,
1340
- TimelineScrollService
1487
+ TimelineScrollService,
1488
+ NavigationService
1341
1489
  ],
1342
1490
  template: `
1343
1491
  <ng-container kendoGanttLocalizedMessages
@@ -1564,6 +1712,7 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1564
1712
  [data]="data"
1565
1713
  [hasChildren]="hasChildren"
1566
1714
  [fetchChildren]="fetchChildren"
1715
+ [navigable]="navigable"
1567
1716
  [isExpanded]="isExpanded"
1568
1717
  [autoSize]="columnsAutoSize"
1569
1718
  [columnMenu]="columnMenu"
@@ -1654,7 +1803,7 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1654
1803
  *ngIf="views && views.length"
1655
1804
  [renderDependencyDragClues]="renderDependencyDragClues"
1656
1805
  [dragScrollSettings]="dragScrollSettings"
1657
- [rows]="renderedTreeListItems"
1806
+ [rows]="viewItems"
1658
1807
  [slots]="timelineSlots"
1659
1808
  [groupSlots]="timelineGroupSlots"
1660
1809
  [tableWidth]="tableWidth"
@@ -1664,7 +1813,8 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1664
1813
  [summaryTaskTemplate]="summaryTaskTemplate?.templateRef"
1665
1814
  [taskClass]="taskClass"
1666
1815
  [dependencies]="dependencies"
1667
- [hasChildren]="hasChildren"
1816
+ [isExpanded]="isExpanded"
1817
+ [selectable]="selectable"
1668
1818
  [isTaskSelected]="isTaskSelected"
1669
1819
  [kendoEventsOutsideAngular]="{
1670
1820
  click: handleTimelineClick,
@@ -1692,12 +1842,12 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1692
1842
  [width]="575"
1693
1843
  [height]="170"
1694
1844
  [title]="getText('confirmationDialogTitle')"
1695
- (close)="showConfirmationDialog = false;">
1845
+ (close)="handleConfirmationDialogClose()">
1696
1846
  <span>{{ getText('confirmationDialogContent') }}</span>
1697
1847
  <kendo-dialog-actions layout="normal">
1698
1848
  <kendo-treelist-spacer></kendo-treelist-spacer>
1699
1849
  <button kendoButton [primary]="true" (click)="handleDeleteConfirmation()">{{ getText('deleteButtonText') }}</button>
1700
- <button kendoButton (click)="showConfirmationDialog = false;">{{ getText('cancelButtonText') }}</button>
1850
+ <button kendoButton (click)="handleConfirmationDialogClose()">{{ getText('cancelButtonText') }}</button>
1701
1851
  </kendo-dialog-actions>
1702
1852
  </kendo-dialog>
1703
1853
  `
@@ -1711,6 +1861,7 @@ GanttComponent = GanttComponent_1 = tslib_1.__decorate([
1711
1861
  EditService,
1712
1862
  LocalizationService,
1713
1863
  ElementRef,
1714
- NgZone])
1864
+ NgZone,
1865
+ NavigationService])
1715
1866
  ], GanttComponent);
1716
1867
  export { GanttComponent };
@@ -22,6 +22,7 @@ export { GanttLocalizationService } from './localization/gantt-localization.serv
22
22
  export { LocalizedMessagesDirective } from './localization/localized-messages.directive';
23
23
  export { Messages } from './localization/messages';
24
24
  export { PreventableEvent } from './models/events/preventable-event';
25
+ export { NavigationService } from './navigation/navigation.service';
25
26
  export { GanttHeaderTableBodyComponent } from './rendering/gantt-header-table-body.component';
26
27
  export { GanttMilestoneTaskComponent } from './rendering/gantt-milestone-task.component';
27
28
  export { GanttSummaryTaskComponent } from './rendering/gantt-summary-task.component';
@@ -22,6 +22,7 @@ export { GanttLocalizationService } from './localization/gantt-localization.serv
22
22
  export { LocalizedMessagesDirective } from './localization/localized-messages.directive';
23
23
  export { Messages } from './localization/messages';
24
24
  export { PreventableEvent } from './models/events/preventable-event';
25
+ export { NavigationService } from './navigation/navigation.service';
25
26
  export { GanttHeaderTableBodyComponent } from './rendering/gantt-header-table-body.component';
26
27
  export { GanttMilestoneTaskComponent } from './rendering/gantt-milestone-task.component';
27
28
  export { GanttSummaryTaskComponent } from './rendering/gantt-summary-task.component';