UNPKG

@wetspace/pro-components

Version:
53 lines (52 loc) 1.55 kB
import { defineComponent as b, computed as i, openBlock as m, createBlock as y, unref as n, normalizeClass as c, withCtx as d, createElementVNode as p, toDisplayString as _, createCommentVNode as h } from "vue"; import { useNamespace as j, ElSpace as E } from "element-plus"; const N = /* @__PURE__ */ b({ __name: "enum", props: { valueEnum: { type: Array, default() { return []; } }, value: [String, Number, Array] }, setup(f) { const u = j("table-cell-state"), t = f, a = i(() => { if (t.value === void 0) return null; const r = t.valueEnum.map((e) => e && typeof e == "object" ? e : { label: e, value: e }), s = Array.isArray(t.value) ? t.value : [t.value], l = []; if (s.forEach((e) => { const o = r.find((v) => v.value === e); o && l.push(o); }), l.length > 1) return { label: l.map((e) => typeof e == "object" ? e.label : e).join(",") }; { const e = l[0] || {}; return { label: typeof e == "object" ? e.label : e, status: typeof e == "object" ? e.status : null }; } }); return (r, s) => a.value ? (m(), y(n(E), { key: 0, class: c(n(u).b()) }, { default: d(() => [ p("span", { class: c([n(u).e("dot"), a.value.status ? `is-${a.value.status}` : ""]) }, null, 2), p("span", null, _(a.value.label), 1) ]), _: 1 }, 8, ["class"])) : h("", !0); } }); export { N as default };