2 lines
3.3 KiB
JavaScript
2 lines
3.3 KiB
JavaScript
"use strict";var e=Object.defineProperty,o=Object.defineProperties,a=Object.getOwnPropertyDescriptors,t=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,s=(o,a,t)=>a in o?e(o,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[a]=t;const i=require("../../../../common/vendor.js");if(!Array){(i.resolveComponent("wd-overlay")+i.resolveComponent("wd-loading")+i.resolveComponent("wd-transition"))()}Math||((()=>"../wd-overlay/wd-overlay.js")+(()=>"../wd-loading/wd-loading.js")+(()=>"../wd-transition/wd-transition.js"))();const u=i.defineComponent((r=((e,o)=>{for(var a in o||(o={}))l.call(o,a)&&s(e,a,o[a]);if(t)for(var a of t(o))n.call(o,a)&&s(e,a,o[a]);return e})({},{name:"wd-toast",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"}}),c={props:i.toastProps,setup(e){const o=e,a=i.ref(""),t=i.ref(!1),l=i.ref(""),n=i.ref("middle"),s=i.ref(!1),u=i.ref(100),r=i.ref("outline"),c=i.ref("#4D80F0"),v=i.ref(42),d=i.ref(""),p=i.ref(!1);let f=null,m=null;const w=o.selector?i.toastDefaultOptionKey+o.selector:i.toastDefaultOptionKey,g=i.inject(w,i.ref(i.defaultOptions));i.watch((()=>g.value),(e=>{var o;(o=e)&&(s.value=!!i.isDef(o.show)&&o.show,s.value&&(a.value=i.isDef(o.iconName)?o.iconName:"",t.value=!!i.isDef(o.customIcon)&&o.customIcon,l.value=i.isDef(o.msg)?o.msg:"",n.value=i.isDef(o.position)?o.position:"middle",u.value=i.isDef(o.zIndex)?o.zIndex:100,r.value=i.isDef(o.loadingType)?o.loadingType:"outline",c.value=i.isDef(o.loadingColor)?o.loadingColor:"#4D80F0",v.value=i.isDef(o.iconSize)?o.iconSize:42,p.value=!!i.isDef(o.cover)&&o.cover,m=i.isFunction(o.closed)?o.closed:null,f=i.isFunction(o.opened)?o.opened:null))}),{deep:!0,immediate:!0}),i.watch((()=>a.value),(()=>{x()}),{deep:!0,immediate:!0});const y=i.computed((()=>{const e={"z-index":u.value,position:"fixed",top:"50%",left:0,width:"100%",transform:"translate(0, -50%)","text-align":"center"};return i.objToStyle(e)})),b=i.computed((()=>i.objToStyle({display:"inline-block","margin-right":"16px"}))),h=i.computed((()=>`wd-toast ${o.customClass} wd-toast--${n.value} ${"loading"===a.value&&!l.value||!a.value&&!t.value?"":"wd-toast--with-icon"} ${"loading"!==a.value||l.value?"":"wd-toast--loading"}`));function D(){i.isFunction(f)&&f()}function j(){i.isFunction(m)&&m()}function x(){if("success"!==a.value&&"warning"!==a.value&&"info"!==a.value&&"error"!==a.value)return;const e=i.toastIcon[a.value](),o=`"data:image/svg+xml;base64,${i.encode(e)}"`;d.value=o}return i.onBeforeMount((()=>{x()})),(e,o)=>i.e({a:p.value},p.value?{b:i.p({"z-index":u.value,"lock-scroll":!0,show:s.value,"custom-style":"background-color: transparent;pointer-events: auto;"})}:{},{c:"loading"===a.value},"loading"===a.value?{d:i.p({type:r.value,color:c.value,"custom-class":"wd-toast__icon",customStyle:b.value})}:"success"===a.value||"warning"===a.value||"info"===a.value||"error"===a.value?{f:i.s(`background-image: url(${d.value}); width:${v.value}px; height:${v.value}px`),g:i.s(`width:${v.value}px; height:${v.value}px`)}:(t.value,{}),{e:"success"===a.value||"warning"===a.value||"info"===a.value||"error"===a.value,h:t.value,i:l.value},l.value?{j:i.t(l.value)}:{},{k:i.n(h.value),l:i.o(D),m:i.o(j),n:i.p({name:"fade",show:s.value,"custom-style":y.value})})}},o(r,a(c))));var r,c;const v=i._export_sfc(u,[["__scopeId","data-v-06ceeffd"]]);wx.createComponent(v);
|