1 |
- System.register(["./index-legacy-e1ea41b7.js","./index-legacy-666fea96.js"],(function(e,a){"use strict";var l,n,r,o,t,d,s,i,u,c,v,p,m,b,y,g,f,h,x,k,A,C,V,S;return{setters:[e=>{l=e.c,n=e.d,r=e.aa,o=e.Y,t=e.a,d=e.b0,s=e.t,i=e.k,u=e.ac,c=e.n,v=e.r,p=e.ad,m=e.e,b=e.b1,y=e.w,g=e.aL,f=e.z,h=e.aM,x=e.ae,k=e.h,A=e.g,C=e.v},e=>{V=e.c,S=e.C}],execute:function(){const[a,j]=l("collapse"),z=Symbol(a),B={border:s,accordion:Boolean,modelValue:{type:[String,Number,Array],default:""}};var L=n({name:a,props:B,emits:["change","update:modelValue"],setup(e,{emit:a,slots:l}){const{linkChildren:n,children:s}=r(z),i=e=>{a("change",e),a("update:modelValue",e)};return o({toggleAll:(a={})=>{if(e.accordion)return;"boolean"==typeof a&&(a={expanded:a});const{expanded:l,skipDisabled:n}=a,r=s.filter((e=>e.disabled&&n?e.expanded.value:null!=l?l:!e.expanded.value)).map((e=>e.itemName.value));i(r)}}),n({toggle:(a,l)=>{const{accordion:n,modelValue:r}=e;i(n?a===r?"":a:l?r.concat(a):r.filter((e=>e!==a)))},isExpanded:a=>{const{accordion:l,modelValue:n}=e;return!!function(e,a){return a&&Array.isArray(e)?(console.error('[Vant] Collapse: "v-model" should not be Array in accordion mode'),!1):!(!a&&!Array.isArray(e)&&(console.error('[Vant] Collapse: "v-model" should be Array in non-accordion mode'),1))}(n,l)&&(l?n===a:n.includes(a))}}),()=>{var a;return t("div",{class:[j(),{[d]:e.border}]},[null==(a=l.default)?void 0:a.call(l)])}}});e("C",i(L));const[N,w]=l("collapse-item"),E=["icon","title","value","label","right-icon"],O=u({},V,{name:c,isLink:s,disabled:Boolean,readonly:Boolean,lazyRender:s});var R=n({name:N,props:O,setup(e,{slots:a}){const l=v(),n=v(),{parent:r,index:d}=p(z);if(!r)return void console.error("[Vant] <CollapseItem> must be a child component of <Collapse>.");const s=m((()=>{var a;return null!=(a=e.name)?a:d.value})),i=m((()=>r.isExpanded(s.value))),u=v(i.value),c=b((()=>u.value||!e.lazyRender)),j=()=>{i.value?l.value&&(l.value.style.height=""):u.value=!1};y(i,((e,a)=>{null!==a&&(e&&(u.value=!0),(e?f:h)((()=>{if(!n.value||!l.value)return;const{offsetHeight:a}=n.value;if(a){const n=`${a}px`;l.value.style.height=e?"0":n,g((()=>{l.value&&(l.value.style.height=e?n:"0")}))}else j()})))}));const B=(e=!i.value)=>{r.toggle(s.value,e)},L=()=>{e.disabled||e.readonly||B()},N=()=>{const{border:l,disabled:n,readonly:r}=e,o=x(e,Object.keys(V));return r&&(o.isLink=!1),(n||r)&&(o.clickable=!1),t(S,k({role:"button",class:w("title",{disabled:n,expanded:i.value,borderless:!l}),"aria-expanded":String(i.value),onClick:L},o),x(a,E))},O=c((()=>{var e;return A(t("div",{ref:l,class:w("wrapper"),onTransitionend:j},[t("div",{ref:n,class:w("content")},[null==(e=a.default)?void 0:e.call(a)])]),[[C,u.value]])}));return o({toggle:B,expanded:i,itemName:s}),()=>t("div",{class:[w({border:d.value&&e.border})]},[N(),O()])}});e("a",i(R))}}}));
|