@aplus-frontend/ui
Version:
2 lines (1 loc) • 1.75 kB
JavaScript
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),s=require("lodash-unified"),a=require("../../utils/format.js"),i=require("./helper.js"),d={key:0,style:{"padding-right":"4px"}},p={key:1,style:{"padding-left":"4px"}},u=e.defineComponent({name:"ApFieldNumberRead",__name:"read",props:{mode:{},class:{},style:{},size:{},bordered:{type:Boolean},placeholder:{},name:{},id:{},type:{},addonBefore:{},addonAfter:{},prefix:{},suffix:{},"onUpdate:value":{},valueModifiers:{},status:{},variant:{},changeOnWheel:{type:Boolean},changeOnBlur:{type:Boolean},stringMode:{type:Boolean},defaultValue:{},value:{},prefixCls:{},min:{},max:{},step:{},tabindex:{},controls:{type:Boolean},readonly:{type:Boolean},disabled:{type:Boolean},autofocus:{type:Boolean},keyboard:{type:Boolean},parser:{},formatter:{},precision:{},decimalSeparator:{},onInput:{},onChange:{},onPressEnter:{},onStep:{},onBlur:{},onFocus:{},inputMode:{},emptyText:{default:"--"},thousands:{type:Boolean,default:!1},limitDecimalsRetain:{type:Boolean}},setup(l){const t=l,r=e.computed(()=>{let o=t.value;if(s.isNil(o))return t.emptyText;t.precision&&(o=a.roundWith(o,t.precision));let n=t.thousands?a.toDecimalMark(o):String(o);return t.precision&&t.limitDecimalsRetain&&(n=i.addZeroToDecimalPlaces(n,t.precision)),n});return(o,n)=>(e.openBlock(),e.createElementBlock("span",null,[o.$slots.prefix?(e.openBlock(),e.createElementBlock("span",d,[e.renderSlot(o.$slots,"prefix")])):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(r.value),1),o.$slots.addonAfter?(e.openBlock(),e.createElementBlock("span",p,[e.renderSlot(o.$slots,"addonAfter")])):e.createCommentVNode("",!0)]))}});exports.default=u;