@progress/kendo-vue-buttons
Version:
107 lines (106 loc) • 2.69 kB
JavaScript
/**
* @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 d, createVNode as n, h as c } from "vue";
import { Icon as m, getTemplate as p } from "@progress/kendo-vue-common";
const C = /* @__PURE__ */ d({
name: "KendoButtonItem",
emits: {
click: null,
down: null
},
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: s,
render: o
} = this.$props, r = function() {
const {
textField: t,
index: l
} = this.$props, i = e.text !== void 0 ? e.text : t ? e[t] : e, a = n("span", {
tabindex: -1,
class: this.innerClass,
key: "icon"
}, [e.icon || e.svgIcon ? n(m, {
name: e.icon,
icon: e.svgIcon,
class: e.iconClass
}, null) : e.iconClass && n("span", {
class: e.iconClass,
role: "presentation"
}, null), e.imageUrl && n("img", {
class: "k-icon",
alt: "",
src: e.imageUrl,
role: "presentation",
key: "image"
}, null), i && n("span", {
class: "k-menu-link-text"
}, [i])]);
return p.call(this, {
h: c,
template: this.$props.dataItem.render || o,
defaultRendering: a,
additionalProps: {
item: e,
itemIndex: l,
innerClass: this.innerClass,
focused: this.focused
}
});
};
return n("li", {
id: s,
class: this.wrapperClass,
onClick: this.onClick,
onMousedown: this.onDown,
onPointerdown: this.onDown,
role: "menuitem",
"aria-disabled": e.disabled || void 0
}, [r.call(this)]);
}
});
export {
C as ButtonItem
};