UNPKG

@progress/kendo-react-grid

Version:

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

75 lines (74 loc) 2.67 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import { classNames as v } from "@progress/kendo-react-common"; import * as r from "react"; import { GridGroupCellToggle as w } from "./client/GridGroupCellToggle.mjs"; import { GridGroupCellContainer as k } from "./client/GridGroupCellContainer.mjs"; import { getClientCellProps as N, isClientReference as I } from "../utils/index.mjs"; const K = (l) => { const { columnIndex: t, level: m, columnsCount: u, rowType: p, dataItem: n, field: S, expanded: x, render: R, ariaColumnIndex: E } = l, o = S || ""; let e = null, a = null, d = null, f = !1, c = !1, g = !1; const i = N(l); t === void 0 || m === void 0 || t < m || u === void 0 || p !== "groupHeader" || n[o] === void 0 ? (c = !0, e = { style: l.style, key: "g" + t, className: v("k-table-td", "k-group-cell", { "k-grid-content-sticky": l.locked }), role: "gridcell" }) : t === m && (c = !0, e = { className: "k-table-td", style: l.style, colSpan: u - t, key: "g-colspan", role: "gridcell", "aria-selected": !1, "aria-expanded": x, "aria-colindex": E }, d = /* @__PURE__ */ r.createElement("p", { className: "k-reset" }, /* @__PURE__ */ r.createElement(w, { ...i }), n[o] instanceof Date && n[o].toString ? n[o].toString() : n[o]), f = !0, l.locked && (g = !0, e = { ...e, colSpan: 0, style: { ...l.style, position: "sticky", zIndex: 2 } }, a = { className: "k-table-td", role: "gridcell", colSpan: u - t, style: { borderLeftWidth: 0, borderRightWidth: 0 } })); const y = l.rowType || "data", s = l.cells; if (s && s.group && s.group[y]) { const C = s.group[y], b = I(C); return /* @__PURE__ */ r.createElement( k, { cellProps: i, tdProps: e, td2Props: a, isCustom: !0, isClient: b, addKeyDownHandler: !0 }, /* @__PURE__ */ r.createElement(C, { ...i, tdProps: e, td2Props: a }, d) ); } const G = c ? /* @__PURE__ */ r.createElement("td", { ...e, key: e == null ? void 0 : e.key }, d) : null; return /* @__PURE__ */ r.createElement( k, { cellProps: i, addKeyDownHandler: f, tdProps: e, td2Props: a, renderFirstCell: c, renderSecondCell: g, content: d }, G ); }; export { K as GridGroupCell };