index-legacy.6999285e.js 18 KB

1
  1. !function(){function e(e){return function(e){if(Array.isArray(e))return n(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||t(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,a){return function(e){if(Array.isArray(e))return e}(e)||function(e,a){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==t)return;var n,r,o=[],l=!0,i=!1;try{for(t=t.call(e);!(l=(n=t.next()).done)&&(o.push(n.value),!a||o.length!==a);l=!0);}catch(u){i=!0,r=u}finally{try{l||null==t.return||t.return()}finally{if(i)throw r}}return o}(e,a)||t(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e,a){if(e){if("string"==typeof e)return n(e,a);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?n(e,a):void 0}}function n(e,a){(null==a||a>e.length)&&(a=e.length);for(var t=0,n=new Array(a);t<a;t++)n[t]=e[t];return n}var r=document.createElement("style");r.innerHTML=':root{--van-calendar-background-color: var(--van-background-color-light);--van-calendar-popup-height: 80%;--van-calendar-header-box-shadow: 0 .05333rem .26667rem rgba(125, 126, 128, .16);--van-calendar-header-title-height: 1.17333rem;--van-calendar-header-title-font-size: var(--van-font-size-lg);--van-calendar-header-subtitle-font-size: var(--van-font-size-md);--van-calendar-weekdays-height: .8rem;--van-calendar-weekdays-font-size: var(--van-font-size-sm);--van-calendar-month-title-font-size: var(--van-font-size-md);--van-calendar-month-mark-color: rgba(242, 243, 245, .8);--van-calendar-month-mark-font-size: 4.26667rem;--van-calendar-day-height: 1.70667rem;--van-calendar-day-font-size: var(--van-font-size-lg);--van-calendar-range-edge-color: var(--van-white);--van-calendar-range-edge-background-color: var(--van-danger-color);--van-calendar-range-middle-color: var(--van-danger-color);--van-calendar-range-middle-background-opacity: .1;--van-calendar-selected-day-size: 1.44rem;--van-calendar-selected-day-color: var(--van-white);--van-calendar-info-font-size: var(--van-font-size-xs);--van-calendar-info-line-height: var(--van-line-height-xs);--van-calendar-selected-day-background-color: var(--van-danger-color);--van-calendar-day-disabled-color: var(--van-text-color-3);--van-calendar-confirm-button-height: .96rem;--van-calendar-confirm-button-margin: .18667rem 0}.van-calendar{display:flex;flex-direction:column;height:100%;background:var(--van-calendar-background-color)}.van-calendar__popup.van-popup--top,.van-calendar__popup.van-popup--bottom{height:var(--van-calendar-popup-height)}.van-calendar__popup.van-popup--left,.van-calendar__popup.van-popup--right{height:100%}.van-calendar__popup .van-popup__close-icon{top:.29333rem}.van-calendar__header{flex-shrink:0;box-shadow:var(--van-calendar-header-box-shadow)}.van-calendar__month-title,.van-calendar__header-title,.van-calendar__header-subtitle{height:var(--van-calendar-header-title-height);font-weight:var(--van-font-weight-bold);line-height:var(--van-calendar-header-title-height);text-align:center}.van-calendar__header-title{font-size:var(--van-calendar-header-title-font-size)}.van-calendar__header-subtitle{font-size:var(--van-calendar-header-subtitle-font-size)}.van-calendar__month-title{font-size:var(--van-calendar-month-title-font-size)}.van-calendar__weekdays{display:flex}.van-calendar__weekday{flex:1;font-size:var(--van-calendar-weekdays-font-size);line-height:var(--van-calendar-weekdays-height);text-align:center}.van-calendar__body{flex:1;overflow:auto;-webkit-overflow-scrolling:touch}.van-calendar__days{position:relative;display:flex;flex-wrap:wrap;-webkit-user-select:none;-moz-user-select:none;user-select:none}.van-calendar__month-mark{position:absolute;top:50%;left:50%;z-index:0;color:var(--van-calendar-month-mark-color);font-size:var(--van-calendar-month-mark-font-size);transform:translate(-50%,-50%);pointer-events:none}.van-calendar__day,.van-calendar__selected-day{display:flex;align-items:center;justify-content:center;text-align:center}.van-calendar__day{position:relative;width:14.285%;height:var(--van-calendar-day-height);font-size:var(--van-calendar-day-font-size);cursor:pointer}.van-calendar__day--end,.van-calendar__day--start,.van-calendar__day--start-end,.van-calendar__day--multiple-middle,.van-calendar__day--multiple-selected{color:var(--van-calendar-range-edge-color);background:var(--van-calendar-range-edge-background-color)}.van-calendar__day--start{border-radius:var(--van-border-radius-md) 0 0 var(--van-border-radius-md)}.van-calendar__day--end{border-radius:0 var(--van-border-radius-md) var(--van-border-radius-md) 0}.van-calendar__day--start-end,.van-calendar__day--multiple-selected{border-radius:var(--van-border-radius-md)}.van-calendar__day--middle{color:var(--van-calendar-range-middle-color)}.van-calendar__day--middle:after{position:absolute;top:0;right:0;bottom:0;left:0;background-color:currentColor;opacity:var(--van-calendar-range-middle-background-opacity);content:""}.van-calendar__day--disabled{color:var(--van-calendar-day-disabled-color);cursor:default}.van-calendar__top-info,.van-calendar__bottom-info{position:absolute;right:0;left:0;font-size:var(--van-calendar-info-font-size);line-height:var(--van-calendar-info-line-height)}@media (max-width: 350px){.van-calendar__top-info,.van-calendar__bottom-info{font-size:.24rem}}.van-calendar__top-info{top:.16rem}.van-calendar__bottom-info{bottom:.16rem}.van-calendar__selected-day{width:var(--van-calendar-selected-day-size);height:var(--van-calendar-selected-day-size);color:var(--van-calendar-selected-day-color);background:var(--van-calendar-selected-day-background-color);border-radius:var(--van-border-radius-md)}.van-calendar__footer{flex-shrink:0;padding-left:var(--van-padding-md);padding-right:var(--van-padding-md)}.van-calendar__confirm{height:var(--van-calendar-confirm-button-height);margin:var(--van-calendar-confirm-button-margin)}\n',document.head.appendChild(r),System.register(["./index-legacy.fba2875c.js","./use-refs-legacy.2affcb61.js","./utils-legacy.e8546185.js","./use-height-legacy.233a2ec8.js"],(function(t){"use strict";var n,r,o,l,i,u,c,d,s,v,f,h,m,p,g,y,b,w,_,k,D,x,z,S,T,A,O,M,C,B;return{setters:[function(e){n=e.A,r=e.d,o=e.aw,l=e.aZ,i=e.V,u=e.j,c=e.bf,d=e.S,s=e.a1,v=e.aj,f=e.E,h=e.X,m=e.au,p=e.aA,g=e.$,y=e.G,b=e.aa,w=e.b5,_=e.a2,k=e.a9,D=e.aR,x=e.at,z=e.ag,S=e.a7,T=e.T,A=e.B,O=e.N},function(e){M=e.u},function(e){C=e.g},function(e){B=e.u}],execute:function(){var I=a(n("calendar"),3),j=I[0],R=I[1],H=I[2];function P(e,a){var t=e.getFullYear(),n=a.getFullYear();if(t===n){var r=e.getMonth(),o=a.getMonth();return r===o?0:r>o?1:-1}return t>n?1:-1}function W(e,a){var t=P(e,a);if(0===t){var n=e.getDate(),r=a.getDate();return n===r?0:n>r?1:-1}return t}var F=function(e){return new Date(e)},Y=function(e){return Array.isArray(e)?e.map(F):F(e)};function E(e,a){var t=F(e);return t.setDate(t.getDate()+a),t}var N=function(e){return E(e,-1)},V=function(e){return E(e,1)},L=function(){var e=new Date;return e.setHours(0,0,0,0),e};var U=a(n("calendar-day"),1)[0],$=r({name:U,props:{item:o(Object),color:String,index:Number,offset:l(0),rowHeight:String},emits:["click"],setup:function(e,a){var t=a.emit,n=a.slots,r=i((function(){var a=e.item,t=e.index,n=e.color,r=e.offset,o={height:e.rowHeight};if("placeholder"===a.type)return o.width="100%",o;if(0===t&&(o.marginLeft="".concat(100*r/7,"%")),n)switch(a.type){case"end":case"start":case"start-end":case"multiple-middle":case"multiple-selected":o.background=n;break;case"middle":o.color=n}return o})),o=function(){"disabled"!==e.item.type&&t("click",e.item)},l=function(){var a=e.item.topInfo;if(a||n["top-info"])return u("div",{class:R("top-info")},[n["top-info"]?n["top-info"](e.item):a])},c=function(){var a=e.item.bottomInfo;if(a||n["bottom-info"])return u("div",{class:R("bottom-info")},[n["bottom-info"]?n["bottom-info"](e.item):a])},d=function(){var a=e.item,t=e.color,n=e.rowHeight,r=a.type,o=a.text,i=[l(),o,c()];return"selected"===r?u("div",{class:R("selected-day"),style:{width:n,height:n,background:t}},[i]):i};return function(){var a=e.item,t=a.type,n=a.className;return"placeholder"===t?u("div",{class:R("day"),style:r.value},null):u("div",{role:"gridcell",style:r.value,class:[R("day",t),n],tabindex:"disabled"===t?void 0:-1,onClick:o},[d()])}}}),G=a(n("calendar-month"),1)[0],X={date:o(Date),type:String,color:String,minDate:o(Date),maxDate:o(Date),showMark:Boolean,rowHeight:f,formatter:Function,lazyRender:Boolean,currentDate:[Date,Array],allowSameDay:Boolean,showSubtitle:Boolean,showMonthTitle:Boolean,firstDayOfWeek:Number},Z=r({name:G,props:X,emits:["click","update-height"],setup:function(e,t){var n=t.emit,r=t.slots,o=a(c(),2),l=o[0],f=o[1],g=d(),y=d(),b=B(y),w=i((function(){return a=e.date,H("monthTitle",a.getFullYear(),a.getMonth()+1);var a})),_=i((function(){return s(e.rowHeight)})),k=i((function(){var a=e.date.getDay();return e.firstDayOfWeek?(a+7-e.firstDayOfWeek)%7:a})),D=i((function(){return C(e.date.getFullYear(),e.date.getMonth()+1)})),x=i((function(){return l.value||!e.lazyRender})),z=function(t){var n=e.type,r=e.minDate,o=e.maxDate,l=e.currentDate;if(W(t,r)<0||W(t,o)>0)return"disabled";if(null===l)return"";if(Array.isArray(l)){if("multiple"===n)return function(a){var t=function(a){return e.currentDate.some((function(e){return 0===W(e,a)}))};if(t(a)){var n=N(a),r=V(a),o=t(n),l=t(r);return o&&l?"multiple-middle":o?"end":l?"start":"multiple-selected"}return""}(t);if("range"===n)return function(t){var n=a(e.currentDate,2),r=n[0],o=n[1];if(!r)return"";var l=W(t,r);if(!o)return 0===l?"start":"";var i=W(t,o);return e.allowSameDay&&0===l&&0===i?"start-end":0===l?"start":0===i?"end":l>0&&i<0?"middle":""}(t)}else if("single"===n)return 0===W(t,l)?"selected":"";return""},S=function(a){if("range"===e.type){if("start"===a||"end"===a)return H(a);if("start-end"===a)return"".concat(H("start"),"/").concat(H("end"))}},T=function(){if(e.showMonthTitle)return u("div",{class:R("month-title")},[w.value])},A=function(){if(e.showMark&&x.value)return u("div",{class:R("month-mark")},[e.date.getMonth()+1])},O=i((function(){var e=Math.ceil((D.value+k.value)/7);return Array(e).fill({type:"placeholder"})})),M=i((function(){for(var a=[],t=e.date.getFullYear(),n=e.date.getMonth(),r=1;r<=D.value;r++){var o=new Date(t,n,r),l=z(o),i={date:o,type:l,text:r,bottomInfo:S(l)};e.formatter&&(i=e.formatter(i)),a.push(i)}return a})),I=i((function(){return M.value.filter((function(e){return"disabled"===e.type}))})),j=function(a,t){return u($,{item:a,index:t,color:e.color,offset:k.value,rowHeight:_.value,onClick:function(e){return n("click",e)}},p(r,["top-info","bottom-info"]))};return v({getTitle:function(){return w.value},getHeight:function(){return b.value},setVisible:f,scrollToDate:function(e,a){if(g.value){var t=h(g.value),n=O.value.length,r=(Math.ceil((a.getDate()+k.value)/7)-1)*t.height/n;m(e,t.top+r+e.scrollTop-h(e).top)}},disabledDays:I}),function(){return u("div",{class:R("month"),ref:y},[T(),u("div",{ref:g,role:"grid",class:R("days")},[A(),(x.value?M:O).value.map(j)])])}}}),q=a(n("calendar-header"),1)[0],J=r({name:q,props:{title:String,subtitle:String,showTitle:Boolean,showSubtitle:Boolean,firstDayOfWeek:Number},emits:["click-subtitle"],setup:function(a,t){var n=t.slots,r=t.emit,o=function(){if(a.showTitle){var e=a.title||H("title"),t=n.title?n.title():e;return u("div",{class:R("header-title")},[t])}},l=function(e){return r("click-subtitle",e)},i=function(){if(a.showSubtitle){var e=n.subtitle?n.subtitle():a.subtitle;return u("div",{class:R("header-subtitle"),onClick:l},[e])}};return function(){return u("div",{class:R("header")},[o(),i(),(t=a.firstDayOfWeek,n=H("weekdays"),r=[].concat(e(n.slice(t,7)),e(n.slice(0,t))),u("div",{class:R("weekdays")},[r.map((function(e){return u("span",{class:R("weekday")},[e])}))]))]);var t,n,r}}}),K={show:Boolean,type:g("single"),title:String,color:String,round:y,readonly:Boolean,poppable:y,maxRange:b(null),position:g("bottom"),teleport:[String,Object],showMark:y,showTitle:y,formatter:Function,rowHeight:f,confirmText:String,rangePrompt:String,lazyRender:y,showConfirm:y,defaultDate:[Date,Array],allowSameDay:Boolean,showSubtitle:y,closeOnPopstate:y,showRangePrompt:y,confirmDisabledText:String,closeOnClickOverlay:y,safeAreaInsetTop:Boolean,safeAreaInsetBottom:y,minDate:{type:Date,validator:w,default:L},maxDate:{type:Date,validator:w,default:function(){var e=L();return new Date(e.getFullYear(),e.getMonth()+6,e.getDate())}},firstDayOfWeek:{type:f,default:0,validator:function(e){return e>=0&&e<=6}}},Q=r({name:j,props:K,emits:["select","confirm","unselect","month-show","over-range","update:show","click-subtitle"],setup:function(t,n){var r,o=n.emit,l=n.slots,c=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.minDate,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.maxDate;return-1===W(e,a)?a:1===W(e,n)?n:e},s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.defaultDate,a=t.type,n=t.minDate,r=t.maxDate;if(null===e)return e;var o=L();if("range"===a){Array.isArray(e)||(e=[]);var l=c(e[0]||o,n,N(r)),i=c(e[1]||o,V(n));return[l,i]}return"multiple"===a?Array.isArray(e)?e.map((function(e){return c(e)})):[c(o)]:(e&&!Array.isArray(e)||(e=o),c(e))},f=d(),m=d(""),g=d(s()),y=a(M(),2),b=y[0],w=y[1],O=i((function(){return t.firstDayOfWeek?+t.firstDayOfWeek%7:0})),C=i((function(){var e=[],a=new Date(t.minDate);a.setDate(1);do{e.push(new Date(a)),a.setMonth(a.getMonth()+1)}while(1!==P(a,t.maxDate));return e})),B=i((function(){if(g.value){if("range"===t.type)return!g.value[0]||!g.value[1];if("multiple"===t.type)return!g.value.length}return!g.value})),I=function(){var e=z(f.value),a=e+r,t=C.value.map((function(e,a){return b.value[a].getHeight()}));if(!(a>t.reduce((function(e,a){return e+a}),0)&&e>0)){for(var n,l=0,i=[-1,-1],u=0;u<C.value.length;u++){var c=b.value[u];l<=a&&l+t[u]>=e&&(i[1]=u,n||(n=c,i[0]=u),b.value[u].showed||(b.value[u].showed=!0,o("month-show",{date:c.date,title:c.getTitle()}))),l+=t[u]}C.value.forEach((function(e,a){var t=a>=i[0]-1&&a<=i[1]+1;b.value[a].setVisible(t)})),n&&(m.value=n.getTitle())}},j=function(e){x((function(){C.value.some((function(a,t){return 0===P(a,e)&&(f.value&&b.value[t].scrollToDate(f.value,e),!0)})),I()}))},U=function(){if(!t.poppable||t.show)if(g.value){var e="single"===t.type?g.value:g.value[0];j(e)}else x(I)},$=function(){t.poppable&&!t.show||x((function(){r=Math.floor(h(f).height),U()}))},G=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s();g.value=e,U()},X=function(){var e;return o("confirm",null!=(e=g.value)?e:Y(g.value))},q=function(e,a){var n=function(e){g.value=e,o("select",Y(e))};if(a&&"range"===t.type){var r=function(e){var a=t.maxRange,n=t.rangePrompt,r=t.showRangePrompt;return!(a&&function(e){var a=e[0].getTime();return(e[1].getTime()-a)/864e5+1}(e)>a&&(r&&T(n||H("rangePrompt",a)),o("over-range"),1))}(e);if(!r)return void n([e[0],E(e[0],+t.maxRange-1)])}n(e),a&&!t.showConfirm&&X()},K=i((function(){return b.value.reduce((function(a,t){var n,r;return a.push.apply(a,e(null!=(r=null==(n=t.disabledDays)?void 0:n.value)?r:[])),a}),[])})),Q=function(n){if(!t.readonly&&n.date){var r=n.date,l=t.type;if("range"===l){if(!g.value)return void q([r]);var i=a(g.value,2),u=i[0],c=i[1];if(u&&!c){var d=W(r,u);if(1===d){var s=function(e,a,t){var n;return null==(n=e.find((function(e){return-1===W(a,e.date)&&-1===W(e.date,t)})))?void 0:n.date}(K.value,u,r);if(s){var v=N(s);-1===W(u,v)?q([u,v]):q([r])}else q([u,r],!0)}else-1===d?q([r]):t.allowSameDay&&q([r,r],!0)}else q([r])}else if("multiple"===l){if(!g.value)return void q([r]);var f=g.value,h=f.findIndex((function(e){return 0===W(e,r)}));if(-1!==h){var m=a(f.splice(h,1),1)[0];o("unselect",F(m))}else t.maxRange&&f.length>=t.maxRange?T(t.rangePrompt||H("rangePrompt",t.maxRange)):q([].concat(e(f),[r]))}else q(r,!0)}},ee=function(e){return o("update:show",e)},ae=function(e,a){var n=0!==a||!t.showSubtitle;return u(Z,S({ref:w(a),date:e,currentDate:g.value,showMonthTitle:n,firstDayOfWeek:O.value},p(t,["type","color","minDate","maxDate","showMark","formatter","rowHeight","lazyRender","showSubtitle","allowSameDay"]),{onClick:Q}),p(l,["top-info","bottom-info"]))},te=function(){if(l.footer)return l.footer();if(t.showConfirm){var e=l["confirm-text"],a=B.value,n=a?t.confirmDisabledText:t.confirmText;return u(A,{round:!0,block:!0,type:"danger",color:t.color,class:R("confirm"),disabled:a,nativeType:"button",onClick:X},{default:function(){return[e?e({disabled:a}):n||H("confirm")]}})}},ne=function(){return u("div",{class:R()},[u(J,{title:t.title,subtitle:m.value,showTitle:t.showTitle,showSubtitle:t.showSubtitle,firstDayOfWeek:O.value,"onClick-subtitle":function(e){return o("click-subtitle",e)}},p(l,["title","subtitle"])),u("div",{ref:f,class:R("body"),onScroll:I},[C.value.map(ae)]),u("div",{class:[R("footer"),{"van-safe-area-bottom":t.safeAreaInsetBottom}]},[te()])])};return _((function(){return t.show}),$),_((function(){return[t.type,t.minDate,t.maxDate]}),(function(){return G(s(g.value))})),_((function(){return t.defaultDate}),(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;g.value=e,U()})),v({reset:G,scrollToDate:j}),k($),function(){return t.poppable?u(D,{show:t.show,class:R("popup"),round:t.round,position:t.position,closeable:t.showTitle||t.showSubtitle,teleport:t.teleport,closeOnPopstate:t.closeOnPopstate,safeAreaInsetTop:t.safeAreaInsetTop,closeOnClickOverlay:t.closeOnClickOverlay,"onUpdate:show":ee},{default:ne}):ne()}}});t("C",O(Q))}}}))}();