-
Notifications
You must be signed in to change notification settings - Fork 6.7k
/
option.ts
62 lines (60 loc) · 1.83 KB
/
option.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ElementRef,
Inject,
Optional,
ViewEncapsulation,
} from '@angular/core';
import {
MAT_OPTION_PARENT_COMPONENT,
_MatOptionBase,
MatOptionParentComponent,
MAT_OPTGROUP,
} from '@angular/material/core';
import {MatLegacyOptgroup} from './optgroup';
/**
* Single option inside of a `<mat-select>` element.
* @deprecated Use `MatOption` from `@angular/material/core` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-option',
exportAs: 'matOption',
host: {
'role': 'option',
'[attr.tabindex]': '_getTabIndex()',
'[class.mat-selected]': 'selected',
'[class.mat-option-multiple]': 'multiple',
'[class.mat-active]': 'active',
'[id]': 'id',
'[attr.aria-selected]': '_getAriaSelected()',
'[attr.aria-disabled]': 'disabled.toString()',
'[class.mat-option-disabled]': 'disabled',
'(click)': '_selectViaInteraction()',
'(keydown)': '_handleKeydown($event)',
'class': 'mat-option mat-focus-indicator',
},
styleUrls: ['option.css'],
templateUrl: 'option.html',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MatLegacyOption<T = any> extends _MatOptionBase<T> {
constructor(
element: ElementRef<HTMLElement>,
changeDetectorRef: ChangeDetectorRef,
@Optional() @Inject(MAT_OPTION_PARENT_COMPONENT) parent: MatOptionParentComponent,
@Optional() @Inject(MAT_OPTGROUP) group: MatLegacyOptgroup,
) {
super(element, changeDetectorRef, parent, group);
}
}