import{defineComponent as P,ref as F,createVNode as b}from"vue";import O from"../_util/omit.mjs";import{stringType as y,booleanType as c}from"../_util/type.mjs";import A from"../date-picker/generatePicker/index.mjs";import{rangePickerProps as E,commonProps as v,datePickerProps as U}from"../date-picker/generatePicker/props.mjs";import{useInjectFormItemContext as N}from"../form/FormItemContext.mjs";import j from"../vc-util/devWarning.mjs";const k=()=>({format:String,showNow:c(),showHour:c(),showMinute:c(),showSecond:c(),use12Hours:c(),hourStep:Number,minuteStep:Number,secondStep:Number,hideDisabledOptions:c(),popupClassName:String,status:y()});function G(T){const x=A(T,{...k(),order:{type:Boolean,default:!0}}),{TimePicker:B,RangePicker:w}=x,I=P({name:"ATimePicker",inheritAttrs:!1,props:{...v(),...U(),...k(),addon:{type:Function}},slots:Object,setup(p,{slots:s,expose:d,emit:e,attrs:i}){const r=p,a=N();j(!(s.addon||r.addon),"TimePicker","`addon` is deprecated. Please use `v-slot:renderExtraFooter` instead.");const t=F();d({focus:()=>{t.value?.focus()},blur:()=>{t.value?.blur()}});const l=(n,h)=>{e("update:value",n),e("change",n,h),a.onFieldChange()},m=n=>{e("update:open",n),e("openChange",n)},f=n=>{e("focus",n)},g=n=>{e("blur",n),a.onFieldBlur()},C=n=>{e("ok",n)};return()=>{const{id:n=a.id.value}=r;return b(B,{...i,...O(r,["onUpdate:value","onUpdate:open"]),id:n,dropdownClassName:r.popupClassName,mode:void 0,ref:t,renderExtraFooter:r.addon||s.addon||r.renderExtraFooter||s.renderExtraFooter,onChange:l,onOpenChange:m,onFocus:f,onBlur:g,onOk:C},s)}}}),R=P({name:"ATimeRangePicker",inheritAttrs:!1,props:{...v(),...E(),...k(),order:{type:Boolean,default:!0}},slots:Object,setup(p,{slots:s,expose:d,emit:e,attrs:i}){const r=p,a=F(),t=N();d({focus:()=>{a.value?.focus()},blur:()=>{a.value?.blur()}});const l=(o,u)=>{e("update:value",o),e("change",o,u),t.onFieldChange()},m=o=>{e("update:open",o),e("openChange",o)},f=o=>{e("focus",o)},g=o=>{e("blur",o),t.onFieldBlur()},C=(o,u)=>{e("panelChange",o,u)},n=o=>{e("ok",o)},h=(o,u,S)=>{e("calendarChange",o,u,S)};return()=>{const{id:o=t.id.value}=r;return b(w,{...i,...O(r,["onUpdate:open","onUpdate:value"]),id:o,dropdownClassName:r.popupClassName,picker:"time",mode:void 0,ref:a,onChange:l,onOpenChange:m,onFocus:f,onBlur:g,onPanelChange:C,onOk:n,onCalendarChange:h},s)}}});return{TimePicker:I,TimeRangePicker:R}}export{G as default,k as timePickerProps};
