UNPKG

@extclp/vexip-ui

Version:

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

40 lines (39 loc) 1.33 kB
import { defineComponent as u, inject as f, ref as s, toRef as b, computed as v, createElementBlock as _, openBlock as w, normalizeClass as C, renderSlot as E } from "vue"; import { useNameHelper as S, emitEvent as k } from "@vexip-ui/config"; import { dropdownItemProps as L } from "./props.mjs"; import { useLabel as $ } from "./hooks.mjs"; import { SELECT_HANDLER as h } from "./symbol.mjs"; const D = /* @__PURE__ */ u({ name: "DropdownItem", __name: "dropdown-item", props: L, setup(a, { expose: c }) { const e = a, n = f(h, null), d = S("dropdown"), o = s(null), i = b(e, "label"), m = s(e.reference), r = $(i, o), p = v(() => { const t = d.be("item"); return { [t]: !0, [`${t}--disabled`]: e.disabled, [`${t}--selected`]: !e.disabled && e.selected, [`${t}--divided`]: e.divided }; }); c({ wrapper: o, handleSelect: l }); function l() { e.disabled || m.value || (typeof n == "function" && n([r.value], [e.meta || {}]), k(e.onSelect, r.value)); } return (t, x) => (w(), _("li", { ref_key: "wrapper", ref: o, class: C(p.value), role: "menuitem", tabindex: "0", onClick: l }, [ E(t.$slots, "default") ], 2)); } }); export { D as default }; //# sourceMappingURL=dropdown-item.vue2.mjs.map