index-legacy.b02dbd1b.js 2.0 KB

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