index-legacy-1ce1819d.js 4.8 KB

1
  1. System.register(["./index-legacy-e28491f2.js"],(function(t,e){"use strict";var o,n,l,a,s,c,i,r,u,d,f,m,b,B,g,v,p,C,h,w,y,x,k,S,T,D,O,P,A,H,N,U,z,I;return{setters:[t=>{o=t.aU,n=t.d,l=t.l,a=t.bJ,s=t.bu,c=t.bx,i=t.f,r=t.aX,u=t.bi,d=t.bK,f=t.bL,m=t.bo,b=t.e,B=t.bp,g=t.K,v=t.bM,p=t.bk,C=t.bN,h=t.by,w=t.bO,y=t.n,x=t.bC,k=t.bv,S=t.bI,T=t.P,D=t.bP,O=t.bQ,P=t.bR,A=t.bS,H=t.bT,N=t.bU,U=t.bV,z=t.bW,I=t.bX}],execute:function(){t("s",tt);const[e,K]=o("action-bar"),E=Symbol(e),F={placeholder:Boolean,safeAreaInsetBottom:c};var L=n({name:e,props:F,setup(t,{slots:e}){const o=l(),n=a(o,K),{linkChildren:c}=s(E);c();const r=()=>{var n;return i("div",{ref:o,class:[K(),{"van-safe-area-bottom":t.safeAreaInsetBottom}]},[null==(n=e.default)?void 0:n.call(e)])};return()=>t.placeholder?n(r):r()}});const M=r(L),[R,X]=o("action-bar-button"),j=u({},d,{type:String,text:String,icon:String,color:String,loading:Boolean,disabled:Boolean});var J=n({name:R,props:j,setup(t,{slots:e}){const o=f(),{parent:n,index:l}=m(E),a=b((()=>{if(n){const t=n.children[l.value-1];return!(t&&"isButton"in t)}})),s=b((()=>{if(n){const t=n.children[l.value+1];return!(t&&"isButton"in t)}}));return B({isButton:!0}),()=>{const{type:n,icon:l,text:c,color:r,loading:u,disabled:d}=t;return i(g,{class:X([n,{last:s.value,first:a.value}]),size:"large",type:n,icon:l,color:r,loading:u,disabled:d,onClick:o},{default:()=>[e.default?e.default():c]})}}});const Q=r(J),[V,W,q]=o("dialog"),G=u({},v,{title:String,theme:String,width:p,message:[String,Function],callback:Function,allowHtml:Boolean,className:C,transition:h("van-dialog-bounce"),messageAlign:String,closeOnPopstate:c,showCancelButton:Boolean,cancelButtonText:String,cancelButtonColor:String,cancelButtonDisabled:Boolean,confirmButtonText:String,confirmButtonColor:String,confirmButtonDisabled:Boolean,showConfirmButton:c,closeOnClickOverlay:Boolean}),Y=[...w,"transition","closeOnPopstate"];var Z=n({name:V,props:G,emits:["confirm","cancel","keydown","update:show"],setup(t,{emit:e,slots:o}){const n=l(),a=y({confirm:!1,cancel:!1}),s=t=>e("update:show",t),c=e=>{var o;s(!1),null==(o=t.callback)||o.call(t,e)},r=o=>()=>{t.show&&(e(o),t.beforeClose?(a[o]=!0,N(t.beforeClose,{args:[o],done(){c(o),a[o]=!1},canceled(){a[o]=!1}})):c(o))},u=r("cancel"),d=r("confirm"),f=D((o=>{var l,a;o.target===(null==(a=null==(l=n.value)?void 0:l.popupRef)?void 0:a.value)&&({Enter:t.showConfirmButton?d:O,Escape:t.showCancelButton?u:O}[o.key](),e("keydown",o))}),["enter","esc"]),m=()=>{const e=o.title?o.title():t.title;if(e)return i("div",{class:W("header",{isolated:!t.message&&!o.default})},[e])},b=e=>{const{message:o,allowHtml:n,messageAlign:l}=t,a=W("message",{"has-title":e,[l]:l}),s=P(o)?o():o;return n&&"string"==typeof s?i("div",{class:a,innerHTML:s},null):i("div",{class:a},[s])},B=()=>{if(o.default)return i("div",{class:W("content")},[o.default()]);const{title:e,message:n,allowHtml:l}=t;if(n){const t=!(!e&&!o.title);return i("div",{key:l?1:0,class:W("content",{isolated:!t})},[b(t)])}},v=()=>o.footer?o.footer():"round-button"===t.theme?i(M,{class:W("footer")},{default:()=>[t.showCancelButton&&i(Q,{type:"warning",text:t.cancelButtonText||q("cancel"),class:W("cancel"),color:t.cancelButtonColor,loading:a.cancel,disabled:t.cancelButtonDisabled,onClick:u},null),t.showConfirmButton&&i(Q,{type:"danger",text:t.confirmButtonText||q("confirm"),class:W("confirm"),color:t.confirmButtonColor,loading:a.confirm,disabled:t.confirmButtonDisabled,onClick:d},null)]}):i("div",{class:[H,W("footer")]},[t.showCancelButton&&i(g,{size:"large",text:t.cancelButtonText||q("cancel"),class:W("cancel"),style:{color:t.cancelButtonColor},loading:a.cancel,disabled:t.cancelButtonDisabled,onClick:u},null),t.showConfirmButton&&i(g,{size:"large",text:t.confirmButtonText||q("confirm"),class:[W("confirm"),{[A]:t.showCancelButton}],style:{color:t.confirmButtonColor},loading:a.confirm,disabled:t.confirmButtonDisabled,onClick:d},null)]);return()=>{const{width:e,title:o,theme:l,message:a,className:c}=t;return i(T,x({ref:n,role:"dialog",class:[W([l]),c],style:{width:S(e)},tabindex:0,"aria-labelledby":o||a,onKeydown:f,"onUpdate:show":s},k(t,Y)),{default:()=>[m(),B(),v()]})}}});let $,_=u({},{title:"",width:"",theme:null,message:"",overlay:!0,callback:null,teleport:"body",className:"",allowHtml:!1,lockScroll:!0,transition:void 0,beforeClose:null,overlayClass:"",overlayStyle:void 0,messageAlign:"",cancelButtonText:"",cancelButtonColor:null,cancelButtonDisabled:!1,confirmButtonText:"",confirmButtonColor:null,confirmButtonDisabled:!1,showConfirmButton:!0,showCancelButton:!1,closeOnPopstate:!0,closeOnClickOverlay:!1});function tt(t){return U?new Promise(((e,o)=>{$||function(){const t={setup(){const{state:t,toggle:e}=I();return()=>i(Z,x(t,{"onUpdate:show":e}),null)}};({instance:$}=z(t))}(),$.open(u({},_,t,{callback:t=>{("confirm"===t?e:o)(t)}}))})):Promise.resolve()}t("a",(t=>tt(u({showCancelButton:!0},t)))),r(Z)}}}));