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 ,
@@ -137,8 +127,6 @@ export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit,
137
127
. pipe ( takeUntil ( this . _onDestroy ) )
138
128
. subscribe ( ( ) => this . _alignInkBar ( ) ) ;
139
129
} ) ;
140
-
141
- this . _setLinkDisableRipple ( ) ;
142
130
}
143
131
144
132
/** Checks if the active link has been changed and, if so, will update the ink bar. */
@@ -166,13 +154,6 @@ export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit,
166
154
this . _inkBar . hide ( ) ;
167
155
}
168
156
}
169
-
170
- /** Sets the `disableRipple` property on each link of the navigation bar. */
171
- private _setLinkDisableRipple ( ) {
172
- if ( this . _tabLinks ) {
173
- this . _tabLinks . forEach ( link => link . disableRipple = this . disableRipple ) ;
174
- }
175
- }
176
157
}
177
158
178
159
@@ -227,7 +208,7 @@ export class MatTabLink extends _MatTabLinkMixinBase
227
208
* @docs -private
228
209
*/
229
210
get rippleDisabled ( ) : boolean {
230
- return this . disabled || this . disableRipple ;
211
+ return this . disabled || this . disableRipple || this . _tabNavBar . disableRipple ;
231
212
}
232
213
233
214
constructor ( private _tabNavBar : MatTabNav ,
0 commit comments