UNPKG

@progress/kendo-react-grid

Version:

React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package

62 lines (61 loc) 1.89 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ "use client"; import * as i from "react"; import { useTableKeyboardNavigation as m } from "@progress/kendo-react-data-tools"; import { GridContext as x } from "../../GridClientWrapper.mjs"; import { cloneReactElement as r } from "../../utils/index.mjs"; const I = (t) => { var c; const { cellProps: e } = t, n = i.useContext(x), d = m(e.id), s = { onContextMenu: i.useCallback( (o) => { n != null && n.onContextMenu && n.onContextMenu.call(void 0, o, e.dataItem, e.field); }, [n, e.dataItem, e.field] ) }, u = n.getCellPositionStyle(e.columnPosition), C = { style: { ...(c = t.tdProps) == null ? void 0 : c.style, ...u } }, l = { ...d, ...s, ...C }, a = { onContextMenu: n.onContextMenu, onChange: n.itemChange, selectionChange: (o) => { n.selectionChange({ event: o, dataItem: e.dataItem, dataIndex: e.rowDataIndex, columnIndex: e.columnIndex }); } }; if (t.isCustom) return n.isClient || t.isClient ? r(t.children, { // pass down to tdProps for client templates tdProps: { ...t.tdProps, ...l }, ...a }) : r(t.children, { ...l }); if (e.render) { const o = e.rowType !== "groupHeader" ? /* @__PURE__ */ i.createElement("td", { ...t.tdProps, ...l }, t.content) : null; return e.render.call(void 0, o, { ...e, ...a }); } return t.children && r(t.children, { ...l }); }; export { I as GridSelectionCellContainer };