diff --git a/dist/vue-tabs.common.js b/dist/vue-tabs.common.js index e2fcaee..7878456 100644 --- a/dist/vue-tabs.common.js +++ b/dist/vue-tabs.common.js @@ -1,5 +1,5 @@ /*! - * vue-nav-tabs v0.5.1 + * vue-nav-tabs v0.5.2 * (c) 2017-present cristij * Released under the MIT License. */ @@ -134,7 +134,7 @@ var VueTabs = { var simpleTitle = h( 'span', { 'class': 'title title_' + position, style: active ? titleStyles : {} }, - [position === 'center' && this.renderIcon(index), '\xA0', title] + [position === 'center' && this.renderIcon(index), title] ); if (tab.$slots.title) return tab.$slots.title; @@ -150,7 +150,7 @@ var VueTabs = { var simpleIcon = h( 'i', { 'class': icon }, - [] + ['\xA0'] ); if (!tab.$slots.title && icon) return simpleIcon; }, diff --git a/dist/vue-tabs.js b/dist/vue-tabs.js index d7aa47a..4412c77 100644 --- a/dist/vue-tabs.js +++ b/dist/vue-tabs.js @@ -1,5 +1,5 @@ /*! - * vue-nav-tabs v0.5.1 + * vue-nav-tabs v0.5.2 * (c) 2017-present cristij * Released under the MIT License. */ @@ -136,7 +136,7 @@ var VueTabs = { var simpleTitle = h( 'span', { 'class': 'title title_' + position, style: active ? titleStyles : {} }, - [position === 'center' && this.renderIcon(index), '\xA0', title] + [position === 'center' && this.renderIcon(index), title] ); if (tab.$slots.title) return tab.$slots.title; @@ -152,7 +152,7 @@ var VueTabs = { var simpleIcon = h( 'i', { 'class': icon }, - [] + ['\xA0'] ); if (!tab.$slots.title && icon) return simpleIcon; }, diff --git a/dist/vue-tabs.min.js b/dist/vue-tabs.min.js index 76485b9..19bdac3 100644 --- a/dist/vue-tabs.min.js +++ b/dist/vue-tabs.min.js @@ -1,7 +1,7 @@ /*! - * vue-nav-tabs v0.5.1 + * vue-nav-tabs v0.5.2 * (c) 2017-present cristij * 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=t.vueTabs||{})}(this,function(t){"use strict";var e={name:"vue-tabs",props:{activeTabColor:String,activeTextColor: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){this.activeTabIndex=e;var a=this.tabs[t],n=this.tabs[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});-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}},renderTabs:function(){var t=this,e=this.$createElement;return this.tabs.map(function(i,a){if(i){var n=i.route,s=i.id,o=i.title,r=(i.icon,t.activeTabIndex===a);return e("li",{attrs:{name:"tab",role:"presentation"},on:{click:function(){return t.navigateToTab(a,n)}},class:["tab",{active:r}],key:o},["top"===t.textPosition&&t.renderTabTitle(a,t.textPosition),e("a",{attrs:{href:"javascript:void(0)","aria-selected":r,"aria-controls":"#"+s,role:"tab"},on:{click:function(){return t.navigateToTab(a)}},style:r?t.activeTabStyle:{},class:{active_tab:r}},["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&&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]},transitionName:String,transitionMode:String},computed:{isValidParent:function(){return"vue-tabs"===this.$parent.$options.name},hash:function(){return"#"+this.id}},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:{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=t.vueTabs||{})}(this,function(t){"use strict";var e={name:"vue-tabs",props:{activeTabColor:String,activeTextColor: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){this.activeTabIndex=e;var a=this.tabs[t],n=this.tabs[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});-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}},renderTabs:function(){var t=this,e=this.$createElement;return this.tabs.map(function(i,a){if(i){var n=i.route,s=i.id,o=i.title,r=(i.icon,t.activeTabIndex===a);return e("li",{attrs:{name:"tab",role:"presentation"},on:{click:function(){return t.navigateToTab(a,n)}},class:["tab",{active:r}],key:o},["top"===t.textPosition&&t.renderTabTitle(a,t.textPosition),e("a",{attrs:{href:"javascript:void(0)","aria-selected":r,"aria-controls":"#"+s,role:"tab"},on:{click:function(){return t.navigateToTab(a)}},style:r?t.activeTabStyle:{},class:{active_tab:r}},["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&&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]},transitionName:String,transitionMode:String},computed:{isValidParent:function(){return"vue-tabs"===this.$parent.$options.name},hash:function(){return"#"+this.id}},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:{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})}); //# sourceMappingURL=Vue-Tabs.min.js.map diff --git a/dist/vue-tabs.min.js.map b/dist/vue-tabs.min.js.map index ef77e8e..2cf4bf0 100644 --- a/dist/vue-tabs.min.js.map +++ b/dist/vue-tabs.min.js.map @@ -1 +1 @@ -{"version":3,"file":null,"sources":["../src/components/VueTabs.js","../src/components/VTab.js","../src/index.js"],"sourcesContent":["export default{\r\n name: 'vue-tabs',\r\n props: {\r\n activeTabColor: String,\r\n activeTextColor: String,\r\n /**\r\n * Tab title position: center | bottom | top\r\n */\r\n textPosition: {\r\n type: String,\r\n default: 'center'\r\n },\r\n /**\r\n * Tab type: tabs | pills\r\n */\r\n type: {\r\n type: String,\r\n default: 'tabs'\r\n },\r\n direction: {\r\n type: String,\r\n default: 'horizontal'\r\n },\r\n /**\r\n * Centers the tabs and makes the container div full width\r\n */\r\n centered: Boolean,\r\n value: [String, Number, Object]\r\n },\r\n data () {\r\n return {\r\n activeTabIndex: 0,\r\n tabs: []\r\n }\r\n },\r\n computed: {\r\n isTabShape () {\r\n return this.type === 'tabs'\r\n },\r\n isStacked () {\r\n return this.direction === 'vertical'\r\n },\r\n classList () {\r\n let navType = this.isTabShape ? 'nav-tabs' : 'nav-pills'\r\n let centerClass = this.centered ? 'nav-justified' : ''\r\n let isStacked = this.isStacked ? 'nav-stacked' : ''\r\n return `nav ${navType} ${centerClass} ${isStacked}`\r\n },\r\n stackedClass () {\r\n return this.isStacked ? 'stacked' : ''\r\n },\r\n activeTabStyle () {\r\n return {\r\n backgroundColor: this.activeTabColor,\r\n color: this.activeTextColor\r\n }\r\n }\r\n },\r\n methods: {\r\n navigateToTab (index, route) {\r\n this.changeTab(this.activeTabIndex, index, route)\r\n },\r\n activateTab (index) {\r\n this.activeTabIndex = index\r\n let tab = this.tabs[index]\r\n tab.active = true\r\n this.$emit('input', tab.title)\r\n },\r\n changeTab (oldIndex, newIndex, route) {\r\n this.activeTabIndex = newIndex\r\n let oldTab = this.tabs[oldIndex]\r\n let newTab = this.tabs[newIndex]\r\n oldTab.active =false\r\n newTab.active = true\r\n this.$emit('input', this.tabs[newIndex].title)\r\n this.$emit('tab-change', newIndex, newTab, oldTab)\r\n this.tryChangeRoute(route)\r\n },\r\n tryChangeRoute (route) {\r\n if (this.$router && route) {\r\n this.$router.push(route)\r\n }\r\n },\r\n addTab(item) {\r\n const index = this.$slots.default.indexOf(item.$vnode);\r\n this.tabs.splice(index, 0, item);\r\n },\r\n removeTab(item) {\r\n const tabs = this.tabs;\r\n const index = tabs.indexOf(item);\r\n if (index > -1) {\r\n tabs.splice(index, 1);\r\n }\r\n },\r\n getTabs () {\r\n if (this.$slots.default) {\r\n return this.$slots.default.filter(comp => comp.componentOptions)\r\n }\r\n return []\r\n },\r\n findTabAndActivate (tabNameOrIndex) {\r\n let indexToActivate = this.tabs.findIndex((tab, index) => tab.title === tabNameOrIndex || index === tabNameOrIndex)\r\n if (indexToActivate != -1) {\r\n this.changeTab(this.activeTabIndex, indexToActivate)\r\n } else {\r\n this.changeTab(this.activeTabIndex, 0)\r\n }\r\n },\r\n renderTabTitle (index, position = 'top') {\r\n if (this.tabs.length === 0) return\r\n let tab = this.tabs[index]\r\n let {active, title} = tab\r\n let titleStyles = {color: this.activeTabColor}\r\n if (position === 'center') titleStyles.color = this.activeTextColor\r\n let simpleTitle = (\r\n {position === 'center' && this.renderIcon(index)} {title}\r\n )\r\n\r\n if (tab.$slots.title) return tab.$slots.title\r\n return simpleTitle\r\n },\r\n renderIcon (index) {\r\n if (this.tabs.length === 0) return\r\n let tab = this.tabs[index]\r\n let {icon} = tab\r\n let simpleIcon = \r\n if (!tab.$slots.title && icon) return simpleIcon\r\n },\r\n renderTabs () {\r\n return this.tabs.map((tab, index) => {\r\n if (!tab) return\r\n let {route, id, title, icon} = tab\r\n let active = this.activeTabIndex === index\r\n return (\r\n
  • this.navigateToTab(index, route)} class={['tab', {active: active}]}\r\n key={title}\r\n role=\"presentation\">\r\n {this.textPosition === 'top' &&\r\n this.renderTabTitle(index, this.textPosition)\r\n }\r\n this.navigateToTab(index)}\r\n style={active ? this.activeTabStyle : {}}\r\n class={{'active_tab': active}}\r\n aria-selected={active}\r\n aria-controls={`#${id}`}\r\n role=\"tab\">\r\n {this.textPosition !=='center' && !tab.$slots.title && this.renderIcon(index)}\r\n {this.textPosition === 'center' &&\r\n this.renderTabTitle(index, this.textPosition)\r\n }\r\n \r\n {this.textPosition === 'bottom' &&\r\n this.renderTabTitle(index, this.textPosition)\r\n }\r\n
  • \r\n )\r\n })\r\n }\r\n },\r\n render () {\r\n const tabList = this.renderTabs()\r\n return (\r\n
    \r\n
    \r\n
    \r\n
      \r\n {tabList}\r\n
    \r\n
    \r\n
    \r\n
    \r\n {this.$slots.default}\r\n
    \r\n
    )\r\n },\r\n watch: {\r\n tabs (newList) {\r\n if (newList.length > 0 && !this.value) {\r\n this.activateTab(this.activeTabIndex)\r\n }\r\n if (newList.length > 0 && this.value) {\r\n this.findTabAndActivate(this.value)\r\n }\r\n },\r\n value (newVal) {\r\n this.findTabAndActivate(newVal)\r\n }\r\n }\r\n}\r\n","export default{\r\n name: 'v-tab',\r\n props: {\r\n title: {\r\n type: String,\r\n default: ''\r\n },\r\n icon: {\r\n type: String,\r\n default: ''\r\n },\r\n /***\r\n * Function to execute before tab switch. Return value must be boolean\r\n * If the return result is false, tab switch is restricted\r\n */\r\n beforeChange: {\r\n type: Function\r\n },\r\n id: String,\r\n route: {\r\n type: [String, Object]\r\n },\r\n transitionName: String,\r\n transitionMode: String\r\n },\r\n computed: {\r\n isValidParent () {\r\n return this.$parent.$options.name === 'vue-tabs'\r\n },\r\n hash () {\r\n return `#${this.id}`\r\n }\r\n },\r\n data () {\r\n return {\r\n active: false,\r\n validationError: null\r\n }\r\n },\r\n mounted(){\r\n this.$parent.addTab(this)\r\n },\r\n destroyed() {\r\n if (this.$el && this.$el.parentNode) {\r\n this.$el.parentNode.removeChild(this.$el);\r\n }\r\n this.$parent.removeTab(this);\r\n },\r\n render () {\r\n return (
    \r\n {this.$slots.default}\r\n
    )\r\n }\r\n}\r\n","import VueTabs from './components/VueTabs.js'\r\nimport VTab from './components/VTab.js'\r\nconst VueTabsPlugin = {\r\n install(Vue) {\r\n Vue.component('vue-tabs', VueTabs)\r\n Vue.component('v-tab', VTab)\r\n }\r\n}\r\n// Automatic installation if Vue has been added to the global scope.\r\nif (typeof window !== 'undefined' && window.Vue) {\r\n window.Vue.use(VueTabsPlugin)\r\n window.VueTabs = VueTabsPlugin\r\n}\r\nexport default VueTabsPlugin\r\nexport {\r\n VueTabs,\r\n VTab\r\n}"],"names":["String","Boolean","Number","Object","this","type","direction","isTabShape","centered","isStacked","activeTabColor","activeTextColor","index","route","changeTab","activeTabIndex","tab","tabs","active","$emit","title","oldIndex","newIndex","oldTab","newTab","tryChangeRoute","$router","push","item","$slots","default","indexOf","$vnode","splice","filter","comp","componentOptions","tabNameOrIndex","indexToActivate","findIndex","position","length","titleStyles","color","simpleTitle","h","class","style","renderIcon","icon","simpleIcon","map","id","_this","name","navigateToTab","textPosition","renderTabTitle","href","activeTabStyle","active_tab","tabList","renderTabs","stackedClass","nav-tabs-navigation","left-vertical-tabs","classList","role","right-text-tabs","newList","value","activateTab","findTabAndActivate","newVal","Function","$parent","$options","addTab","$el","parentNode","removeChild","removeTab","VueTabsPlugin","Vue","component","VueTabs","VTab","window","use"],"mappings":";;;;;oMAAA,aACU,iCAEcA,uBACCA,0BAKP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QAAIC,MAAO1C,KAAK8D,iBAAWC,KAAK,aAC3BN,QAIbhB,SAAKC,OAAQ,eAAesB,kBAAmBhE,KAAKK,cAC/CL,KAAKyB,OAAOC,kCAKnBuC,GACEA,EAAQ5B,OAAS,IAAMrC,KAAKkE,YACvBC,YAAYnE,KAAKW,gBAEtBsD,EAAQ5B,OAAS,GAAKrC,KAAKkE,YACtBE,mBAAmBpE,KAAKkE,uBAG9BG,QACED,mBAAmBC,cCzL1B,2BAGQzE,eACG,eAGHA,eACG,uBAOH0E,aAEN1E,oBAEOA,OAAQG,wBAEHH,sBACAA,iDAI0B,aAA/BI,KAAKuE,QAAQC,SAAStB,gCAGlBlD,KAAKgD,oCAKR,kBACS,+BAIlBuB,QAAQE,OAAOzE,4BAGdA,KAAK0E,KAAO1E,KAAK0E,IAAIC,iBAChBD,IAAIC,WAAWC,YAAY5E,KAAK0E,UAEpCH,QAAQM,UAAU7E,gCAGdyC,2BAASC,MAAM,uBACNqB,KAAK,2CAAmB/D,KAAKc,WAC1Cd,KAAKyB,OAAOC,YCjDnBoD,oBACIC,KACFC,UAAU,WAAYC,KACtBD,UAAU,QAASE,IAIL,oBAAXC,SAA0BA,OAAOJ,aACnCA,IAAIK,IAAIN,UACRG,QAAUH"} \ No newline at end of file +{"version":3,"file":null,"sources":["../src/components/VueTabs.js","../src/components/VTab.js","../src/index.js"],"sourcesContent":["export default{\r\n name: 'vue-tabs',\r\n props: {\r\n activeTabColor: String,\r\n activeTextColor: String,\r\n /**\r\n * Tab title position: center | bottom | top\r\n */\r\n textPosition: {\r\n type: String,\r\n default: 'center'\r\n },\r\n /**\r\n * Tab type: tabs | pills\r\n */\r\n type: {\r\n type: String,\r\n default: 'tabs'\r\n },\r\n direction: {\r\n type: String,\r\n default: 'horizontal'\r\n },\r\n /**\r\n * Centers the tabs and makes the container div full width\r\n */\r\n centered: Boolean,\r\n value: [String, Number, Object]\r\n },\r\n data () {\r\n return {\r\n activeTabIndex: 0,\r\n tabs: []\r\n }\r\n },\r\n computed: {\r\n isTabShape () {\r\n return this.type === 'tabs'\r\n },\r\n isStacked () {\r\n return this.direction === 'vertical'\r\n },\r\n classList () {\r\n let navType = this.isTabShape ? 'nav-tabs' : 'nav-pills'\r\n let centerClass = this.centered ? 'nav-justified' : ''\r\n let isStacked = this.isStacked ? 'nav-stacked' : ''\r\n return `nav ${navType} ${centerClass} ${isStacked}`\r\n },\r\n stackedClass () {\r\n return this.isStacked ? 'stacked' : ''\r\n },\r\n activeTabStyle () {\r\n return {\r\n backgroundColor: this.activeTabColor,\r\n color: this.activeTextColor\r\n }\r\n }\r\n },\r\n methods: {\r\n navigateToTab (index, route) {\r\n this.changeTab(this.activeTabIndex, index, route)\r\n },\r\n activateTab (index) {\r\n this.activeTabIndex = index\r\n let tab = this.tabs[index]\r\n tab.active = true\r\n this.$emit('input', tab.title)\r\n },\r\n changeTab (oldIndex, newIndex, route) {\r\n this.activeTabIndex = newIndex\r\n let oldTab = this.tabs[oldIndex]\r\n let newTab = this.tabs[newIndex]\r\n oldTab.active =false\r\n newTab.active = true\r\n this.$emit('input', this.tabs[newIndex].title)\r\n this.$emit('tab-change', newIndex, newTab, oldTab)\r\n this.tryChangeRoute(route)\r\n },\r\n tryChangeRoute (route) {\r\n if (this.$router && route) {\r\n this.$router.push(route)\r\n }\r\n },\r\n addTab(item) {\r\n const index = this.$slots.default.indexOf(item.$vnode);\r\n this.tabs.splice(index, 0, item);\r\n },\r\n removeTab(item) {\r\n const tabs = this.tabs;\r\n const index = tabs.indexOf(item);\r\n if (index > -1) {\r\n tabs.splice(index, 1);\r\n }\r\n },\r\n getTabs () {\r\n if (this.$slots.default) {\r\n return this.$slots.default.filter(comp => comp.componentOptions)\r\n }\r\n return []\r\n },\r\n findTabAndActivate (tabNameOrIndex) {\r\n let indexToActivate = this.tabs.findIndex((tab, index) => tab.title === tabNameOrIndex || index === tabNameOrIndex)\r\n if (indexToActivate != -1) {\r\n this.changeTab(this.activeTabIndex, indexToActivate)\r\n } else {\r\n this.changeTab(this.activeTabIndex, 0)\r\n }\r\n },\r\n renderTabTitle (index, position = 'top') {\r\n if (this.tabs.length === 0) return\r\n let tab = this.tabs[index]\r\n let {active, title} = tab\r\n let titleStyles = {color: this.activeTabColor}\r\n if (position === 'center') titleStyles.color = this.activeTextColor\r\n let simpleTitle = (\r\n {position === 'center' && this.renderIcon(index)}{title}\r\n )\r\n\r\n if (tab.$slots.title) return tab.$slots.title\r\n return simpleTitle\r\n },\r\n renderIcon (index) {\r\n if (this.tabs.length === 0) return\r\n let tab = this.tabs[index]\r\n let {icon} = tab\r\n let simpleIcon =  \r\n if (!tab.$slots.title && icon) return simpleIcon\r\n },\r\n renderTabs () {\r\n return this.tabs.map((tab, index) => {\r\n if (!tab) return\r\n let {route, id, title, icon} = tab\r\n let active = this.activeTabIndex === index\r\n return (\r\n
  • this.navigateToTab(index, route)} class={['tab', {active: active}]}\r\n key={title}\r\n role=\"presentation\">\r\n {this.textPosition === 'top' &&\r\n this.renderTabTitle(index, this.textPosition)\r\n }\r\n this.navigateToTab(index)}\r\n style={active ? this.activeTabStyle : {}}\r\n class={{'active_tab': active}}\r\n aria-selected={active}\r\n aria-controls={`#${id}`}\r\n role=\"tab\">\r\n {this.textPosition !=='center' && !tab.$slots.title && this.renderIcon(index)}\r\n {this.textPosition === 'center' &&\r\n this.renderTabTitle(index, this.textPosition)\r\n }\r\n \r\n {this.textPosition === 'bottom' &&\r\n this.renderTabTitle(index, this.textPosition)\r\n }\r\n
  • \r\n )\r\n })\r\n }\r\n },\r\n render () {\r\n const tabList = this.renderTabs()\r\n return (\r\n
    \r\n
    \r\n
    \r\n
      \r\n {tabList}\r\n
    \r\n
    \r\n
    \r\n
    \r\n {this.$slots.default}\r\n
    \r\n
    )\r\n },\r\n watch: {\r\n tabs (newList) {\r\n if (newList.length > 0 && !this.value) {\r\n this.activateTab(this.activeTabIndex)\r\n }\r\n if (newList.length > 0 && this.value) {\r\n this.findTabAndActivate(this.value)\r\n }\r\n },\r\n value (newVal) {\r\n this.findTabAndActivate(newVal)\r\n }\r\n }\r\n}\r\n","export default{\r\n name: 'v-tab',\r\n props: {\r\n title: {\r\n type: String,\r\n default: ''\r\n },\r\n icon: {\r\n type: String,\r\n default: ''\r\n },\r\n /***\r\n * Function to execute before tab switch. Return value must be boolean\r\n * If the return result is false, tab switch is restricted\r\n */\r\n beforeChange: {\r\n type: Function\r\n },\r\n id: String,\r\n route: {\r\n type: [String, Object]\r\n },\r\n transitionName: String,\r\n transitionMode: String\r\n },\r\n computed: {\r\n isValidParent () {\r\n return this.$parent.$options.name === 'vue-tabs'\r\n },\r\n hash () {\r\n return `#${this.id}`\r\n }\r\n },\r\n data () {\r\n return {\r\n active: false,\r\n validationError: null\r\n }\r\n },\r\n mounted(){\r\n this.$parent.addTab(this)\r\n },\r\n destroyed() {\r\n if (this.$el && this.$el.parentNode) {\r\n this.$el.parentNode.removeChild(this.$el);\r\n }\r\n this.$parent.removeTab(this);\r\n },\r\n render () {\r\n return (
    \r\n {this.$slots.default}\r\n
    )\r\n }\r\n}\r\n","import VueTabs from './components/VueTabs.js'\r\nimport VTab from './components/VTab.js'\r\nconst VueTabsPlugin = {\r\n install(Vue) {\r\n Vue.component('vue-tabs', VueTabs)\r\n Vue.component('v-tab', VTab)\r\n }\r\n}\r\n// Automatic installation if Vue has been added to the global scope.\r\nif (typeof window !== 'undefined' && window.Vue) {\r\n window.Vue.use(VueTabsPlugin)\r\n window.VueTabs = VueTabsPlugin\r\n}\r\nexport default VueTabsPlugin\r\nexport {\r\n VueTabs,\r\n VTab\r\n}"],"names":["String","Boolean","Number","Object","this","type","direction","isTabShape","centered","isStacked","activeTabColor","activeTextColor","index","route","changeTab","activeTabIndex","tab","tabs","active","$emit","title","oldIndex","newIndex","oldTab","newTab","tryChangeRoute","$router","push","item","$slots","default","indexOf","$vnode","splice","filter","comp","componentOptions","tabNameOrIndex","indexToActivate","findIndex","position","length","titleStyles","color","simpleTitle","h","class","style","renderIcon","icon","simpleIcon","map","id","_this","name","navigateToTab","textPosition","renderTabTitle","href","activeTabStyle","active_tab","tabList","renderTabs","stackedClass","nav-tabs-navigation","left-vertical-tabs","classList","role","right-text-tabs","newList","value","activateTab","findTabAndActivate","newVal","Function","$parent","$options","addTab","$el","parentNode","removeChild","removeTab","VueTabsPlugin","Vue","component","VueTabs","VTab","window","use"],"mappings":";;;;;oMAAA,aACU,iCAEcA,uBACCA,0BAKPA,eACG,qBAMHA,eACG,wBAGHA,eACG,uBAKHC,eACFD,OAAQE,OAAQC,+CAIJ,kDAMK,SAAdC,KAAKC,iCAGc,aAAnBD,KAAKE,8CAGEF,KAAKG,WAAa,WAAa,kBAC3BH,KAAKI,SAAW,gBAAkB,SACpCJ,KAAKK,UAAY,cAAgB,mCAI1CL,MAAKK,UAAY,UAAY,qDAIfL,KAAKM,qBACfN,KAAKO,mDAKLC,EAAOC,QACbC,UAAUV,KAAKW,eAAgBH,EAAOC,yBAElCD,QACJG,eAAiBH,KAClBI,GAAMZ,KAAKa,KAAKL,KAChBM,QAAS,OACRC,MAAM,QAASH,EAAII,2BAEjBC,EAAUC,EAAUT,QACtBE,eAAiBO,KAClBC,GAASnB,KAAKa,KAAKI,GACnBG,EAASpB,KAAKa,KAAKK,KAChBJ,QAAQ,IACRA,QAAS,OACXC,MAAM,QAASf,KAAKa,KAAKK,GAAUF,YACnCD,MAAM,aAAcG,EAAUE,EAAQD,QACtCE,eAAeZ,4BAERA,GACRT,KAAKsB,SAAWb,QACXa,QAAQC,KAAKd,oBAGnBe,MACGhB,GAAQR,KAAKyB,OAAOC,QAAQC,QAAQH,EAAKI,aAC1Cf,KAAKgB,OAAOrB,EAAO,EAAGgB,uBAErBA,MACAX,GAAOb,KAAKa,KACZL,EAAQK,EAAKc,QAAQH,EACvBhB,IAAS,KACJqB,OAAOrB,EAAO,6BAInBR,MAAKyB,OAAOC,QACL1B,KAAKyB,OAAOC,QAAQI,OAAO,kBAAQC,GAAKC,mDAInCC,MACZC,GAAkBlC,KAAK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