"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),oe=require("@ant-design/icons-vue/DownOutlined"),de=require("@ant-design/icons-vue/UpOutlined"),p=require("../_util/classNames.js"),V=require("../_util/isValidValue.js"),ce=require("../_util/omit.js"),m=require("../_util/statusUtils.js"),v=require("../_util/type.js"),ie=require("../_util/vnode.js"),S=require("../_util/vue-types/index.js"),fe=require("../config-provider/DisabledContext.js"),pe=require("../config-provider/hooks/useConfigInject.js"),g=require("../form/FormItemContext.js"),q=require("../space/Compact.js"),U=require("./src/InputNumber.js"),me=require("./style/index.js"),k=U.inputNumberProps(),E=()=>({...k,size:v.stringType(),bordered:v.booleanType(!0),placeholder:String,name:String,id:String,controls:v.booleanType(!1),type:String,addonBefore:S.default.any,addonAfter:S.default.any,prefix:S.default.any,"onUpdate:value":k.onChange,valueModifiers:Object,status:v.stringType()}),F=a.defineComponent({compatConfig:{MODE:3},name:"AInputNumber",inheritAttrs:!1,props:E(),slots:Object,setup(t,{emit:d,expose:H,attrs:W,slots:l}){const N=g.useInjectFormItemContext(),j=g.FormItemInputContext.useInject(),b=a.computed(()=>m.getMergedStatus(j.status,t.status)),{prefixCls:c,size:_,direction:s,disabled:G}=pe.default("input-number",t),{compactSize:J,compactItemClassnames:K}=q.useCompactItemContext(c,s),L=fe.useInjectDisabled(),z=a.computed(()=>G.value??L.value),[Q,i]=me.default(c),n=a.computed(()=>J.value||_.value),$=a.shallowRef(t.value??t.defaultValue),C=a.shallowRef(!1);a.watch(()=>t.value,()=>{$.value=t.value});const x=a.shallowRef(null),A=()=>{x.value?.focus()};H({focus:A,blur:()=>{x.value?.blur()}});const X=r=>{t.value===void 0&&($.value=r),d("update:value",r),d("change",r),N.onFieldChange()},Y=r=>{C.value=!1,d("blur",r),N.onFieldBlur()},Z=r=>{C.value=!0,d("focus",r)};return()=>{const{hasFeedback:r,isFormItemInput:ee,feedbackIcon:ae}=j,te=t.id??N.id.value,{class:f,bordered:B,readonly:w,style:h,addonBefore:I=l.addonBefore?.(),addonAfter:y=l.addonAfter?.(),prefix:O=l.prefix?.(),valueModifiers:re={},...le}={...W,...t,id:te,disabled:z.value},e=c.value,ne=p.default({[`${e}-lg`]:n.value==="large",[`${e}-sm`]:n.value==="small",[`${e}-rtl`]:s.value==="rtl",[`${e}-readonly`]:w,[`${e}-borderless`]:!B,[`${e}-in-form-item`]:ee},m.getStatusClassNames(e,b.value),f,K.value,i.value);let u=a.createVNode(U.default,{...ce.default(le,["size","defaultValue"]),ref:x,lazy:!!re.lazy,value:$.value,class:ne,prefixCls:e,readonly:w,onChange:X,onBlur:Y,onFocus:Z},{upHandler:l.upIcon?()=>a.createVNode("span",{class:`${e}-handler-up-inner`},[l.upIcon()]):()=>a.createVNode(de,{class:`${e}-handler-up-inner`},null),downHandler:l.downIcon?()=>a.createVNode("span",{class:`${e}-handler-down-inner`},[l.downIcon()]):()=>a.createVNode(oe,{class:`${e}-handler-down-inner`},null)});const M=V.default(I)||V.default(y),P=V.default(O);if(P||r){const o=p.default(`${e}-affix-wrapper`,m.getStatusClassNames(`${e}-affix-wrapper`,b.value,r),{[`${e}-affix-wrapper-focused`]:C.value,[`${e}-affix-wrapper-disabled`]:z.value,[`${e}-affix-wrapper-sm`]:n.value==="small",[`${e}-affix-wrapper-lg`]:n.value==="large",[`${e}-affix-wrapper-rtl`]:s.value==="rtl",[`${e}-affix-wrapper-readonly`]:w,[`${e}-affix-wrapper-borderless`]:!B,[`${f}`]:!M&&f},i.value);u=a.createVNode("div",{class:o,style:h,onClick:A},[P&&a.createVNode("span",{class:`${e}-prefix`},[O]),u,r&&a.createVNode("span",{class:`${e}-suffix`},[ae])])}if(M){const o=`${e}-group`,D=`${o}-addon`,R=I?a.createVNode("div",{class:D},[I]):null,T=y?a.createVNode("div",{class:D},[y]):null,se=p.default(`${e}-wrapper`,o,{[`${o}-rtl`]:s.value==="rtl"},i.value),ue=p.default(`${e}-group-wrapper`,{[`${e}-group-wrapper-sm`]:n.value==="small",[`${e}-group-wrapper-lg`]:n.value==="large",[`${e}-group-wrapper-rtl`]:s.value==="rtl"},m.getStatusClassNames(`${c}-group-wrapper`,b.value,r),f,i.value);u=a.createVNode("div",{class:ue,style:h},[a.createVNode("div",{class:se},[R&&a.createVNode(q.NoCompactStyle,null,{default:()=>[a.createVNode(g.NoFormStatus,null,{default:()=>[R]})]}),u,T&&a.createVNode(q.NoCompactStyle,null,{default:()=>[a.createVNode(g.NoFormStatus,null,{default:()=>[T]})]})])])}return Q(ie.cloneElement(u,{style:h}))}}}),ve=Object.assign(F,{install:t=>(t.component(F.name,F),t)});exports.default=ve;exports.inputNumberProps=E;
