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 { Component, ChangeDetectorRef, Input, Inject, Output, EventEmitter, ElementRef, Directive, Optional, ViewEncapsulation, ChangeDetectionStrategy, ComponentFactoryResolver, ViewContainerRef, forwardRef, ViewChild, } from '@angular/core';
|
---|
9 | import { TemplatePortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
---|
10 | import { Directionality } from '@angular/cdk/bidi';
|
---|
11 | import { DOCUMENT } from '@angular/common';
|
---|
12 | import { Subscription, Subject } from 'rxjs';
|
---|
13 | import { matTabsAnimations } from './tabs-animations';
|
---|
14 | import { startWith, distinctUntilChanged } from 'rxjs/operators';
|
---|
15 | /**
|
---|
16 | * The portal host directive for the contents of the tab.
|
---|
17 | * @docs-private
|
---|
18 | */
|
---|
19 | export class MatTabBodyPortal extends CdkPortalOutlet {
|
---|
20 | constructor(componentFactoryResolver, viewContainerRef, _host, _document) {
|
---|
21 | super(componentFactoryResolver, viewContainerRef, _document);
|
---|
22 | this._host = _host;
|
---|
23 | /** Subscription to events for when the tab body begins centering. */
|
---|
24 | this._centeringSub = Subscription.EMPTY;
|
---|
25 | /** Subscription to events for when the tab body finishes leaving from center position. */
|
---|
26 | this._leavingSub = Subscription.EMPTY;
|
---|
27 | }
|
---|
28 | /** Set initial visibility or set up subscription for changing visibility. */
|
---|
29 | ngOnInit() {
|
---|
30 | super.ngOnInit();
|
---|
31 | this._centeringSub = this._host._beforeCentering
|
---|
32 | .pipe(startWith(this._host._isCenterPosition(this._host._position)))
|
---|
33 | .subscribe((isCentering) => {
|
---|
34 | if (isCentering && !this.hasAttached()) {
|
---|
35 | this.attach(this._host._content);
|
---|
36 | }
|
---|
37 | });
|
---|
38 | this._leavingSub = this._host._afterLeavingCenter.subscribe(() => {
|
---|
39 | this.detach();
|
---|
40 | });
|
---|
41 | }
|
---|
42 | /** Clean up centering subscription. */
|
---|
43 | ngOnDestroy() {
|
---|
44 | super.ngOnDestroy();
|
---|
45 | this._centeringSub.unsubscribe();
|
---|
46 | this._leavingSub.unsubscribe();
|
---|
47 | }
|
---|
48 | }
|
---|
49 | MatTabBodyPortal.decorators = [
|
---|
50 | { type: Directive, args: [{
|
---|
51 | selector: '[matTabBodyHost]'
|
---|
52 | },] }
|
---|
53 | ];
|
---|
54 | MatTabBodyPortal.ctorParameters = () => [
|
---|
55 | { type: ComponentFactoryResolver },
|
---|
56 | { type: ViewContainerRef },
|
---|
57 | { type: MatTabBody, decorators: [{ type: Inject, args: [forwardRef(() => MatTabBody),] }] },
|
---|
58 | { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
---|
59 | ];
|
---|
60 | /**
|
---|
61 | * Base class with all of the `MatTabBody` functionality.
|
---|
62 | * @docs-private
|
---|
63 | */
|
---|
64 | export class _MatTabBodyBase {
|
---|
65 | constructor(_elementRef, _dir, changeDetectorRef) {
|
---|
66 | this._elementRef = _elementRef;
|
---|
67 | this._dir = _dir;
|
---|
68 | /** Subscription to the directionality change observable. */
|
---|
69 | this._dirChangeSubscription = Subscription.EMPTY;
|
---|
70 | /** Emits when an animation on the tab is complete. */
|
---|
71 | this._translateTabComplete = new Subject();
|
---|
72 | /** Event emitted when the tab begins to animate towards the center as the active tab. */
|
---|
73 | this._onCentering = new EventEmitter();
|
---|
74 | /** Event emitted before the centering of the tab begins. */
|
---|
75 | this._beforeCentering = new EventEmitter();
|
---|
76 | /** Event emitted before the centering of the tab begins. */
|
---|
77 | this._afterLeavingCenter = new EventEmitter();
|
---|
78 | /** Event emitted when the tab completes its animation towards the center. */
|
---|
79 | this._onCentered = new EventEmitter(true);
|
---|
80 | // Note that the default value will always be overwritten by `MatTabBody`, but we need one
|
---|
81 | // anyway to prevent the animations module from throwing an error if the body is used on its own.
|
---|
82 | /** Duration for the tab's animation. */
|
---|
83 | this.animationDuration = '500ms';
|
---|
84 | if (_dir) {
|
---|
85 | this._dirChangeSubscription = _dir.change.subscribe((dir) => {
|
---|
86 | this._computePositionAnimationState(dir);
|
---|
87 | changeDetectorRef.markForCheck();
|
---|
88 | });
|
---|
89 | }
|
---|
90 | // Ensure that we get unique animation events, because the `.done` callback can get
|
---|
91 | // invoked twice in some browsers. See https://github.com/angular/angular/issues/24084.
|
---|
92 | this._translateTabComplete.pipe(distinctUntilChanged((x, y) => {
|
---|
93 | return x.fromState === y.fromState && x.toState === y.toState;
|
---|
94 | })).subscribe(event => {
|
---|
95 | // If the transition to the center is complete, emit an event.
|
---|
96 | if (this._isCenterPosition(event.toState) && this._isCenterPosition(this._position)) {
|
---|
97 | this._onCentered.emit();
|
---|
98 | }
|
---|
99 | if (this._isCenterPosition(event.fromState) && !this._isCenterPosition(this._position)) {
|
---|
100 | this._afterLeavingCenter.emit();
|
---|
101 | }
|
---|
102 | });
|
---|
103 | }
|
---|
104 | /** The shifted index position of the tab body, where zero represents the active center tab. */
|
---|
105 | set position(position) {
|
---|
106 | this._positionIndex = position;
|
---|
107 | this._computePositionAnimationState();
|
---|
108 | }
|
---|
109 | /**
|
---|
110 | * After initialized, check if the content is centered and has an origin. If so, set the
|
---|
111 | * special position states that transition the tab from the left or right before centering.
|
---|
112 | */
|
---|
113 | ngOnInit() {
|
---|
114 | if (this._position == 'center' && this.origin != null) {
|
---|
115 | this._position = this._computePositionFromOrigin(this.origin);
|
---|
116 | }
|
---|
117 | }
|
---|
118 | ngOnDestroy() {
|
---|
119 | this._dirChangeSubscription.unsubscribe();
|
---|
120 | this._translateTabComplete.complete();
|
---|
121 | }
|
---|
122 | _onTranslateTabStarted(event) {
|
---|
123 | const isCentering = this._isCenterPosition(event.toState);
|
---|
124 | this._beforeCentering.emit(isCentering);
|
---|
125 | if (isCentering) {
|
---|
126 | this._onCentering.emit(this._elementRef.nativeElement.clientHeight);
|
---|
127 | }
|
---|
128 | }
|
---|
129 | /** The text direction of the containing app. */
|
---|
130 | _getLayoutDirection() {
|
---|
131 | return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';
|
---|
132 | }
|
---|
133 | /** Whether the provided position state is considered center, regardless of origin. */
|
---|
134 | _isCenterPosition(position) {
|
---|
135 | return position == 'center' ||
|
---|
136 | position == 'left-origin-center' ||
|
---|
137 | position == 'right-origin-center';
|
---|
138 | }
|
---|
139 | /** Computes the position state that will be used for the tab-body animation trigger. */
|
---|
140 | _computePositionAnimationState(dir = this._getLayoutDirection()) {
|
---|
141 | if (this._positionIndex < 0) {
|
---|
142 | this._position = dir == 'ltr' ? 'left' : 'right';
|
---|
143 | }
|
---|
144 | else if (this._positionIndex > 0) {
|
---|
145 | this._position = dir == 'ltr' ? 'right' : 'left';
|
---|
146 | }
|
---|
147 | else {
|
---|
148 | this._position = 'center';
|
---|
149 | }
|
---|
150 | }
|
---|
151 | /**
|
---|
152 | * Computes the position state based on the specified origin position. This is used if the
|
---|
153 | * tab is becoming visible immediately after creation.
|
---|
154 | */
|
---|
155 | _computePositionFromOrigin(origin) {
|
---|
156 | const dir = this._getLayoutDirection();
|
---|
157 | if ((dir == 'ltr' && origin <= 0) || (dir == 'rtl' && origin > 0)) {
|
---|
158 | return 'left-origin-center';
|
---|
159 | }
|
---|
160 | return 'right-origin-center';
|
---|
161 | }
|
---|
162 | }
|
---|
163 | _MatTabBodyBase.decorators = [
|
---|
164 | { type: Directive }
|
---|
165 | ];
|
---|
166 | _MatTabBodyBase.ctorParameters = () => [
|
---|
167 | { type: ElementRef },
|
---|
168 | { type: Directionality, decorators: [{ type: Optional }] },
|
---|
169 | { type: ChangeDetectorRef }
|
---|
170 | ];
|
---|
171 | _MatTabBodyBase.propDecorators = {
|
---|
172 | _onCentering: [{ type: Output }],
|
---|
173 | _beforeCentering: [{ type: Output }],
|
---|
174 | _afterLeavingCenter: [{ type: Output }],
|
---|
175 | _onCentered: [{ type: Output }],
|
---|
176 | _content: [{ type: Input, args: ['content',] }],
|
---|
177 | origin: [{ type: Input }],
|
---|
178 | animationDuration: [{ type: Input }],
|
---|
179 | position: [{ type: Input }]
|
---|
180 | };
|
---|
181 | /**
|
---|
182 | * Wrapper for the contents of a tab.
|
---|
183 | * @docs-private
|
---|
184 | */
|
---|
185 | export class MatTabBody extends _MatTabBodyBase {
|
---|
186 | constructor(elementRef, dir, changeDetectorRef) {
|
---|
187 | super(elementRef, dir, changeDetectorRef);
|
---|
188 | }
|
---|
189 | }
|
---|
190 | MatTabBody.decorators = [
|
---|
191 | { type: Component, args: [{
|
---|
192 | selector: 'mat-tab-body',
|
---|
193 | template: "<div class=\"mat-tab-body-content\" #content\n [@translateTab]=\"{\n value: _position,\n params: {animationDuration: animationDuration}\n }\"\n (@translateTab.start)=\"_onTranslateTabStarted($event)\"\n (@translateTab.done)=\"_translateTabComplete.next($event)\"\n cdkScrollable>\n <ng-template matTabBodyHost></ng-template>\n</div>\n",
|
---|
194 | encapsulation: ViewEncapsulation.None,
|
---|
195 | // tslint:disable-next-line:validate-decorators
|
---|
196 | changeDetection: ChangeDetectionStrategy.Default,
|
---|
197 | animations: [matTabsAnimations.translateTab],
|
---|
198 | host: {
|
---|
199 | 'class': 'mat-tab-body',
|
---|
200 | },
|
---|
201 | styles: [".mat-tab-body-content{height:100%;overflow:auto}.mat-tab-group-dynamic-height .mat-tab-body-content{overflow:hidden}\n"]
|
---|
202 | },] }
|
---|
203 | ];
|
---|
204 | MatTabBody.ctorParameters = () => [
|
---|
205 | { type: ElementRef },
|
---|
206 | { type: Directionality, decorators: [{ type: Optional }] },
|
---|
207 | { type: ChangeDetectorRef }
|
---|
208 | ];
|
---|
209 | MatTabBody.propDecorators = {
|
---|
210 | _portalHost: [{ type: ViewChild, args: [CdkPortalOutlet,] }]
|
---|
211 | };
|
---|
212 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLWJvZHkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8u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