vue-nav-tabs
Advanced tools
Comparing version 0.2.2 to 0.3.0
@@ -0,0 +0,0 @@ // http://eslint.org/docs/user-guide/configuring |
@@ -0,0 +0,0 @@ // https://github.com/michael-ciniawsky/postcss-load-config |
@@ -0,0 +0,0 @@ require('./check-versions')() |
@@ -0,0 +0,0 @@ var chalk = require('chalk') |
@@ -0,0 +0,0 @@ /* eslint-disable */ |
@@ -0,0 +0,0 @@ require('./check-versions')() |
@@ -0,0 +0,0 @@ var path = require('path') |
@@ -0,0 +0,0 @@ var utils = require('./utils') |
@@ -0,0 +0,0 @@ var utils = require('./utils') |
@@ -0,0 +0,0 @@ var path = require('path') |
@@ -0,0 +0,0 @@ // This is the webpack config used for unit tests. |
@@ -0,0 +0,0 @@ var merge = require('webpack-merge') |
@@ -0,0 +0,0 @@ // see http://vuejs-templates.github.io/webpack for documentation. |
module.exports = { | ||
NODE_ENV: '"production"' | ||
} |
@@ -0,0 +0,0 @@ var merge = require('webpack-merge') |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueTabs=e():t.VueTabs=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var s=n[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=5)}([function(t,e){t.exports=function(t,e,n,o){var s,i=t=t||{},a=typeof t.default;"object"!==a&&"function"!==a||(s=t,i=t.default);var r="function"==typeof i?i.options:i;if(e&&(r.render=e.render,r.staticRenderFns=e.staticRenderFns),n&&(r._scopeId=n),o){var u=Object.create(r.computed||null);Object.keys(o).forEach(function(t){var e=o[t];u[t]=function(){return e}}),r.computed=u}return{esModule:s,exports:i,options:r}}},function(t,e,n){var o=n(0)(n(3),n(8),null,null);o.options.__file="C:\\work\\vue-tabs\\src\\components\\TabContent.vue",o.esModule&&Object.keys(o.esModule).some(function(t){return"default"!==t&&"__esModule"!==t})&&console.error("named exports are not supported in *.vue files."),o.options.functional&&console.error("[vue-loader] TabContent.vue: functional components are not supported with templates, they should use render functions."),t.exports=o.exports},function(t,e,n){n(7),n(6);var o=n(0)(n(4),n(9),null,null);o.options.__file="C:\\work\\vue-tabs\\src\\components\\VueTabs.vue",o.esModule&&Object.keys(o.esModule).some(function(t){return"default"!==t&&"__esModule"!==t})&&console.error("named exports are not supported in *.vue files."),o.options.functional&&console.error("[vue-loader] VueTabs.vue: functional components are not supported with templates, they should use render functions."),t.exports=o.exports},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={name:"v-tab",props:{title:{type:String,default:""},icon:{type:String,default:""},beforeChange:{type:Function},route:{type:[String,Object]},transitionName:String,transitionMode:String},computed:{isValidParent:function(){return"vue-tabs"===this.$parent.$options.name}},data:function(){return{active:!1}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={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,startIndex:{type:Number,default:0}},data:function(){return{activeTabIndex:0,tabs:[]}},computed:{tabCount:function(){return this.tabs.length},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}},activeTitleColor:function(){return{color:this.activeTabColor}}},methods:{navigateToTab:function(t){this.beforeTabChange(this.activeTabIndex)&&this.changeTab(this.activeTabIndex,t)},beforeTabChange:function(t){var e=this.tabs[t];return!e||void 0===e.beforeChange||e.beforeChange()},changeTab:function(t,e){if(!(e<0||e>=this.tabCount)){var n=this.tabs[t],o=this.tabs[e];n&&(n.active=!1,o&&(o.active=!0)),this.activeTabIndex=e,this.tryChangeRoute(o)}},tryChangeRoute:function(t){this.$router&&t&&t.route&&this.$router.push(t.route)}},mounted:function(){if(this.tabs=this.$children.filter(function(t){return"v-tab"===t.$options.name}),this.tabs.length>0&&0===this.startIndex){var t=this.tabs[this.activeTabIndex];t.active=!0,this.tryChangeRoute(t)}if(this.startIndex<this.tabs.length){var e=this.tabs[this.startIndex];this.activeTabIndex=this.startIndex,e.active=!0,this.tryChangeRoute(this.tabs[this.startIndex])}else console.warn("Prop startIndex set to "+this.startIndex+" is greater than the number of tabs - "+this.tabs.length+". Make sure that the starting index is less than the number of tabs registered")}}},function(t,e,n){t.exports={VueTabs:n(2),VTab:n(1),install:function(e){e.component("vue-tabs",t.exports.VueTabs),e.component("v-tab",t.exports.VTab)}}},function(t,e){},function(t,e){},function(t,e,n){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return t.active?n("div",{staticClass:"tab-container"},[t._t("default")],2):t._e()},staticRenderFns:[]},t.exports.render._withStripped=!0},function(t,e,n){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vue-tabs",class:t.stackedClass},[n("ul",{class:t.classList},[t._l(t.tabs,function(e,o){return t._t("tab",[n("li",{key:e,staticClass:"tab",class:{active:e.active}},["top"===t.textPosition?n("span",{staticClass:"title title_top",style:e.active?t.activeTitleColor:{}},[t._v("\n "+t._s(e.title)+"\n ")]):t._e(),t._v(" "),n("a",{style:e.active?t.activeTabStyle:{},attrs:{href:""},on:{click:function(e){e.preventDefault(),t.navigateToTab(o)}}},[n("i",{class:e.icon},["center"===t.textPosition?n("span",[t._v("\n "+t._s(e.title)+"\n ")]):t._e()])]),t._v(" "),"bottom"===t.textPosition?n("span",{staticClass:"title title_bottom",style:e.active?t.activeTitleColor:{}},[t._v("\n "+t._s(e.title)+"\n ")]):t._e()])],{tab:e,index:o,clickHandler:t.navigateToTab})})],2),t._v(" "),n("div",{staticClass:"tab-content"},[t._t("default")],2)])},staticRenderFns:[]},t.exports.render._withStripped=!0}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VueTabs=e():t.VueTabs=e()}(this,function(){return function(t){function e(i){if(n[i])return n[i].exports;var a=n[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=5)}([function(t,e){t.exports=function(t,e,n,i){var a,o=t=t||{},r=typeof t.default;"object"!==r&&"function"!==r||(a=t,o=t.default);var s="function"==typeof o?o.options:o;if(e&&(s.render=e.render,s.staticRenderFns=e.staticRenderFns),n&&(s._scopeId=n),i){var u=Object.create(s.computed||null);Object.keys(i).forEach(function(t){var e=i[t];u[t]=function(){return e}}),s.computed=u}return{esModule:a,exports:o,options:s}}},function(t,e,n){var i=n(0)(n(3),n(8),null,null);i.options.__file="C:\\work\\Github\\vue-tabs\\src\\components\\TabContent.vue",i.esModule&&Object.keys(i.esModule).some(function(t){return"default"!==t&&"__esModule"!==t})&&console.error("named exports are not supported in *.vue files."),i.options.functional&&console.error("[vue-loader] TabContent.vue: functional components are not supported with templates, they should use render functions."),t.exports=i.exports},function(t,e,n){n(7),n(6);var i=n(0)(n(4),n(9),null,null);i.options.__file="C:\\work\\Github\\vue-tabs\\src\\components\\VueTabs.vue",i.esModule&&Object.keys(i.esModule).some(function(t){return"default"!==t&&"__esModule"!==t})&&console.error("named exports are not supported in *.vue files."),i.options.functional&&console.error("[vue-loader] VueTabs.vue: functional components are not supported with templates, they should use render functions."),t.exports=i.exports},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={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}}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={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,startIndex:{type:Number,default:0}},data:function(){return{activeTabIndex:0,tabs:[]}},computed:{tabCount:function(){return this.tabs.length},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}},activeTitleColor:function(){return{color:this.activeTabColor}}},methods:{navigateToTab:function(t){var e=this;this.beforeTabChange(this.activeTabIndex,function(){e.changeTab(e.activeTabIndex,t)})},setLoading:function(t){this.loading=t,this.$emit("on-loading",t)},setValidationError:function(t,e){this.tabs[this.activeTabIndex].validationError=e,this.$emit("on-error",e),e&&t.$emit&&t.$emit("on-error",e)},validateBeforeChange:function(t,e,n){var i=this;if(this.setValidationError(e,null),t.then&&"function"==typeof t.then)this.setLoading(!0),t.then(function(t){i.setLoading(!1);var e=!0===t;i.executeBeforeChange(e,n)}).catch(function(t){i.setLoading(!1),i.setValidationError(e,t)});else{var a=!0===t;this.executeBeforeChange(a,n)}},executeBeforeChange:function(t,e){this.$emit("on-validate",t,this.activeTabIndex),t?e():this.tabs[this.activeTabIndex].validationError="error"},beforeTabChange:function(t,e){if(!this.loading){var n=this.tabs[t];if(n&&void 0!==n.beforeChange){var i=n.beforeChange();this.validateBeforeChange(i,n,e)}else e()}},changeTab:function(t,e){if(!(e<0||e>=this.tabCount)){var n=this.tabs[t],i=this.tabs[e];n&&(n.active=!1,i&&(i.active=!0)),this.activeTabIndex=e,this.$emit("tab-change",e,i,n),this.tryChangeRoute(i)}},tryChangeRoute:function(t){this.$router&&t&&t.route&&this.$router.push(t.route)}},mounted:function(){if(this.tabs=this.$children.filter(function(t){return"v-tab"===t.$options.name}),this.tabs.length>0&&0===this.startIndex){var t=this.tabs[this.activeTabIndex];t.active=!0,this.tryChangeRoute(t)}if(this.startIndex<this.tabs.length){var e=this.tabs[this.startIndex];this.activeTabIndex=this.startIndex,e.active=!0,this.tryChangeRoute(this.tabs[this.startIndex])}else console.warn("Prop startIndex set to "+this.startIndex+" is greater than the number of tabs - "+this.tabs.length+". Make sure that the starting index is less than the number of tabs registered")}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),a=n.n(i),o=n(1),r=n.n(o),s={VueTabs:a.a,VTab:r.a,install:function(t){t.component("vue-tabs",a.a),t.component("v-tab",r.a)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(s),e.default=s},function(t,e){},function(t,e){},function(t,e,n){t.exports={render:function(){var t=this,e=t.$createElement;return(t._self._c||e)("section",{staticClass:"tab-container",attrs:{role:"tabpanel",id:t.hash,"aria-hidden":!t.active}},[t._t("default")],2)},staticRenderFns:[]},t.exports.render._withStripped=!0},function(t,e,n){t.exports={render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"vue-tabs",class:t.stackedClass},[n("ul",{class:t.classList,attrs:{role:"tablist"}},[t._l(t.tabs,function(e,i){return t._t("tab",[n("li",{key:e,staticClass:"tab",class:{active:e.active},attrs:{role:"presentation"}},["top"===t.textPosition?n("span",{staticClass:"title title_top",style:e.active?t.activeTitleColor:{}},[t._v("\n "+t._s(e.title)+"\n ")]):t._e(),t._v(" "),n("a",{style:e.active?t.activeTabStyle:{},attrs:{href:"#"+e.id,"aria-selected":e.active,"aria-controls":"#"+e.id,role:"tab"},on:{click:function(e){e.preventDefault(),t.navigateToTab(i)}}},[n("i",{class:e.icon},["center"===t.textPosition?n("span",[t._v("\n "+t._s(e.title)+"\n ")]):t._e()])]),t._v(" "),"bottom"===t.textPosition?n("span",{staticClass:"title title_bottom",style:e.active?t.activeTitleColor:{}},[t._v("\n "+t._s(e.title)+"\n ")]):t._e()])],{tab:e,index:i,clickHandler:t.navigateToTab})})],2),t._v(" "),n("div",{staticClass:"tab-content"},[t._t("default")],2)])},staticRenderFns:[]},t.exports.render._withStripped=!0}])}); |
{ | ||
"name": "vue-nav-tabs", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "A vue based tab component", | ||
@@ -5,0 +5,0 @@ "main": "dist/vue-tabs.js", |
@@ -10,87 +10,3 @@ # Vue-tabs | ||
## Usage | ||
## NPM | ||
`npm install vue-nav-tabs` | ||
## [Documentation](https://cristijora.github.io/vue-tabs/#/) | ||
## Or alternatively directly include the javascript | ||
Download the css and js files from `dist` folder or reference them directly from github (check jsfiddle links) | ||
```html | ||
<link rel="stylesheet" href="vue-tabs.min.css"> | ||
<script src="vue-tabs.js"></script> | ||
``` | ||
## Component registration | ||
```js | ||
//global registration | ||
import VueTabs from 'vue-nav-tabs' | ||
import 'vue-nav-tabs/dist/vue-tabs.min.css' | ||
Vue.use(VueTabs) | ||
//local registration | ||
import {VueTabs, VTab} from 'vue-nav-tabs' | ||
import 'vue-nav-tabs/dist/vue-tabs.min.css' | ||
//component code | ||
components: { | ||
VueTabs, | ||
VTab | ||
} | ||
``` | ||
```html | ||
<vue-tabs> | ||
<v-tab title="First tab"> | ||
First tab content | ||
</v-tab> | ||
<v-tab title="Second tab"> | ||
Second tab content | ||
</v-tab> | ||
<v-tab title="Third tab"> | ||
Third tab content | ||
</v-tab> | ||
</vue-tabs> | ||
``` | ||
# Props | ||
## Vue-tabs props | ||
```js | ||
props: { | ||
title: { | ||
type: String, | ||
default: '' | ||
}, | ||
/*** | ||
* Icon name for the upper circle corresponding to the tab | ||
* Supports themify icons only for now. | ||
*/ | ||
icon: { | ||
type: String, | ||
default: '' | ||
}, | ||
/*** | ||
* Function to execute before tab switch. Return value must be boolean | ||
* If the return result is false, tab switch is restricted | ||
*/ | ||
beforeChange: { | ||
type: Function | ||
}, | ||
route: { | ||
type: [String, Object] | ||
} | ||
} | ||
``` | ||
## V-tab props | ||
```js | ||
props: { | ||
title: { | ||
type: String, | ||
default: '' | ||
}, | ||
icon: { | ||
type: String, | ||
default: '' | ||
} | ||
} | ||
``` |
@@ -1,10 +0,15 @@ | ||
module.exports = { | ||
VueTabs: require('./components/VueTabs.vue'), | ||
VTab: require('./components/TabContent.vue'), | ||
import VueTabs from './components/VueTabs.vue' | ||
import VTab from './components/TabContent.vue' | ||
const VueTabsPlugin = { | ||
VueTabs: VueTabs, | ||
VTab: VTab, | ||
install: function (Vue) { | ||
Vue.component('vue-tabs', module.exports.VueTabs) | ||
Vue.component('v-tab', module.exports.VTab) | ||
Vue.component('vue-tabs', VueTabs) | ||
Vue.component('v-tab', VTab) | ||
} | ||
} | ||
// Automatic installation if Vue has been added to the global scope. | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
window.Vue.use(VueTabsPlugin) | ||
} | ||
export default VueTabsPlugin |
@@ -0,0 +0,0 @@ // A custom Nightwatch assertion. |
@@ -0,0 +0,0 @@ require('babel-register') |
@@ -0,0 +0,0 @@ // 1. start the dev server using production config |
@@ -0,0 +0,0 @@ // For authoring Nightwatch tests, see |
@@ -0,0 +0,0 @@ import Vue from 'vue' |
@@ -0,0 +0,0 @@ // This is a karma config file. For more details see |
@@ -79,6 +79,3 @@ var webpack = require("webpack"); | ||
new ExtractTextPlugin({filename:"vue-tabs.min.css", allChunks: true, fallback:"style-loader" }), | ||
new StatsPlugin( {filename:"./stats.json", | ||
chunkModules: true | ||
//exclude: [/node_modules[\\\/]react/] | ||
}), | ||
new StatsPlugin('stats.json'), | ||
], | ||
@@ -85,0 +82,0 @@ |
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
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
907743
66
1916
12