UNPKG

@progress/kendo-react-grid

Version:

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

64 lines (63 loc) 2.62 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 o from "react"; import { Draggable as h, IconWrap as l, Keys as i } from "@progress/kendo-react-common"; import { sortAscSmallIcon as C, sortDescSmallIcon as D, xCircleIcon as R } from "@progress/kendo-svg-icons"; const I = (n) => { const a = o.useRef(null), s = (e) => { const t = a.current && a.current.element; t && n.onPress && n.onPress(e.event, t); }, r = (e) => { const t = a.current && a.current.element; t && n.onDrag && n.onDrag(e.event, t); }, m = (e) => { a.current && a.current.element && n.onRelease && n.onRelease(e.event); }, d = (e) => { if (e.preventDefault(), n.onSortChange) { const t = n.dir === "asc" ? "desc" : "asc"; n.onSortChange(e, t); } }, u = (e) => { (e.keyCode === i.delete || e.keyCode === i.backspace) && (e.preventDefault(), e.stopPropagation(), n.onRemove && n.onRemove(e)); }, f = (e) => { e.preventDefault(), e.stopPropagation(), n.onRemove && n.onRemove(e); }, k = (e) => { const t = { title: n.title, dir: n.dir, index: n.index }; n.onContextMenu && n.onContextMenu.call(void 0, e, { dataItem: { ...t } }); }, { dir: c, title: g } = n; return /* @__PURE__ */ o.createElement(h, { onPress: s, onDrag: r, onRelease: m, ref: a }, /* @__PURE__ */ o.createElement( "div", { className: "k-chip k-chip-md k-chip-solid k-chip-solid-base k-rounded-md", onClick: d, onContextMenu: k, onKeyDown: u, tabIndex: 0, role: "button", style: { touchAction: "none" } }, /* @__PURE__ */ o.createElement("span", null, /* @__PURE__ */ o.createElement( l, { name: "sort-" + c + "-small", icon: c === "asc" ? C : D, size: "small" } )), /* @__PURE__ */ o.createElement("span", { className: "k-chip-content" }, /* @__PURE__ */ o.createElement("span", { className: "k-chip-label" }, g)), /* @__PURE__ */ o.createElement("span", { className: "k-chip-actions" }, /* @__PURE__ */ o.createElement("span", { className: "k-chip-action k-chip-remove-action", onClick: f }, /* @__PURE__ */ o.createElement(l, { name: "x-circle", icon: R, size: "small" }))) )); }; export { I as GroupingIndicator };