mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
10 KiB
JavaScript
2 lines
10 KiB
JavaScript
/*! For license information please see 6280.0643690f.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["6280"],{90681:function(e,t,a){"use strict";a.r(t);var o=a("68063");a("83312");let n=o.Z;t.default=n},68063:function(e,t,a){"use strict";var o=a("80681"),n=a("11848"),l=a("57122"),i=a("54369"),r=a("37313"),s=a("19924"),u=a("44616"),c=a("13118"),v={class:"text"},d={class:"text"},f={class:"text"};t.Z=(0,o.aZ)({__name:"index",setup(e){var t=(0,i.q)({"zh-CN":{clickBubble:"\u70B9\u51FB\u6C14\u6CE1",freeMagnetic:"\u81EA\u7531\u62D6\u62FD\u548C\u78C1\u5438",vModel:"\u53CC\u5411\u7ED1\u5B9A",basicUsageText:"\u5728 x \u8F74\u9ED8\u8BA4\u4F4D\u7F6E\uFF0C\u5141\u8BB8 y \u8F74\u65B9\u5411\u62D6\u62FD",freeMagneticText:"\u5141\u8BB8 x \u548C y \u8F74\u65B9\u5411\u62D6\u62FD\uFF0C\u5438\u9644\u5230 x \u8F74\u65B9\u5411\u6700\u8FD1\u4E00\u8FB9",vModelText:"\u4F7F\u7528 offset \u63A7\u5236\u4F4D\u7F6E\uFF0C"},"en-US":{clickBubble:"Click bubble",freeMagnetic:"Free Magnetic",vModel:"vModel",basicUsageText:"In the default x position, drag in the y direction is allowed",freeMagneticText:"Allow x and y drags to attach to the nearest side of the x axis",vModelText:"Use offset to control the position,"}}),a=e=>{(0,c.CF)("x: ".concat(e.x.toFixed(0),", y: ").concat(e.y.toFixed(0)))},p=()=>{(0,c.CF)(t("clickBubble"))},y=(0,n.iH)(0),g=(0,n.iH)({x:200,y:400});return(e,i)=>((0,o.wg)(),(0,o.j4)((0,n.SU)(s.ZP),{active:y.value,"onUpdate:active":i[1]||(i[1]=e=>y.value=e)},{default:(0,o.w5)(()=>[(0,o.Wm)((0,n.SU)(u.ZP),{title:(0,n.SU)(t)("basicUsage")},{default:(0,o.w5)(()=>[(0,o._)("p",v,(0,l.zw)((0,n.SU)(t)("basicUsageText")),1),0===y.value?((0,o.wg)(),(0,o.j4)((0,n.SU)(r.ZP),{key:0,icon:"chat",onClick:p})):(0,o.kq)("",!0)]),_:1},8,["title"]),(0,o.Wm)((0,n.SU)(u.ZP),{title:(0,n.SU)(t)("freeMagnetic")},{default:(0,o.w5)(()=>[(0,o._)("p",d,(0,l.zw)((0,n.SU)(t)("freeMagneticText")),1),1===y.value?((0,o.wg)(),(0,o.j4)((0,n.SU)(r.ZP),{key:0,icon:"chat",axis:"xy",magnetic:"x",onOffsetChange:a})):(0,o.kq)("",!0)]),_:1},8,["title"]),(0,o.Wm)((0,n.SU)(u.ZP),{title:(0,n.SU)(t)("vModel")},{default:(0,o.w5)(()=>[(0,o._)("p",f,(0,l.zw)((0,n.SU)(t)("vModelText"))+" x\uFF1A"+(0,l.zw)(g.value.x.toFixed(0))+" y: "+(0,l.zw)(g.value.y.toFixed(0)),1),2===y.value?((0,o.wg)(),(0,o.j4)((0,n.SU)(r.ZP),{key:0,icon:"chat",offset:g.value,"onUpdate:offset":i[0]||(i[0]=e=>g.value=e),axis:"xy"},null,8,["offset"])):(0,o.kq)("",!0)]),_:1},8,["title"])]),_:1},8,["active"]))}})},37313:function(e,t,a){"use strict";var o=a("63112"),n=a("10348"),l=(0,o.n)(n.Z);t.ZP=l},95786:function(e,t,a){"use strict";a.d(t,{gb:function(){return l}});var o=a("63112"),n=a("2309"),l=(0,o.n)(n.Z);t.ZP=l},20897:function(e,t,a){"use strict";a.d(t,{G:function(){return n}});var o=0;function n(e){e?(!o&&document.body.classList.add("van-toast--unclickable"),o++):o&&!--o&&document.body.classList.remove("van-toast--unclickable")}},62951:function(e,t,a){"use strict";function o(e,t){return e.reduce((e,a)=>Math.abs(e-t)<Math.abs(a-t)?e:a)}a.d(t,{o:function(){return o}}),a("21690"),a("29256"),a("36056"),a("70629")},84285:function(e,t,a){"use strict";a.d(t,{H:function(){return s},o:function(){return r}});var o=a("11848"),n=a("39594"),l=a("12308"),i=a("10023");function r(){var e=(0,o.qj)({show:!1}),t=t=>{e.show=t},a=a=>{(0,l.l7)(e,a,{transitionAppear:!0}),t(!0)},n=()=>t(!1);return(0,i.F)({open:a,close:n,toggle:t}),{open:a,close:n,state:e,toggle:t}}function s(e){var t=(0,n.ri)(e),a=document.createElement("div");return document.body.appendChild(a),{instance:t.mount(a),unmount(){t.unmount(),document.body.removeChild(a)}}}},10348:function(e,t,a){"use strict";a("82116"),a("17989");var o=a("80681"),n=a("39594"),l=a("11848"),i=a("78335"),r=a("62568"),s=a("82210"),u=a("20358"),c=a("12308"),v=a("62951"),d=a("22300"),f=a("29609"),p=a("96528"),y={gap:(0,i.qM)(24),icon:String,axis:(0,i.SQ)("y"),magnetic:String,offset:{type:Object,default:()=>({x:-1,y:-1})},teleport:{type:[String,Object],default:"body"}},[g,x]=(0,r.do)("floating-bubble");t.Z=(0,o.aZ)({name:g,inheritAttrs:!1,props:y,emits:["click","update:offset","offsetChange"],setup(e,t){var{slots:a,emit:i,attrs:r}=t,y=(0,l.iH)(),g=(0,l.iH)({x:0,y:0,width:0,height:0}),m=(0,o.Fl)(()=>({top:e.gap,right:s.bn.value-g.value.width-e.gap,bottom:s.uK.value-g.value.height-e.gap,left:e.gap})),h=(0,l.iH)(!1),b=!1,S=(0,o.Fl)(()=>{var e={},t=(0,u.Nn)(g.value.x),a=(0,u.Nn)(g.value.y);return e.transform="translate3d(".concat(t,", ").concat(a,", 0)"),(h.value||!b)&&(e.transition="none"),e}),k=()=>{if(T.value){var{width:t,height:a}=(0,d.EL)(y.value),{offset:o}=e;g.value={x:o.x>-1?o.x:s.bn.value-t-e.gap,y:o.y>-1?o.y:s.uK.value-a-e.gap,width:t,height:a}}},w=(0,f.o)(),C=0,O=0,U=e=>{w.start(e),h.value=!0,C=g.value.x,O=g.value.y};(0,d.OR)("touchmove",t=>{if(t.preventDefault(),w.move(t),"lock"!==e.axis&&!w.isTap.value){if("x"===e.axis||"xy"===e.axis){var a=C+w.deltaX.value;a<m.value.left&&(a=m.value.left),a>m.value.right&&(a=m.value.right),g.value.x=a}if("y"===e.axis||"xy"===e.axis){var o=O+w.deltaY.value;o<m.value.top&&(o=m.value.top),o>m.value.bottom&&(o=m.value.bottom),g.value.y=o}i("update:offset",(0,c.ei)(g.value,["x","y"]))}},{target:y});var Z=()=>{h.value=!1,(0,o.Y3)(()=>{if("x"===e.magnetic){var t=(0,v.o)([m.value.left,m.value.right],g.value.x);g.value.x=t}if("y"===e.magnetic){var a=(0,v.o)([m.value.top,m.value.bottom],g.value.y);g.value.y=a}if(!w.isTap.value){var o=(0,c.ei)(g.value,["x","y"]);i("update:offset",o),(C!==o.x||O!==o.y)&&i("offsetChange",o)}})},M=e=>{w.isTap.value?i("click",e):e.stopPropagation()};(0,o.bv)(()=>{k(),(0,o.Y3)(()=>{b=!0})}),(0,o.YP)([s.bn,s.uK,()=>e.gap,()=>e.offset],k,{deep:!0});var T=(0,l.iH)(!0);return(0,o.dl)(()=>{T.value=!0}),(0,o.se)(()=>{e.teleport&&(T.value=!1)}),()=>{var t,l=(0,o.wy)((0,o.Wm)("div",(0,o.dG)({class:x(),ref:y,onTouchstartPassive:U,onTouchend:Z,onTouchcancel:Z,onClickCapture:M,style:S.value},r),[a.default?a.default():(0,o.Wm)(p.ZP,{name:e.icon,class:x("icon")},null)]),[[n.F8,T.value]]);return e.teleport?(0,o.Wm)(o.lR,{to:e.teleport},"function"!=typeof(t=l)&&("[object Object]"!==Object.prototype.toString.call(t)||(0,o.lA)(t))?{default:()=>[l]}:l):l}}})},2309:function(e,t,a){"use strict";a("82116"),a("17989"),a("66786"),a("14529");var o=a("80681"),n=a("62568"),l=a("78335"),i=a("12308"),r=a("20358"),[s,u]=(0,n.do)("loading"),c=Array(12).fill(null).map((e,t)=>(0,o.Wm)("i",{class:u("line",String(t+1))},null)),v=(0,o.Wm)("svg",{class:u("circular"),viewBox:"25 25 50 50"},[(0,o.Wm)("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),d={size:l.Or,type:(0,l.SQ)("circular"),color:String,vertical:Boolean,textSize:l.Or,textColor:String};t.Z=(0,o.aZ)({name:s,props:d,setup(e,t){var{slots:a}=t,n=(0,o.Fl)(()=>(0,i.l7)({color:e.color},(0,r.Xn)(e.size))),l=()=>{var t="spinner"===e.type?c:v;return(0,o.Wm)("span",{class:u("spinner",e.type),style:n.value},[a.icon?a.icon():t])},s=()=>{if(a.default){var t;return(0,o.Wm)("span",{class:u("text"),style:{fontSize:(0,r.Nn)(e.textSize),color:null!==(t=e.textColor)&&void 0!==t?t:e.color}},[a.default()])}};return()=>{var{type:t,vertical:a}=e;return(0,o.Wm)("div",{class:u([t,{vertical:a}]),"aria-live":"polite","aria-busy":!0},[l(),s()])}}})},21083:function(e,t,a){"use strict";a("82116"),a("17989");var o=a("80681"),n=a("62568"),l=a("78335"),i=a("12308"),r=a("20897"),s=a("96528"),u=a("97760"),c=a("95786"),[v,d]=(0,n.do)("toast"),f=["show","overlay","teleport","transition","overlayClass","overlayStyle","closeOnClickOverlay","zIndex"],p={icon:String,show:Boolean,type:(0,l.SQ)("text"),overlay:Boolean,message:l.Or,iconSize:l.Or,duration:(0,l.qM)(2e3),position:(0,l.SQ)("middle"),teleport:[String,Object],wordBreak:String,className:l.Vg,iconPrefix:String,transition:(0,l.SQ)("van-fade"),loadingType:String,forbidClick:Boolean,overlayClass:l.Vg,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean,zIndex:l.Or};t.Z=(0,o.aZ)({name:v,props:p,emits:["update:show"],setup(e,t){var a,{emit:n,slots:l}=t,v=!1,p=()=>{var t=e.show&&e.forbidClick;v!==t&&(v=t,(0,r.G)(v))},y=e=>n("update:show",e),g=()=>{e.closeOnClick&&y(!1)},x=()=>clearTimeout(a),m=()=>{var{icon:t,type:a,iconSize:n,iconPrefix:l,loadingType:i}=e;return t||"success"===a||"fail"===a?(0,o.Wm)(s.JO,{name:t||a,size:n,class:d("icon"),classPrefix:l},null):"loading"===a?(0,o.Wm)(c.gb,{class:d("loading"),size:n,type:i},null):void 0},h=()=>{var{type:t,message:a}=e;return l.message?(0,o.Wm)("div",{class:d("text")},[l.message()]):(0,i.Xq)(a)&&""!==a?"html"===t?(0,o.Wm)("div",{key:0,class:d("text"),innerHTML:String(a)},null):(0,o.Wm)("div",{class:d("text")},[a]):void 0};return(0,o.YP)(()=>[e.show,e.forbidClick],p),(0,o.YP)(()=>[e.show,e.type,e.message,e.duration],()=>{x(),e.show&&e.duration>0&&(a=setTimeout(()=>{y(!1)},e.duration))}),(0,o.bv)(p),(0,o.Ah)(p),()=>(0,o.Wm)(u.GI,(0,o.dG)({class:[d([e.position,"normal"===e.wordBreak?"break-normal":e.wordBreak,{[e.type]:!e.icon}]),e.className],lockScroll:!1,onClick:g,onClosed:x,"onUpdate:show":y},(0,i.ei)(e,f)),{default:()=>[m(),h()]})}})},13118:function(e,t,a){"use strict";a.d(t,{CF:function(){return d},LJ:function(){return g},XA:function(){return y},di:function(){return p},yg:function(){return x}}),a("24836"),a("41712"),a("80855"),a("10502"),a("7978"),a("66746"),a("17530"),a("87604"),a("57024"),a("22175"),a("85322"),a("47897"),a("48943"),a("43356"),a("82116"),a("17989"),a("96245"),a("37232"),a("70629"),a("61557"),a("31564"),a("8649");var o=a("80681"),n=a("11848"),l=a("12308"),i=a("84285"),r=a("21083"),s=[],u=(0,l.l7)({},{icon:"",type:"text",message:"",className:"",overlay:!1,onClose:void 0,onOpened:void 0,duration:2e3,teleport:"body",iconSize:void 0,iconPrefix:void 0,position:"middle",transition:"van-fade",forbidClick:!1,loadingType:void 0,overlayClass:"",overlayStyle:void 0,closeOnClick:!1,closeOnClickOverlay:!1}),c=new Map;function v(e){return(0,l.Kn)(e)?e:{message:e}}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!l._f)return{};var t=function(){if(!s.length){var e=function(){var{instance:e,unmount:t}=(0,i.H)({setup(){var e=(0,n.iH)(""),{open:t,state:a,close:l,toggle:s}=(0,i.o)(),u=()=>{};return(0,o.YP)(e,e=>{a.message=e}),(0,o.FN)().render=()=>(0,o.Wm)(r.Z,(0,o.dG)(a,{onClosed:u,"onUpdate:show":s}),null),{open:t,close:l,message:e}}});return e}();s.push(e)}return s[s.length-1]}(),a=v(e);return t.open((0,l.l7)({},u,c.get(a.type||u.type),a)),t}var f=e=>t=>d((0,l.l7)({type:e},v(t))),p=f("loading"),y=f("success"),g=f("fail"),x=e=>{if(s.length){if(e)s.forEach(e=>{e.close()}),s=[];else{var t;s[0].close()}}}},83312:function(e,t,a){"use strict";a.r(e.exports={})},52199:function(e,t,a){"use strict";a.r(e.exports={})}}]); |