mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
/*! For license information please see 8713.d4123648.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["8713"],{89893:function(e,l,a){"use strict";a.r(l);var t=a("42278");a("68217");let o=t.Z;l.default=o},42278:function(e,l,a){"use strict";var t=a("80681"),o=a("11848"),n=a("77279"),r=a("54369"),i=a("13118");l.Z=(0,t.aZ)({__name:"index",setup(e){var l=(0,r.q)({"zh-CN":{halfStar:"\u534A\u661F",disabled:"\u7981\u7528\u72B6\u6001",customIcon:"\u81EA\u5B9A\u4E49\u56FE\u6807",customStyle:"\u81EA\u5B9A\u4E49\u6837\u5F0F",customCount:"\u81EA\u5B9A\u4E49\u6570\u91CF",clearable:"\u53EF\u6E05\u7A7A",readonly:"\u53EA\u8BFB\u72B6\u6001",readonlyHalfStar:"\u53EA\u8BFB\u72B6\u6001\u5C0F\u6570\u663E\u793A",changeEvent:"\u76D1\u542C change \u4E8B\u4EF6",toastContent:e=>"\u5F53\u524D\u503C\uFF1A".concat(e)},"en-US":{halfStar:"Half Star",disabled:"Disabled",customIcon:"Custom Icon",customStyle:"Custom Style",customCount:"Custom Count",clearable:"Clearable",readonly:"Readonly",readonlyHalfStar:"Readonly Half Star",changeEvent:"Change Event",toastContent:e=>"current value\uFF1A".concat(e)}}),a=(0,o.iH)(3),u=(0,o.iH)(3),s=(0,o.iH)(3),d=(0,o.iH)(2.5),c=(0,o.iH)(4),v=(0,o.iH)(3),m=(0,o.iH)(3.3),f=(0,o.iH)(2),p=(0,o.iH)(3),h=e=>(0,i.CF)(l("toastContent",e));return(e,r)=>{var i=(0,t.up)("demo-block");return(0,t.wg)(),(0,t.iD)(t.HY,null,[(0,t.Wm)(i,{title:(0,o.SU)(l)("basicUsage")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:a.value,"onUpdate:modelValue":r[0]||(r[0]=e=>a.value=e)},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("customIcon")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:u.value,"onUpdate:modelValue":r[1]||(r[1]=e=>u.value=e),icon:"like","void-icon":"like-o"},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("customStyle")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:s.value,"onUpdate:modelValue":r[2]||(r[2]=e=>s.value=e),size:25,color:"#ffd21e","void-icon":"star","void-color":"#eee"},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("halfStar")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:d.value,"onUpdate:modelValue":r[3]||(r[3]=e=>d.value=e),"allow-half":""},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("customCount")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:c.value,"onUpdate:modelValue":r[4]||(r[4]=e=>c.value=e),count:6},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("clearable")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:p.value,"onUpdate:modelValue":r[5]||(r[5]=e=>p.value=e),clearable:""},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("disabled")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:v.value,"onUpdate:modelValue":r[6]||(r[6]=e=>v.value=e),disabled:""},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("readonly")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:v.value,"onUpdate:modelValue":r[7]||(r[7]=e=>v.value=e),readonly:""},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("readonlyHalfStar")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:m.value,"onUpdate:modelValue":r[8]||(r[8]=e=>m.value=e),readonly:"","allow-half":""},null,8,["modelValue"])]),_:1},8,["title"]),(0,t.Wm)(i,{title:(0,o.SU)(l)("changeEvent")},{default:(0,t.w5)(()=>[(0,t.Wm)((0,o.SU)(n.ZP),{modelValue:f.value,"onUpdate:modelValue":r[9]||(r[9]=e=>f.value=e),onChange:h},null,8,["modelValue"])]),_:1},8,["title"])],64)}}})},89923:function(e,l,a){"use strict";a.d(l,{v:function(){return n}});var t=a("11848"),o=a("80681");function n(){var e=(0,t.iH)([]),l=[];return(0,o.Xn)(()=>{e.value=[]}),[e,a=>(!l[a]&&(l[a]=l=>{e.value[a]=l}),l[a])]}},95786:function(e,l,a){"use strict";a.d(l,{gb:function(){return n}});var t=a("63112"),o=a("2309"),n=(0,t.n)(o.Z);l.ZP=n},77279:function(e,l,a){"use strict";var t=a("63112"),o=a("64362"),n=(0,t.n)(o.Z);l.ZP=n},20897:function(e,l,a){"use strict";a.d(l,{G:function(){return o}});var t=0;function o(e){e?(!t&&document.body.classList.add("van-toast--unclickable"),t++):t&&!--t&&document.body.classList.remove("van-toast--unclickable")}},84285:function(e,l,a){"use strict";a.d(l,{H:function(){return u},o:function(){return i}});var t=a("11848"),o=a("39594"),n=a("12308"),r=a("10023");function i(){var e=(0,t.qj)({show:!1}),l=l=>{e.show=l},a=a=>{(0,n.l7)(e,a,{transitionAppear:!0}),l(!0)},o=()=>l(!1);return(0,r.F)({open:a,close:o,toggle:l}),{open:a,close:o,state:e,toggle:l}}function u(e){var l=(0,o.ri)(e),a=document.createElement("div");return document.body.appendChild(a),{instance:l.mount(a),unmount(){l.unmount(),document.body.removeChild(a)}}}},2309:function(e,l,a){"use strict";a("82116"),a("17989"),a("66786"),a("14529");var t=a("80681"),o=a("62568"),n=a("78335"),r=a("12308"),i=a("20358"),[u,s]=(0,o.do)("loading"),d=Array(12).fill(null).map((e,l)=>(0,t.Wm)("i",{class:s("line",String(l+1))},null)),c=(0,t.Wm)("svg",{class:s("circular"),viewBox:"25 25 50 50"},[(0,t.Wm)("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),v={size:n.Or,type:(0,n.SQ)("circular"),color:String,vertical:Boolean,textSize:n.Or,textColor:String};l.Z=(0,t.aZ)({name:u,props:v,setup(e,l){var{slots:a}=l,o=(0,t.Fl)(()=>(0,r.l7)({color:e.color},(0,i.Xn)(e.size))),n=()=>{var l="spinner"===e.type?d:c;return(0,t.Wm)("span",{class:s("spinner",e.type),style:o.value},[a.icon?a.icon():l])},u=()=>{if(a.default){var l;return(0,t.Wm)("span",{class:s("text"),style:{fontSize:(0,i.Nn)(e.textSize),color:null!==(l=e.textColor)&&void 0!==l?l:e.color}},[a.default()])}};return()=>{var{type:l,vertical:a}=e;return(0,t.Wm)("div",{class:s([l,{vertical:a}]),"aria-live":"polite","aria-busy":!0},[n(),u()])}}})},64362:function(e,l,a){"use strict";a("82116"),a("17989"),a("66786"),a("14529"),a("31564"),a("8649"),a("70629"),a("61557");var t=a("80681"),o=a("11848"),n=a("62568"),r=a("78335"),i=a("82210"),u=a("20358"),s=a("22300"),d=a("89923"),c=a("29609"),v=a("96528"),[m,f]=(0,n.do)("rate"),p={size:r.Or,icon:(0,r.SQ)("star"),color:String,count:(0,r.SI)(5),gutter:r.Or,clearable:Boolean,readonly:Boolean,disabled:Boolean,voidIcon:(0,r.SQ)("star-o"),allowHalf:Boolean,voidColor:String,touchable:r.J5,iconPrefix:String,modelValue:(0,r.qM)(0),disabledColor:String};l.Z=(0,t.aZ)({name:m,props:p,emits:["change","update:modelValue"],setup(e,l){var a,n,{emit:r}=l,m=(0,c.o)(),[p,h]=(0,d.v)(),y=(0,o.iH)(),S=(0,t.Fl)(()=>e.readonly||e.disabled),g=(0,t.Fl)(()=>S.value||!e.touchable),b=(0,t.Fl)(()=>Array(+e.count).fill("").map((l,a)=>{var t,o,n,r;return t=e.modelValue,o=a+1,n=e.allowHalf,r=e.readonly,t>=o?{status:"full",value:1}:t+.5>=o&&n&&!r?{status:"half",value:.5}:t+1>=o&&n&&r?{status:"half",value:Math.round((t-o+1)*1e10)/1e10}:{status:"void",value:0}})),C=Number.MAX_SAFE_INTEGER,V=Number.MIN_SAFE_INTEGER,w=()=>{n=(0,s.EL)(y);var l=p.value.map(s.EL);a=[],l.forEach((l,t)=>{C=Math.min(l.top,C),V=Math.max(l.top,V),e.allowHalf?a.push({score:t+.5,left:l.left,top:l.top,height:l.height},{score:t+1,left:l.left+l.width/2,top:l.top,height:l.height}):a.push({score:t+1,left:l.left,top:l.top,height:l.height})})},W=(l,t)=>{for(var o=a.length-1;o>0;o--)if(t>=n.top&&t<=n.bottom){if(l>a[o].left&&t>=a[o].top&&t<=a[o].top+a[o].height)return a[o].score}else{var r=t<n.top?C:V;if(l>a[o].left&&a[o].top===r)return a[o].score}return e.allowHalf?.5:1},U=l=>{!S.value&&l!==e.modelValue&&(r("update:modelValue",l),r("change",l))},k=e=>{!g.value&&(m.start(e),w())},x=(l,a)=>{var o,{icon:n,size:r,color:i,count:s,gutter:d,voidIcon:c,disabled:p,voidColor:y,allowHalf:S,iconPrefix:g,disabledColor:b}=e,C=a+1,V="full"===l.status,k="void"===l.status,x=S&&l.value>0&&l.value<1;return d&&C!==+s&&(o={paddingRight:(0,u.Nn)(d)}),(0,t.Wm)("div",{key:a,ref:h(a),role:"radio",style:o,class:f("item"),tabindex:p?void 0:0,"aria-setsize":s,"aria-posinset":C,"aria-checked":!k,onClick:l=>{w();var a=S?W(l.clientX,l.clientY):C;e.clearable&&m.isTap.value&&a===e.modelValue&&(a=0),U(a)}},[(0,t.Wm)(v.JO,{size:r,name:V?n:c,class:f("icon",{disabled:p,full:V}),color:p?b:V?i:y,classPrefix:g},null),x&&(0,t.Wm)(v.JO,{size:r,style:{width:l.value+"em"},name:k?c:n,class:f("icon",["half",{disabled:p,full:!k}]),color:p?b:k?y:i,classPrefix:g},null)])};return(0,s.aM)(()=>e.modelValue),(0,s.OR)("touchmove",e=>{if(!g.value&&(m.move(e),m.isHorizontal()&&!m.isTap.value)){var{clientX:l,clientY:a}=e.touches[0];(0,i.PF)(e),U(W(l,a))}},{target:y}),()=>(0,t.Wm)("div",{ref:y,role:"radiogroup",class:f({readonly:e.readonly,disabled:e.disabled}),tabindex:e.disabled?void 0:0,"aria-disabled":e.disabled,"aria-readonly":e.readonly,onTouchstartPassive:k},[b.value.map(x)])}})},21083:function(e,l,a){"use strict";a("82116"),a("17989");var t=a("80681"),o=a("62568"),n=a("78335"),r=a("12308"),i=a("20897"),u=a("96528"),s=a("97760"),d=a("95786"),[c,v]=(0,o.do)("toast"),m=["show","overlay","teleport","transition","overlayClass","overlayStyle","closeOnClickOverlay","zIndex"],f={icon:String,show:Boolean,type:(0,n.SQ)("text"),overlay:Boolean,message:n.Or,iconSize:n.Or,duration:(0,n.qM)(2e3),position:(0,n.SQ)("middle"),teleport:[String,Object],wordBreak:String,className:n.Vg,iconPrefix:String,transition:(0,n.SQ)("van-fade"),loadingType:String,forbidClick:Boolean,overlayClass:n.Vg,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean,zIndex:n.Or};l.Z=(0,t.aZ)({name:c,props:f,emits:["update:show"],setup(e,l){var a,{emit:o,slots:n}=l,c=!1,f=()=>{var l=e.show&&e.forbidClick;c!==l&&(c=l,(0,i.G)(c))},p=e=>o("update:show",e),h=()=>{e.closeOnClick&&p(!1)},y=()=>clearTimeout(a),S=()=>{var{icon:l,type:a,iconSize:o,iconPrefix:n,loadingType:r}=e;return l||"success"===a||"fail"===a?(0,t.Wm)(u.JO,{name:l||a,size:o,class:v("icon"),classPrefix:n},null):"loading"===a?(0,t.Wm)(d.gb,{class:v("loading"),size:o,type:r},null):void 0},g=()=>{var{type:l,message:a}=e;return n.message?(0,t.Wm)("div",{class:v("text")},[n.message()]):(0,r.Xq)(a)&&""!==a?"html"===l?(0,t.Wm)("div",{key:0,class:v("text"),innerHTML:String(a)},null):(0,t.Wm)("div",{class:v("text")},[a]):void 0};return(0,t.YP)(()=>[e.show,e.forbidClick],f),(0,t.YP)(()=>[e.show,e.type,e.message,e.duration],()=>{y(),e.show&&e.duration>0&&(a=setTimeout(()=>{p(!1)},e.duration))}),(0,t.bv)(f),(0,t.Ah)(f),()=>(0,t.Wm)(s.GI,(0,t.dG)({class:[v([e.position,"normal"===e.wordBreak?"break-normal":e.wordBreak,{[e.type]:!e.icon}]),e.className],lockScroll:!1,onClick:h,onClosed:y,"onUpdate:show":p},(0,r.ei)(e,m)),{default:()=>[S(),g()]})}})},13118:function(e,l,a){"use strict";a.d(l,{CF:function(){return v},LJ:function(){return h},XA:function(){return p},di:function(){return f},yg:function(){return y}}),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 t=a("80681"),o=a("11848"),n=a("12308"),r=a("84285"),i=a("21083"),u=[],s=(0,n.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}),d=new Map;function c(e){return(0,n.Kn)(e)?e:{message:e}}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!n._f)return{};var l=function(){if(!u.length){var e=function(){var{instance:e,unmount:l}=(0,r.H)({setup(){var e=(0,o.iH)(""),{open:l,state:a,close:n,toggle:u}=(0,r.o)(),s=()=>{};return(0,t.YP)(e,e=>{a.message=e}),(0,t.FN)().render=()=>(0,t.Wm)(i.Z,(0,t.dG)(a,{onClosed:s,"onUpdate:show":u}),null),{open:l,close:n,message:e}}});return e}();u.push(e)}return u[u.length-1]}(),a=c(e);return l.open((0,n.l7)({},s,d.get(a.type||s.type),a)),l}var m=e=>l=>v((0,n.l7)({type:e},c(l))),f=m("loading"),p=m("success"),h=m("fail"),y=e=>{if(u.length){if(e)u.forEach(e=>{e.close()}),u=[];else{var l;u[0].close()}}}},68217:function(e,l,a){"use strict";a.r(e.exports={})},41623:function(e,l,a){"use strict";a.r(e.exports={})}}]); |