UNPKG

nativescript-bubble-navigation

Version:

Nativescript plugin for Android & iOS that create beautiful navigation tabs

117 lines 3.99 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var view_1 = require("tns-core-modules/ui/core/view"); var properties_1 = require("tns-core-modules/ui/core/properties"); var BubbleNavigationBase = (function (_super) { __extends(BubbleNavigationBase, _super); function BubbleNavigationBase() { var _this = _super.call(this) || this; _this.selectedTabIndex = 0; _this._tabs = []; return _this; } Object.defineProperty(BubbleNavigationBase.prototype, "tabs", { get: function () { return this._tabs; }, enumerable: true, configurable: true }); BubbleNavigationBase.prototype.selectTab = function (index) { if (index !== this.selectedTabIndex) { this.selectTabNative(index); } }; BubbleNavigationBase.prototype.onTabSelected = function (index) { var eventData = { eventName: 'tabSelected', object: this, position: index, name: this.tabs[index].title }; this.notify(eventData); }; return BubbleNavigationBase; }(view_1.View)); exports.BubbleNavigationBase = BubbleNavigationBase; exports.tabsProperty = new properties_1.Property({ name: 'tabs', equalityComparer: function (a, b) { return !a && !b && a.length === b.length; } }); exports.tabsProperty.register(BubbleNavigationBase); exports.tabBackgroundColorProperty = new properties_1.Property({ name: 'tabBackgroundColor' }); exports.tabBackgroundColorProperty.register(BubbleNavigationBase); exports.paddingProperty = new properties_1.Property({ name: 'padding' }); exports.paddingProperty.register(BubbleNavigationBase); exports.elevationProperty = new properties_1.Property({ name: 'elevation' }); exports.elevationProperty.register(BubbleNavigationBase); var BubbleNavigationItemBase = (function (_super) { __extends(BubbleNavigationItemBase, _super); function BubbleNavigationItemBase(title, icon, colorActive, colorInactive) { var _this = _super.call(this) || this; _this._title = title; _this._icon = icon; if (colorActive) { _this._colorActive = colorActive; } if (colorInactive) { _this._colorInactive = colorInactive; } return _this; } Object.defineProperty(BubbleNavigationItemBase.prototype, "title", { get: function () { return this._title; }, set: function (value) { this._title = value; }, enumerable: true, configurable: true }); Object.defineProperty(BubbleNavigationItemBase.prototype, "icon", { get: function () { return this._icon; }, set: function (value) { if (this.icon !== value) { this._icon = value; } }, enumerable: true, configurable: true }); Object.defineProperty(BubbleNavigationItemBase.prototype, "colorActive", { get: function () { return this._colorActive; }, set: function (value) { if (this.colorActive !== value) { this._colorActive = value; } }, enumerable: true, configurable: true }); Object.defineProperty(BubbleNavigationItemBase.prototype, "colorInactive", { get: function () { return this._colorInactive; }, set: function (value) { if (this.colorInactive !== value) { this._colorInactive = value; } }, enumerable: true, configurable: true }); return BubbleNavigationItemBase; }(view_1.View)); exports.BubbleNavigationItemBase = BubbleNavigationItemBase; //# sourceMappingURL=bubble-navigation.common.js.map