source: trip-planner-front/node_modules/@angular/material/tabs/paginated-tab-header.d.ts@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 9.1 KB
RevLine 
[6a3a178]1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { ChangeDetectorRef, ElementRef, NgZone, QueryList, EventEmitter, AfterContentChecked, AfterContentInit, AfterViewInit, OnDestroy } from '@angular/core';
9import { Direction, Directionality } from '@angular/cdk/bidi';
10import { NumberInput } from '@angular/cdk/coercion';
11import { ViewportRuler } from '@angular/cdk/scrolling';
12import { FocusableOption } from '@angular/cdk/a11y';
13import { Subject } from 'rxjs';
14import { Platform } from '@angular/cdk/platform';
15/**
16 * The directions that scrolling can go in when the header's tabs exceed the header width. 'After'
17 * will scroll the header towards the end of the tabs list and 'before' will scroll towards the
18 * beginning of the list.
19 */
20import * as ɵngcc0 from '@angular/core';
21export declare type ScrollDirection = 'after' | 'before';
22/** Item inside a paginated tab header. */
23export declare type MatPaginatedTabHeaderItem = FocusableOption & {
24 elementRef: ElementRef;
25};
26/**
27 * Base class for a tab header that supported pagination.
28 * @docs-private
29 */
30export declare abstract class MatPaginatedTabHeader implements AfterContentChecked, AfterContentInit, AfterViewInit, OnDestroy {
31 protected _elementRef: ElementRef<HTMLElement>;
32 protected _changeDetectorRef: ChangeDetectorRef;
33 private _viewportRuler;
34 private _dir;
35 private _ngZone;
36 private _platform;
37 _animationMode?: string | undefined;
38 abstract _items: QueryList<MatPaginatedTabHeaderItem>;
39 abstract _inkBar: {
40 hide: () => void;
41 alignToElement: (element: HTMLElement) => void;
42 };
43 abstract _tabListContainer: ElementRef<HTMLElement>;
44 abstract _tabList: ElementRef<HTMLElement>;
45 abstract _nextPaginator: ElementRef<HTMLElement>;
46 abstract _previousPaginator: ElementRef<HTMLElement>;
47 /** The distance in pixels that the tab labels should be translated to the left. */
48 private _scrollDistance;
49 /** Whether the header should scroll to the selected index after the view has been checked. */
50 private _selectedIndexChanged;
51 /** Emits when the component is destroyed. */
52 protected readonly _destroyed: Subject<void>;
53 /** Whether the controls for pagination should be displayed */
54 _showPaginationControls: boolean;
55 /** Whether the tab list can be scrolled more towards the end of the tab label list. */
56 _disableScrollAfter: boolean;
57 /** Whether the tab list can be scrolled more towards the beginning of the tab label list. */
58 _disableScrollBefore: boolean;
59 /**
60 * The number of tab labels that are displayed on the header. When this changes, the header
61 * should re-evaluate the scroll position.
62 */
63 private _tabLabelCount;
64 /** Whether the scroll distance has changed and should be applied after the view is checked. */
65 private _scrollDistanceChanged;
66 /** Used to manage focus between the tabs. */
67 private _keyManager;
68 /** Cached text content of the header. */
69 private _currentTextContent;
70 /** Stream that will stop the automated scrolling. */
71 private _stopScrolling;
72 /**
73 * Whether pagination should be disabled. This can be used to avoid unnecessary
74 * layout recalculations if it's known that pagination won't be required.
75 */
76 disablePagination: boolean;
77 /** The index of the active tab. */
78 get selectedIndex(): number;
79 set selectedIndex(value: number);
80 private _selectedIndex;
81 /** Event emitted when the option is selected. */
82 readonly selectFocusedIndex: EventEmitter<number>;
83 /** Event emitted when a label is focused. */
84 readonly indexFocused: EventEmitter<number>;
85 constructor(_elementRef: ElementRef<HTMLElement>, _changeDetectorRef: ChangeDetectorRef, _viewportRuler: ViewportRuler, _dir: Directionality, _ngZone: NgZone, _platform: Platform, _animationMode?: string | undefined);
86 /** Called when the user has selected an item via the keyboard. */
87 protected abstract _itemSelected(event: KeyboardEvent): void;
88 ngAfterViewInit(): void;
89 ngAfterContentInit(): void;
90 ngAfterContentChecked(): void;
91 ngOnDestroy(): void;
92 /** Handles keyboard events on the header. */
93 _handleKeydown(event: KeyboardEvent): void;
94 /**
95 * Callback for when the MutationObserver detects that the content has changed.
96 */
97 _onContentChanges(): void;
98 /**
99 * Updates the view whether pagination should be enabled or not.
100 *
101 * WARNING: Calling this method can be very costly in terms of performance. It should be called
102 * as infrequently as possible from outside of the Tabs component as it causes a reflow of the
103 * page.
104 */
105 updatePagination(): void;
106 /** Tracks which element has focus; used for keyboard navigation */
107 get focusIndex(): number;
108 /** When the focus index is set, we must manually send focus to the correct label */
109 set focusIndex(value: number);
110 /**
111 * Determines if an index is valid. If the tabs are not ready yet, we assume that the user is
112 * providing a valid index and return true.
113 */
114 _isValidIndex(index: number): boolean;
115 /**
116 * Sets focus on the HTML element for the label wrapper and scrolls it into the view if
117 * scrolling is enabled.
118 */
119 _setTabFocus(tabIndex: number): void;
120 /** The layout direction of the containing app. */
121 _getLayoutDirection(): Direction;
122 /** Performs the CSS transformation on the tab list that will cause the list to scroll. */
123 _updateTabScrollPosition(): void;
124 /** Sets the distance in pixels that the tab header should be transformed in the X-axis. */
125 get scrollDistance(): number;
126 set scrollDistance(value: number);
127 /**
128 * Moves the tab list in the 'before' or 'after' direction (towards the beginning of the list or
129 * the end of the list, respectively). The distance to scroll is computed to be a third of the
130 * length of the tab list view window.
131 *
132 * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
133 * should be called sparingly.
134 */
135 _scrollHeader(direction: ScrollDirection): {
136 maxScrollDistance: number;
137 distance: number;
138 };
139 /** Handles click events on the pagination arrows. */
140 _handlePaginatorClick(direction: ScrollDirection): void;
141 /**
142 * Moves the tab list such that the desired tab label (marked by index) is moved into view.
143 *
144 * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
145 * should be called sparingly.
146 */
147 _scrollToLabel(labelIndex: number): void;
148 /**
149 * Evaluate whether the pagination controls should be displayed. If the scroll width of the
150 * tab list is wider than the size of the header container, then the pagination controls should
151 * be shown.
152 *
153 * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
154 * should be called sparingly.
155 */
156 _checkPaginationEnabled(): void;
157 /**
158 * Evaluate whether the before and after controls should be enabled or disabled.
159 * If the header is at the beginning of the list (scroll distance is equal to 0) then disable the
160 * before button. If the header is at the end of the list (scroll distance is equal to the
161 * maximum distance we can scroll), then disable the after button.
162 *
163 * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
164 * should be called sparingly.
165 */
166 _checkScrollingControls(): void;
167 /**
168 * Determines what is the maximum length in pixels that can be set for the scroll distance. This
169 * is equal to the difference in width between the tab list container and tab header container.
170 *
171 * This is an expensive call that forces a layout reflow to compute box and scroll metrics and
172 * should be called sparingly.
173 */
174 _getMaxScrollDistance(): number;
175 /** Tells the ink-bar to align itself to the current label wrapper */
176 _alignInkBarToSelectedTab(): void;
177 /** Stops the currently-running paginator interval. */
178 _stopInterval(): void;
179 /**
180 * Handles the user pressing down on one of the paginators.
181 * Starts scrolling the header after a certain amount of time.
182 * @param direction In which direction the paginator should be scrolled.
183 */
184 _handlePaginatorPress(direction: ScrollDirection, mouseEvent?: MouseEvent): void;
185 /**
186 * Scrolls the header to a given position.
187 * @param position Position to which to scroll.
188 * @returns Information on the current scroll distance and the maximum.
189 */
190 private _scrollTo;
191 static ngAcceptInputType_selectedIndex: NumberInput;
192 static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatPaginatedTabHeader, [null, null, null, { optional: true; }, null, null, { optional: true; }]>;
193 static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatPaginatedTabHeader, never, never, { "disablePagination": "disablePagination"; }, {}, never>;
194}
195
196//# sourceMappingURL=paginated-tab-header.d.ts.map
Note: See TracBrowser for help on using the repository browser.