@alauda/ui
Version:
Angular UI components by Alauda Frontend Team.
93 lines (92 loc) • 4.68 kB
TypeScript
import { AfterContentChecked, AfterContentInit, ChangeDetectorRef, EventEmitter, OnChanges, OnDestroy, QueryList, SimpleChanges, TemplateRef } from '@angular/core';
import { Subject } from 'rxjs';
import { Bem } from '../internal/utils';
import { TabHeaderAddonDirective, TabTitleDirective } from './tab-body.component';
import { TabHeaderComponent } from './tab-header.component';
import { TabComponent } from './tab.component';
import { TabSize, TabType } from './tabs.types';
import * as i0 from "@angular/core";
/** A simple change event emitted on focus or selection changes. */
export declare class TabChangeEvent {
/** Index of the currently-selected tab. */
index: number;
/** Reference to the currently-selected tab. */
tab: TabComponent;
}
export declare class TabGroupComponent implements OnChanges, AfterContentChecked, AfterContentInit, OnDestroy {
private readonly _changeDetectorRef;
bem: Bem;
_tabs: QueryList<TabComponent>;
_headerAddon: TabHeaderAddonDirective;
_tabHeader: TabHeaderComponent;
_tabTitle: TabTitleDirective;
/** The tab index that should be selected after the content has been checked. */
private _indexToSelect;
/** Subscription to tabs being added/removed. */
private _tabsSubscription;
/** Subscription to changes in the tab labels. */
private _tabLabelSubscription;
private _selectedIndex;
private _tab;
private _type;
private _size;
/** true lazy mode for template ref children */
private _lazy;
private _previousHeaderAddon;
/** Emits whenever the type changes */
readonly _typeChange: Subject<void>;
/** Emits whenever the size changes */
readonly _sizeChange: Subject<void>;
/** The index of the active tab. */
get selectedIndex(): number;
set selectedIndex(value: number);
get tab(): string;
set tab(value: string);
get type(): TabType;
set type(type: TabType);
title: TemplateRef<unknown> | string;
get size(): TabSize;
set size(val: TabSize);
get lazy(): boolean;
set lazy(lazy: boolean);
/** Output to enable support for two-way binding on `[(selectedIndex)]` */
readonly selectedIndexChange: EventEmitter<number>;
readonly tabChange: EventEmitter<string>;
/** Event emitted when the tab selection has changed. */
readonly selectedTabChange: EventEmitter<TabChangeEvent>;
/** Event emitted when focus has changed within a tab group. */
readonly focusChange: EventEmitter<TabChangeEvent>;
constructor(_changeDetectorRef: ChangeDetectorRef);
activatedTabs: TabComponent[];
get activeTab(): TabComponent;
ngOnChanges(changes: SimpleChanges): 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.
*/
ngAfterContentChecked(): void;
ngAfterContentInit(): void;
ngOnDestroy(): void;
/** Handle click events, setting new selected index if appropriate. */
_handleClick(tab: TabComponent, idx: number): void;
_focusChanged(index: number): void;
/** Re-aligns the ink bar to the selected tab element. */
realignActiveIndicator(): void;
private _changeActivatedTabs;
/** Clamps the given index to the bounds of 0 and the tabs length. */
private _clampTabIndex;
private _findIndexByTab;
private _createChangeEvent;
/**
* Subscribes to changes in the tab labels. This is needed, because the @Input for the label is
* on the Tab component, whereas the data binding is inside the TabGroup. In order for the
* binding to be updated, we need to subscribe to changes in it and trigger change detection
* manually.
*/
private _subscribeToTabLabels;
/** Retrieves the tabindex for the tab. */
_getTabIndex(tab: TabComponent, idx: number): number | null;
static ɵfac: i0.ɵɵFactoryDeclaration<TabGroupComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<TabGroupComponent, "aui-tab-group", ["auiTabGroup"], { "selectedIndex": { "alias": "selectedIndex"; "required": false; }; "tab": { "alias": "tab"; "required": false; }; "type": { "alias": "type"; "required": false; }; "title": { "alias": "title"; "required": false; }; "size": { "alias": "size"; "required": false; }; "lazy": { "alias": "lazy"; "required": false; }; }, { "selectedIndexChange": "selectedIndexChange"; "tabChange": "tabChange"; "selectedTabChange": "selectedTabChange"; "focusChange": "focusChange"; }, ["_headerAddon", "_tabTitle", "_tabs"], never, true, never>;
}