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 | */
|
---|
8 | import { ChangeDetectorRef, EventEmitter, OnDestroy, OnInit, ElementRef, ComponentFactoryResolver, ViewContainerRef } from '@angular/core';
|
---|
9 | import { AnimationEvent } from '@angular/animations';
|
---|
10 | import { TemplatePortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
---|
11 | import { Directionality, Direction } from '@angular/cdk/bidi';
|
---|
12 | import { Subject } from 'rxjs';
|
---|
13 | /**
|
---|
14 | * These position states are used internally as animation states for the tab body. Setting the
|
---|
15 | * position state to left, right, or center will transition the tab body from its current
|
---|
16 | * position to its respective state. If there is not current position (void, in the case of a new
|
---|
17 | * tab body), then there will be no transition animation to its state.
|
---|
18 | *
|
---|
19 | * In the case of a new tab body that should immediately be centered with an animating transition,
|
---|
20 | * then left-origin-center or right-origin-center can be used, which will use left or right as its
|
---|
21 | * psuedo-prior state.
|
---|
22 | */
|
---|
23 | import * as ɵngcc0 from '@angular/core';
|
---|
24 | export declare type MatTabBodyPositionState = 'left' | 'center' | 'right' | 'left-origin-center' | 'right-origin-center';
|
---|
25 | /**
|
---|
26 | * The origin state is an internally used state that is set on a new tab body indicating if it
|
---|
27 | * began to the left or right of the prior selected index. For example, if the selected index was
|
---|
28 | * set to 1, and a new tab is created and selected at index 2, then the tab body would have an
|
---|
29 | * origin of right because its index was greater than the prior selected index.
|
---|
30 | */
|
---|
31 | export declare type MatTabBodyOriginState = 'left' | 'right';
|
---|
32 | /**
|
---|
33 | * The portal host directive for the contents of the tab.
|
---|
34 | * @docs-private
|
---|
35 | */
|
---|
36 | export declare class MatTabBodyPortal extends CdkPortalOutlet implements OnInit, OnDestroy {
|
---|
37 | private _host;
|
---|
38 | /** Subscription to events for when the tab body begins centering. */
|
---|
39 | private _centeringSub;
|
---|
40 | /** Subscription to events for when the tab body finishes leaving from center position. */
|
---|
41 | private _leavingSub;
|
---|
42 | constructor(componentFactoryResolver: ComponentFactoryResolver, viewContainerRef: ViewContainerRef, _host: MatTabBody, _document: any);
|
---|
43 | /** Set initial visibility or set up subscription for changing visibility. */
|
---|
44 | ngOnInit(): void;
|
---|
45 | /** Clean up centering subscription. */
|
---|
46 | ngOnDestroy(): void;
|
---|
47 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatTabBodyPortal, never>;
|
---|
48 | static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<MatTabBodyPortal, "[matTabBodyHost]", never, {}, {}, never>;
|
---|
49 | }
|
---|
50 | /**
|
---|
51 | * Base class with all of the `MatTabBody` functionality.
|
---|
52 | * @docs-private
|
---|
53 | */
|
---|
54 | export declare abstract class _MatTabBodyBase implements OnInit, OnDestroy {
|
---|
55 | private _elementRef;
|
---|
56 | private _dir;
|
---|
57 | /** Current position of the tab-body in the tab-group. Zero means that the tab is visible. */
|
---|
58 | private _positionIndex;
|
---|
59 | /** Subscription to the directionality change observable. */
|
---|
60 | private _dirChangeSubscription;
|
---|
61 | /** Tab body position state. Used by the animation trigger for the current state. */
|
---|
62 | _position: MatTabBodyPositionState;
|
---|
63 | /** Emits when an animation on the tab is complete. */
|
---|
64 | readonly _translateTabComplete: Subject<AnimationEvent>;
|
---|
65 | /** Event emitted when the tab begins to animate towards the center as the active tab. */
|
---|
66 | readonly _onCentering: EventEmitter<number>;
|
---|
67 | /** Event emitted before the centering of the tab begins. */
|
---|
68 | readonly _beforeCentering: EventEmitter<boolean>;
|
---|
69 | /** Event emitted before the centering of the tab begins. */
|
---|
70 | readonly _afterLeavingCenter: EventEmitter<void>;
|
---|
71 | /** Event emitted when the tab completes its animation towards the center. */
|
---|
72 | readonly _onCentered: EventEmitter<void>;
|
---|
73 | /** The portal host inside of this container into which the tab body content will be loaded. */
|
---|
74 | abstract _portalHost: CdkPortalOutlet;
|
---|
75 | /** The tab body content to display. */
|
---|
76 | _content: TemplatePortal;
|
---|
77 | /** Position that will be used when the tab is immediately becoming visible after creation. */
|
---|
78 | origin: number | null;
|
---|
79 | /** Duration for the tab's animation. */
|
---|
80 | animationDuration: string;
|
---|
81 | /** The shifted index position of the tab body, where zero represents the active center tab. */
|
---|
82 | set position(position: number);
|
---|
83 | constructor(_elementRef: ElementRef<HTMLElement>, _dir: Directionality, changeDetectorRef: ChangeDetectorRef);
|
---|
84 | /**
|
---|
85 | * After initialized, check if the content is centered and has an origin. If so, set the
|
---|
86 | * special position states that transition the tab from the left or right before centering.
|
---|
87 | */
|
---|
88 | ngOnInit(): void;
|
---|
89 | ngOnDestroy(): void;
|
---|
90 | _onTranslateTabStarted(event: AnimationEvent): void;
|
---|
91 | /** The text direction of the containing app. */
|
---|
92 | _getLayoutDirection(): Direction;
|
---|
93 | /** Whether the provided position state is considered center, regardless of origin. */
|
---|
94 | _isCenterPosition(position: MatTabBodyPositionState | string): boolean;
|
---|
95 | /** Computes the position state that will be used for the tab-body animation trigger. */
|
---|
96 | private _computePositionAnimationState;
|
---|
97 | /**
|
---|
98 | * Computes the position state based on the specified origin position. This is used if the
|
---|
99 | * tab is becoming visible immediately after creation.
|
---|
100 | */
|
---|
101 | private _computePositionFromOrigin;
|
---|
102 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<_MatTabBodyBase, [null, { optional: true; }, null]>;
|
---|
103 | static ɵdir: ɵngcc0.ɵɵDirectiveDeclaration<_MatTabBodyBase, never, never, { "animationDuration": "animationDuration"; "position": "position"; "_content": "content"; "origin": "origin"; }, { "_onCentering": "_onCentering"; "_beforeCentering": "_beforeCentering"; "_afterLeavingCenter": "_afterLeavingCenter"; "_onCentered": "_onCentered"; }, never>;
|
---|
104 | }
|
---|
105 | /**
|
---|
106 | * Wrapper for the contents of a tab.
|
---|
107 | * @docs-private
|
---|
108 | */
|
---|
109 | export declare class MatTabBody extends _MatTabBodyBase {
|
---|
110 | _portalHost: CdkPortalOutlet;
|
---|
111 | constructor(elementRef: ElementRef<HTMLElement>, dir: Directionality, changeDetectorRef: ChangeDetectorRef);
|
---|
112 | static ɵfac: ɵngcc0.ɵɵFactoryDeclaration<MatTabBody, [null, { optional: true; }, null]>;
|
---|
113 | static ɵcmp: ɵngcc0.ɵɵComponentDeclaration<MatTabBody, "mat-tab-body", never, {}, {}, never, never>;
|
---|
114 | }
|
---|
115 |
|
---|
116 | //# sourceMappingURL=tab-body.d.ts.map |
---|