UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

420 lines (397 loc) 22.5 kB
import { Observable, Subject } from 'rxjs'; import { NzSafeAny, NzSizeLDSType } from 'ng-zorro-antd/core/types'; import * as i0 from '@angular/core'; import { TemplateRef, ElementRef, InjectionToken, OnChanges, OnDestroy, EventEmitter, SimpleChanges, AfterViewInit, AfterContentChecked, QueryList, AfterContentInit } from '@angular/core'; import { RouterLink } from '@angular/router'; import * as _angular_cdk_bidi from '@angular/cdk/bidi'; import { FocusableOption } from '@angular/cdk/a11y'; import { NzConfigKey } from 'ng-zorro-antd/core/config'; /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ type NzTabPosition = 'top' | 'bottom' | 'left' | 'right'; type NzTabType = 'line' | 'card' | 'editable-card'; type NzTabsCanDeactivateFn = (fromIndex: number, toIndex: number) => Observable<boolean> | Promise<boolean> | boolean; type NzTabPositionMode = 'horizontal' | 'vertical'; interface NzAnimatedInterface { inkBar: boolean; tabPane: boolean; } declare class NzTabChangeEvent { index?: number; tab: NzSafeAny; } interface NzTabScrollListOffset { x: number; y: number; } type NzTabScrollListOffsetEvent = NzTabScrollListOffset & { event: Event; }; interface NzTabWheelScrollEvent { type: 'wheel'; event: WheelEvent; } interface NzTabTouchScrollEvent { type: 'touchstart' | 'touchmove' | 'touchend'; event: TouchEvent; } type NzTabScrollEvent = NzTabTouchScrollEvent | NzTabWheelScrollEvent; type NzTabScrollEventHandlerFun<T extends NzTabScrollEvent['event']> = (event: T) => void; interface TabTemplateContext { visible: boolean; } type NzIndicatorAlign = 'start' | 'end' | 'center'; interface NzIndicator { size?: number | ((origin: number) => number); align: NzIndicatorAlign; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare class NzTabAddButtonComponent { addIcon: string | TemplateRef<NzSafeAny>; private readonly element; getElementWidth(): number; getElementHeight(): number; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabAddButtonComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTabAddButtonComponent, "nz-tab-add-button, button[nz-tab-add-button]", never, { "addIcon": { "alias": "addIcon"; "required": false; }; }, {}, never, never, true, never>; } declare class NzTabBarExtraContentDirective { readonly position: i0.InputSignal<"start" | "end">; readonly templateRef: TemplateRef<any>; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabBarExtraContentDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTabBarExtraContentDirective, "[nzTabBarExtraContent]:not(nz-tabs)", never, { "position": { "alias": "nzTabBarExtraContent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } type AnimationState = 'enter-start' | 'enter-active' | 'leave-start' | 'leave-active' | 'void' | 'hidden'; declare class NzTabBodyComponent { private readonly elementRef; readonly content: i0.InputSignal<TemplateRef<void> | null>; readonly active: i0.InputSignal<boolean>; readonly animated: i0.InputSignal<boolean>; protected readonly _animationState: i0.WritableSignal<AnimationState>; protected readonly _animationEnabled: i0.Signal<boolean>; protected readonly class: i0.Signal<string[]>; constructor(); protected _onTransitionEnd(event: TransitionEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabBodyComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTabBodyComponent, "[nz-tab-body]", ["nzTabBody"], { "content": { "alias": "content"; "required": false; "isSignal": true; }; "active": { "alias": "active"; "required": false; "isSignal": true; }; "animated": { "alias": "animated"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } declare class NzTabCloseButtonComponent { readonly closeIcon: i0.InputSignal<string | TemplateRef<any>>; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabCloseButtonComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTabCloseButtonComponent, "nz-tab-close-button, button[nz-tab-close-button]", never, { "closeIcon": { "alias": "closeIcon"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /** * Fix https://github.com/angular/angular/issues/8563 */ declare class NzTabLinkTemplateDirective { templateRef: TemplateRef<TabTemplateContext>; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabLinkTemplateDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTabLinkTemplateDirective, "ng-template[nzTabLink]", ["nzTabLinkTemplate"], {}, {}, never, never, true, never>; } /** * This component is for catching `routerLink` directive. */ declare class NzTabLinkDirective { elementRef: ElementRef<any>; routerLink: RouterLink | null; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabLinkDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTabLinkDirective, "a[nz-tab-link]", ["nzTabLink"], {}, {}, never, never, true, never>; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ /** * Used to provide a tab set to a tab without causing a circular dependency. */ declare const NZ_TAB_SET: InjectionToken<any>; declare class NzTabComponent implements OnChanges, OnDestroy { readonly closestTabSet: any; nzTitle: string | TemplateRef<TabTemplateContext>; nzClosable: boolean; nzCloseIcon: string | TemplateRef<NzSafeAny>; nzDisabled: boolean; nzForceRender: boolean; readonly nzSelect: EventEmitter<void>; readonly nzDeselect: EventEmitter<void>; readonly nzClick: EventEmitter<void>; readonly nzContextmenu: EventEmitter<MouseEvent>; nzTabLinkTemplateDirective: NzTabLinkTemplateDirective; template: TemplateRef<void> | null; linkDirective: NzTabLinkDirective; contentTemplate: TemplateRef<void>; isActive: boolean; hasBeenActive: boolean; position: number | null; origin: number | null; readonly stateChanges: Subject<void>; get content(): TemplateRef<NzSafeAny>; get label(): string | TemplateRef<NzSafeAny>; ngOnChanges(changes: SimpleChanges): void; ngOnDestroy(): void; setActive(active: boolean): void; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTabComponent, "nz-tab", ["nzTab"], { "nzTitle": { "alias": "nzTitle"; "required": false; }; "nzClosable": { "alias": "nzClosable"; "required": false; }; "nzCloseIcon": { "alias": "nzCloseIcon"; "required": false; }; "nzDisabled": { "alias": "nzDisabled"; "required": false; }; "nzForceRender": { "alias": "nzForceRender"; "required": false; }; }, { "nzSelect": "nzSelect"; "nzDeselect": "nzDeselect"; "nzClick": "nzClick"; "nzContextmenu": "nzContextmenu"; }, ["nzTabLinkTemplateDirective", "template", "linkDirective"], ["[nz-tab-link]", "*"], true, never>; static ngAcceptInputType_nzClosable: unknown; static ngAcceptInputType_nzDisabled: unknown; static ngAcceptInputType_nzForceRender: unknown; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare class NzTabNavItemDirective implements FocusableOption { readonly elementRef: ElementRef<HTMLElement>; private el; private parentElement; tab: NzTabComponent; disabled: boolean; active: boolean; focus(): void; get width(): number; get height(): number; get left(): number; get top(): number; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabNavItemDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTabNavItemDirective, "[nzTabNavItem]", never, { "tab": { "alias": "tab"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "active": { "alias": "active"; "required": false; }; }, {}, never, never, true, never>; static ngAcceptInputType_disabled: unknown; static ngAcceptInputType_active: unknown; } declare class NzTabNavOperationComponent { private readonly element; items: NzTabNavItemDirective[]; addable: boolean; addIcon: string | TemplateRef<NzSafeAny>; readonly addClicked: EventEmitter<void>; readonly selected: EventEmitter<NzTabNavItemDirective>; private closeAnimationWaitTimeoutId?; protected readonly menuOpened: i0.WritableSignal<boolean>; constructor(); onSelect(item: NzTabNavItemDirective): void; onContextmenu(item: NzTabNavItemDirective, e: MouseEvent): void; showItems(): void; protected menuVisibleChange(visible: boolean): void; getElementWidth(): number; getElementHeight(): number; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabNavOperationComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTabNavOperationComponent, "nz-tab-nav-operation", ["nzTabNavOperation"], { "items": { "alias": "items"; "required": false; }; "addable": { "alias": "addable"; "required": false; }; "addIcon": { "alias": "addIcon"; "required": false; }; }, { "addClicked": "addClicked"; "selected": "selected"; }, never, never, true, never>; static ngAcceptInputType_addable: unknown; } declare class NzTabsInkBarDirective { private readonly ngZone; private readonly el; private readonly directionality; readonly position: i0.InputSignal<NzTabPositionMode>; readonly animated: i0.InputSignal<boolean>; readonly indicator: i0.InputSignal<NzIndicator | undefined>; protected readonly animationEnabled: i0.Signal<boolean>; alignToElement(element: HTMLElement): void; private setStyles; private setIndicatorPosition; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabsInkBarDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTabsInkBarDirective, "nz-tabs-ink-bar, [nz-tabs-ink-bar]", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; "animated": { "alias": "animated"; "required": false; "isSignal": true; }; "indicator": { "alias": "indicator"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } declare class NzTabNavBarComponent implements AfterViewInit, AfterContentChecked, OnChanges { private readonly cdr; private readonly ngZone; private readonly viewportRuler; private readonly nzResizeObserver; private readonly directionality; private readonly destroyRef; protected readonly dir: i0.WritableSignal<_angular_cdk_bidi.Direction>; readonly indexFocused: EventEmitter<number>; readonly selectFocusedIndex: EventEmitter<number>; readonly addClicked: EventEmitter<void>; readonly tabScroll: EventEmitter<NzTabScrollEvent>; position: NzTabPositionMode; addable: boolean; hideBar: boolean; addIcon: string | TemplateRef<NzSafeAny>; inkBarAnimated: boolean; extraTemplate?: TemplateRef<void>; readonly extraContents: i0.InputSignal<readonly NzTabBarExtraContentDirective[]>; readonly indicator: i0.InputSignal<NzIndicator | undefined>; readonly startExtraContent: i0.Signal<NzTabBarExtraContentDirective | undefined>; readonly endExtraContent: i0.Signal<NzTabBarExtraContentDirective | undefined>; get selectedIndex(): number; set selectedIndex(value: number); navWrapRef: ElementRef<HTMLElement>; navListRef: ElementRef<HTMLElement>; operationRef: NzTabNavOperationComponent; addBtnRef: NzTabAddButtonComponent; inkBar: NzTabsInkBarDirective; items: QueryList<NzTabNavItemDirective>; /** Tracks which element has focus; used for keyboard navigation */ get focusIndex(): number; /** When the focus index is set, we must manually send focus to the correct label */ set focusIndex(value: number); get showAddButton(): boolean; translate: null | string; transformX: number; transformY: number; pingLeft: boolean; pingRight: boolean; pingTop: boolean; pingBottom: boolean; hiddenItems: NzTabNavItemDirective[]; private keyManager; private _selectedIndex; private wrapperWidth; private wrapperHeight; private scrollListWidth; private scrollListHeight; private operationWidth; private operationHeight; private addButtonWidth; private addButtonHeight; private selectedIndexChanged; private lockAnimationTimeoutId?; private cssTransformTimeWaitingId?; constructor(); ngAfterViewInit(): void; ngAfterContentChecked(): void; onSelectedFromMenu(tab: NzTabNavItemDirective): void; onOffsetChange(e: NzTabScrollListOffsetEvent): void; handleKeydown(event: KeyboardEvent): void; private isValidIndex; private scrollToTab; private lockAnimation; private setTransform; private clampTransformX; private clampTransformY; private updateScrollListPosition; private resetSizes; private alignInkBarToSelectedTab; private setPingStatus; private setVisibleRange; ngOnChanges(changes: SimpleChanges): void; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabNavBarComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTabNavBarComponent, "nz-tabs-nav", ["nzTabsNav"], { "position": { "alias": "position"; "required": false; }; "addable": { "alias": "addable"; "required": false; }; "hideBar": { "alias": "hideBar"; "required": false; }; "addIcon": { "alias": "addIcon"; "required": false; }; "inkBarAnimated": { "alias": "inkBarAnimated"; "required": false; }; "extraTemplate": { "alias": "extraTemplate"; "required": false; }; "extraContents": { "alias": "extraContents"; "required": true; "isSignal": true; }; "indicator": { "alias": "indicator"; "required": false; "isSignal": true; }; "selectedIndex": { "alias": "selectedIndex"; "required": false; }; }, { "indexFocused": "indexFocused"; "selectFocusedIndex": "selectFocusedIndex"; "addClicked": "addClicked"; "tabScroll": "tabScroll"; }, ["items"], ["*"], true, never>; static ngAcceptInputType_addable: unknown; static ngAcceptInputType_hideBar: unknown; } /** * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE */ declare class NzTabScrollListDirective { private ngZone; private destroyRef; private el; lastWheelDirection: 'x' | 'y' | null; lastWheelTimestamp: number; lastTimestamp: number; lastTimeDiff: number; lastMixedWheel: number; lastWheelPrevent: boolean; touchPosition: NzTabScrollListOffset | null; lastOffset: NzTabScrollListOffset | null; motion: number; readonly offsetChange: EventEmitter<NzTabScrollListOffsetEvent>; readonly tabScroll: EventEmitter<NzTabScrollEvent>; constructor(); private subscribeWrap; onTouchEnd: (e: TouchEvent) => void; onTouchMove: (e: TouchEvent) => void; onTouchStart: (e: TouchEvent) => void; onWheel: (e: WheelEvent) => void; onOffset(x: number, y: number, event: Event): void; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabScrollListDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTabScrollListDirective, "[nzTabScrollList]", never, {}, { "offsetChange": "offsetChange"; "tabScroll": "tabScroll"; }, never, never, true, never>; } /** Decorates the `ng-template` tags and reads out the template from it. */ declare class NzTabDirective { static ɵfac: i0.ɵɵFactoryDeclaration<NzTabDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<NzTabDirective, "[nz-tab]", ["nzTab"], {}, {}, never, never, true, never>; } declare class NzTabsComponent implements AfterContentChecked, AfterContentInit { readonly _nzModuleName: NzConfigKey; protected readonly dir: i0.WritableSignal<_angular_cdk_bidi.Direction>; private readonly ngZone; private readonly cdr; private readonly destroyRef; private readonly router; get nzSelectedIndex(): number | null; set nzSelectedIndex(value: null | number); nzTabPosition: NzTabPosition; nzTabBarExtraContent?: TemplateRef<void>; nzCanDeactivate: NzTabsCanDeactivateFn | null; nzAddIcon: string | TemplateRef<NzSafeAny>; nzTabBarStyle: Record<string, string> | null; nzType: NzTabType; nzSize: NzSizeLDSType; nzAnimated: NzAnimatedInterface | boolean; nzTabBarGutter?: number; nzHideAdd: boolean; nzCentered: boolean; nzHideAll: boolean; nzLinkRouter: boolean; nzLinkExact: boolean; nzDestroyInactiveTabPane: boolean; readonly nzIndicator: i0.InputSignal<NzIndicator | undefined>; readonly nzSelectChange: i0.OutputEmitterRef<NzTabChangeEvent>; readonly nzSelectedIndexChange: i0.OutputEmitterRef<number>; readonly nzTabListScroll: i0.OutputEmitterRef<NzTabScrollEvent>; readonly nzClose: i0.OutputEmitterRef<{ index: number; }>; readonly nzAdd: i0.OutputEmitterRef<void>; get position(): NzTabPositionMode; get addable(): boolean; get closable(): boolean; get inkBarAnimated(): boolean; get tabPaneAnimated(): boolean; allTabs: QueryList<NzTabComponent>; tabLinks: QueryList<NzTabLinkDirective>; tabNavBarRef: NzTabNavBarComponent; tabs: QueryList<NzTabComponent>; readonly extraContents: i0.Signal<readonly NzTabBarExtraContentDirective[]>; private readonly tabSetId; private indexToSelect; private selectedIndex; private tabLabelSubscription; private canDeactivateSubscription; constructor(); ngAfterContentInit(): void; ngAfterContentChecked(): void; onClose(index: number, e: MouseEvent): void; onAdd(): void; private clampTabIndex; private createChangeEvent; private subscribeToTabLabels; private subscribeToAllTabChanges; canDeactivateFun(pre: number, next: number): Observable<boolean>; clickNavItem(tab: NzTabComponent, index: number, e: MouseEvent): void; private isRouterLinkClickEvent; contextmenuNavItem(tab: NzTabComponent, e: MouseEvent): void; setSelectedIndex(index: number): void; getTabIndex(tab: NzTabComponent, index: number): number | null; getTabContentId(i: number): string; private setUpRouter; private updateRouterActive; private findShouldActiveTabIndex; private isLinkActive; static ɵfac: i0.ɵɵFactoryDeclaration<NzTabsComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<NzTabsComponent, "nz-tabs", ["nzTabs"], { "nzSelectedIndex": { "alias": "nzSelectedIndex"; "required": false; }; "nzTabPosition": { "alias": "nzTabPosition"; "required": false; }; "nzTabBarExtraContent": { "alias": "nzTabBarExtraContent"; "required": false; }; "nzCanDeactivate": { "alias": "nzCanDeactivate"; "required": false; }; "nzAddIcon": { "alias": "nzAddIcon"; "required": false; }; "nzTabBarStyle": { "alias": "nzTabBarStyle"; "required": false; }; "nzType": { "alias": "nzType"; "required": false; }; "nzSize": { "alias": "nzSize"; "required": false; }; "nzAnimated": { "alias": "nzAnimated"; "required": false; }; "nzTabBarGutter": { "alias": "nzTabBarGutter"; "required": false; }; "nzHideAdd": { "alias": "nzHideAdd"; "required": false; }; "nzCentered": { "alias": "nzCentered"; "required": false; }; "nzHideAll": { "alias": "nzHideAll"; "required": false; }; "nzLinkRouter": { "alias": "nzLinkRouter"; "required": false; }; "nzLinkExact": { "alias": "nzLinkExact"; "required": false; }; "nzDestroyInactiveTabPane": { "alias": "nzDestroyInactiveTabPane"; "required": false; }; "nzIndicator": { "alias": "nzIndicator"; "required": false; "isSignal": true; }; }, { "nzSelectChange": "nzSelectChange"; "nzSelectedIndexChange": "nzSelectedIndexChange"; "nzTabListScroll": "nzTabListScroll"; "nzClose": "nzClose"; "nzAdd": "nzAdd"; }, ["extraContents", "allTabs", "tabLinks"], never, true, never>; static ngAcceptInputType_nzHideAdd: unknown; static ngAcceptInputType_nzCentered: unknown; static ngAcceptInputType_nzHideAll: unknown; static ngAcceptInputType_nzLinkRouter: unknown; static ngAcceptInputType_nzLinkExact: unknown; static ngAcceptInputType_nzDestroyInactiveTabPane: unknown; } declare class NzTabsModule { static ɵfac: i0.ɵɵFactoryDeclaration<NzTabsModule, never>; static ɵmod: i0.ɵɵNgModuleDeclaration<NzTabsModule, never, [typeof NzTabsComponent, typeof NzTabComponent, typeof NzTabNavBarComponent, typeof NzTabNavItemDirective, typeof NzTabsInkBarDirective, typeof NzTabScrollListDirective, typeof NzTabNavOperationComponent, typeof NzTabAddButtonComponent, typeof NzTabCloseButtonComponent, typeof NzTabDirective, typeof NzTabBodyComponent, typeof NzTabLinkDirective, typeof NzTabLinkTemplateDirective, typeof NzTabBarExtraContentDirective], [typeof NzTabsComponent, typeof NzTabComponent, typeof NzTabNavBarComponent, typeof NzTabNavItemDirective, typeof NzTabsInkBarDirective, typeof NzTabScrollListDirective, typeof NzTabNavOperationComponent, typeof NzTabAddButtonComponent, typeof NzTabCloseButtonComponent, typeof NzTabDirective, typeof NzTabBodyComponent, typeof NzTabLinkDirective, typeof NzTabLinkTemplateDirective, typeof NzTabBarExtraContentDirective]>; static ɵinj: i0.ɵɵInjectorDeclaration<NzTabsModule>; } export { NZ_TAB_SET, NzTabBarExtraContentDirective, NzTabChangeEvent, NzTabComponent, NzTabDirective, NzTabLinkDirective, NzTabLinkTemplateDirective, NzTabsComponent, NzTabsModule, NzTabAddButtonComponent as ɵNzTabAddButtonComponent, NzTabBodyComponent as ɵNzTabBodyComponent, NzTabCloseButtonComponent as ɵNzTabCloseButtonComponent, NzTabNavBarComponent as ɵNzTabNavBarComponent, NzTabNavItemDirective as ɵNzTabNavItemDirective, NzTabNavOperationComponent as ɵNzTabNavOperationComponent, NzTabScrollListDirective as ɵNzTabScrollListDirective, NzTabsInkBarDirective as ɵNzTabsInkBarDirective }; export type { NzAnimatedInterface, NzIndicator, NzIndicatorAlign, NzTabPosition, NzTabPositionMode, NzTabScrollEvent, NzTabScrollEventHandlerFun, NzTabScrollListOffset, NzTabScrollListOffsetEvent, NzTabType, NzTabsCanDeactivateFn, TabTemplateContext };