el-collapse-item-dbcbc3e1.js 3.5 KB

1
  1. import{aL as V,aM as B,bq as ae,bI as F,cF as q,b8 as se,r as K,b$ as O,w as le,p as te,aN as P,e as d,d as k,o as W,c as D,aO as I,ad as m,a as e,aP as G,dq as L,i as ie,B as A,D as oe,E as ne,f as w,A as M,bx as de,aG as ce,a5 as re,aE as ue,k as pe,v as me,dr as ve,aQ as be,aU as he,__tla as fe}from"./index-286756b9.js";let Q,T,Ce=Promise.all([(()=>{try{return fe}catch{}})()]).then(async()=>{const E=v=>typeof se(v),U=V({accordion:Boolean,modelValue:{type:B([Array,String,Number]),default:()=>ae([])}}),j={[F]:E,[q]:E},$=Symbol("collapseContextKey"),z=k({name:"ElCollapse"});var J=G(k({...z,props:U,emits:j,setup(v,{expose:_,emit:h}){const f=v,{activeNames:g,setActiveNames:r}=((t,u)=>{const o=K(O(t.modelValue)),b=c=>{o.value=c;const n=t.accordion?o.value[0]:o.value;u(F,n),u(q,n)};return le(()=>t.modelValue,()=>o.value=O(t.modelValue),{deep:!0}),te($,{activeNames:o,handleItemClick:c=>{if(t.accordion)b([o.value[0]===c?"":c]);else{const n=[...o.value],y=n.indexOf(c);y>-1?n.splice(y,1):n.push(c),b(n)}}}),{activeNames:o,setActiveNames:b}})(f,h),{rootKls:C}=(()=>{const t=P("collapse");return{rootKls:d(()=>t.b())}})();return _({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=V({title:{type:String,default:""},name:{type:B([String,Number]),default:()=>L()},disabled:Boolean}),X=["id","aria-expanded","aria-controls","aria-describedby","tabindex"],Y=["id","aria-hidden","aria-labelledby"],Z=k({name:"ElCollapseItem"});var H=G(k({...Z,props:R,setup(v,{expose:_}){const h=v,{focusing:f,id:g,isActive:r,handleFocus:C,handleHeaderClick:t,handleEnterClick:u}=(i=>{const a=ie($),s=K(!1),p=K(!1),l=K(L()),x=d(()=>a==null?void 0:a.activeNames.value.includes(i.name));return{focusing:s,id:l,isActive:x,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:y,scopedContentId:N,scopedHeadId:S}=((i,{focusing:a,isActive:s,id:p})=>{const l=P("collapse"),x=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:x,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)=>(W(),D("div",{class:m(e(c))},[A("button",{id:e(S),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(ce),{class:m(e(o))},{default:M(()=>[w(e(de))]),_:1},8,["class"])],42,X),w(e(ve),null,{default:M(()=>[pe(A("div",{id:e(N),role:"region",class:m(e(n)),"aria-hidden":!e(r),"aria-labelledby":e(S)},[A("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"]]);T=be(J,{CollapseItem:H}),Q=he(H)});export{Q as E,Ce as __tla,T as a};