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)

1 lines 11.3 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(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="fb15")}({2350:function(e,t){function n(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"===typeof btoa){var a=i(r),s=r.sources.map((function(e){return"/*# sourceURL="+r.sourceRoot+e+" */"}));return[n].concat(s).concat([a]).join("\n")}return[n].join("\n")}function i(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 i=n(t,e);return t[2]?"@media "+t[2]+"{"+i+"}":i})).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 s=e[r];"number"===typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),t.push(s))}},t}},"499e":function(e,t,n){"use strict";function i(e,t){for(var n=[],i={},r=0;r<t.length;r++){var a=t[r],s=a[0],o=a[1],l=a[2],u=a[3],c={id:e+":"+r,css:o,media:l,sourceMap:u};i[s]?i[s].parts.push(c):n.push(i[s]={id:s,parts:[c]})}return n}n.r(t),n.d(t,"default",(function(){return m}));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={},s=r&&(document.head||document.getElementsByTagName("head")[0]),o=null,l=0,u=!1,c=function(){},p=null,d="data-vue-ssr-id",f="undefined"!==typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());function m(e,t,n,r){u=n,p=r||{};var s=i(e,t);return v(s),function(t){for(var n=[],r=0;r<s.length;r++){var o=s[r],l=a[o.id];l.refs--,n.push(l)}t?(s=i(e,t),v(s)):s=[];for(r=0;r<n.length;r++){l=n[r];if(0===l.refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete a[l.id]}}}}function v(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(b(n.parts[r]));i.parts.length>n.parts.length&&(i.parts.length=n.parts.length)}else{var s=[];for(r=0;r<n.parts.length;r++)s.push(b(n.parts[r]));a[n.id]={id:n.id,refs:1,parts:s}}}}function h(){var e=document.createElement("style");return e.type="text/css",s.appendChild(e),e}function b(e){var t,n,i=document.querySelector("style["+d+'~="'+e.id+'"]');if(i){if(u)return c;i.parentNode.removeChild(i)}if(f){var r=l++;i=o||(o=h()),t=y.bind(null,i,r,!1),n=y.bind(null,i,r,!0)}else i=h(),t=_.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 g=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}();function y(e,t,n,i){var r=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=g(t,r);else{var a=document.createTextNode(r),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function _(e,t){var n=t.css,i=t.media,r=t.sourceMap;if(i&&e.setAttribute("media",i),p.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))))+" */"),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 .p-panelmenu-header-link{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;position:relative;text-decoration:none}.p-panelmenu .p-panelmenu-header-link:focus{z-index:1}.p-panelmenu .p-submenu-list{margin:0;padding:0;list-style:none}.p-panelmenu .p-menuitem-link{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer;text-decoration:none}.p-panelmenu .p-menuitem-text{line-height:1}",""])},c2bd:function(e,t,n){"use strict";n("e9b3")},e9b3:function(e,t,n){var i=n("8f6e");"string"===typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);var r=n("499e").default;r("718d92e6",i,!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(i){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(i.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 i;(n.r(t),"undefined"!==typeof window)&&(n("f6fd"),(i=window.document.currentScript)&&(i=i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=i[1]));var r=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,i){return[e.visible(t)?n("div",{key:t.label+"_"+i,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,tabindex:t.disabled?null:"0","aria-expanded":e.isActive(t),id:e.ariaId+"_header","aria-controls":e.ariaId+"_content"},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",attrs:{role:"region",id:e.ariaId+"_content","aria-labelledby":e.ariaId+"_header"}},[t.items?n("div",{staticClass:"p-panelmenu-content"},[n("PanelMenuSub",{staticClass:"p-panelmenu-root-submenu",attrs:{model:t.items}})],1):e._e()])])],1):e._e()]}))],2)},a=[],s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("ul",{staticClass:"p-submenu-list",attrs:{role:"tree"}},[e._l(e.model,(function(t,i){return[e.visible(t)&&!t.separator?n("li",{key:t.label+i,class:e.getItemClass(t),style:t.style,attrs:{role:"none"}},[t.to&&!t.disabled?n("router-link",{class:e.getLinkClass(t),attrs:{to:t.to,role:"treeitem","aria-expanded":e.isActive(t)},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",{class:e.getLinkClass(t),attrs:{href:t.url,target:t.target,role:"treeitem","aria-expanded":e.isActive(t),tabindex:t.disabled?null:"0"},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"},[e.visible(t)&&t.items?n("sub-panelmenu",{key:t.label+"_sub_",attrs:{model:t.items}}):e._e()],1)])],1):e._e(),e.visible(t)&&t.separator?n("li",{key:"separator"+i,staticClass:"p-menu-separator",style:t.style}):e._e()]}))],2)},o=[],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.class]},getLinkClass:function(e){return["p-menuitem-link",{"p-disabled":e.disabled}]},isActive:function(e){return e===this.activeItem},getSubmenuIcon:function(e){var t=this.isActive(e);return["p-panelmenu-icon pi pi-fw",{"pi-angle-right":!t,"pi-angle-down":t}]},visible:function(e){return"function"===typeof e.visible?e.visible():!1!==e.visible}}},u=l;function c(e,t,n,i,r,a,s,o){var l,u="function"===typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),a&&(u._scopeId="data-v-"+a),s?(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__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},u._ssrRegister=l):r&&(l=o?function(){r.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:r),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,s,o,!1,null,null,null),d=p.exports,f=0,m=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"pv_id_";return f++,"".concat(e).concat(f)},v={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]},getPanelToggleIcon:function(e){var t=e===this.activeItem;return["p-panelmenu-icon pi",{"pi-chevron-right":!t," pi-chevron-down":t}]},getPanelIcon:function(e){return["p-menuitem-icon",e.icon]},isActive:function(e){return e===this.activeItem},getHeaderClass:function(e){return["p-component p-panelmenu-header",{"p-highlight":this.isActive(e),"p-disabled":e.disabled}]},visible:function(e){return"function"===typeof e.visible?e.visible():!1!==e.visible}},components:{PanelMenuSub:d},computed:{ariaId:function(){return m()}}},h=v,b=(n("c2bd"),c(h,r,a,!1,null,null,null)),g=b.exports;t["default"]=g}})["default"]}));