index-legacy.ab2ce923.js 1.9 KB

1
  1. System.register(["./index-legacy.eb062188.js","./utils-legacy.6e8de97c.js","./index-legacy.38b799d5.js"],(function(e){"use strict";var n,t,u,a,i,m,o,c,r,l,s,d,p,f,v,y,x;return{setters:[function(e){n=e.t,t=e.N,u=e.w,a=e.d,i=e.R,m=e.y,o=e.Z,c=e.a_,r=e.c,l=e.E,s=e.am,d=e.D},function(e){p=e.s,f=e.a,v=e.f,y=e.p},function(e){x=e.P}],execute:function(){const[T]=n("time-picker"),h=e=>/^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/.test(e),g=["hour","minute","second"],V=t({},p,{minHour:u(0),maxHour:u(23),minMinute:u(0),maxMinute:u(59),minSecond:u(0),maxSecond:u(59),minTime:{type:String,validator:h},maxTime:{type:String,validator:h},columnsType:{type:Array,default:()=>["hour","minute"]},filter:Function});var S=a({name:T,props:V,emits:["confirm","cancel","change","update:modelValue"],setup(e,{emit:n,slots:t}){const u=i(e.modelValue),a=n=>{const t=n.split(":");return g.map(((n,u)=>e.columnsType.includes(n)?t[u]:"00"))},d=m((()=>{let{minHour:n,maxHour:t,minMinute:i,maxMinute:m,minSecond:o,maxSecond:c}=e;if(e.minTime||e.maxTime){const r={hour:0,minute:0,second:0};e.columnsType.forEach(((e,n)=>{var t;r[e]=null!=(t=u.value[n])?t:0}));const{hour:l,minute:s}=r;if(e.minTime){const[t,u,m]=a(e.minTime);n=t,i=+l<=+n?u:"00",o=+l<=+n&&+s<=+i?m:"00"}if(e.maxTime){const[n,u,i]=a(e.maxTime);t=n,m=+l>=+t?u:"59",c=+l>=+t&&+s>=+m?i:"59"}}return e.columnsType.map((a=>{const{filter:r,formatter:l}=e;switch(a){case"hour":return f(+n,+t,a,l,r,u.value);case"minute":return f(+i,+m,a,l,r,u.value);case"second":return f(+o,+c,a,l,r,u.value);default:throw new Error(`[Vant] DatePicker: unsupported columns type: ${a}`)}}))}));o(u,(t=>{c(t,e.modelValue)||n("update:modelValue",t)})),o((()=>e.modelValue),(e=>{e=v(e,d.value),c(e,u.value)||(u.value=e)}),{immediate:!0});const p=(...e)=>n("change",...e),T=(...e)=>n("cancel",...e),h=(...e)=>n("confirm",...e);return()=>r(x,l({modelValue:u.value,"onUpdate:modelValue":e=>u.value=e,columns:d.value,onChange:p,onCancel:T,onConfirm:h},s(e,y)),t)}});e("T",d(S))}}}));