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