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 {
@@ -55,7 +54,7 @@ import {MatInkBar} from '../ink-bar';
55
54
export class MatTabNavBase {
56
55
constructor ( public _elementRef : ElementRef ) { }
57
56
}
58
- export const _MatTabNavMixinBase = mixinColor ( MatTabNavBase , 'primary' ) ;
57
+ export const _MatTabNavMixinBase = mixinDisableRipple ( mixinColor ( MatTabNavBase , 'primary' ) ) ;
59
58
60
59
/**
61
60
* Navigation component matching the styles of the tab group header.
@@ -65,15 +64,15 @@ export const _MatTabNavMixinBase = mixinColor(MatTabNavBase, 'primary');
65
64
moduleId : module . id ,
66
65
selector : '[mat-tab-nav-bar]' ,
67
66
exportAs : 'matTabNavBar, matTabNav' ,
68
- inputs : [ 'color' ] ,
67
+ inputs : [ 'color' , 'disableRipple' ] ,
69
68
templateUrl : 'tab-nav-bar.html' ,
70
69
styleUrls : [ 'tab-nav-bar.css' ] ,
71
70
host : { 'class' : 'mat-tab-nav-bar' } ,
72
71
encapsulation : ViewEncapsulation . None ,
73
72
changeDetection : ChangeDetectionStrategy . OnPush ,
74
73
} )
75
74
export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit , CanColor ,
76
- OnDestroy {
75
+ CanDisableRipple , OnDestroy {
77
76
78
77
/** Subject that emits when the component has been destroyed. */
79
78
private readonly _onDestroy = new Subject < void > ( ) ;
@@ -103,15 +102,6 @@ export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit,
103
102
}
104
103
private _backgroundColor : ThemePalette ;
105
104
106
- /** Whether ripples should be disabled for all links or not. */
107
- @Input ( )
108
- get disableRipple ( ) { return this . _disableRipple ; }
109
- set disableRipple ( value : boolean ) {
110
- this . _disableRipple = coerceBooleanProperty ( value ) ;
111
- this . _setLinkDisableRipple ( ) ;
112
- }
113
- private _disableRipple : boolean = false ;
114
-
115
105
constructor ( elementRef : ElementRef ,
116
106
@Optional ( ) private _dir : Directionality ,
117
107
private _ngZone : NgZone ,
@@ -137,8 +127,6 @@ export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit,
137
127
return merge ( dirChange , this . _viewportRuler . change ( 10 ) ) . 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. */
@@ -160,13 +148,6 @@ export class MatTabNav extends _MatTabNavMixinBase implements AfterContentInit,
160
148
this . _inkBar . alignToElement ( this . _activeLinkElement . nativeElement ) ;
161
149
}
162
150
}
163
-
164
- /** Sets the `disableRipple` property on each link of the navigation bar. */
165
- private _setLinkDisableRipple ( ) {
166
- if ( this . _tabLinks ) {
167
- this . _tabLinks . forEach ( link => link . disableRipple = this . disableRipple ) ;
168
- }
169
- }
170
151
}
171
152
172
153
@@ -221,7 +202,7 @@ export class MatTabLink extends _MatTabLinkMixinBase
221
202
* @docs -private
222
203
*/
223
204
get rippleDisabled ( ) : boolean {
224
- return this . disabled || this . disableRipple ;
205
+ return this . disabled || this . disableRipple || this . _tabNavBar . disableRipple ;
225
206
}
226
207
227
208
constructor ( private _tabNavBar : MatTabNav ,
0 commit comments