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