@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
@@ -0,0 +1,392 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var tslib_1 = require("tslib");
8
+ var core_1 = require("@angular/core");
9
+ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
10
+ var rxjs_1 = require("rxjs");
11
+ var scroll_sync_service_1 = require("../scrolling/scroll-sync.service");
12
+ var utils_1 = require("../utils");
13
+ var utils_2 = require("./utils");
14
+ /**
15
+ * @hidden
16
+ */
17
+ var NavigationService = /** @class */ (function () {
18
+ function NavigationService(zone, renderer, scrollSyncService) {
19
+ this.zone = zone;
20
+ this.renderer = renderer;
21
+ this.scrollSyncService = scrollSyncService;
22
+ /**
23
+ * Notifies when the tasks' focused and interactive (tabindex) state has changed.
24
+ *
25
+ * All tasks are rendered with tabindex="-1".
26
+ * When one is clicked, or when some navigation key keyboard key is pressed, it should be focused, assigned the focus class, and its tabindex updated to 0.
27
+ * All other tasks should get -1 tabindex and have the focus class removed from them.
28
+ */
29
+ this.taskStatusChanges = new rxjs_1.Subject();
30
+ /**
31
+ * Keeps track of whether the Timeline part is focused.
32
+ * Used when the index of the task elements change (tasks are changed, pushed to, spliced from, etc.)
33
+ * and their status should be updated accordingly.
34
+ */
35
+ this.isTimelineFocused = false;
36
+ /**
37
+ * Keeps track of which part has last been focused.
38
+ * Used when calling `gantt.focus()` to determine which part of the component should receive focus.
39
+ */
40
+ this.treeListLastActive = false;
41
+ /**
42
+ * Keeps track of which part has last been focused.
43
+ * Used when calling `gantt.focus()` to determine which part of the component should receive focus.
44
+ */
45
+ this.timelineLastActive = false;
46
+ this._enabled = false;
47
+ this._activeTimelineIndex = 0;
48
+ this._activeTreeListCell = { rowIndex: 0, colIndex: 0 };
49
+ }
50
+ Object.defineProperty(NavigationService.prototype, "enabled", {
51
+ /**
52
+ * Specifies whether navigation is enabled.
53
+ */
54
+ get: function () {
55
+ return this._enabled;
56
+ },
57
+ enumerable: true,
58
+ configurable: true
59
+ });
60
+ Object.defineProperty(NavigationService.prototype, "activeTask", {
61
+ /**
62
+ * Used to retrieve read-only data about the currently active task.
63
+ */
64
+ get: function () {
65
+ return {
66
+ activeIndex: this.activeTimelineIndex,
67
+ isFocused: this.isTimelineFocused
68
+ };
69
+ },
70
+ enumerable: true,
71
+ configurable: true
72
+ });
73
+ Object.defineProperty(NavigationService.prototype, "activeTreeListCell", {
74
+ get: function () {
75
+ var firstAvailableIndex = 0;
76
+ var lastAvailableRowIndex = this.treeListHeaderRowsCount + this.gantt.treeList.view.data.length - 1;
77
+ var rowIndex = utils_1.fitToRange(this._activeTreeListCell.rowIndex, firstAvailableIndex, lastAvailableRowIndex);
78
+ var lastAvailableColIndex = this.gantt.columns.length;
79
+ var colIndex = utils_1.fitToRange(this._activeTreeListCell.colIndex, firstAvailableIndex, lastAvailableColIndex);
80
+ return { rowIndex: rowIndex, colIndex: colIndex };
81
+ },
82
+ /**
83
+ * Persists the expected TreeList focused cell coords.
84
+ * When the tasks in the Timeline are navigated through, the expected TreeList focus target should also change,
85
+ * in order to allow back-tabbing from the Timeline to the same row in the TreeList.
86
+ */
87
+ set: function (cell) {
88
+ this._activeTreeListCell = cell;
89
+ },
90
+ enumerable: true,
91
+ configurable: true
92
+ });
93
+ Object.defineProperty(NavigationService.prototype, "activeTimelineIndex", {
94
+ get: function () {
95
+ var firstAvailableIndex = 0;
96
+ var lastAvailableIndex = this.gantt.treeList.view.data.length - 1;
97
+ return utils_1.fitToRange(this._activeTimelineIndex, firstAvailableIndex, lastAvailableIndex);
98
+ },
99
+ /**
100
+ * Persists the expected Timeline focused task index.
101
+ * When the cells in the TreeList are navigated through, the expected Timeline focus target should also change,
102
+ * in order to allow tabbing from the TreeList to the same row in the Timeline.
103
+ */
104
+ set: function (index) {
105
+ this._activeTimelineIndex = index;
106
+ },
107
+ enumerable: true,
108
+ configurable: true
109
+ });
110
+ Object.defineProperty(NavigationService.prototype, "treeListHeaderRowsCount", {
111
+ /**
112
+ * The TreeList row index takes into account the header and filter rows.
113
+ * Used when translating Timeline task indices to TreeList row indices.
114
+ */
115
+ get: function () {
116
+ // captures nested group header rows + filter row if we start supporting it at some point
117
+ return this.treeListElement.querySelectorAll('.k-grid-header tr').length;
118
+ },
119
+ enumerable: true,
120
+ configurable: true
121
+ });
122
+ NavigationService.prototype.initialize = function (_a) {
123
+ var _this = this;
124
+ var gantt = _a.gantt, host = _a.host, treeListElement = _a.treeListElement, timelineElement = _a.timelineElement;
125
+ // no private property setters in TypeScript, so use a getter and a poorly named private prop for this value
126
+ this._enabled = true;
127
+ this.gantt = gantt;
128
+ this.host = host;
129
+ this.treeListElement = treeListElement;
130
+ this.timelineElement = timelineElement;
131
+ // TODO: fix in the splitter package and remove
132
+ // move the splitbar HTML element between the two panes to keep the visial tabbing order in tact
133
+ var splitbar = this.host.querySelector('.k-splitbar');
134
+ if (utils_1.isPresent(splitbar) && utils_1.isPresent(splitbar.previousElementSibling) && utils_1.isPresent(splitbar.after)) {
135
+ splitbar.after(splitbar.previousElementSibling);
136
+ }
137
+ this.zone.runOutsideAngular(function () {
138
+ _this.eventListenerDisposers = [
139
+ _this.renderer.listen(_this.host, 'keydown', _this.handleKeydown.bind(_this)),
140
+ _this.renderer.listen(_this.treeListElement, 'mousedown', _this.focusTreeList.bind(_this)),
141
+ _this.renderer.listen(_this.treeListElement, 'focusin', _this.handleTreeListFocusIn.bind(_this)),
142
+ _this.renderer.listen(_this.timelineElement, 'mousedown', _this.handleTimelineMousedown.bind(_this)),
143
+ _this.renderer.listen(_this.timelineElement, 'focusin', _this.handleTimelineFocusIn.bind(_this)),
144
+ _this.renderer.listen(_this.timelineElement, 'focusout', _this.handleTimelineFocusOut.bind(_this))
145
+ ];
146
+ });
147
+ };
148
+ NavigationService.prototype.ngOnDestroy = function () {
149
+ if (utils_1.isPresent(this.eventListenerDisposers)) {
150
+ this.eventListenerDisposers.forEach(function (removeListener) { return removeListener(); });
151
+ this.eventListenerDisposers = null;
152
+ }
153
+ this.gantt = null;
154
+ this.host = null;
155
+ this.treeListElement = null;
156
+ this.timelineElement = null;
157
+ };
158
+ /**
159
+ * Focuses either the last active TreeList cell, or the last active Timeline task,
160
+ * dependening on which of the two last held focus.
161
+ *
162
+ * Focuses the first TreeList cell by default.
163
+ */
164
+ NavigationService.prototype.focusLastActiveItem = function () {
165
+ if (this.gantt.data.length === 0 || (!this.treeListLastActive && !this.timelineLastActive)) {
166
+ this.focusCell(0, 0);
167
+ }
168
+ else if (this.treeListLastActive) {
169
+ var _a = this.activeTreeListCell, rowIndex = _a.rowIndex, colIndex = _a.colIndex;
170
+ this.gantt.treeList.focusCell(rowIndex, colIndex);
171
+ }
172
+ else if (this.timelineLastActive) {
173
+ this.focusTask(this.activeTimelineIndex);
174
+ }
175
+ };
176
+ /**
177
+ * Focuses the targeted TreeList cell regardless of the last peresisted target.
178
+ */
179
+ NavigationService.prototype.focusCell = function (rowIndex, colIndex) {
180
+ this.activeTreeListCell = { rowIndex: rowIndex, colIndex: colIndex };
181
+ this.activeTimelineIndex = rowIndex - this.treeListHeaderRowsCount;
182
+ this.gantt.treeList.focusCell(this.activeTreeListCell.rowIndex, this.activeTreeListCell.colIndex);
183
+ };
184
+ /**
185
+ * Focuses the targeted Timeline task regardless of the last peresisted target.
186
+ */
187
+ NavigationService.prototype.focusTask = function (index) {
188
+ this.activeTimelineIndex = index;
189
+ this.isTimelineFocused = true;
190
+ this.activeTreeListCell = {
191
+ rowIndex: index + this.treeListHeaderRowsCount,
192
+ colIndex: this.activeTreeListCell.colIndex
193
+ };
194
+ this.notifyTaskStatusChange();
195
+ };
196
+ /**
197
+ * Updates the focus target flags and notifies the active task to update its focused state.
198
+ */
199
+ NavigationService.prototype.handleTimelineFocusIn = function (_a) {
200
+ var target = _a.target;
201
+ this.treeListLastActive = false;
202
+ this.timelineLastActive = true;
203
+ this.isTimelineFocused = true;
204
+ if (utils_1.isTask(target, this.timelineElement)) {
205
+ this.notifyTaskStatusChange();
206
+ }
207
+ };
208
+ /**
209
+ * Updates the timeline focus state flag and notifies the active task to update its focused state.
210
+ */
211
+ NavigationService.prototype.handleTimelineFocusOut = function (_a) {
212
+ var relatedTarget = _a.relatedTarget;
213
+ this.isTimelineFocused = this.timelineElement.contains(relatedTarget);
214
+ // update the task element only if the new focus target is not in the Timeline - focus change between tasks is handled in the focusin handler
215
+ if (!utils_1.isTask(relatedTarget, this.timelineElement)) {
216
+ this.notifyTaskStatusChange();
217
+ }
218
+ };
219
+ /**
220
+ * Updates the focus target flags and corrects the TreeList focus target if needed.
221
+ * As the TreeList will keep its last focused cell with tabindex="0",
222
+ * this methods forcefully focuses the correct cell,
223
+ * when navigating in the Timeline has updated the expected TreeList focus target.
224
+ */
225
+ NavigationService.prototype.handleTreeListFocusIn = function (event) {
226
+ this.treeListLastActive = true;
227
+ this.timelineLastActive = false;
228
+ // if the previous focus target was in the TreeList, rely on its component navigation and just record the focused item index
229
+ if (this.treeListElement.contains(event.relatedTarget)) {
230
+ var _a = this.gantt.treeList.activeCell, colIndex = _a.colIndex, rowIndex = _a.rowIndex;
231
+ this.activeTreeListCell = { colIndex: colIndex, rowIndex: rowIndex };
232
+ }
233
+ else {
234
+ // if the previous focus target was outside the TreeList, ensure the expected focus coords are used
235
+ var _b = this.activeTreeListCell, rowIndex = _b.rowIndex, colIndex = _b.colIndex;
236
+ this.gantt.treeList.focusCell(rowIndex, colIndex); // activates the target cell even if it has tabindex="-1"
237
+ }
238
+ this.activeTimelineIndex = this.gantt.treeList.activeCell.dataRowIndex;
239
+ this.notifyTaskStatusChange();
240
+ if (this.gantt.treeList.activeCell.dataRowIndex >= 0) {
241
+ this.scrollHorizontallyToTask(this.activeTimelineIndex);
242
+ this.scrollSyncService.syncScrollTop('treelist', 'timeline');
243
+ }
244
+ };
245
+ NavigationService.prototype.handleKeydown = function (event) {
246
+ var _this = this;
247
+ var _a = event, keyCode = _a.keyCode, target = _a.target, altKey = _a.altKey;
248
+ var isTimelineActive = this.timelineElement.contains(target);
249
+ if (isTimelineActive) {
250
+ if (utils_2.isArrowUpDownKey(keyCode)) {
251
+ var direction = keyCode === kendo_angular_common_1.Keys.ArrowUp ? -1 : 1;
252
+ this.activeTimelineIndex = this.activeTimelineIndex + direction;
253
+ this.activeTreeListCell = {
254
+ rowIndex: this.activeTimelineIndex + this.treeListHeaderRowsCount,
255
+ colIndex: this.activeTreeListCell.colIndex
256
+ };
257
+ }
258
+ else if (keyCode === kendo_angular_common_1.Keys.Home) {
259
+ this.activeTimelineIndex = 0;
260
+ this.activeTreeListCell = {
261
+ rowIndex: this.activeTimelineIndex + this.treeListHeaderRowsCount,
262
+ colIndex: this.activeTreeListCell.colIndex
263
+ };
264
+ }
265
+ else if (keyCode === kendo_angular_common_1.Keys.End) {
266
+ var lastAvailableIndex = this.gantt.treeList.view.data.length - 1;
267
+ this.activeTimelineIndex = lastAvailableIndex;
268
+ this.activeTreeListCell = {
269
+ rowIndex: this.activeTimelineIndex + this.treeListHeaderRowsCount,
270
+ colIndex: this.activeTreeListCell.colIndex
271
+ };
272
+ }
273
+ if (utils_2.isNavigationKey(keyCode)) {
274
+ this.scrollHorizontallyToTask(this.activeTimelineIndex);
275
+ this.scrollSyncService.syncScrollTop('timeline', 'treelist');
276
+ this.notifyTaskStatusChange();
277
+ event.preventDefault();
278
+ }
279
+ if (keyCode === kendo_angular_common_1.Keys.Space && kendo_angular_common_1.hasObservers(this.gantt.selectionChange)) {
280
+ var task_1 = this.gantt.renderedTreeListItems[this.activeTimelineIndex];
281
+ var selectionAction_1 = this.gantt.getSelectionAction(event, task_1);
282
+ if (utils_1.isPresent(task_1) && !this.gantt.isSameSelection(selectionAction_1, task_1)) {
283
+ this.zone.run(function () {
284
+ return _this.gantt.notifySelectionChange(task_1, selectionAction_1);
285
+ });
286
+ }
287
+ event.preventDefault();
288
+ }
289
+ if (keyCode === kendo_angular_common_1.Keys.Enter && kendo_angular_common_1.hasObservers(this.gantt.taskClick)) {
290
+ var task_2 = this.gantt.renderedTreeListItems[this.activeTimelineIndex];
291
+ if (utils_1.isPresent(task_2)) {
292
+ this.zone.run(function () {
293
+ return _this.gantt.notifyTaskClick(event, task_2, _this.activeTimelineIndex);
294
+ });
295
+ }
296
+ event.preventDefault();
297
+ }
298
+ if (utils_2.isExpandCollapseKey(keyCode, altKey)) {
299
+ var task_3 = this.gantt.renderedTreeListItems[this.activeTimelineIndex];
300
+ if (utils_1.isPresent(task_3) && this.gantt.hasChildren(task_3)) {
301
+ var shouldExpand_1 = keyCode === kendo_angular_common_1.Keys.ArrowRight;
302
+ var isExpanded = this.gantt.isExpanded(task_3);
303
+ var sameState = shouldExpand_1 === isExpanded;
304
+ if (!sameState) {
305
+ this.zone.run(function () {
306
+ var expandEvent = { dataItem: task_3 };
307
+ // order is not arbitrary
308
+ // the TreeList emits the individual events first, then the combined `expandStateChange` event
309
+ var individualEmitter = shouldExpand_1 ? _this.gantt.rowExpand : _this.gantt.rowCollapse;
310
+ individualEmitter.emit(expandEvent);
311
+ _this.gantt.expandStateChange.emit(tslib_1.__assign({}, expandEvent, { expand: shouldExpand_1 }));
312
+ _this.gantt.updateView();
313
+ _this.scrollHorizontallyToTask(_this.activeTimelineIndex);
314
+ });
315
+ }
316
+ }
317
+ event.preventDefault();
318
+ }
319
+ }
320
+ var isTreeListActive = this.treeListElement.contains(target);
321
+ if (keyCode === kendo_angular_common_1.Keys.Delete && (isTimelineActive || isTreeListActive) && kendo_angular_common_1.hasObservers(this.gantt.taskDelete)) {
322
+ var taskIndex = isTreeListActive ?
323
+ this.gantt.treeList.activeCell.dataRowIndex :
324
+ this.activeTimelineIndex;
325
+ var task_4 = this.gantt.renderedTreeListItems[taskIndex];
326
+ if (utils_1.isPresent(task_4)) {
327
+ this.zone.run(function () {
328
+ return _this.gantt.notifyTaskDelete(task_4);
329
+ });
330
+ }
331
+ }
332
+ if (utils_2.isViewDigitKey(keyCode) && !utils_1.isToolbar(target, this.host) && !this.gantt.isInEditMode) {
333
+ var targetViewIndex = utils_2.getIndexFromViewDigitKeyCode(keyCode);
334
+ var availableViews = this.gantt.views.toArray();
335
+ var targetView_1 = availableViews[targetViewIndex];
336
+ if (utils_1.isPresent(targetView_1) && targetView_1.type !== this.gantt.activeView) {
337
+ this.zone.run(function () {
338
+ return _this.gantt.changeActiveView(targetView_1.type);
339
+ });
340
+ }
341
+ }
342
+ };
343
+ /**
344
+ * Filters for task mousedown in the Timeline.
345
+ */
346
+ NavigationService.prototype.handleTimelineMousedown = function (_a) {
347
+ var target = _a.target;
348
+ if (utils_1.isTask(target, this.host) && !utils_1.isClearButton(target, this.host)) {
349
+ var taskIndex = utils_1.getClosestTaskIndex(target, this.host);
350
+ this.focusTask(taskIndex);
351
+ }
352
+ };
353
+ /**
354
+ * Scrolls horizontally to the beginning of the target task if the beginning of its content is not in the viewport.
355
+ */
356
+ NavigationService.prototype.scrollHorizontallyToTask = function (index) {
357
+ var task = this.timelineElement.querySelectorAll('.k-task-wrap').item(index);
358
+ if (!utils_1.isPresent(task)) {
359
+ return;
360
+ }
361
+ // scroll horizontally to the item if less than 200px from the beginning of its content are visible
362
+ var targetVisibleWidth = 200;
363
+ var isScrollBeforeTask = (this.timelineElement.clientWidth + this.timelineElement.scrollLeft) < (task.offsetLeft + targetVisibleWidth);
364
+ var isScrollAfterTask = this.timelineElement.scrollLeft > task.offsetLeft;
365
+ if (isScrollBeforeTask || isScrollAfterTask) {
366
+ this.timelineElement.scrollLeft = task.offsetLeft;
367
+ }
368
+ };
369
+ /**
370
+ * Focus the TreeList on TreeList mousedown.
371
+ * A nasty hack to trick `handleTreeListFocusIn` into regarding the previous focus target as again the TreeList.
372
+ * Otherwise cell clicks are wrongly overwritten in `handleTreeListFocusIn` and the click focus target is not respected.
373
+ */
374
+ NavigationService.prototype.focusTreeList = function () {
375
+ this.gantt.treeList.focus();
376
+ };
377
+ /**
378
+ * Fires the `taskStatusChanges` event with active and focused status retrieved from
379
+ * `this.activeTimelineIndex` and `this.isTimelineFocused`.
380
+ */
381
+ NavigationService.prototype.notifyTaskStatusChange = function () {
382
+ this.taskStatusChanges.next(this.activeTask);
383
+ };
384
+ NavigationService = tslib_1.__decorate([
385
+ core_1.Injectable(),
386
+ tslib_1.__metadata("design:paramtypes", [core_1.NgZone,
387
+ core_1.Renderer2,
388
+ scroll_sync_service_1.ScrollSyncService])
389
+ ], NavigationService);
390
+ return NavigationService;
391
+ }());
392
+ exports.NavigationService = NavigationService;
@@ -0,0 +1,79 @@
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
+ "use strict";
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ var kendo_angular_common_1 = require("@progress/kendo-angular-common");
8
+ // TODO: add those keys to `import { Keys } from '@progress/kendo-angular-common';`
9
+ var NumpadKeys;
10
+ (function (NumpadKeys) {
11
+ NumpadKeys[NumpadKeys["Digit1"] = 97] = "Digit1";
12
+ NumpadKeys[NumpadKeys["Digit2"] = 98] = "Digit2";
13
+ NumpadKeys[NumpadKeys["Digit3"] = 99] = "Digit3";
14
+ NumpadKeys[NumpadKeys["Digit4"] = 100] = "Digit4";
15
+ })(NumpadKeys || (NumpadKeys = {}));
16
+ /**
17
+ * @hidden
18
+ */
19
+ exports.isArrowUpDownKey = function (keyCode) { return [
20
+ kendo_angular_common_1.Keys.ArrowUp,
21
+ kendo_angular_common_1.Keys.ArrowDown
22
+ ].some(function (arrowKeyCode) {
23
+ return keyCode === arrowKeyCode;
24
+ }); };
25
+ /**
26
+ * @hidden
27
+ */
28
+ exports.isNavigationKey = function (keyCode) { return [
29
+ kendo_angular_common_1.Keys.ArrowUp,
30
+ kendo_angular_common_1.Keys.ArrowDown,
31
+ kendo_angular_common_1.Keys.Home,
32
+ kendo_angular_common_1.Keys.End
33
+ ].some(function (navigationKeyCode) {
34
+ return keyCode === navigationKeyCode;
35
+ }); };
36
+ /**
37
+ * @hidden
38
+ */
39
+ exports.isExpandCollapseKey = function (keyCode, altKey) {
40
+ return altKey && [
41
+ kendo_angular_common_1.Keys.ArrowLeft,
42
+ kendo_angular_common_1.Keys.ArrowRight
43
+ ].some(function (navigationKeyCode) {
44
+ return keyCode === navigationKeyCode;
45
+ });
46
+ };
47
+ /**
48
+ * @hidden
49
+ */
50
+ exports.isViewDigitKey = function (keyCode) { return [
51
+ kendo_angular_common_1.Keys.Digit1,
52
+ NumpadKeys.Digit1,
53
+ kendo_angular_common_1.Keys.Digit2,
54
+ NumpadKeys.Digit2,
55
+ kendo_angular_common_1.Keys.Digit3,
56
+ NumpadKeys.Digit3,
57
+ kendo_angular_common_1.Keys.Digit4,
58
+ NumpadKeys.Digit4
59
+ ].some(function (digitKeyCode) {
60
+ return keyCode === digitKeyCode;
61
+ }); };
62
+ /**
63
+ * @hidden
64
+ *
65
+ * Returns the corresponding view index for the pressed digit key (Digit 1 => 0, Digit 2 => 1, etc.).
66
+ */
67
+ exports.getIndexFromViewDigitKeyCode = function (keyCode) {
68
+ switch (keyCode) {
69
+ case NumpadKeys.Digit1:
70
+ case kendo_angular_common_1.Keys.Digit1: return 0;
71
+ case NumpadKeys.Digit2:
72
+ case kendo_angular_common_1.Keys.Digit2: return 1;
73
+ case NumpadKeys.Digit3:
74
+ case kendo_angular_common_1.Keys.Digit3: return 2;
75
+ case NumpadKeys.Digit4:
76
+ case kendo_angular_common_1.Keys.Digit4: return 3;
77
+ default: return null;
78
+ }
79
+ };
@@ -11,7 +11,7 @@ exports.packageMetadata = {
11
11
  name: '@progress/kendo-angular-gantt',
12
12
  productName: 'Kendo UI for Angular',
13
13
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
14
- publishDate: 1642086647,
14
+ publishDate: 1642580546,
15
15
  version: '',
16
16
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
17
17
  };
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
8
  var core_1 = require("@angular/core");
