@progress/kendo-vue-layout
Version:
106 lines (105 loc) • 2.46 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 l, createVNode as r, ref as u } from "vue";
import { getTabIndex as b, Icon as h, getDir as m } from "@progress/kendo-vue-common";
const f = /* @__PURE__ */ l({
name: "KendoBreadcrumbLink",
props: {
id: String,
tabIndex: Number,
dir: String,
disabled: Boolean,
text: String,
svgIcon: Object,
icon: Object,
ariaCurrent: Boolean,
isLast: Boolean,
isFirst: Boolean,
onSelect: Function
},
emits: ["select", "keydown"],
computed: {
itemClasses() {
const {
isFirst: e,
svgIcon: i,
text: t,
disabled: n
} = this.$props;
return {
"k-breadcrumb-root-link": e,
"k-breadcrumb-link": !e,
"k-breadcrumb-icontext-link": i && t,
"k-breadcrumb-icon-link": i !== void 0 && !t,
"k-disabled": n
};
}
},
created() {
this.currentDir = void 0;
},
mounted() {
this.currentDir = m(this.$el, this.$props.dir);
},
setup() {
return {
linkRef: u(null)
};
},
render() {
const {
ariaCurrent: e,
isLast: i,
id: t,
svgIcon: n,
icon: a,
text: s,
tabIndex: c,
disabled: o
} = this.$props;
return r("a", {
href: "#",
"aria-current": e || i && "page",
"aria-disabled": o || i,
id: t,
ref: this.linkRef,
dir: this.currentDir,
tabindex: b(c, o),
class: this.itemClasses,
onClick: (d) => {
d.preventDefault(), this.handleSelect(d);
},
onKeydown: this.handleKeyDown
}, [a || "", n && r(h, {
class: "k-svg-icon",
icon: n
}, null), s && r("span", {
class: "k-breadcrumb-item-text"
}, [s])]);
},
methods: {
focus() {
this.$el && this.$el.focus();
},
handleSelect(e) {
this.$emit("select", {
event: e,
id: this.$props.id
});
},
handleKeyDown(e) {
this.$emit("keydown", {
event: e,
id: this.$props.id
});
}
}
});
export {
f as BreadcrumbLink
};