el-collapse-item-6d06a9e0.js 3.6 KB

1
  1. import{aD as $,aE as B,bk as ae,cf as F,d4 as W,bl as se,r as K,cv as P,L as le,at as te,aF as j,K as d,d as k,o as D,c as G,aG as N,Z as p,a as e,aH as L,dx as M,bP as ie,g as A,m as oe,t as ne,f as w,w as O,bC as de,ax as ce,R as re,av as ue,x as me,a4 as pe,dy as ve,aI as be,aM as fe,__tla as he}from"./index-430b3151.js";let R,T,Ce=Promise.all([(()=>{try{return he}catch{}})()]).then(async()=>{const E=v=>typeof se(v),Z=$({accordion:Boolean,modelValue:{type:B([Array,String,Number]),default:()=>ae([])}}),q={[F]:E,[W]:E},H=Symbol("collapseContextKey"),z=k({name:"ElCollapse"});var J=L(k({...z,props:Z,emits:q,setup(v,{expose:_,emit:f}){const h=v,{activeNames:g,setActiveNames:r}=((t,u)=>{const o=K(P(t.modelValue)),b=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=P(t.modelValue),{deep:!0}),te(H,{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}})(h,f),{rootKls:C}=(()=>{const t=j("collapse");return{rootKls:d(()=>t.b())}})();return _({activeNames:g,setActiveNames:r}),(t,u)=>(D(),G("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 Q=$({title:{type:String,default:""},name:{type:B([String,Number]),default:()=>M()},disabled:Boolean}),U=["id","aria-expanded","aria-controls","aria-describedby","tabindex"],X=["id","aria-hidden","aria-labelledby"],Y=k({name:"ElCollapseItem"});var S=L(k({...Y,props:Q,setup(v,{expose:_}){const f=v,{focusing:h,id:g,isActive:r,handleFocus:C,handleHeaderClick:t,handleEnterClick:u}=(i=>{const a=ie(H),s=K(!1),m=K(!1),l=K(M()),I=d(()=>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)}}})(f),{arrowKls:o,headKls:b,rootKls:c,itemWrapperKls:n,itemContentKls:y,scopedContentId:x,scopedHeadId:V}=((i,{focusing:a,isActive:s,id:m})=>{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(m)}`)),scopedHeadId:d(()=>l.b(`head-${e(m)}`))}})(f,{focusing:h,isActive:r,id:g});return _({isActive:r}),(i,a)=>(D(),G("div",{class:p(e(c))},[A("button",{id:e(V),class:p(e(b)),"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(C)&&e(C)(...s)),onBlur:a[3]||(a[3]=s=>h.value=!1)},[N(i.$slots,"title",{},()=>[oe(ne(i.title),1)]),w(e(ce),{class:p(e(o))},{default:O(()=>[w(e(de))]),_:1},8,["class"])],42,U),w(e(ve),null,{default:O(()=>[me(A("div",{id:e(x),role:"region",class:p(e(n)),"aria-hidden":!e(r),"aria-labelledby":e(V)},[A("div",{class:p(e(y))},[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"]]);T=be(J,{CollapseItem:S}),R=fe(S)});export{R as E,Ce as __tla,T as a};