@aplus-frontend/ui
Version:
52 lines (51 loc) • 1.86 kB
JavaScript
import { defineComponent as r, useSlots as m, computed as d, createVNode as e, mergeProps as p } from "vue";
import { Tooltip as f, Badge as A } from "@aplus-frontend/antdv";
import { IconApAdLineAnnotation as y, IconApAdFillWarn as v, IconApAdLineWarn as b, IconApAdFillExecution as g, IconApAdFillSuccessful as T } from "@aplus-frontend/icon";
import { omit as I } from "lodash-unified";
import "../../config-provider/index.mjs";
import { ApLabelProps as L } from "./constans.mjs";
import S from "./style/index.mjs";
import { useNamespace as h } from "../../config-provider/hooks/use-namespace.mjs";
const W = /* @__PURE__ */ r({
name: "ApLabel",
props: L(),
setup(l) {
const {
b: a,
e: i
} = h("ap-label"), c = S("ap-label"), o = m(), n = d(() => ({
color: l.iconColor,
"font-size": l.iconSize + "px",
"margin-left": "4px",
cursor: "pointer"
})), s = (u, t) => u ? e(f, {
title: u,
placement: t.placement || "top",
color: t.toolTipBgColor
}, {
default: () => [t.iconType === "question" && e(y, {
style: n.value
}, null), t.iconType === "warning" && e(v, {
style: n.value
}, null), t.iconType === "line-warning" && e(b, {
style: n.value
}, null), t.iconType === "ellipsis" && e(g, {
style: n.value
}, null), t.iconType === "success" && e(T, {
style: n.value
}, null)]
}) : null;
return () => e("div", null, [l.show ? e("div", {
class: [a(), c.value]
}, [e("div", {
class: [i("content")]
}, [e(A, p(I(l, ["helpMessage", "placement", "iconColor"]), {
status: l.status ? l.status : "default"
}), null), o.default ? o.default() : s(l.helpMessage, l)]), o.custom ? e("div", {
class: [i("custom")]
}, [o.custom()]) : null]) : null]);
}
});
export {
W as default
};