mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
/*! For license information please see 970.5c772cb3.js.LICENSE.txt */
|
|
(self.webpackChunk=self.webpackChunk||[]).push([["970"],{1875:function(e,l,t){"use strict";t.r(l);let n=t("31636").Z;l.default=n},31636:function(e,l,t){"use strict";t("40944");var n=t("80681"),a=t("11848"),i=t("99742"),o=t("16977"),r=t("54369"),u=t("13118");l.Z=(0,n.aZ)({__name:"index",setup(e){var l=(0,r.q)({"zh-CN":{step:"\u6B65\u957F\u8BBE\u7F6E",range:"\u9650\u5236\u8F93\u5165\u8303\u56F4",integer:"\u9650\u5236\u8F93\u5165\u6574\u6570",roundTheme:"\u5706\u89D2\u98CE\u683C",customSize:"\u81EA\u5B9A\u4E49\u5927\u5C0F",beforeChange:"\u5F02\u6B65\u53D8\u66F4",disableInput:"\u7981\u7528\u8F93\u5165\u6846",decimalLength:"\u56FA\u5B9A\u5C0F\u6570\u4F4D\u6570"},"en-US":{step:"Step",range:"Range",integer:"Integer",roundTheme:"Round Theme",customSize:"Custom Size",beforeChange:"Before Change",disableInput:"Disable Input",decimalLength:"Decimal Length"}}),t=(0,a.iH)(1),s=(0,a.iH)(1),d=(0,a.iH)(1),c=(0,a.iH)(1),v=(0,a.iH)(1),m=(0,a.iH)(1),p=(0,a.iH)(1),g=(0,a.iH)(1),f=(0,a.iH)(1),b=(0,a.iH)(1),S=()=>((0,u.di)({forbidClick:!0}),new Promise(e=>{setTimeout(()=>{(0,u.yg)(),e(!0)},500)}));return(e,r)=>{var u=(0,n.up)("demo-block");return(0,n.wg)(),(0,n.j4)(u,{card:""},{default:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("basicUsage")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:t.value,"onUpdate:modelValue":r[0]||(r[0]=e=>t.value=e)},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("step")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:s.value,"onUpdate:modelValue":r[1]||(r[1]=e=>s.value=e),step:"2"},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("range")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:d.value,"onUpdate:modelValue":r[2]||(r[2]=e=>d.value=e),min:5,max:8},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("integer")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:c.value,"onUpdate:modelValue":r[3]||(r[3]=e=>c.value=e),integer:""},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("disabled")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:v.value,"onUpdate:modelValue":r[4]||(r[4]=e=>v.value=e),disabled:""},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("disableInput")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:b.value,"onUpdate:modelValue":r[5]||(r[5]=e=>b.value=e),"disable-input":""},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("decimalLength")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:g.value,"onUpdate:modelValue":r[6]||(r[6]=e=>g.value=e),"decimal-length":1,step:"0.2"},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("customSize")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:p.value,"onUpdate:modelValue":r[7]||(r[7]=e=>p.value=e),"button-size":"32px","input-width":"40px"},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("beforeChange")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:m.value,"onUpdate:modelValue":r[8]||(r[8]=e=>m.value=e),"before-change":S},null,8,["modelValue"])]),_:1},8,["title"]),(0,n.Wm)((0,a.SU)(i.ZP),{center:"",title:(0,a.SU)(l)("roundTheme")},{value:(0,n.w5)(()=>[(0,n.Wm)((0,a.SU)(o.ZP),{modelValue:f.value,"onUpdate:modelValue":r[9]||(r[9]=e=>f.value=e),theme:"round","button-size":"22","disable-input":""},null,8,["modelValue"])]),_:1},8,["title"])]),_:1})}}})},99742:function(e,l,t){"use strict";t.d(l,{bL:function(){return i}});var n=t("63112"),a=t("54499"),i=(0,n.n)(a.ZP);l.ZP=i},6149:function(e,l,t){"use strict";t.d(l,{BC:function(){return i},g2:function(){return a},yj:function(){return o}}),t("56115"),t("59644");var n=t("80681"),a={to:[String,Object],url:String,replace:Boolean};function i(e){var{to:l,url:t,replace:n,$router:a}=e;l&&a?a[n?"replace":"push"](l):t&&(n?location.replace(t):location.href=t)}function o(){var e=(0,n.FN)().proxy;return()=>i(e)}},95786:function(e,l,t){"use strict";t.d(l,{gb:function(){return i}});var n=t("63112"),a=t("2309"),i=(0,n.n)(a.Z);l.ZP=i},16977:function(e,l,t){"use strict";var n=t("63112"),a=t("41468"),i=(0,n.n)(a.Z);l.ZP=i},20897:function(e,l,t){"use strict";t.d(l,{G:function(){return a}});var n=0;function a(e){e?(!n&&document.body.classList.add("van-toast--unclickable"),n++):n&&!--n&&document.body.classList.remove("van-toast--unclickable")}},84285:function(e,l,t){"use strict";t.d(l,{H:function(){return u},o:function(){return r}});var n=t("11848"),a=t("39594"),i=t("12308"),o=t("10023");function r(){var e=(0,n.qj)({show:!1}),l=l=>{e.show=l},t=t=>{(0,i.l7)(e,t,{transitionAppear:!0}),l(!0)},a=()=>l(!1);return(0,o.F)({open:t,close:a,toggle:l}),{open:t,close:a,state:e,toggle:l}}function u(e){var l=(0,a.ri)(e),t=document.createElement("div");return document.body.appendChild(t),{instance:l.mount(t),unmount(){l.unmount(),document.body.removeChild(t)}}}},54499:function(e,l,t){"use strict";t.d(l,{x_:function(){return c}}),t("82116"),t("17989");var n=t("80681"),a=t("62568"),i=t("78335"),o=t("12308"),r=t("6149"),u=t("96528"),[s,d]=(0,a.do)("cell"),c={tag:(0,i.SQ)("div"),icon:String,size:String,title:i.Or,value:i.Or,label:i.Or,center:Boolean,isLink:Boolean,border:i.J5,iconPrefix:String,valueClass:i.Vg,labelClass:i.Vg,titleClass:i.Vg,titleStyle:null,arrowDirection:String,required:{type:[Boolean,String],default:null},clickable:{type:Boolean,default:null}},v=(0,o.l7)({},c,r.g2);l.ZP=(0,n.aZ)({name:s,props:v,setup(e,l){var{slots:t}=l,a=(0,r.yj)(),i=()=>{if(t.label||(0,o.Xq)(e.label))return(0,n.Wm)("div",{class:[d("label"),e.labelClass]},[t.label?t.label():e.label])},s=()=>{if(t.title||(0,o.Xq)(e.title)){var l,a=null===(l=t.title)||void 0===l?void 0:l.call(t);if(!Array.isArray(a)||0!==a.length)return(0,n.Wm)("div",{class:[d("title"),e.titleClass],style:e.titleStyle},[a||(0,n.Wm)("span",null,[e.title]),i()])}},c=()=>{var l=t.value||t.default;if(l||(0,o.Xq)(e.value))return(0,n.Wm)("div",{class:[d("value"),e.valueClass]},[l?l():(0,n.Wm)("span",null,[e.value])])},v=()=>t.icon?t.icon():e.icon?(0,n.Wm)(u.JO,{name:e.icon,class:d("left-icon"),classPrefix:e.iconPrefix},null):void 0,m=()=>{if(t["right-icon"])return t["right-icon"]();if(e.isLink){var l=e.arrowDirection&&"right"!==e.arrowDirection?"arrow-".concat(e.arrowDirection):"arrow";return(0,n.Wm)(u.JO,{name:l,class:d("right-icon")},null)}};return()=>{var l,{tag:i,size:o,center:r,border:u,isLink:p,required:g}=e,f=null!==(l=e.clickable)&&void 0!==l?l:p,b={center:r,required:!!g,clickable:f,borderless:!u};return o&&(b[o]=!!o),(0,n.Wm)(i,{class:d(b),role:f?"button":void 0,tabindex:f?0:void 0,onClick:a},{default:()=>{var e;return[v(),s(),c(),m(),null===(e=t.extra)||void 0===e?void 0:e.call(t)]}})}}})},2309:function(e,l,t){"use strict";t("82116"),t("17989"),t("66786"),t("14529");var n=t("80681"),a=t("62568"),i=t("78335"),o=t("12308"),r=t("20358"),[u,s]=(0,a.do)("loading"),d=Array(12).fill(null).map((e,l)=>(0,n.Wm)("i",{class:s("line",String(l+1))},null)),c=(0,n.Wm)("svg",{class:s("circular"),viewBox:"25 25 50 50"},[(0,n.Wm)("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),v={size:i.Or,type:(0,i.SQ)("circular"),color:String,vertical:Boolean,textSize:i.Or,textColor:String};l.Z=(0,n.aZ)({name:u,props:v,setup(e,l){var{slots:t}=l,a=(0,n.Fl)(()=>(0,o.l7)({color:e.color},(0,r.Xn)(e.size))),i=()=>{var l="spinner"===e.type?d:c;return(0,n.Wm)("span",{class:s("spinner",e.type),style:a.value},[t.icon?t.icon():l])},u=()=>{if(t.default){var l;return(0,n.Wm)("span",{class:s("text"),style:{fontSize:(0,r.Nn)(e.textSize),color:null!==(l=e.textColor)&&void 0!==l?l:e.color}},[t.default()])}};return()=>{var{type:l,vertical:t}=e;return(0,n.Wm)("div",{class:s([l,{vertical:t}]),"aria-live":"polite","aria-busy":!0},[i(),u()])}}})},41468:function(e,l,t){"use strict";t("82116"),t("17989"),t("24660"),t("89176"),t("59644");var n=t("80681"),a=t("39594"),i=t("11848"),o=t("62568"),r=t("78335"),u=t("20358"),s=t("12308"),d=t("55987"),c=t("82210"),v=t("8051"),m=t("22300"),[p,g]=(0,o.do)("stepper"),f=(e,l)=>String(e)===String(l),b={min:(0,r.SI)(1),max:(0,r.SI)(1/0),name:(0,r.SI)(""),step:(0,r.SI)(1),theme:String,integer:Boolean,disabled:Boolean,showPlus:r.J5,showMinus:r.J5,showInput:r.J5,longPress:r.J5,autoFixed:r.J5,allowEmpty:Boolean,modelValue:r.Or,inputWidth:r.Or,buttonSize:r.Or,placeholder:String,disablePlus:Boolean,disableMinus:Boolean,disableInput:Boolean,beforeChange:Function,defaultValue:(0,r.SI)(1),decimalLength:r.Or};l.Z=(0,n.aZ)({name:p,props:b,emits:["plus","blur","minus","focus","change","overlimit","update:modelValue"],setup(e,l){var t,o,r,p,b,{emit:S}=l,h=function(l){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],{min:n,max:a,allowEmpty:i,decimalLength:o}=e;return i&&""===l?l:(l=Number.isNaN(l=""===(l=(0,u.uf)(String(l),!e.integer))?0:+l)?+n:l,l=t?Math.max(Math.min(+a,l),+n):l,(0,s.Xq)(o)&&(l=l.toFixed(+o)),l)},y=(0,i.iH)();var w=(0,i.iH)((!f(o=h(null!==(t=e.modelValue)&&void 0!==t?t:e.defaultValue),e.modelValue)&&S("update:modelValue",o),o)),P=(0,n.Fl)(()=>e.disabled||e.disableMinus||+w.value<=+e.min),W=(0,n.Fl)(()=>e.disabled||e.disablePlus||+w.value>=+e.max),V=(0,n.Fl)(()=>({width:(0,u.Nn)(e.inputWidth),height:(0,u.Nn)(e.buttonSize)})),C=(0,n.Fl)(()=>(0,u.Xn)(e.buttonSize)),U=l=>{e.beforeChange?(0,d.I)(e.beforeChange,{args:[l],done(){w.value=l}}):w.value=l},x=()=>{if("plus"===r&&W.value||"minus"===r&&P.value){S("overlimit",r);return}var l="minus"===r?-e.step:+e.step;U(h((0,u.Ft)(+w.value,l))),S(r)},Z=l=>{var t=l.target,{value:n}=t,{decimalLength:a}=e,i=(0,u.uf)(String(n),!e.integer);if((0,s.Xq)(a)&&i.includes(".")){var o=i.split(".");i="".concat(o[0],".").concat(o[1].slice(0,+a))}e.beforeChange?t.value=String(w.value):!f(n,i)&&(t.value=i),U(i===String(+i)?+i:i)},k=l=>{if(e.disableInput){var t;null===(t=y.value)||void 0===t||t.blur()}else S("focus",l)},O=l=>{var t=l.target,a=h(t.value,e.autoFixed);t.value=String(a),w.value=a,(0,n.Y3)(()=>{S("blur",l),(0,c.pe)()})},B=()=>{b=setTimeout(()=>{x(),B()},200)},z=()=>{e.longPress&&(p=!1,clearTimeout(b),b=setTimeout(()=>{p=!0,x(),B()},v.Cp))},F=l=>{e.longPress&&(clearTimeout(b),p&&(0,c.PF)(l))},I=l=>{e.disableInput&&(0,c.PF)(l)},T=e=>({onClick:l=>{(0,c.PF)(l),r=e,x()},onTouchstartPassive:()=>{r=e,z()},onTouchend:F,onTouchcancel:F});return(0,n.YP)(()=>[e.max,e.min,e.integer,e.decimalLength],()=>{var e=h(w.value);!f(e,w.value)&&(w.value=e)}),(0,n.YP)(()=>e.modelValue,e=>{!f(e,w.value)&&(w.value=h(e))}),(0,n.YP)(w,l=>{S("update:modelValue",l),S("change",l,{name:e.name})}),(0,m.aM)(()=>e.modelValue),()=>(0,n.Wm)("div",{role:"group",class:g([e.theme])},[(0,n.wy)((0,n.Wm)("button",(0,n.dG)({type:"button",style:C.value,class:[g("minus",{disabled:P.value}),{[v.e9]:!P.value}],"aria-disabled":P.value||void 0},T("minus")),null),[[a.F8,e.showMinus]]),(0,n.wy)((0,n.Wm)("input",{ref:y,type:e.integer?"tel":"text",role:"spinbutton",class:g("input"),value:w.value,style:V.value,disabled:e.disabled,readonly:e.disableInput,inputmode:e.integer?"numeric":"decimal",placeholder:e.placeholder,"aria-valuemax":e.max,"aria-valuemin":e.min,"aria-valuenow":w.value,onBlur:O,onInput:Z,onFocus:k,onMousedown:I},null),[[a.F8,e.showInput]]),(0,n.wy)((0,n.Wm)("button",(0,n.dG)({type:"button",style:C.value,class:[g("plus",{disabled:W.value}),{[v.e9]:!W.value}],"aria-disabled":W.value||void 0},T("plus")),null),[[a.F8,e.showPlus]])])}})},21083:function(e,l,t){"use strict";t("82116"),t("17989");var n=t("80681"),a=t("62568"),i=t("78335"),o=t("12308"),r=t("20897"),u=t("96528"),s=t("97760"),d=t("95786"),[c,v]=(0,a.do)("toast"),m=["show","overlay","teleport","transition","overlayClass","overlayStyle","closeOnClickOverlay","zIndex"],p={icon:String,show:Boolean,type:(0,i.SQ)("text"),overlay:Boolean,message:i.Or,iconSize:i.Or,duration:(0,i.qM)(2e3),position:(0,i.SQ)("middle"),teleport:[String,Object],wordBreak:String,className:i.Vg,iconPrefix:String,transition:(0,i.SQ)("van-fade"),loadingType:String,forbidClick:Boolean,overlayClass:i.Vg,overlayStyle:Object,closeOnClick:Boolean,closeOnClickOverlay:Boolean,zIndex:i.Or};l.Z=(0,n.aZ)({name:c,props:p,emits:["update:show"],setup(e,l){var t,{emit:a,slots:i}=l,c=!1,p=()=>{var l=e.show&&e.forbidClick;c!==l&&(c=l,(0,r.G)(c))},g=e=>a("update:show",e),f=()=>{e.closeOnClick&&g(!1)},b=()=>clearTimeout(t),S=()=>{var{icon:l,type:t,iconSize:a,iconPrefix:i,loadingType:o}=e;return l||"success"===t||"fail"===t?(0,n.Wm)(u.JO,{name:l||t,size:a,class:v("icon"),classPrefix:i},null):"loading"===t?(0,n.Wm)(d.gb,{class:v("loading"),size:a,type:o},null):void 0},h=()=>{var{type:l,message:t}=e;return i.message?(0,n.Wm)("div",{class:v("text")},[i.message()]):(0,o.Xq)(t)&&""!==t?"html"===l?(0,n.Wm)("div",{key:0,class:v("text"),innerHTML:String(t)},null):(0,n.Wm)("div",{class:v("text")},[t]):void 0};return(0,n.YP)(()=>[e.show,e.forbidClick],p),(0,n.YP)(()=>[e.show,e.type,e.message,e.duration],()=>{b(),e.show&&e.duration>0&&(t=setTimeout(()=>{g(!1)},e.duration))}),(0,n.bv)(p),(0,n.Ah)(p),()=>(0,n.Wm)(s.GI,(0,n.dG)({class:[v([e.position,"normal"===e.wordBreak?"break-normal":e.wordBreak,{[e.type]:!e.icon}]),e.className],lockScroll:!1,onClick:f,onClosed:b,"onUpdate:show":g},(0,o.ei)(e,m)),{default:()=>[S(),h()]})}})},13118:function(e,l,t){"use strict";t.d(l,{CF:function(){return v},LJ:function(){return f},XA:function(){return g},di:function(){return p},yg:function(){return b}}),t("24836"),t("41712"),t("80855"),t("10502"),t("7978"),t("66746"),t("17530"),t("87604"),t("57024"),t("22175"),t("85322"),t("47897"),t("48943"),t("43356"),t("82116"),t("17989"),t("96245"),t("37232"),t("70629"),t("61557"),t("31564"),t("8649");var n=t("80681"),a=t("11848"),i=t("12308"),o=t("84285"),r=t("21083"),u=[],s=(0,i.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,i.Kn)(e)?e:{message:e}}function v(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!i._f)return{};var l=function(){if(!u.length){var e=function(){var{instance:e,unmount:l}=(0,o.H)({setup(){var e=(0,a.iH)(""),{open:l,state:t,close:i,toggle:u}=(0,o.o)(),s=()=>{};return(0,n.YP)(e,e=>{t.message=e}),(0,n.FN)().render=()=>(0,n.Wm)(r.Z,(0,n.dG)(t,{onClosed:s,"onUpdate:show":u}),null),{open:l,close:i,message:e}}});return e}();u.push(e)}return u[u.length-1]}(),t=c(e);return l.open((0,i.l7)({},s,d.get(t.type||s.type),t)),l}var m=e=>l=>v((0,i.l7)({type:e},c(l))),p=m("loading"),g=m("success"),f=m("fail"),b=e=>{if(u.length){if(e)u.forEach(e=>{e.close()}),u=[];else{var l;u[0].close()}}}}}]); |