9
9
  var mapping_service_1 = require("../common/mapping.service");
10
+ var navigation_service_1 = require("../navigation/navigation.service");
10
11
  var touch_enabled_1 = require("../common/touch-enabled");
11
12
  var dependency_dom_service_1 = require("../dependencies/dependency-dom.service");
12
13
  var option_changes_service_1 = require("../common/option-changes.service");
@@ -17,8 +18,8 @@ var gantt_task_base_1 = require("./gantt-task-base");
17
18
  */
18
19
  var GanttMilestoneTaskComponent = /** @class */ (function (_super) {
19
20
  tslib_1.__extends(GanttMilestoneTaskComponent, _super);
20
- function GanttMilestoneTaskComponent(touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) {
21
- var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) || this;
21
+ function GanttMilestoneTaskComponent(touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) {
22
+ var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) || this;
22
23
  _this.touchEnabled = touchEnabled;
23
24
  _this.milestoneWrapperClass = true;
24
25
  return _this;
@@ -38,14 +39,16 @@ var GanttMilestoneTaskComponent = /** @class */ (function (_super) {
38
39
  useExisting: core_1.forwardRef(function () { return GanttMilestoneTaskComponent_1; })
39
40
  }
40
41
  ],
41
- template: "\n <div\n #task\n class=\"k-task k-task-milestone\"\n [ngClass]=\"taskClass(dataItem)\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n >\n </div>\n <ng-container *ngIf=\"renderDependencyDragClues\">\n <div\n class=\"k-task-dot k-task-start k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n <div\n class=\"k-task-dot k-task-end k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n </ng-container>\n "
42
+ template: "\n <div\n #task\n role=\"treeitem\"\n class=\"k-task k-task-milestone\"\n [ngClass]=\"taskClass(dataItem)\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n [attr.aria-selected]=\"ariaSelected\"\n [attr.aria-level]=\"level + 1\"\n >\n </div>\n <ng-container *ngIf=\"renderDependencyDragClues\">\n <div\n class=\"k-task-dot k-task-start k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n <div\n class=\"k-task-dot k-task-end k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n </ng-container>\n ",
43
+ styles: ["\n .k-task.k-focus {\n box-shadow: 0 0 4px 3px grey;\n outline: none;\n }\n .k-task.k-focus.k-state-selected {\n box-shadow: 0 0 4px 3px #ffaea8;\n }\n "]
42
44
  }),
