@aplus-frontend/ui
Version:
128 lines (127 loc) • 4.34 kB
JavaScript
import { defineComponent as F, useSlots as I, computed as t, createVNode as r, Fragment as s, createElementBlock as P, openBlock as o, mergeProps as x, createBlock as u, createElementVNode as C, resolveDynamicComponent as a, normalizeClass as B, unref as O, createSlots as V, withCtx as d } from "vue";
import { QuestionCircleOutlined as Q } from "@ant-design/icons-vue";
import { Tooltip as R, Badge as T, Statistic as q } from "@aplus-frontend/antdv";
import { clsx as c } from "clsx";
import { omit as G } from "lodash-unified";
import "../../../config-provider/index.mjs";
import H from "../../style/statistic.mjs";
import { useNamespace as J } from "../../../config-provider/hooks/use-namespace.mjs";
const ne = /* @__PURE__ */ F({
name: "ApProCardStatistic",
__name: "index",
props: {
prefixCls: {},
decimalSeparator: {},
groupSeparator: {},
format: {},
value: {},
valueStyle: {},
valueRender: {},
formatter: {
type: [Boolean, String, Function],
default: void 0
},
precision: {},
prefix: {
type: [Object, String, Number, Boolean, null, Array],
default: void 0
},
suffix: {
type: [Object, String, Number, Boolean, null, Array],
default: void 0
},
title: {
type: [Object, String, Number, Boolean, null, Array],
default: void 0
},
loading: {
type: Boolean
},
description: {
type: [Object, String, Number, Boolean, null, Array],
default: void 0
},
tip: {
type: [Object, String, Number, Boolean, null, Array],
default: void 0
},
status: {
default: void 0
},
icon: {
type: [Object, String, Number, Boolean, null, Array],
default: void 0
},
layout: {
default: "inline"
},
trend: {
default: void 0
},
size: {
default: "default"
}
},
setup(S) {
const n = I(), e = S, {
b: l
} = J("pro-card-statistic"), b = H("pro-card-statistic"), g = t(() => {
const i = l();
return c(`${i}`, [e.size ? `${i}-size-${e.size}` : void 0, b.value].filter(Boolean));
}), $ = t(() => l("tip")), D = t(() => {
const i = l();
return c(`${i}-trend-icon`, [e.trend ? `${i}-trend-icon-${e.trend}` : void 0].filter(Boolean));
}), N = t(() => l("status")), M = t(() => l("icon")), A = t(() => l("wrapper")), j = t(() => l("content")), k = t(() => {
const i = l();
return c(`${i}-layout`, [e.layout ? `${i}-layout-${e.layout}` : void 0, e.trend ? `${i}-trend-${e.trend}` : void 0].filter(Boolean));
}), _ = t(() => l("description")), f = t(() => e.tip || n.tip ? r(R, {
title: e.tip ?? n.tip?.()
}, {
default: () => [r(Q, {
class: $.value
}, null)]
}) : void 0), p = t(() => e.trend ? r("div", {
class: D.value
}, null) : void 0), z = t(() => e.status ? r(T, {
class: N.value,
status: e.status
}, null) : void 0), h = t(() => e.icon || n.icon ? r("div", {
class: M.value
}, [e.icon ?? n.icon?.()]) : void 0), m = t(() => e.title || n.title ? r(s, null, [e.title || n.title?.()]) : void 0), v = t(() => e.prefix || n.prefix ? r(s, null, [e.prefix || n.prefix?.()]) : void 0), y = t(() => e.suffix || n.suffix ? r(s, null, [e.suffix || n.suffix?.()]) : void 0), w = t(() => e.description || n.description ? r("div", {
class: _.value
}, [e.description || n.description?.()]) : void 0);
return (i, K) => (o(), P("div", x({
...i.$attrs
}, {
class: g.value
}), [(o(), u(a(h.value))), C("div", {
class: B(A.value)
}, [(o(), u(a(z.value))), C("div", {
class: B(j.value)
}, [r(O(q), x({
class: k.value
}, {
...O(G)(e, ["title", "prefix"]),
formatter: e.formatter ?? (({
value: E
}) => E ?? "--")
}), V({
_: 2
}, [m.value || f.value ? {
name: "title",
fn: d(() => [(o(), u(a(m.value))), (o(), u(a(f.value)))]),
key: "0"
} : void 0, p.value || v.value ? {
name: "prefix",
fn: d(() => [(o(), u(a(p.value))), (o(), u(a(v.value)))]),
key: "1"
} : void 0, y.value ? {
name: "suffix",
fn: d(() => [(o(), u(a(y.value)))]),
key: "2"
} : void 0]), 1040, ["class"]), (o(), u(a(w.value)))], 2)], 2)], 16));
}
});
export {
ne as default
};