6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
import { Directionality } from '@angular/cdk/bidi' ;
9
- import { coerceBooleanProperty } from '@angular/cdk/coercion' ;
10
9
import { Platform } from '@angular/cdk/platform' ;
11
10
import { ViewportRuler } from '@angular/cdk/scrolling' ;
12
11
import {
@@ -53,7 +52,7 @@ import {MatInkBar} from '../ink-bar';
53
52
export class MatTabNavBase {
54
53
constructor ( public _elementRef : ElementRef ) { }
55
54
}
56
- export const _MatTabNavMixinBase = mixinColor ( MatTabNavBase , 'primary' ) ;
55
+ export const _MatTabNavMixinBase = mixinDisableRipple ( mixinColor ( MatTabNavBase , 'primary' ) ) ;
57
56
58
57
/**
59
58
* Navigation component matching the styles of the tab group header.
@@ -63,15 +62,15 @@ export const _MatTabNavMixinBase = mixinColor(MatTabNavBase, 'primary');
63
62
moduleId : module . id ,
64
63
selector : '[mat-tab-nav-bar]' ,
65
64
exportAs : 'matTabNavBar, matTabNav' ,
66
- inputs : [ 'color' ] ,
65
+ inputs : [ 'color' , 'disableRipple' ] ,
67
66
templateUrl : 'tab-nav-bar.html' ,
68
67
styleUrls : [ 'tab-nav-bar.css' ] ,
69
68
host : { 'class' : 'mat-tab-nav-bar' } ,
70
69
encapsulation : ViewEncapsulation . None ,
71
70
changeDetection : ChangeDetectionStrategy . OnPush ,
72
71
} )
73
72
export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit , CanColor ,
74
- OnDestroy {
73
+ CanDisableRipple , OnDestroy {
75
74
76
75
/** Subject that emits when the component has been destroyed. */
77
76
private readonly _onDestroy = new Subject < void > ( ) ;
@@ -101,15 +100,6 @@ export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit,
101
100
}
102
101
private _backgroundColor : ThemePalette ;
103
102
104
- /** Whether ripples should be disabled for all links or not. */
105
- @Input ( )
106
- get disableRipple ( ) { return this . _disableRipple ; }
107
- set disableRipple ( value : boolean ) {
108
- this . _disableRipple = coerceBooleanProperty ( value ) ;
109
- this . _setLinkDisableRipple ( ) ;
110
- }
111
- private _disableRipple : boolean = false ;
112
-
113
103
constructor ( elementRef : ElementRef ,
114
104
@Optional ( ) private _dir : Directionality ,
115
105
private _ngZone : NgZone ,
@@ -136,8 +126,6 @@ export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit,
136
126
. pipe ( takeUntil ( this . _onDestroy ) )
137
127
. subscribe ( ( ) => this . _alignInkBar ( ) ) ;
138
128
} ) ;
139
-
140
- this . _setLinkDisableRipple ( ) ;
141
129
}
142
130
143
131
/** Checks if the active link has been changed and, if so, will update the ink bar. */
@@ -165,13 +153,6 @@ export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit,
165
153
this . _inkBar . hide ( ) ;
166
154
}
167
155
}
168
-
169
- /** Sets the `disableRipple` property on each link of the navigation bar. */
170
- private _setLinkDisableRipple ( ) {
171
- if ( this . _tabLinks ) {
172
- this . _tabLinks . forEach ( link => link . disableRipple = this . disableRipple ) ;
173
- }
174
- }
175
156
}
176
157
177
158
@@ -226,7 +207,7 @@ export class MatTabLink extends _MatTabLinkMixinBase
226
207
* @docs -private
227
208
*/
228
209
get rippleDisabled ( ) : boolean {
229
- return this . disabled || this . disableRipple ;
210
+ return this . disabled || this . disableRipple || this . _tabNavBar . disableRipple ;
230
211
}
231
212
232
213
constructor ( private _tabNavBar : MatTabNav ,
0 commit comments