vue-tree-navigation
Advanced tools
Comparing version 2.0.0 to 2.1.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 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}",""])}])}); | ||
!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()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var a=t[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([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,a=n(12),o=(r=a)&&r.__esModule?r:{default: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";function r(e,t,n,r,a,o,i,s){var u=typeof(e=e||{}).default;"object"!==u&&"function"!==u||(e=e.default);var l,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=n,d._compiled=!0),r&&(d.functional=!0),o&&(d._scopeId=o),i?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),a&&a.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(i)},d._ssrRegister=l):a&&(l=s?function(){a.call(this,this.$root.$options.shadowRoot)}:a),l)if(d.functional){d._injectStyles=l;var f=d.render;d.render=function(e,t){return l.call(t),f(e,t)}}else{var c=d.beforeCreate;d.beforeCreate=c?[].concat(c,l):[l]}return{exports:e,options:d}}n.d(t,"a",function(){return r})},function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},a=0;a<t.length;a++){var o=t[a],i=o[0],s={id:e+":"+a,css:o[1],media:o[2],sourceMap:o[3]};r[i]?r[i].parts.push(s):n.push(r[i]={id:i,parts:[s]})}return n}n.r(t),n.d(t,"default",function(){return v});var a="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!a)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 o={},i=a&&(document.head||document.getElementsByTagName("head")[0]),s=null,u=0,l=!1,d=function(){},f=null,c="data-vue-ssr-id",p="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function v(e,t,n,a){l=n,f=a||{};var i=r(e,t);return h(i),function(t){for(var n=[],a=0;a<i.length;a++){var s=i[a];(u=o[s.id]).refs--,n.push(u)}t?h(i=r(e,t)):i=[];for(a=0;a<n.length;a++){var u;if(0===(u=n[a]).refs){for(var l=0;l<u.parts.length;l++)u.parts[l]();delete o[u.id]}}}}function h(e){for(var t=0;t<e.length;t++){var n=e[t],r=o[n.id];if(r){r.refs++;for(var a=0;a<r.parts.length;a++)r.parts[a](n.parts[a]);for(;a<n.parts.length;a++)r.parts.push(m(n.parts[a]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{var i=[];for(a=0;a<n.parts.length;a++)i.push(m(n.parts[a]));o[n.id]={id:n.id,refs:1,parts:i}}}}function g(){var e=document.createElement("style");return e.type="text/css",i.appendChild(e),e}function m(e){var t,n,r=document.querySelector("style["+c+'~="'+e.id+'"]');if(r){if(l)return d;r.parentNode.removeChild(r)}if(p){var a=u++;r=s||(s=g()),t=T.bind(null,r,a,!1),n=T.bind(null,r,a,!0)}else r=g(),t=function(e,t){var n=t.css,r=t.media,a=t.sourceMap;r&&e.setAttribute("media",r);f.ssrId&&e.setAttribute(c,t.id);a&&(n+="\n/*# sourceURL="+a.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */");if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.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()}}var y,_=(y=[],function(e,t){return y[e]=t,y.filter(Boolean).join("\n")});function T(e,t,n,r){var a=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=_(t,a);else{var o=document.createTextNode(a),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(o,i[t]):e.appendChild(o)}}},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var a=(i=r,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),o=r.sources.map(function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"});return[n].concat(o).concat([a]).join("\n")}var i;return[n].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},a=0;a<this.length;a++){var o=this[a][0];"number"==typeof o&&(r[o]=!0)}for(a=0;a<e.length;a++){var i=e[a];"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){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a});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){return e.toggle(t)}}}),e._v(" "),e._t("default")],2)},a=[]},function(e,t,n){"use strict";n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a});var r=function(){var e=this.$createElement,t=this._self._c||e;return t("span",{staticClass:"navigation-toggle",class:this.classes},[t("span",{staticClass:"navigation-toggle-icon"})])},a=[]},function(e,t,n){(e.exports=n(4)(!1)).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,n){var r=n(7);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n(3).default)("0965e660",r,!0,{})},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){(e.exports=n(4)(!1)).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){var r=n(10);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n(3).default)("13a093fa",r,!0,{})},function(e,t,n){"use strict";n.r(t);var r=n(0),a=n.n(r);for(var o in r)"default"!==o&&function(e){n.d(t,e,function(){return r[e]})}(o);var i=n(6),s=n(2);var u=function(e){n(11)},l=Object(s.a)(a.a,i.a,i.b,!1,u,null,null);t.default=l.exports},function(e,t,n){(e.exports=n(4)(!1)).push([e.i,".navigation-list.closed li,.navigation-list.closed ul{display:none}",""])},function(e,t,n){var r=n(13);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);(0,n(3).default)("15f9f40e",r,!0,{})},function(e,t,n){"use strict";n.r(t);var r=n(1),a=n.n(r);for(var o in r)"default"!==o&&function(e){n.d(t,e,function(){return r[e]})}(o);var i=n(5),s=n(2);var u=function(e){n(14)},l=Object(s.a)(a.a,i.a,i.b,!1,u,null,null);t.default=l.exports},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(15)),a=o(n(9));function o(e){return e&&e.__esModule?e:{default:e}}var i=a.default.PATH_TYPE_NONE,s=a.default.PATH_TYPE_ELEMENT,u=a.default.PATH_TYPE_ROUTE;function l(e){var t=e.indexOf("#");return-1===t?e:e.slice(0,t)}function d(e){if(void 0!==e)return"/"!==e[0]&&(e="/"+e),"/"===e[e.length-1]&&(e=e.slice(0,-1)),e}function f(e){if(void 0!==e)return"#"!==e[0]&&(e="#"+e),e}function c(e,t){var n=f(e.element),r=d(e.route);if(void 0===t){if(void 0===n&&void 0===r)return{path:void 0,pathType:i};if(void 0!==r)return{path:r,pathType:u};if(void 0!==n)return{path:n,pathType:s}}return t.meta.pathType===u&&void 0!==r?{path:l(t.meta.path)+r,pathType:u}:t.meta.pathType===u&&void 0!==n?{path:l(t.meta.path)+n,pathType:u}:t.meta.pathType===u&&void 0===n&&void 0===r?{path:l(t.meta.path),pathType:u}:t.meta.pathType===s&&void 0!==r?{path:r,pathType:u}:t.meta.pathType===s&&void 0!==n?{path:n,pathType:s}:t.meta.pathType===s&&void 0===n&&void 0===r?{path:void 0,pathType:i}:t.meta.pathType===i&&void 0!==r?{path:r,pathType:u}:t.meta.pathType===i&&void 0!==n?{path:n,pathType:s}:t.meta.pathType===i&&void 0===n&&void 0===r?{path:void 0,pathType:i}:void 0}t.default={sanitizeRoute:d,sanitizeElement:f,removeElementFromPath:l,getItemMetadata:c,insertMetadataToItems:function e(t,n){return t.forEach(function(t){t.meta=c(t,n),t.hasOwnProperty("children")&&(t.children=e(t.children,t))}),t},generateLevel:function e(t,n,a,o){var i=[];return n.forEach(function(n){var l=function(e,t){if(void 0===t.route&&void 0===t.element)return t.name;var n=void 0,r=void 0,a=void 0,o=void 0;return t.meta.pathType===s&&(n="a",r={href:t.meta.path},a={},o=[]),t.meta.pathType===u&&(n="router-link",r={},a={to:t.meta.path},o=["router-link"]),e(n,{attrs:r,props:a,class:o},[t.name])}(t,n);n.hasOwnProperty("children")?i.push(t(r.default,{props:{level:a,defaultOpenLevel:o}},[l].concat(function(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)}(e(t,n.children,a+1,o))))):i.push(t("li",[l]))}),i}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,a=n(16),o=(r=a)&&r.__esModule?r:{default:r};n(8);var i={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=JSON.parse(JSON.stringify(this.items));return o.default.insertMetadataToItems(e)}},render:function(e){var t=e("ul",o.default.generateLevel(e,this.itemsWithMetadata,1,this.defaultOpenLevel));return e("div",{class:this.classes},[t])}};t.default=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,a=n(17),o=(r=a)&&r.__esModule?r:{default: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,a=n(18),o=(r=a)&&r.__esModule?r:{default:r};t.default=o.default}])}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "vue-tree-navigation", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Vue.js 2 tree navigation", | ||
@@ -31,7 +31,9 @@ "keywords": [ | ||
"lint": "npm run lint:js & npm run lint:scss", | ||
"test": "jest", | ||
"test:verbose": "jest --verbose" | ||
"prettier-list": "prettier --list-different '**/*.{js,vue}' --ignore-path .eslintignore", | ||
"prettier": "prettier --write '**/*.{js,vue}' --ignore-path .eslintignore", | ||
"unit": "jest" | ||
}, | ||
"dependencies": { | ||
"vue": "^2.5.11" | ||
"vue": "^2.5.11", | ||
"webpack-merge": "^4.1.2" | ||
}, | ||
@@ -48,5 +50,7 @@ "devDependencies": { | ||
"eslint": "^4.13.1", | ||
"eslint-config-genius": "^0.1.4", | ||
"eslint-config-standard": "^11.0.0-beta.0", | ||
"eslint-config-prettier": "^2.9.0", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-html": "^4.0.1", | ||
"eslint-plugin-import": "^2.11.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.6.0", | ||
@@ -58,17 +62,19 @@ "eslint-plugin-standard": "^3.0.1", | ||
"jest-plugin-context": "^2.6.0", | ||
"jest-serializer-vue": "^0.3.0", | ||
"jest-serializer-vue": "^1.0.0", | ||
"node-sass": "^4.5.3", | ||
"prettier": "1.12.0", | ||
"sass-loader": "^6.0.6", | ||
"stylelint": "^8.4.0", | ||
"stylelint-config-recess-order": "^1.2.3", | ||
"stylelint": "^9.2.0", | ||
"stylelint-config-recess-order": "^2.0.0", | ||
"stylelint-config-standard": "^18.0.0", | ||
"stylelint-processor-html": "^1.0.0", | ||
"stylelint-scss": "^2.2.0", | ||
"vue-jest": "^1.4.0", | ||
"vue-loader": "^13.0.5", | ||
"stylelint-scss": "^3.0.0", | ||
"vue-jest": "^2.4.1", | ||
"vue-loader": "^14.2.2", | ||
"vue-router": "^3.0.1", | ||
"vue-template-compiler": "^2.4.4", | ||
"vue-test-utils": "^1.0.0-beta.8", | ||
"webpack": "^3.6.0", | ||
"webpack-dev-server": "^2.9.1" | ||
"webpack": "^4.5.0", | ||
"webpack-cli": "^2.0.14", | ||
"webpack-dev-server": "^3.1.3" | ||
}, | ||
@@ -85,3 +91,2 @@ "jest": { | ||
}, | ||
"mapCoverage": true, | ||
"moduleNameMapper": { | ||
@@ -88,0 +93,0 @@ "\\.(scss)$": "identity-obj-proxy" |
# vue-tree-navigation | ||
Vue.js 2 tree navigation | ||
> Vue.js 2 tree navigation with vue-router support | ||
[Documentation/demo](https://vue-tree-navigation.misrob.cz) | ||
For more information see [documentation/demo](https://vue-tree-navigation.misrob.cz) | ||
## Example | ||
```html | ||
<template> | ||
<vue-tree-navigation :items="items" :defaultOpenLevel="1" /> | ||
</template> | ||
<script> | ||
export default { | ||
data() { | ||
return { | ||
items: [ | ||
{ name: 'Products', children: [ // category label | ||
{ name: 'Shoes', route: 'shoes' } // #/shoes | ||
]}, | ||
{ name: 'About', route: 'about', children: [ // #/about | ||
{ name: 'Contact', route: 'contact', children: [ // #/about/contact | ||
{ name: 'E-mail', element: 'email' }, // #/about/contact#email | ||
{ name: 'Phone', element: 'phone' } // #/about/contact#phone | ||
]}, | ||
]}, | ||
], | ||
}; | ||
}, | ||
}; | ||
</script> | ||
``` | ||
## Installation | ||
### Include with a script tag | ||
```html | ||
<script src="https://unpkg.com/vue-tree-navigation@2.0.1/dist/vue-tree-navigation.js"></script> | ||
<script> | ||
Vue.use(VueTreeNavigation) | ||
</script> | ||
``` | ||
### NPM | ||
```console | ||
$ npm install vue-tree-navigation | ||
``` | ||
*main.js* | ||
```javascript | ||
import VueTreeNavigation from 'vue-tree-navigation'; | ||
Vue.use(VueTreeNavigation); | ||
``` | ||
## Requirements | ||
- [Vue.js](https://vuejs.org/) | ||
- [vue-router](https://router.vuejs.org/en/) (optional, only when you wish to use router links) | ||
## Developers | ||
```console | ||
$ npm run lint | ||
$ npm run test | ||
$ npm run test:verbose | ||
$ npm run dev | ||
$ npm run build | ||
$ yarn dev | ||
$ yarn build | ||
$ yarn prettier | ||
$ yarn lint | ||
$ yarn unit | ||
$ yarn unit --verbose | ||
``` |
Sorry, the diff of this file is not supported yet
121621
7
86
79
2
37
+ Addedwebpack-merge@^4.1.2
+ Addedlodash@4.17.21(transitive)
+ Addedwebpack-merge@4.2.2(transitive)