* * @param items List of TreeKeyManager options. Can be synchronous or asynchronous. * @param config Optional configuration options. By default, use 'ltr' horizontal orientation. By * default, do not skip any nodes. By default, key manager only calls `focus` method when items * are focus
(items: Observable<T[]> | QueryList<T> | T[], config: TreeKeyManagerOptions<T>)
| 97 | * default interval of 200ms. |
| 98 | */ |
| 99 | constructor(items: Observable<T[]> | QueryList<T> | T[], config: TreeKeyManagerOptions<T>) { |
| 100 | // We allow for the items to be an array or Observable because, in some cases, the consumer may |
| 101 | // not have access to a QueryList of the items they want to manage (e.g. when the |
| 102 | // items aren't being collected via `ViewChildren` or `ContentChildren`). |
| 103 | if (items instanceof QueryList) { |
| 104 | this._items = items.toArray(); |
| 105 | items.changes.subscribe((newItems: QueryList<T>) => this._itemsChanged(newItems.toArray())); |
| 106 | } else if (isObservable(items)) { |
| 107 | items.subscribe(newItems => this._itemsChanged(newItems)); |
| 108 | } else { |
| 109 | this._items = items; |
| 110 | this._initializeFocus(); |
| 111 | } |
| 112 | |
| 113 | if (typeof config.shouldActivationFollowFocus === 'boolean') { |
| 114 | this._shouldActivationFollowFocus = config.shouldActivationFollowFocus; |
| 115 | } |
| 116 | if (config.horizontalOrientation) { |
| 117 | this._horizontalOrientation = config.horizontalOrientation; |
| 118 | } |
| 119 | if (config.skipPredicate) { |
| 120 | this._skipPredicateFn = config.skipPredicate; |
| 121 | } |
| 122 | if (config.trackBy) { |
| 123 | this._trackByFn = config.trackBy; |
| 124 | } |
| 125 | if (typeof config.typeAheadDebounceInterval !== 'undefined') { |
| 126 | this._setTypeAhead(config.typeAheadDebounceInterval); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | /** Stream that emits any time the focused item changes. */ |
| 131 | readonly change = new Subject<T | null>(); |
nothing calls this directly
no test coverage detected