UNPKG

@progress/kendo-vue-grid

Version:
115 lines (114 loc) 3.05 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 o, createVNode as t, h as r } from "vue"; import { getNestedValue as d } from "../utils/main.mjs"; import { noop as l, guid as s, getTemplate as p } from "@progress/kendo-vue-common"; import { KEYBOARD_NAV_DATA_LEVEL as c, KEYBOARD_NAV_DATA_ID as h } from "@progress/kendo-vue-data-tools"; const k = /* @__PURE__ */ o({ name: "KendoGridSelectionCell", inheritAttrs: !1, props: { id: String, field: String, dataItem: Object, format: String, type: String, className: String, colSpan: Number, columnIndex: Number, columnsCount: Number, rowType: String, level: Number, expanded: Boolean, render: [String, Function, Object], isSelected: Boolean, ariaColumnIndex: Number, editor: String, isRtl: Boolean }, emits: { selectionchange: null, cellkeydown: null }, inject: { kendoIntlService: { default: null }, getKeyboardNavigationAttributes: { default: l } }, data() { return { inputId: s() }; }, computed: { tdClass() { const { className: e } = this.$props; return { "k-table-td": !0, [e]: e }; } }, methods: { triggerKeydown(e) { this.$emit("cellkeydown", { event: e, dataItem: this.$props.dataItem, field: this.$props.field }); }, handleOnChange(e) { this.$emit("selectionchange", { event: e, dataItem: this.$props.dataItem }); } }, render() { const e = d(this.$props.field, this.$props.dataItem), a = this.$props.render, n = this.getKeyboardNavigationAttributes(this.$props.id), i = this.$props.rowType !== "groupHeader" ? t("td", { style: this.$attrs.style, onKeydown: this.triggerKeydown, colspan: this.$props.colSpan, class: this.tdClass, "aria-colindex": this.$props.ariaColumnIndex, role: "gridcell", tabindex: n.tabIndex, "data-keyboardnavlevel": n[c], "data-keyboardnavid": n[h] }, [t("span", { class: "k-checkbox-wrap" }, [t("input", { checked: e, id: this.inputId, type: "checkbox", class: "k-checkbox k-checkbox-md k-rounded-md", onChange: this.handleOnChange }, null)]), t("label", { class: "k-checkbox-label", for: this.inputId }, null)]) : null; return p.call(this, { h: r, template: a, defaultRendering: i, additionalProps: this.$props, additionalListeners: { keydown: this.triggerKeydown, change: this.handleOnChange } }); } }); export { k as GridSelectionCell };