import { AfterContentChecked, AfterContentInit, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy, QueryList } from '@angular/core'; import { TsStyleThemeTypes } from '@terminus/ui/utilities'; import { TsTabHeaderComponent } from '../header/tab-header.component'; import { TsTabComponent } from '../tab/tab.component'; /** * A change event emitted on focus or selection changes */ export declare class TsTabChangeEvent { index: number; tab: TsTabComponent | null; constructor(index: number, tab: TsTabComponent | null); } /** * Possible horizontal layout alignment choices for header tabs */ export declare type TsTabAlignmentOptions = 'start' | 'center' | 'end' | 'stretch'; /** * Possible positions for the tab header */ export declare type TsTabHeaderPosition = 'above' | 'below'; /** * A collection of {@link TsTabComponent}s * * @example * * * Content 1 * * * * Content 2 * * * * https://getterminus.github.io/ui-demos-release/components/tabs */ export declare class TsTabCollectionComponent implements AfterContentInit, AfterContentChecked, OnDestroy { private changeDetectorRef; /** * A unique ID per instance */ collectionId: number; /** * Internal reference used to enable two-way binding for `selectedIndex` */ private _indexToSelect; /** * Snapshot of the height of the tab body wrapper before another tab is activated */ private tabBodyWrapperHeight; /** * Subscription to changes in the tab labels */ private tabLabelSubscription; /** * Reference for the wrapper around the tabs */ tabBodyWrapper: ElementRef; /** * Reference for the tab header * * NOTE: We are using a template reference rather than class reference because the template needs to reference this also. */ tabHeader: TsTabHeaderComponent; /** * Reference for the collection of tabs */ tabs: QueryList; /** * Define the position of the tab header */ headerPosition: TsTabHeaderPosition; /** * Define the index of the active tab * * @param value - The index to select */ set selectedIndex(value: number | null); get selectedIndex(): number | null; private _selectedIndex; /** * Define the horizontal layout for the tabs */ tabAlignment: TsTabAlignmentOptions; /** * Define the theme for the tabs */ theme: TsStyleThemeTypes; /** * Event emitted when the body animation has completed */ readonly animationFinished: EventEmitter; /** * Event emitted when focus has changed within a tab collection */ readonly focusChange: EventEmitter; /** * Event emitted when the selected index changes. * * NOTE: This is to enable support for two-way binding on `[(selectedIndex)]` */ readonly selectedIndexChange: EventEmitter; /** * Event emitted when the tab selection has changed */ readonly selectedTabChange: EventEmitter; constructor(changeDetectorRef: ChangeDetectorRef); /** * Set up tab and label subscriptions */ ngAfterContentInit(): void; /** * After the content is checked, this component knows what tabs have been defined and what the selected index should be. This is where we * can know exactly what position each tab should be in according to the new selected index, and additionally we know how a new selected * tab should transition in (from the left or right). */ ngAfterContentChecked(): void; /** * Needed for untilComponentDestroyed */ ngOnDestroy(): void; /** * Re-align the ink bar to the selected tab element */ realignInkBar(): void; /** * Emit an event for focus change * * @param index - The focused index */ focusChanged(index: number): void; /** * Set the height of the body wrapper to the height of the activating tab * * @param tabHeight - The desired tab height */ setTabBodyWrapperHeight(tabHeight: number): void; /** * Remove the height of the tab body wrapper */ removeTabBodyWrapperHeight(): void; /** * Handle click events & set a new selected index if appropriate * * @param tab - The tab that was clicked * @param tabHeader - The header of the tab that was clicked * @param index - The index of the tab that was clicked */ handleClick(tab: TsTabComponent, tabHeader: TsTabHeaderComponent, index: number): void; /** * Subscribes to changes in the tab labels. * * This is needed, because the @Input for the label is on the {@link TsTabComponent}, whereas the data binding is inside the * {@link TsTabCollectionComponent}. In order for the binding to be updated, we need to subscribe to changes in it and trigger change * detection manually. */ private subscribeToTabLabels; /** * Clamps the given index to the bounds of 0 and the tabs length * * @param index - The index * @returns The clamped index */ private clampTabIndex; /** * Create a new change event * * @param index - The tab index * @returns The change event */ private createChangeEvent; /** * Function for tracking for-loops changes * * @param index - The item index * @param item - The item * @returns The unique ID */ trackByFn(index: any, item: any): number; }