@progress/kendo-vue-layout
Version:
103 lines (102 loc) • 2.53 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 h, createVNode as a } from "vue";
import { getDefaultSlots as b, getTabIndex as f, Icon as k, getIconName as g } from "@progress/kendo-vue-common";
import { provideLocalizationService as x } from "@progress/kendo-vue-intl";
import { separatorAriaMessage as o, messages as I } from "../messages/main.mjs";
const v = /* @__PURE__ */ h({
name: "KendoDrawerItem",
emits: {
click: null
},
props: {
index: Number,
text: String,
icon: String,
svgIcon: Object,
separator: Boolean,
selected: Boolean,
disabled: Boolean,
targetItem: [Object, Array]
},
inject: {
kendoDrawer: {
default: null
},
kendoLocalizationService: {
default: null
}
},
computed: {
itemClassNames() {
const {
disabled: e,
selected: t
} = this.$props;
return {
"k-drawer-item": !0,
"k-selected": t,
"k-disabled": e
};
}
},
render() {
const e = b(this), {
text: t,
icon: s,
svgIcon: i,
separator: l,
disabled: r,
selected: n,
tabIndex: c
} = this.$props, {
expanded: d,
mini: m,
item: p
} = this.kendoDrawer, u = x(this).toLanguageString(o, I[o]);
return l ? a("li", {
class: "k-drawer-item k-drawer-separator",
role: "separator",
"aria-label": u
}, null) : a("li", {
class: this.itemClassNames,
role: "menuitem",
"aria-label": t,
"aria-current": n,
"aria-disabled": r,
onClick: this.handleClick,
tabindex: f(c, r)
}, [p ? e : [(s || i) && a(k, {
name: g(s),
icon: i
}, null), !d && m ? null : a("span", {
class: "k-item-text"
}, [t])]]);
},
methods: {
focus(e) {
this.$el && this.$el.focus(e);
},
handleClick() {
if (!this.disabled) {
const e = {
element: this.$el,
focus: this.focus,
props: {
...this.$props,
...this.$attrs
}
};
this.$emit("click", e, this.$props.index);
}
}
}
});
export {
v as DrawerItem
};