index-legacy-96b15b0b.js 2.8 KB

1
  1. System.register(["./index-legacy-e6be1dcb.js","./index-legacy-72ad1f03.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.ab,o=e.Z,t=e.a,d=e.aQ,s=e.t,i=e.k,u=e.ad,c=e.n,v=e.r,p=e.ae,m=e.e,b=e.aR,y=e.w,g=e.aS,f=e.z,h=e.aB,x=e.af,k=e.h,A=e.g,C=e.v},e=>{V=e.c,S=e.C}],execute:function(){const[a,B]=l("collapse"),j=Symbol(a),z={border:s,accordion:Boolean,modelValue:{type:[String,Number,Array],default:""}};var N=n({name:a,props:z,emits:["change","update:modelValue"],setup(e,{emit:a,slots:l}){const{linkChildren:n,children:s}=r(j),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:[B(),{[d]:e.border}]},[null==(a=l.default)?void 0:a.call(l)])}}});e("C",i(N));const[R,w]=l("collapse-item"),E=["icon","title","value","label","right-icon"],L=u({},V,{name:c,isLink:s,disabled:Boolean,readonly:Boolean,lazyRender:s});var D=n({name:R,props:L,setup(e,{slots:a}){const l=v(),n=v(),{parent:r,index:d}=p(j);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)),B=()=>{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 B()})))}));const z=(e=!i.value)=>{r.toggle(s.value,e)},N=()=>{e.disabled||e.readonly||z()},R=()=>{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:N},o),x(a,E))},L=c((()=>{var e;return A(t("div",{ref:l,class:w("wrapper"),onTransitionend:B},[t("div",{ref:n,class:w("content")},[null==(e=a.default)?void 0:e.call(a)])]),[[C,u.value]])}));return o({toggle:z,expanded:i,itemName:s}),()=>t("div",{class:[w({border:d.value&&e.border})]},[R(),L()])}});e("a",i(D))}}}));