el-time-select-12ab7196.js 3.3 KB

1
  1. import{aL as U,bC as A,aM as S,cX as P,ct as E,d as _,G as x,cY as F,aN as G,r as w,cZ as L,br as R,e as i,o as f,C as b,A as h,a as c,aG as X,ad as Y,a0 as Z,a3 as q,c as D,F as J,R as K,U as I,aP as Q,__tla as W}from"./index-54aa57d8.js";let $,ee=Promise.all([(()=>{try{return W}catch{}})()]).then(async()=>{const T=U({format:{type:String,default:"HH:mm"},modelValue:String,disabled:Boolean,editable:{type:Boolean,default:!0},effect:{type:String,default:"light"},clearable:{type:Boolean,default:!0},size:A,placeholder:String,start:{type:String,default:"09:00"},end:{type:String,default:"18:00"},step:{type:String,default:"00:30"},minTime:String,maxTime:String,name:String,prefixIcon:{type:S([String,Object]),default:()=>P},clearIcon:{type:S([String,Object]),default:()=>E}}),u=n=>{const o=(n||"").split(":");if(o.length>=2){let t=Number.parseInt(o[0],10);const r=Number.parseInt(o[1],10),s=n.toUpperCase();return s.includes("AM")&&t===12?t=0:s.includes("PM")&&t!==12&&(t+=12),{hours:t,minutes:r}}return null},v=(n,o)=>{const t=u(n);if(!t)return-1;const r=u(o);if(!r)return-1;const s=t.minutes+60*t.hours,d=r.minutes+60*r.hours;return s===d?0:s>d?1:-1},g=n=>`${n}`.padStart(2,"0"),m=n=>`${g(n.hours)}:${g(n.minutes)}`,V=(n,o)=>{const t=u(n);if(!t)return"";const r=u(o);if(!r)return"";const s={hours:t.hours,minutes:t.minutes};return s.minutes+=r.minutes,s.hours+=r.hours,s.hours+=Math.floor(s.minutes/60),s.minutes=s.minutes%60,m(s)},k=_({name:"ElTimeSelect"});var p=Q(_({...k,props:T,emits:["change","blur","focus","update:modelValue"],setup(n,{expose:o}){const t=n;x.extend(F);const{Option:r}=I,s=G("input"),d=w(),B=L(),{lang:M}=R(),z=i(()=>t.modelValue),C=i(()=>{const e=u(t.start);return e?m(e):null}),y=i(()=>{const e=u(t.end);return e?m(e):null}),H=i(()=>{const e=u(t.step);return e?m(e):null}),N=i(()=>{const e=u(t.minTime||"");return e?m(e):null}),j=i(()=>{const e=u(t.maxTime||"");return e?m(e):null}),O=i(()=>{const e=[];if(t.start&&t.end&&t.step){let l,a=C.value;for(;a&&y.value&&v(a,y.value)<=0;)l=x(a,"HH:mm").locale(M.value).format(t.format),e.push({value:l,disabled:v(a,N.value||"-1:-1")<=0||v(a,j.value||"100:100")>=0}),a=V(a,H.value)}return e});return o({blur:()=>{var e,l;(l=(e=d.value)==null?void 0:e.blur)==null||l.call(e)},focus:()=>{var e,l;(l=(e=d.value)==null?void 0:e.focus)==null||l.call(e)}}),(e,l)=>(f(),b(c(I),{ref_key:"select",ref:d,"model-value":c(z),disabled:c(B),clearable:e.clearable,"clear-icon":e.clearIcon,size:e.size,effect:e.effect,placeholder:e.placeholder,"default-first-option":"",filterable:e.editable,"onUpdate:modelValue":l[0]||(l[0]=a=>e.$emit("update:modelValue",a)),onChange:l[1]||(l[1]=a=>e.$emit("change",a)),onBlur:l[2]||(l[2]=a=>e.$emit("blur",a)),onFocus:l[3]||(l[3]=a=>e.$emit("focus",a))},{prefix:h(()=>[e.prefixIcon?(f(),b(c(X),{key:0,class:Y(c(s).e("prefix-icon"))},{default:h(()=>[(f(),b(Z(e.prefixIcon)))]),_:1},8,["class"])):q("v-if",!0)]),default:h(()=>[(f(!0),D(J,null,K(c(O),a=>(f(),b(c(r),{key:a.value,label:a.value,value:a.value,disabled:a.disabled},null,8,["label","value","disabled"]))),128))]),_:1},8,["model-value","disabled","clearable","clear-icon","size","effect","placeholder","filterable"]))}}),[["__file","/home/runner/work/element-plus/element-plus/packages/components/time-select/src/time-select.vue"]]);p.install=n=>{n.component(p.name,p)},$=p});export{$ as E,ee as __tla};