@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.19 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 k=require("react"),a=require("@progress/kendo-react-common"),v=require("../constants/index.js"),O=require("../utils/GridContext.js");function S(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const c=S(k),G=e=>{var w;const r=c.useContext(O.GridContext),{reorderRowDropTargetRef:n,reorderRowDragTargetRef:t,activeDragRowDataItemRef:R}=r,{rowType:i,isAltRow:b,isInEdit:f,isSelected:m,isHighlighted:y}=e,d=a.useUnstyled(),D=d&&d.uGrid?d.uGrid:a.uGrid,h=a.classNames(D.tr({selected:m,highlighted:y,isHeader:i==="groupHeader",isFooter:i==="groupFooter",isMaster:i!=="groupHeader"&&i!=="groupFooter",isAltRow:b,isInEdit:f})),s=c.useRef(null),x=o=>{if(e.isRowReorderable&&R.current){const T=o.originalEvent.target;n.current=T.closest(".k-table-row")}},I=()=>{t.current&&e.isRowReorderable&&(t.current.style.userSelect="")};a.useDroppable(s,{onDragOver:x,onDrop:I});const C={onClick:o=>r.rowClick(o,e.dataItem),onDoubleClick:o=>r.rowDblClick(o,e.dataItem)},u={ref:s,id:e.id,...C,className:h,style:{height:e.rowHeight?e.rowHeight+"px":"",visibility:e.isHidden?"hidden":"",userSelect:(w=t==null?void 0:t.current)==null?void 0:w.style.userSelect},role:"row","aria-rowindex":e.ariaRowIndex,"absolute-row-index":e.absoluteRowIndex,[v.GRID_ROW_INDEX_ATTRIBUTE]:e.rowType==="data"?e.dataIndex:void 0},g=e.rowType||"data",l=e.rows;if(l&&l[g]){const o=l[g];return c.createElement(o,{key:e.absoluteRowIndex,...e,trProps:u},e.children)}return c.createElement("tr",{key:e.absoluteRowIndex,...u},e.children)};exports.GridRow=G;