UNPKG

@aplus-frontend/ui

Version:

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