43
45
  tslib_1.__param(0, core_1.Inject(touch_enabled_1.TOUCH_ENABLED)),
44
46
  tslib_1.__metadata("design:paramtypes", [Boolean, mapping_service_1.MappingService,
45
47
  timeline_view_service_1.TimelineViewService,
46
48
  dependency_dom_service_1.DependencyDomService,
47
49
  option_changes_service_1.OptionChangesService,
48
- core_1.ChangeDetectorRef])
50
+ core_1.ChangeDetectorRef,
51
+ navigation_service_1.NavigationService])
49
52
  ], GanttMilestoneTaskComponent);
50
53
  return GanttMilestoneTaskComponent;
51
54
  }(gantt_task_base_1.GanttTaskBase));
@@ -7,23 +7,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  var tslib_1 = require("tslib");
8
8
  var core_1 = require("@angular/core");
9
9
  var mapping_service_1 = require("../common/mapping.service");
10
+ var navigation_service_1 = require("../navigation/navigation.service");
10
11
  var touch_enabled_1 = require("../common/touch-enabled");
11
12
  var dependency_dom_service_1 = require("../dependencies/dependency-dom.service");
12
13
  var option_changes_service_1 = require("../common/option-changes.service");
13
14
  var timeline_view_service_1 = require("./../timeline/timeline-view.service");
