5
5
* Use of this source code is governed by an MIT-style license that can be
6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
-
9
8
import {
10
9
AfterContentInit ,
11
10
Component ,
@@ -21,7 +20,13 @@ import {
21
20
EventEmitter ,
22
21
Output ,
23
22
} from '@angular/core' ;
24
- import { MatOption , MatOptgroup } from '@angular/material/core' ;
23
+ import {
24
+ MatOption ,
25
+ MatOptgroup ,
26
+ MAT_OPTION_PARENT_COMPONENT ,
27
+ mixinDisableRipple ,
28
+ CanDisableRipple ,
29
+ } from '@angular/material/core' ;
25
30
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y' ;
26
31
27
32
@@ -40,6 +45,11 @@ export class MatAutocompleteSelectedEvent {
40
45
public option : MatOption ) { }
41
46
}
42
47
48
+ // Boilerplate for applying mixins to MatAutocomplete.
49
+ /** @docs -private */
50
+ export class MatAutocompleteBase { }
51
+ export const _MatAutocompleteMixinBase = mixinDisableRipple ( MatAutocompleteBase ) ;
52
+
43
53
44
54
@Component ( {
45
55
moduleId : module . id ,
@@ -50,11 +60,16 @@ export class MatAutocompleteSelectedEvent {
50
60
preserveWhitespaces : false ,
51
61
changeDetection : ChangeDetectionStrategy . OnPush ,
52
62
exportAs : 'matAutocomplete' ,
63
+ inputs : [ 'disableRipple' ] ,
53
64
host : {
54
65
'class' : 'mat-autocomplete'
55
- }
66
+ } ,
67
+ providers : [
68
+ { provide : MAT_OPTION_PARENT_COMPONENT , useExisting : MatAutocomplete }
69
+ ]
56
70
} )
57
- export class MatAutocomplete implements AfterContentInit {
71
+ export class MatAutocomplete extends _MatAutocompleteMixinBase implements AfterContentInit ,
72
+ CanDisableRipple {
58
73
59
74
/** Manages active item in option list based on key events. */
60
75
_keyManager : ActiveDescendantKeyManager < MatOption > ;
@@ -103,7 +118,9 @@ export class MatAutocomplete implements AfterContentInit {
103
118
/** Unique ID to be used by autocomplete trigger's "aria-owns" property. */
104
119
id : string = `mat-autocomplete-${ _uniqueAutocompleteIdCounter ++ } ` ;
105
120
106
- constructor ( private _changeDetectorRef : ChangeDetectorRef , private _elementRef : ElementRef ) { }
121
+ constructor ( private _changeDetectorRef : ChangeDetectorRef , private _elementRef : ElementRef ) {
122
+ super ( ) ;
123
+ }
107
124
108
125
ngAfterContentInit ( ) {
109
126
this . _keyManager = new ActiveDescendantKeyManager < MatOption > ( this . options ) . withWrap ( ) ;
0 commit comments