vant/static/js/async/4667.bab5d1c8.js
2024-04-20 08:49:23 +00:00

2 lines
16 KiB
JavaScript

/*! For license information please see 4667.bab5d1c8.js.LICENSE.txt */
(self.webpackChunk=self.webpackChunk||[]).push([["4667"],{99497:function(e,t,a){"use strict";a.d(t,{zx:function(){return n}});var r=a("63112"),l=a("14314"),n=(0,r.n)(l.Z);t.ZP=n},11136:function(e,t,a){"use strict";var r=a("63112"),l=a("12553"),n=(0,r.n)(l.Z);t.ZP=n},31045:function(e,t,a){"use strict";a.d(t,{BC:function(){return i},Gl:function(){return g},KK:function(){return v},L1:function(){return c},PH:function(){return l},ao:function(){return f},kB:function(){return d},ky:function(){return s},l3:function(){return o},rP:function(){return u},t:function(){return n},u2:function(){return r},x2:function(){return m}}),a("82116"),a("17989"),a("66786"),a("14529");var[r,l,n]=(0,a("62568").do)("calendar"),i=e=>n("monthTitle",e.getFullYear(),e.getMonth()+1);function o(e,t){var a=e.getFullYear(),r=t.getFullYear();if(a===r){var l=e.getMonth(),n=t.getMonth();return l===n?0:l>n?1:-1}return a>r?1:-1}function u(e,t){var a=o(e,t);if(0===a){var r=e.getDate(),l=t.getDate();return r===l?0:r>l?1:-1}return a}var s=e=>new Date(e),c=e=>Array.isArray(e)?e.map(s):s(e);function d(e,t){var a=s(e);return a.setDate(a.getDate()+t),a}var v=e=>d(e,-1),f=e=>d(e,1),m=()=>{var e=new Date;return e.setHours(0,0,0,0),e};function g(e){var t=e[0].getTime();return(e[1].getTime()-t)/864e5+1}},55944:function(e,t,a){"use strict";a.d(t,{F:function(){return u}});var r=a("22300"),l=a("11848"),n=a("80681"),i=a("82210"),o=a("65170"),u=(e,t)=>{var a=(0,l.iH)(),u=()=>{a.value=(0,r.EL)(e).height};return(0,n.bv)(()=>{if((0,n.Y3)(u),t)for(var e=1;e<=3;e++)setTimeout(u,100*e)}),(0,o.h)(()=>(0,n.Y3)(u)),(0,n.YP)([i.bn,i.uK],u),a}},92855:function(e,t,a){"use strict";a.d(t,{En:function(){return o},K:function(){return c},re:function(){return d},uT:function(){return u},yn:function(){return s}}),a("66786"),a("14529");var r=a("12308"),l=a("78335"),n=a("20358"),i=a("36809"),o=(0,r.l7)({},i.d4,{modelValue:(0,l.Ce)(),filter:Function,formatter:{type:Function,default:(e,t)=>t}}),u=Object.keys(i.d4),s=(e,t)=>32-new Date(e,t-1,32).getDate(),c=(e,t,a,r,l,i)=>{var o=function(e,t){if(e<0)return[];for(var a=Array(e),r=-1;++r<e;)a[r]=t(r);return a}(t-e+1,t=>{var l=(0,n.Bd)(e+t);return r(a,{text:l,value:l})});return l?l(a,o,i):o},d=(e,t)=>e.map((e,a)=>{var r=t[a];if(r.length){var l=+r[0].value,i=+r[r.length-1].value;return(0,n.Bd)((0,n.uZ)(+e,l,i))}return e})},14314:function(e,t,a){"use strict";a("82116"),a("17989"),a("24660");var r=a("80681"),l=a("62568"),n=a("12308"),i=a("78335"),o=a("82210"),u=a("8051"),s=a("6149"),c=a("96528"),d=a("95786"),[v,f]=(0,l.do)("button"),m=(0,n.l7)({},s.g2,{tag:(0,i.SQ)("button"),text:String,icon:String,type:(0,i.SQ)("default"),size:(0,i.SQ)("normal"),color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,nativeType:(0,i.SQ)("button"),loadingSize:i.Or,loadingText:String,loadingType:String,iconPosition:(0,i.SQ)("left")});t.Z=(0,r.aZ)({name:v,props:m,emits:["click"],setup(e,t){var{emit:a,slots:l}=t,n=(0,s.yj)(),i=()=>l.loading?l.loading():(0,r.Wm)(d.gb,{size:e.loadingSize,type:e.loadingType,class:f("loading")},null),v=()=>e.loading?i():l.icon?(0,r.Wm)("div",{class:f("icon")},[l.icon()]):e.icon?(0,r.Wm)(c.JO,{name:e.icon,class:f("icon"),classPrefix:e.iconPrefix},null):void 0,m=()=>{var t;if(t=e.loading?e.loadingText:l.default?l.default():e.text)return(0,r.Wm)("span",{class:f("text")},[t])},g=()=>{var{color:t,plain:a}=e;if(t){var r={color:a?t:"white"};return!a&&(r.background=t),t.includes("gradient")?r.border=0:r.borderColor=t,r}},h=t=>{e.loading?(0,o.PF)(t):!e.disabled&&(a("click",t),n())};return()=>{var{tag:t,type:a,size:l,block:n,round:i,plain:o,square:s,loading:c,disabled:d,hairline:p,nativeType:y,iconPosition:b}=e,D=[f([a,l,{plain:o,block:n,round:i,square:s,loading:c,disabled:d,hairline:p}]),{[u._K]:p}];return(0,r.Wm)(t,{type:y,class:D,style:g(),disabled:d,onClick:h},{default:()=>[(0,r.Wm)("div",{class:f("content")},["left"===b&&v(),m(),"right"===b&&v()])]})}}})},12553:function(e,t,a){"use strict";a("66786"),a("14529"),a("82116"),a("17989"),a("61557"),a("21690"),a("29256"),a("36056"),a("70629"),a("31564"),a("8649"),a("63773"),a("97687"),a("57856"),a("31053");var r=a("80681"),l=a("11848"),n=a("78335"),i=a("12308"),o=a("82210"),u=a("31045"),s=a("22300"),c=a("89923"),d=a("10023"),v=a("97760"),f=a("99497"),m=a("13118"),g=a("19315"),h=a("83295"),p={show:Boolean,type:(0,n.SQ)("single"),title:String,color:String,round:n.J5,readonly:Boolean,poppable:n.J5,maxRange:(0,n.SI)(null),position:(0,n.SQ)("bottom"),teleport:[String,Object],showMark:n.J5,showTitle:n.J5,formatter:Function,rowHeight:n.Or,confirmText:String,rangePrompt:String,lazyRender:n.J5,showConfirm:n.J5,defaultDate:[Date,Array],allowSameDay:Boolean,showSubtitle:n.J5,closeOnPopstate:n.J5,showRangePrompt:n.J5,confirmDisabledText:String,closeOnClickOverlay:n.J5,safeAreaInsetTop:Boolean,safeAreaInsetBottom:n.J5,minDate:{type:Date,validator:i.J_,default:u.x2},maxDate:{type:Date,validator:i.J_,default:()=>{var e=(0,u.x2)();return new Date(e.getFullYear(),e.getMonth()+6,e.getDate())}},firstDayOfWeek:{type:n.Or,default:0,validator:e=>e>=0&&e<=6}};t.Z=(0,r.aZ)({name:u.u2,props:p,emits:["select","confirm","unselect","monthShow","overRange","update:show","clickSubtitle","clickDisabledDate"],setup(e,t){var a,{emit:n,slots:p}=t,y=function(t){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.minDate,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.maxDate;return -1===(0,u.rP)(t,a)?a:1===(0,u.rP)(t,r)?r:t},b=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.defaultDate,{type:a,minDate:r,maxDate:l,allowSameDay:n}=e;if(null===t)return t;var i=(0,u.x2)();if("range"===a)return!Array.isArray(t)&&(t=[]),[y(t[0]||i,r,n?l:(0,u.KK)(l)),y(t[1]||i,n?r:(0,u.ao)(r))];if("multiple"===a)return Array.isArray(t)?t.map(e=>y(e)):[y(i)];return(!t||Array.isArray(t))&&(t=i),y(t)},D=(0,l.iH)(),w=(0,l.iH)({textFn:()=>"",date:void 0}),k=(0,l.iH)(b()),[P,S]=(0,c.v)(),x=(0,r.Fl)(()=>e.firstDayOfWeek?+e.firstDayOfWeek%7:0),W=(0,r.Fl)(()=>{var t=[],a=new Date(e.minDate);a.setDate(1);do t.push(new Date(a)),a.setMonth(a.getMonth()+1);while(1!==(0,u.l3)(a,e.maxDate));return t}),H=(0,r.Fl)(()=>{if(k.value){if("range"===e.type)return!k.value[0]||!k.value[1];if("multiple"===e.type)return!k.value.length}return!k.value}),T=()=>{var e,t=(0,o.cx)(D.value),r=t+a,l=W.value.map((e,t)=>P.value[t].getHeight());if(!(r>l.reduce((e,t)=>e+t,0))||!(t>0)){for(var i=0,u=[-1,-1],s=0;s<W.value.length;s++){var c=P.value[s];i<=r&&i+l[s]>=t&&(u[1]=s,!e&&(e=c,u[0]=s),!P.value[s].showed&&(P.value[s].showed=!0,n("monthShow",{date:c.date,title:c.getTitle()}))),i+=l[s]}W.value.forEach((e,t)=>{var a=t>=u[0]-1&&t<=u[1]+1;P.value[t].setVisible(a)}),e&&(w.value={textFn:e.getTitle,date:e.date})}},F=e=>{(0,s.Wn)(()=>{W.value.some((t,a)=>0===(0,u.l3)(t,e)&&(D.value&&P.value[a].scrollToDate(D.value,e),!0)),T()})},B=()=>{if(!e.poppable||e.show){if(k.value){var t="single"===e.type?k.value:k.value[0];(0,i.J_)(t)&&F(t)}else(0,s.Wn)(T)}},O=()=>{(!e.poppable||e.show)&&((0,s.Wn)(()=>{a=Math.floor((0,s.EL)(D).height)}),B())},C=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b();k.value=e,B()},M=t=>{var{maxRange:a,rangePrompt:r,showRangePrompt:l}=e;return!(a&&(0,u.Gl)(t)>+a)||(l&&(0,m.CF)(r||(0,u.t)("rangePrompt",a)),n("overRange"),!1)},A=()=>{var e;return n("confirm",null!==(e=k.value)&&void 0!==e?e:(0,u.L1)(k.value))},Z=(t,a)=>{var r=e=>{k.value=e,n("select",(0,u.L1)(e))};if(a&&"range"===e.type&&!M(t)){r([t[0],(0,u.kB)(t[0],+e.maxRange-1)]);return}r(t),a&&!e.showConfirm&&A()},J=(e,t,a)=>{var r;return null===(r=e.find(e=>-1===(0,u.rP)(t,e.date)&&-1===(0,u.rP)(e.date,a)))||void 0===r?void 0:r.date},R=(0,r.Fl)(()=>P.value.reduce((e,t)=>{var a,r;return e.push(...null!==(r=null===(a=t.disabledDays)||void 0===a?void 0:a.value)&&void 0!==r?r:[]),e},[])),Y=t=>{if(!e.readonly&&t.date){var{date:a}=t,{type:r}=e;if("range"===r){if(!k.value){Z([a]);return}var[l,i]=k.value;if(l&&!i){var o=(0,u.rP)(a,l);if(1===o){var s=J(R.value,l,a);if(s){var c=(0,u.KK)(s);-1===(0,u.rP)(l,c)?Z([l,c]):Z([a])}else Z([l,a],!0)}else -1===o?Z([a]):e.allowSameDay&&Z([a,a],!0)}else Z([a])}else if("multiple"===r){if(!k.value){Z([a]);return}var d=k.value,v=d.findIndex(e=>0===(0,u.rP)(e,a));if(-1!==v){var[f]=d.splice(v,1);n("unselect",(0,u.ky)(f))}else e.maxRange&&d.length>=+e.maxRange?(0,m.CF)(e.rangePrompt||(0,u.t)("rangePrompt",e.maxRange)):Z([...d,a])}else Z(a,!0)}},K=e=>n("update:show",e),z=(t,a)=>{var l=0!==a||!e.showSubtitle;return(0,r.Wm)(g.Z,(0,r.dG)({ref:S(a),date:t,currentDate:k.value,showMonthTitle:l,firstDayOfWeek:x.value},(0,i.ei)(e,["type","color","minDate","maxDate","showMark","formatter","rowHeight","lazyRender","showSubtitle","allowSameDay"]),{onClick:Y,onClickDisabledDate:e=>n("clickDisabledDate",e)}),(0,i.ei)(p,["top-info","bottom-info","month-title"]))},I=()=>{if(p.footer)return p.footer();if(e.showConfirm){var t=p["confirm-text"],a=H.value,l=a?e.confirmDisabledText:e.confirmText;return(0,r.Wm)(f.zx,{round:!0,block:!0,type:"primary",color:e.color,class:(0,u.PH)("confirm"),disabled:a,nativeType:"button",onClick:A},{default:()=>[t?t({disabled:a}):l||(0,u.t)("confirm")]})}},L=()=>(0,r.Wm)("div",{class:[(0,u.PH)("footer"),{"van-safe-area-bottom":e.safeAreaInsetBottom}]},[I()]),Q=()=>{var t=w.value.textFn();return(0,r.Wm)("div",{class:(0,u.PH)()},[(0,r.Wm)(h.Z,{date:w.value.date,title:e.title,subtitle:t,showTitle:e.showTitle,showSubtitle:e.showSubtitle,firstDayOfWeek:x.value,onClickSubtitle:e=>n("clickSubtitle",e)},(0,i.ei)(p,["title","subtitle"])),(0,r.Wm)("div",{ref:D,class:(0,u.PH)("body"),onScroll:T},[W.value.map(z)]),L()])};return(0,r.YP)(()=>e.show,O),(0,r.YP)(()=>[e.type,e.minDate,e.maxDate],()=>C(b(k.value))),(0,r.YP)(()=>e.defaultDate,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;k.value=e,B()}),(0,d.F)({reset:C,scrollToDate:F,getSelectedDate:()=>k.value}),(0,s.Ib)(O),()=>e.poppable?(0,r.Wm)(v.GI,{show:e.show,class:(0,u.PH)("popup"),round:e.round,position:e.position,closeable:e.showTitle||e.showSubtitle,teleport:e.teleport,closeOnPopstate:e.closeOnPopstate,safeAreaInsetTop:e.safeAreaInsetTop,closeOnClickOverlay:e.closeOnClickOverlay,"onUpdate:show":K},{default:Q}):Q()}})},844:function(e,t,a){"use strict";a("82116"),a("17989");var r=a("80681"),l=a("62568"),n=a("78335"),i=a("31045"),[o]=(0,l.do)("calendar-day");t.Z=(0,r.aZ)({name:o,props:{item:(0,n.ir)(Object),color:String,index:Number,offset:(0,n.qM)(0),rowHeight:String},emits:["click","clickDisabledDate"],setup(e,t){var{emit:a,slots:l}=t,n=(0,r.Fl)(()=>{var t,{item:a,index:r,color:l,offset:n,rowHeight:i}=e,o={height:i};if("placeholder"===a.type)return o.width="100%",o;if(0===r&&(o.marginLeft="".concat(100*n/7,"%")),l)switch(a.type){case"end":case"start":case"start-end":case"multiple-middle":case"multiple-selected":o.background=l;break;case"middle":o.color=l}return n+((null===(t=a.date)||void 0===t?void 0:t.getDate())||1)>28&&(o.marginBottom=0),o}),o=()=>{"disabled"!==e.item.type?a("click",e.item):a("clickDisabledDate",e.item)},u=()=>{var{topInfo:t}=e.item;if(t||l["top-info"])return(0,r.Wm)("div",{class:(0,i.PH)("top-info")},[l["top-info"]?l["top-info"](e.item):t])},s=()=>{var{bottomInfo:t}=e.item;if(t||l["bottom-info"])return(0,r.Wm)("div",{class:(0,i.PH)("bottom-info")},[l["bottom-info"]?l["bottom-info"](e.item):t])},c=()=>{var{item:t,color:a,rowHeight:l}=e,{type:n,text:o}=t,c=[u(),o,s()];return"selected"===n?(0,r.Wm)("div",{class:(0,i.PH)("selected-day"),style:{width:l,height:l,background:a}},[c]):c};return()=>{var{type:t,className:a}=e.item;return"placeholder"===t?(0,r.Wm)("div",{class:(0,i.PH)("day"),style:n.value},null):(0,r.Wm)("div",{role:"gridcell",style:n.value,class:[(0,i.PH)("day",t),a],tabindex:"disabled"===t?void 0:-1,onClick:o},[c()])}}})},83295:function(e,t,a){"use strict";a("82116"),a("17989"),a("66786"),a("14529");var r=a("80681"),l=a("62568"),n=a("31045"),[i]=(0,l.do)("calendar-header");t.Z=(0,r.aZ)({name:i,props:{date:Date,title:String,subtitle:String,showTitle:Boolean,showSubtitle:Boolean,firstDayOfWeek:Number},emits:["clickSubtitle"],setup(e,t){var{slots:a,emit:l}=t,i=()=>{if(e.showTitle){var t=e.title||(0,n.t)("title"),l=a.title?a.title():t;return(0,r.Wm)("div",{class:(0,n.PH)("header-title")},[l])}},o=e=>l("clickSubtitle",e),u=()=>{if(e.showSubtitle){var t=a.subtitle?a.subtitle({date:e.date,text:e.subtitle}):e.subtitle;return(0,r.Wm)("div",{class:(0,n.PH)("header-subtitle"),onClick:o},[t])}},s=()=>{var{firstDayOfWeek:t}=e,a=(0,n.t)("weekdays"),l=[...a.slice(t,7),...a.slice(0,t)];return(0,r.Wm)("div",{class:(0,n.PH)("weekdays")},[l.map(e=>(0,r.Wm)("span",{class:(0,n.PH)("weekday")},[e]))])};return()=>(0,r.Wm)("div",{class:(0,n.PH)("header")},[i(),u(),s()])}})},19315:function(e,t,a){"use strict";a("82116"),a("17989"),a("63773"),a("97687"),a("70629"),a("61557"),a("96245"),a("37232"),a("66786"),a("14529");var r=a("80681"),l=a("11848"),n=a("62568"),i=a("78335"),o=a("20358"),u=a("82210"),s=a("12308"),c=a("92855"),d=a("31045"),v=a("22300"),f=a("10023"),m=a("55944"),g=a("844"),[h]=(0,n.do)("calendar-month"),p={date:(0,i.ir)(Date),type:String,color:String,minDate:(0,i.ir)(Date),maxDate:(0,i.ir)(Date),showMark:Boolean,rowHeight:i.Or,formatter:Function,lazyRender:Boolean,currentDate:[Date,Array],allowSameDay:Boolean,showSubtitle:Boolean,showMonthTitle:Boolean,firstDayOfWeek:Number};t.Z=(0,r.aZ)({name:h,props:p,emits:["click","clickDisabledDate"],setup(e,t){var{emit:a,slots:n}=t,[i,h]=(0,v.OT)(),p=(0,l.iH)(),y=(0,l.iH)(),b=(0,m.F)(y),D=(0,r.Fl)(()=>(0,d.BC)(e.date)),w=(0,r.Fl)(()=>(0,o.Nn)(e.rowHeight)),k=(0,r.Fl)(()=>{var t=e.date.getDay();return e.firstDayOfWeek?(t+7-e.firstDayOfWeek)%7:t}),P=(0,r.Fl)(()=>(0,c.yn)(e.date.getFullYear(),e.date.getMonth()+1)),S=(0,r.Fl)(()=>i.value||!e.lazyRender),x=t=>{var a=t=>e.currentDate.some(e=>0===(0,d.rP)(e,t));if(a(t)){var r=(0,d.KK)(t),l=(0,d.ao)(t),n=a(r),i=a(l);return n&&i?"multiple-middle":n?"end":i?"start":"multiple-selected"}return""},W=t=>{var[a,r]=e.currentDate;if(!a)return"";var l=(0,d.rP)(t,a);if(!r)return 0===l?"start":"";var n=(0,d.rP)(t,r);return e.allowSameDay&&0===l&&0===n?"start-end":0===l?"start":0===n?"end":l>0&&n<0?"middle":""},H=t=>{var{type:a,minDate:r,maxDate:l,currentDate:n}=e;if(0>(0,d.rP)(t,r)||(0,d.rP)(t,l)>0)return"disabled";if(null===n)return"";if(Array.isArray(n)){if("multiple"===a)return x(t);if("range"===a)return W(t)}else if("single"===a)return 0===(0,d.rP)(t,n)?"selected":"";return""},T=t=>{if("range"===e.type){if("start"===t||"end"===t)return(0,d.t)(t);if("start-end"===t)return"".concat((0,d.t)("start"),"/").concat((0,d.t)("end"))}},F=()=>{if(e.showMonthTitle)return(0,r.Wm)("div",{class:(0,d.PH)("month-title")},[n["month-title"]?n["month-title"]({date:e.date,text:D.value}):D.value])},B=()=>{if(e.showMark&&S.value)return(0,r.Wm)("div",{class:(0,d.PH)("month-mark")},[e.date.getMonth()+1])},O=(0,r.Fl)(()=>Array(Math.ceil((P.value+k.value)/7)).fill({type:"placeholder"})),C=(0,r.Fl)(()=>{for(var t=[],a=e.date.getFullYear(),r=e.date.getMonth(),l=1;l<=P.value;l++){var n=new Date(a,r,l),i=H(n),o={date:n,type:i,text:l,bottomInfo:T(i)};e.formatter&&(o=e.formatter(o)),t.push(o)}return t}),M=(0,r.Fl)(()=>C.value.filter(e=>"disabled"===e.type)),A=(t,l)=>(0,r.Wm)(g.Z,{item:t,index:l,color:e.color,offset:k.value,rowHeight:w.value,onClick:e=>a("click",e),onClickDisabledDate:e=>a("clickDisabledDate",e)},(0,s.ei)(n,["top-info","bottom-info"])),Z=()=>(0,r.Wm)("div",{ref:p,role:"grid",class:(0,d.PH)("days")},[B(),(S.value?C:O).value.map(A)]);return(0,f.F)({getTitle:()=>D.value,getHeight:()=>b.value,setVisible:h,scrollToDate:(e,t)=>{if(p.value){var a=(0,v.EL)(p.value),r=O.value.length,l=(Math.ceil((t.getDate()+k.value)/7)-1)*a.height/r;(0,u.QU)(e,a.top+l+e.scrollTop-(0,v.EL)(e).top)}},disabledDays:M}),()=>(0,r.Wm)("div",{class:(0,d.PH)("month"),ref:y},[F(),Z()])}})}}]);