@progress/kendo-react-grid
Version:
React Data Grid (Table) provides 100+ ready-to-use data grid features. KendoReact Grid package
10 lines (9 loc) • 2.08 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";
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),P=require("../drag/GroupingIndicator.js"),C=require("@progress/kendo-react-intl"),c=require("../messages/index.js"),G=require("../utils/GridContext.js");function v(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(n,a,s.get?s:{enumerable:!0,get:()=>t[a]})}}return n.default=t,Object.freeze(n)}const l=v(b),R=t=>{const n=l.useContext(G.GridContext),a=(o,e)=>{const r=t.group.slice();r.splice(e,1),n.groupChange(r,o)},s=(o,e,r,i)=>{const f=Object.assign({},r,{dir:i}),d=t.group.slice();d.splice(e,1,f),n.groupChange(d,o)},u=C.useLocalization(),p=t.group||[],m=o=>{const e=t.columns.find(i=>i.field===o),r=e&&(e.title||e.field);return r===void 0?o:r},g=p.map((o,e)=>l.createElement(P.GroupingIndicator,{key:e,index:e,dir:o.dir||"asc",title:m(o.field),onRemove:r=>{a(r,e)},onSortChange:(r,i)=>{s(r,e,o,i)},onPress:n.dragLogicRef.current.pressHandler,onDrag:n.dragLogicRef.current.dragHandler,onRelease:n.dragLogicRef.current.releaseHandler,onContextMenu:n.onContextMenu}));return l.createElement("div",{ref:n.dragLogicRef.current.refGroupPanelDiv,className:"k-grouping-header",role:"toolbar","aria-label":u.toLanguageString(c.groupPanelAriaLabel,c.messages[c.groupPanelAriaLabel]),"aria-controls":t.ariaControls||""},l.createElement("div",{className:"k-chip-list k-chip-list-md",role:"none"},g),l.createElement("div",{className:"k-grouping-drop-container"},!g.length&&u.toLanguageString(c.groupPanelEmpty,c.messages[c.groupPanelEmpty])," "))};exports.GroupPanel=R;