@@ -93,8 +93,39 @@ export interface TreeKeyManagerOptions<T extends TreeKeyManagerItem> {
9393export class TreeKeyManager < T extends TreeKeyManagerItem > {
9494 private _activeItemIndex = - 1 ;
9595 private _activeItem : T | null = null ;
96+ private _activationFollowsFocus = false ;
97+ private _horizontal : 'ltr' | 'rtl' = 'ltr' ;
98+
99+ /**
100+ * Predicate function that can be used to check whether an item should be skipped
101+ * by the key manager. By default, disabled items are skipped.
102+ */
103+ private _skipPredicateFn = ( item : T ) => ! ! item . isDisabled ?.( ) ;
104+
105+ /** Function to determine equivalent items. */
106+ private _trackByFn : ( item : T ) => unknown = ( item : T ) => item ;
107+
108+ constructor ( {
109+ items,
110+ skipPredicate,
111+ trackBy,
112+ horizontalOrientation,
113+ activationFollowsFocus,
114+ typeAheadDebounceInterval,
115+ } : TreeKeyManagerOptions < T > ) {
116+ if ( typeof skipPredicate !== 'undefined' ) {
117+ this . _skipPredicateFn = skipPredicate ;
118+ }
119+ if ( typeof trackBy !== 'undefined' ) {
120+ this . _trackByFn = trackBy ;
121+ }
122+ if ( typeof horizontalOrientation !== 'undefined' ) {
123+ this . _horizontal = horizontalOrientation ;
124+ }
125+ if ( typeof activationFollowsFocus !== 'undefined' ) {
126+ this . _activationFollowsFocus = activationFollowsFocus ;
127+ }
96128
97- constructor ( { items} : TreeKeyManagerOptions < T > ) {
98129 // We allow for the items to be an array or Observable because, in some cases, the consumer may
99130 // not have access to a QueryList of the items they want to manage (e.g. when the
100131 // items aren't being collected via `ViewChildren` or `ContentChildren`).
0 commit comments