vue-tree-navigation
Advanced tools
Comparing version 1.0.2 to 2.0.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueTreeNavigation=t():e.VueTreeNavigation=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t){function n(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var i=r(o);return[n].concat(o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"})).concat([i]).join("\n")}return[n].join("\n")}function r(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r=n(t,e);return t[2]?"@media "+t[2]+"{"+r+"}":r}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<e.length;o++){var a=e[o];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(e,t,n){function r(e){for(var t=0;t<e.length;t++){var n=e[t],r=c[n.id];if(r){r.refs++;for(var o=0;o<r.parts.length;o++)r.parts[o](n.parts[o]);for(;o<n.parts.length;o++)r.parts.push(i(n.parts[o]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{for(var a=[],o=0;o<n.parts.length;o++)a.push(i(n.parts[o]));c[n.id]={id:n.id,refs:1,parts:a}}}}function o(){var e=document.createElement("style");return e.type="text/css",f.appendChild(e),e}function i(e){var t,n,r=document.querySelector('style[data-vue-ssr-id~="'+e.id+'"]');if(r){if(v)return g;r.parentNode.removeChild(r)}if(h){var i=p++;r=d||(d=o()),t=a.bind(null,r,i,!1),n=a.bind(null,r,i,!0)}else r=o(),t=s.bind(null,r),n=function(){r.parentNode.removeChild(r)};return t(e),function(r){if(r){if(r.css===e.css&&r.media===e.media&&r.sourceMap===e.sourceMap)return;t(e=r)}else n()}}function a(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=y(t,o);else{var i=document.createTextNode(o),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(i,a[t]):e.appendChild(i)}}function s(e,t){var n=t.css,r=t.media,o=t.sourceMap;if(r&&e.setAttribute("media",r),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var u="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!u)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var l=n(12),c={},f=u&&(document.head||document.getElementsByTagName("head")[0]),d=null,p=0,v=!1,g=function(){},h="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,n){v=n;var o=l(e,t);return r(o),function(t){for(var n=[],i=0;i<o.length;i++){var a=o[i],s=c[a.id];s.refs--,n.push(s)}t?(o=l(e,t),r(o)):o=[];for(var i=0;i<n.length;i++){var s=n[i];if(0===s.refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete c[s.id]}}}};var y=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e,t,n,r,o,i){var a,s=e=e||{},u=typeof e.default;"object"!==u&&"function"!==u||(a=e,s=e.default);var l="function"==typeof s?s.options:s;t&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0),n&&(l.functional=!0),o&&(l._scopeId=o);var c;if(i?(c=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},l._ssrRegister=c):r&&(c=r),c){var f=l.functional,d=f?l.render:l.beforeCreate;f?(l._injectStyles=c,l.render=function(e,t){return c.call(t),d(e,t)}):l.beforeCreate=d?[].concat(d,c):[c]}return{esModule:a,exports:s,options:l}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(13),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default={data:function(){return{closed:this.level>this.defaultOpenLevel}},props:{level:{type:Number,required:!0},defaultOpenLevel:{type:Number,required:!0}},computed:{classes:function(){return{closed:this.closed}}},watch:{defaultOpenLevel:function(){this.closed=this.level>this.defaultOpenLevel}},methods:{toggle:function(){this.closed=!this.closed}},components:{"navigation-toggle":o.default}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{isClosed:{type:Boolean,required:!0}},computed:{classes:function(){return{closed:this.isClosed}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=function(e){return e&&e.__esModule?e:{default:e}}(r);o.default.install=function(e){e.component(o.default.name,o.default)},t.default=o.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8),o=function(e){return e&&e.__esModule?e:{default:e}}(r);n(18);var i={name:"vue-tree-navigation",data:function(){return{classes:["tree-navigation"]}},props:{items:{type:Array,required:!0},defaultOpenLevel:{type:Number,default:0}},render:function(e){var t=this,n=e("ul",o.default.generateLevel(e,t.items,1,t.defaultOpenLevel));return e("div",{class:t.classes},[n])}};t.default=i},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t,n){return void 0!==n?e("a",{attrs:{href:n}},[t]):t}function i(e,t,n,a){var u=[];return t.forEach(function(t){var l=o(e,t.name,t.href);t.hasOwnProperty("children")?u.push(e(s.default,{props:{level:n,defaultOpenLevel:a}},[l].concat(r(i(e,t.children,n+1,a))))):u.push(e("li",[l]))}),u}Object.defineProperty(t,"__esModule",{value:!0});var a=n(9),s=function(e){return e&&e.__esModule?e:{default:e}}(a);t.default={generateLevel:i}},function(e,t,n){"use strict";function r(e){n(10)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),i=n.n(o);for(var a in o)"default"!==a&&function(e){n.d(t,e,function(){return o[e]})}(a);var s=n(17),u=n(2),l=r,c=u(i.a,s.a,!1,l,null,null);t.default=c.exports},function(e,t,n){var r=n(11);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("4d090b5a",r,!0)},function(e,t,n){t=e.exports=n(0)(void 0),t.push([e.i,".navigation-list.closed li,.navigation-list.closed ul{display:none}",""])},function(e,t){e.exports=function(e,t){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],a=i[0],s=i[1],u=i[2],l=i[3],c={id:e+":"+o,css:s,media:u,sourceMap:l};r[a]?r[a].parts.push(c):n.push(r[a]={id:a,parts:[c]})}return n}},function(e,t,n){"use strict";function r(e){n(14)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),i=n.n(o);for(var a in o)"default"!==a&&function(e){n.d(t,e,function(){return o[e]})}(a);var s=n(16),u=n(2),l=r,c=u(i.a,s.a,!1,l,null,null);t.default=c.exports},function(e,t,n){var r=n(15);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("3da26586",r,!0)},function(e,t,n){t=e.exports=n(0)(void 0),t.push([e.i,".navigation-toggle{position:relative;top:-3px;padding:6px;cursor:pointer}.navigation-toggle .navigation-toggle-icon{display:inline-block;padding:3px;border:solid #000;border-width:0 2px 2px 0;transform:rotate(45deg)}.navigation-toggle.closed .navigation-toggle-icon{transform:rotate(-45deg)}",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("span",{staticClass:"navigation-toggle",class:e.classes},[n("span",{staticClass:"navigation-toggle-icon"})])},o=[],i={render:r,staticRenderFns:o};t.a=i},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("ul",{staticClass:"navigation-list",class:e.classes},[n("navigation-toggle",{attrs:{isClosed:e.closed},nativeOn:{click:function(t){e.toggle(t)}}}),e._v(" "),e._t("default")],2)},o=[],i={render:r,staticRenderFns:o};t.a=i},function(e,t,n){var r=n(19);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("7915500d",r,!0)},function(e,t,n){t=e.exports=n(0)(void 0),t.push([e.i,".tree-navigation{display:inline-block}.tree-navigation ul{padding-left:15px;font-weight:700;line-height:30px;text-align:left;list-style-type:none}.tree-navigation ul li{padding-left:40px;font-weight:400}.tree-navigation>ul{padding-left:0}",""])}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.VueTreeNavigation=t():e.VueTreeNavigation=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=5)}([function(e,t){function n(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var a=r(o);return[n].concat(o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"})).concat([a]).join("\n")}return[n].join("\n")}function r(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r=n(t,e);return t[2]?"@media "+t[2]+"{"+r+"}":r}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o<this.length;o++){var a=this[o][0];"number"==typeof a&&(r[a]=!0)}for(o=0;o<e.length;o++){var i=e[o];"number"==typeof i[0]&&r[i[0]]||(n&&!i[2]?i[2]=n:n&&(i[2]="("+i[2]+") and ("+n+")"),t.push(i))}},t}},function(e,t,n){function r(e){for(var t=0;t<e.length;t++){var n=e[t],r=d[n.id];if(r){r.refs++;for(var o=0;o<r.parts.length;o++)r.parts[o](n.parts[o]);for(;o<n.parts.length;o++)r.parts.push(a(n.parts[o]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{for(var i=[],o=0;o<n.parts.length;o++)i.push(a(n.parts[o]));d[n.id]={id:n.id,refs:1,parts:i}}}}function o(){var e=document.createElement("style");return e.type="text/css",f.appendChild(e),e}function a(e){var t,n,r=document.querySelector('style[data-vue-ssr-id~="'+e.id+'"]');if(r){if(v)return h;r.parentNode.removeChild(r)}if(g){var a=p++;r=c||(c=o()),t=i.bind(null,r,a,!1),n=i.bind(null,r,a,!0)}else r=o(),t=s.bind(null,r),n=function(){r.parentNode.removeChild(r)};return t(e),function(r){if(r){if(r.css===e.css&&r.media===e.media&&r.sourceMap===e.sourceMap)return;t(e=r)}else n()}}function i(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=m(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function s(e,t){var n=t.css,r=t.media,o=t.sourceMap;if(r&&e.setAttribute("media",r),o&&(n+="\n/*# sourceURL="+o.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var u="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!u)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var l=n(12),d={},f=u&&(document.head||document.getElementsByTagName("head")[0]),c=null,p=0,v=!1,h=function(){},g="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,n){v=n;var o=l(e,t);return r(o),function(t){for(var n=[],a=0;a<o.length;a++){var i=o[a],s=d[i.id];s.refs--,n.push(s)}t?(o=l(e,t),r(o)):o=[];for(var a=0;a<n.length;a++){var s=n[a];if(0===s.refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete d[s.id]}}}};var m=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e,t,n,r,o,a){var i,s=e=e||{},u=typeof e.default;"object"!==u&&"function"!==u||(i=e,s=e.default);var l="function"==typeof s?s.options:s;t&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0),n&&(l.functional=!0),o&&(l._scopeId=o);var d;if(a?(d=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=d):r&&(d=r),d){var f=l.functional,c=f?l.render:l.beforeCreate;f?(l._injectStyles=d,l.render=function(e,t){return d.call(t),c(e,t)}):l.beforeCreate=c?[].concat(c,d):[d]}return{esModule:i,exports:s,options:l}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(13),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default={data:function(){return{closed:this.level>this.defaultOpenLevel}},props:{level:{type:Number,required:!0},defaultOpenLevel:{type:Number,required:!0}},computed:{classes:function(){return{closed:this.closed}}},watch:{defaultOpenLevel:function(){this.closed=this.level>this.defaultOpenLevel}},methods:{toggle:function(){this.closed=!this.closed}},components:{"navigation-toggle":o.default}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{isClosed:{type:Boolean,required:!0}},computed:{classes:function(){return{closed:this.isClosed}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=function(e){return e&&e.__esModule?e:{default:e}}(r);t.default=o.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=function(e){return e&&e.__esModule?e:{default:e}}(r);o.default.install=function(e){e.component(o.default.name,o.default)},t.default=o.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8),o=function(e){return e&&e.__esModule?e:{default:e}}(r);n(19);var a={name:"vue-tree-navigation",data:function(){return{classes:["tree-navigation"]}},props:{items:{type:Array,required:!0},defaultOpenLevel:{type:Number,default:0}},computed:{itemsWithMetadata:function(){var e=this,t=JSON.parse(JSON.stringify(e.items));return o.default.insertMetadataToItems(t)}},render:function(e){var t=this,n=e("ul",o.default.generateLevel(e,t.itemsWithMetadata,1,t.defaultOpenLevel));return e("div",{class:t.classes},[n])}};t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function a(e,t){if(void 0===t.route&&void 0===t.element)return t.name;var n=void 0,r=void 0,o=void 0,a=void 0;return t.meta.pathType===m&&(n="a",r={href:t.meta.path},o={},a=[]),t.meta.pathType===y&&(n="router-link",r={},o={to:t.meta.path},a=["router-link"]),e(n,{attrs:r,props:o,class:a},[t.name])}function i(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function s(e){if(void 0!==e)return"/"!==e[0]&&(e="/"+e),"/"===e[e.length-1]&&(e=e.slice(0,-1)),e}function u(e){if(void 0!==e)return"#"!==e[0]&&(e="#"+e),e}function l(e,t){var n=u(e.element),r=s(e.route);if(void 0===t){if(void 0===n&&void 0===r)return{path:void 0,pathType:g};if(void 0!==r)return{path:r,pathType:y};if(void 0!==n)return{path:n,pathType:m}}if(t.meta.pathType===y&&void 0!==r){return{path:i(t.meta.path)+r,pathType:y}}if(t.meta.pathType===y&&void 0!==n){return{path:i(t.meta.path)+n,pathType:y}}if(t.meta.pathType===y&&void 0===n&&void 0===r){return{path:i(t.meta.path),pathType:y}}return t.meta.pathType===m&&void 0!==r?{path:r,pathType:y}:t.meta.pathType===m&&void 0!==n?{path:n,pathType:m}:t.meta.pathType===m&&void 0===n&&void 0===r?{path:void 0,pathType:g}:t.meta.pathType===g&&void 0!==r?{path:r,pathType:y}:t.meta.pathType===g&&void 0!==n?{path:n,pathType:m}:t.meta.pathType===g&&void 0===n&&void 0===r?{path:void 0,pathType:g}:void 0}function d(e,t){return e.forEach(function(e){e.meta=l(e,t),e.hasOwnProperty("children")&&(e.children=d(e.children,e))}),e}function f(e,t,n,r){var i=[];return t.forEach(function(t){var s=a(e,t);t.hasOwnProperty("children")?i.push(e(p.default,{props:{level:n,defaultOpenLevel:r}},[s].concat(o(f(e,t.children,n+1,r))))):i.push(e("li",[s]))}),i}Object.defineProperty(t,"__esModule",{value:!0});var c=n(9),p=r(c),v=n(18),h=r(v),g=h.default.PATH_TYPE_NONE,m=h.default.PATH_TYPE_ELEMENT,y=h.default.PATH_TYPE_ROUTE;t.default={sanitizeRoute:s,sanitizeElement:u,removeElementFromPath:i,getItemMetadata:l,insertMetadataToItems:d,generateLevel:f}},function(e,t,n){"use strict";function r(e){n(10)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),a=n.n(o);for(var i in o)"default"!==i&&function(e){n.d(t,e,function(){return o[e]})}(i);var s=n(17),u=n(2),l=r,d=u(a.a,s.a,!1,l,null,null);t.default=d.exports},function(e,t,n){var r=n(11);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("4d090b5a",r,!0)},function(e,t,n){t=e.exports=n(0)(void 0),t.push([e.i,".navigation-list.closed li,.navigation-list.closed ul{display:none}",""])},function(e,t){e.exports=function(e,t){for(var n=[],r={},o=0;o<t.length;o++){var a=t[o],i=a[0],s=a[1],u=a[2],l=a[3],d={id:e+":"+o,css:s,media:u,sourceMap:l};r[i]?r[i].parts.push(d):n.push(r[i]={id:i,parts:[d]})}return n}},function(e,t,n){"use strict";function r(e){n(14)}Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),a=n.n(o);for(var i in o)"default"!==i&&function(e){n.d(t,e,function(){return o[e]})}(i);var s=n(16),u=n(2),l=r,d=u(a.a,s.a,!1,l,null,null);t.default=d.exports},function(e,t,n){var r=n(15);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("3da26586",r,!0)},function(e,t,n){t=e.exports=n(0)(void 0),t.push([e.i,".navigation-toggle{position:relative;top:-3px;padding:6px;cursor:pointer}.navigation-toggle .navigation-toggle-icon{display:inline-block;padding:3px;border:solid #000;border-width:0 2px 2px 0;transform:rotate(45deg)}.navigation-toggle.closed .navigation-toggle-icon{transform:rotate(-45deg)}",""])},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("span",{staticClass:"navigation-toggle",class:e.classes},[n("span",{staticClass:"navigation-toggle-icon"})])},o=[],a={render:r,staticRenderFns:o};t.a=a},function(e,t,n){"use strict";var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("ul",{staticClass:"navigation-list",class:e.classes},[n("navigation-toggle",{attrs:{isClosed:e.closed},nativeOn:{click:function(t){e.toggle(t)}}}),e._v(" "),e._t("default")],2)},o=[],a={render:r,staticRenderFns:o};t.a=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={PATH_TYPE_NONE:"none",PATH_TYPE_ELEMENT:"element",PATH_TYPE_ROUTE:"route"}},function(e,t,n){var r=n(20);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(1)("7915500d",r,!0)},function(e,t,n){t=e.exports=n(0)(void 0),t.push([e.i,".tree-navigation{display:inline-block}.tree-navigation ul{padding-left:15px;font-weight:700;line-height:30px;text-align:left;list-style-type:none}.tree-navigation ul li{padding-left:40px;font-weight:400}.tree-navigation>ul{padding-left:0}",""])}])}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "vue-tree-navigation", | ||
"version": "1.0.2", | ||
"description": "A Vue.js tree navigation", | ||
"version": "2.0.0", | ||
"description": "Vue.js 2 tree navigation", | ||
"keywords": [ | ||
@@ -34,6 +34,2 @@ "tree", | ||
}, | ||
"pre-commit": [ | ||
"lint", | ||
"test" | ||
], | ||
"dependencies": { | ||
@@ -60,5 +56,5 @@ "vue": "^2.5.11" | ||
"jest": "^22.0.4", | ||
"jest-plugin-context": "^2.6.0", | ||
"jest-serializer-vue": "^0.3.0", | ||
"node-sass": "^4.5.3", | ||
"pre-commit": "^1.2.2", | ||
"sass-loader": "^6.0.6", | ||
@@ -72,2 +68,3 @@ "stylelint": "^8.4.0", | ||
"vue-loader": "^13.0.5", | ||
"vue-router": "^3.0.1", | ||
"vue-template-compiler": "^2.4.4", | ||
@@ -94,4 +91,7 @@ "vue-test-utils": "^1.0.0-beta.8", | ||
"<rootDir>/node_modules/jest-serializer-vue" | ||
], | ||
"setupFiles": [ | ||
"jest-plugin-context/setup" | ||
] | ||
} | ||
} |
119
README.md
# vue-tree-navigation | ||
A Vue.js tree navigation menu | ||
Vue.js 2 tree navigation | ||
[Demo](https://vue-tree-navigation.misrob.cz) | ||
[Documentation/demo](https://vue-tree-navigation.misrob.cz) | ||
## Features: | ||
* unlimited number of levels | ||
* you can define default open level | ||
* focused on core functionality, only necessary styles included - just apply your own styles like I did for demo page :wink: | ||
## Installation | ||
```console | ||
$ npm install vue-tree-navigation | ||
``` | ||
**main.js** | ||
```javascript | ||
import VueTreeNavigation from 'vue-tree-navigation'; | ||
Vue.use(VueTreeNavigation); | ||
``` | ||
## Usage | ||
**file.vue** | ||
```html | ||
<vue-tree-navigation :items="items" :defaultOpenLevel="defaultOpenLevel" /> | ||
``` | ||
```javascript | ||
export default { | ||
... | ||
data() { | ||
return { | ||
items: [ | ||
{ name: 'First category', children: [ | ||
{ name: 'Category item', href: '#take-me-somewhere' }, | ||
{ name: 'Category item', href: '#take-me-somewhere' } | ||
]}, | ||
{ name: 'Second category', href: '#take-me-somewhere' } | ||
], | ||
defaultOpenLevel: 1 | ||
} | ||
}, | ||
... | ||
}; | ||
``` | ||
**items** `Array` | ||
An array containing navigation menu items. | ||
You don't need to specify `href` field. Menu item will be rendered as a simple value instead of a hyperlink in this case. | ||
**defaultOpenLevel** `Number` | ||
Optional. Default value is 0 (everything is closed). | ||
## Nuxt | ||
You can use the component in your [Nuxt.js](https://nuxtjs.org/) project if you disable server-side rendering for your Nuxt plugin: | ||
**plugins/vue-tree-navigation.js** | ||
```javascript | ||
import Vue from 'vue'; | ||
import VueTreeNavigation from 'vue-tree-navigation'; | ||
Vue.use(VueTreeNavigation); | ||
``` | ||
**nuxt.config.js** | ||
```javascript | ||
module.exports = { | ||
... | ||
plugins: [ | ||
{ src: '~plugins/vue-tree-navigation', ssr: false } | ||
], | ||
... | ||
} | ||
``` | ||
## Developers | ||
Install dependencies: | ||
```console | ||
$ npm install | ||
``` | ||
Run tests: | ||
```console | ||
$ npm run lint | ||
$ npm run test | ||
``` | ||
Run tests in verbose mode: | ||
```console | ||
$ npm run test:verbose | ||
``` | ||
Run development server: | ||
```console | ||
$ npm run dev | ||
``` | ||
Build: | ||
```console | ||
$ npm run build | ||
``` | ||
Run demo development server: | ||
```console | ||
$ cd demo | ||
$ npm install | ||
$ npm run dev | ||
``` | ||
Sorry, the diff of this file is not supported yet
103000
43
33
16