index.2ca0f455.js 1.2 KB

1
  1. import{t as P,N as g,w as n,d as k,R as x,y as V,Z as i,ar as s,c as v,E as C,al as S,D as H}from"./index.ffe80dbe.js";import{s as M,g as r,f as N,p as T}from"./utils.18cb7a73.js";import{P as p}from"./index.777c6c1a.js";const[y]=P("time-picker"),w=g({},M,{minHour:n(0),maxHour:n(23),minMinute:n(0),maxMinute:n(59),minSecond:n(0),maxSecond:n(59),columnsType:{type:Array,default:()=>["hour","minute"]}});var D=k({name:y,props:w,emits:["confirm","cancel","change","update:modelValue"],setup(a,{emit:t,slots:l}){const o=x(a.modelValue),u=V(()=>a.columnsType.map(e=>{const{filter:m,formatter:c}=a;switch(e){case"hour":return r(+a.minHour,+a.maxHour,e,c,m);case"minute":return r(+a.minMinute,+a.maxMinute,e,c,m);case"second":return r(+a.minSecond,+a.maxSecond,e,c,m);default:throw new Error(`[Vant] DatePicker: unsupported columns type: ${e}`)}}));i(o,e=>{s(e,a.modelValue)||t("update:modelValue",e)}),i(()=>a.modelValue,e=>{e=N(e,u.value),s(e,o.value)||(o.value=e)},{immediate:!0});const d=(...e)=>t("change",...e),f=(...e)=>t("cancel",...e),h=(...e)=>t("confirm",...e);return()=>v(p,C({modelValue:o.value,"onUpdate:modelValue":e=>o.value=e,columns:u.value,onChange:d,onCancel:f,onConfirm:h},S(a,T)),l)}});const A=H(D);export{A as T};