UNPKG

@progress/kendo-angular-gantt

Version:
131 lines (130 loc) 5.76 kB
/**----------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the project root for more information *-------------------------------------------------------------------------------------------*/ import { NgZone, OnDestroy, Renderer2 } from '@angular/core'; import { Subject } from 'rxjs'; import { ScrollSyncService } from '../scrolling/scroll-sync.service'; import { TaskActivityStatus } from './navigation-models'; import { NavigationMetadata } from './navigation-models'; import * as i0 from "@angular/core"; /** * @hidden */ export declare class NavigationService implements OnDestroy { private zone; private renderer; private scrollSyncService; /** * Notifies when the tasks' focused and interactive (tabindex) state has changed. * * All tasks are rendered with tabindex="-1". * 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. * All other tasks should get -1 tabindex and have the focus class removed from them. */ readonly taskStatusChanges: Subject<TaskActivityStatus>; /** * Specifies whether navigation is enabled. */ get enabled(): boolean; /** * Used to retrieve read-only data about the currently active task. */ get activeTask(): TaskActivityStatus; /** * Persists the expected Timeline focused task index. * When the cells in the TreeList are navigated through, the expected Timeline focus target should also change, * in order to allow tabbing from the TreeList to the same row in the Timeline. */ set activeTimelineIndex(index: number); get activeTimelineIndex(): number; /** * Persists the expected TreeList focused cell coords. * When the tasks in the Timeline are navigated through, the expected TreeList focus target should also change, * in order to allow back-tabbing from the Timeline to the same row in the TreeList. */ private set activeTreeListCell(value); private get activeTreeListCell(); /** * Keeps track of whether the Timeline part is focused. * Used when the index of the task elements change (tasks are changed, pushed to, spliced from, etc.) * and their status should be updated accordingly. */ private isTimelineFocused; /** * The TreeList row index takes into account the header and filter rows. * Used when translating Timeline task indices to TreeList row indices. */ private get treeListHeaderRowsCount(); /** * Keeps track of which part has last been focused. * Used when calling `gantt.focus()` to determine which part of the component should receive focus. */ private treeListLastActive; /** * Keeps track of which part has last been focused. * Used when calling `gantt.focus()` to determine which part of the component should receive focus. */ private timelineLastActive; private metadata; private _enabled; private _activeTimelineIndex; private _activeTreeListCell; private eventListenerDisposers; constructor(zone: NgZone, renderer: Renderer2, scrollSyncService: ScrollSyncService); initialize(metadata: NavigationMetadata): void; ngOnDestroy(): void; /** * Focuses either the last active TreeList cell, or the last active Timeline task, * dependening on which of the two last held focus. * * Focuses the first TreeList cell by default. */ focusLastActiveItem(): void; /** * Focuses the targeted TreeList cell regardless of the last peresisted target. */ focusCell(rowIndex: number, colIndex: number): void; /** * Focuses the targeted Timeline task regardless of the last peresisted target. */ focusTask(index: number): void; /** * Updates the focus target flags and notifies the active task to update its focused state. */ handleTimelineFocusIn({ target }: FocusEvent): void; /** * Updates the timeline focus state flag and notifies the active task to update its focused state. */ handleTimelineFocusOut({ relatedTarget }: FocusEvent): void; /** * Updates the focus target flags and corrects the TreeList focus target if needed. * As the TreeList will keep its last focused cell with tabindex="0", * this methods forcefully focuses the correct cell, * when navigating in the Timeline has updated the expected TreeList focus target. */ handleTreeListFocusIn(event: FocusEvent): void; updateActiveTimeLineIndex(index: number): void; updateActiveTreeListCell(): void; /** * Fires the `taskStatusChanges` event with active and focused status retrieved from * `this.activeTimelineIndex` and `this.isTimelineFocused`. */ notifyTaskStatusChange(): void; /** * Scrolls horizontally to the beginning of the target task if the beginning of its content is not in the viewport. */ scrollHorizontallyToTask(): void; /** * Filters for task mousedown in the Timeline. */ private handleTimelineMousedown; /** * Focus the TreeList on TreeList mousedown. * A nasty hack to trick `handleTreeListFocusIn` into regarding the previous focus target as again the TreeList. * Otherwise cell clicks are wrongly overwritten in `handleTreeListFocusIn` and the click focus target is not respected. */ private focusTreeList; static ɵfac: i0.ɵɵFactoryDeclaration<NavigationService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<NavigationService>; }