import{defineComponent as de,computed as f,ref as fe,createVNode as n,Fragment as ve}from"vue";import Ce from"@ant-design/icons-vue/CalendarOutlined";import Pe from"@ant-design/icons-vue/ClockCircleOutlined";import ke from"@ant-design/icons-vue/CloseCircleFilled";import{getTimeProps as w,Components as he}from"./index.mjs";import N from"../../_util/classNames.mjs";import{getStatusClassNames as Ie,getMergedStatus as ge}from"../../_util/statusUtils.mjs";import xe from"../../config-provider/hooks/useConfigInject.mjs";import{useInjectFormItemContext as Fe,FormItemInputContext as Ve}from"../../form/FormItemContext.mjs";import{useLocaleReceiver as be}from"../../locale/LocaleReceiver.mjs";import{useCompactItemContext as we}from"../../space/Compact.mjs";import Ne from"../../vc-picker/Picker.mjs";import"../../vc-picker/panels/DatePanel/index.mjs";import"../../vc-picker/panels/DatetimePanel/index.mjs";import"../../vc-picker/panels/DecadePanel/index.mjs";import"../../vc-picker/panels/MonthPanel/index.mjs";import"../../vc-picker/panels/QuarterPanel/index.mjs";import"../../vc-picker/panels/TimePanel/index.mjs";import"../../vc-picker/panels/WeekPanel/index.mjs";import"../../vc-picker/panels/YearPanel/index.mjs";import"../../_util/raf.mjs";import"../../vc-trigger/Trigger.mjs";import"../../_util/vue-types/index.mjs";import Re from"../locale/en_US.mjs";import Se from"../style/index.mjs";import{transPlacement2DropdownAlign as Oe,getPlaceholder as Te}from"../util.mjs";import{datePickerProps as Ae,commonProps as De}from"./props.mjs";function uo(i,R){function u(m,y){const j={...De(),...Ae(),...R};return de({compatConfig:{MODE:3},name:y,inheritAttrs:!1,props:j,slots:Object,setup(E,{slots:t,expose:M,attrs:v,emit:a}){const e=E,C=Fe(),p=Ve.useInject(),{prefixCls:P,direction:k,getPopupContainer:z,size:B,rootPrefixCls:L,disabled:Q}=xe("picker",e),{compactSize:W,compactItemClassnames:Y}=we(P,k),x=f(()=>W.value||B.value),[q,F]=Se(P),h=fe();M({focus:()=>{h.value?.focus()},blur:()=>{h.value?.blur()}});const I=o=>e.valueFormat?i.toString(o,e.valueFormat):o,G=(o,r)=>{const c=I(o);a("update:value",c),a("change",c,r),C.onFieldChange()},H=o=>{a("update:open",o),a("openChange",o)},J=o=>{a("focus",o)},K=o=>{a("blur",o),C.onFieldBlur()},U=(o,r)=>{const c=I(o);a("panelChange",c,r)},X=o=>{const r=I(o);a("ok",r)},[Z]=be("DatePicker",Re),_=f(()=>e.value?e.valueFormat?i.toDate(e.value,e.valueFormat):e.value:e.value===""?void 0:e.value),ee=f(()=>e.defaultValue?e.valueFormat?i.toDate(e.defaultValue,e.valueFormat):e.defaultValue:e.defaultValue===""?void 0:e.defaultValue),oe=f(()=>e.defaultPickerValue?e.valueFormat?i.toDate(e.defaultPickerValue,e.valueFormat):e.defaultPickerValue:e.defaultPickerValue===""?void 0:e.defaultPickerValue);return()=>{const o={...Z.value,...e.locale},r={...e,...v},{bordered:c=!0,placeholder:re,suffixIcon:te=t.suffixIcon?.(),showToday:ne=!0,transitionName:ae,allowClear:le=!0,dateRender:ue=t.dateRender,renderExtraFooter:ce=t.renderExtraFooter,monthCellRender:ie=t.monthCellRender||e.monthCellContentRender||t.monthCellContentRender,clearIcon:se=t.clearIcon?.(),id:me=C.id.value,...V}=r,g=r.showTime===""?!0:r.showTime,{format:b}=r;let d={};m&&(d.picker=m);const s=m||r.picker||"date";d={...d,...g?w({format:b,picker:s,...typeof g=="object"?g:{}}):{},...s==="time"?w({format:b,...V,picker:s}):{}};const l=P.value,pe=n(ve,null,[te||(m==="time"?n(Pe,null,null):n(Ce,null,null)),p.hasFeedback&&p.feedbackIcon]);return q(n(Ne,{monthCellRender:ie,dateRender:ue,renderExtraFooter:ce,ref:h,placeholder:Te(o,s,re),suffixIcon:pe,dropdownAlign:Oe(k.value,e.placement),clearIcon:se||n(ke,null,null),allowClear:le,transitionName:ae||`${L.value}-slide-up`,...V,...d,id:me,picker:s,value:_.value,defaultValue:ee.value,defaultPickerValue:oe.value,showToday:ne,locale:o.lang,class:N({[`${l}-${x.value}`]:x.value,[`${l}-borderless`]:!c},Ie(l,ge(p.status,e.status),p.hasFeedback),v.class,F.value,Y.value),disabled:Q.value,prefixCls:l,getPopupContainer:v.getCalendarContainer||z.value,generateConfig:i,prevIcon:t.prevIcon?.()||n("span",{class:`${l}-prev-icon`},null),nextIcon:t.nextIcon?.()||n("span",{class:`${l}-next-icon`},null),superPrevIcon:t.superPrevIcon?.()||n("span",{class:`${l}-super-prev-icon`},null),superNextIcon:t.superNextIcon?.()||n("span",{class:`${l}-super-next-icon`},null),components:he,direction:k.value,dropdownClassName:N(F.value,e.popupClassName,e.dropdownClassName),onChange:G,onOpenChange:H,onFocus:J,onBlur:K,onPanelChange:U,onOk:X},null))}}})}const S=u(void 0,"ADatePicker"),O=u("week","AWeekPicker"),T=u("month","AMonthPicker"),A=u("year","AYearPicker"),D=u("time","TimePicker"),$=u("quarter","AQuarterPicker");return{DatePicker:S,WeekPicker:O,MonthPicker:T,YearPicker:A,TimePicker:D,QuarterPicker:$}}export{uo as default};
