el-collapse-item-5ecf4321.js 3.6 KB

1
  1. import{az as V,aA as $,aJ as ae,cm as F,c_ as J,bp as se,r as y,cB as O,K as le,aU as te,aB as W,J as c,d as _,o as z,c as D,aC as N,Y as p,a as e,aD as Q,dt as R,aO as ie,g as x,m as oe,t as ne,f as w,w as T,bS as ce,aS as de,Q as re,aR as ue,v as me,a3 as pe,du as ve,aE as be,aI as he,__tla as fe}from"./index-2eab2d23.js";let U,Y,Ce=Promise.all([(()=>{try{return fe}catch{}})()]).then(async()=>{const E=v=>typeof se(v),j=V({accordion:Boolean,modelValue:{type:$([Array,String,Number]),default:()=>ae([])}}),q={[F]:E,[J]:E},S=Symbol("collapseContextKey"),P=_({name:"ElCollapse"});var G=Q(_({...P,props:j,emits:q,setup(v,{expose:k,emit:h}){const f=v,{activeNames:g,setActiveNames:r}=((t,u)=>{const o=y(O(t.modelValue)),b=d=>{o.value=d;const n=t.accordion?o.value[0]:o.value;u(F,n),u(J,n)};return le(()=>t.modelValue,()=>o.value=O(t.modelValue),{deep:!0}),te(S,{activeNames:o,handleItemClick:d=>{if(t.accordion)b([o.value[0]===d?"":d]);else{const n=[...o.value],K=n.indexOf(d);K>-1?n.splice(K,1):n.push(d),b(n)}}}),{activeNames:o,setActiveNames:b}})(f,h),{rootKls:C}=(()=>{const t=W("collapse");return{rootKls:c(()=>t.b())}})();return k({activeNames:g,setActiveNames:r}),(t,u)=>(z(),D("div",{class:p(e(C))},[N(t.$slots,"default")],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);const L=V({title:{type:String,default:""},name:{type:$([String,Number]),default:()=>R()},disabled:Boolean}),M=["id","aria-expanded","aria-controls","aria-describedby","tabindex"],X=["id","aria-hidden","aria-labelledby"],Z=_({name:"ElCollapseItem"});var B=Q(_({...Z,props:L,setup(v,{expose:k}){const h=v,{focusing:f,id:g,isActive:r,handleFocus:C,handleHeaderClick:t,handleEnterClick:u}=(i=>{const a=ie(S),s=y(!1),m=y(!1),l=y(R()),I=c(()=>a==null?void 0:a.activeNames.value.includes(i.name));return{focusing:s,id:l,isActive:I,handleFocus:()=>{setTimeout(()=>{m.value?m.value=!1:s.value=!0},50)},handleHeaderClick:()=>{i.disabled||(a==null||a.handleItemClick(i.name),s.value=!1,m.value=!0)},handleEnterClick:()=>{a==null||a.handleItemClick(i.name)}}})(h),{arrowKls:o,headKls:b,rootKls:d,itemWrapperKls:n,itemContentKls:K,scopedContentId:A,scopedHeadId:H}=((i,{focusing:a,isActive:s,id:m})=>{const l=W("collapse"),I=c(()=>[l.b("item"),l.is("active",e(s)),l.is("disabled",i.disabled)]),ee=c(()=>[l.be("item","header"),l.is("active",e(s)),{focusing:e(a)&&!i.disabled}]);return{arrowKls:c(()=>[l.be("item","arrow"),l.is("active",e(s))]),headKls:ee,rootKls:I,itemWrapperKls:c(()=>l.be("item","wrap")),itemContentKls:c(()=>l.be("item","content")),scopedContentId:c(()=>l.b(`content-${e(m)}`)),scopedHeadId:c(()=>l.b(`head-${e(m)}`))}})(h,{focusing:f,isActive:r,id:g});return k({isActive:r}),(i,a)=>(z(),D("div",{class:p(e(d))},[x("button",{id:e(H),class:p(e(b)),"aria-expanded":e(r),"aria-controls":e(A),"aria-describedby":e(A),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(C)&&e(C)(...s)),onBlur:a[3]||(a[3]=s=>f.value=!1)},[N(i.$slots,"title",{},()=>[oe(ne(i.title),1)]),w(e(de),{class:p(e(o))},{default:T(()=>[w(e(ce))]),_:1},8,["class"])],42,M),w(e(ve),null,{default:T(()=>[me(x("div",{id:e(A),role:"region",class:p(e(n)),"aria-hidden":!e(r),"aria-labelledby":e(H)},[x("div",{class:p(e(K))},[N(i.$slots,"default")],2)],10,X),[[pe,e(r)]])]),_:3})],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse-item.vue"]]);Y=be(G,{CollapseItem:B}),U=he(B)});export{U as E,Ce as __tla,Y as a};