1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { ListKeyManager, ListKeyManagerOption } from './list-key-manager';
|
---|
9 | import { FocusOrigin } from '../focus-monitor/focus-monitor';
|
---|
10 | /**
|
---|
11 | * This is the interface for focusable items (used by the FocusKeyManager).
|
---|
12 | * Each item must know how to focus itself, whether or not it is currently disabled
|
---|
13 | * and be able to supply its label.
|
---|
14 | */
|
---|
15 | export interface FocusableOption extends ListKeyManagerOption {
|
---|
16 | /** Focuses the `FocusableOption`. */
|
---|
17 | focus(origin?: FocusOrigin): void;
|
---|
18 | }
|
---|
19 | export declare class FocusKeyManager<T> extends ListKeyManager<FocusableOption & T> {
|
---|
20 | private _origin;
|
---|
21 | /**
|
---|
22 | * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
|
---|
23 | * @param origin Focus origin to be used when focusing items.
|
---|
24 | */
|
---|
25 | setFocusOrigin(origin: FocusOrigin): this;
|
---|
26 | /**
|
---|
27 | * Sets the active item to the item at the specified
|
---|
28 | * index and focuses the newly active item.
|
---|
29 | * @param index Index of the item to be set as active.
|
---|
30 | */
|
---|
31 | setActiveItem(index: number): void;
|
---|
32 | /**
|
---|
33 | * Sets the active item to the item that is specified and focuses it.
|
---|
34 | * @param item Item to be set as active.
|
---|
35 | */
|
---|
36 | setActiveItem(item: T): void;
|
---|
37 | }
|
---|