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