UNPKG

vexip-ui

Version:

A Vue 3 UI library, Highly customizability, full TypeScript, performance pretty good

100 lines (99 loc) 2.66 kB
import { isVNode as p, createVNode as o, mergeProps as c } from "vue"; import "../dropdown/index.mjs"; import "../dropdown-list/index.mjs"; import "../dropdown-item/index.mjs"; import "../icon/index.mjs"; import { useIcons as f } from "@vexip-ui/config"; import { useRtl as m } from "@vexip-ui/hooks"; import a from "../icon/icon.mjs"; import y from "../dropdown/dropdown.vue2.mjs"; import v from "../dropdown/dropdown-list.vue2.mjs"; import d from "../dropdown/dropdown-item.vue2.mjs"; function _(e) { return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !p(e); } function i(e, r) { return e.icon ? o("div", { class: r.be("icon") }, [o(a, { icon: e.icon, style: [{ color: e.iconColor || e.color }, e.icon.style] }, null)]) : null; } function u(e, r) { return e.shortcut ? o("div", { class: r.be("shortcut") }, [e.shortcut]) : null; } function I(e, r) { const t = f(), { isRtl: b } = m(); return o(y, c({ inherit: !0, transfer: !1 }, { onContextmenu: (l) => { l.preventDefault(), l.stopPropagation(); } }), { default: () => o(d, { class: r.be("item"), label: e.key, divided: e.divided, disabled: e.disabled }, { default: () => [i(e, r), typeof e.renderer == "function" ? e.renderer() : o("span", { class: r.be("label"), style: { color: e.color } }, [e.label || e.key]), u(e, r), o("div", { class: [r.be("icon"), r.be("arrow")] }, [o(a, c(b.value ? t.value.angleLeft : t.value.angleRight, { style: { color: e.iconColor || e.color } }), null)])] }), drop: () => { let l; return o(v, { class: [r.be("list"), e.children.some((s) => s.icon) ? r.bem("list", "icons") : r.bem("list", "no-icon"), e.children.some((s) => { var n; return (n = s.children) == null ? void 0 : n.length; }) ? r.bem("list", "arrows") : r.bem("list", "no-arrow")] }, _(l = e.children.map((s) => k({ nh: r, config: s }))) ? l : { default: () => [l] }); } }); } function k({ config: e, nh: r }) { var t; return (t = e.children) != null && t.length ? I(e, r) : o(d, { class: r.be("item"), label: e.key, divided: e.divided, disabled: e.disabled }, { default: () => [i(e, r), typeof e.renderer == "function" ? e.renderer() : o("span", { class: r.be("label"), style: { color: e.color } }, [e.label || e.key]), u(e, r)] }); } export { k as renderItem }; //# sourceMappingURL=render.mjs.map