UNPKG

@aplus-frontend/ui

Version:

14 lines (13 loc) 598 B
import { isNil as c, isString as n } from "lodash-unified"; import { addZeroToDecimalPlaces as f } from "../../ap-field/number/helper.mjs"; import { roundWith as l, toDecimalMark as m } from "../../utils/format.mjs"; function v(e) { if (c(e.value)) return e.emptyText || "--"; const r = n(e.prefix) ? `${e.prefix} ` : "", a = n(e.addonAfter) ? ` ${e.addonAfter}` : "", t = e.precision ? l(e.value, e.precision) : e.value; let i = e.thousands ? m(t) : String(t); return e.precision && e.limitDecimalsRetain && (i = f(i, e.precision)), `${r}${i}${a}`; } export { v as numberRenderer };