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) [![Discord Chat](https://img.shields.io/discord/55794023

1 lines 5.11 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["panelmenusub"]=t():e["panelmenusub"]=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")}({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._self._c;return t("ul",{staticClass:"p-submenu-list",attrs:{role:"tree"}},[e._l(e.model,(function(n,i){return[e.visible(n)&&!n.separator?t("li",{key:e.label(n)+i,class:e.getItemClass(n),style:n.style,attrs:{role:"none"}},[n.to&&!e.disabled(n)?t("router-link",{attrs:{to:n.to,custom:""},scopedSlots:e._u([{key:"default",fn:function(i){var r=i.navigate,o=i.href,a=i.isActive,s=i.isExactActive;return[t("a",{class:e.linkClass(n,{isRouterActive:a,isExactActive:s}),attrs:{href:o,role:"treeitem","aria-expanded":e.isActive(n)},on:{click:function(t){return e.onItemClick(t,n,r)}}},[t("span",{class:["p-menuitem-icon",n.icon]}),t("span",{staticClass:"p-menuitem-text"},[e._v(e._s(e.label(n)))])])]}}],null,!0)}):t("a",{class:e.linkClass(n),attrs:{href:n.url,target:n.target,role:"treeitem","aria-expanded":e.isActive(n),tabindex:e.disabled(n)?null:"0"},on:{click:function(t){return e.onItemClick(t,n)}}},[n.items?t("span",{class:e.getSubmenuIcon(n)}):e._e(),t("span",{class:["p-menuitem-icon",n.icon]}),t("span",{staticClass:"p-menuitem-text"},[e._v(e._s(e.label(n)))])]),t("transition",{attrs:{name:"p-toggleable-content"}},[t("div",{directives:[{name:"show",rawName:"v-show",value:n===e.activeItem,expression:"item === activeItem"}],staticClass:"p-toggleable-content"},[e.visible(n)&&n.items?t("sub-panelmenu",{key:e.label(n)+"_sub_",attrs:{model:n.items,exact:e.exact}}):e._e()],1)])],1):e._e(),e.visible(n)&&n.separator?t("li",{key:"separator"+i,class:["p-menu-separator",n.class],style:n.style}):e._e()]}))],2)},o=[],a={name:"sub-panelmenu",props:{model:{type:null,default:null},exact:{type:Boolean,default:!0}},data:function(){return{activeItem:null}},methods:{onItemClick:function(e,t,n){this.disabled(t)?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,t.to&&n&&n(e))},getItemClass:function(e){return["p-menuitem",e.class]},linkClass:function(e,t){return["p-menuitem-link",{"p-disabled":this.disabled(e),"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},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},disabled:function(e){return"function"===typeof e.disabled?e.disabled():e.disabled},label:function(e){return"function"===typeof e.label?e.label():e.label}}},s=a;function l(e,t,n,i,r,o,a,s){var l,c="function"===typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),i&&(c.functional=!0),o&&(c._scopeId="data-v-"+o),a?(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(a)},c._ssrRegister=l):r&&(l=s?function(){r.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:r),l)if(c.functional){c._injectStyles=l;var u=c.render;c.render=function(e,t){return l.call(t),u(e,t)}}else{var f=c.beforeCreate;c.beforeCreate=f?[].concat(f,l):[l]}return{exports:e,options:c}}var c=l(s,r,o,!1,null,null,null),u=c.exports;t["default"]=u}})["default"]}));