@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
45 lines (44 loc) • 1.49 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
*-------------------------------------------------------------------------------------------
*/
"use client";
import * as a from "react";
import { GridContext as m } from "../../utils/GridContext.mjs";
import { useTableKeyboardNavigation as s, GROUP_EXPAND_ACTION as f } from "@progress/kendo-react-data-tools";
import { Keys as y } from "@progress/kendo-react-common";
import { useContextMenuHandler as p, usePositionStyle as x } from "../hooks.mjs";
const b = (t, o) => {
const e = a.useContext(m), d = s(t.id), i = p(t.dataItem, t.field), u = x(t), r = a.useCallback(
(n) => {
n.isDefaultPrevented() || n.keyCode === y.enter && (e != null && e.itemChange) && (n.preventDefault(), e.itemChange({
dataItem: t.dataItem,
dataIndex: t.dataIndex,
syntheticEvent: n,
field: void 0,
value: !t.expanded
}), e == null || e.dispatchGroupExpand(
{
type: f.TOGGLE,
group: t.group
},
n
));
},
[e, t.dataItem, t.dataIndex, t.expanded, t.group]
);
return {
...d,
...o ? {
onKeyDown: r
} : {},
onContextMenu: i,
style: u
};
};
export {
b as useGroupCellClientTdProps
};