import { defineComponent as p, computed as d, openBlock as a, createElementBlock as n, renderSlot as r, createCommentVNode as l, createElementVNode as u, toDisplayString as m } from "vue";
import { isNil as c } from "lodash-unified";
import { roundWith as f, toDecimalMark as y } from "../../utils/format.mjs";
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: {},
    emptyText: { default: "--" },
    customReadMode: {},
    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: {},
    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) => (a(), n("span", null, [
      e.$slots.prefix ? (a(), n("span", h, [
        r(e.$slots, "prefix")
      ])) : l("", !0),
      u("span", null, m(i.value), 1),
      e.$slots.addonAfter ? (a(), n("span", g, [
        r(e.$slots, "addonAfter")
      ])) : l("", !0)
    ]));
  }
});
export {
  _ as default
};
