@ux-aspects/ux-aspects
Version:
Open source user interface framework for building modern, responsive, mobile big data applications
65 lines (64 loc) • 3.42 kB
TypeScript
import { FocusKeyManager, FocusOrigin } from '@angular/cdk/a11y';
import { OnDestroy, QueryList } from '@angular/core';
import { Subject } from 'rxjs';
import { TabbableListItemDirective } from './tabbable-list-item.directive';
import * as i0 from "@angular/core";
export declare class TabbableListService implements OnDestroy {
/** Indicate is this is being using on a hierarchichal set of items */
hierarchy: boolean;
/** Determine if we all the alt key */
allowAltModifier: boolean;
/** Determine if we all the ctrl key */
allowCtrlModifier: boolean;
/** Determine if we allow the Home/End keys */
allowBoundaryKeys: boolean;
/** Determine if we should scroll the item into view on focus */
shouldScrollInView: boolean;
/** Store the instance of the focus key manager */
focusKeyManager: FocusKeyManager<TabbableListItemDirective>;
/** Indicate if we should refocus an item on QueryList change - for use within virtual lists */
shouldFocusOnChange: boolean;
/** Store the container element */
containerRef: HTMLElement;
/** Emit whenever focus does not change but tabindexes have */
onTabIndexChange: Subject<void>;
/** Determine if focus is currently within the tabbable list */
isFocused: boolean;
/** Store the list of tabbable items */
private _items;
/** Store the direction of the list */
private _direction;
/** Unsubscribe from all observables on destroy */
private readonly _onDestroy;
ngOnDestroy(): void;
initialize(items: QueryList<TabbableListItemDirective>, direction: 'horizontal' | 'vertical', wrap: boolean): void;
/** Give and item focus or just make it the current tabbable item */
activate(item: TabbableListItemDirective, updateIndexOnly?: boolean): void;
/** Give and item focus or just make it the current tabbable item */
activateItemAtIndex(index: number, updateIndexOnly?: boolean): void;
isItemActive(item: TabbableListItemDirective): boolean;
setFirstItemTabbable(): void;
isAnyItemTabbable(): boolean;
ensureTabbableItem(): void;
focusTabbableItem(): void;
onKeydown(source: TabbableListItemDirective, event: KeyboardEvent): void;
sortItemsByHierarchy(list: QueryList<TabbableListItemDirective>): TabbableListItemDirective[];
/**
* In a uxVirtualFor list cells can be resused. This means that when we scroll
* the data associated with a given element may change and not the actual elements. If only the data changes
* then the QueryList will not emit a change so we may show focus indicatator on the element that previously displayed
* the correct data but no longer does.
*
* We need to handle this correctly here. We already have keys implements to handle virtual elements so we can check
* if a key changes and use it to update the focused item even if the QueryList doesn't inform us that we have changed.
*/
itemReferenceChange(previousKey: unknown, origin: FocusOrigin): void;
/** Update the active item without causing focus */
updateActiveItemIndex(index: number): void;
/** Determine if there is an item with a tabindex of 0 */
hasTabbableItem(): boolean;
private getItemByKey;
private flattenHierarchy;
static ɵfac: i0.ɵɵFactoryDeclaration<TabbableListService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<TabbableListService>;
}