import{d as e,s as a,a as t,b as l,h as d,e as n,f as r,H as u,j as s}from"./index-d052b22f-1780912037814v=1.0.0.js";const p={class:"flx-row"},o=e({name:"TimeSelect"}),i=e({...o,props:{yearRange:{type:Array,default:()=>[]},type:{type:String,default:()=>"year"},placeholder:{type:Object,default:()=>({start:"开始年份",end:"结束年份"})},disableValue:{type:Object,default:()=>({start:"",end:""})}},emits:["valueChange","update:yearRange"],setup(e,{emit:o}){const i=e,g=o,y=a({get:()=>i.yearRange[0]?new Date(i.yearRange[0].toString()):"",set(e){g("update:yearRange",[e,m.value])}}),m=a({get:()=>i.yearRange[1]?new Date(i.yearRange[1].toString()):"",set(e){g("update:yearRange",[y.value,e])}}),c=e=>{let a=e.getTime();return!!i.disableValue.start&&a<new Date(i.disableValue.start).getTime()},v=e=>{let a=e.getTime(),t=!1;return i.disableValue.end&&(t=a>new Date(i.disableValue.end).getTime()),t||(t=a<new Date(y.value).getTime()),t},b=(e,a)=>{new Date(y.value).getTime()>new Date(m.value).getTime()&&("start"==a?m.value="":y.value="")};return(a,o)=>{const i=t("el-date-picker");return l(),d("div",p,[n(i,{modelValue:r(y),"onUpdate:modelValue":o[0]||(o[0]=e=>u(y)?y.value=e:null),type:e.type,placeholder:e.placeholder.start,onChange:o[1]||(o[1]=e=>b(0,"start")),"disabled-date":c},null,8,["modelValue","type","placeholder"]),o[4]||(o[4]=s(" - ")),n(i,{modelValue:r(m),"onUpdate:modelValue":o[2]||(o[2]=e=>u(m)?m.value=e:null),type:e.type,placeholder:e.placeholder.end,onChange:o[3]||(o[3]=e=>b(0,"end")),"disabled-date":v},null,8,["modelValue","type","placeholder"])])}}});export{i as _};
