el-collapse-item-c60eb47f.js 3.6 KB

1
  1. import{b2 as V,b8 as $,ch as ae,bU as F,bV as W,be as se,r as K,d8 as j,aS as le,bZ as te,b4 as J,b as d,d as _,o as O,c as Q,aJ as N,W as m,a as e,b6 as R,dA as T,aX as ie,g as x,j as oe,t as ne,i as w,w as U,cI as de,b5 as ce,Q as re,aR as ue,C as pe,a1 as me,dB as be,b7 as ve,bb as he,__tla as Ce}from"./index-af173888.js";let X,Z,fe=Promise.all([(()=>{try{return Ce}catch{}})()]).then(async()=>{const B=b=>typeof se(b),q=V({accordion:Boolean,modelValue:{type:$([Array,String,Number]),default:()=>ae([])}}),z={[F]:B,[W]:B},E=Symbol("collapseContextKey"),P=_({name:"ElCollapse"});var D=R(_({...P,props:q,emits:z,setup(b,{expose:k,emit:h}){const C=b,{activeNames:g,setActiveNames:r}=((t,u)=>{const o=K(j(t.modelValue)),v=c=>{o.value=c;const n=t.accordion?o.value[0]:o.value;u(F,n),u(W,n)};return le(()=>t.modelValue,()=>o.value=j(t.modelValue),{deep:!0}),te(E,{activeNames:o,handleItemClick:c=>{if(t.accordion)v([o.value[0]===c?"":c]);else{const n=[...o.value],y=n.indexOf(c);y>-1?n.splice(y,1):n.push(c),v(n)}}}),{activeNames:o,setActiveNames:v}})(C,h),{rootKls:f}=(()=>{const t=J("collapse");return{rootKls:d(()=>t.b())}})();return k({activeNames:g,setActiveNames:r}),(t,u)=>(O(),Q("div",{class:m(e(f))},[N(t.$slots,"default")],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);const G=V({title:{type:String,default:""},name:{type:$([String,Number]),default:()=>T()},disabled:Boolean}),L=["id","aria-expanded","aria-controls","aria-describedby","tabindex"],M=["id","aria-hidden","aria-labelledby"],Y=_({name:"ElCollapseItem"});var H=R(_({...Y,props:G,setup(b,{expose:k}){const h=b,{focusing:C,id:g,isActive:r,handleFocus:f,handleHeaderClick:t,handleEnterClick:u}=(i=>{const a=ie(E),s=K(!1),p=K(!1),l=K(T()),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:v,rootKls:c,itemWrapperKls:n,itemContentKls:y,scopedContentId:A,scopedHeadId:S}=((i,{focusing:a,isActive:s,id:p})=>{const l=J("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:C,isActive:r,id:g});return k({isActive:r}),(i,a)=>(O(),Q("div",{class:m(e(c))},[x("button",{id:e(S),class:m(e(v)),"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(f)&&e(f)(...s)),onBlur:a[3]||(a[3]=s=>C.value=!1)},[N(i.$slots,"title",{},()=>[oe(ne(i.title),1)]),w(e(ce),{class:m(e(o))},{default:U(()=>[w(e(de))]),_:1},8,["class"])],42,L),w(e(be),null,{default:U(()=>[pe(x("div",{id:e(A),role:"region",class:m(e(n)),"aria-hidden":!e(r),"aria-labelledby":e(S)},[x("div",{class:m(e(y))},[N(i.$slots,"default")],2)],10,M),[[me,e(r)]])]),_:3})],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse-item.vue"]]);Z=ve(D,{CollapseItem:H}),X=he(H)});export{X as E,fe as __tla,Z as a};