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