vue-nav-tabs
Advanced tools
Comparing version 0.5.6 to 0.5.7
/*! | ||
* vue-nav-tabs v0.5.6 | ||
* (c) 2017-present cristij <joracristi@gmail.com> | ||
* vue-nav-tabs v0.5.7 | ||
* (c) 2018-present cristij <joracristi@gmail.com> | ||
* Released under the MIT License. | ||
@@ -10,2 +10,6 @@ */ | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var _mergeJSXProps = _interopDefault(require('babel-helper-vue-jsx-merge-props')); | ||
var VueTabs = { | ||
@@ -83,3 +87,3 @@ name: 'vue-tabs', | ||
changeTab: function changeTab(oldIndex, newIndex, route) { | ||
var oldTab = this.tabs[oldIndex]; | ||
var oldTab = this.tabs[oldIndex] || {}; | ||
var newTab = this.tabs[newIndex]; | ||
@@ -147,2 +151,9 @@ if (newTab.disabled) return; | ||
if (tab.$slots.title) return tab.$slots.title; | ||
if (tab.$scopedSlots.title) return tab.$scopedSlots.title({ | ||
active: active, | ||
title: title, | ||
position: position, | ||
icon: tab.icon, | ||
data: tab.tabData | ||
}); | ||
return simpleTitle; | ||
@@ -189,3 +200,3 @@ }, | ||
'li', | ||
{ | ||
_mergeJSXProps([{ | ||
attrs: { name: 'tab', | ||
@@ -196,25 +207,39 @@ id: 't-' + tabId, | ||
role: 'tab' }, | ||
'class': ['tab', { active: active }, { disabled: tab.disabled }], | ||
key: title }, { | ||
on: { | ||
'click': function click() { | ||
return !tab.disabled && _this.navigateToTab(index, route); | ||
'click': function click($event) { | ||
for (var _len = arguments.length, attrs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
attrs[_key - 1] = arguments[_key]; | ||
} | ||
(function () { | ||
return !tab.disabled && _this.navigateToTab(index, route); | ||
}).apply(undefined, [$event].concat(attrs)); | ||
} | ||
}, | ||
'class': ['tab', { active: active }, { disabled: tab.disabled }], | ||
key: title }, | ||
} | ||
}]), | ||
[_this.textPosition === 'top' && _this.renderTabTitle(index, _this.textPosition), h( | ||
'a', | ||
{ | ||
_mergeJSXProps([{ | ||
attrs: { href: '#', | ||
role: 'tab' }, | ||
style: active ? _this.activeTabStyle : _this.tabStyles(tab), | ||
'class': [{ 'active_tab': active }, 'tabs__link'] }, { | ||
on: { | ||
'click': function click(e) { | ||
e.preventDefault(); | ||
return false; | ||
'click': function click($event) { | ||
for (var _len2 = arguments.length, attrs = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
attrs[_key2 - 1] = arguments[_key2]; | ||
} | ||
(function (e) { | ||
e.preventDefault(); | ||
return false; | ||
}).apply(undefined, [$event].concat(attrs)); | ||
} | ||
}, | ||
style: active ? _this.activeTabStyle : _this.tabStyles(tab), | ||
'class': [{ 'active_tab': active }, 'tabs__link'] }, | ||
} | ||
}]), | ||
[_this.textPosition !== 'center' && !tab.$slots.title && _this.renderIcon(index), _this.textPosition === 'center' && _this.renderTabTitle(index, _this.textPosition)] | ||
@@ -284,2 +309,5 @@ ), _this.textPosition === 'bottom' && _this.renderTabTitle(index, _this.textPosition)] | ||
}, | ||
tabData: { | ||
default: null | ||
}, | ||
/*** | ||
@@ -286,0 +314,0 @@ * Function to execute before tab switch. Return value must be boolean |
/*! | ||
* vue-nav-tabs v0.5.6 | ||
* (c) 2017-present cristij <joracristi@gmail.com> | ||
* vue-nav-tabs v0.5.7 | ||
* (c) 2018-present cristij <joracristi@gmail.com> | ||
* Released under the MIT License. | ||
*/ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var VueTabs={name:"vue-tabs",props:{activeTabColor:String,activeTextColor:String,disabledColor:String,disabledTextColor:String,textPosition:{type:String,default:"center"},type:{type:String,default:"tabs"},direction:{type:String,default:"horizontal"},centered:Boolean,value:[String,Number,Object]},data:function(){return{activeTabIndex:0,tabs:[]}},computed:{isTabShape:function(){return"tabs"===this.type},isStacked:function(){return"vertical"===this.direction},classList:function(){return"nav "+(this.isTabShape?"nav-tabs":"nav-pills")+" "+(this.centered?"nav-justified":"")+" "+(this.isStacked?"nav-stacked":"")},stackedClass:function(){return this.isStacked?"stacked":""},activeTabStyle:function(){return{backgroundColor:this.activeTabColor,color:this.activeTextColor}}},methods:{navigateToTab:function(t,e){this.changeTab(this.activeTabIndex,t,e)},activateTab:function(t){this.activeTabIndex=t;var e=this.tabs[t];e.active=!0,this.$emit("input",e.title)},changeTab:function(t,e,i){var a=this.tabs[t],n=this.tabs[e];n.disabled||(this.activeTabIndex=e,a.active=!1,n.active=!0,this.$emit("input",this.tabs[e].title),this.$emit("tab-change",e,n,a),this.tryChangeRoute(i))},tryChangeRoute:function(t){this.$router&&t&&this.$router.push(t)},addTab:function(t){var e=this.$slots.default.indexOf(t.$vnode);this.tabs.splice(e,0,t)},removeTab:function(t){var e=this.tabs,i=e.indexOf(t);i>-1&&e.splice(i,1)},getTabs:function(){return this.$slots.default?this.$slots.default.filter(function(t){return t.componentOptions}):[]},findTabAndActivate:function(t){var e=this.tabs.findIndex(function(e,i){return e.title===t||i===t});e!==this.activeTabIndex&&(-1!==e?this.changeTab(this.activeTabIndex,e):this.changeTab(this.activeTabIndex,0))},renderTabTitle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",i=this.$createElement;if(0!==this.tabs.length){var a=this.tabs[t],n=a.active,s=a.title,r={color:this.activeTabColor};"center"===e&&(r.color=this.activeTextColor);var o=i("span",{class:"title title_"+e,style:n?r:{}},["center"===e&&this.renderIcon(t),s]);return a.$slots.title?a.$slots.title:o}},renderIcon:function(t){var e=this.$createElement;if(0!==this.tabs.length){var i=this.tabs[t],a=i.icon,n=e("i",{class:a},[" "]);return!i.$slots.title&&a?n:void 0}},tabStyles:function(t){return t.disabled?{backgroundColor:this.disabledColor,color:this.disabledTextColor}:{}},renderTabs:function(){var t=this,e=this.$createElement;return this.tabs.map(function(i,a){if(i){var n=i.route,s=(i.id,i.title),r=(i.icon,i.tabId),o=t.activeTabIndex===a;return e("li",{attrs:{name:"tab",id:"t-"+r,"aria-selected":o,"aria-controls":"p-"+r,role:"tab"},on:{click:function(){return!i.disabled&&t.navigateToTab(a,n)}},class:["tab",{active:o},{disabled:i.disabled}],key:s},["top"===t.textPosition&&t.renderTabTitle(a,t.textPosition),e("a",{attrs:{href:"#",role:"tab"},on:{click:function(t){return t.preventDefault(),!1}},style:o?t.activeTabStyle:t.tabStyles(i),class:[{active_tab:o},"tabs__link"]},["center"!==t.textPosition&&!i.$slots.title&&t.renderIcon(a),"center"===t.textPosition&&t.renderTabTitle(a,t.textPosition)]),"bottom"===t.textPosition&&t.renderTabTitle(a,t.textPosition)])}})}},render:function(){var t=arguments[0],e=this.renderTabs();return t("div",{class:["vue-tabs",this.stackedClass]},[t("div",{class:[{"nav-tabs-navigation":!this.isStacked},{"left-vertical-tabs":this.isStacked}]},[t("div",{class:["nav-tabs-wrapper",this.stackedClass]},[t("ul",{class:this.classList,attrs:{role:"tablist"}},[e])])]),t("div",{class:["tab-content",{"right-text-tabs":this.isStacked}]},[this.$slots.default])])},watch:{tabs:function(t){t.length>0&&!this.value&&(t.length<=this.activeTabIndex?this.activateTab(this.activeTabIndex-1):this.activateTab(this.activeTabIndex)),t.length>0&&this.value&&this.findTabAndActivate(this.value)},value:function(t){this.findTabAndActivate(t)}}},VTab={name:"v-tab",props:{title:{type:String,default:""},icon:{type:String,default:""},beforeChange:{type:Function},id:String,route:{type:[String,Object]},disabled:Boolean,transitionName:String,transitionMode:String},computed:{isValidParent:function(){return"vue-tabs"===this.$parent.$options.name},hash:function(){return"#"+this.id},tabId:function(){return this.id?this.id:this.title}},data:function(){return{active:!1,validationError:null}},mounted:function(){this.$parent.addTab(this)},destroyed:function(){this.$el&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el),this.$parent.removeTab(this)},render:function(){return(0,arguments[0])("section",{class:"tab-container",attrs:{id:"p-"+this.tabId,"aria-labelledby":"t-"+this.tabId,role:"tabpanel"},directives:[{name:"show",value:this.active}]},[this.$slots.default])}},VueTabsPlugin={install:function(t){t.component("vue-tabs",VueTabs),t.component("v-tab",VTab)}};"undefined"!=typeof window&&window.Vue&&(window.Vue.use(VueTabsPlugin),window.VueTabs=VueTabsPlugin),exports.default=VueTabsPlugin,exports.VueTabs=VueTabs,exports.VTab=VTab; | ||
"use strict";function _interopDefault(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var _mergeJSXProps=_interopDefault(require("babel-helper-vue-jsx-merge-props")),VueTabs={name:"vue-tabs",props:{activeTabColor:String,activeTextColor:String,disabledColor:String,disabledTextColor:String,textPosition:{type:String,default:"center"},type:{type:String,default:"tabs"},direction:{type:String,default:"horizontal"},centered:Boolean,value:[String,Number,Object]},data:function(){return{activeTabIndex:0,tabs:[]}},computed:{isTabShape:function(){return"tabs"===this.type},isStacked:function(){return"vertical"===this.direction},classList:function(){return"nav "+(this.isTabShape?"nav-tabs":"nav-pills")+" "+(this.centered?"nav-justified":"")+" "+(this.isStacked?"nav-stacked":"")},stackedClass:function(){return this.isStacked?"stacked":""},activeTabStyle:function(){return{backgroundColor:this.activeTabColor,color:this.activeTextColor}}},methods:{navigateToTab:function(t,e){this.changeTab(this.activeTabIndex,t,e)},activateTab:function(t){this.activeTabIndex=t;var e=this.tabs[t];e.active=!0,this.$emit("input",e.title)},changeTab:function(t,e,i){var a=this.tabs[t]||{},n=this.tabs[e];n.disabled||(this.activeTabIndex=e,a.active=!1,n.active=!0,this.$emit("input",this.tabs[e].title),this.$emit("tab-change",e,n,a),this.tryChangeRoute(i))},tryChangeRoute:function(t){this.$router&&t&&this.$router.push(t)},addTab:function(t){var e=this.$slots.default.indexOf(t.$vnode);this.tabs.splice(e,0,t)},removeTab:function(t){var e=this.tabs,i=e.indexOf(t);i>-1&&e.splice(i,1)},getTabs:function(){return this.$slots.default?this.$slots.default.filter(function(t){return t.componentOptions}):[]},findTabAndActivate:function(t){var e=this.tabs.findIndex(function(e,i){return e.title===t||i===t});e!==this.activeTabIndex&&(-1!==e?this.changeTab(this.activeTabIndex,e):this.changeTab(this.activeTabIndex,0))},renderTabTitle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",i=this.$createElement;if(0!==this.tabs.length){var a=this.tabs[t],n=a.active,s=a.title,r={color:this.activeTabColor};"center"===e&&(r.color=this.activeTextColor);var o=i("span",{class:"title title_"+e,style:n?r:{}},["center"===e&&this.renderIcon(t),s]);return a.$slots.title?a.$slots.title:a.$scopedSlots.title?a.$scopedSlots.title({active:n,title:s,position:e,icon:a.icon,data:a.tabData}):o}},renderIcon:function(t){var e=this.$createElement;if(0!==this.tabs.length){var i=this.tabs[t],a=i.icon,n=e("i",{class:a},[" "]);return!i.$slots.title&&a?n:void 0}},tabStyles:function(t){return t.disabled?{backgroundColor:this.disabledColor,color:this.disabledTextColor}:{}},renderTabs:function(){var t=this,e=this.$createElement;return this.tabs.map(function(i,a){if(i){var n=i.route,s=(i.id,i.title),r=(i.icon,i.tabId),o=t.activeTabIndex===a;return e("li",_mergeJSXProps([{attrs:{name:"tab",id:"t-"+r,"aria-selected":o,"aria-controls":"p-"+r,role:"tab"},class:["tab",{active:o},{disabled:i.disabled}],key:s},{on:{click:function(e){for(var s=arguments.length,r=Array(s>1?s-1:0),o=1;o<s;o++)r[o-1]=arguments[o];(function(){return!i.disabled&&t.navigateToTab(a,n)}).apply(void 0,[e].concat(r))}}}]),["top"===t.textPosition&&t.renderTabTitle(a,t.textPosition),e("a",_mergeJSXProps([{attrs:{href:"#",role:"tab"},style:o?t.activeTabStyle:t.tabStyles(i),class:[{active_tab:o},"tabs__link"]},{on:{click:function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),a=1;a<e;a++)i[a-1]=arguments[a];(function(t){return t.preventDefault(),!1}).apply(void 0,[t].concat(i))}}}]),["center"!==t.textPosition&&!i.$slots.title&&t.renderIcon(a),"center"===t.textPosition&&t.renderTabTitle(a,t.textPosition)]),"bottom"===t.textPosition&&t.renderTabTitle(a,t.textPosition)])}})}},render:function(){var t=arguments[0],e=this.renderTabs();return t("div",{class:["vue-tabs",this.stackedClass]},[t("div",{class:[{"nav-tabs-navigation":!this.isStacked},{"left-vertical-tabs":this.isStacked}]},[t("div",{class:["nav-tabs-wrapper",this.stackedClass]},[t("ul",{class:this.classList,attrs:{role:"tablist"}},[e])])]),t("div",{class:["tab-content",{"right-text-tabs":this.isStacked}]},[this.$slots.default])])},watch:{tabs:function(t){t.length>0&&!this.value&&(t.length<=this.activeTabIndex?this.activateTab(this.activeTabIndex-1):this.activateTab(this.activeTabIndex)),t.length>0&&this.value&&this.findTabAndActivate(this.value)},value:function(t){this.findTabAndActivate(t)}}},VTab={name:"v-tab",props:{title:{type:String,default:""},icon:{type:String,default:""},tabData:{default:null},beforeChange:{type:Function},id:String,route:{type:[String,Object]},disabled:Boolean,transitionName:String,transitionMode:String},computed:{isValidParent:function(){return"vue-tabs"===this.$parent.$options.name},hash:function(){return"#"+this.id},tabId:function(){return this.id?this.id:this.title}},data:function(){return{active:!1,validationError:null}},mounted:function(){this.$parent.addTab(this)},destroyed:function(){this.$el&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el),this.$parent.removeTab(this)},render:function(){return(0,arguments[0])("section",{class:"tab-container",attrs:{id:"p-"+this.tabId,"aria-labelledby":"t-"+this.tabId,role:"tabpanel"},directives:[{name:"show",value:this.active}]},[this.$slots.default])}},VueTabsPlugin={install:function(t){t.component("vue-tabs",VueTabs),t.component("v-tab",VTab)}};"undefined"!=typeof window&&window.Vue&&(window.Vue.use(VueTabsPlugin),window.VueTabs=VueTabsPlugin),exports.default=VueTabsPlugin,exports.VueTabs=VueTabs,exports.VTab=VTab; | ||
//# sourceMappingURL=vue-tabs.common.min.js.map |
/*! | ||
* vue-nav-tabs v0.5.6 | ||
* (c) 2017-present cristij <joracristi@gmail.com> | ||
* vue-nav-tabs v0.5.7 | ||
* (c) 2018-present cristij <joracristi@gmail.com> | ||
* Released under the MIT License. | ||
@@ -12,2 +12,53 @@ */ | ||
var nestRE = /^(attrs|props|on|nativeOn|class|style|hook)$/; | ||
var babelHelperVueJsxMergeProps = function mergeJSXProps(objs) { | ||
return objs.reduce(function (a, b) { | ||
var aa, bb, key, nestedKey, temp; | ||
for (key in b) { | ||
aa = a[key]; | ||
bb = b[key]; | ||
if (aa && nestRE.test(key)) { | ||
// normalize class | ||
if (key === 'class') { | ||
if (typeof aa === 'string') { | ||
temp = aa; | ||
a[key] = aa = {}; | ||
aa[temp] = true; | ||
} | ||
if (typeof bb === 'string') { | ||
temp = bb; | ||
b[key] = bb = {}; | ||
bb[temp] = true; | ||
} | ||
} | ||
if (key === 'on' || key === 'nativeOn' || key === 'hook') { | ||
// merge functions | ||
for (nestedKey in bb) { | ||
aa[nestedKey] = mergeFn(aa[nestedKey], bb[nestedKey]); | ||
} | ||
} else if (Array.isArray(aa)) { | ||
a[key] = aa.concat(bb); | ||
} else if (Array.isArray(bb)) { | ||
a[key] = [aa].concat(bb); | ||
} else { | ||
for (nestedKey in bb) { | ||
aa[nestedKey] = bb[nestedKey]; | ||
} | ||
} | ||
} else { | ||
a[key] = b[key]; | ||
} | ||
} | ||
return a; | ||
}, {}); | ||
}; | ||
function mergeFn(a, b) { | ||
return function () { | ||
a.apply(this, arguments); | ||
b.apply(this, arguments); | ||
}; | ||
} | ||
var VueTabs = { | ||
@@ -85,3 +136,3 @@ name: 'vue-tabs', | ||
changeTab: function changeTab(oldIndex, newIndex, route) { | ||
var oldTab = this.tabs[oldIndex]; | ||
var oldTab = this.tabs[oldIndex] || {}; | ||
var newTab = this.tabs[newIndex]; | ||
@@ -149,2 +200,9 @@ if (newTab.disabled) return; | ||
if (tab.$slots.title) return tab.$slots.title; | ||
if (tab.$scopedSlots.title) return tab.$scopedSlots.title({ | ||
active: active, | ||
title: title, | ||
position: position, | ||
icon: tab.icon, | ||
data: tab.tabData | ||
}); | ||
return simpleTitle; | ||
@@ -191,3 +249,3 @@ }, | ||
'li', | ||
{ | ||
babelHelperVueJsxMergeProps([{ | ||
attrs: { name: 'tab', | ||
@@ -198,25 +256,39 @@ id: 't-' + tabId, | ||
role: 'tab' }, | ||
'class': ['tab', { active: active }, { disabled: tab.disabled }], | ||
key: title }, { | ||
on: { | ||
'click': function click() { | ||
return !tab.disabled && _this.navigateToTab(index, route); | ||
'click': function click($event) { | ||
for (var _len = arguments.length, attrs = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
attrs[_key - 1] = arguments[_key]; | ||
} | ||
(function () { | ||
return !tab.disabled && _this.navigateToTab(index, route); | ||
}).apply(undefined, [$event].concat(attrs)); | ||
} | ||
}, | ||
'class': ['tab', { active: active }, { disabled: tab.disabled }], | ||
key: title }, | ||
} | ||
}]), | ||
[_this.textPosition === 'top' && _this.renderTabTitle(index, _this.textPosition), h( | ||
'a', | ||
{ | ||
babelHelperVueJsxMergeProps([{ | ||
attrs: { href: '#', | ||
role: 'tab' }, | ||
style: active ? _this.activeTabStyle : _this.tabStyles(tab), | ||
'class': [{ 'active_tab': active }, 'tabs__link'] }, { | ||
on: { | ||
'click': function click(e) { | ||
e.preventDefault(); | ||
return false; | ||
'click': function click($event) { | ||
for (var _len2 = arguments.length, attrs = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { | ||
attrs[_key2 - 1] = arguments[_key2]; | ||
} | ||
(function (e) { | ||
e.preventDefault(); | ||
return false; | ||
}).apply(undefined, [$event].concat(attrs)); | ||
} | ||
}, | ||
style: active ? _this.activeTabStyle : _this.tabStyles(tab), | ||
'class': [{ 'active_tab': active }, 'tabs__link'] }, | ||
} | ||
}]), | ||
[_this.textPosition !== 'center' && !tab.$slots.title && _this.renderIcon(index), _this.textPosition === 'center' && _this.renderTabTitle(index, _this.textPosition)] | ||
@@ -286,2 +358,5 @@ ), _this.textPosition === 'bottom' && _this.renderTabTitle(index, _this.textPosition)] | ||
}, | ||
tabData: { | ||
default: null | ||
}, | ||
/*** | ||
@@ -288,0 +363,0 @@ * Function to execute before tab switch. Return value must be boolean |
/*! | ||
* vue-nav-tabs v0.5.6 | ||
* (c) 2017-present cristij <joracristi@gmail.com> | ||
* vue-nav-tabs v0.5.7 | ||
* (c) 2018-present cristij <joracristi@gmail.com> | ||
* Released under the MIT License. | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vueTabs={})}(this,function(t){"use strict";var e={name:"vue-tabs",props:{activeTabColor:String,activeTextColor:String,disabledColor:String,disabledTextColor:String,textPosition:{type:String,default:"center"},type:{type:String,default:"tabs"},direction:{type:String,default:"horizontal"},centered:Boolean,value:[String,Number,Object]},data:function(){return{activeTabIndex:0,tabs:[]}},computed:{isTabShape:function(){return"tabs"===this.type},isStacked:function(){return"vertical"===this.direction},classList:function(){return"nav "+(this.isTabShape?"nav-tabs":"nav-pills")+" "+(this.centered?"nav-justified":"")+" "+(this.isStacked?"nav-stacked":"")},stackedClass:function(){return this.isStacked?"stacked":""},activeTabStyle:function(){return{backgroundColor:this.activeTabColor,color:this.activeTextColor}}},methods:{navigateToTab:function(t,e){this.changeTab(this.activeTabIndex,t,e)},activateTab:function(t){this.activeTabIndex=t;var e=this.tabs[t];e.active=!0,this.$emit("input",e.title)},changeTab:function(t,e,i){var a=this.tabs[t],n=this.tabs[e];n.disabled||(this.activeTabIndex=e,a.active=!1,n.active=!0,this.$emit("input",this.tabs[e].title),this.$emit("tab-change",e,n,a),this.tryChangeRoute(i))},tryChangeRoute:function(t){this.$router&&t&&this.$router.push(t)},addTab:function(t){var e=this.$slots.default.indexOf(t.$vnode);this.tabs.splice(e,0,t)},removeTab:function(t){var e=this.tabs,i=e.indexOf(t);i>-1&&e.splice(i,1)},getTabs:function(){return this.$slots.default?this.$slots.default.filter(function(t){return t.componentOptions}):[]},findTabAndActivate:function(t){var e=this.tabs.findIndex(function(e,i){return e.title===t||i===t});e!==this.activeTabIndex&&(-1!==e?this.changeTab(this.activeTabIndex,e):this.changeTab(this.activeTabIndex,0))},renderTabTitle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",i=this.$createElement;if(0!==this.tabs.length){var a=this.tabs[t],n=a.active,s=a.title,o={color:this.activeTabColor};"center"===e&&(o.color=this.activeTextColor);var r=i("span",{class:"title title_"+e,style:n?o:{}},["center"===e&&this.renderIcon(t),s]);return a.$slots.title?a.$slots.title:r}},renderIcon:function(t){var e=this.$createElement;if(0!==this.tabs.length){var i=this.tabs[t],a=i.icon,n=e("i",{class:a},[" "]);return!i.$slots.title&&a?n:void 0}},tabStyles:function(t){return t.disabled?{backgroundColor:this.disabledColor,color:this.disabledTextColor}:{}},renderTabs:function(){var t=this,e=this.$createElement;return this.tabs.map(function(i,a){if(i){var n=i.route,s=(i.id,i.title),o=(i.icon,i.tabId),r=t.activeTabIndex===a;return e("li",{attrs:{name:"tab",id:"t-"+o,"aria-selected":r,"aria-controls":"p-"+o,role:"tab"},on:{click:function(){return!i.disabled&&t.navigateToTab(a,n)}},class:["tab",{active:r},{disabled:i.disabled}],key:s},["top"===t.textPosition&&t.renderTabTitle(a,t.textPosition),e("a",{attrs:{href:"#",role:"tab"},on:{click:function(t){return t.preventDefault(),!1}},style:r?t.activeTabStyle:t.tabStyles(i),class:[{active_tab:r},"tabs__link"]},["center"!==t.textPosition&&!i.$slots.title&&t.renderIcon(a),"center"===t.textPosition&&t.renderTabTitle(a,t.textPosition)]),"bottom"===t.textPosition&&t.renderTabTitle(a,t.textPosition)])}})}},render:function(){var t=arguments[0],e=this.renderTabs();return t("div",{class:["vue-tabs",this.stackedClass]},[t("div",{class:[{"nav-tabs-navigation":!this.isStacked},{"left-vertical-tabs":this.isStacked}]},[t("div",{class:["nav-tabs-wrapper",this.stackedClass]},[t("ul",{class:this.classList,attrs:{role:"tablist"}},[e])])]),t("div",{class:["tab-content",{"right-text-tabs":this.isStacked}]},[this.$slots.default])])},watch:{tabs:function(t){t.length>0&&!this.value&&(t.length<=this.activeTabIndex?this.activateTab(this.activeTabIndex-1):this.activateTab(this.activeTabIndex)),t.length>0&&this.value&&this.findTabAndActivate(this.value)},value:function(t){this.findTabAndActivate(t)}}},i={name:"v-tab",props:{title:{type:String,default:""},icon:{type:String,default:""},beforeChange:{type:Function},id:String,route:{type:[String,Object]},disabled:Boolean,transitionName:String,transitionMode:String},computed:{isValidParent:function(){return"vue-tabs"===this.$parent.$options.name},hash:function(){return"#"+this.id},tabId:function(){return this.id?this.id:this.title}},data:function(){return{active:!1,validationError:null}},mounted:function(){this.$parent.addTab(this)},destroyed:function(){this.$el&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el),this.$parent.removeTab(this)},render:function(){return(0,arguments[0])("section",{class:"tab-container",attrs:{id:"p-"+this.tabId,"aria-labelledby":"t-"+this.tabId,role:"tabpanel"},directives:[{name:"show",value:this.active}]},[this.$slots.default])}},a={install:function(t){t.component("vue-tabs",e),t.component("v-tab",i)}};"undefined"!=typeof window&&window.Vue&&(window.Vue.use(a),window.VueTabs=a),t.default=a,t.VueTabs=e,t.VTab=i,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.vueTabs={})}(this,function(t){"use strict";var e=/^(attrs|props|on|nativeOn|class|style|hook)$/,i=function(t){return t.reduce(function(t,i){var a,n,s,o,r;for(s in i)if(a=t[s],n=i[s],a&&e.test(s))if("class"===s&&("string"==typeof a&&(r=a,t[s]=a={},a[r]=!0),"string"==typeof n&&(r=n,i[s]=n={},n[r]=!0)),"on"===s||"nativeOn"===s||"hook"===s)for(o in n)a[o]=function(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}(a[o],n[o]);else if(Array.isArray(a))t[s]=a.concat(n);else if(Array.isArray(n))t[s]=[a].concat(n);else for(o in n)a[o]=n[o];else t[s]=i[s];return t},{})},a={name:"vue-tabs",props:{activeTabColor:String,activeTextColor:String,disabledColor:String,disabledTextColor:String,textPosition:{type:String,default:"center"},type:{type:String,default:"tabs"},direction:{type:String,default:"horizontal"},centered:Boolean,value:[String,Number,Object]},data:function(){return{activeTabIndex:0,tabs:[]}},computed:{isTabShape:function(){return"tabs"===this.type},isStacked:function(){return"vertical"===this.direction},classList:function(){return"nav "+(this.isTabShape?"nav-tabs":"nav-pills")+" "+(this.centered?"nav-justified":"")+" "+(this.isStacked?"nav-stacked":"")},stackedClass:function(){return this.isStacked?"stacked":""},activeTabStyle:function(){return{backgroundColor:this.activeTabColor,color:this.activeTextColor}}},methods:{navigateToTab:function(t,e){this.changeTab(this.activeTabIndex,t,e)},activateTab:function(t){this.activeTabIndex=t;var e=this.tabs[t];e.active=!0,this.$emit("input",e.title)},changeTab:function(t,e,i){var a=this.tabs[t]||{},n=this.tabs[e];n.disabled||(this.activeTabIndex=e,a.active=!1,n.active=!0,this.$emit("input",this.tabs[e].title),this.$emit("tab-change",e,n,a),this.tryChangeRoute(i))},tryChangeRoute:function(t){this.$router&&t&&this.$router.push(t)},addTab:function(t){var e=this.$slots.default.indexOf(t.$vnode);this.tabs.splice(e,0,t)},removeTab:function(t){var e=this.tabs,i=e.indexOf(t);i>-1&&e.splice(i,1)},getTabs:function(){return this.$slots.default?this.$slots.default.filter(function(t){return t.componentOptions}):[]},findTabAndActivate:function(t){var e=this.tabs.findIndex(function(e,i){return e.title===t||i===t});e!==this.activeTabIndex&&(-1!==e?this.changeTab(this.activeTabIndex,e):this.changeTab(this.activeTabIndex,0))},renderTabTitle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",i=this.$createElement;if(0!==this.tabs.length){var a=this.tabs[t],n=a.active,s=a.title,o={color:this.activeTabColor};"center"===e&&(o.color=this.activeTextColor);var r=i("span",{class:"title title_"+e,style:n?o:{}},["center"===e&&this.renderIcon(t),s]);return a.$slots.title?a.$slots.title:a.$scopedSlots.title?a.$scopedSlots.title({active:n,title:s,position:e,icon:a.icon,data:a.tabData}):r}},renderIcon:function(t){var e=this.$createElement;if(0!==this.tabs.length){var i=this.tabs[t],a=i.icon,n=e("i",{class:a},[" "]);return!i.$slots.title&&a?n:void 0}},tabStyles:function(t){return t.disabled?{backgroundColor:this.disabledColor,color:this.disabledTextColor}:{}},renderTabs:function(){var t=this,e=this.$createElement;return this.tabs.map(function(a,n){if(a){var s=a.route,o=(a.id,a.title),r=(a.icon,a.tabId),c=t.activeTabIndex===n;return e("li",i([{attrs:{name:"tab",id:"t-"+r,"aria-selected":c,"aria-controls":"p-"+r,role:"tab"},class:["tab",{active:c},{disabled:a.disabled}],key:o},{on:{click:function(e){for(var i=arguments.length,o=Array(i>1?i-1:0),r=1;r<i;r++)o[r-1]=arguments[r];(function(){return!a.disabled&&t.navigateToTab(n,s)}).apply(void 0,[e].concat(o))}}}]),["top"===t.textPosition&&t.renderTabTitle(n,t.textPosition),e("a",i([{attrs:{href:"#",role:"tab"},style:c?t.activeTabStyle:t.tabStyles(a),class:[{active_tab:c},"tabs__link"]},{on:{click:function(t){for(var e=arguments.length,i=Array(e>1?e-1:0),a=1;a<e;a++)i[a-1]=arguments[a];(function(t){return t.preventDefault(),!1}).apply(void 0,[t].concat(i))}}}]),["center"!==t.textPosition&&!a.$slots.title&&t.renderIcon(n),"center"===t.textPosition&&t.renderTabTitle(n,t.textPosition)]),"bottom"===t.textPosition&&t.renderTabTitle(n,t.textPosition)])}})}},render:function(){var t=arguments[0],e=this.renderTabs();return t("div",{class:["vue-tabs",this.stackedClass]},[t("div",{class:[{"nav-tabs-navigation":!this.isStacked},{"left-vertical-tabs":this.isStacked}]},[t("div",{class:["nav-tabs-wrapper",this.stackedClass]},[t("ul",{class:this.classList,attrs:{role:"tablist"}},[e])])]),t("div",{class:["tab-content",{"right-text-tabs":this.isStacked}]},[this.$slots.default])])},watch:{tabs:function(t){t.length>0&&!this.value&&(t.length<=this.activeTabIndex?this.activateTab(this.activeTabIndex-1):this.activateTab(this.activeTabIndex)),t.length>0&&this.value&&this.findTabAndActivate(this.value)},value:function(t){this.findTabAndActivate(t)}}},n={name:"v-tab",props:{title:{type:String,default:""},icon:{type:String,default:""},tabData:{default:null},beforeChange:{type:Function},id:String,route:{type:[String,Object]},disabled:Boolean,transitionName:String,transitionMode:String},computed:{isValidParent:function(){return"vue-tabs"===this.$parent.$options.name},hash:function(){return"#"+this.id},tabId:function(){return this.id?this.id:this.title}},data:function(){return{active:!1,validationError:null}},mounted:function(){this.$parent.addTab(this)},destroyed:function(){this.$el&&this.$el.parentNode&&this.$el.parentNode.removeChild(this.$el),this.$parent.removeTab(this)},render:function(){return(0,arguments[0])("section",{class:"tab-container",attrs:{id:"p-"+this.tabId,"aria-labelledby":"t-"+this.tabId,role:"tabpanel"},directives:[{name:"show",value:this.active}]},[this.$slots.default])}},s={install:function(t){t.component("vue-tabs",a),t.component("v-tab",n)}};"undefined"!=typeof window&&window.Vue&&(window.Vue.use(s),window.VueTabs=s),t.default=s,t.VueTabs=a,t.VTab=n,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=vue-tabs.min.js.map |
@@ -0,0 +0,0 @@ MIT License |
{ | ||
"name": "vue-nav-tabs", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"description": "A vue based tab component", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -0,0 +0,0 @@ # Vue-tabs |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
117328
1333
4