@progress/kendo-react-editor
Version:
React Editor enables users to create rich text content through a WYSIWYG interface. KendoReact Editor package
52 lines (51 loc) • 1.79 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 * as l from "react";
import { formatString as a } from "../utils.mjs";
const i = "k-ct-cell k-disabled", p = "k-selected";
class m extends l.Component {
constructor() {
super(...arguments), this.state = { row: -1, col: -1 };
}
renderCell(t, n, o) {
const s = Math.floor(t / this.props.columns), e = t % this.props.columns, r = e <= o && s <= n;
return /* @__PURE__ */ l.createElement(
"span",
{
className: i + (r ? ` ${p}` : ""),
onMouseEnter: () => this.setState({ row: s, col: e }),
onClick: () => this.props.onCellClick.call(void 0, s, e),
key: t
}
);
}
render() {
const t = [], n = this.props.columns * this.props.rows, { row: o, col: s } = this.state, { onDown: e } = this.props;
let r = this.props.createTableMessage;
s > -1 && (r = a(this.props.createTableHintMessage, o + 1, s + 1));
for (let c = 0; c < n; c++)
t.push(this.renderCell(c, o, s));
return [
/* @__PURE__ */ l.createElement(
"div",
{
onMouseLeave: () => this.setState({ row: -1, col: -1 }),
key: "cells",
style: { borderColor: "inherit" },
onPointerDown: e,
onMouseDown: e
},
t
),
/* @__PURE__ */ l.createElement("div", { className: "k-status", key: "status", onPointerDown: e, onMouseDown: e }, r)
];
}
}
export {
m as default
};