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 { TemplatePortal } from '@angular/cdk/portal';
|
---|
9 | import { ChangeDetectionStrategy, Component, ContentChild, Input, TemplateRef, ViewChild, ViewContainerRef, ViewEncapsulation, InjectionToken, Inject, Optional, } from '@angular/core';
|
---|
10 | import { mixinDisabled } from '@angular/material/core';
|
---|
11 | import { Subject } from 'rxjs';
|
---|
12 | import { MAT_TAB_CONTENT } from './tab-content';
|
---|
13 | import { MAT_TAB_LABEL, MatTabLabel, MAT_TAB } from './tab-label';
|
---|
14 | // Boilerplate for applying mixins to MatTab.
|
---|
15 | /** @docs-private */
|
---|
16 | const _MatTabBase = mixinDisabled(class {
|
---|
17 | });
|
---|
18 | /**
|
---|
19 | * Used to provide a tab group to a tab without causing a circular dependency.
|
---|
20 | * @docs-private
|
---|
21 | */
|
---|
22 | export const MAT_TAB_GROUP = new InjectionToken('MAT_TAB_GROUP');
|
---|
23 | export class MatTab extends _MatTabBase {
|
---|
24 | constructor(_viewContainerRef, _closestTabGroup) {
|
---|
25 | super();
|
---|
26 | this._viewContainerRef = _viewContainerRef;
|
---|
27 | this._closestTabGroup = _closestTabGroup;
|
---|
28 | /** Plain text label for the tab, used when there is no template label. */
|
---|
29 | this.textLabel = '';
|
---|
30 | /** Portal that will be the hosted content of the tab */
|
---|
31 | this._contentPortal = null;
|
---|
32 | /** Emits whenever the internal state of the tab changes. */
|
---|
33 | this._stateChanges = new Subject();
|
---|
34 | /**
|
---|
35 | * The relatively indexed position where 0 represents the center, negative is left, and positive
|
---|
36 | * represents the right.
|
---|
37 | */
|
---|
38 | this.position = null;
|
---|
39 | /**
|
---|
40 | * The initial relatively index origin of the tab if it was created and selected after there
|
---|
41 | * was already a selected tab. Provides context of what position the tab should originate from.
|
---|
42 | */
|
---|
43 | this.origin = null;
|
---|
44 | /**
|
---|
45 | * Whether the tab is currently active.
|
---|
46 | */
|
---|
47 | this.isActive = false;
|
---|
48 | }
|
---|
49 | /** Content for the tab label given by `<ng-template mat-tab-label>`. */
|
---|
50 | get templateLabel() { return this._templateLabel; }
|
---|
51 | set templateLabel(value) { this._setTemplateLabelInput(value); }
|
---|
52 | /** @docs-private */
|
---|
53 | get content() {
|
---|
54 | return this._contentPortal;
|
---|
55 | }
|
---|
56 | ngOnChanges(changes) {
|
---|
57 | if (changes.hasOwnProperty('textLabel') || changes.hasOwnProperty('disabled')) {
|
---|
58 | this._stateChanges.next();
|
---|
59 | }
|
---|
60 | }
|
---|
61 | ngOnDestroy() {
|
---|
62 | this._stateChanges.complete();
|
---|
63 | }
|
---|
64 | ngOnInit() {
|
---|
65 | this._contentPortal = new TemplatePortal(this._explicitContent || this._implicitContent, this._viewContainerRef);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * This has been extracted to a util because of TS 4 and VE.
|
---|
69 | * View Engine doesn't support property rename inheritance.
|
---|
70 | * TS 4.0 doesn't allow properties to override accessors or vice-versa.
|
---|
71 | * @docs-private
|
---|
72 | */
|
---|
73 | _setTemplateLabelInput(value) {
|
---|
74 | // Only update the label if the query managed to find one. This works around an issue where a
|
---|
75 | // user may have manually set `templateLabel` during creation mode, which would then get
|
---|
76 | // clobbered by `undefined` when the query resolves. Also note that we check that the closest
|
---|
77 | // tab matches the current one so that we don't pick up labels from nested tabs.
|
---|
78 | if (value && value._closestTab === this) {
|
---|
79 | this._templateLabel = value;
|
---|
80 | }
|
---|
81 | }
|
---|
82 | }
|
---|
83 | MatTab.decorators = [
|
---|
84 | { type: Component, args: [{
|
---|
85 | selector: 'mat-tab',
|
---|
86 | template: "<!-- Create a template for the content of the <mat-tab> so that we can grab a reference to this\n TemplateRef and use it in a Portal to render the tab content in the appropriate place in the\n tab-group. -->\n<ng-template><ng-content></ng-content></ng-template>\n",
|
---|
87 | inputs: ['disabled'],
|
---|
88 | // tslint:disable-next-line:validate-decorators
|
---|
89 | changeDetection: ChangeDetectionStrategy.Default,
|
---|
90 | encapsulation: ViewEncapsulation.None,
|
---|
91 | exportAs: 'matTab',
|
---|
92 | providers: [{ provide: MAT_TAB, useExisting: MatTab }]
|
---|
93 | },] }
|
---|
94 | ];
|
---|
95 | MatTab.ctorParameters = () => [
|
---|
96 | { type: ViewContainerRef },
|
---|
97 | { type: undefined, decorators: [{ type: Inject, args: [MAT_TAB_GROUP,] }, { type: Optional }] }
|
---|
98 | ];
|
---|
99 | MatTab.propDecorators = {
|
---|
100 | templateLabel: [{ type: ContentChild, args: [MAT_TAB_LABEL,] }],
|
---|
101 | _explicitContent: [{ type: ContentChild, args: [MAT_TAB_CONTENT, { read: TemplateRef, static: true },] }],
|
---|
102 | _implicitContent: [{ type: ViewChild, args: [TemplateRef, { static: true },] }],
|
---|
103 | textLabel: [{ type: Input, args: ['label',] }],
|
---|
104 | ariaLabel: [{ type: Input, args: ['aria-label',] }],
|
---|
105 | ariaLabelledby: [{ type: Input, args: ['aria-labelledby',] }]
|
---|
106 | };
|
---|
107 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFiLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL3RhYnMvdGFiLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUdILE9BQU8sRUFBQyxjQUFjLEVBQUMsTUFBTSxxQkFBcUIsQ0FBQztBQUNuRCxPQUFPLEVBQ0wsdUJBQXVCLEVBQ3ZCLFNBQVMsRUFDVCxZQUFZLEVBQ1osS0FBSyxFQUtMLFdBQVcsRUFDWCxTQUFTLEVBQ1QsZ0JBQWdCLEVBQ2hCLGlCQUFpQixFQUNqQixjQUFjLEVBQ2QsTUFBTSxFQUNOLFFBQVEsR0FDVCxNQUFNLGVBQWU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