primevue
Version:
[](https://opensource.org/licenses/MIT) [](https://badge.fury.io/js/primevue) [ • 21.4 kB
JavaScript
import e from"primevue/basecomponent";import t from"primevue/icons/chevrondown";import s from"primevue/icons/chevronright";import{ObjectUtils as i,DomHandler as n,UniqueComponentId as a}from"primevue/utils";import o from"primevue/ripple";import{resolveComponent as l,resolveDirective as r,openBlock as m,createElementBlock as c,mergeProps as d,Fragment as u,renderList as p,createElementVNode as h,createBlock as I,withCtx as g,withDirectives as f,resolveDynamicComponent as y,normalizeClass as v,createCommentVNode as b,toDisplayString as P,createVNode as k,Transition as x,vShow as C,renderSlot as A}from"vue";var K={name:"PanelMenuSub",extends:e,emits:["item-toggle"],props:{panelId:{type:String,default:null},focusedItemId:{type:String,default:null},items:{type:Array,default:null},level:{type:Number,default:0},templates:{type:Object,default:null},activeItemPath:{type:Object,default:null},exact:{type:Boolean,default:!0}},methods:{getItemId(e){return`${this.panelId}_${e.key}`},getItemKey(e){return this.getItemId(e)},getItemProp:(e,t,s)=>e&&e.item?i.getItemValue(e.item[t],s):void 0,getItemLabel(e){return this.getItemProp(e,"label")},getPTOptions(e,t){return this.ptm(t,{context:{active:this.isItemActive(e),focused:this.isItemFocused(e)}})},isItemActive(e){return this.activeItemPath.some((t=>t.key===e.key))},isItemVisible(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled(e){return this.getItemProp(e,"disabled")},isItemFocused(e){return this.focusedItemId===this.getItemId(e)},isItemGroup:e=>i.isNotEmpty(e.items),onItemClick(e,t){this.getItemProp(t,"command",{originalEvent:e,item:t.item}),this.$emit("item-toggle",{processedItem:t,expanded:!this.isItemActive(t)})},onItemToggle(e){this.$emit("item-toggle",e)},onItemActionClick(e,t){t&&t(e)},getAriaSetSize(){return this.items.filter((e=>this.isItemVisible(e)&&!this.getItemProp(e,"separator"))).length},getAriaPosInset(e){return e-this.items.slice(0,e).filter((e=>this.isItemVisible(e)&&this.getItemProp(e,"separator"))).length+1},getItemClass(e){return["p-menuitem",this.getItemProp(e,"class"),{"p-focus":this.isItemFocused(e),"p-disabled":this.isItemDisabled(e)}]},getItemActionClass(e,t){return["p-menuitem-link",{"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},getItemIconClass(e){return["p-menuitem-icon",this.getItemProp(e,"icon")]},getSeparatorItemClass(e){return["p-menuitem-separator",this.getItemProp(e,"class")]}},components:{ChevronRightIcon:s,ChevronDownIcon:t},directives:{ripple:o}};const E=["id","aria-label","aria-expanded","aria-level","aria-setsize","aria-posinset"],H=["onClick"],w=["href","onClick"],T=["href","target"];K.render=function(e,t,s,i,n,a){const o=l("router-link"),A=l("PanelMenuSub",!0),K=r("ripple");return m(),c("ul",d({class:"p-submenu-list"},e.ptm("menu")),[(m(!0),c(u,null,p(s.items,((t,i)=>(m(),c(u,{key:a.getItemKey(t)},[a.isItemVisible(t)&&!a.getItemProp(t,"separator")?(m(),c("li",d({key:0,id:a.getItemId(t),style:a.getItemProp(t,"style"),class:a.getItemClass(t),role:"treeitem","aria-label":a.getItemLabel(t),"aria-expanded":a.isItemGroup(t)?a.isItemActive(t):void 0,"aria-level":s.level+1,"aria-setsize":a.getAriaSetSize(),"aria-posinset":a.getAriaPosInset(i)},a.getPTOptions(t,"menuitem")),[h("div",d({class:"p-menuitem-content",onClick:e=>a.onItemClick(e,t)},a.getPTOptions(t,"content")),[s.templates.item?(m(),I(y(s.templates.item),{key:1,item:t.item},null,8,["item"])):(m(),c(u,{key:0},[a.getItemProp(t,"to")&&!a.isItemDisabled(t)?(m(),I(o,{key:0,to:a.getItemProp(t,"to"),custom:""},{default:g((({navigate:e,href:i,isActive:n,isExactActive:o})=>[f((m(),c("a",d({href:i,class:a.getItemActionClass(t,{isActive:n,isExactActive:o}),tabindex:"-1","aria-hidden":"true",onClick:t=>a.onItemActionClick(t,e)},a.getPTOptions(t,"action")),[s.templates.itemicon?(m(),I(y(s.templates.itemicon),{key:0,item:t.item,class:v(a.getItemIconClass(t))},null,8,["item","class"])):a.getItemProp(t,"icon")?(m(),c("span",d({key:1,class:a.getItemIconClass(t)},a.getPTOptions(t,"icon")),null,16)):b("",!0),h("span",d({class:"p-menuitem-text"},a.getPTOptions(t,"label")),P(a.getItemLabel(t)),17)],16,w)),[[K]])])),_:2},1032,["to"])):f((m(),c("a",d({key:1,href:a.getItemProp(t,"url"),class:a.getItemActionClass(t),target:a.getItemProp(t,"target"),tabindex:"-1","aria-hidden":"true"},a.getPTOptions(t,"action")),[a.isItemGroup(t)?(m(),c(u,{key:0},[s.templates.submenuicon?(m(),I(y(s.templates.submenuicon),d({key:0,class:"p-submenu-icon",active:a.isItemActive(t)},a.getPTOptions(t,"submenuIcon")),null,16,["active"])):(m(),I(y(a.isItemActive(t)?"ChevronDownIcon":"ChevronRightIcon"),d({key:1,class:"p-submenu-icon"},a.getPTOptions(t,"submenuIcon")),null,16))],64)):b("",!0),s.templates.itemicon?(m(),I(y(s.templates.itemicon),{key:1,item:t.item,class:v(a.getItemIconClass(t))},null,8,["item","class"])):a.getItemProp(t,"icon")?(m(),c("span",d({key:2,class:a.getItemIconClass(t)},a.getPTOptions(t,"icon")),null,16)):b("",!0),h("span",d({class:"p-menuitem-text"},a.getPTOptions(t,"label")),P(a.getItemLabel(t)),17)],16,T)),[[K]])],64))],16,H),k(x,{name:"p-toggleable-content"},{default:g((()=>[f(h("div",d({class:"p-toggleable-content"},e.ptm("toggleableContent")),[a.isItemVisible(t)&&a.isItemGroup(t)?(m(),I(A,{key:0,id:a.getItemId(t)+"_list",role:"group",panelId:s.panelId,focusedItemId:s.focusedItemId,items:t.items,level:s.level+1,templates:s.templates,activeItemPath:s.activeItemPath,exact:s.exact,onItemToggle:a.onItemToggle,pt:e.pt},null,8,["id","panelId","focusedItemId","items","level","templates","activeItemPath","exact","onItemToggle","pt"])):b("",!0)],16),[[C,a.isItemActive(t)]])])),_:2},1024)],16,E)):b("",!0),a.isItemVisible(t)&&a.getItemProp(t,"separator")?(m(),c("li",d({key:1,style:a.getItemProp(t,"style"),class:a.getSeparatorItemClass(t),role:"separator"},e.ptm("separator")),null,16)):b("",!0)],64)))),128))],16)};var D={name:"PanelMenuList",extends:e,emits:["item-toggle","header-focus"],props:{panelId:{type:String,default:null},items:{type:Array,default:null},templates:{type:Object,default:null},expandedKeys:{type:Object,default:null},exact:{type:Boolean,default:!0}},searchTimeout:null,searchValue:null,data:()=>({focused:!1,focusedItem:null,activeItemPath:[]}),watch:{expandedKeys(e){this.autoUpdateActiveItemPath(e)}},mounted(){this.autoUpdateActiveItemPath(this.expandedKeys)},methods:{getItemProp:(e,t)=>e&&e.item?i.getItemValue(e.item[t]):void 0,getItemLabel(e){return this.getItemProp(e,"label")},isItemVisible(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled(e){return this.getItemProp(e,"disabled")},isItemActive(e){return this.activeItemPath.some((t=>t.key===e.parentKey))},isItemGroup:e=>i.isNotEmpty(e.items),onFocus(e){this.focused=!0,this.focusedItem=this.focusedItem||(this.isElementInPanel(e,e.relatedTarget)?this.findFirstItem():this.findLastItem())},onBlur(){this.focused=!1,this.focusedItem=null,this.searchValue=""},onKeyDown(e){const t=e.metaKey||e.ctrlKey;switch(e.code){case"ArrowDown":this.onArrowDownKey(e);break;case"ArrowUp":this.onArrowUpKey(e);break;case"ArrowLeft":this.onArrowLeftKey(e);break;case"ArrowRight":this.onArrowRightKey(e);break;case"Home":this.onHomeKey(e);break;case"End":this.onEndKey(e);break;case"Space":this.onSpaceKey(e);break;case"Enter":this.onEnterKey(e);break;case"Escape":case"Tab":case"PageDown":case"PageUp":case"Backspace":case"ShiftLeft":case"ShiftRight":break;default:!t&&i.isPrintableCharacter(e.key)&&this.searchItems(e,e.key)}},onArrowDownKey(e){const t=i.isNotEmpty(this.focusedItem)?this.findNextItem(this.focusedItem):this.findFirstItem();this.changeFocusedItem({originalEvent:e,processedItem:t,focusOnNext:!0}),e.preventDefault()},onArrowUpKey(e){const t=i.isNotEmpty(this.focusedItem)?this.findPrevItem(this.focusedItem):this.findLastItem();this.changeFocusedItem({originalEvent:e,processedItem:t,selfCheck:!0}),e.preventDefault()},onArrowLeftKey(e){if(i.isNotEmpty(this.focusedItem)){this.activeItemPath.some((e=>e.key===this.focusedItem.key))?this.activeItemPath=this.activeItemPath.filter((e=>e.key!==this.focusedItem.key)):this.focusedItem=i.isNotEmpty(this.focusedItem.parent)?this.focusedItem.parent:this.focusedItem,e.preventDefault()}},onArrowRightKey(e){if(i.isNotEmpty(this.focusedItem)){if(this.isItemGroup(this.focusedItem)){this.activeItemPath.some((e=>e.key===this.focusedItem.key))?this.onArrowDownKey(e):(this.activeItemPath=this.activeItemPath.filter((e=>e.parentKey!==this.focusedItem.parentKey)),this.activeItemPath.push(this.focusedItem))}e.preventDefault()}},onHomeKey(e){this.changeFocusedItem({originalEvent:e,processedItem:this.findFirstItem(),allowHeaderFocus:!1}),e.preventDefault()},onEndKey(e){this.changeFocusedItem({originalEvent:e,processedItem:this.findLastItem(),focusOnNext:!0,allowHeaderFocus:!1}),e.preventDefault()},onEnterKey(e){if(i.isNotEmpty(this.focusedItem)){const e=n.findSingle(this.$el,`li[id="${this.focusedItemId}"]`),t=e&&(n.findSingle(e,".p-menuitem-link")||n.findSingle(e,"a,button"));t?t.click():e&&e.click()}e.preventDefault()},onSpaceKey(e){this.onEnterKey(e)},onItemToggle(e){const{processedItem:t,expanded:s}=e;this.expandedKeys?this.$emit("item-toggle",{item:t.item,expanded:s}):(this.activeItemPath=this.activeItemPath.filter((e=>e.parentKey!==t.parentKey)),s&&this.activeItemPath.push(t)),this.focusedItem=t,n.focus(this.$el)},isElementInPanel(e,t){const s=e.currentTarget.closest(".p-panelmenu-panel");return s&&s.contains(t)},isItemMatched(e){return this.isValidItem(e)&&this.getItemLabel(e).toLocaleLowerCase(this.searchLocale).startsWith(this.searchValue.toLocaleLowerCase(this.searchLocale))},isVisibleItem(e){return!!e&&(0===e.level||this.isItemActive(e))&&this.isItemVisible(e)},isValidItem(e){return!!e&&!this.isItemDisabled(e)},findFirstItem(){return this.visibleItems.find((e=>this.isValidItem(e)))},findLastItem(){return i.findLast(this.visibleItems,(e=>this.isValidItem(e)))},findNextItem(e){const t=this.visibleItems.findIndex((t=>t.key===e.key));return(t<this.visibleItems.length-1?this.visibleItems.slice(t+1).find((e=>this.isValidItem(e))):void 0)||e},findPrevItem(e){const t=this.visibleItems.findIndex((t=>t.key===e.key));return(t>0?i.findLast(this.visibleItems.slice(0,t),(e=>this.isValidItem(e))):void 0)||e},searchItems(e,t){this.searchValue=(this.searchValue||"")+t;let s=null,n=!1;if(i.isNotEmpty(this.focusedItem)){const e=this.visibleItems.findIndex((e=>e.key===this.focusedItem.key));s=this.visibleItems.slice(e).find((e=>this.isItemMatched(e))),s=i.isEmpty(s)?this.visibleItems.slice(0,e).find((e=>this.isItemMatched(e))):s}else s=this.visibleItems.find((e=>this.isItemMatched(e)));return i.isNotEmpty(s)&&(n=!0),i.isEmpty(s)&&i.isEmpty(this.focusedItem)&&(s=this.findFirstItem()),i.isNotEmpty(s)&&this.changeFocusedItem({originalEvent:e,processedItem:s,allowHeaderFocus:!1}),this.searchTimeout&&clearTimeout(this.searchTimeout),this.searchTimeout=setTimeout((()=>{this.searchValue="",this.searchTimeout=null}),500),n},changeFocusedItem(e){const{originalEvent:t,processedItem:s,focusOnNext:n,selfCheck:a,allowHeaderFocus:o=!0}=e;i.isNotEmpty(this.focusedItem)&&this.focusedItem.key!==s.key?(this.focusedItem=s,this.scrollInView()):o&&this.$emit("header-focus",{originalEvent:t,focusOnNext:n,selfCheck:a})},scrollInView(){const e=n.findSingle(this.$el,`li[id="${this.focusedItemId}"]`);e&&e.scrollIntoView&&e.scrollIntoView({block:"nearest",inline:"start"})},autoUpdateActiveItemPath(e){this.activeItemPath=Object.entries(e||{}).reduce(((e,[t,s])=>{if(s){const s=this.findProcessedItemByItemKey(t);s&&e.push(s)}return e}),[])},findProcessedItemByItemKey(e,t,s=0){if(!(t=t||0===s&&this.processedItems))return null;for(let i=0;i<t.length;i++){const n=t[i];if(this.getItemProp(n,"key")===e)return n;const a=this.findProcessedItemByItemKey(e,n.items,s+1);if(a)return a}},createProcessedItems(e,t=0,s={},i=""){const n=[];return e&&e.forEach(((e,a)=>{const o=(""!==i?i+"_":"")+a,l={item:e,index:a,level:t,key:o,parent:s,parentKey:i};l.items=this.createProcessedItems(e.items,t+1,l,o),n.push(l)})),n},flatItems(e,t=[]){return e&&e.forEach((e=>{this.isVisibleItem(e)&&(t.push(e),this.flatItems(e.items,t))})),t}},computed:{processedItems(){return this.createProcessedItems(this.items||[])},visibleItems(){return this.flatItems(this.processedItems)},focusedItemId(){return i.isNotEmpty(this.focusedItem)?`${this.panelId}_${this.focusedItem.key}`:null}},components:{PanelMenuSub:K}};D.render=function(e,t,s,i,n,a){const o=l("PanelMenuSub");return m(),I(o,{id:s.panelId+"_list",class:"p-panelmenu-root-list",role:"tree",tabindex:-1,"aria-activedescendant":n.focused?a.focusedItemId:void 0,panelId:s.panelId,focusedItemId:n.focused?a.focusedItemId:void 0,items:a.processedItems,templates:s.templates,activeItemPath:n.activeItemPath,exact:s.exact,onFocus:a.onFocus,onBlur:a.onBlur,onKeydown:a.onKeyDown,onItemToggle:a.onItemToggle,pt:e.pt},null,8,["id","aria-activedescendant","panelId","focusedItemId","items","templates","activeItemPath","exact","onFocus","onBlur","onKeydown","onItemToggle","pt"])};var F={name:"PanelMenu",extends:e,emits:["update:expandedKeys","panel-open","panel-close"],props:{model:{type:Array,default:null},expandedKeys:{type:Object,default:null},exact:{type:Boolean,default:!0},tabindex:{type:Number,default:0}},data(){return{id:this.$attrs.id,activeItem:null}},watch:{"$attrs.id":function(e){this.id=e||a()}},mounted(){this.id=this.id||a()},methods:{getItemProp:(e,t)=>e?i.getItemValue(e[t]):void 0,getItemLabel(e){return this.getItemProp(e,"label")},getPTOptions(e,t){return this.ptm(t,{options:{active:this.isItemActive(e),focused:this.isItemFocused(e)}})},isItemActive(e){return this.expandedKeys?this.expandedKeys[this.getItemProp(e,"key")]:i.equals(e,this.activeItem)},isItemVisible(e){return!1!==this.getItemProp(e,"visible")},isItemDisabled(e){return this.getItemProp(e,"disabled")},isItemFocused(e){return i.equals(e,this.activeItem)},getPanelId(e){return`${this.id}_${e}`},getPanelKey(e){return this.getPanelId(e)},getHeaderId(e){return`${this.getPanelId(e)}_header`},getContentId(e){return`${this.getPanelId(e)}_content`},onHeaderClick(e,t){this.isItemDisabled(t)?e.preventDefault():(t.command&&t.command({originalEvent:e,item:t}),this.changeActiveItem(e,t),n.focus(e.currentTarget))},onHeaderKeyDown(e,t){switch(e.code){case"ArrowDown":this.onHeaderArrowDownKey(e);break;case"ArrowUp":this.onHeaderArrowUpKey(e);break;case"Home":this.onHeaderHomeKey(e);break;case"End":this.onHeaderEndKey(e);break;case"Enter":case"Space":this.onHeaderEnterKey(e,t)}},onHeaderArrowDownKey(e){const t=n.hasClass(e.currentTarget,"p-highlight")?n.findSingle(e.currentTarget.nextElementSibling,".p-panelmenu-root-list"):null;t?n.focus(t):this.updateFocusedHeader({originalEvent:e,focusOnNext:!0}),e.preventDefault()},onHeaderArrowUpKey(e){const t=this.findPrevHeader(e.currentTarget.parentElement)||this.findLastHeader(),s=n.hasClass(t,"p-highlight")?n.findSingle(t.nextElementSibling,".p-panelmenu-root-list"):null;s?n.focus(s):this.updateFocusedHeader({originalEvent:e,focusOnNext:!1}),e.preventDefault()},onHeaderHomeKey(e){this.changeFocusedHeader(e,this.findFirstHeader()),e.preventDefault()},onHeaderEndKey(e){this.changeFocusedHeader(e,this.findLastHeader()),e.preventDefault()},onHeaderEnterKey(e,t){const s=n.findSingle(e.currentTarget,".p-panelmenu-header-action");s?s.click():this.onHeaderClick(e,t),e.preventDefault()},onHeaderActionClick(e,t){t&&t(e)},findNextHeader(e,t=!1){const s=t?e:e.nextElementSibling,i=n.findSingle(s,".p-panelmenu-header");return i?n.hasClass(i,"p-disabled")?this.findNextHeader(i.parentElement):i:null},findPrevHeader(e,t=!1){const s=t?e:e.previousElementSibling,i=n.findSingle(s,".p-panelmenu-header");return i?n.hasClass(i,"p-disabled")?this.findPrevHeader(i.parentElement):i:null},findFirstHeader(){return this.findNextHeader(this.$el.firstElementChild,!0)},findLastHeader(){return this.findPrevHeader(this.$el.lastElementChild,!0)},updateFocusedHeader(e){const{originalEvent:t,focusOnNext:s,selfCheck:i}=e,a=t.currentTarget.closest(".p-panelmenu-panel"),o=i?n.findSingle(a,".p-panelmenu-header"):s?this.findNextHeader(a):this.findPrevHeader(a);o?this.changeFocusedHeader(t,o):s?this.onHeaderHomeKey(t):this.onHeaderEndKey(t)},changeActiveItem(e,t,s=!1){if(!this.isItemDisabled(t)){const n=this.isItemActive(t),a=n?"panel-close":"panel-open";this.activeItem=s?t:this.activeItem&&i.equals(t,this.activeItem)?null:t,this.changeExpandedKeys({item:t,expanded:!n}),this.$emit(a,{originalEvent:e,item:t})}},changeExpandedKeys({item:e,expanded:t=!1}){if(this.expandedKeys){let s={...this.expandedKeys};t?s[e.key]=!0:delete s[e.key],this.$emit("update:expandedKeys",s)}},changeFocusedHeader(e,t){t&&n.focus(t)},getPanelClass(e){return["p-panelmenu-panel",this.getItemProp(e,"class")]},getHeaderClass(e){return["p-panelmenu-header",this.getItemProp(e,"headerClass"),{"p-highlight":this.isItemActive(e),"p-disabled":this.isItemDisabled(e)}]},getHeaderActionClass(e,t){return["p-panelmenu-header-action",{"router-link-active":t&&t.isActive,"router-link-active-exact":this.exact&&t&&t.isExactActive}]},getHeaderIconClass(e){return["p-menuitem-icon",this.getItemProp(e,"icon")]}},components:{PanelMenuList:D,ChevronRightIcon:s,ChevronDownIcon:t}};const S=["id"],L=["id","tabindex","aria-label","aria-expanded","aria-controls","aria-disabled","onClick","onKeydown"],O=["href","onClick"],V=["href"],$=["id","aria-labelledby"];!function(e,t){void 0===t&&(t={});var s=t.insertAt;if(e&&"undefined"!=typeof document){var i=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css","top"===s&&i.firstChild?i.insertBefore(n,i.firstChild):i.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}}("\n.p-panelmenu .p-panelmenu-header-action {\n display: flex;\n align-items: center;\n user-select: none;\n cursor: pointer;\n position: relative;\n text-decoration: none;\n}\n.p-panelmenu .p-panelmenu-header-action:focus {\n z-index: 1;\n}\n.p-panelmenu .p-submenu-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.p-panelmenu .p-menuitem-link {\n display: flex;\n align-items: center;\n user-select: none;\n cursor: pointer;\n text-decoration: none;\n position: relative;\n overflow: hidden;\n}\n.p-panelmenu .p-menuitem-text {\n line-height: 1;\n}\n"),F.render=function(e,t,s,i,n,a){const o=l("router-link"),r=l("PanelMenuList");return m(),c("div",d({id:n.id,class:"p-panelmenu p-component"},e.ptm("root")),[(m(!0),c(u,null,p(s.model,((t,i)=>(m(),c(u,{key:a.getPanelKey(i)},[a.isItemVisible(t)?(m(),c("div",d({key:0,style:a.getItemProp(t,"style"),class:a.getPanelClass(t)},e.ptm("panel")),[h("div",d({id:a.getHeaderId(i),class:a.getHeaderClass(t),tabindex:a.isItemDisabled(t)?-1:s.tabindex,role:"button","aria-label":a.getItemLabel(t),"aria-expanded":a.isItemActive(t),"aria-controls":a.getContentId(i),"aria-disabled":a.isItemDisabled(t),onClick:e=>a.onHeaderClick(e,t),onKeydown:e=>a.onHeaderKeyDown(e,t)},a.getPTOptions(t,"header")),[h("div",d({class:"p-panelmenu-header-content"},a.getPTOptions(t,"headerContent")),[e.$slots.item?(m(),I(y(e.$slots.item),{key:1,item:t},null,8,["item"])):(m(),c(u,{key:0},[a.getItemProp(t,"to")&&!a.isItemDisabled(t)?(m(),I(o,{key:0,to:a.getItemProp(t,"to"),custom:""},{default:g((({navigate:s,href:i,isActive:n,isExactActive:o})=>[h("a",d({href:i,class:a.getHeaderActionClass(t,{isActive:n,isExactActive:o}),tabindex:-1,onClick:e=>a.onHeaderActionClick(e,s)},a.getPTOptions(t,"headerAction")),[e.$slots.headericon?(m(),I(y(e.$slots.headericon),{key:0,item:t,class:v(a.getHeaderIconClass(t))},null,8,["item","class"])):a.getItemProp(t,"icon")?(m(),c("span",d({key:1,class:a.getHeaderIconClass(t)},a.getPTOptions(t,"headerIcon")),null,16)):b("",!0),h("span",d({class:"p-menuitem-text"},a.getPTOptions(t,"headerLabel")),P(a.getItemLabel(t)),17)],16,O)])),_:2},1032,["to"])):(m(),c("a",d({key:1,href:a.getItemProp(t,"url"),class:a.getHeaderActionClass(t),tabindex:-1},a.getPTOptions(t,"headerAction")),[a.getItemProp(t,"items")?A(e.$slots,"submenuicon",{key:0,active:a.isItemActive(t)},(()=>[(m(),I(y(a.isItemActive(t)?"ChevronDownIcon":"ChevronRightIcon"),d({class:"p-submenu-icon"},a.getPTOptions(t,"submenuIcon")),null,16))])):b("",!0),e.$slots.headericon?(m(),I(y(e.$slots.headericon),{key:1,item:t,class:v(a.getHeaderIconClass(t))},null,8,["item","class"])):a.getItemProp(t,"icon")?(m(),c("span",d({key:2,class:a.getHeaderIconClass(t)},a.getPTOptions(t,"headerIcon")),null,16)):b("",!0),h("span",d({class:"p-menuitem-text"},a.getPTOptions(t,"headerLabel")),P(a.getItemLabel(t)),17)],16,V))],64))],16)],16,L),k(x,{name:"p-toggleable-content"},{default:g((()=>[f(h("div",d({id:a.getContentId(i),class:"p-toggleable-content",role:"region","aria-labelledby":a.getHeaderId(i)},e.ptm("toggleableContent")),[a.getItemProp(t,"items")?(m(),c("div",d({key:0,class:"p-panelmenu-content"},e.ptm("menuContent")),[k(r,{panelId:a.getPanelId(i),items:a.getItemProp(t,"items"),templates:e.$slots,expandedKeys:s.expandedKeys,onItemToggle:a.changeExpandedKeys,onHeaderFocus:a.updateFocusedHeader,exact:s.exact,pt:e.pt},null,8,["panelId","items","templates","expandedKeys","onItemToggle","onHeaderFocus","exact","pt"])],16)):b("",!0)],16,$),[[C,a.isItemActive(t)]])])),_:2},1024)],16)):b("",!0)],64)))),128))],16,S)};export{F as default};