import{defineComponent as ne,computed as d,ref as te,createVNode as a,Fragment as le}from"vue";import ue from"@ant-design/icons-vue/CalendarOutlined";import ce from"@ant-design/icons-vue/ClockCircleOutlined";import se from"@ant-design/icons-vue/CloseCircleFilled";import pe from"@ant-design/icons-vue/SwapRightOutlined";import{getTimeProps as R,Components as ie}from"./index.mjs";import V from"../../_util/classNames.mjs";import me from"../../_util/omit.mjs";import{getStatusClassNames as de,getMergedStatus as fe}from"../../_util/statusUtils.mjs";import ve from"../../config-provider/hooks/useConfigInject.mjs";import{useInjectFormItemContext as Ce,FormItemInputContext as ge}from"../../form/FormItemContext.mjs";import{useLocaleReceiver as Ie}from"../../locale/LocaleReceiver.mjs";import{useCompactItemContext as Pe}from"../../space/Compact.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 xe from"../../vc-picker/RangePicker.mjs";import ke from"../locale/en_US.mjs";import he from"../style/index.mjs";import{getRangePlaceholder as Fe,transPlacement2DropdownAlign as be}from"../util.mjs";import{rangePickerProps as Re,commonProps as Ve}from"./props.mjs";function ro(s,N){return ne({compatConfig:{MODE:3},name:"ARangePicker",inheritAttrs:!1,props:{...Ve(),...Re(),...N},slots:Object,setup(O,{expose:S,slots:n,attrs:f,emit:t}){const e=O,v=Ce(),p=ge.useInject(),{prefixCls:C,direction:g,getPopupContainer:w,size:$,rootPrefixCls:D,disabled:j}=ve("picker",e),{compactSize:z,compactItemClassnames:A}=Pe(C,g),k=d(()=>z.value||$.value),[E,h]=he(C),I=te();S({focus:()=>{I.value?.focus()},blur:()=>{I.value?.blur()}});const i=o=>e.valueFormat?s.toString(o,e.valueFormat):o,T=(o,r)=>{const u=i(o);t("update:value",u),t("change",u,r),v.onFieldChange()},B=o=>{t("update:open",o),t("openChange",o)},y=o=>{t("focus",o)},L=o=>{t("blur",o),v.onFieldBlur()},M=(o,r)=>{const u=i(o);t("panelChange",u,r)},U=o=>{const r=i(o);t("ok",r)},q=(o,r,u)=>{const P=i(o);t("calendarChange",P,r,u)},[G]=Ie("DatePicker",ke),H=d(()=>e.value&&e.valueFormat?s.toDate(e.value,e.valueFormat):e.value),J=d(()=>e.defaultValue&&e.valueFormat?s.toDate(e.defaultValue,e.valueFormat):e.defaultValue),K=d(()=>e.defaultPickerValue&&e.valueFormat?s.toDate(e.defaultPickerValue,e.valueFormat):e.defaultPickerValue);return()=>{const o={...G.value,...e.locale},r={...e,...f},{prefixCls:u,bordered:P=!0,placeholder:Q,suffixIcon:W=n.suffixIcon?.(),picker:c="date",transitionName:X,allowClear:Y=!0,dateRender:Z=n.dateRender,renderExtraFooter:_=n.renderExtraFooter,separator:ee=n.separator?.(),clearIcon:oe=n.clearIcon?.(),id:ae=v.id.value,...m}=r;delete m["onUpdate:value"],delete m["onUpdate:open"];const{format:F,showTime:b}=r;let x={};x={...x,...b?R({format:F,picker:c,...b}):{},...c==="time"?R({format:F,...me(m,["disabledTime"]),picker:c}):{}};const l=C.value,re=a(le,null,[W||(c==="time"?a(ce,null,null):a(ue,null,null)),p.hasFeedback&&p.feedbackIcon]);return E(a(xe,{dateRender:Z,renderExtraFooter:_,separator:ee||a("span",{"aria-label":"to",class:`${l}-separator`},[a(pe,null,null)]),ref:I,dropdownAlign:be(g.value,e.placement),placeholder:Fe(o,c,Q),suffixIcon:re,clearIcon:oe||a(se,null,null),allowClear:Y,transitionName:X||`${D.value}-slide-up`,...m,...x,disabled:j.value,id:ae,value:H.value,defaultValue:J.value,defaultPickerValue:K.value,picker:c,class:V({[`${l}-${k.value}`]:k.value,[`${l}-borderless`]:!P},de(l,fe(p.status,e.status),p.hasFeedback),f.class,h.value,A.value),locale:o.lang,prefixCls:l,getPopupContainer:f.getCalendarContainer||w.value,generateConfig:s,prevIcon:n.prevIcon?.()||a("span",{class:`${l}-prev-icon`},null),nextIcon:n.nextIcon?.()||a("span",{class:`${l}-next-icon`},null),superPrevIcon:n.superPrevIcon?.()||a("span",{class:`${l}-super-prev-icon`},null),superNextIcon:n.superNextIcon?.()||a("span",{class:`${l}-super-next-icon`},null),components:ie,direction:g.value,dropdownClassName:V(h.value,e.popupClassName,e.dropdownClassName),onChange:T,onOpenChange:B,onFocus:y,onBlur:L,onPanelChange:M,onOk:U,onCalendarChange:q},null))}}})}export{ro as default};
