UNPKG

@progress/kendo-vue-layout

Version:
9 lines (8 loc) 4.12 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("@progress/kendo-vue-common"),k=require("@progress/kendo-svg-icons"),q=require("@progress/kendo-vue-animation");function E(t){return typeof t=="function"||Object.prototype.toString.call(t)==="[object Object]"&&!e.isVNode(t)}const w=e.defineComponent({name:"KendoPanelBarGroup",props:{item:Object,items:Array,animation:Boolean,expanded:Boolean,disabled:Boolean,keepItemsMounted:Boolean,uniquePrivateKey:[String,Number],content:Object},data(){return{show:this.$props.expanded}},render(){const{item:t,items:s,uniquePrivateKey:p,disabled:c,expanded:r,animation:i,keepItemsMounted:u}=this.$props,h={display:"block"},n=o.getTemplate.call(this,{h:e.h,template:this.$props.content,defaultRendering:null,additionalProps:{...this.$props,show:this.show}}),d=!c&&r,l=d||u?s?e.createVNode("ul",{role:"group",class:"k-panelbar-group",style:{display:u?this.$data.show?"block":"none":"block"}},[s.map(function(a){return e.h(g,{...a,item:t})},this)]):this.$props.content?e.createVNode("div",{class:"k-panelbar-content"},[n]):null:null;return(i===void 0||i)&&!c?e.createVNode(q.Reveal,{appear:d,transitionEnterDuration:200,transitionExitDuration:200,key:p+"_animation",style:h,onEntering:this.handleEntering,onExited:this.handleExited},E(l)?l:{default:()=>[l]}):l},methods:{handleEntering(){this.keepItemsMounted&&(this.show=!0)},handleExited(){this.keepItemsMounted&&(this.show=!1)}}}),g=e.defineComponent({name:"KendoPanelBarItem",props:{item:Object,items:Array,animation:Boolean,expanded:Boolean,disabled:Boolean,selected:Boolean,level:Number,title:{type:[String,Object,Function],default:function(){return"Untitled"}},id:[String,Number],focused:Boolean,keepItemsMounted:Boolean,uniquePrivateKey:[String,Number],parentUniquePrivateKey:Array,parentExpanded:Boolean,headerClassName:String,iconClass:String,imageUrl:String,icon:String,svgIcon:Object,content:Object,header:Object},inject:{dispatchItemSelect:{default:null}},render(){const{id:t,item:s,icon:p,svgIcon:c,items:r,content:i,title:u,uniquePrivateKey:h,disabled:n,selected:d,focused:l,expanded:a,className:I,level:b,headerClassName:N,animation:f,keepItemsMounted:y}=this.$props,m=!!r||!!i,v=o.classNames("k-panelbar-item",{"k-panelbar-header":b===0,"k-panelbar-item":b!==0,"k-expanded":a&&m,"k-disabled":n},`k-level-${b}`,I),B=o.classNames("k-link",{"k-selected":!n&&d,"k-focus":l},N),S=o.classNames("k-panelbar-toggle",{"k-panelbar-collapse":a&&m,"k-panelbar-expand":!a&&m}),C=a?"chevron-up":"chevron-down",P=a?k.chevronUpIcon:k.chevronDownIcon,x=function(){return this.imageUrl?e.createVNode("img",{role:"presentation",class:"k-panelbar-item-icon k-image",src:this.imageUrl},null):p||c?e.createVNode(o.Icon,{name:p,class:"k-panelbar-item-icon",icon:c},null):this.iconClass?e.createVNode(o.Icon,{class:"k-panelbar-item-icon "+this.iconClass},null):null}.call(this),V=!n&&(r||i)?e.createVNode(o.Icon,{name:C,icon:P,class:S},null):null,$=r||i?e.createVNode(w,{items:r,item:s,content:i,uniquePrivateKey:h,disabled:n,expanded:a,animation:f,keepItemsMounted:y},null):null,j=o.getTemplate.call(this,{h:e.h,template:this.$props.header,defaultRendering:null,additionalProps:{...this.$props}});return e.createVNode("li",{id:t,class:v,role:"treeitem","aria-disabled":n,"aria-hidden":!n&&!a,"aria-selected":!n&&d,"aria-expanded":!n&&a&&m},[e.createVNode("span",{class:B,onClick:this.handleItemClick},[x,this.$props.header?j:e.createVNode("span",{class:"k-panelbar-item-text"},[u]),V]),$])},methods:{handleItemClick(){const{disabled:t,id:s}=this.$props;t||this.dispatchItemSelect({uniquePrivateKey:this.$props.uniquePrivateKey,id:s,target:this})},childFactory(t){return t}}});exports.PanelBarItem=g;