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