el-collapse-item-086c9c49.js 3.6 KB

1
  1. import{aE as $,aF as B,bi as ae,c9 as F,c_ as j,bj as se,r as K,cp as O,O as le,at as te,aG as T,e as c,d as _,o as W,c as D,aH as I,a1 as m,a as e,aI as G,dr as J,aT as ie,j as x,l as oe,t as ne,i as w,w as Q,bA as ce,aQ as de,U as re,b9 as ue,D as pe,a7 as me,ds as ve,aJ as be,aN as he,__tla as fe}from"./index-2f799233.js";let U,q,Ce=Promise.all([(()=>{try{return fe}catch{}})()]).then(async()=>{const E=v=>typeof se(v),z=$({accordion:Boolean,modelValue:{type:B([Array,String,Number]),default:()=>ae([])}}),L={[F]:E,[j]:E},H=Symbol("collapseContextKey"),P=_({name:"ElCollapse"});var M=G(_({...P,props:z,emits:L,setup(v,{expose:k,emit:h}){const f=v,{activeNames:g,setActiveNames:r}=((t,u)=>{const o=K(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(H,{activeNames:o,handleItemClick:d=>{if(t.accordion)b([o.value[0]===d?"":d]);else{const n=[...o.value],y=n.indexOf(d);y>-1?n.splice(y,1):n.push(d),b(n)}}}),{activeNames:o,setActiveNames:b}})(f,h),{rootKls:C}=(()=>{const t=T("collapse");return{rootKls:c(()=>t.b())}})();return k({activeNames:g,setActiveNames:r}),(t,u)=>(W(),D("div",{class:m(e(C))},[I(t.$slots,"default")],2))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);const R=$({title:{type:String,default:""},name:{type:B([String,Number]),default:()=>J()},disabled:Boolean}),X=["id","aria-expanded","aria-controls","aria-describedby","tabindex"],Y=["id","aria-hidden","aria-labelledby"],Z=_({name:"ElCollapseItem"});var S=G(_({...Z,props:R,setup(v,{expose:k}){const h=v,{focusing:f,id:g,isActive:r,handleFocus:C,handleHeaderClick:t,handleEnterClick:u}=(i=>{const a=ie(H),s=K(!1),p=K(!1),l=K(J()),A=c(()=>a==null?void 0:a.activeNames.value.includes(i.name));return{focusing:s,id:l,isActive:A,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:d,itemWrapperKls:n,itemContentKls:y,scopedContentId:N,scopedHeadId:V}=((i,{focusing:a,isActive:s,id:p})=>{const l=T("collapse"),A=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:A,itemWrapperKls:c(()=>l.be("item","wrap")),itemContentKls:c(()=>l.be("item","content")),scopedContentId:c(()=>l.b(`content-${e(p)}`)),scopedHeadId:c(()=>l.b(`head-${e(p)}`))}})(h,{focusing:f,isActive:r,id:g});return k({isActive:r}),(i,a)=>(W(),D("div",{class:m(e(d))},[x("button",{id:e(V),class:m(e(b)),"aria-expanded":e(r),"aria-controls":e(N),"aria-describedby":e(N),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)},[I(i.$slots,"title",{},()=>[oe(ne(i.title),1)]),w(e(de),{class:m(e(o))},{default:Q(()=>[w(e(ce))]),_:1},8,["class"])],42,X),w(e(ve),null,{default:Q(()=>[pe(x("div",{id:e(N),role:"region",class:m(e(n)),"aria-hidden":!e(r),"aria-labelledby":e(V)},[x("div",{class:m(e(y))},[I(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(M,{CollapseItem:S}),U=he(S)});export{U as E,Ce as __tla,q as a};