UNPKG

@progress/kendo-react-grid

Version:

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

40 lines (39 loc) 1.57 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 m from "react"; import { useLocalization as g } from "@progress/kendo-react-intl"; import { GridColumnMenuItemGroup as s } from "./GridColumnMenuItemGroup.mjs"; import { GridColumnMenuItem as d } from "./GridColumnMenuItem.mjs"; import { messages as C, groupColumn as p, ungroupColumn as G } from "../messages/index.mjs"; import { groupIcon as I, ungroupIcon as M } from "@progress/kendo-svg-icons"; const L = (o) => { const c = (n) => { if (n.preventDefault(), o.onGroupChange) { if (!o.column.field) return; const e = (o.group || []).slice(), t = e.findIndex((a) => a.field === o.column.field); t > -1 ? e.splice(t, 1) : e.push({ field: o.column.field }), o.onGroupChange(e, n); } o.onCloseMenu && o.onCloseMenu(); }, { group: i, column: l } = o, f = g(), u = !!(i && l.field && i.find((n) => n.field === l.field)), r = u ? G : p; return /* @__PURE__ */ m.createElement(s, null, /* @__PURE__ */ m.createElement( d, { title: f.toLanguageString(r, C[r]), iconClass: u ? "k-i-ungroup" : "k-i-group", svgIcon: u ? M : I, onClick: c } )); }; export { L as GridColumnMenuGroup };