UNPKG

@aplus-frontend/ui

Version:

125 lines (124 loc) 3.87 kB
import { defineComponent as N, useSlots as _, computed as r, createVNode as a, mergeProps as f, createBlock as s, openBlock as u, createSlots as $, withCtx as m, createCommentVNode as y, renderSlot as h, resolveDynamicComponent as v, renderList as A, unref as j } from "vue"; import { clsx as b } from "clsx"; import { omit as P } from "lodash-unified"; import "../../../config-provider/index.mjs"; import D from "../../style/statistics-card.mjs"; import "../card/index.vue.mjs"; import "../statistic/index.vue.mjs"; import { useNamespace as k } from "../../../config-provider/hooks/use-namespace.mjs"; import M from "../statistic/index.vue2.mjs"; import w from "../card/index.vue2.mjs"; const K = /* @__PURE__ */ N({ name: "ApStatisticCard", __name: "index", props: { headStyle: {}, bodyStyle: {}, actionsStyle: {}, headerBordered: { type: Boolean }, title: { type: [Object, String, Number, Boolean, null, Array] }, tooltip: { type: [Object, String, Number, Boolean, null, Array] }, extra: { type: [Object, String, Number, Boolean, null, Array] }, layout: {}, type: {}, direction: {}, wrap: { type: Boolean }, loading: { type: [Boolean, Object, String, Number, null, Array] }, colSpan: {}, colStyle: {}, gutter: {}, actions: { type: [Object, String, Number, Boolean, null, Array] }, split: {}, bordered: { type: Boolean }, hoverable: { type: Boolean }, ghost: { type: Boolean }, collapsible: { type: Boolean }, defaultCollapsed: { type: Boolean }, collapsed: { type: Boolean, default: void 0 }, collapsibleIconRender: {}, boxShadow: { type: Boolean }, chart: { type: [Object, String, Number, Boolean, null, Array] }, statistic: {}, chartPlacement: {}, footer: { type: [Object, String, Number, Boolean, null, Array] } }, setup(B) { const t = B, e = _(), { b: n } = k("statistic-card"), S = D("statistic-card"), g = r(() => [n(), S.value]), C = r(() => { const o = n("chart"); return b(`${o}`, [t.chartPlacement === "left" ? `${o}-left` : void 0, t.chartPlacement === "right" ? `${o}-right` : void 0].filter(Boolean)); }), p = r(() => { const o = n("content"); return b(`${o}`, [t.chartPlacement === "left" || t.chartPlacement === "right" ? `${o}-horizontal` : void 0].filter(Boolean)); }), x = r(() => n("footer")), l = r(() => t.statistic ? a(M, f({ layout: "vertical" }, t.statistic, { title: t.statistic?.title || e.statisticTitle?.(), prefix: t.statistic?.prefix || e.prefix?.(), suffix: t.statistic?.suffix || e.suffix?.(), icon: t.statistic?.icon || e.icon?.(), tip: t.statistic?.tip || e.tip?.(), description: t.statistic?.description || e.description?.() }), null) : void 0), i = r(() => t.chart || e.chart ? a("div", { class: C.value }, [t.chart || e.chart?.()]) : void 0), c = r(() => i.value || l.value ? t.chartPlacement === "left" ? a("div", { class: p.value }, [i.value, l.value]) : a("div", { class: p.value }, [l.value, i.value]) : void 0), O = r(() => t.footer || e.footer ? a("div", { class: x.value }, [t.footer || e.footer?.()]) : void 0); return (o, I) => (u(), s(w, f({ class: g.value }, { ...t }), $({ default: m(() => [c.value ? (u(), s(v(c.value), { key: 0 })) : y("", !0), h(o.$slots, "default"), c.value ? (u(), s(v(O.value), { key: 1 })) : y("", !0)]), _: 2 }, [A(j(P)(e, ["chart", "footer", "description", "default"]), (V, d) => ({ name: d, fn: m(() => [h(o.$slots, d)]) }))]), 1040, ["class"])); } }); export { K as default };