UNPKG

@progress/kendo-vue-buttons

Version:
107 lines (106 loc) 2.71 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { defineComponent as a, createVNode as t, h as c } from "vue"; import { Icon as m, getTemplate as p } from "@progress/kendo-vue-common"; const x = /* @__PURE__ */ a({ name: "KendoButtonItem", emits: { click: (e, n) => !0, down: (e, n) => !0 }, props: { focused: Boolean, index: Number, item: Object, render: [String, Object, Function], dataItem: [String, Object], id: String, textField: String, role: String }, computed: { wrapperClass() { return { "k-item": !0, "k-focus": this.$props.focused }; }, innerClass() { const { dataItem: e } = this.$props; return { "k-link k-menu-link": !0, "k-selected": e.selected, "k-disabled": e.disabled }; } }, methods: { onClick(e) { this.$emit("click", e, this.$props.index); }, onDown(e) { this.$emit("down", e, this.$props.index); } }, render() { const { dataItem: e, id: n, render: o } = this.$props, r = function() { const { textField: i, index: l } = this.$props, s = e.text !== void 0 ? e.text : i ? e[i] : e, d = t("span", { tabindex: -1, class: this.innerClass, key: "icon" }, [e.icon || e.svgIcon ? t(m, { name: e.icon, icon: e.svgIcon, class: e.iconClass }, null) : e.iconClass && t("span", { class: e.iconClass, role: "presentation" }, null), e.imageUrl && t("img", { class: "k-icon", alt: "", src: e.imageUrl, role: "presentation", key: "image" }, null), s && t("span", { class: "k-menu-link-text" }, [s])]); return p.call(this, { h: c, template: this.$props.dataItem.render || o, defaultRendering: d, additionalProps: { item: e, itemIndex: l, innerClass: this.innerClass, focused: this.focused } }); }; return t("li", { id: n, class: this.wrapperClass, onClick: this.onClick, onMousedown: this.onDown, onPointerdown: this.onDown, role: "menuitem", "aria-disabled": e.disabled || void 0 }, [r.call(this)]); } }); export { x as ButtonItem };