@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
70 lines (69 loc) • 2.18 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
*-------------------------------------------------------------------------------------------
*/
"use client";
import * as n from "react";
import { classNames as w } from "@progress/kendo-react-common";
import { handleStackedKeyboardNavigation as D } from "@progress/kendo-react-data-tools";
const S = (l) => {
const {
header: e,
children: m,
isInEdit: i,
editMode: u,
className: r,
columnIndex: f,
id: k,
style: h,
onClick: y,
onKeyDown: C,
cellRef: t
} = l, d = n.useRef(null), [s, o] = n.useState(!1), N = w("k-grid-stack-cell", r, {
"k-focus": s,
"k-grid-stack-edit-cell": i
}), I = s ? 0 : -1, g = (c) => {
const a = d.current;
a && D({
event: c,
cellElement: a,
onKeyDown: C,
isInEdit: i,
editMode: u
});
}, E = () => {
o(!0);
}, K = (c) => {
var a;
(a = d.current) != null && a.contains(c.relatedTarget) || o(!1);
}, R = n.useCallback(
(c) => {
d.current = c, typeof t == "function" ? t(c) : t && "current" in t && (t.current = c);
},
[t]
);
return /* @__PURE__ */ n.createElement(
"div",
{
ref: R,
className: N,
"data-grid-col-index": f,
id: k,
style: h,
tabIndex: I,
onClick: y,
onKeyDown: g,
onFocus: E,
onBlur: K
},
e && /* @__PURE__ */ n.createElement("div", { className: "k-grid-stack-header" }, e),
/* @__PURE__ */ n.createElement("div", { className: "k-grid-stack-content" }, m)
);
}, b = n.memo(S, (l, e) => l.header === e.header && l.children === e.children && l.isInEdit === e.isInEdit && l.editMode === e.editMode && l.className === e.className && l.columnIndex === e.columnIndex && l.id === e.id && l.style === e.style && l.onClick === e.onClick && l.onKeyDown === e.onKeyDown);
b.displayName = "KendoReactGridStackedCell";
export {
b as GridStackedCell
};