1 |
- System.register(["./index-legacy-f009f15c.js","./utils-legacy-e5dbc9ae.js","./index-legacy-bfb39003.js"],(function(e,t){"use strict";var a,n,r,l,u,o,m,c,s,i,d,y,D,g,f,p,h,v;return{setters:[e=>{a=e.c,n=e.ai,r=e.bj,l=e.d,u=e.r,o=e.e,m=e.w,c=e.bG,s=e.a,i=e.h,d=e.ak,y=e.k},e=>{D=e.s,g=e.f,f=e.a,p=e.g,h=e.p},e=>{v=e.P}],execute:function(){const t=(new Date).getFullYear(),[x]=a("date-picker"),V=n({},D,{columnsType:{type:Array,default:()=>["year","month","day"]},minDate:{type:Date,default:()=>new Date(t-10,0,1),validator:r},maxDate:{type:Date,default:()=>new Date(t+10,11,31),validator:r}});var w=l({name:x,props:V,emits:["confirm","cancel","change","update:modelValue"],setup(e,{emit:t,slots:a}){const n=u(e.modelValue),r=u(!1),l=t=>t===e.minDate.getFullYear(),y=t=>t===e.maxDate.getFullYear(),D=t=>{const{minDate:a,columnsType:l}=e,u=l.indexOf(t),o=r.value?e.modelValue[u]:n.value[u];if(o)return+o;switch(t){case"year":return a.getFullYear();case"month":return a.getMonth()+1;case"day":return a.getDate()}},x=()=>{const t=D("year"),a=D("month"),n=l(t)&&(t=>t===e.minDate.getMonth()+1)(a)?e.minDate.getDate():1,r=y(t)&&(t=>t===e.maxDate.getMonth()+1)(a)?e.maxDate.getDate():p(t,a);return f(n,r,"day",e.formatter,e.filter)},V=o((()=>e.columnsType.map((t=>{switch(t){case"year":return(()=>{const t=e.minDate.getFullYear(),a=e.maxDate.getFullYear();return f(t,a,"year",e.formatter,e.filter)})();case"month":return(()=>{const t=D("year"),a=l(t)?e.minDate.getMonth()+1:1,n=y(t)?e.maxDate.getMonth()+1:12;return f(a,n,"month",e.formatter,e.filter)})();case"day":return x();default:throw new Error(`[Vant] DatePicker: unsupported columns type: ${t}`)}}))));m(n,(a=>{c(a,e.modelValue)||t("update:modelValue",a)})),m((()=>e.modelValue),((e,t)=>{r.value=c(t,n.value),e=g(e,V.value),c(e,n.value)||(n.value=e),r.value=!1}),{immediate:!0});const w=(...e)=>t("change",...e),F=(...e)=>t("cancel",...e),Y=(...e)=>t("confirm",...e);return()=>s(v,i({modelValue:n.value,"onUpdate:modelValue":e=>n.value=e,columns:V.value,onChange:w,onCancel:F,onConfirm:Y},d(e,h)),a)}});e("D",y(w))}}}));
|