UNPKG

bia-framework

Version:

Bia Framework to work with angular 2

152 lines 6.35 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; var __param = (this && this.__param) || function (paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } }; var core_1 = require("@angular/core"); var common_1 = require("@angular/common"); var Observable_1 = require("rxjs/Observable"); var RippleEffect_1 = require("../ripple-effect/RippleEffect"); var core_icon_1 = require("../core-icon/core-icon"); var CoreAnimations_1 = require("../core-animations/CoreAnimations"); var CoreTabs = (function () { function CoreTabs() { var _this = this; this.tabs = []; this.IsVisible = false; this._selectedIndex = 0; this.selectedIndexChange = new core_1.EventEmitter(); this.selectTab = function (index) { _this.tabs.forEach(function (item) { return item.isActive = false; }); _this.tabs[index].isActive = true; }; this.addTab = function (tab) { _this.tabs.push(tab); }; this.getColor = function (isactive) { if (isactive) return "white"; else return "secondary"; }; this.tabs = []; } Object.defineProperty(CoreTabs.prototype, "selectedIndex", { get: function () { return this._selectedIndex; }, set: function (index) { if (this._selectedIndex != index) { this._selectedIndex = index; this.selectedIndexChange.emit(index); this.selectTab(index); } }, enumerable: true, configurable: true }); CoreTabs.prototype.ngAfterContentInit = function () { return undefined; }; __decorate([ core_1.Input("is-navegation-full"), __metadata('design:type', Boolean) ], CoreTabs.prototype, "isNavegationFull", void 0); __decorate([ core_1.Input(), __metadata('design:type', Number) ], CoreTabs.prototype, "selectedIndex", null); __decorate([ core_1.Output(), __metadata('design:type', Object) ], CoreTabs.prototype, "selectedIndexChange", void 0); CoreTabs = __decorate([ core_1.Component({ selector: 'core-tabs', encapsulation: core_1.ViewEncapsulation.None, templateUrl: "node_modules/bia-framework/components/core-tabs/core-tabs.template.html", styleUrls: ['node_modules/bia-framework/components/core-tabs/core-tabs.style.css'], directives: [common_1.NgClass, common_1.NgFor, RippleEffect_1.RippleEffect, core_icon_1.CoreIcon], host: { 'class': 'view' } }), __metadata('design:paramtypes', []) ], CoreTabs); return CoreTabs; }()); exports.CoreTabs = CoreTabs; var CoreTab = (function () { function CoreTab(tabHost, resolver) { var _this = this; this.tabHost = tabHost; this.resolver = resolver; this.isContentProcessing = false; this.setupDynamicContent = function () { return Observable_1.Observable.create(function (observer) { if (_this.dynamicContent == null) observer.complete(); else { _this.isContentProcessing = true; System.import(_this.dynamicContent.path) .then(function (c) { return c[_this.dynamicContent.className]; }) .then(function (result) { _this.resolver.resolveComponent(result).then(function (factory) { _this.dynamic.createComponent(factory, 0, _this.dynamic.injector); _this.isContentProcessing = false; }); }); } }); }; tabHost.addTab(this); } CoreTab.prototype.ngAfterContentInit = function () { this.setupDynamicContent().subscribe(); return undefined; }; CoreTab.prototype.ngOnInit = function () { this.title = this.title || ""; this.isActive = this.isActive || false; return undefined; }; __decorate([ core_1.Input(), __metadata('design:type', String) ], CoreTab.prototype, "icon", void 0); __decorate([ core_1.Input(), __metadata('design:type', String) ], CoreTab.prototype, "title", void 0); __decorate([ core_1.Input(), __metadata('design:type', Boolean) ], CoreTab.prototype, "isActive", void 0); __decorate([ core_1.ViewChild('dynamic', { read: core_1.ViewContainerRef }), __metadata('design:type', core_1.ViewContainerRef) ], CoreTab.prototype, "dynamic", void 0); __decorate([ core_1.Input(), __metadata('design:type', Object) ], CoreTab.prototype, "dynamicContent", void 0); CoreTab = __decorate([ core_1.Component({ selector: 'core-tab', encapsulation: core_1.ViewEncapsulation.None, templateUrl: "node_modules/bia-framework/components/core-tabs/core-tab.template.html", animations: [CoreAnimations_1.CoreAnimations.animationReveal()] }), __param(0, core_1.Host()), __metadata('design:paramtypes', [CoreTabs, core_1.ComponentResolver]) ], CoreTab); return CoreTab; }()); exports.CoreTab = CoreTab; //# sourceMappingURL=core-tabs.component.js.map