nativescript-bottom-navigation
Advanced tools
Comparing version 1.4.4 to 1.5.0
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var nativescript_bottom_navigation_module_1 = require("./nativescript-bottom-navigation.module"); | ||
exports.NativescriptBottomNavigationModule = nativescript_bottom_navigation_module_1.NativescriptBottomNavigationModule; | ||
__export(require("./nativescript-bottom-navigation.module")); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var core_1 = require("@angular/core"); | ||
var lang_facade_1 = require("nativescript-angular/lang-facade"); | ||
var BottomNavigationDirective = (function () { | ||
function BottomNavigationDirective(element) { | ||
this.bottomNavigation = element.nativeElement; | ||
function BottomNavigationDirective() { | ||
} | ||
Object.defineProperty(BottomNavigationDirective.prototype, "titleVisibility", { | ||
get: function () { | ||
return this._titleVisibility; | ||
}, | ||
set: function (value) { | ||
this._titleVisibility = value; | ||
if (this._viewInitialized) { | ||
this.bottomNavigation.titleVisibility = value; | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(BottomNavigationDirective.prototype, "activeColor", { | ||
get: function () { | ||
return this._activeColor; | ||
}, | ||
set: function (value) { | ||
this._activeColor = value; | ||
if (this._viewInitialized) { | ||
this.bottomNavigation.activeColor = this._activeColor; | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(BottomNavigationDirective.prototype, "inactiveColor", { | ||
get: function () { | ||
return this._inactiveColor; | ||
}, | ||
set: function (value) { | ||
this._inactiveColor = value; | ||
if (this._viewInitialized) { | ||
this.bottomNavigation.inactiveColor = this._inactiveColor; | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(BottomNavigationDirective.prototype, "backgroundColor", { | ||
get: function () { | ||
return this._backgroundColor; | ||
}, | ||
set: function (value) { | ||
this._backgroundColor = value; | ||
if (this._viewInitialized) { | ||
this.bottomNavigation.backgroundColor = this._backgroundColor; | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(BottomNavigationDirective.prototype, "tabs", { | ||
get: function () { | ||
return this._tabs; | ||
}, | ||
set: function (value) { | ||
this._tabs = value; | ||
if (this._viewInitialized) { | ||
this.bottomNavigation.tabs = this._tabs; | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(BottomNavigationDirective.prototype, "selectedTabIndex", { | ||
get: function () { | ||
return this._selectedTabIndex; | ||
}, | ||
set: function (value) { | ||
this._selectedTabIndex = value; | ||
if (this._viewInitialized) { | ||
this.bottomNavigation.selectedTabIndex = this._selectedTabIndex; | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
BottomNavigationDirective.prototype.ngAfterViewInit = function () { | ||
this._viewInitialized = true; | ||
if (!lang_facade_1.isBlank(this._titleVisibility)) { | ||
this.bottomNavigation.titleVisibility = this._titleVisibility; | ||
} | ||
if (!lang_facade_1.isBlank(this._activeColor)) { | ||
this.bottomNavigation.activeColor = this._activeColor; | ||
} | ||
if (!lang_facade_1.isBlank(this._inactiveColor)) { | ||
this.bottomNavigation.inactiveColor = this._inactiveColor; | ||
} | ||
if (!lang_facade_1.isBlank(this._backgroundColor)) { | ||
this.bottomNavigation.backgroundColor = this._backgroundColor; | ||
} | ||
if (!lang_facade_1.isBlank(this._tabs)) { | ||
this.bottomNavigation.tabs = this._tabs; | ||
} | ||
if (!lang_facade_1.isBlank(this._selectedTabIndex)) { | ||
this.bottomNavigation.selectedTabIndex = this._selectedTabIndex; | ||
} | ||
}; | ||
BottomNavigationDirective.decorators = [ | ||
{ type: core_1.Directive, args: [{ | ||
selector: "BottomNavigation" | ||
},] }, | ||
]; | ||
BottomNavigationDirective.ctorParameters = function () { return [ | ||
{ type: core_1.ElementRef } | ||
]; }; | ||
BottomNavigationDirective.propDecorators = { | ||
titleVisibility: [{ type: core_1.Input }], | ||
activeColor: [{ type: core_1.Input }], | ||
inactiveColor: [{ type: core_1.Input }], | ||
backgroundColor: [{ type: core_1.Input }], | ||
tabs: [{ type: core_1.Input }], | ||
selectedTabIndex: [{ type: core_1.Input }] | ||
}; | ||
BottomNavigationDirective = __decorate([ | ||
core_1.Directive({ | ||
selector: "BottomNavigation" | ||
}) | ||
], BottomNavigationDirective); | ||
return BottomNavigationDirective; | ||
}()); | ||
exports.BottomNavigationDirective = BottomNavigationDirective; | ||
function BottomNavigationDirective_tsickle_Closure_declarations() { | ||
BottomNavigationDirective.prototype.bottomNavigation; | ||
BottomNavigationDirective.prototype._viewInitialized; | ||
BottomNavigationDirective.prototype._titleVisibility; | ||
BottomNavigationDirective.prototype._activeColor; | ||
BottomNavigationDirective.prototype._inactiveColor; | ||
BottomNavigationDirective.prototype._backgroundColor; | ||
BottomNavigationDirective.prototype._tabs; | ||
BottomNavigationDirective.prototype._selectedTabIndex; | ||
} | ||
var BottomNavigationTabDirective = (function () { | ||
function BottomNavigationTabDirective() { | ||
} | ||
Object.defineProperty(BottomNavigationTabDirective.prototype, "title", { | ||
get: function () { | ||
return this._title; | ||
}, | ||
set: function (value) { | ||
this._title = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(BottomNavigationTabDirective.prototype, "icon", { | ||
get: function () { | ||
return this._icon; | ||
}, | ||
set: function (value) { | ||
this._icon = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(BottomNavigationTabDirective.prototype, "selectable", { | ||
get: function () { | ||
return this._selectable; | ||
}, | ||
set: function (value) { | ||
this._selectable = value; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
BottomNavigationTabDirective.decorators = [ | ||
{ type: core_1.Directive, args: [{ | ||
selector: "BottomNavigationTab" | ||
},] }, | ||
]; | ||
BottomNavigationTabDirective.propDecorators = { | ||
title: [{ type: core_1.Input }], | ||
icon: [{ type: core_1.Input }], | ||
_selectable: [{ type: core_1.Input }] | ||
}; | ||
BottomNavigationTabDirective = __decorate([ | ||
core_1.Directive({ | ||
selector: "BottomNavigationTab" | ||
}) | ||
], BottomNavigationTabDirective); | ||
return BottomNavigationTabDirective; | ||
}()); | ||
exports.BottomNavigationTabDirective = BottomNavigationTabDirective; | ||
function BottomNavigationTabDirective_tsickle_Closure_declarations() { | ||
BottomNavigationTabDirective.prototype._title; | ||
BottomNavigationTabDirective.prototype._icon; | ||
BottomNavigationTabDirective.prototype._selectable; | ||
} | ||
exports.DIRECTIVES = [BottomNavigationDirective, BottomNavigationTabDirective]; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"BottomNavigationDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":4,"character":1},"arguments":[{"selector":"BottomNavigation"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":14,"character":23}]}],"titleVisibility":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":20,"character":3}}]}],"activeColor":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"inactiveColor":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":48,"character":3}}]}],"backgroundColor":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":62,"character":3}}]}],"tabs":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":76,"character":3}}]}],"selectedTabIndex":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":90,"character":3}}]}],"ngAfterViewInit":[{"__symbolic":"method"}]}},"BottomNavigationTabDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":113,"character":1},"arguments":[{"selector":"BottomNavigationTab"}]}],"members":{"title":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":122,"character":3}}]}],"icon":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":133,"character":3}}]}],"_selectable":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":142,"character":3}}]}]}},"DIRECTIVES":[{"__symbolic":"reference","name":"BottomNavigationDirective"},{"__symbolic":"reference","name":"BottomNavigationTabDirective"}]}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"BottomNavigationDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"BottomNavigation"}]}]},"BottomNavigationTabDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":7,"character":1},"arguments":[{"selector":"BottomNavigationTab"}]}]},"DIRECTIVES":[{"__symbolic":"reference","name":"BottomNavigationDirective"},{"__symbolic":"reference","name":"BottomNavigationTabDirective"}]}}] |
@@ -9,8 +9,8 @@ "use strict"; | ||
} | ||
NativescriptBottomNavigationModule.decorators = [ | ||
{ type: core_1.NgModule, args: [{ | ||
declarations: [nativescript_bottom_navigation_directives_1.DIRECTIVES], | ||
exports: [nativescript_bottom_navigation_directives_1.DIRECTIVES], | ||
},] }, | ||
]; | ||
NativescriptBottomNavigationModule = __decorate([ | ||
core_1.NgModule({ | ||
declarations: [nativescript_bottom_navigation_directives_1.DIRECTIVES], | ||
exports: [nativescript_bottom_navigation_directives_1.DIRECTIVES], | ||
}) | ||
], NativescriptBottomNavigationModule); | ||
return NativescriptBottomNavigationModule; | ||
@@ -17,0 +17,0 @@ }()); |
{ | ||
"name": "nativescript-bottom-navigation", | ||
"main": "index.js" | ||
} |
@@ -12,3 +12,9 @@ "use strict"; | ||
function BottomNavigation() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.titleVisibilityOptions = { | ||
always: AHBottomNavigation.TitleState.ALWAYS_SHOW, | ||
never: AHBottomNavigation.TitleState.ALWAYS_HIDE, | ||
selected: AHBottomNavigation.TitleState.SHOW_WHEN_ACTIVE, | ||
}; | ||
return _this; | ||
} | ||
@@ -23,4 +29,4 @@ Object.defineProperty(BottomNavigation.prototype, "android", { | ||
BottomNavigation.prototype.createNativeView = function () { | ||
var owner = new WeakRef(this); | ||
this.nativeView = new AHBottomNavigation(this._context); | ||
var owner = new WeakRef(this); | ||
this.nativeView.setOnTabSelectedListener(new AHBottomNavigation.OnTabSelectedListener({ | ||
@@ -35,2 +41,5 @@ get owner() { | ||
} | ||
if (wasSelected && bottomNavigationTab.selectable) { | ||
this.owner.onTabReselected(position); | ||
} | ||
if (!wasSelected && !bottomNavigationTab.selectable) { | ||
@@ -61,3 +70,2 @@ this.owner.onTabPressed(position); | ||
} | ||
this.nativeView.setCurrentItem(this.selectedTabIndex); | ||
}; | ||
@@ -74,13 +82,3 @@ BottomNavigation.prototype[bottom_navigation_common_1.tabsProperty.getDefault] = function () { | ||
BottomNavigation.prototype[bottom_navigation_common_1.titleVisibilityProperty.setNative] = function (value) { | ||
switch (value) { | ||
case 'never': | ||
this.nativeView.setTitleState(AHBottomNavigation.TitleState.ALWAYS_HIDE); | ||
break; | ||
case 'always': | ||
this.nativeView.setTitleState(AHBottomNavigation.TitleState.ALWAYS_SHOW); | ||
break; | ||
default: | ||
this.nativeView.setTitleState(AHBottomNavigation.TitleState.SHOW_WHEN_ACTIVE); | ||
break; | ||
} | ||
this.nativeView.setTitleState(this.titleVisibilityOptions[value]); | ||
}; | ||
@@ -87,0 +85,0 @@ BottomNavigation.prototype[bottom_navigation_common_1.activeColorProperty.setNative] = function (activeColor) { |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"BottomNavigation":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./bottom-navigation.common","name":"BottomNavigationBase","line":24,"character":38},"members":{"createNativeView":[{"__symbolic":"method"}],"initNativeView":[{"__symbolic":"method"}],"createTabs":[{"__symbolic":"method"}],"selectTabNative":[{"__symbolic":"method"}]}},"BottomNavigationTab":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./bottom-navigation.common","name":"BottomNavigationTabBase","line":140,"character":41},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"error","message":"Could not resolve type","line":141,"character":74,"context":{"typeName":"WeakRef"}}]}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"BottomNavigation":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./bottom-navigation.common","name":"BottomNavigationBase","line":25,"character":38},"members":{"createNativeView":[{"__symbolic":"method"}],"initNativeView":[{"__symbolic":"method"}],"createTabs":[{"__symbolic":"method"}],"selectTabNative":[{"__symbolic":"method"}]}},"BottomNavigationTab":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./bottom-navigation.common","name":"BottomNavigationTabBase","line":138,"character":41},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"error","message":"Could not resolve type","line":139,"character":74,"context":{"typeName":"WeakRef"}}]}]}}}}] |
@@ -8,13 +8,2 @@ "use strict"; | ||
var view_base_1 = require("tns-core-modules/ui/core/view-base"); | ||
function OnTabPressedEventData() { } | ||
exports.OnTabPressedEventData = OnTabPressedEventData; | ||
function OnTabPressedEventData_tsickle_Closure_declarations() { | ||
OnTabPressedEventData.prototype.index; | ||
} | ||
function OnTabSelectedEventData() { } | ||
exports.OnTabSelectedEventData = OnTabSelectedEventData; | ||
function OnTabSelectedEventData_tsickle_Closure_declarations() { | ||
OnTabSelectedEventData.prototype.oldIndex; | ||
OnTabSelectedEventData.prototype.newIndex; | ||
} | ||
var BottomNavigationBase = (function (_super) { | ||
@@ -41,6 +30,14 @@ __extends(BottomNavigationBase, _super); | ||
object: this, | ||
index: index | ||
index: index, | ||
}; | ||
this.notify(eventData); | ||
}; | ||
BottomNavigationBase.prototype.onTabReselected = function (index) { | ||
var eventData = { | ||
eventName: 'tabReselected', | ||
object: this, | ||
index: index, | ||
}; | ||
this.notify(eventData); | ||
}; | ||
BottomNavigationBase.prototype.onTabSelected = function (index) { | ||
@@ -59,5 +56,5 @@ var eventData = { | ||
if (!this.tabs) { | ||
this.tabs = ([]); | ||
this.tabs = []; | ||
} | ||
this.tabs.push((value)); | ||
this.tabs.push(value); | ||
} | ||
@@ -68,12 +65,2 @@ }; | ||
exports.BottomNavigationBase = BottomNavigationBase; | ||
function BottomNavigationBase_tsickle_Closure_declarations() { | ||
BottomNavigationBase.prototype.tabs; | ||
BottomNavigationBase.prototype.selectedTabIndex; | ||
BottomNavigationBase.prototype.titleVisibility; | ||
BottomNavigationBase.prototype.activeColor; | ||
BottomNavigationBase.prototype.inactiveColor; | ||
BottomNavigationBase.prototype.backgroundColor; | ||
BottomNavigationBase.prototype.keyLineColor; | ||
BottomNavigationBase.prototype.selectTabNative = function (index) { }; | ||
} | ||
exports.tabsProperty = new properties_1.Property({ | ||
@@ -169,3 +156,3 @@ name: 'tabs', | ||
get: function () { | ||
return view_base_1.booleanConverter((this._selectable)); | ||
return view_base_1.booleanConverter(this._selectable); | ||
}, | ||
@@ -193,7 +180,1 @@ set: function (value) { | ||
exports.BottomNavigationTabBase = BottomNavigationTabBase; | ||
function BottomNavigationTabBase_tsickle_Closure_declarations() { | ||
BottomNavigationTabBase.prototype._title; | ||
BottomNavigationTabBase.prototype._icon; | ||
BottomNavigationTabBase.prototype._selectable; | ||
BottomNavigationTabBase.prototype._parent; | ||
} |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"OnTabPressedEventData":{"__symbolic":"interface"},"OnTabSelectedEventData":{"__symbolic":"interface"},"TitleVisibility":{"__symbolic":"interface"},"BottomNavigationBase":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"tns-core-modules/ui/core/view","name":"View","line":24,"character":51},"members":{"selectTab":[{"__symbolic":"method"}],"onTabPressed":[{"__symbolic":"method"}],"onTabSelected":[{"__symbolic":"method"}],"_addChildFromBuilder":[{"__symbolic":"method"}],"selectTabNative":[{"__symbolic":"method"}]}},"tabsProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":103,"character":32},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":106,"character":22}]},"titleVisibilityProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":112,"character":43},"arguments":[{"name":"titleVisibility"}]},"activeColorProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":120,"character":39},"arguments":[{"name":"activeColor"}]},"activeColorCssProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"CssProperty","line":128,"character":42},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":133,"character":20}]},"inactiveColorProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":137,"character":41},"arguments":[{"name":"inactiveColor"}]},"inactiveColorCssProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"CssProperty","line":145,"character":44},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":150,"character":20}]},"backgroundColorProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":155,"character":43},"arguments":[{"name":"backgroundColor"}]},"backgroundColorCssProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"CssProperty","line":163,"character":46},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":168,"character":20}]},"keyLineColorProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":173,"character":40},"arguments":[{"name":"keyLineColor"}]},"keyLineColorCssProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"CssProperty","line":181,"character":43},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":186,"character":20}]},"BottomNavigationTabBase":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"error","message":"Could not resolve type","line":198,"character":13,"context":{"typeName":"WeakRef"}}]}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"OnTabPressedEventData":{"__symbolic":"interface"},"OnTabReselectedEventData":{"__symbolic":"interface"},"OnTabSelectedEventData":{"__symbolic":"interface"},"TitleVisibility":{"__symbolic":"interface"},"TitleVisibilityOptions":{"__symbolic":"interface"},"BottomNavigationBase":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"tns-core-modules/ui/core/view","name":"View","line":33,"character":51},"members":{"selectTab":[{"__symbolic":"method"}],"onTabPressed":[{"__symbolic":"method"}],"onTabReselected":[{"__symbolic":"method"}],"onTabSelected":[{"__symbolic":"method"}],"_addChildFromBuilder":[{"__symbolic":"method"}],"selectTabNative":[{"__symbolic":"method"}]}},"tabsProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":123,"character":32},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":126,"character":22}]},"titleVisibilityProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":132,"character":43},"arguments":[{"name":"titleVisibility"}]},"activeColorProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":140,"character":39},"arguments":[{"name":"activeColor"}]},"activeColorCssProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"CssProperty","line":148,"character":42},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":153,"character":20}]},"inactiveColorProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":157,"character":41},"arguments":[{"name":"inactiveColor"}]},"inactiveColorCssProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"CssProperty","line":165,"character":44},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":170,"character":20}]},"backgroundColorProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":175,"character":43},"arguments":[{"name":"backgroundColor"}]},"backgroundColorCssProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"CssProperty","line":183,"character":46},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":188,"character":20}]},"keyLineColorProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"Property","line":193,"character":40},"arguments":[{"name":"keyLineColor"}]},"keyLineColorCssProperty":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"tns-core-modules/ui/core/properties","name":"CssProperty","line":201,"character":43},"arguments":[{"__symbolic":"error","message":"Lambda not supported","line":206,"character":20}]},"BottomNavigationTabBase":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"error","message":"Could not resolve type","line":218,"character":13,"context":{"typeName":"WeakRef"}}]}]}}}}] |
@@ -15,3 +15,3 @@ "use strict"; | ||
BottomNavigationDelegate.initWithOwner = function (owner) { | ||
var delegate = ((BottomNavigationDelegate.new())); | ||
var delegate = BottomNavigationDelegate.new(); | ||
delegate._owner = owner; | ||
@@ -23,2 +23,3 @@ return delegate; | ||
if (bottomNavigation.selectedTabIndex === item.tag) { | ||
bottomNavigation.onTabReselected(item.tag); | ||
return; | ||
@@ -40,10 +41,12 @@ } | ||
exports.BottomNavigationDelegate = BottomNavigationDelegate; | ||
function BottomNavigationDelegate_tsickle_Closure_declarations() { | ||
BottomNavigationDelegate.ObjCProtocols; | ||
BottomNavigationDelegate.prototype._owner; | ||
} | ||
var BottomNavigation = (function (_super) { | ||
__extends(BottomNavigation, _super); | ||
function BottomNavigation() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.titleVisibilityOptions = { | ||
never: MDCBottomNavigationBarTitleVisibilityNever, | ||
always: MDCBottomNavigationBarTitleVisibilityAlways, | ||
selected: MDCBottomNavigationBarTitleVisibilitySelected, | ||
}; | ||
return _this; | ||
} | ||
@@ -87,3 +90,3 @@ Object.defineProperty(BottomNavigation.prototype, "ios", { | ||
var frame = CGRectMake(0, view_1.layout.toDeviceIndependentPixels(top), viewSize.width, bottomBarHeight); | ||
((this))._setNativeViewFrame(nativeView, frame); | ||
this._setNativeViewFrame(nativeView, frame); | ||
}; | ||
@@ -109,13 +112,3 @@ BottomNavigation.prototype.createTabs = function (tabs) { | ||
BottomNavigation.prototype[bottom_navigation_common_1.titleVisibilityProperty.setNative] = function (value) { | ||
switch (value) { | ||
case 'never': | ||
this.nativeView.titleVisibility = MDCBottomNavigationBarTitleVisibilityNever; | ||
break; | ||
case 'always': | ||
this.nativeView.titleVisibility = MDCBottomNavigationBarTitleVisibilityAlways; | ||
break; | ||
default: | ||
this.nativeView.titleVisibility = MDCBottomNavigationBarTitleVisibilitySelected; | ||
break; | ||
} | ||
this.nativeView.titleVisibility = this.titleVisibilityOptions[value]; | ||
}; | ||
@@ -150,5 +143,2 @@ BottomNavigation.prototype[bottom_navigation_common_1.activeColorProperty.setNative] = function (activeColor) { | ||
exports.BottomNavigation = BottomNavigation; | ||
function BottomNavigation_tsickle_Closure_declarations() { | ||
BottomNavigation.prototype._delegate; | ||
} | ||
var BottomNavigationTab = (function (_super) { | ||
@@ -155,0 +145,0 @@ __extends(BottomNavigationTab, _super); |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"MDCBottomNavigationBarDelegate":{"__symbolic":"class"},"BottomNavigationDelegate":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"NSObject"},"members":{"bottomNavigationBarDidSelectItem":[{"__symbolic":"method"}],"bottomNavigationBarShouldSelectItem":[{"__symbolic":"method"}]},"statics":{"ObjCProtocols":[{"__symbolic":"reference","name":"MDCBottomNavigationBarDelegate"}]}},"BottomNavigation":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./bottom-navigation.common","name":"BottomNavigationBase","line":62,"character":38},"members":{"createNativeView":[{"__symbolic":"method"}],"initNativeView":[{"__symbolic":"method"}],"disposeNativeView":[{"__symbolic":"method"}],"onLoaded":[{"__symbolic":"method"}],"layoutNativeView":[{"__symbolic":"method"}],"createTabs":[{"__symbolic":"method"}],"selectTabNative":[{"__symbolic":"method"}]}},"BottomNavigationTab":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./bottom-navigation.common","name":"BottomNavigationTabBase","line":190,"character":41},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"error","message":"Could not resolve type","line":192,"character":74,"context":{"typeName":"WeakRef"}}]}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"MDCBottomNavigationBarDelegate":{"__symbolic":"class"},"BottomNavigationDelegate":{"__symbolic":"class","extends":{"__symbolic":"reference","name":"NSObject"},"members":{"bottomNavigationBarDidSelectItem":[{"__symbolic":"method"}],"bottomNavigationBarShouldSelectItem":[{"__symbolic":"method"}]},"statics":{"ObjCProtocols":[{"__symbolic":"reference","name":"MDCBottomNavigationBarDelegate"}]}},"BottomNavigation":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./bottom-navigation.common","name":"BottomNavigationBase","line":66,"character":38},"members":{"createNativeView":[{"__symbolic":"method"}],"initNativeView":[{"__symbolic":"method"}],"disposeNativeView":[{"__symbolic":"method"}],"onLoaded":[{"__symbolic":"method"}],"layoutNativeView":[{"__symbolic":"method"}],"createTabs":[{"__symbolic":"method"}],"selectTabNative":[{"__symbolic":"method"}]}},"BottomNavigationTab":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./bottom-navigation.common","name":"BottomNavigationTabBase","line":189,"character":41},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"boolean"},{"__symbolic":"error","message":"Could not resolve type","line":191,"character":74,"context":{"typeName":"WeakRef"}}]}]}}}}] |
import { EventData } from 'tns-core-modules/data/observable'; | ||
import { AddChildFromBuilder, View } from 'tns-core-modules/ui/core/view'; | ||
import { BottomNavigationBase, BottomNavigationTabBase } from './bottom-navigation.common'; | ||
@@ -8,2 +9,6 @@ export declare interface OnTabPressedEventData extends EventData { | ||
export declare interface OnTabReselectedEventData extends EventData { | ||
index: number; | ||
} | ||
export declare interface OnTabSelectedEventData extends EventData { | ||
@@ -16,41 +21,7 @@ oldIndex: number; | ||
export declare abstract class BottomNavigationBase extends View implements AddChildFromBuilder { | ||
export declare class BottomNavigation extends BottomNavigationBase { | ||
public tabs: BottomNavigationTabBase[]; | ||
protected titleVisibilityOptions; | ||
public selectedTabIndex: number; | ||
public titleVisibility: TitleVisibility; | ||
public activeColor: string; | ||
public inactiveColor: string; | ||
public backgroundColor: string; | ||
@Deprecated | ||
public keyLineColor: string; | ||
public selectTab(index: number): void; | ||
_addChildFromBuilder(name: string, value: any): void; | ||
protected abstract selectTabNative(index: number): void; | ||
} | ||
export declare class BottomNavigationTabBase { | ||
public title: string; | ||
public icon: string; | ||
public selectable: boolean; | ||
parent: WeakRef<BottomNavigationBase>; | ||
constructor(title: string, icon: string, selectable?: boolean, parent?: WeakRef<BottomNavigationBase>); | ||
} | ||
export declare class BottomNavigation extends BottomNavigationBase { | ||
readonly android: any; | ||
readonly ios: any; | ||
@@ -57,0 +28,0 @@ |
{ | ||
"name": "nativescript-bottom-navigation", | ||
"version": "1.4.4", | ||
"version": "1.5.0", | ||
"description": "Nativescript plugin to add a bottom navigation component for Android & iOS", | ||
@@ -15,5 +15,5 @@ "main": "bottom-navigation", | ||
"tsc": "tsc -skipLibCheck", | ||
"ngc": "node --max-old-space-size=8192 ./node_modules/.bin/ngc", | ||
"build": "npm i && tsc && tns plugin build && npm run ngc", | ||
"build.iosOnly": "npm i && tsc && npm run ngc", | ||
"ngc.clean": "find ./ angular/ -name '*.metadata.json' -delete", | ||
"ngc": "npm i && npm run ngc.clean && node --max-old-space-size=8192 node_modules/.bin/ngc -skipLibCheck -p tsconfig.json", | ||
"build": "npm i && tsc && npm run ngc", | ||
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'", | ||
@@ -27,13 +27,19 @@ "prepublishOnly": "npm run build", | ||
"plugin.angular.link": "npm link && cd ../demo-angular && npm link nativescript-bottom-navigation && cd ../src", | ||
"plugin.vue.link": "npm link && cd ../demo-vue && npm link nativescript-bottom-navigation && cd ../src", | ||
"plugin.tscwatch": "npm run tsc -- -w", | ||
"demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios --syncAllFiles", | ||
"demo.angular.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios --syncAllFiles", | ||
"demo.android": "npm i && npm run tsc && cd ../demo && tns run android --syncAllFiles", | ||
"demo.angular.android": "npm i && npm run tsc && cd ../demo-angular && tns run android --syncAllFiles", | ||
"demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios --bundle --syncAllFiles", | ||
"demo.angular.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios --bundle --syncAllFiles", | ||
"demo.vue.ios": "npm i && npm run tsc && cd ../demo-vue && tns run ios --bundle --syncAllFiles", | ||
"demo.android": "npm i && npm run tsc && cd ../demo && tns run android --bundle --syncAllFiles", | ||
"demo.angular.android": "npm i && npm run tsc && cd ../demo-angular && tns run android --bundle --syncAllFiles", | ||
"demo.vue.android": "npm i && npm run tsc && cd ../demo-vue && tns run android --bundle --syncAllFiles", | ||
"demo.reset": "cd ../demo && rimraf platforms", | ||
"demo.angular.reset": "cd ../demo-angular && rimraf platforms", | ||
"demo.vue.reset": "cd ../demo-vue && rimraf platforms", | ||
"plugin.prepare": "npm run build && cd ../demo && tns plugin remove nativescript-bottom-navigation && tns plugin add ../src", | ||
"plugin.angular.prepare": "npm run build && cd ../demo-angular && tns plugin remove nativescript-bottom-navigation && tns plugin add ../src", | ||
"plugin.vue.prepare": "npm run build && cd ../demo-vue && tns plugin remove nativescript-bottom-navigation && tns plugin add ../src", | ||
"clean": "cd ../demo && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.link", | ||
"clean.angular": "cd ../demo-angular && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.angular.link" | ||
"clean.angular": "cd ../demo-angular && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.angular.link", | ||
"clean.vue": "cd ../demo-vue && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.vue.link" | ||
}, | ||
@@ -49,3 +55,4 @@ "keywords": [ | ||
"Bottom Navigation", | ||
"Material Design" | ||
"Material Design", | ||
"Tab Navigation" | ||
], | ||
@@ -64,14 +71,15 @@ "author": { | ||
"devDependencies": { | ||
"tns-core-modules": "^4.0.0", | ||
"tns-platform-declarations": "^4.0.0", | ||
"typescript": "~2.7.2", | ||
"nativescript-angular": "~6.0.6", | ||
"@angular/core": "~6.0.6", | ||
"@angular/common": "~6.0.6", | ||
"@angular/compiler": "~6.0.6", | ||
"@angular/compiler-cli": "~6.0.6", | ||
"rxjs": "5.4.2", | ||
"zone.js": "~0.8.4", | ||
"tslint": "~5.4.3" | ||
"@angular/common": "~7.1.0", | ||
"@angular/compiler": "~7.1.0", | ||
"@angular/compiler-cli": "~7.1.0", | ||
"@angular/core": "~7.1.0", | ||
"nativescript-angular": "~7.1.0", | ||
"rxjs": "^6.3.3", | ||
"tns-core-modules": "^5.1.0", | ||
"tns-platform-declarations": "^5.1.1", | ||
"tsickle": "^0.34.0", | ||
"tslint": "~5.11.0", | ||
"typescript": "~3.1.6", | ||
"zone.js": "~0.8.26" | ||
} | ||
} |
@@ -49,3 +49,2 @@ # Nativescript Bottom Navigation | ||
backgroundColor="black" | ||
keyLineColor="black" | ||
loaded="bottomNavigationLoaded" | ||
@@ -104,3 +103,2 @@ row="1"></bottomNav:BottomNavigation> | ||
backgroundColor="black" | ||
keyLineColor="black" | ||
loaded="bottomNavigationLoaded" | ||
@@ -165,3 +163,2 @@ row="1"> | ||
backgroundColor="black" | ||
keyLineColor="black" | ||
(tabSelected)="onBottomNavigationTabSelected($event)" | ||
@@ -183,3 +180,2 @@ (tabPressed)="onBottomNavigationTabPressed($event)" | ||
backgroundColor="black" | ||
keyLineColor="black" | ||
(tabSelected)="onBottomNavigationTabSelected($event)" | ||
@@ -226,10 +222,11 @@ (tabPressed)="onBottomNavigationTabPressed($event)" | ||
If you want to use this plugin with Vue, the only thing you have to do is register de element in your `app.js` or `main.js` as I'll show you below: | ||
If you want to use this plugin with Vue, do this in your `app.js` or `main.js`: | ||
```javascript | ||
Vue.registerElement('BottomNavigation', () => require('nativescript-bottom-navigation').BottomNavigation); | ||
Vue.registerElement('BottomNavigationTab', () => require('nativescript-bottom-navigation').BottomNavigationTab); | ||
import BottomNavigation from 'nativescript-bottom-navigation/vue'; | ||
Vue.use(BottomNavigation) | ||
``` | ||
This will register `BottomNavigation` and `BottomNavigationTab` to your `Vue` instance and now you can use the plugin as follows: | ||
This will install and register `BottomNavigation` and `BottomNavigationTab` components to your `Vue` instance and now you can use the plugin as follows: | ||
@@ -244,3 +241,2 @@ ```xml | ||
backgroundColor="black" | ||
keyLineColor="black" | ||
@tabSelected="onBottomNavigationTabSelected" | ||
@@ -285,3 +281,3 @@ row="1"> | ||
| tabs | true | null | `Array<BottomNavigationTab>` | Array containing the tabs for the BottomNavigation | | ||
| titleVisibility | false | "selected" | `"selected" | "always" | "never"` | Title Visibility of each BottomNavigationTab | | ||
| titleVisibility | false | "selected" | `"selected" | "always" | "never"` | Title Visibility for each BottomNavigationTab | | ||
| activeColor | false | "blue" | `String` | Color of the BottomNavigationTab when it's selected | | ||
@@ -296,2 +292,3 @@ | inactiveColor | false | "gray" | `String` | Color of the BottomNavigationTab when it's not selected | | ||
| tabSelected | false | null | `function ($event: OnTabSelectedEventData) {}` | Function fired every time the user select a new tab that receive an event object | | ||
| tabReselected | false | null | `function ($event: OnTabReselectedEventData) {}` | Function fired every time the user select a tab that is already selected and receive an event object | | ||
| tabPressed | false | null | `function ($event: OnTabPressedEventData) {}` | Function fired every time the user tap a tab with `selectable: false` that receive an event object | | ||
@@ -298,0 +295,0 @@ |
78630
12
531
310