UNPKG

vue-amazing-ui

Version:

An Amazing Vue3 UI Components Library, Using TypeScript.

58 lines (57 loc) 1.88 kB
import { defineComponent as v, computed as i, createElementBlock as o, openBlock as a, createCommentVNode as n, createElementVNode as c, renderSlot as l, createTextVNode as r, toDisplayString as u, normalizeStyle as h } from "vue"; import { useSlotsExist as y, formatNumber as S } from "../utils/index.js"; const k = { class: "statistic-wrap" }, w = { key: 0, class: "statistic-title" }, E = { key: 0, class: "statistic-prefix" }, N = { class: "statistic-value" }, V = { key: 1, class: "statistic-suffix" }, C = /* @__PURE__ */ v({ __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: (t) => t } }, setup(t) { const e = t, f = y(["title", "prefix", "suffix"]), d = i(() => e.formatter(S(e.value || "", e.precision, e.separator))), p = i(() => f.title || e.title), m = i(() => f.prefix || e.prefix), x = i(() => f.suffix || e.suffix); return (s, _) => (a(), o("div", k, [ p.value ? (a(), o("div", w, [ l(s.$slots, "title", {}, () => [ r(u(t.title), 1) ], !0) ])) : n("", !0), c("div", { class: "statistic-content", style: h(t.valueStyle) }, [ m.value ? (a(), o("span", E, [ l(s.$slots, "prefix", {}, () => [ r(u(t.prefix), 1) ], !0) ])) : n("", !0), c("span", N, [ l(s.$slots, "default", {}, () => [ r(u(d.value), 1) ], !0) ]), x.value ? (a(), o("span", V, [ l(s.$slots, "suffix", {}, () => [ r(u(t.suffix), 1) ], !0) ])) : n("", !0) ], 4) ])); } }); export { C as default };