feat(tabs): add automatic scrolling when holding down paginator (#14632)

Adds some code that automatically keeps scrolling the tab header while holding down one of the paginator buttons. This is useful on long lists of tabs where the user might have to click a lot to reach the tab that they want.

Fixes #6510.
This commit is contained in:
Kristiyan Kostadinov
2019-01-23 20:42:07 +01:00
committed by Andrew Seguin
parent a4d943cfbb
commit e66131744a
5 changed files with 337 additions and 18 deletions
+11 -2
View File
@@ -109,11 +109,13 @@ export declare class MatTabGroupBase {
constructor(_elementRef: ElementRef);
}
export declare class MatTabHeader extends _MatTabHeaderMixinBase implements AfterContentChecked, AfterContentInit, OnDestroy, CanDisableRipple {
export declare class MatTabHeader extends _MatTabHeaderMixinBase implements AfterContentChecked, AfterContentInit, AfterViewInit, OnDestroy, CanDisableRipple {
_disableScrollAfter: boolean;
_disableScrollBefore: boolean;
_inkBar: MatInkBar;
_labelWrappers: QueryList<MatTabLabelWrapper>;
_nextPaginator: ElementRef<HTMLElement>;
_previousPaginator: ElementRef<HTMLElement>;
_showPaginationControls: boolean;
_tabList: ElementRef;
_tabListContainer: ElementRef;
@@ -129,14 +131,21 @@ export declare class MatTabHeader extends _MatTabHeaderMixinBase implements Afte
_getLayoutDirection(): Direction;
_getMaxScrollDistance(): number;
_handleKeydown(event: KeyboardEvent): void;
_handlePaginatorClick(direction: ScrollDirection): void;
_handlePaginatorPress(direction: ScrollDirection): void;
_isValidIndex(index: number): boolean;
_onContentChanges(): void;
_scrollHeader(scrollDir: ScrollDirection): void;
_scrollHeader(direction: ScrollDirection): {
maxScrollDistance: number;
distance: number;
};
_scrollToLabel(labelIndex: number): void;
_setTabFocus(tabIndex: number): void;
_stopInterval(): void;
_updateTabScrollPosition(): void;
ngAfterContentChecked(): void;
ngAfterContentInit(): void;
ngAfterViewInit(): void;
ngOnDestroy(): void;
updatePagination(): void;
}