vue-tree-navigation
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -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()}(window,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},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=23)}([function(e,t,n){"use strict";function i(e,t,n,i,r,a,o,s){var u=typeof(e=e||{}).default;"object"!==u&&"function"!==u||(e=e.default);var l,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),i&&(c.functional=!0),a&&(c._scopeId=a),o?(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__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=l):r&&(l=s?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(c.functional){c._injectStyles=l;var f=c.render;c.render=function(e,t){return l.call(t),f(e,t)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,l):[l]}return{exports:e,options:c}}n.d(t,"a",function(){return i})},function(e,t,n){"use strict";function i(e,t){for(var n=[],i={},r=0;r<t.length;r++){var a=t[r],o=a[0],s={id:e+":"+r,css:a[1],media:a[2],sourceMap:a[3]};i[o]?i[o].parts.push(s):n.push(i[o]={id:o,parts:[s]})}return n}n.r(t),n.d(t,"default",function(){return v});var r="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!r)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 a={},o=r&&(document.head||document.getElementsByTagName("head")[0]),s=null,u=0,l=!1,c=function(){},f=null,d="data-vue-ssr-id",p="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function v(e,t,n,r){l=n,f=r||{};var o=i(e,t);return h(o),function(t){for(var n=[],r=0;r<o.length;r++){var s=o[r];(u=a[s.id]).refs--,n.push(u)}t?h(o=i(e,t)):o=[];for(r=0;r<n.length;r++){var u;if(0===(u=n[r]).refs){for(var l=0;l<u.parts.length;l++)u.parts[l]();delete a[u.id]}}}}function h(e){for(var t=0;t<e.length;t++){var n=e[t],i=a[n.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](n.parts[r]);for(;r<n.parts.length;r++)i.parts.push(m(n.parts[r]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var o=[];for(r=0;r<n.parts.length;r++)o.push(m(n.parts[r]));a[n.id]={id:n.id,refs:1,parts:o}}}}function g(){var e=document.createElement("style");return e.type="text/css",o.appendChild(e),e}function m(e){var t,n,i=document.querySelector("style["+d+'~="'+e.id+'"]');if(i){if(l)return c;i.parentNode.removeChild(i)}if(p){var r=u++;i=s||(s=g()),t=b.bind(null,i,r,!1),n=b.bind(null,i,r,!0)}else i=g(),t=function(e,t){var n=t.css,i=t.media,r=t.sourceMap;i&&e.setAttribute("media",i);f.ssrId&&e.setAttribute(d,t.id);r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,i),n=function(){i.parentNode.removeChild(i)};return t(e),function(i){if(i){if(i.css===e.css&&i.media===e.media&&i.sourceMap===e.sourceMap)return;t(e=i)}else n()}}var _,y=(_=[],function(e,t){return _[e]=t,_.filter(Boolean).join("\n")});function b(e,t,n,i){var r=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=y(t,r);else{var a=document.createTextNode(r),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}},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]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var r=(o=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),a=i.sources.map(function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"});return[n].concat(a).concat([r]).join("\n")}var o;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 i={},r=0;r<this.length;r++){var a=this[r][0];"number"==typeof a&&(i[a]=!0)}for(r=0;r<e.length;r++){var o=e[r];"number"==typeof o[0]&&i[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),t.push(o))}},t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={data:function(){return{active:!1}},props:{item:Object,required:!0},methods:{isActive:function(){return""!==this.item.meta.target&&(this.$route?this.$route.path+this.$route.hash===this.item.meta.target:window.location.href.endsWith(this.item.meta.target))}},computed:{showLabel:function(){return void 0===this.item.route&&void 0===this.item.element&&void 0===this.item.external},showRouterLink:function(){return this.showLink&&void 0!==this.$router},showHyperLink:function(){return this.showLink&&void 0===this.$router},showExternalHyperLink:function(){return void 0!==this.item.external},showLink:function(){return void 0!==this.item.route||void 0!==this.item.element},classes:function(){return{"NavigationItem--active":this.active}}},watch:{item:function(){this.active=this.isActive()},$route:function(){this.active=this.isActive()}},mounted:function(){var e=this;this.active=this.isActive(),this.$router||window.addEventListener("hashchange",function(){e.active=e.isActive()})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{open:{type:Boolean,required:!1,default:!1}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a(n(17)),r=a(n(9));function a(e){return e&&e.__esModule?e:{default:e}}t.default={data:function(){return{isOpen:this.open}},props:{parentItem:{type:Object,required:!0},level:{type:Number,required:!0},open:{type:Boolean,required:!1,default:!1}},computed:{classes:function(){return e={"NavigationLevel--closed":!this.isOpen},t="NavigationLevel--level-"+this.level,n=!0,t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e;var e,t,n}},methods:{onToggleClick:function(){this.isOpen=!this.isOpen},onItemClick:function(){!1===this.isOpen&&(this.isOpen=!0)}},components:{NavigationItem:r.default,NavigationToggle:i.default}}},function(e,t,n){"use strict";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return r});var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"NavigationLevel",class:e.classes},[n("div",{staticClass:"NavigationLevel__parent"},[n("NavigationToggle",{attrs:{open:e.isOpen},nativeOn:{click:function(t){return e.onToggleClick(t)}}}),e._v(" "),n("NavigationItem",{attrs:{item:e.parentItem},nativeOn:{click:function(t){return e.onItemClick(t)}}})],1),e._v(" "),n("ul",{staticClass:"NavigationLevel__children"},[e._t("default")],2)])},r=[]},function(e,t,n){"use strict";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return r});var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("span",{staticClass:"NavigationItem",class:e.classes},[e.showLabel?n("span",{staticClass:"NavigationItem__label"},[e._v(e._s(e.item.name))]):e._e(),e._v(" "),e.showRouterLink?n("router-link",{staticClass:"NavigationItem__router-link",attrs:{to:e.item.meta.target}},[e._v(e._s(e.item.name))]):e._e(),e._v(" "),e.showHyperLink?n("a",{staticClass:"NavigationItem__link",attrs:{href:e.item.meta.target}},[e._v(e._s(e.item.name))]):e._e(),e._v(" "),e.showExternalHyperLink?n("a",{staticClass:"NavigationItem__external-link",attrs:{href:e.item.meta.target,target:"_blank"}},[e._v(e._s(e.item.name))]):e._e()],1)},r=[]},function(e,t,n){"use strict";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return r});var i=function(){var e=this.$createElement,t=this._self._c||e;return t("span",{staticClass:"NavigationToggle",class:{"NavigationToggle--closed":!this.open}},[t("span",{staticClass:"NavigationToggle__icon",class:{"NavigationToggle__icon--closed":!this.open}})])},r=[]},function(e,t,n){"use strict";n.r(t);var i=n(3),r=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var o=n(7),s=n(0);var u=function(e){n(14)},l=Object(s.a)(r.a,o.a,o.b,!1,u,null,null);t.default=l.exports},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".TreeNavigation{display:inline-block;padding:0;margin:0}.TreeNavigation ul{padding:0;margin:0;list-style-type:none}.TreeNavigation li{padding-left:20px}",""])},function(e,t,n){var i=n(10);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(1).default)("0965e660",i,!0,{})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getRelativeUrl=function(e,t){var n=e.replace("/#/","/");return"/"===t[t.length-1]&&(t=t.slice(0,-1)),n=n.replace(t,""),r(n)};var i=t.removeElementFromPath=function(e){for(var t=void 0;-1!==t;){if(-1===(t=e.lastIndexOf("#")))return e;if(t===e.indexOf("#/"))return e;e=e.slice(0,t)}},r=(t.sanitizeElement=function(e){return void 0===e||""===e?e:("#"!==e[0]&&(e="#"+e),e)},t.sanitizeRoute=function(e){if(void 0!==e)return"/"!==e[0]&&(e="/"+e),"/"===e[e.length-1]&&(e=e.slice(0,-1)),e});t.startsWithUrl=function(e,t){return t.startsWith("/#")||(t=i(t)),!!e.startsWith(t)}},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".NavigationItem{display:inline-block;padding-top:5px;padding-bottom:5px}.NavigationItem span{cursor:pointer}",""])},function(e,t,n){var i=n(13);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(1).default)("14573478",i,!0,{})},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".NavigationToggle{position:relative;top:-3px;padding:5px 5px 5px 3px;cursor:pointer}.NavigationToggle__icon{display:inline-block;padding:3px;border:solid #000;border-width:0 2px 2px 0;transform:rotate(45deg)}.NavigationToggle__icon--closed{transform:rotate(-45deg)}",""])},function(e,t,n){var i=n(15);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(1).default)("13a093fa",i,!0,{})},function(e,t,n){"use strict";n.r(t);var i=n(4),r=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var o=n(8),s=n(0);var u=function(e){n(16)},l=Object(s.a)(r.a,o.a,o.b,!1,u,null,null);t.default=l.exports},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".NavigationLevel--closed ul{display:none}",""])},function(e,t,n){var i=n(18);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(1).default)("486a06cd",i,!0,{})},function(e,t,n){"use strict";n.r(t);var i=n(5),r=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);var o=n(6),s=n(0);var u=function(e){n(19)},l=Object(s.a)(r.a,o.a,o.b,!1,u,null,null);t.default=l.exports},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getItemMetadata=t.insertMetadataToItems=t.renderLevelAsOpen=t.generateLevel=void 0;var i=o(n(20)),r=o(n(9)),a=n(12);function o(e){return e&&e.__esModule?e:{default:e}}t.generateLevel=function e(t,n,a,o){var u=[];return n.forEach(function(n){if(n.hasOwnProperty("children")){var l=t(i.default,{props:{parentItem:n,level:a,open:s(n,a,o)}},[].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))));u.push(t("li",[l]))}else{var c=t(r.default,{props:{item:n}});u.push(t("li",[c]))}}),u};var s=t.renderLevelAsOpen=function(e,t,n){if(n>=t)return!0;var i=(0,a.getRelativeUrl)(window.location.href,window.location.origin);if(""!==e.meta.target&&!0===(0,a.startsWithUrl)(i,e.meta.target))return!0;for(var r=0;r<e.children.length;r++){var o=e.children[r];if(""!==o.meta.target&&!0===(0,a.startsWithUrl)(i,o.meta.target))return!0}return!1},u=(t.insertMetadataToItems=function e(t,n){return t.forEach(function(t){t.meta=u(t,n),t.hasOwnProperty("children")&&(t.children=e(t.children,t))}),t},t.getItemMetadata=function(e,t){var n=(0,a.sanitizeElement)(e.element),i=(0,a.sanitizeRoute)(e.route),r=e.external;if(void 0===t){if(void 0===n&&void 0===i&&void 0===r)return{path:"",target:""};if(void 0!==r)return{path:"",target:r};if(void 0!==i)return{path:i,target:i};if(void 0!==n)return{path:"",target:"/"+n}}var o=(0,a.sanitizeRoute)(t.meta.path);return void 0!==r?{path:o,target:r}:void 0!==i?{path:o+i,target:o+i}:void 0!==n?{path:o,target:(0,a.sanitizeRoute)(o+n)}:{path:o,target:""}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(21);n(11);var r={props:{items:{type:Array,required:!0},defaultOpenLevel:{type:Number,default:0}},computed:{itemsWithMetadata:function(){var e=JSON.parse(JSON.stringify(this.items));return(0,i.insertMetadataToItems)(e)}},render:function(e){return e("div",{class:"TreeNavigation"},[e("div",{class:["NavigationLevel","NavigationLevel--level-0"]},[e("ul",(0,i.generateLevel)(e,this.itemsWithMetadata,1,this.defaultOpenLevel))])])}};t.default=r},function(e,t,n){"use strict";var i,r=n(22),a=(i=r)&&i.__esModule?i:{default:i};e.exports={install:function(e,t){e.component("vue-tree-navigation",a.default)}}}])}); | ||
!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(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},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=29)}([function(e,t,n){"use strict";function i(e,t,n,i,r,a,o,s){var u,l="function"==typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),i&&(l.functional=!0),a&&(l._scopeId="data-v-"+a),o?(u=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__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},l._ssrRegister=u):r&&(u=s?function(){r.call(this,this.$root.$options.shadowRoot)}:r),u)if(l.functional){l._injectStyles=u;var c=l.render;l.render=function(e,t){return u.call(t),c(e,t)}}else{var f=l.beforeCreate;l.beforeCreate=f?[].concat(f,u):[u]}return{exports:e,options:l}}n.d(t,"a",function(){return i})},function(e,t,n){"use strict";function i(e,t){for(var n=[],i={},r=0;r<t.length;r++){var a=t[r],o=a[0],s={id:e+":"+r,css:a[1],media:a[2],sourceMap:a[3]};i[o]?i[o].parts.push(s):n.push(i[o]={id:o,parts:[s]})}return n}n.r(t),n.d(t,"default",function(){return v});var r="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!r)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 a={},o=r&&(document.head||document.getElementsByTagName("head")[0]),s=null,u=0,l=!1,c=function(){},f=null,d="data-vue-ssr-id",p="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function v(e,t,n,r){l=n,f=r||{};var o=i(e,t);return h(o),function(t){for(var n=[],r=0;r<o.length;r++){var s=o[r];(u=a[s.id]).refs--,n.push(u)}t?h(o=i(e,t)):o=[];for(r=0;r<n.length;r++){var u;if(0===(u=n[r]).refs){for(var l=0;l<u.parts.length;l++)u.parts[l]();delete a[u.id]}}}}function h(e){for(var t=0;t<e.length;t++){var n=e[t],i=a[n.id];if(i){i.refs++;for(var r=0;r<i.parts.length;r++)i.parts[r](n.parts[r]);for(;r<n.parts.length;r++)i.parts.push(m(n.parts[r]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var o=[];for(r=0;r<n.parts.length;r++)o.push(m(n.parts[r]));a[n.id]={id:n.id,refs:1,parts:o}}}}function g(){var e=document.createElement("style");return e.type="text/css",o.appendChild(e),e}function m(e){var t,n,i=document.querySelector("style["+d+'~="'+e.id+'"]');if(i){if(l)return c;i.parentNode.removeChild(i)}if(p){var r=u++;i=s||(s=g()),t=b.bind(null,i,r,!1),n=b.bind(null,i,r,!0)}else i=g(),t=function(e,t){var n=t.css,i=t.media,r=t.sourceMap;i&&e.setAttribute("media",i);f.ssrId&&e.setAttribute(d,t.id);r&&(n+="\n/*# sourceURL="+r.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(r))))+" */");if(e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}.bind(null,i),n=function(){i.parentNode.removeChild(i)};return t(e),function(i){if(i){if(i.css===e.css&&i.media===e.media&&i.sourceMap===e.sourceMap)return;t(e=i)}else n()}}var _,y=(_=[],function(e,t){return _[e]=t,_.filter(Boolean).join("\n")});function b(e,t,n,i){var r=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=y(t,r);else{var a=document.createTextNode(r),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(a,o[t]):e.appendChild(a)}}},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]||"",i=e[3];if(!i)return n;if(t&&"function"==typeof btoa){var r=(o=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),a=i.sources.map(function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"});return[n].concat(a).concat([r]).join("\n")}var o;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 i={},r=0;r<this.length;r++){var a=this[r][0];"number"==typeof a&&(i[a]=!0)}for(r=0;r<e.length;r++){var o=e[r];"number"==typeof o[0]&&i[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),t.push(o))}},t}},function(e,t,n){var i=n(19);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(1).default)("1263c5bb",i,!0,{})},function(e,t,n){var i=n(21);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(1).default)("231535cc",i,!0,{})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={data:function(){return{active:!1}},props:{item:Object,required:!0},methods:{isActive:function(){return""!==this.item.meta.target&&(this.$route?(this.$route.path+this.$route.hash).endsWith(this.item.meta.target):window.location.href.endsWith(this.item.meta.target))}},computed:{showLabel:function(){return void 0===this.item.route&&void 0===this.item.element&&void 0===this.item.external},showRouterLink:function(){return this.showLink&&void 0!==this.$router},showHyperLink:function(){return this.showLink&&void 0===this.$router},showExternalHyperLink:function(){return void 0!==this.item.external},showLink:function(){return void 0!==this.item.route||void 0!==this.item.element},classes:function(){return{"NavigationItem--active":this.active}}},watch:{item:function(){this.active=this.isActive()},$route:function(){this.active=this.isActive()}},mounted:function(){var e=this;this.active=this.isActive(),this.$router||window.addEventListener("hashchange",function(){e.active=e.isActive()})}}},function(e,t,n){"use strict";n.r(t);var i=n(5),r=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);t.default=r.a},function(e,t,n){var i=n(23);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(1).default)("63b4d5bb",i,!0,{})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{open:{type:Boolean,required:!1,default:!1}}}},function(e,t,n){"use strict";n.r(t);var i=n(8),r=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);t.default=r.a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a(n(25)),r=a(n(15));function a(e){return e&&e.__esModule?e:{default:e}}t.default={data:function(){return{isOpen:null}},props:{parentItem:{type:Object,required:!0},level:{type:Number,required:!0},defaultOpenLevel:{type:Number,required:!0}},computed:{classes:function(){return e={"NavigationLevel--closed":!this.isOpen},t="NavigationLevel--level-"+this.level,n=!0,t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e;var e,t,n}},methods:{onToggleClick:function(){this.isOpen=!this.isOpen},onItemClick:function(){!1===this.isOpen&&(this.isOpen=!0)},renderLevelAsOpen:function(){if(this.defaultOpenLevel>=this.level)return!0;var e=void 0;if(e=void 0!==this.$router?this.$route.path+this.$route.hash:window.location.pathname+window.location.hash,""!==this.parentItem.meta.target&&e.includes(this.parentItem.meta.target))return!0;for(var t=0;t<this.parentItem.children.length;t++){var n=this.parentItem.children[t];if(""!==n.meta.target&&e.includes(n.meta.target))return!0}return!1}},components:{NavigationItem:r.default,NavigationToggle:i.default},mounted:function(){this.isOpen=this.renderLevelAsOpen()}}},function(e,t,n){"use strict";n.r(t);var i=n(10),r=n.n(i);for(var a in i)"default"!==a&&function(e){n.d(t,e,function(){return i[e]})}(a);t.default=r.a},function(e,t,n){"use strict";var i=function(){var e=this.$createElement,t=this._self._c||e;return t("span",{staticClass:"NavigationToggle",class:{"NavigationToggle--closed":!this.open}},[t("span",{staticClass:"NavigationToggle__icon",class:{"NavigationToggle__icon--closed":!this.open}})])},r=[];n.d(t,"a",function(){return i}),n.d(t,"b",function(){return r})},function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("span",{staticClass:"NavigationItem",class:e.classes},[e.showLabel?n("span",{staticClass:"NavigationItem__label"},[e._v(e._s(e.item.name))]):e._e(),e._v(" "),e.showRouterLink?n("router-link",{staticClass:"NavigationItem__router-link",attrs:{to:e.item.meta.target}},[e._v(e._s(e.item.name))]):e._e(),e._v(" "),e.showHyperLink?n("a",{staticClass:"NavigationItem__link",attrs:{href:e.item.meta.target}},[e._v(e._s(e.item.name))]):e._e(),e._v(" "),e.showExternalHyperLink?n("a",{staticClass:"NavigationItem__external-link",attrs:{href:e.item.meta.target,target:"_blank"}},[e._v(e._s(e.item.name))]):e._e()],1)},r=[];n.d(t,"a",function(){return i}),n.d(t,"b",function(){return r})},function(e,t,n){"use strict";var i=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"NavigationLevel",class:e.classes},[n("div",{staticClass:"NavigationLevel__parent"},[n("NavigationToggle",{attrs:{open:e.isOpen},nativeOn:{click:function(t){return e.onToggleClick(t)}}}),e._v(" "),n("NavigationItem",{attrs:{item:e.parentItem},nativeOn:{click:function(t){return e.onItemClick(t)}}})],1),e._v(" "),n("ul",{staticClass:"NavigationLevel__children"},[e._t("default")],2)])},r=[];n.d(t,"a",function(){return i}),n.d(t,"b",function(){return r})},function(e,t,n){"use strict";n.r(t);var i=n(13),r=n(6);for(var a in r)"default"!==a&&function(e){n.d(t,e,function(){return r[e]})}(a);n(22);var o=n(0),s=Object(o.a)(r.default,i.a,i.b,!1,null,null,null);t.default=s.exports},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".TreeNavigation{display:inline-block;padding:0;margin:0}.TreeNavigation ul{padding:0;margin:0;list-style-type:none}.TreeNavigation li{padding-left:20px}",""])},function(e,t,n){var i=n(16);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,n(1).default)("0965e660",i,!0,{})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.sanitizeElement=function(e){return void 0===e||""===e?e:("#"!==e[0]&&(e="#"+e),e)},t.sanitizeRoute=function(e){if(void 0!==e)return"/"!==e[0]&&(e="/"+e),"/"===e[e.length-1]&&(e=e.slice(0,-1)),e}},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".NavigationLevel--closed ul{display:none}",""])},function(e,t,n){"use strict";var i=n(3);n.n(i).a},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".NavigationItem{display:inline-block;padding-top:5px;padding-bottom:5px}.NavigationItem span{cursor:pointer}",""])},function(e,t,n){"use strict";var i=n(4);n.n(i).a},function(e,t,n){(e.exports=n(2)(!1)).push([e.i,".NavigationToggle{position:relative;top:-3px;padding:5px 5px 5px 3px;cursor:pointer}.NavigationToggle__icon{display:inline-block;padding:3px;border:solid #000;border-width:0 2px 2px 0;transform:rotate(45deg)}.NavigationToggle__icon--closed{transform:rotate(-45deg)}",""])},function(e,t,n){"use strict";var i=n(7);n.n(i).a},function(e,t,n){"use strict";n.r(t);var i=n(12),r=n(9);for(var a in r)"default"!==a&&function(e){n.d(t,e,function(){return r[e]})}(a);n(24);var o=n(0),s=Object(o.a)(r.default,i.a,i.b,!1,null,null,null);t.default=s.exports},function(e,t,n){"use strict";n.r(t);var i=n(14),r=n(11);for(var a in r)"default"!==a&&function(e){n.d(t,e,function(){return r[e]})}(a);n(20);var o=n(0),s=Object(o.a)(r.default,i.a,i.b,!1,null,null,null);t.default=s.exports},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getItemMetadata=t.insertMetadataToItems=t.generateLevel=void 0;var i=o(n(26)),r=o(n(15)),a=n(18);function o(e){return e&&e.__esModule?e:{default:e}}t.generateLevel=function e(t,n,a,o){var s=[];return n.forEach(function(n){if(n.hasOwnProperty("children")){var u=t(i.default,{props:{parentItem:n,level:a,defaultOpenLevel:o}},[].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))));s.push(t("li",[u]))}else{var l=t(r.default,{props:{item:n}});s.push(t("li",[l]))}}),s},t.insertMetadataToItems=function e(t,n){return t.forEach(function(t){t.meta=s(t,n),t.hasOwnProperty("children")&&(t.children=e(t.children,t))}),t};var s=t.getItemMetadata=function(e,t){var n=(0,a.sanitizeElement)(e.element),i=(0,a.sanitizeRoute)(e.route),r=e.external;if(void 0===t){if(void 0===n&&void 0===i&&void 0===r)return{path:"",target:""};if(void 0!==r)return{path:"",target:r};if(void 0!==i)return{path:i,target:i};if(void 0!==n)return{path:"",target:"/"+n}}var o=(0,a.sanitizeRoute)(t.meta.path);return void 0!==r?{path:o,target:r}:void 0!==i?{path:o+i,target:o+i}:void 0!==n?{path:o,target:(0,a.sanitizeRoute)(o+n)}:{path:o,target:""}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(27);n(17);var r={props:{items:{type:Array,required:!0},defaultOpenLevel:{type:Number,default:0}},computed:{itemsWithMetadata:function(){var e=JSON.parse(JSON.stringify(this.items));return(0,i.insertMetadataToItems)(e)}},render:function(e){return e("div",{class:"TreeNavigation"},[e("div",{class:["NavigationLevel","NavigationLevel--level-0"]},[e("ul",(0,i.generateLevel)(e,this.itemsWithMetadata,1,this.defaultOpenLevel))])])}};t.default=r},function(e,t,n){"use strict";var i,r=n(28),a=(i=r)&&i.__esModule?i:{default:i};e.exports={install:function(e,t){e.component("vue-tree-navigation",a.default)}}}])}); | ||
//# sourceMappingURL=vue-tree-navigation.js.map |
{ | ||
"name": "vue-tree-navigation", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Vue.js 2 tree navigation", | ||
@@ -41,11 +41,11 @@ "keywords": [ | ||
"devDependencies": { | ||
"@vue/test-utils": "^1.0.0-beta.14", | ||
"babel-core": "^6.26.0", | ||
"@vue/test-utils": "^1.0.0-beta.18", | ||
"babel-core": "^6.26.3", | ||
"babel-eslint": "^8.2.3", | ||
"babel-jest": "^22.0.4", | ||
"babel-jest": "^23.0.1", | ||
"babel-loader": "^7.1.2", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-stage-3": "^6.24.1", | ||
"coveralls": "^3.0.0", | ||
"cross-env": "^5.0.5", | ||
"coveralls": "^3.0.1", | ||
"cross-env": "^5.1.6", | ||
"css-loader": "^0.28.7", | ||
@@ -56,29 +56,29 @@ "eslint": "^4.13.1", | ||
"eslint-plugin-html": "^4.0.1", | ||
"eslint-plugin-import": "^2.11.0", | ||
"eslint-plugin-import": "^2.12.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.6.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"eslint-plugin-promise": "^3.8.0", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"file-loader": "^1.1.4", | ||
"identity-obj-proxy": "^3.0.0", | ||
"jest": "^22.0.4", | ||
"jest-each": "^0.3.1", | ||
"jest-environment-jsdom": "^22.4.3", | ||
"jest-environment-jsdom-global": "^1.0.3", | ||
"jest": "^23.1.0", | ||
"jest-each": "^23.1.0", | ||
"jest-environment-jsdom": "^23.1.0", | ||
"jest-environment-jsdom-global": "^1.1.0", | ||
"jest-plugin-context": "^2.6.0", | ||
"jest-serializer-vue": "^1.0.0", | ||
"node-sass": "^4.5.3", | ||
"prettier": "1.12.1", | ||
"sass-loader": "^7.0.1", | ||
"stylelint": "^9.2.0", | ||
"jest-serializer-vue": "^2.0.2", | ||
"node-sass": "^4.9.0", | ||
"prettier": "1.13.5", | ||
"sass-loader": "^7.0.3", | ||
"stylelint": "^9.2.1", | ||
"stylelint-config-recess-order": "^2.0.0", | ||
"stylelint-config-standard": "^18.0.0", | ||
"stylelint-processor-html": "^1.0.0", | ||
"stylelint-scss": "^3.0.1", | ||
"vue-jest": "^2.5.0", | ||
"vue-loader": "^14.2.2", | ||
"stylelint-scss": "^3.1.0", | ||
"vue-jest": "^2.6.0", | ||
"vue-loader": "^15.2.4", | ||
"vue-router": "^3.0.1", | ||
"vue-template-compiler": "^2.4.4", | ||
"webpack": "^4.6.0", | ||
"webpack-cli": "^2.0.14", | ||
"webpack-dev-server": "^3.1.3" | ||
"webpack": "^4.12.0", | ||
"webpack-cli": "^3.0.3", | ||
"webpack-dev-server": "^3.1.4" | ||
}, | ||
@@ -85,0 +85,0 @@ "jest": { |
Sorry, the diff of this file is not supported yet
77124
55