UNPKG

@progress/kendo-vue-editor

Version:
84 lines (83 loc) 2.27 kB
/** * @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 w, createVNode as t } from "vue"; import { formatString as m } from "../utils.mjs"; const M = "k-ct-cell k-disabled", k = "k-selected", b = /* @__PURE__ */ w({ name: "KendoPopupGrid", props: { rows: Number, columns: Number, createTableMessage: String, createTableHintMessage: String, onCellclick: Function, onDown: Function }, data() { return { row: -1, col: -1 }; }, render() { const o = [], s = this.$props.columns * this.$props.rows, { row: c, col: n } = this.$data; let i = this.$props.createTableMessage; n > -1 && (i = m(this.$props.createTableHintMessage, c + 1, n + 1)); const a = function(e, h, p) { const l = Math.floor(e / this.$props.columns), r = e % this.$props.columns, d = r <= p && l <= h; return t("span", { class: M + (d ? ` ${k}` : ""), onMouseenter: () => this.cellMouseEnter({ row: l, col: r }), onClick: () => this.onCellClick(l, r), key: e }, null); }; for (let e = 0; e < s; e++) o.push(a.call(this, e, c, n)); const u = [t("div", { onMouseleave: () => this.handleMouseLeave(), key: "cells", style: { borderColor: "inherit" }, onPointerdown: this.onMouseDown, onMousedown: this.onDown }, [o]), t("div", { class: "k-status", key: "status", onPointerdown: this.onMouseDown, onMousedown: this.onDown }, [i])]; return t("span", null, [u]); }, methods: { cellMouseEnter({ row: o, col: s }) { this.row = o, this.col = s; }, handleMouseLeave() { this.row = -1, this.col = -1; }, onCellClick(o, s) { this.$emit("cellclick", o, s); }, onMouseDown(o) { this.$emit("down", o); } } }); export { b as PopupGrid };