"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),C=require("@aplus-frontend/antdv"),i=require("lodash-unified");require("../../render/index.js");const c=require("../../utils/format.js");require("../../config-provider/index.js");require("../../hooks/index.js");const R=require("../hooks/use-default-placeholder.js"),x=require("../hooks/use-read-mode-render.js"),M=require("../style/index.js"),N=require("./helper.js"),P=require("../../config-provider/hooks/use-namespace.js"),V=require("../../hooks/useControllableValue.js"),D=require("../../render/render.js"),z=e.defineComponent({name:"ApFieldNumber",__name:"index",props:{mode:{},class:{},style:{},emptyText:{default:"--"},customReadMode:{},size:{},bordered:{type:Boolean,default:!0},placeholder:{},name:{},id:{},type:{},addonBefore:{},addonAfter:{},prefix:{},suffix:{},"onUpdate:value":{},valueModifiers:{},status:{},variant:{},changeOnWheel:{type:Boolean,default:void 0},changeOnBlur:{type:Boolean,default:void 0},stringMode:{type:Boolean},defaultValue:{},value:{},prefixCls:{},min:{default:-1/0},max:{default:1/0},step:{default:1},tabindex:{},controls:{type:Boolean,default:!0},readonly:{type:Boolean},disabled:{type:Boolean,default:void 0},autofocus:{type:Boolean},keyboard:{type:Boolean,default:!0},parser:{},formatter:{},precision:{},decimalSeparator:{},onInput:{},onChange:{},onPressEnter:{},onStep:{},onBlur:{},onFocus:{},inputMode:{},thousands:{type:Boolean,default:!1},limitDecimalsRetain:{type:Boolean}},emits:["update:value"],setup(a,{expose:f,emit:p}){const m=p,v=e.useSlots(),{b:n}=P.useNamespace("field-number"),y=M.default("field"),t=a,h=e.computed(()=>i.omit(t,["value","onUpdate:value","mode"])),l=e.shallowRef(),{value:u,updateValue:B}=V.useControllableValue(t,m),b=R.useDefaultPlaceholder("Number",t),s=e.computed(()=>{let o=e.unref(u);if(i.isNil(o))return t.emptyText;t.precision&&(o=c.roundWith(o,t.precision));let r=t.thousands?c.toDecimalMark(o):String(o);return t.precision&&t.limitDecimalsRetain&&(r=N.addZeroToDecimalPlaces(r,t.precision)),r}),{renderer:k}=x.useReadModeRender(t,s);function q(){l.value?.focus()}function S(){l.value?.blur()}return f({focus:q,blur:S}),(o,r)=>a.mode==="read"?(e.openBlock(),e.createBlock(e.unref(D.default),{key:0,renderer:e.unref(k)},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass([e.unref(n)(),e.unref(y)])},[o.$slots.prefix?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(e.unref(n)("label-left"))},[e.renderSlot(o.$slots,"prefix")],2)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(s.value),1),o.$slots.addonAfter?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(e.unref(n)("label-right"))},[e.renderSlot(o.$slots,"addonAfter")],2)):e.createCommentVNode("",!0)],2)]),_:3},8,["renderer"])):(e.openBlock(),e.createBlock(e.unref(C.InputNumber),e.mergeProps({key:1},h.value,{ref_key:"inputRef",ref:l,placeholder:e.unref(b),value:e.unref(u),mode:a.inputMode,"onUpdate:value":e.unref(B)}),e.createSlots({_:2},[e.renderList(v,(E,d)=>({name:d,fn:e.withCtx(g=>[e.renderSlot(o.$slots,d,e.normalizeProps(e.guardReactiveProps(g||{})))])}))]),1040,["placeholder","value","mode","onUpdate:value"]))}});exports.default=z;
