UNPKG

primevue

Version:

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![npm version](https://badge.fury.io/js/primevue.svg)](https://badge.fury.io/js/primevue) [![Join the chat at https://gitter.im/primefaces/primevu

1 lines 10.5 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["panelmenu"]=t():e["panelmenu"]=t()})("undefined"!==typeof self?self:this,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,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(r,a,function(t){return e[t]}.bind(null,a));return r},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="fb15")}({2350:function(e,t){function n(e,t){var n=e[1]||"",a=e[3];if(!a)return n;if(t&&"function"===typeof btoa){var i=r(a),o=a.sources.map(function(e){return"/*# sourceURL="+a.sourceRoot+e+" */"});return[n].concat(o).concat([i]).join("\n")}return[n].join("\n")}function r(e){var t=btoa(unescape(encodeURIComponent(JSON.stringify(e)))),n="sourceMappingURL=data:application/json;charset=utf-8;base64,"+t;return"/*# "+n+" */"}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={},a=0;a<this.length;a++){var i=this[a][0];"number"===typeof i&&(r[i]=!0)}for(a=0;a<e.length;a++){var o=e[a];"number"===typeof o[0]&&r[o[0]]||(n&&!o[2]?o[2]=n:n&&(o[2]="("+o[2]+") and ("+n+")"),t.push(o))}},t}},"499e":function(e,t,n){"use strict";function r(e,t){for(var n=[],r={},a=0;a<t.length;a++){var i=t[a],o=i[0],s=i[1],l=i[2],u=i[3],c={id:e+":"+a,css:s,media:l,sourceMap:u};r[o]?r[o].parts.push(c):n.push(r[o]={id:o,parts:[c]})}return n}n.r(t),n.d(t,"default",function(){return f});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 i={},o=a&&(document.head||document.getElementsByTagName("head")[0]),s=null,l=0,u=!1,c=function(){},p=null,d="data-vue-ssr-id",m="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function f(e,t,n,a){u=n,p=a||{};var o=r(e,t);return v(o),function(t){for(var n=[],a=0;a<o.length;a++){var s=o[a],l=i[s.id];l.refs--,n.push(l)}t?(o=r(e,t),v(o)):o=[];for(a=0;a<n.length;a++){l=n[a];if(0===l.refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete i[l.id]}}}}function v(e){for(var t=0;t<e.length;t++){var n=e[t],r=i[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(g(n.parts[a]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{var o=[];for(a=0;a<n.parts.length;a++)o.push(g(n.parts[a]));i[n.id]={id:n.id,refs:1,parts:o}}}}function h(){var e=document.createElement("style");return e.type="text/css",o.appendChild(e),e}function g(e){var t,n,r=document.querySelector("style["+d+'~="'+e.id+'"]');if(r){if(u)return c;r.parentNode.removeChild(r)}if(m){var a=l++;r=s||(s=h()),t=y.bind(null,r,a,!1),n=y.bind(null,r,a,!0)}else r=h(),t=_.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 b=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}();function y(e,t,n,r){var a=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=b(t,a);else{var i=document.createTextNode(a),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(i,o[t]):e.appendChild(i)}}function _(e,t){var n=t.css,r=t.media,a=t.sourceMap;if(r&&e.setAttribute("media",r),p.ssrId&&e.setAttribute(d,t.id),a&&(n+="\n/*# sourceURL="+a.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(a))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{while(e.firstChild)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}},"8f6e":function(e,t,n){t=e.exports=n("2350")(!1),t.push([e.i,".p-panelmenu{width:auto}.p-panelmenu .p-menu-separator{border-width:1px 0 0 0}.p-panelmenu .p-panelmenu-content-wrapper{overflow:hidden}.p-panelmenu .p-panelmenu-header{margin:-1px 0 0 0;zoom:1}.p-panelmenu .p-panelmenu-header-link{padding:.5em;display:block;text-decoration:none}.p-panelmenu .p-menuitem-text,.p-panelmenu .p-panelmenu-icon{vertical-align:middle}.p-panelmenu .p-menuitem-icon{margin-right:.25em;vertical-align:middle}.p-panelmenu .p-panelmenu-content{padding:.25em;border-top:0;margin-bottom:1px}.p-panelmenu .p-submenu-list{margin:0;padding:0;list-style:none;margin-left:1.5em}.p-panelmenu .p-panelmenu-content>.p-panelmenu-root-submenu.p-submenu-list{margin-left:0}.p-panelmenu .p-menuitem{overflow:hidden;margin:.125em 0}.p-panelmenu .p-menuitem-link{padding:.25em;display:block;text-decoration:none}",""])},c2bd:function(e,t,n){"use strict";var r=n("e9b3"),a=n.n(r);a.a},e9b3:function(e,t,n){var r=n("8f6e");"string"===typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);var a=n("499e").default;a("718d92e6",r,!0,{sourceMap:!1,shadowMode:!1})},f6fd:function(e,t){(function(e){var t="currentScript",n=e.getElementsByTagName("script");t in e||Object.defineProperty(e,t,{get:function(){try{throw new Error}catch(r){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(e in n)if(n[e].src==t||"interactive"==n[e].readyState)return n[e];return null}}})})(document)},fb15:function(e,t,n){"use strict";var r;(n.r(t),"undefined"!==typeof window)&&(n("f6fd"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^\/]+\.js(\?.*)?$/))&&(n.p=r[1]));var a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"p-panelmenu p-component"},[e._l(e.model,function(t,r){return[n("div",{key:t.label+"_"+r,class:e.getPanelClass(t),style:t.style},[n("div",{class:e.getHeaderClass(t),style:t.style},[n("a",{staticClass:"p-panelmenu-header-link",attrs:{href:t.url||"#"},on:{click:function(n){return e.onItemClick(n,t)}}},[t.items?n("span",{class:e.getPanelToggleIcon(t)}):e._e(),t.icon?n("span",{class:e.getPanelIcon(t)}):e._e(),n("span",{staticClass:"p-menuitem-text"},[e._v(e._s(t.label))])])]),n("transition",{attrs:{name:"p-toggleable-content"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t===e.activeItem,expression:"item === activeItem"}],staticClass:"p-toggleable-content"},[t.items?n("div",{staticClass:"p-panelmenu-content"},[n("PanelMenuSub",{staticClass:"p-panelmenu-root-submenu",attrs:{model:t.items}})],1):e._e()])])],1)]})],2)},i=[],o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("ul",{staticClass:"p-submenu-list"},[e._l(e.model,function(t,r){return[!1===t.visible||t.separator?e._e():n("li",{key:t.label+r,class:e.getItemClass(t),style:t.style,attrs:{role:"menuitem"}},[t.to?n("router-link",{staticClass:"p-menuitem-link",attrs:{to:t.to},nativeOn:{click:function(n){return e.onItemClick(n,t)}}},[n("span",{class:["p-menuitem-icon",t.icon]}),n("span",{staticClass:"p-menuitem-text"},[e._v(e._s(t.label))])]):n("a",{staticClass:"p-menuitem-link",attrs:{href:t.url||"#",target:t.target},on:{click:function(n){return e.onItemClick(n,t)}}},[t.items?n("span",{class:e.getSubmenuIcon(t)}):e._e(),n("span",{class:["p-menuitem-icon",t.icon]}),n("span",{staticClass:"p-menuitem-text"},[e._v(e._s(t.label))])]),n("transition",{attrs:{name:"p-toggleable-content"}},[n("div",{directives:[{name:"show",rawName:"v-show",value:t===e.activeItem,expression:"item === activeItem"}],staticClass:"p-toggleable-content"},[!1!==t.visible&&t.items?n("sub-panelmenu",{key:t.label+"_sub_",attrs:{model:t.items}}):e._e()],1)])],1),!1!==t.visible&&t.separator?n("li",{key:"separator"+r,staticClass:"p-menu-separator",style:t.style}):e._e()]})],2)},s=[],l={name:"sub-panelmenu",props:{model:{type:null,default:null}},data:function(){return{activeItem:null}},methods:{onItemClick:function(e,t){t.disabled?event.preventDefault():(t.url||t.to||event.preventDefault(),t.command&&t.command({originalEvent:event,item:t}),this.activeItem&&this.activeItem===t?this.activeItem=null:this.activeItem=t)},getItemClass:function(e){return["p-menuitem",e.className,{"p-disabled":e.disabled}]},getSubmenuIcon:function(e){var t=e===this.activeItem;return["p-panelmenu-icon pi pi-fw",{"pi-caret-right":!t,"pi-caret-down":t}]}}},u=l;function c(e,t,n,r,a,i,o,s){var l,u="function"===typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),o?(l=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__),a&&a.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=l):a&&(l=s?function(){a.call(this,this.$root.$options.shadowRoot)}:a),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(e,t){return l.call(t),c(e,t)}}else{var p=u.beforeCreate;u.beforeCreate=p?[].concat(p,l):[l]}return{exports:e,options:u}}var p=c(u,o,s,!1,null,null,null),d=p.exports,m={props:{model:{type:Array,default:null}},data:function(){return{activeItem:null}},methods:{onItemClick:function(e,t){t.disabled?e.preventDefault():(t.url||t.to||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),this.activeItem&&this.activeItem===t?this.activeItem=null:this.activeItem=t)},getPanelClass:function(e){return["p-panelmenu-panel",e.class,{"p-disabled":e.disabled}]},getPanelToggleIcon:function(e){var t=e===this.activeItem;return["p-panelmenu-icon pi pi-fw",{"pi-caret-right":!t," pi-caret-down":t}]},getPanelIcon:function(e){return["p-menuitem-icon",e.icon]},getHeaderClass:function(e){return["p-component p-panelmenu-header",{"p-highlight":e===this.activeItem}]}},computed:{},components:{PanelMenuSub:d}},f=m,v=(n("c2bd"),c(f,a,i,!1,null,null,null)),h=v.exports;t["default"]=h}})["default"]});