UNPKG

@progress/kendo-react-grid

Version:

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

59 lines (58 loc) 2.18 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 { GroupingIndicator as v } from "../drag/GroupingIndicator.mjs"; import { useLocalization as G } from "@progress/kendo-react-intl"; import { groupPanelAriaLabel as g, messages as u, groupPanelEmpty as m } from "../messages/index.mjs"; import { GridContext as L } from "../utils/GridContext.mjs"; const b = (t) => { const n = i.useContext(L), p = (r, e) => { const o = t.group.slice(); o.splice(e, 1), n.groupChange(o, r); }, d = (r, e, o, a) => { const h = Object.assign({}, o, { dir: a }), s = t.group.slice(); s.splice(e, 1, h), n.groupChange(s, r); }, l = G(), f = t.group || [], C = (r) => { const e = t.columns.find((a) => a.field === r), o = e && (e.title || e.field); return o === void 0 ? r : o; }, c = f.map((r, e) => /* @__PURE__ */ i.createElement( v, { key: e, index: e, dir: r.dir || "asc", title: C(r.field), onRemove: (o) => { p(o, e); }, onSortChange: (o, a) => { d(o, e, r, a); }, onPress: n.dragLogicRef.current.pressHandler, onDrag: n.dragLogicRef.current.dragHandler, onRelease: n.dragLogicRef.current.releaseHandler, onContextMenu: n.onContextMenu } )); return /* @__PURE__ */ i.createElement( "div", { ref: n.dragLogicRef.current.refGroupPanelDiv, className: "k-grouping-header", role: "toolbar", "aria-label": l.toLanguageString(g, u[g]), "aria-controls": t.ariaControls || "" }, /* @__PURE__ */ i.createElement("div", { className: "k-chip-list k-chip-list-md", role: "none" }, c), /* @__PURE__ */ i.createElement("div", { className: "k-grouping-drop-container" }, !c.length && l.toLanguageString(m, u[m]), " ") ); }; export { b as GroupPanel };