@angular/cdk
Version:
Angular Material Component Development Kit
1 lines • 22.2 kB
Source Map (JSON)
{"version":3,"file":"_tree-key-manager-chunk.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/src/cdk/a11y/key-manager/tree-key-manager.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {InjectionToken, QueryList} from '@angular/core';\nimport {coerceObservable} from '../../coercion/private';\nimport {Observable, Subject, Subscription, isObservable, of as observableOf} from 'rxjs';\nimport {take} from 'rxjs/operators';\nimport {\n TreeKeyManagerFactory,\n TreeKeyManagerItem,\n TreeKeyManagerOptions,\n TreeKeyManagerStrategy,\n} from './tree-key-manager-strategy';\nimport {Typeahead} from './typeahead';\n\n/**\n * This class manages keyboard events for trees. If you pass it a QueryList or other list of tree\n * items, it will set the active item, focus, handle expansion and typeahead correctly when\n * keyboard events occur.\n */\nexport class TreeKeyManager<T extends TreeKeyManagerItem> implements TreeKeyManagerStrategy<T> {\n /** The index of the currently active (focused) item. */\n private _activeItemIndex = -1;\n /** The currently active (focused) item. */\n private _activeItem: T | null = null;\n /** Whether or not we activate the item when it's focused. */\n private _shouldActivationFollowFocus = false;\n /**\n * The orientation that the tree is laid out in. In `rtl` mode, the behavior of Left and\n * Right arrow are switched.\n */\n private _horizontalOrientation: 'ltr' | 'rtl' = 'ltr';\n\n /**\n * Predicate function that can be used to check whether an item should be skipped\n * by the key manager.\n *\n * The default value for this doesn't skip any elements in order to keep tree items focusable\n * when disabled. This aligns with ARIA guidelines:\n * https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols.\n */\n private _skipPredicateFn = (_item: T) => false;\n\n /** Function to determine equivalent items. */\n private _trackByFn: (item: T) => unknown = (item: T) => item;\n\n /** Synchronous cache of the items to manage. */\n private _items: T[] = [];\n\n private _typeahead?: Typeahead<T>;\n private _typeaheadSubscription = Subscription.EMPTY;\n\n private _hasInitialFocused = false;\n\n private _initializeFocus(): void {\n if (this._hasInitialFocused || this._items.length === 0) {\n return;\n }\n\n let activeIndex = 0;\n for (let i = 0; i < this._items.length; i++) {\n if (!this._skipPredicateFn(this._items[i]) && !this._isItemDisabled(this._items[i])) {\n activeIndex = i;\n break;\n }\n }\n\n const activeItem = this._items[activeIndex];\n\n // Use `makeFocusable` here, because we want the item to just be focusable, not actually\n // capture the focus since the user isn't interacting with it. See #29628.\n if (activeItem.makeFocusable) {\n this._activeItem?.unfocus();\n this._activeItemIndex = activeIndex;\n this._activeItem = activeItem;\n this._typeahead?.setCurrentSelectedItemIndex(activeIndex);\n activeItem.makeFocusable();\n } else {\n // Backwards compatibility for items that don't implement `makeFocusable`.\n this.focusItem(activeIndex);\n }\n\n this._hasInitialFocused = true;\n }\n\n /**\n *\n * @param items List of TreeKeyManager options. Can be synchronous or asynchronous.\n * @param config Optional configuration options. By default, use 'ltr' horizontal orientation. By\n * default, do not skip any nodes. By default, key manager only calls `focus` method when items\n * are focused and does not call `activate`. If `typeaheadDefaultInterval` is `true`, use a\n * default interval of 200ms.\n */\n constructor(items: Observable<T[]> | QueryList<T> | T[], config: TreeKeyManagerOptions<T>) {\n // We allow for the items to be an array or Observable because, in some cases, the consumer may\n // not have access to a QueryList of the items they want to manage (e.g. when the\n // items aren't being collected via `ViewChildren` or `ContentChildren`).\n if (items instanceof QueryList) {\n this._items = items.toArray();\n items.changes.subscribe((newItems: QueryList<T>) => this._itemsChanged(newItems.toArray()));\n } else if (isObservable(items)) {\n items.subscribe(newItems => this._itemsChanged(newItems));\n } else {\n this._items = items;\n this._initializeFocus();\n }\n\n if (typeof config.shouldActivationFollowFocus === 'boolean') {\n this._shouldActivationFollowFocus = config.shouldActivationFollowFocus;\n }\n if (config.horizontalOrientation) {\n this._horizontalOrientation = config.horizontalOrientation;\n }\n if (config.skipPredicate) {\n this._skipPredicateFn = config.skipPredicate;\n }\n if (config.trackBy) {\n this._trackByFn = config.trackBy;\n }\n if (typeof config.typeAheadDebounceInterval !== 'undefined') {\n this._setTypeAhead(config.typeAheadDebounceInterval);\n }\n }\n\n /** Stream that emits any time the focused item changes. */\n readonly change = new Subject<T | null>();\n\n /** Cleans up the key manager. */\n destroy() {\n this._typeaheadSubscription.unsubscribe();\n this._typeahead?.destroy();\n this.change.complete();\n }\n\n /**\n * Handles a keyboard event on the tree.\n * @param event Keyboard event that represents the user interaction with the tree.\n */\n onKeydown(event: KeyboardEvent) {\n const key = event.key;\n\n switch (key) {\n case 'Tab':\n // Return early here, in order to allow Tab to actually tab out of the tree\n return;\n\n case 'ArrowDown':\n this._focusNextItem();\n break;\n\n case 'ArrowUp':\n this._focusPreviousItem();\n break;\n\n case 'ArrowRight':\n this._horizontalOrientation === 'rtl'\n ? this._collapseCurrentItem()\n : this._expandCurrentItem();\n break;\n\n case 'ArrowLeft':\n this._horizontalOrientation === 'rtl'\n ? this._expandCurrentItem()\n : this._collapseCurrentItem();\n break;\n\n case 'Home':\n this._focusFirstItem();\n break;\n\n case 'End':\n this._focusLastItem();\n break;\n\n case 'Enter':\n case ' ':\n this._activateCurrentItem();\n break;\n\n default:\n if (event.key === '*') {\n this._expandAllItemsAtCurrentItemLevel();\n break;\n }\n\n this._typeahead?.handleKey(event);\n // Return here, in order to avoid preventing the default action of non-navigational\n // keys or resetting the buffer of pressed letters.\n return;\n }\n\n // Reset the typeahead since the user has used a navigational key.\n this._typeahead?.reset();\n event.preventDefault();\n }\n\n /** Index of the currently active item. */\n getActiveItemIndex(): number | null {\n return this._activeItemIndex;\n }\n\n /** The currently active item. */\n getActiveItem(): T | null {\n return this._activeItem;\n }\n\n /** Called when the list of items has changed. */\n private _itemsChanged(newItems: T[]) {\n if (this._hasInitialFocused && this._activeItem && !newItems.includes(this._activeItem)) {\n this._activeItem = null;\n this._hasInitialFocused = false;\n }\n\n this._items = newItems;\n this._typeahead?.setItems(this._items);\n this._updateActiveItemIndex(this._items);\n this._initializeFocus();\n }\n\n /** Focus the first available item. */\n private _focusFirstItem(): void {\n this.focusItem(this._findNextAvailableItemIndex(-1));\n }\n\n /** Focus the last available item. */\n private _focusLastItem(): void {\n this.focusItem(this._findPreviousAvailableItemIndex(this._items.length));\n }\n\n /** Focus the next available item. */\n private _focusNextItem(): void {\n this.focusItem(this._findNextAvailableItemIndex(this._activeItemIndex));\n }\n\n /** Focus the previous available item. */\n private _focusPreviousItem(): void {\n this.focusItem(this._findPreviousAvailableItemIndex(this._activeItemIndex));\n }\n\n /**\n * Focus the provided item by index.\n * @param index The index of the item to focus.\n * @param options Additional focusing options.\n */\n focusItem(index: number, options?: {emitChangeEvent?: boolean}): void;\n focusItem(item: T, options?: {emitChangeEvent?: boolean}): void;\n focusItem(itemOrIndex: number | T, options?: {emitChangeEvent?: boolean}): void;\n focusItem(itemOrIndex: number | T, options: {emitChangeEvent?: boolean} = {}) {\n // Set default options\n options.emitChangeEvent ??= true;\n\n let index =\n typeof itemOrIndex === 'number'\n ? itemOrIndex\n : this._items.findIndex(item => this._trackByFn(item) === this._trackByFn(itemOrIndex));\n if (index < 0 || index >= this._items.length) {\n return;\n }\n const activeItem = this._items[index];\n\n // If we're just setting the same item, don't re-call activate or focus\n if (\n this._activeItem !== null &&\n this._trackByFn(activeItem) === this._trackByFn(this._activeItem)\n ) {\n return;\n }\n\n const previousActiveItem = this._activeItem;\n this._activeItem = activeItem ?? null;\n this._activeItemIndex = index;\n this._typeahead?.setCurrentSelectedItemIndex(index);\n\n this._activeItem?.focus();\n previousActiveItem?.unfocus();\n\n if (options.emitChangeEvent) {\n this.change.next(this._activeItem);\n }\n\n if (this._shouldActivationFollowFocus) {\n this._activateCurrentItem();\n }\n }\n\n private _updateActiveItemIndex(newItems: T[]) {\n const activeItem = this._activeItem;\n if (!activeItem) {\n return;\n }\n\n const newIndex = newItems.findIndex(\n item => this._trackByFn(item) === this._trackByFn(activeItem),\n );\n\n if (newIndex > -1 && newIndex !== this._activeItemIndex) {\n this._activeItemIndex = newIndex;\n this._typeahead?.setCurrentSelectedItemIndex(newIndex);\n }\n }\n\n private _setTypeAhead(debounceInterval: number | boolean) {\n this._typeahead = new Typeahead(this._items, {\n debounceInterval: typeof debounceInterval === 'number' ? debounceInterval : undefined,\n skipPredicate: item => this._skipPredicateFn(item),\n });\n\n this._typeaheadSubscription = this._typeahead.selectedItem.subscribe(item => {\n this.focusItem(item);\n });\n }\n\n private _findNextAvailableItemIndex(startingIndex: number) {\n for (let i = startingIndex + 1; i < this._items.length; i++) {\n if (!this._skipPredicateFn(this._items[i])) {\n return i;\n }\n }\n return startingIndex;\n }\n\n private _findPreviousAvailableItemIndex(startingIndex: number) {\n for (let i = startingIndex - 1; i >= 0; i--) {\n if (!this._skipPredicateFn(this._items[i])) {\n return i;\n }\n }\n return startingIndex;\n }\n\n /**\n * If the item is already expanded, we collapse the item. Otherwise, we will focus the parent.\n */\n private _collapseCurrentItem() {\n if (!this._activeItem) {\n return;\n }\n\n if (this._isCurrentItemExpanded()) {\n this._activeItem.collapse();\n } else {\n const parent = this._activeItem.getParent();\n if (!parent || this._skipPredicateFn(parent as T)) {\n return;\n }\n this.focusItem(parent as T);\n }\n }\n\n /**\n * If the item is already collapsed, we expand the item. Otherwise, we will focus the first child.\n */\n private _expandCurrentItem() {\n if (!this._activeItem) {\n return;\n }\n\n if (!this._isCurrentItemExpanded()) {\n this._activeItem.expand();\n } else {\n coerceObservable(this._activeItem.getChildren())\n .pipe(take(1))\n .subscribe(children => {\n const firstChild = children.find(child => !this._skipPredicateFn(child as T));\n if (!firstChild) {\n return;\n }\n this.focusItem(firstChild as T);\n });\n }\n }\n\n private _isCurrentItemExpanded() {\n if (!this._activeItem) {\n return false;\n }\n return typeof this._activeItem.isExpanded === 'boolean'\n ? this._activeItem.isExpanded\n : this._activeItem.isExpanded();\n }\n\n private _isItemDisabled(item: TreeKeyManagerItem) {\n return typeof item.isDisabled === 'boolean' ? item.isDisabled : item.isDisabled?.();\n }\n\n /** For all items that are the same level as the current item, we expand those items. */\n private _expandAllItemsAtCurrentItemLevel() {\n if (!this._activeItem) {\n return;\n }\n\n const parent = this._activeItem.getParent();\n let itemsToExpand;\n if (!parent) {\n itemsToExpand = observableOf(this._items.filter(item => item.getParent() === null));\n } else {\n itemsToExpand = coerceObservable(parent.getChildren());\n }\n\n itemsToExpand.pipe(take(1)).subscribe(items => {\n for (const item of items) {\n item.expand();\n }\n });\n }\n\n private _activateCurrentItem() {\n this._activeItem?.activate();\n }\n}\n\n/** Injection token that determines the key manager to use. */\nexport const TREE_KEY_MANAGER = new InjectionToken<TreeKeyManagerFactory<any>>('tree-key-manager', {\n providedIn: 'root',\n factory: () => (items, options) => new TreeKeyManager(items, options),\n});\n"],"names":["observableOf"],"mappings":";;;;;;MAyBa,cAAc,CAAA;EAEjB,gBAAgB,GAAG,EAAE;AAErB,EAAA,WAAW,GAAa,IAAI;AAE5B,EAAA,4BAA4B,GAAG,KAAK;AAKpC,EAAA,sBAAsB,GAAkB,KAAK;EAU7C,gBAAgB,GAAI,KAAQ,IAAK,KAAK;EAGtC,UAAU,GAA0B,IAAO,IAAK,IAAI;AAGpD,EAAA,MAAM,GAAQ,EAAE;EAEhB,UAAU;EACV,sBAAsB,GAAG,YAAY,CAAC,KAAK;AAE3C,EAAA,kBAAkB,GAAG,KAAK;AAE1B,EAAA,gBAAgB,GAAA;IACtB,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;AACvD,MAAA;AACF,IAAA;IAEA,IAAI,WAAW,GAAG,CAAC;AACnB,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MAC3C,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MA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