el-collapse-item-dbb3399f.js 3.6 KB

1
  1. import{aD as V,aE as $,bk as ae,cf as B,d4 as M,bl as se,r as K,cv as W,M as le,au as te,aF as P,L as d,d as k,o as D,c as G,aG as N,a0 as m,a as e,aH as L,dx as O,bP as ie,h as w,n as oe,t as ne,g as A,w as T,bC as de,ay as ce,S as re,aw as ue,y as pe,a6 as me,dy as ve,aI as be,aM as he,__tla as fe}from"./index-52b99925.js";let j,q,ye=Promise.all([(()=>{try{return fe}catch{}})()]).then(async()=>{const E=v=>typeof se(v),z=V({accordion:Boolean,modelValue:{type:$([Array,String,Number]),default:()=>ae([])}}),J={[B]:E,[M]:E},F=Symbol("collapseContextKey"),Q=k({name:"ElCollapse"});var R=L(k({...Q,props:z,emits:J,setup(v,{expose:_,emit:h}){const f=v,{activeNames:g,setActiveNames:r}=((t,u)=>{const o=K(W(t.modelValue)),b=c=>{o.value=c;const n=t.accordion?o.value[0]:o.value;u(B,n),u(M,n)};return le(()=>t.modelValue,()=>o.value=W(t.modelValue),{deep:!0}),te(F,{activeNames:o,handleItemClick:c=>{if(t.accordion)b([o.value[0]===c?"":c]);else{const n=[...o.value],C=n.indexOf(c);C>-1?n.splice(C,1):n.push(c),b(n)}}}),{activeNames:o,setActiveNames:b}})(f,h),{rootKls:y}=(()=>{const t=P("collapse");return{rootKls:d(()=>t.b())}})();return _({activeNames:g,setActiveNames:r}),(t,u)=>(D(),G("div",{class:m(e(y))},[N(t.$slots,"default")],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);const U=V({title:{type:String,default:""},name:{type:$([String,Number]),default:()=>O()},disabled:Boolean}),X=["id","aria-expanded","aria-controls","aria-describedby","tabindex"],Y=["id","aria-hidden","aria-labelledby"],Z=k({name:"ElCollapseItem"});var H=L(k({...Z,props:U,setup(v,{expose:_}){const h=v,{focusing:f,id:g,isActive:r,handleFocus:y,handleHeaderClick:t,handleEnterClick:u}=(i=>{const a=ie(F),s=K(!1),p=K(!1),l=K(O()),I=d(()=>a==null?void 0:a.activeNames.value.includes(i.name));return{focusing:s,id:l,isActive:I,handleFocus:()=>{setTimeout(()=>{p.value?p.value=!1:s.value=!0},50)},handleHeaderClick:()=>{i.disabled||(a==null||a.handleItemClick(i.name),s.value=!1,p.value=!0)},handleEnterClick:()=>{a==null||a.handleItemClick(i.name)}}})(h),{arrowKls:o,headKls:b,rootKls:c,itemWrapperKls:n,itemContentKls:C,scopedContentId:x,scopedHeadId:S}=((i,{focusing:a,isActive:s,id:p})=>{const l=P("collapse"),I=d(()=>[l.b("item"),l.is("active",e(s)),l.is("disabled",i.disabled)]),ee=d(()=>[l.be("item","header"),l.is("active",e(s)),{focusing:e(a)&&!i.disabled}]);return{arrowKls:d(()=>[l.be("item","arrow"),l.is("active",e(s))]),headKls:ee,rootKls:I,itemWrapperKls:d(()=>l.be("item","wrap")),itemContentKls:d(()=>l.be("item","content")),scopedContentId:d(()=>l.b(`content-${e(p)}`)),scopedHeadId:d(()=>l.b(`head-${e(p)}`))}})(h,{focusing:f,isActive:r,id:g});return _({isActive:r}),(i,a)=>(D(),G("div",{class:m(e(c))},[w("button",{id:e(S),class:m(e(b)),"aria-expanded":e(r),"aria-controls":e(x),"aria-describedby":e(x),tabindex:i.disabled?-1:0,type:"button",onClick:a[0]||(a[0]=(...s)=>e(t)&&e(t)(...s)),onKeydown:a[1]||(a[1]=re(ue((...s)=>e(u)&&e(u)(...s),["stop","prevent"]),["space","enter"])),onFocus:a[2]||(a[2]=(...s)=>e(y)&&e(y)(...s)),onBlur:a[3]||(a[3]=s=>f.value=!1)},[N(i.$slots,"title",{},()=>[oe(ne(i.title),1)]),A(e(ce),{class:m(e(o))},{default:T(()=>[A(e(de))]),_:1},8,["class"])],42,X),A(e(ve),null,{default:T(()=>[pe(w("div",{id:e(x),role:"region",class:m(e(n)),"aria-hidden":!e(r),"aria-labelledby":e(S)},[w("div",{class:m(e(C))},[N(i.$slots,"default")],2)],10,Y),[[me,e(r)]])]),_:3})],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse-item.vue"]]);q=be(R,{CollapseItem:H}),j=he(H)});export{j as E,ye as __tla,q as a};