UNPKG

@aplus-frontend/ui

Version:

83 lines (82 loc) 2.16 kB
import { defineComponent as p, computed as d, createElementBlock as a, openBlock as n, createCommentVNode as r, createElementVNode as m, renderSlot as l, toDisplayString as u } from "vue"; import { isNil as c } from "lodash-unified"; import { roundWith as f, toDecimalMark as y } from "@fruits-chain/utils"; import { addZeroToDecimalPlaces as B } from "./helper.mjs"; const h = { key: 0, style: { "padding-right": "4px" } }, g = { key: 1, style: { "padding-left": "4px" } }, _ = /* @__PURE__ */ p({ 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 }, 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: {}, emptyText: { default: "--" }, thousands: { type: Boolean, default: !1 }, limitDecimalsRetain: { type: Boolean } }, setup(s) { const o = s, i = d(() => { let e = o.value; if (c(e)) return o.emptyText; o.precision && (e = f(e, o.precision)); let t = o.thousands ? y(e) : String(e); return o.precision && o.limitDecimalsRetain && (t = B(t, o.precision)), t; }); return (e, t) => (n(), a("span", null, [ e.$slots.prefix ? (n(), a("span", h, [ l(e.$slots, "prefix") ])) : r("", !0), m("span", null, u(i.value), 1), e.$slots.addonAfter ? (n(), a("span", g, [ l(e.$slots, "addonAfter") ])) : r("", !0) ])); } }); export { _ as default };