vue-amazing-ui
Version:
An Amazing Vue3 UI Components Library, Using TypeScript.
58 lines (57 loc) • 1.88 kB
JavaScript
import { defineComponent as x, computed as s, createElementBlock as i, openBlock as o, createCommentVNode as n, createElementVNode as c, renderSlot as r, createTextVNode as a, toDisplayString as l, normalizeStyle as h } from "vue";
import { useSlotsExist as y, formatNumber as S } from "../utils/index.js";
const _ = { class: "statistic-wrap" }, k = {
key: 0,
class: "statistic-title"
}, w = {
key: 0,
class: "statistic-prefix"
}, E = { class: "statistic-value" }, N = {
key: 1,
class: "statistic-suffix"
}, C = /* @__PURE__ */ x({
__name: "Statistic",
props: {
title: { default: void 0 },
value: { default: void 0 },
valueStyle: { default: () => ({}) },
precision: { default: 0 },
prefix: { default: void 0 },
suffix: { default: void 0 },
separator: { default: "," },
formatter: { type: Function, default: (u) => u }
},
setup(u) {
const e = u, f = y(["title", "prefix", "suffix"]), d = s(() => e.formatter(S(e.value || "", e.precision, e.separator))), p = s(() => f.title || e.title), m = s(() => f.prefix || e.prefix), v = s(() => f.suffix || e.suffix);
return (t, V) => (o(), i("div", _, [
p.value ? (o(), i("div", k, [
r(t.$slots, "title", {}, () => [
a(l(t.title), 1)
], !0)
])) : n("", !0),
c("div", {
class: "statistic-content",
style: h(t.valueStyle)
}, [
m.value ? (o(), i("span", w, [
r(t.$slots, "prefix", {}, () => [
a(l(t.prefix), 1)
], !0)
])) : n("", !0),
c("span", E, [
r(t.$slots, "default", {}, () => [
a(l(d.value), 1)
], !0)
]),
v.value ? (o(), i("span", N, [
r(t.$slots, "suffix", {}, () => [
a(l(t.suffix), 1)
], !0)
])) : n("", !0)
], 4)
]));
}
});
export {
C as default
};