UNPKG

@progress/kendo-react-grid

Version:

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

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