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