14
15
  var gantt_task_base_1 = require("./gantt-task-base");
16
+ var utils_1 = require("../utils");
15
17
  /**
16
18
  * @hidden
17
19
  */
18
20
  var GanttSummaryTaskComponent = /** @class */ (function (_super) {
19
21
  tslib_1.__extends(GanttSummaryTaskComponent, _super);
20
- function GanttSummaryTaskComponent(touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) {
21
- var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr) || this;
22
+ function GanttSummaryTaskComponent(touchEnabled, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) {
23
+ var _this = _super.call(this, mapper, timelineViewService, dependencyDomService, optionChangesService, cdr, navigationService) || this;
22
24
  _this.touchEnabled = touchEnabled;
23
25
  _this.summaryWrapperClass = true;
24
26
  return _this;
25
27
  }
26
28
  GanttSummaryTaskComponent_1 = GanttSummaryTaskComponent;
29
+ Object.defineProperty(GanttSummaryTaskComponent.prototype, "ariaExpanded", {
30
+ get: function () {
31
+ // if no callback is provided, all child items are displayed and the item is regarded as expanded
32
+ // replicates the TreeList aria-expanded behavior
33
+ var isExpanded = !utils_1.isPresent(this.isExpanded) || this.isExpanded(this.dataItem);
34
+ return String(isExpanded);
35
+ },
36
+ enumerable: true,
37
+ configurable: true
38
+ });
27
39
  var GanttSummaryTaskComponent_1;
28
40
  tslib_1.__decorate([
29
41
  core_1.HostBinding('class.k-summary-wrap'),
@@ -33,6 +45,10 @@ var GanttSummaryTaskComponent = /** @class */ (function (_super) {
33
45
  core_1.Input(),
34
46
  tslib_1.__metadata("design:type", core_1.TemplateRef)
35
47
  ], GanttSummaryTaskComponent.prototype, "template", void 0);
48
+ tslib_1.__decorate([
49
+ core_1.Input(),
50
+ tslib_1.__metadata("design:type", Function)
51
+ ], GanttSummaryTaskComponent.prototype, "isExpanded", void 0);
36
52
  GanttSummaryTaskComponent = GanttSummaryTaskComponent_1 = tslib_1.__decorate([
37
53
  core_1.Component({
38
54
  selector: 'kendo-gantt-summary-task',
@@ -42,14 +58,16 @@ var GanttSummaryTaskComponent = /** @class */ (function (_super) {
42
58
  useExisting: core_1.forwardRef(function () { return GanttSummaryTaskComponent_1; })
43
59
  }
44
60
  ],
45
- template: "\n <div\n #task\n class=\"k-task k-task-summary\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.width.px]=\"taskWidth\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n >\n <div *ngIf=\"!template; else summaryTemplate\"\n class=\"k-task-summary-progress\"\n [style.width.px]=\"taskWidth\">\n <div\n class=\"k-task-summary-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n >\n </div>\n </div>\n <ng-template\n #summaryTemplate\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{\n $implicit: dataItem,\n elementWidth: taskWidth\n }\"\n >\n </ng-template>\n </div>\n <ng-container *ngIf=\"renderDependencyDragClues\">\n <div\n class=\"k-task-dot k-task-start k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n <div\n class=\"k-task-dot k-task-end k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n </ng-container>\n "
61
+ template: "\n <div\n #task\n role=\"treeitem\"\n class=\"k-task k-task-summary\"\n [ngClass]=\"taskClass(dataItem)\"\n [style.width.px]=\"taskWidth\"\n [attr.title]=\"mapper.extractFromTask(dataItem, 'title')\"\n [class.k-state-selected]=\"isSelected(dataItem)\"\n [attr.aria-selected]=\"ariaSelected\"\n [attr.aria-expanded]=\"ariaExpanded\"\n [attr.aria-level]=\"level + 1\"\n >\n <div *ngIf=\"!template; else summaryTemplate\"\n class=\"k-task-summary-progress\"\n [style.width.px]=\"taskWidth\">\n <div\n class=\"k-task-summary-complete\"\n [style.width.px]=\"completionOverlayWidth\"\n >\n </div>\n </div>\n <ng-template\n #summaryTemplate\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{\n $implicit: dataItem,\n elementWidth: taskWidth\n }\"\n >\n </ng-template>\n </div>\n <ng-container *ngIf=\"renderDependencyDragClues\">\n <div\n class=\"k-task-dot k-task-start k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n <div\n class=\"k-task-dot k-task-end k-touch-action-none\"\n [class.k-display-block]=\"touchEnabled\"\n >\n </div>\n </ng-container>\n ",
62
+ styles: ["\n .k-task.k-focus {\n box-shadow: 0 0 4px 3px grey;\n outline: none;\n }\n .k-task.k-focus.k-state-selected {\n box-shadow: 0 0 4px 3px #ffaea8;\n }\n "]
46
63
  }),
47
64
  tslib_1.__param(0, core_1.Inject(touch_enabled_1.TOUCH_ENABLED)),
48
65
  tslib_1.__metadata("design:paramtypes", [Boolean, mapping_service_1.MappingService,
49
66
  timeline_view_service_1.TimelineViewService,
50
67
  dependency_dom_service_1.DependencyDomService,
51
68
  option_changes_service_1.OptionChangesService,
52
- core_1.ChangeDetectorRef])
69
+ core_1.ChangeDetectorRef,
70
+ navigation_service_1.NavigationService])
53
71
  ], GanttSummaryTaskComponent);
54
72
  return GanttSummaryTaskComponent;
55
73
  }(gantt_task_base_1.GanttTaskBase));