@progress/kendo-vue-grid
Version:
137 lines (136 loc) • 4.02 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2026 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 r, mergeProps as l, h as C, inject as d } from "vue";
import { KEYBOARD_NAV_DATA_ID as s, KEYBOARD_NAV_DATA_LEVEL as g, TABLE_COL_INDEX_ATTRIBUTE as b } from "@progress/kendo-vue-data-tools";
import { noop as c, uGrid as y, classNames as x, getTemplate as N } from "@progress/kendo-vue-common";
import { GridPinDropdownButton as f } from "./GridPinDropdownButton.mjs";
const I = (e) => {
var t, i;
return (i = (t = e.cells) == null ? void 0 : t.pin) == null ? void 0 : i[e.rowType || "data"];
}, v = /* @__PURE__ */ h({
name: "GridPinCell",
inheritAttrs: !1,
props: {
id: String,
field: String,
dataItem: Object,
format: String,
readFormat: String,
className: String,
columnType: String,
colSpan: Number,
columnIndex: Number,
columnsCount: Number,
dataIndex: Number,
rowType: String,
level: Number,
expanded: Boolean,
type: String,
editor: String,
rowSpan: [Number, Object],
isSelected: Boolean,
isHighlighted: Boolean,
ariaColumnIndex: Number,
render: [String, Function, Object],
isRtl: Boolean
},
inject: {
getKeyboardNavigationAttributes: {
default: c
}
},
setup() {
const e = d("getKeyboardNavigationAttributes", c), t = d("gridContext", null);
return {
getKeyboardNavigationAttributes: e,
gridContext: t
};
},
methods: {
triggerClick() {
this.$emit("cellclick", {
dataItem: this.$props.dataItem,
field: this.$props.field
});
},
triggerKeydown(e) {
this.$emit("cellkeydown", {
event: e,
dataItem: this.$props.dataItem,
field: this.$props.field
});
},
triggerContextMenu(e) {
var t, i;
(i = (t = this.gridContext) == null ? void 0 : t.onContextMenu) == null || i.call(t, e, this.$props.dataItem, this.$props.field);
}
},
render() {
var o, a;
const e = this.$props;
let t = null;
const i = this.getKeyboardNavigationAttributes(e.id);
let n = {};
if (e.rowType === "groupFooter")
n = {
class: e.className,
tabindex: i.tabIndex,
"data-keyboardnavlevel": i[g],
"data-keyboardnavid": i[s]
}, t = r("td", l(n, {
onClick: this.triggerClick,
onKeydown: this.triggerKeydown,
onContextmenu: this.triggerContextMenu
}), null);
else if (e.rowType !== "groupHeader") {
const u = (a = (o = e.unstyled) == null ? void 0 : o.uGrid) != null ? a : y, p = x(u.td({
selected: e.isSelected,
highlighted: e.isHighlighted,
sorted: e.isSorted,
alt: e.isAlt
}), e.className);
n = {
style: this.$attrs.style,
colspan: e.colSpan,
class: p,
role: "gridcell",
"aria-colindex": e.ariaColumnIndex,
"aria-selected": e.isSelected,
[b]: e.columnIndex,
tabindex: i.tabIndex,
"data-keyboardnavlevel": i[g],
"data-keyboardnavid": i[s]
}, t = r("td", l(n, {
onClick: this.triggerClick,
onKeydown: this.triggerKeydown,
onContextmenu: this.triggerContextMenu
}), [r(f, {
dataItem: e.dataItem
}, null)]);
}
const m = I(e);
return N.call(this, {
h: C,
template: m,
defaultRendering: t,
additionalProps: {
...e,
tdProps: n
},
additionalListeners: {
click: this.triggerClick,
keydown: this.triggerKeydown,
contextmenu: this.triggerContextMenu
}
});
}
});
export {
v as GridPinCell,
I as getCustomCell
};