1 | import { Directive, EventEmitter, HostBinding, Input, Output } from '@angular/core';
|
2 | import { TabsetComponent } from './tabset.component';
|
3 | export var TabDirective = (function () {
|
4 | function TabDirective(tabset) {
|
5 |
|
6 | this.select = new EventEmitter();
|
7 |
|
8 | this.deselect = new EventEmitter();
|
9 |
|
10 | this.removed = new EventEmitter();
|
11 | this.addClass = true;
|
12 | this.tabset = tabset;
|
13 | this.tabset.addTab(this);
|
14 | }
|
15 | Object.defineProperty(TabDirective.prototype, "active", {
|
16 |
|
17 | get: function () {
|
18 | return this._active;
|
19 | },
|
20 | set: function (active) {
|
21 | var _this = this;
|
22 | if (this.disabled && active || !active) {
|
23 | if (!active) {
|
24 | this._active = active;
|
25 | }
|
26 | this.deselect.emit(this);
|
27 | return;
|
28 | }
|
29 | this._active = active;
|
30 | this.select.emit(this);
|
31 | this.tabset.tabs.forEach(function (tab) {
|
32 | if (tab !== _this) {
|
33 | tab.active = false;
|
34 | }
|
35 | });
|
36 | },
|
37 | enumerable: true,
|
38 | configurable: true
|
39 | });
|
40 | TabDirective.prototype.ngOnInit = function () {
|
41 | this.removable = this.removable;
|
42 | };
|
43 | TabDirective.decorators = [
|
44 | { type: Directive, args: [{ selector: 'tab, [tab]' },] },
|
45 | ];
|
46 |
|
47 | TabDirective.ctorParameters = function () { return [
|
48 | { type: TabsetComponent, },
|
49 | ]; };
|
50 | TabDirective.propDecorators = {
|
51 | 'heading': [{ type: Input },],
|
52 | 'disabled': [{ type: Input },],
|
53 | 'removable': [{ type: Input },],
|
54 | 'customClass': [{ type: Input },],
|
55 | 'active': [{ type: HostBinding, args: ['class.active',] }, { type: Input },],
|
56 | 'select': [{ type: Output },],
|
57 | 'deselect': [{ type: Output },],
|
58 | 'removed': [{ type: Output },],
|
59 | 'addClass': [{ type: HostBinding, args: ['class.tab-pane',] },],
|
60 | };
|
61 | return TabDirective;
|
62 | }());
|
63 |
|
\ | No newline at end of file |