el-collapse-item-2a135d3a.js 3.6 KB

1
  1. import{a$ as S,b5 as V,ce as ae,bR as W,bS as B,bb as se,r as K,d5 as j,aP as le,bW as te,b1 as O,b as d,d as _,o as P,c as Q,aF as A,W as m,a as e,b3 as R,dx as T,aU as ie,g as I,j as oe,t as ne,i as w,w as U,cF as de,b2 as ce,Q as re,aO as ue,C as pe,a1 as me,dy as be,b4 as ve,b8 as he,__tla as Ce}from"./index-afaf388d.js";let q,z,fe=Promise.all([(()=>{try{return Ce}catch{}})()]).then(async()=>{const $=b=>typeof se(b),D=S({accordion:Boolean,modelValue:{type:V([Array,String,Number]),default:()=>ae([])}}),G={[W]:$,[B]:$},E=Symbol("collapseContextKey"),J=_({name:"ElCollapse"});var L=R(_({...J,props:D,emits:G,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(W,n),u(B,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=O("collapse");return{rootKls:d(()=>t.b())}})();return k({activeNames:g,setActiveNames:r}),(t,u)=>(P(),Q("div",{class:m(e(f))},[A(t.$slots,"default")],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);const M=S({title:{type:String,default:""},name:{type:V([String,Number]),default:()=>T()},disabled:Boolean}),X=["id","aria-expanded","aria-controls","aria-describedby","tabindex"],Y=["id","aria-hidden","aria-labelledby"],Z=_({name:"ElCollapseItem"});var F=R(_({...Z,props:M,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()),N=d(()=>a==null?void 0:a.activeNames.value.includes(i.name));return{focusing:s,id:l,isActive:N,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:x,scopedHeadId:H}=((i,{focusing:a,isActive:s,id:p})=>{const l=O("collapse"),N=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:N,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)=>(P(),Q("div",{class:m(e(c))},[I("button",{id:e(H),class:m(e(v)),"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(f)&&e(f)(...s)),onBlur:a[3]||(a[3]=s=>C.value=!1)},[A(i.$slots,"title",{},()=>[oe(ne(i.title),1)]),w(e(ce),{class:m(e(o))},{default:U(()=>[w(e(de))]),_:1},8,["class"])],42,X),w(e(be),null,{default:U(()=>[pe(I("div",{id:e(x),role:"region",class:m(e(n)),"aria-hidden":!e(r),"aria-labelledby":e(H)},[I("div",{class:m(e(y))},[A(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"]]);z=ve(L,{CollapseItem:F}),q=he(F)});export{q as E,fe as __tla,z as a};