-
Notifications
You must be signed in to change notification settings - Fork 6.7k
/
tab-header.ts
112 lines (104 loc) · 4.02 KB
/
tab-header.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* @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 {Directionality} from '@angular/cdk/bidi';
import {ViewportRuler} from '@angular/cdk/scrolling';
import {
AfterContentChecked,
AfterContentInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
ContentChildren,
ElementRef,
NgZone,
OnDestroy,
Optional,
QueryList,
ViewChild,
ViewEncapsulation,
AfterViewInit,
Input,
Inject,
Directive,
} from '@angular/core';
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
import {coerceBooleanProperty} from '@angular/cdk/coercion';
import {MatInkBar} from './ink-bar';
import {MatTabLabelWrapper} from './tab-label-wrapper';
import {Platform} from '@angular/cdk/platform';
import {MatPaginatedTabHeader} from './paginated-tab-header';
/**
* Base class with all of the `MatTabHeader` functionality.
* @docs-private
*/
@Directive()
// tslint:disable-next-line:class-name
export abstract class _MatTabHeaderBase extends MatPaginatedTabHeader implements
AfterContentChecked, AfterContentInit, AfterViewInit, OnDestroy {
/** Whether the ripple effect is disabled or not. */
@Input()
get disableRipple() { return this._disableRipple; }
set disableRipple(value: any) { this._disableRipple = coerceBooleanProperty(value); }
private _disableRipple: boolean = false;
constructor(elementRef: ElementRef,
changeDetectorRef: ChangeDetectorRef,
viewportRuler: ViewportRuler,
@Optional() dir: Directionality,
ngZone: NgZone,
platform: Platform,
// @breaking-change 9.0.0 `_animationMode` parameter to be made required.
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
super(elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform, animationMode);
}
protected _itemSelected(event: KeyboardEvent) {
event.preventDefault();
}
}
/**
* The header of the tab group which displays a list of all the tabs in the tab group. Includes
* an ink bar that follows the currently selected tab. When the tabs list's width exceeds the
* width of the header container, then arrows will be displayed to allow the user to scroll
* left and right across the header.
* @docs-private
*/
@Component({
moduleId: module.id,
selector: 'mat-tab-header',
templateUrl: 'tab-header.html',
styleUrls: ['tab-header.css'],
inputs: ['selectedIndex'],
outputs: ['selectFocusedIndex', 'indexFocused'],
encapsulation: ViewEncapsulation.None,
// tslint:disable-next-line:validate-decorators
changeDetection: ChangeDetectionStrategy.Default,
host: {
'class': 'mat-tab-header',
'[class.mat-tab-header-pagination-controls-enabled]': '_showPaginationControls',
'[class.mat-tab-header-rtl]': "_getLayoutDirection() == 'rtl'",
},
})
export class MatTabHeader extends _MatTabHeaderBase {
@ContentChildren(MatTabLabelWrapper) _items: QueryList<MatTabLabelWrapper>;
@ViewChild(MatInkBar, {static: true}) _inkBar: MatInkBar;
@ViewChild('tabListContainer', {static: true}) _tabListContainer: ElementRef;
@ViewChild('tabList', {static: true}) _tabList: ElementRef;
@ViewChild('nextPaginator') _nextPaginator: ElementRef<HTMLElement>;
@ViewChild('previousPaginator') _previousPaginator: ElementRef<HTMLElement>;
constructor(elementRef: ElementRef,
changeDetectorRef: ChangeDetectorRef,
viewportRuler: ViewportRuler,
@Optional() dir: Directionality,
ngZone: NgZone,
platform: Platform,
// @breaking-change 9.0.0 `_animationMode` parameter to be made required.
@Optional() @Inject(ANIMATION_MODULE_TYPE) animationMode?: string) {
super(elementRef, changeDetectorRef, viewportRuler, dir, ngZone, platform, animationMode);
}
static ngAcceptInputType_disableRipple: boolean | string;
static ngAcceptInputType_selectedIndex: number | string;
}