Last change
on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
3.8 KB
|
Line | |
---|
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 } from './list-key-manager';
|
---|
9 | export class FocusKeyManager extends ListKeyManager {
|
---|
10 | constructor() {
|
---|
11 | super(...arguments);
|
---|
12 | this._origin = 'program';
|
---|
13 | }
|
---|
14 | /**
|
---|
15 | * Sets the focus origin that will be passed in to the items for any subsequent `focus` calls.
|
---|
16 | * @param origin Focus origin to be used when focusing items.
|
---|
17 | */
|
---|
18 | setFocusOrigin(origin) {
|
---|
19 | this._origin = origin;
|
---|
20 | return this;
|
---|
21 | }
|
---|
22 | setActiveItem(item) {
|
---|
23 | super.setActiveItem(item);
|
---|
24 | if (this.activeItem) {
|
---|
25 | this.activeItem.focus(this._origin);
|
---|
26 | }
|
---|
27 | }
|
---|
28 | }
|
---|
29 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9jdXMta2V5LW1hbmFnZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL2ExMXkva2V5LW1hbmFnZXIvZm9jdXMta2V5LW1hbmFnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLGNBQWMsRUFBdUIsTUFBTSxvQkFBb0IsQ0FBQztBQWF4RSxNQUFNLE9BQU8sZUFBbUIsU0FBUSxjQUFtQztJQUEzRTs7UUFDVSxZQUFPLEdBQWdCLFNBQVMsQ0FBQztJQStCM0MsQ0FBQztJQTdCQzs7O09BR0c7SU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