@progress/kendo-react-grid 7.3.0-develop.2 → 7.3.0-develop.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Grid.js CHANGED
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const we=require("react"),s=require("prop-types"),u=require("@progress/kendo-react-common"),p=require("@progress/kendo-react-data-tools"),ke=require("./cells/GridSelectionCell.js"),Ie=require("./cells/GridHierarchyCell.js"),Ee=require("./cells/GridEditCell.js"),xe=require("./header/Header.js"),_e=require("./header/HeaderRow.js"),ze=require("./header/FilterRow.js"),De=require("./header/GroupPanel.js"),He=require("./footer/Footer.js"),ae=require("@progress/kendo-react-intl"),O=require("./messages/index.js"),Te=require("./VirtualScroll.js"),A=require("./VirtualScrollFixed.js"),Ne=require("./drag/ColumnResize.js"),Me=require("./drag/CommonDragLogic.js"),v=require("./utils/index.js"),Fe=require("./cells/GridCell.js"),ie=require("./cells/GridGroupCell.js"),Le=require("./rows/GridRow.js"),Ge=require("./header/GridHeaderSelectionCell.js"),Oe=require("./GridNoRecords.js"),oe=require("./filterCommon.js"),Ae=require("./footer/FooterRow.js"),Ke=require("./paging/GridPagerSettings.js"),re=require("./package-metadata.js"),qe=require("./cells/GridDetailCell.js"),Pe=require("./cells/GridDetailHierarchyCell.js");function Ve(D){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(D){for(const c in D)if(c!=="default"){const g=Object.getOwnPropertyDescriptor(D,c);Object.defineProperty(a,c,g.get?g:{enumerable:!0,get:()=>D[c]})}}return a.default=D,Object.freeze(a)}const r=Ve(we),z=class z extends r.Component{constructor(a){super(a),this._columns=[],this._columnsMap=[[]],this._columnsMutations=0,this._resized=!1,this._shouldUpdateLeftRight=!0,this.contextStateRef={current:void 0},this.navigationStateRef={current:void 0},this._data=[],this._slicedData=void 0,this.wrapperScrollTop=0,this.showLicenseWatermark=!1,this.headerRef=r.createRef(),this.headerElementRef=r.createRef(),this._element=null,this.tableElement=null,this.containerRef=r.createRef(),this.tableBodyRef=r.createRef(),this._footer=null,this.forceUpdateTimeout=void 0,this.isRtl=!1,this.observer=null,this.handleIntersection=e=>{const t={rowIndex:this.rowIndex};e.forEach(i=>{i.isIntersecting||this.setCurrentOnTop(t)})},this.setCurrentOnTop=e=>{if(!this.vs.container||this.props.scrollable==="none")return;this.observer&&this.observer.disconnect();const{rowIndex:t}=e;if(this.props.scrollable==="virtual")this.vs.askedSkip=t,this.vs.container.scroll(0,Math.round(this.vs.askedSkip/this.vs.total*this.vs.container.scrollHeight));else if(this.element){const i=t<1?this.element.querySelector("tbody > tr:nth-child(1)"):this.element.querySelector(`tbody > tr:nth-child(${t+1})`);i&&this.containerRef.current&&(this.containerRef.current.scrollTop=i.offsetTop)}},this.scrollIntoView=e=>{if(!this.vs.container||this.props.scrollable==="none")return;this.rowIndex=e.rowIndex;const{rowIndex:t}=e,i=this.element;if(this.observer&&i){this.observer.disconnect();const n=i.querySelector(`[absolute-row-index="${t}"]`);n?this.observer.observe(n):this.setCurrentOnTop(e)}},this.fitColumns=e=>{this.columnResize.dblClickHandler(null,e)},this.onContextMenu=(e,t,i)=>{if(this.props.onContextMenu){const n={target:this,syntheticEvent:e,nativeEvent:e.nativeEvent,dataItem:t,field:i};this.props.onContextMenu.call(void 0,n)}},this.getVirtualScroll=e=>{const{rowHeight:t,detailRowHeight:i,detail:n,expandField:h,groupable:l}=e,d=this.isAllData(),R=t!==void 0&&t>0,w=i!==void 0&&i>0,x=l===!0||typeof l=="object"&&l.enabled!==!1;return!R||x&&!d||!!(n&&h)&&(!w||!d)?Te.VirtualScroll:A.VirtualScrollFixed},this.isAllData=()=>{const{data:e,total:t}=this.props;return Array.isArray(e)?e.length===t:e?t===e.total:!1},this.initializeVirtualization=(e,t)=>{if(this.reInitVirtualization(this.props.scrollable==="virtual",this.props.total,this.props.filter,this.props.group,this.props.sort,t||this.props.rowHeight===void 0||this.props.rowHeight===0),this.vs.fixedScroll=this.props.fixedScroll||!1,this.vs.PageChange=this.pageChange,this.vs.realSkip=this.props.skip||0,this.vs.pageSize=(this.props.take!==void 0?this.props.take:this.props.pageSize)||0,this.vs.scrollableVirtual=this.props.scrollable==="virtual",this.vs.total=e,this.vs.propsSkip=(this.props.skip||0)+(this.props.scrollable==="virtual"?this.vs.topCacheCount+(this.vs.attendedSkip-(this.props.skip||0)):0),this.props.rowHeight!==void 0&&this.props.rowHeight>0&&!t){const i=this.props.rowHeight*e;this.vs.containerHeight=v.firefox?Math.min(v.firefoxMaxHeight,i):i}else this.vs.containerHeight=1533915;if(this.vs.containerRef=this.containerRef,this.vs.tableBodyRef=this.tableBodyRef,this.vs.table=this.tableElement,this._slicedData=void 0,this.vs instanceof A.VirtualScrollFixed){const{rowHeight:i=0,detail:n,expandField:h}=this.props;let{detailRowHeight:l=0}=this.props;l=n&&h?l:i,this.isAllData()?(this.vs.total=this._data.length,this._slicedData=this._data.slice(this.vs.realSkip,this.vs.realSkip+this.vs.pageSize),this.vs.rowHeightService=this.rowHeightService(this.vs,this._data.length,i,l,this._data)):this.vs.rowHeightService=new A.RowHeightService(e,i,l);const d=this.vs.rowHeightService.totalHeight();this.vs.containerHeight=v.firefox?Math.min(v.firefoxMaxHeight,d):d}},this.scrollHandler=e=>{if(e.target!==e.currentTarget)return;clearTimeout(this.forceUpdateTimeout),this.vs.table=this.tableElement;const t=e.currentTarget.scrollLeft,i=e.currentTarget.scrollTop;this.props.columnVirtualization&&(!this.vs.scrollableVirtual||i===this.wrapperScrollTop)&&(this.forceUpdateTimeout=window.setTimeout(()=>{this.forceUpdate()},0)),this._header&&this._header.setScrollLeft(t),this._footer&&this._footer.setScrollLeft(t),this.vs&&i!==this.wrapperScrollTop&&this.vs.scrollHandler(e),u.dispatchEvent(this.props.onScroll,e,this,void 0),this.wrapperScrollTop=i},this.onKeyDown=e=>{if(p.tableKeyboardNavigation.onKeyDown(e,{contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef,onNavigationAction:this.onNavigationAction}),this.props.onKeyDown){const{mode:t,cell:i}=p.getSelectionOptions(this.props.selectable),n={dataItems:this.getLeafDataItems(),mode:t,cell:i,componentId:this._gridId,selectedField:this.props.selectedField,...this.getArguments(e)};this.props.onKeyDown.call(void 0,n)}},this.onFocus=e=>{p.tableKeyboardNavigation.onFocus(e,{contextStateRef:this.contextStateRef})},this.onNavigationAction=e=>{if(this.props.onNavigationAction){const t={focusElement:e.focusElement,...this.getArguments(e.event)};this.props.onNavigationAction.call(void 0,t)}},this.rowClick=(e,t)=>{this.props.onRowClick&&e.target.nodeName==="TD"&&this.props.onRowClick.call(void 0,{dataItem:t.dataItem,...this.getArguments(e)})},this.rowDblClick=(e,t)=>{this.props.onRowDoubleClick&&e.target.nodeName==="TD"&&this.props.onRowDoubleClick.call(void 0,{dataItem:t.dataItem,...this.getArguments(e)})},this.itemChange=e=>{const t=this.props.onItemChange;if(e.field===this.props.expandField||this.props.group&&e.field===void 0){const i=this.props.onExpandChange;i&&i.call(void 0,{...this.getArguments(e.syntheticEvent),dataItem:e.dataItem,dataIndex:e.dataIndex,value:e.value});return}t&&t.call(void 0,{...this.getArguments(e.syntheticEvent),dataItem:e.dataItem,field:e.field,value:e.value})},this.onHeaderSelectionChange=e=>{this.props.onHeaderSelectionChange&&this.props.onHeaderSelectionChange.call(void 0,{field:e.field,nativeEvent:e.syntheticEvent&&e.syntheticEvent.nativeEvent,syntheticEvent:e.syntheticEvent,target:this,dataItems:this.getLeafDataItems(),selectedField:this.props.selectedField})},this.selectionRelease=e=>{if(this.props.onSelectionChange){const t={syntheticEvent:void 0,target:this,selectedField:this.props.selectedField||"",componentId:this._gridId,dataItems:this.getLeafDataItems(),dataItem:null,...e};this.props.onSelectionChange.call(void 0,t)}},this.pageChange=(e,t,i)=>{this.raiseDataEvent(this.props.onPageChange,{page:e},{skip:e.skip,take:e.take},t,i)},this.pagerPageChange=e=>{this.pageChange({skip:e.skip,take:e.take},e.syntheticEvent,e.targetEvent)},this.sortChange=(e,t)=>{this.raiseDataEvent(this.props.onSortChange,{sort:e},{sort:e,...this.props.scrollable==="virtual"?{skip:0}:{}},t)},this.filterChange=(e,t)=>{this.raiseDataEvent(this.props.onFilterChange,{filter:e},{filter:e||void 0,skip:0},t)},this.groupChange=(e,t)=>{const i=t.nativeEvent?t:{nativeEvent:t.nativeEvent||t.originalEvent};this.raiseDataEvent(this.props.onGroupChange,{group:e},{group:e,skip:0},i)},this.onClipboard=(e,t)=>{if(this.props.onClipboard){if(!this.inActiveElement()||!e)return;this.props.onClipboard.call(void 0,{type:e,nativeEvent:t,columns:this._columns,dataItemKey:this.props.dataItemKey||"",...typeof this.props.clipboard!="boolean"?this.props.clipboard:{}})}},this.inActiveElement=()=>{var h,l,d;if(!u.canUseDOM)return!1;const e=u.getActiveElement(this.document),t=e?e.matches(".k-table-td")?e:(h=this.document)==null?void 0:h.body:(l=this.document)==null?void 0:l.body,i=t.closest(".k-grid-container"),n=t&&((d=this._element)==null?void 0:d.contains(t));return!!(t&&n&&i)},this.onResize=(e,t,i,n,h,l)=>{this.resetTableWidth(),this._shouldUpdateLeftRight=!0,this._resized=!0,this._columnsMutations++,this.props.onColumnResize&&this.props.onColumnResize.call(void 0,{columns:this.columns,nativeEvent:n,targetColumnId:l,index:e,newWidth:t,oldWidth:i,end:h,target:this})},this.reInitVirtualization=u.memoizeOne((e,t,i,n,h,l)=>{this.vs.reset();const d=this.getVirtualScroll(this.props);this.vs=new d(l)}),this.flatData=u.memoizeOne((e,t,i,n,h,l,d)=>{const R=[],w=v.flatData(R,e,t,{index:i},n!==void 0,h);return{flattedData:R,resolvedGroupsCount:w}}),this.rowHeightService=u.memoizeOne((e,t,i,n,h)=>new A.RowHeightService(t,i,n,h)),this.childrenToArray=u.memoizeOne(e=>r.Children.toArray(e)),this.readColumns=u.memoizeOne((e,t,i)=>{const n=e.filter(h=>h&&h.type&&h.type.displayName==="KendoReactGridColumn");return v.readColumns(n,this.columns,{prevId:0,idPrefix:t})}),this.mapColumns=u.memoizeOne(e=>p.mapColumns(e)),this.configureColumns=u.memoizeOne((e,t,i)=>{this.props.selectedField&&e.filter(l=>l.field===this.props.selectedField).forEach(l=>{l.width=l.width||"50px",l.cell=l.cell||ke.GridSelectionCell,l.headerCell=l.headerCell||Ge.GridHeaderSelectionCell});const n={id:"",resizable:!0,width:"32px",title:" ",declarationIndex:-1,orderIndex:-1,children:[],parentIndex:-1,depth:0,colSpan:0,rowSpan:0,left:0,right:0,index:0,rightBorder:!1,ariaColumnIndex:0,isAccessible:!0};let h=0;this.props.expandField&&this.props.onExpandChange&&this.props.detail&&(e.unshift({...n,cell:Ie.GridHierarchyCell,field:this.props.expandField,headerClassName:"k-hierarchy-cell k-header",id:p.tableKeyboardNavigationTools.generateNavigatableId(`${this._columns.length}`,i,"column")}),h++);for(let l=0;l<t;l++)e.unshift({...n,isAccessible:!1,cell:ie.GridGroupCell,field:"value",locked:this.props.lockGroups}),h++;e.slice(h).forEach(l=>l.parentIndex>=0&&(l.parentIndex+=h))}),this.getHeaderRow=u.memoizeOne((e,t,i,n,h,l,d,R,w,x,y,F)=>r.createElement(_e.HeaderRow,{cells:this.props.cells,sort:e,sortable:t,sortChange:this.sortChange,group:i||[],groupable:n,groupChange:this.groupChange,filter:h,filterable:l,filterOperators:d,filterChange:this.filterChange,columnMenu:w,selectionChange:this.onHeaderSelectionChange,columns:x,columnResize:this.columnResize,pressHandler:this.dragLogic.pressHandler,dragHandler:this.dragLogic.dragHandler,releaseHandler:this.dragLogic.releaseHandler,columnsMap:y,cellRender:R,isRtl:F,dragClue:this.dragLogic.dragClueRef,headerRef:this.headerElementRef,containerRef:this.containerRef})),this.resolveTitle=e=>{const t=this._columns.find(n=>n.field===e),i=t&&(t.title||t.field);return i===void 0?e:i},this.getLeafDataItems=()=>this._data.filter(e=>e.rowType==="data").map(e=>e.dataItem),u.validatePackage(re.packageMetadata),this.showLicenseWatermark=u.shouldShowValidationUI(re.packageMetadata);const c=this.props.groupable===!0||typeof this.props.groupable=="object"&&this.props.groupable.enabled!==!1,g=this.getVirtualScroll(a);this.vs=new g(c||a.rowHeight===void 0||a.rowHeight===0),this.dragLogic=new Me.CommonDragLogic(this.columnReorder.bind(this),this.groupReorder.bind(this),this.columnToGroup.bind(this)),this.columnResize=new Ne.ColumnResize(this.onResize),this.props.clipboard&&(this.clipboardService=new p.ClipboardService(this.onClipboard)),p.tableKeyboardNavigation.onConstructor({navigatable:!!a.navigatable,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef,idPrefix:this._gridId})}get columns(){const a=this._columns.filter(c=>c.declarationIndex>=0&&c.parentIndex===-1);return v.sanitizeColumns(a)}get element(){return this._element}get document(){if(u.canUseDOM)return this.element&&this.element.ownerDocument||document}get _header(){return this.headerRef.current}get _gridId(){return this.props.id+"-role-element-id"}componentDidMount(){this.resetTableWidth(),u.setScrollbarWidth();const a=p.isRtl(this.element);this.isRtl=a,p.tableKeyboardNavigation.onComponentDidMount({scope:this.element||void 0,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef}),this.isRtl&&this.forceUpdate();const c={rootMargin:"0px",threshold:.9};this.clipboardService&&this.clipboardService.addEventListeners(this.document),this.observer=u.canUseDOM&&window.IntersectionObserver&&new window.IntersectionObserver(this.handleIntersection,c)||null}getSnapshotBeforeUpdate(){return p.tableKeyboardNavigation.onGetSnapshotBeforeUpdate({document:this.document,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef}),null}componentDidUpdate(){this.resetTableWidth(),u.setScrollbarWidth(),this.vs.tableTransform&&this.vs.table&&(this.vs.table.style.transform=this.vs.tableTransform,this.vs.tableTransform=""),p.tableKeyboardNavigation.onComponentDidUpdate({scope:this.element||void 0,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef})}componentWillUnmount(){clearTimeout(this.forceUpdateTimeout),this.clipboardService&&this.clipboardService.removeEventListeners(this.document)}render(){var te;let a=this.props.total||0;const c=p.tableKeyboardNavigationTools.getIdPrefix(this.navigationStateRef),g=ae.provideLocalizationService(this);let e=[];Array.isArray(this.props.data)?(e=this.props.data,a=a||this.props.data.length):this.props.data&&(e=this.props.data.data,a=a||this.props.data.total);const t=typeof this.props.groupable=="object"&&this.props.groupable.footer||"none",{resolvedGroupsCount:i,flattedData:n}=this.flatData(e,t,this.props.skip||0,this.props.group,this.props.expandField,this.props.filter,this.props.sort);this._data=n;const h=this.props.groupable===!0||typeof this.props.groupable=="object"&&this.props.groupable.enabled!==!1;this.columnResize.resizable=this.props.resizable||!1,this.dragLogic.reorderable=this.props.reorderable||!1,this.dragLogic.groupable=h;const l=this.props.selectable&&this.props.selectable.drag?"none":void 0;this.initializeVirtualization(a,h);const d=this.childrenToArray(this.props.children);this.initColumns(d,i);const R=d.map(o=>o&&o.type&&o.type.displayName==="KendoReactGridToolbar"?r.cloneElement(o,{...o.props,ariaControls:this._gridId}):null),w=d.filter(o=>o&&o.type&&o.type.displayName==="KendoReactGridNoRecords"),x=d.filter(o=>o&&o.type&&o.type.displayName==="KendoReactGridStatusBar"),y=this._columns.filter(o=>o.children.length===0),F=h&&r.createElement(De.GroupPanel,{group:this.props.group||[],groupChange:this.groupChange,pressHandler:this.dragLogic.pressHandler,dragHandler:this.dragLogic.dragHandler,releaseHandler:this.dragLogic.releaseHandler,refCallback:this.dragLogic.refGroupPanelDiv,resolveTitle:this.resolveTitle,ariaControls:this._gridId,onContextMenu:this.onContextMenu}),{sort:le,sortable:ne,group:he,filter:pe,filterable:ce,filterOperators:de=oe.operators,headerCellRender:ue,columnMenu:ge}=this.props,U=r.createElement(xe.Header,{size:this.props.size,columnResize:this.columnResize,staticHeaders:this.props.scrollable!=="none",scrollableDataElement:()=>this.vs.container,draggable:this.props.reorderable||h,ref:this.headerRef,elemRef:this.headerElementRef,headerRow:this.getHeaderRow(le,ne,he,h,pe,ce,de,ue,ge,this._columns,this._columnsMap,this.isRtl),filterRow:this.props.filterable&&r.createElement(ze.FilterRow,{cells:this.props.cells,size:this.props.size,columns:this._columns,filter:this.props.filter,filterOperators:this.props.filterOperators||oe.operators,filterChange:this.filterChange,sort:this.props.sort,cellRender:this.props.filterCellRender,isRtl:this.isRtl,ariaRowIndex:this._columnsMap.length+1})||void 0,cols:y.map((o,m)=>r.createElement("col",{key:m.toString(),width:v.getColumnWidth(o)}))}),fe=this.vs&&this.vs.container&&this.vs.container.scrollLeft||0,me=parseFloat(((this.props.style||{}).width||"").toString()),{colSpans:be,hiddenColumns:ve}=p.tableColumnsVirtualization({enabled:this.props.columnVirtualization,columns:y,tableViewPortWidth:me,scrollLeft:fe}),Ce=(o,m,b)=>{let _=!1;const E=this.props.selectedField?v.getNestedValue(this.props.selectedField,o.dataItem):void 0;return{row:y.map((f,C)=>{if(ve[C])return null;const T=f.id?f.id:C,N=`${f.className?f.className+" ":""}${f.locked?"k-grid-content-sticky":""}`,k=f.left!==void 0?this.isRtl?{left:f.right,right:f.left}:{left:f.left,right:f.right}:{};let I=!1;if(f.editable&&this.props.editField){const S=v.getNestedValue(this.props.editField,o.dataItem);S&&(S===!0||S===f.field)&&(_=!0,I=!0)}const V=f.cell||I&&Ee.GridEditCell||Fe.GridCell;return r.createElement(V,{onContextMenu:this.onContextMenu,key:T,locked:this.props.lockGroups,id:p.tableKeyboardNavigationTools.generateNavigatableId(`${m}-${String(C)}`,c),colSpan:be[C],dataItem:o.dataItem,field:f.field,editor:f.editor,format:f.format,className:N,render:this.props.cellRender,cells:v.resolveCells(this.props.cells,f.cells),onChange:this.itemChange,selectionChange:this.props.onSelectionChange?S=>{this.selectionChange({event:S,dataItem:o.dataItem,dataIndex:b,columnIndex:C})}:void 0,columnIndex:C,columnsCount:y.length,rowType:o.rowType,level:o.level,expanded:o.expanded,dataIndex:o.dataIndex,style:k,ariaColumnIndex:f.ariaColumnIndex,isSelected:Array.isArray(E)&&E.indexOf(C)>-1})}),isInEdit:_,isSelected:typeof E=="boolean"&&E}};let W=0;if(this.props.scrollable==="virtual")for(let o=0;o<this.vs.topCacheCount+this.vs.attendedSkip-(this.props.skip||0);o++){const m=this._data.shift();if(m)this._data.push(m),W++,m.rowType==="groupHeader"&&o--;else break}const B=o=>o>=this._data.length-W;let $=this.vs.realSkip||0;const L=[];let q=!1;const P=this._columnsMap.length+(this.props.filterable?1:0)+1,j=r.createElement("div",{key:"no-records",className:"k-grid-norecords","aria-rowindex":P},r.createElement("div",{className:"k-grid-norecords-template"},w.length?w:r.createElement(Oe.GridNoRecords,null)));let H=0;if(this._data.length){let o=-1,m=0;(this._slicedData||this._data).forEach((b,_)=>{b.rowType==="data"&&($++,o++);const E=$%2===0,f=this.props.dataItemKey&&u.getter(this.props.dataItemKey)(b.dataItem),C=_+(this.vs.realSkip||0),T=f||"ai"+C,N=T+"_1",k=Ce(b,T,o);if(H=C+P+m,L.push(r.createElement(Le.GridRow,{key:T,dataItem:b.dataItem,isAltRow:E,isInEdit:k.isInEdit,rowType:b.rowType,isHidden:B(_),onClick:I=>this.rowClick(I,b),onDoubleClick:I=>this.rowDblClick(I,b),selectedField:this.props.selectedField,rowHeight:this.props.rowHeight,render:this.props.rowRender,ariaRowIndex:H,absoluteRowIndex:C,dataIndex:o,isSelected:k.isSelected},k.row)),this.props.detail&&b.rowType==="data"&&b.expanded){const I=y.length-(this.props.expandField?1:0)-(this.props.group?this.props.group.length:0)||1;m++,H=C+P+m,L.push(r.createElement("tr",{key:N,className:u.classNames("k-table-row",E?"k-detail-row k-table-alt-row k-alt":"k-detail-row"),style:{visibility:B(_)?"hidden":"",height:this.props.detailRowHeight},role:"row","aria-rowindex":H},this.props.group&&this.props.group.map((V,S)=>{var se;const M=(se=k==null?void 0:k.row[S])==null?void 0:se.props.style,Se=M?this.isRtl?{left:M.right,right:M.left}:{left:M.left,right:M.right}:{};return r.createElement(ie.GridGroupCell,{id:"",dataIndex:b.dataIndex,field:V.field,dataItem:b.dataItem,key:S,style:Se,ariaColumnIndex:1+S,isSelected:!1,locked:this.props.lockGroups,isRtl:this.isRtl,cells:this.props.cells})}),this.props.expandField&&r.createElement(Pe.GridDetailHierarchyCell,{id:p.tableKeyboardNavigationTools.generateNavigatableId(`${N}-dhcell`,c)}),r.createElement(qe.GridDetailCell,{onContextMenu:this.onContextMenu,dataItem:b.dataItem,dataIndex:b.dataIndex,colSpan:I,ariaColIndex:2+(this.props.group?this.props.group.length:0),detail:this.props.detail,id:p.tableKeyboardNavigationTools.generateNavigatableId(`${N}-dcell`,c)})))}})}else q=!0;const J={size:this.props.size,onPageChange:this.pagerPageChange,total:a,dir:this.isRtl?"rtl":void 0,skip:this.vs.propsSkip||0,take:(this.props.take!==void 0?this.props.take:this.props.pageSize)||10,messagesMap:O.pagerMessagesMap,...Ke.normalize(this.props.pageable||{})},Q=this.props.pager?r.createElement(this.props.pager,{...J}):r.createElement(p.Pager,{className:"k-grid-pager",...J}),Re=o=>this.props.sort&&this.props.sort.filter(m=>m.field===o).length>0,ye=(o,m)=>r.createElement("col",{key:m.toString(),width:v.getColumnWidth(o)}),X=(te=this.props.cells)!=null&&te.footerCell||this._columns.some(o=>{var m;return!!(o.footerCell||(m=o.cells)!=null&&m.footerCell)})?r.createElement(He.Footer,{size:this.props.size,columnResize:this.columnResize,staticHeaders:this.props.scrollable!=="none",ref:o=>this._footer=o,row:r.createElement(Ae.FooterRow,{cells:this.props.cells,columns:this._columns,isRtl:this.isRtl,ariaRowIndex:H+1}),cols:y.map(ye)}):null,Y=r.createElement("colgroup",{ref:o=>{this.columnResize.colGroupMain=o}},y.map((o,m)=>r.createElement("col",{key:m.toString(),className:Re(o.field)?"k-sorted":void 0,width:v.getColumnWidth(o)}))),Z=this.dragLogic.reorderable||this.dragLogic.groupable,ee=this.props.columnVirtualization?"block":"table";if(this.props.scrollable==="none")return r.createElement(p.TableKeyboardNavigationContext.Provider,{value:this.contextStateRef.current},r.createElement("div",{id:this.props.id,style:this.props.style,className:u.classNames("k-grid",{"k-grid-md":!this.props.size,[`k-grid-${u.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size},this.props.className),ref:o=>{this._element=o},"aria-label":this.props.ariaLabel,onKeyDown:this.onKeyDown,onFocus:this.onFocus,...p.tableKeyboardNavigationScopeAttributes},R,F,r.createElement(p.TableSelection,{selectable:this.props.selectable,onRelease:this.selectionRelease,childRef:o=>{this.tableElement=o}},r.createElement("table",{className:u.classNames("k-table k-grid-table",{[`k-table-${u.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size}),style:{userSelect:l,display:ee}},Y,U,r.createElement("tbody",{role:"rowgroup",className:"k-table-tbody",...p.tableKeyboardNavigationBodyAttributes},L),X)),q&&j,Z&&r.createElement(r.Fragment,null,r.createElement(p.DropClue,{ref:this.dragLogic.refDropElementClue}),r.createElement(p.DragClue,{ref:this.dragLogic.refDragElementClue}))),x,this.props.pageable&&Q);let G=this.props.style||{};return this.props.scrollable==="virtual"&&(G.height||(G=Object.assign({},G,{height:"450px"}))),r.createElement(p.TableKeyboardNavigationContext.Provider,{value:this.contextStateRef.current},r.createElement("div",{id:this.props.id,style:G,className:u.classNames("k-grid",{"k-grid-md":!this.props.size,[`k-grid-${u.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size,"k-grid-virtual":this.props.scrollable==="virtual"},this.props.className),ref:o=>{this._element=o},"aria-label":this.props.ariaLabel,onKeyDown:this.onKeyDown,onFocus:this.onFocus,...p.tableKeyboardNavigationScopeAttributes},R,F,r.createElement("div",{className:"k-grid-aria-root",role:"grid","aria-colcount":y.length,"aria-rowcount":a,id:this._gridId,"aria-label":g.toLanguageString(O.gridAriaLabel,O.messages[O.gridAriaLabel])},U,r.createElement("div",{className:"k-grid-container",role:"presentation"},r.createElement("div",{ref:this.containerRef,className:"k-grid-content k-virtual-content",onScroll:this.scrollHandler,role:"presentation"},r.createElement("div",{className:"k-grid-table-wrap",role:"presentation"},r.createElement(p.TableSelection,{selectable:this.props.selectable,onRelease:this.selectionRelease,childRef:o=>{this.tableElement=o}},r.createElement("table",{className:u.classNames("k-table k-grid-table",{"k-table-md":!this.props.size,[`k-table-${u.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size}),role:"presentation",style:{userSelect:l,display:ee}},Y,r.createElement("tbody",{className:"k-table-tbody",ref:this.tableBodyRef,role:"rowgroup",...p.tableKeyboardNavigationBodyAttributes},L))),q&&j),r.createElement("div",{className:"k-height-container",role:"presentation"},r.createElement("div",{style:this.props.scrollable==="virtual"?{height:this.vs.containerHeight+"px"}:{}})))),X,Z&&r.createElement(r.Fragment,null,r.createElement(p.DropClue,{ref:this.dragLogic.refDropElementClue}),r.createElement(p.DragClue,{ref:this.dragLogic.refDragElementClue})),this.showLicenseWatermark&&r.createElement(u.WatermarkOverlay,null)),x,this.props.pageable&&Q))}selectionChange(a){if(this.props.onSelectionChange){const{event:c,dataItem:g,dataIndex:e,columnIndex:t}=a,{mode:i,cell:n}=p.getSelectionOptions(this.props.selectable),h={...this.getArguments(c.syntheticEvent),dataItem:g,startColIndex:t,endColIndex:t,startRowIndex:e,endRowIndex:e,dataItems:this.getLeafDataItems(),altKey:!1,ctrlKey:!1,shiftKey:!1,metaKey:!1,mode:i,cell:n,isDrag:!1,componentId:this._gridId,selectedField:this.props.selectedField||""};this.props.onSelectionChange.call(void 0,h)}}raiseDataEvent(a,c,g,e,t){const i=this.props.onDataStateChange;if(a){const n={...this.getArguments(e),...c,targetEvent:t};a.call(void 0,n)}else i&&i.call(void 0,{...this.getArguments(e),targetEvent:t||{},dataState:{...this.getDataState(),...g}})}columnReorder(a,c,g){const e=this._columns[a],t=e.depth,i=d=>{do d++;while(d<this._columns.length&&this._columns[d].depth>t);return d},n=this._columns.splice(a,i(a)-a);this._columns.splice(a<c?i(c-n.length):c,0,...n),this._columns.filter(d=>d.declarationIndex>=0).forEach((d,R)=>d.orderIndex=R),this._columnsMutations++;const h=this._columns[a].locked&&this._columns[c].locked;p.updateLeft(this._columnsMap,this._columns,h||this._shouldUpdateLeftRight),p.updateRight(this._columnsMap,this._columns,h||this._shouldUpdateLeftRight),this._resized&&(this._shouldUpdateLeftRight=!1,this._resized=!1);const l=this.columns;if(this.forceUpdate(),this.props.onColumnReorder){const d={target:this,columns:l,columnId:e.id,nativeEvent:g};this.props.onColumnReorder.call(void 0,d)}}groupReorder(a,c,g){if(this.props.group===void 0)return;const e=this.props.group.slice();e.splice(c,0,...e.splice(a,1)),this.groupChange(e,g)}columnToGroup(a,c,g){const e=this._columns[a].field;if(!e)return;const t=(this.props.group||[]).slice();t.splice(c,0,{field:e}),this.groupChange(t,g)}resetTableWidth(){let a=0;if(!this.columnResize.colGroupMain)return;const c=this.columnResize.colGroupMain.children;for(let g=0;g<c.length;g++){const e=c[g].width;if(!e)return;a+=parseFloat(e.toString())}a=Math.round(a),this._header&&this._header.setWidth(a),this._footer&&this._footer.setWidth(a),this.tableElement&&(this.tableElement.style.width=a+"px")}initColumns(a,c){const g=p.tableKeyboardNavigationTools.getIdPrefix(this.navigationStateRef);this._columns=this.readColumns(a,g,this._columnsMutations),this._columns.length===0&&(this._columns=v.autoGenerateColumns(this.props.data,this.props.group,this.props.expandField,{prevId:0,idPrefix:g})),this.configureColumns(this._columns,c,g),this._columnsMap=this.mapColumns(this._columns),this.columnResize.columns=this._columns,this.dragLogic.columns=this._columns}getDataState(){return{filter:this.props.filter,sort:this.props.sort,skip:this.props.skip,take:this.props.take!==void 0?this.props.take:this.props.pageSize,group:this.props.group}}getArguments(a){return{nativeEvent:a&&a.nativeEvent,syntheticEvent:a,target:this}}};z.displayName="KendoReactGrid",z.defaultProps={},z.propTypes={data:s.oneOfType([s.array,s.shape({data:s.array,total:s.number})]),sortable:s.oneOfType([s.bool,s.shape({mode:s.oneOf(["single","multiple"]),allowUnsort:s.bool})]),onSortChange:s.func,sort:s.array,filterable:s.bool,filter:s.any,onFilterChange:s.func,pageable:s.oneOfType([s.bool,s.shape({buttonCount:s.number,responsive:s.bool,info:s.bool,type:s.oneOf(["numeric","input"]),pageSizes:s.oneOfType([s.bool,s.arrayOf(s.oneOfType([s.string,s.number]))]),previousNext:s.bool})]),pageSize:s.number,onPageChange:s.func,total:s.number,skip:s.number,take:s.number,fixedScroll:s.bool,onExpandChange:s.func,expandField:s.string,selectedField:s.string,onSelectionChange:s.func,onHeaderSelectionChange:s.func,resizable:s.bool,reorderable:s.bool,group:s.any,groupable:s.oneOfType([s.bool,s.shape({enabled:s.bool,footer:s.oneOf(["always","visible","none"])})]),onGroupChange:s.func,onRowClick:s.func,onRowDoubleClick:s.func,onItemChange:s.func,editField:s.string,scrollable:s.oneOf(["none","scrollable","virtual"]),rowHeight:s.number,detailRowHeight:s.number,detail:s.any,style:s.object,onDataStateChange:s.func,onColumnResize:s.func,onColumnReorder:s.func,dataItemKey:s.string,navigatable:s.bool,size:s.oneOf(["small","medium"])},z.contextType=p.TableKeyboardNavigationContext;let K=z;ae.registerForLocalization(K);exports.Grid=K;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const we=require("react"),s=require("prop-types"),u=require("@progress/kendo-react-common"),c=require("@progress/kendo-react-data-tools"),ke=require("./cells/GridSelectionCell.js"),Ie=require("./cells/GridHierarchyCell.js"),Ee=require("./cells/GridEditCell.js"),xe=require("./header/Header.js"),_e=require("./header/HeaderRow.js"),ze=require("./header/FilterRow.js"),De=require("./header/GroupPanel.js"),He=require("./footer/Footer.js"),ae=require("@progress/kendo-react-intl"),O=require("./messages/index.js"),Te=require("./VirtualScroll.js"),A=require("./VirtualScrollFixed.js"),Ne=require("./drag/ColumnResize.js"),Ge=require("./drag/CommonDragLogic.js"),v=require("./utils/index.js"),Le=require("./cells/GridCell.js"),ie=require("./cells/GridGroupCell.js"),Me=require("./rows/GridRow.js"),Fe=require("./header/GridHeaderSelectionCell.js"),Oe=require("./GridNoRecords.js"),oe=require("./filterCommon.js"),Ae=require("./footer/FooterRow.js"),Ke=require("./paging/GridPagerSettings.js"),re=require("./package-metadata.js"),qe=require("./cells/GridDetailCell.js"),Pe=require("./cells/GridDetailHierarchyCell.js");function Ve(D){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(D){for(const h in D)if(h!=="default"){const g=Object.getOwnPropertyDescriptor(D,h);Object.defineProperty(a,h,g.get?g:{enumerable:!0,get:()=>D[h]})}}return a.default=D,Object.freeze(a)}const r=Ve(we),z=class z extends r.Component{constructor(a){super(a),this._columns=[],this._columnsMap=[[]],this._columnsMutations=0,this._resized=!1,this._shouldUpdateLeftRight=!0,this.contextStateRef={current:void 0},this.navigationStateRef={current:void 0},this._data=[],this._slicedData=void 0,this.wrapperScrollTop=0,this.showLicenseWatermark=!1,this.headerRef=r.createRef(),this.headerElementRef=r.createRef(),this._element=null,this.tableElement=null,this.containerRef=r.createRef(),this.tableBodyRef=r.createRef(),this._footer=null,this.forceUpdateTimeout=void 0,this.isRtl=!1,this.observer=null,this.handleIntersection=e=>{const t={rowIndex:this.rowIndex};e.forEach(i=>{i.isIntersecting||this.setCurrentOnTop(t)})},this.setCurrentOnTop=e=>{if(!this.vs.container||this.props.scrollable==="none")return;this.observer&&this.observer.disconnect();const{rowIndex:t}=e;if(this.props.scrollable==="virtual")this.vs.askedSkip=t,this.vs.container.scroll(0,Math.round(this.vs.askedSkip/this.vs.total*this.vs.container.scrollHeight));else if(this.element){const i=t<1?this.element.querySelector("tbody > tr:nth-child(1)"):this.element.querySelector(`tbody > tr:nth-child(${t+1})`);i&&this.containerRef.current&&(this.containerRef.current.scrollTop=i.offsetTop)}},this.scrollIntoView=e=>{if(!this.vs.container||this.props.scrollable==="none")return;this.rowIndex=e.rowIndex;const{rowIndex:t}=e,i=this.element;if(this.observer&&i){this.observer.disconnect();const n=i.querySelector(`[absolute-row-index="${t}"]`);n?this.observer.observe(n):this.setCurrentOnTop(e)}},this.fitColumns=e=>{this.columnResize.dblClickHandler(null,e)},this.onContextMenu=(e,t,i)=>{if(this.props.onContextMenu){const n={target:this,syntheticEvent:e,nativeEvent:e.nativeEvent,dataItem:t,field:i};this.props.onContextMenu.call(void 0,n)}},this.getVirtualScroll=e=>{const{rowHeight:t,detailRowHeight:i,detail:n,expandField:p,groupable:l}=e,d=this.isAllData(),R=t!==void 0&&t>0,w=i!==void 0&&i>0,x=l===!0||typeof l=="object"&&l.enabled!==!1;return!R||x&&!d||!!(n&&p)&&(!w||!d)?Te.VirtualScroll:A.VirtualScrollFixed},this.isAllData=()=>{const{data:e,total:t}=this.props;return Array.isArray(e)?e.length===t:e?t===e.total:!1},this.initializeVirtualization=(e,t)=>{if(this.reInitVirtualization(this.props.scrollable==="virtual",this.props.total,this.props.filter,this.props.group,this.props.sort,t||this.props.rowHeight===void 0||this.props.rowHeight===0),this.vs.fixedScroll=this.props.fixedScroll||!1,this.vs.PageChange=this.pageChange,this.vs.realSkip=this.props.skip||0,this.vs.pageSize=(this.props.take!==void 0?this.props.take:this.props.pageSize)||0,this.vs.scrollableVirtual=this.props.scrollable==="virtual",this.vs.total=e,this.vs.propsSkip=(this.props.skip||0)+(this.props.scrollable==="virtual"?this.vs.topCacheCount+(this.vs.attendedSkip-(this.props.skip||0)):0),this.props.rowHeight!==void 0&&this.props.rowHeight>0&&!t){const i=this.props.rowHeight*e;this.vs.containerHeight=v.firefox?Math.min(v.firefoxMaxHeight,i):i}else this.vs.containerHeight=1533915;if(this.vs.containerRef=this.containerRef,this.vs.tableBodyRef=this.tableBodyRef,this.vs.table=this.tableElement,this._slicedData=void 0,this.vs instanceof A.VirtualScrollFixed){const{rowHeight:i=0,detail:n,expandField:p}=this.props;let{detailRowHeight:l=0}=this.props;l=n&&p?l:i,this.isAllData()?(this.vs.total=this._data.length,this._slicedData=this._data.slice(this.vs.realSkip,this.vs.realSkip+this.vs.pageSize),this.vs.rowHeightService=this.rowHeightService(this.vs,this._data.length,i,l,this._data)):this.vs.rowHeightService=new A.RowHeightService(e,i,l);const d=this.vs.rowHeightService.totalHeight();this.vs.containerHeight=v.firefox?Math.min(v.firefoxMaxHeight,d):d}},this.scrollHandler=e=>{if(e.target!==e.currentTarget)return;clearTimeout(this.forceUpdateTimeout),this.vs.table=this.tableElement;const t=e.currentTarget.scrollLeft,i=e.currentTarget.scrollTop;this.props.columnVirtualization&&(!this.vs.scrollableVirtual||i===this.wrapperScrollTop)&&(this.forceUpdateTimeout=window.setTimeout(()=>{this.forceUpdate()},0)),this._header&&this._header.setScrollLeft(t),this._footer&&this._footer.setScrollLeft(t),this.vs&&i!==this.wrapperScrollTop&&this.vs.scrollHandler(e),u.dispatchEvent(this.props.onScroll,e,this,void 0),this.wrapperScrollTop=i},this.onKeyDown=e=>{if(c.tableKeyboardNavigation.onKeyDown(e,{contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef,onNavigationAction:this.onNavigationAction}),this.props.onKeyDown){const{mode:t,cell:i}=c.getSelectionOptions(this.props.selectable),n={dataItems:this.getLeafDataItems(),mode:t,cell:i,componentId:this._gridId,selectedField:this.props.selectedField,...this.getArguments(e)};this.props.onKeyDown.call(void 0,n)}},this.onFocus=e=>{c.tableKeyboardNavigation.onFocus(e,{contextStateRef:this.contextStateRef})},this.onNavigationAction=e=>{if(this.props.onNavigationAction){const t={focusElement:e.focusElement,...this.getArguments(e.event)};this.props.onNavigationAction.call(void 0,t)}},this.rowClick=(e,t)=>{this.props.onRowClick&&e.target.nodeName==="TD"&&this.props.onRowClick.call(void 0,{dataItem:t.dataItem,...this.getArguments(e)})},this.rowDblClick=(e,t)=>{this.props.onRowDoubleClick&&e.target.nodeName==="TD"&&this.props.onRowDoubleClick.call(void 0,{dataItem:t.dataItem,...this.getArguments(e)})},this.itemChange=e=>{const t=this.props.onItemChange;if(e.field===this.props.expandField||this.props.group&&e.field===void 0){const i=this.props.onExpandChange;i&&i.call(void 0,{...this.getArguments(e.syntheticEvent),dataItem:e.dataItem,dataIndex:e.dataIndex,value:e.value});return}t&&t.call(void 0,{...this.getArguments(e.syntheticEvent),dataItem:e.dataItem,field:e.field,value:e.value})},this.onHeaderSelectionChange=e=>{this.props.onHeaderSelectionChange&&this.props.onHeaderSelectionChange.call(void 0,{field:e.field,nativeEvent:e.syntheticEvent&&e.syntheticEvent.nativeEvent,syntheticEvent:e.syntheticEvent,target:this,dataItems:this.getLeafDataItems(),selectedField:this.props.selectedField})},this.selectionRelease=e=>{if(this.props.onSelectionChange){const t={syntheticEvent:void 0,target:this,selectedField:this.props.selectedField||"",componentId:this._gridId,dataItems:this.getLeafDataItems(),dataItem:null,...e};this.props.onSelectionChange.call(void 0,t)}},this.pageChange=(e,t,i)=>{this.raiseDataEvent(this.props.onPageChange,{page:e},{skip:e.skip,take:e.take},t,i)},this.pagerPageChange=e=>{this.pageChange({skip:e.skip,take:e.take},e.syntheticEvent,e.targetEvent)},this.sortChange=(e,t)=>{this.raiseDataEvent(this.props.onSortChange,{sort:e},{sort:e,...this.props.scrollable==="virtual"?{skip:0}:{}},t)},this.filterChange=(e,t)=>{this.raiseDataEvent(this.props.onFilterChange,{filter:e},{filter:e||void 0,skip:0},t)},this.groupChange=(e,t)=>{const i=t.nativeEvent?t:{nativeEvent:t.nativeEvent||t.originalEvent};this.raiseDataEvent(this.props.onGroupChange,{group:e},{group:e,skip:0},i)},this.onClipboard=(e,t)=>{if(this.props.onClipboard){if(!this.inActiveElement()||!e)return;this.props.onClipboard.call(void 0,{type:e,nativeEvent:t,columns:this._columns,dataItemKey:this.props.dataItemKey||"",...typeof this.props.clipboard!="boolean"?this.props.clipboard:{}})}},this.inActiveElement=()=>{var p,l,d;if(!u.canUseDOM)return!1;const e=u.getActiveElement(this.document),t=e?e.matches(".k-table-td")?e:(p=this.document)==null?void 0:p.body:(l=this.document)==null?void 0:l.body,i=t.closest(".k-grid-container"),n=t&&((d=this._element)==null?void 0:d.contains(t));return!!(t&&n&&i)},this.onResize=(e,t,i,n,p,l)=>{this.resetTableWidth(),this._shouldUpdateLeftRight=!0,this._resized=!0,this._columnsMutations++,this.props.onColumnResize&&this.props.onColumnResize.call(void 0,{columns:this.columns,nativeEvent:n,targetColumnId:l,index:e,newWidth:t,oldWidth:i,end:p,target:this})},this.reInitVirtualization=u.memoizeOne((e,t,i,n,p,l)=>{this.vs.reset();const d=this.getVirtualScroll(this.props);this.vs=new d(l)}),this.flatData=u.memoizeOne((e,t,i,n,p,l,d)=>{const R=[],w=v.flatData(R,e,t,{index:i},n!==void 0,p);return{flattedData:R,resolvedGroupsCount:w}}),this.rowHeightService=u.memoizeOne((e,t,i,n,p)=>new A.RowHeightService(t,i,n,p)),this.childrenToArray=u.memoizeOne(e=>r.Children.toArray(e)),this.readColumns=u.memoizeOne((e,t,i)=>{const n=e.filter(p=>p&&p.type&&p.type.displayName==="KendoReactGridColumn");return v.readColumns(n,this.columns,{prevId:0,idPrefix:t})}),this.mapColumns=u.memoizeOne(e=>c.mapColumns(e)),this.configureColumns=u.memoizeOne((e,t,i)=>{this.props.selectedField&&e.filter(l=>l.field===this.props.selectedField).forEach(l=>{l.width=l.width||"50px",l.cell=l.cell||ke.GridSelectionCell,l.headerCell=l.headerCell||Fe.GridHeaderSelectionCell});const n={id:"",resizable:!0,width:"32px",title:" ",declarationIndex:-1,orderIndex:-1,children:[],parentIndex:-1,depth:0,colSpan:0,rowSpan:0,left:0,right:0,index:0,rightBorder:!1,ariaColumnIndex:0,isAccessible:!0};let p=0;this.props.expandField&&this.props.onExpandChange&&this.props.detail&&(e.unshift({...n,cell:Ie.GridHierarchyCell,field:this.props.expandField,headerClassName:"k-hierarchy-cell k-header",id:c.tableKeyboardNavigationTools.generateNavigatableId(`${this._columns.length}`,i,"column")}),p++);for(let l=0;l<t;l++)e.unshift({...n,isAccessible:!1,cell:ie.GridGroupCell,field:"value",locked:this.props.lockGroups}),p++;e.slice(p).forEach(l=>l.parentIndex>=0&&(l.parentIndex+=p))}),this.getHeaderRow=u.memoizeOne((e,t,i,n,p,l,d,R,w,x,y,L)=>r.createElement(_e.HeaderRow,{cells:this.props.cells,sort:e,sortable:t,sortChange:this.sortChange,group:i||[],groupable:n,groupChange:this.groupChange,filter:p,filterable:l,filterOperators:d,filterChange:this.filterChange,columnMenu:w,selectionChange:this.onHeaderSelectionChange,columns:x,columnResize:this.columnResize,pressHandler:this.dragLogic.pressHandler,dragHandler:this.dragLogic.dragHandler,releaseHandler:this.dragLogic.releaseHandler,columnsMap:y,cellRender:R,isRtl:L,dragClue:this.dragLogic.dragClueRef,headerRef:this.headerElementRef,containerRef:this.containerRef,columnGroupChange:this.columnGroupChange})),this.resolveTitle=e=>{const t=this._columns.find(n=>n.field===e),i=t&&(t.title||t.field);return i===void 0?e:i},this.getLeafDataItems=()=>this._data.filter(e=>e.rowType==="data").map(e=>e.dataItem),u.validatePackage(re.packageMetadata),this.showLicenseWatermark=u.shouldShowValidationUI(re.packageMetadata);const h=this.props.groupable===!0||typeof this.props.groupable=="object"&&this.props.groupable.enabled!==!1,g=this.getVirtualScroll(a);this.vs=new g(h||a.rowHeight===void 0||a.rowHeight===0),this.dragLogic=new Ge.CommonDragLogic(this.columnReorder.bind(this),this.groupReorder.bind(this),this.columnToGroup.bind(this)),this.columnGroupChange=this.columnGroupChange.bind(this),this.columnResize=new Ne.ColumnResize(this.onResize),this.props.clipboard&&(this.clipboardService=new c.ClipboardService(this.onClipboard)),c.tableKeyboardNavigation.onConstructor({navigatable:!!a.navigatable,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef,idPrefix:this._gridId})}get columns(){const a=this._columns.filter(h=>h.declarationIndex>=0&&h.parentIndex===-1);return v.sanitizeColumns(a)}get element(){return this._element}get document(){if(u.canUseDOM)return this.element&&this.element.ownerDocument||document}get _header(){return this.headerRef.current}get _gridId(){return this.props.id+"-role-element-id"}componentDidMount(){this.resetTableWidth(),u.setScrollbarWidth();const a=c.isRtl(this.element);this.isRtl=a,c.tableKeyboardNavigation.onComponentDidMount({scope:this.element||void 0,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef}),this.isRtl&&this.forceUpdate();const h={rootMargin:"0px",threshold:.9};this.clipboardService&&this.clipboardService.addEventListeners(this.document),this.observer=u.canUseDOM&&window.IntersectionObserver&&new window.IntersectionObserver(this.handleIntersection,h)||null}getSnapshotBeforeUpdate(){return c.tableKeyboardNavigation.onGetSnapshotBeforeUpdate({document:this.document,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef}),null}componentDidUpdate(){this.resetTableWidth(),u.setScrollbarWidth(),this.vs.tableTransform&&this.vs.table&&(this.vs.table.style.transform=this.vs.tableTransform,this.vs.tableTransform=""),c.tableKeyboardNavigation.onComponentDidUpdate({scope:this.element||void 0,contextStateRef:this.contextStateRef,navigationStateRef:this.navigationStateRef})}componentWillUnmount(){clearTimeout(this.forceUpdateTimeout),this.clipboardService&&this.clipboardService.removeEventListeners(this.document)}render(){var te;let a=this.props.total||0;const h=c.tableKeyboardNavigationTools.getIdPrefix(this.navigationStateRef),g=ae.provideLocalizationService(this);let e=[];Array.isArray(this.props.data)?(e=this.props.data,a=a||this.props.data.length):this.props.data&&(e=this.props.data.data,a=a||this.props.data.total);const t=typeof this.props.groupable=="object"&&this.props.groupable.footer||"none",{resolvedGroupsCount:i,flattedData:n}=this.flatData(e,t,this.props.skip||0,this.props.group,this.props.expandField,this.props.filter,this.props.sort);this._data=n;const p=this.props.groupable===!0||typeof this.props.groupable=="object"&&this.props.groupable.enabled!==!1;this.columnResize.resizable=this.props.resizable||!1,this.dragLogic.reorderable=this.props.reorderable||!1,this.dragLogic.groupable=p;const l=this.props.selectable&&this.props.selectable.drag?"none":void 0;this.initializeVirtualization(a,p);const d=this.childrenToArray(this.props.children);this.initColumns(d,i);const R=d.map(o=>o&&o.type&&o.type.displayName==="KendoReactGridToolbar"?r.cloneElement(o,{...o.props,ariaControls:this._gridId}):null),w=d.filter(o=>o&&o.type&&o.type.displayName==="KendoReactGridNoRecords"),x=d.filter(o=>o&&o.type&&o.type.displayName==="KendoReactGridStatusBar"),y=this._columns.filter(o=>o.children.length===0),L=p&&r.createElement(De.GroupPanel,{group:this.props.group||[],groupChange:this.groupChange,pressHandler:this.dragLogic.pressHandler,dragHandler:this.dragLogic.dragHandler,releaseHandler:this.dragLogic.releaseHandler,refCallback:this.dragLogic.refGroupPanelDiv,resolveTitle:this.resolveTitle,ariaControls:this._gridId,onContextMenu:this.onContextMenu}),{sort:le,sortable:ne,group:he,filter:pe,filterable:ce,filterOperators:de=oe.operators,headerCellRender:ue,columnMenu:ge}=this.props,U=r.createElement(xe.Header,{size:this.props.size,columnResize:this.columnResize,staticHeaders:this.props.scrollable!=="none",scrollableDataElement:()=>this.vs.container,draggable:this.props.reorderable||p,ref:this.headerRef,elemRef:this.headerElementRef,headerRow:this.getHeaderRow(le,ne,he,p,pe,ce,de,ue,ge,this._columns,this._columnsMap,this.isRtl),filterRow:this.props.filterable&&r.createElement(ze.FilterRow,{cells:this.props.cells,size:this.props.size,columns:this._columns,filter:this.props.filter,filterOperators:this.props.filterOperators||oe.operators,filterChange:this.filterChange,sort:this.props.sort,cellRender:this.props.filterCellRender,isRtl:this.isRtl,ariaRowIndex:this._columnsMap.length+1})||void 0,cols:y.map((o,m)=>r.createElement("col",{key:m.toString(),width:v.getColumnWidth(o)}))}),fe=this.vs&&this.vs.container&&this.vs.container.scrollLeft||0,me=parseFloat(((this.props.style||{}).width||"").toString()),{colSpans:be,hiddenColumns:ve}=c.tableColumnsVirtualization({enabled:this.props.columnVirtualization,columns:y,tableViewPortWidth:me,scrollLeft:fe}),Ce=(o,m,b)=>{let _=!1;const E=this.props.selectedField?v.getNestedValue(this.props.selectedField,o.dataItem):void 0;return{row:y.map((f,C)=>{if(ve[C])return null;const T=f.id?f.id:C,N=`${f.className?f.className+" ":""}${f.locked?"k-grid-content-sticky":""}`,k=f.left!==void 0?this.isRtl?{left:f.right,right:f.left}:{left:f.left,right:f.right}:{};let I=!1;if(f.editable&&this.props.editField){const S=v.getNestedValue(this.props.editField,o.dataItem);S&&(S===!0||S===f.field)&&(_=!0,I=!0)}const V=f.cell||I&&Ee.GridEditCell||Le.GridCell;return r.createElement(V,{onContextMenu:this.onContextMenu,key:T,locked:this.props.lockGroups,id:c.tableKeyboardNavigationTools.generateNavigatableId(`${m}-${String(C)}`,h),colSpan:be[C],dataItem:o.dataItem,field:f.field,editor:f.editor,format:f.format,className:N,render:this.props.cellRender,cells:v.resolveCells(this.props.cells,f.cells),onChange:this.itemChange,selectionChange:this.props.onSelectionChange?S=>{this.selectionChange({event:S,dataItem:o.dataItem,dataIndex:b,columnIndex:C})}:void 0,columnIndex:C,columnsCount:y.length,rowType:o.rowType,level:o.level,expanded:o.expanded,dataIndex:o.dataIndex,style:k,ariaColumnIndex:f.ariaColumnIndex,isSelected:Array.isArray(E)&&E.indexOf(C)>-1})}),isInEdit:_,isSelected:typeof E=="boolean"&&E}};let W=0;if(this.props.scrollable==="virtual")for(let o=0;o<this.vs.topCacheCount+this.vs.attendedSkip-(this.props.skip||0);o++){const m=this._data.shift();if(m)this._data.push(m),W++,m.rowType==="groupHeader"&&o--;else break}const B=o=>o>=this._data.length-W;let $=this.vs.realSkip||0;const M=[];let q=!1;const P=this._columnsMap.length+(this.props.filterable?1:0)+1,j=r.createElement("div",{key:"no-records",className:"k-grid-norecords","aria-rowindex":P},r.createElement("div",{className:"k-grid-norecords-template"},w.length?w:r.createElement(Oe.GridNoRecords,null)));let H=0;if(this._data.length){let o=-1,m=0;(this._slicedData||this._data).forEach((b,_)=>{b.rowType==="data"&&($++,o++);const E=$%2===0,f=this.props.dataItemKey&&u.getter(this.props.dataItemKey)(b.dataItem),C=_+(this.vs.realSkip||0),T=f||"ai"+C,N=T+"_1",k=Ce(b,T,o);if(H=C+P+m,M.push(r.createElement(Me.GridRow,{key:T,dataItem:b.dataItem,isAltRow:E,isInEdit:k.isInEdit,rowType:b.rowType,isHidden:B(_),onClick:I=>this.rowClick(I,b),onDoubleClick:I=>this.rowDblClick(I,b),selectedField:this.props.selectedField,rowHeight:this.props.rowHeight,render:this.props.rowRender,ariaRowIndex:H,absoluteRowIndex:C,dataIndex:o,isSelected:k.isSelected},k.row)),this.props.detail&&b.rowType==="data"&&b.expanded){const I=y.length-(this.props.expandField?1:0)-(this.props.group?this.props.group.length:0)||1;m++,H=C+P+m,M.push(r.createElement("tr",{key:N,className:u.classNames("k-table-row",E?"k-detail-row k-table-alt-row k-alt":"k-detail-row"),style:{visibility:B(_)?"hidden":"",height:this.props.detailRowHeight},role:"row","aria-rowindex":H},this.props.group&&this.props.group.map((V,S)=>{var se;const G=(se=k==null?void 0:k.row[S])==null?void 0:se.props.style,Se=G?this.isRtl?{left:G.right,right:G.left}:{left:G.left,right:G.right}:{};return r.createElement(ie.GridGroupCell,{id:"",dataIndex:b.dataIndex,field:V.field,dataItem:b.dataItem,key:S,style:Se,ariaColumnIndex:1+S,isSelected:!1,locked:this.props.lockGroups,isRtl:this.isRtl,cells:this.props.cells})}),this.props.expandField&&r.createElement(Pe.GridDetailHierarchyCell,{id:c.tableKeyboardNavigationTools.generateNavigatableId(`${N}-dhcell`,h)}),r.createElement(qe.GridDetailCell,{onContextMenu:this.onContextMenu,dataItem:b.dataItem,dataIndex:b.dataIndex,colSpan:I,ariaColIndex:2+(this.props.group?this.props.group.length:0),detail:this.props.detail,id:c.tableKeyboardNavigationTools.generateNavigatableId(`${N}-dcell`,h)})))}})}else q=!0;const J={size:this.props.size,onPageChange:this.pagerPageChange,total:a,dir:this.isRtl?"rtl":void 0,skip:this.vs.propsSkip||0,take:(this.props.take!==void 0?this.props.take:this.props.pageSize)||10,messagesMap:O.pagerMessagesMap,...Ke.normalize(this.props.pageable||{})},Q=this.props.pager?r.createElement(this.props.pager,{...J}):r.createElement(c.Pager,{className:"k-grid-pager",...J}),Re=o=>this.props.sort&&this.props.sort.filter(m=>m.field===o).length>0,ye=(o,m)=>r.createElement("col",{key:m.toString(),width:v.getColumnWidth(o)}),X=(te=this.props.cells)!=null&&te.footerCell||this._columns.some(o=>{var m;return!!(o.footerCell||(m=o.cells)!=null&&m.footerCell)})?r.createElement(He.Footer,{size:this.props.size,columnResize:this.columnResize,staticHeaders:this.props.scrollable!=="none",ref:o=>this._footer=o,row:r.createElement(Ae.FooterRow,{cells:this.props.cells,columns:this._columns,isRtl:this.isRtl,ariaRowIndex:H+1}),cols:y.map(ye)}):null,Y=r.createElement("colgroup",{ref:o=>{this.columnResize.colGroupMain=o}},y.map((o,m)=>r.createElement("col",{key:m.toString(),className:Re(o.field)?"k-sorted":void 0,width:v.getColumnWidth(o)}))),Z=this.dragLogic.reorderable||this.dragLogic.groupable,ee=this.props.columnVirtualization?"block":"table";if(this.props.scrollable==="none")return r.createElement(c.TableKeyboardNavigationContext.Provider,{value:this.contextStateRef.current},r.createElement("div",{id:this.props.id,style:this.props.style,className:u.classNames("k-grid",{"k-grid-md":!this.props.size,[`k-grid-${u.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size},this.props.className),ref:o=>{this._element=o},"aria-label":this.props.ariaLabel,onKeyDown:this.onKeyDown,onFocus:this.onFocus,...c.tableKeyboardNavigationScopeAttributes},R,L,r.createElement(c.TableSelection,{selectable:this.props.selectable,onRelease:this.selectionRelease,childRef:o=>{this.tableElement=o}},r.createElement("table",{className:u.classNames("k-table k-grid-table",{[`k-table-${u.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size}),style:{userSelect:l,display:ee}},Y,U,r.createElement("tbody",{role:"rowgroup",className:"k-table-tbody",...c.tableKeyboardNavigationBodyAttributes},M),X)),q&&j,Z&&r.createElement(r.Fragment,null,r.createElement(c.DropClue,{ref:this.dragLogic.refDropElementClue}),r.createElement(c.DragClue,{ref:this.dragLogic.refDragElementClue}))),x,this.props.pageable&&Q);let F=this.props.style||{};return this.props.scrollable==="virtual"&&(F.height||(F=Object.assign({},F,{height:"450px"}))),r.createElement(c.TableKeyboardNavigationContext.Provider,{value:this.contextStateRef.current},r.createElement("div",{id:this.props.id,style:F,className:u.classNames("k-grid",{"k-grid-md":!this.props.size,[`k-grid-${u.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size,"k-grid-virtual":this.props.scrollable==="virtual"},this.props.className),ref:o=>{this._element=o},"aria-label":this.props.ariaLabel,onKeyDown:this.onKeyDown,onFocus:this.onFocus,...c.tableKeyboardNavigationScopeAttributes},R,L,r.createElement("div",{className:"k-grid-aria-root",role:"grid","aria-colcount":y.length,"aria-rowcount":a,id:this._gridId,"aria-label":g.toLanguageString(O.gridAriaLabel,O.messages[O.gridAriaLabel])},U,r.createElement("div",{className:"k-grid-container",role:"presentation"},r.createElement("div",{ref:this.containerRef,className:"k-grid-content k-virtual-content",onScroll:this.scrollHandler,role:"presentation"},r.createElement("div",{className:"k-grid-table-wrap",role:"presentation"},r.createElement(c.TableSelection,{selectable:this.props.selectable,onRelease:this.selectionRelease,childRef:o=>{this.tableElement=o}},r.createElement("table",{className:u.classNames("k-table k-grid-table",{"k-table-md":!this.props.size,[`k-table-${u.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size}),role:"presentation",style:{userSelect:l,display:ee}},Y,r.createElement("tbody",{className:"k-table-tbody",ref:this.tableBodyRef,role:"rowgroup",...c.tableKeyboardNavigationBodyAttributes},M))),q&&j),r.createElement("div",{className:"k-height-container",role:"presentation"},r.createElement("div",{style:this.props.scrollable==="virtual"?{height:this.vs.containerHeight+"px"}:{}})))),X,Z&&r.createElement(r.Fragment,null,r.createElement(c.DropClue,{ref:this.dragLogic.refDropElementClue}),r.createElement(c.DragClue,{ref:this.dragLogic.refDragElementClue})),this.showLicenseWatermark&&r.createElement(u.WatermarkOverlay,null)),x,this.props.pageable&&Q))}selectionChange(a){if(this.props.onSelectionChange){const{event:h,dataItem:g,dataIndex:e,columnIndex:t}=a,{mode:i,cell:n}=c.getSelectionOptions(this.props.selectable),p={...this.getArguments(h.syntheticEvent),dataItem:g,startColIndex:t,endColIndex:t,startRowIndex:e,endRowIndex:e,dataItems:this.getLeafDataItems(),altKey:!1,ctrlKey:!1,shiftKey:!1,metaKey:!1,mode:i,cell:n,isDrag:!1,componentId:this._gridId,selectedField:this.props.selectedField||""};this.props.onSelectionChange.call(void 0,p)}}raiseDataEvent(a,h,g,e,t){const i=this.props.onDataStateChange;if(a){const n={...this.getArguments(e),...h,targetEvent:t};a.call(void 0,n)}else i&&i.call(void 0,{...this.getArguments(e),targetEvent:t||{},dataState:{...this.getDataState(),...g}})}columnReorder(a,h,g){const e=this._columns[a],t=e.depth,i=d=>{do d++;while(d<this._columns.length&&this._columns[d].depth>t);return d},n=this._columns.splice(a,i(a)-a);this._columns.splice(a<h?i(h-n.length):h,0,...n),this._columns.filter(d=>d.declarationIndex>=0).forEach((d,R)=>d.orderIndex=R),this._columnsMutations++;const p=this._columns[a].locked&&this._columns[h].locked;c.updateLeft(this._columnsMap,this._columns,p||this._shouldUpdateLeftRight),c.updateRight(this._columnsMap,this._columns,p||this._shouldUpdateLeftRight),this._resized&&(this._shouldUpdateLeftRight=!1,this._resized=!1);const l=this.columns;if(this.forceUpdate(),this.props.onColumnReorder){const d={target:this,columns:l,columnId:e.id,nativeEvent:g};this.props.onColumnReorder.call(void 0,d)}}groupReorder(a,h,g){if(this.props.group===void 0)return;const e=this.props.group.slice();e.splice(h,0,...e.splice(a,1)),this.groupChange(e,g)}columnToGroup(a,h,g){const e=this._columns[a].field;if(!e)return;const t=(this.props.group||[]).slice();t.splice(h,0,{field:e}),this.groupChange(t,g)}columnGroupChange(a,h){const g=this.dragLogic.getCurrentGroupsLength;this.columnToGroup(a,g,h)}resetTableWidth(){let a=0;if(!this.columnResize.colGroupMain)return;const h=this.columnResize.colGroupMain.children;for(let g=0;g<h.length;g++){const e=h[g].width;if(!e)return;a+=parseFloat(e.toString())}a=Math.round(a),this._header&&this._header.setWidth(a),this._footer&&this._footer.setWidth(a),this.tableElement&&(this.tableElement.style.width=a+"px")}initColumns(a,h){const g=c.tableKeyboardNavigationTools.getIdPrefix(this.navigationStateRef);this._columns=this.readColumns(a,g,this._columnsMutations),this._columns.length===0&&(this._columns=v.autoGenerateColumns(this.props.data,this.props.group,this.props.expandField,{prevId:0,idPrefix:g})),this.configureColumns(this._columns,h,g),this._columnsMap=this.mapColumns(this._columns),this.columnResize.columns=this._columns,this.dragLogic.columns=this._columns}getDataState(){return{filter:this.props.filter,sort:this.props.sort,skip:this.props.skip,take:this.props.take!==void 0?this.props.take:this.props.pageSize,group:this.props.group}}getArguments(a){return{nativeEvent:a&&a.nativeEvent,syntheticEvent:a,target:this}}};z.displayName="KendoReactGrid",z.defaultProps={},z.propTypes={data:s.oneOfType([s.array,s.shape({data:s.array,total:s.number})]),sortable:s.oneOfType([s.bool,s.shape({mode:s.oneOf(["single","multiple"]),allowUnsort:s.bool})]),onSortChange:s.func,sort:s.array,filterable:s.bool,filter:s.any,onFilterChange:s.func,pageable:s.oneOfType([s.bool,s.shape({buttonCount:s.number,responsive:s.bool,info:s.bool,type:s.oneOf(["numeric","input"]),pageSizes:s.oneOfType([s.bool,s.arrayOf(s.oneOfType([s.string,s.number]))]),previousNext:s.bool})]),pageSize:s.number,onPageChange:s.func,total:s.number,skip:s.number,take:s.number,fixedScroll:s.bool,onExpandChange:s.func,expandField:s.string,selectedField:s.string,onSelectionChange:s.func,onHeaderSelectionChange:s.func,resizable:s.bool,reorderable:s.bool,group:s.any,groupable:s.oneOfType([s.bool,s.shape({enabled:s.bool,footer:s.oneOf(["always","visible","none"])})]),onGroupChange:s.func,onRowClick:s.func,onRowDoubleClick:s.func,onItemChange:s.func,editField:s.string,scrollable:s.oneOf(["none","scrollable","virtual"]),rowHeight:s.number,detailRowHeight:s.number,detail:s.any,style:s.object,onDataStateChange:s.func,onColumnResize:s.func,onColumnReorder:s.func,dataItemKey:s.string,navigatable:s.bool,size:s.oneOf(["small","medium"])},z.contextType=c.TableKeyboardNavigationContext;let K=z;ae.registerForLocalization(K);exports.Grid=K;
package/Grid.mjs CHANGED
@@ -8,7 +8,7 @@
8
8
  "use client";
9
9
  import * as r from "react";
10
10
  import s from "prop-types";
11
- import { dispatchEvent as Ae, canUseDOM as U, getActiveElement as Ge, memoizeOne as S, validatePackage as Ke, shouldShowValidationUI as Oe, setScrollbarWidth as re, getter as Pe, classNames as L, kendoThemeMaps as G, WatermarkOverlay as Ue } from "@progress/kendo-react-common";
11
+ import { dispatchEvent as Ae, canUseDOM as U, getActiveElement as Ge, memoizeOne as S, validatePackage as Ke, shouldShowValidationUI as Oe, setScrollbarWidth as re, getter as Pe, classNames as N, kendoThemeMaps as G, WatermarkOverlay as Ue } from "@progress/kendo-react-common";
12
12
  import { tableKeyboardNavigation as x, getSelectionOptions as ae, mapColumns as Ve, tableKeyboardNavigationTools as _, ClipboardService as We, TableKeyboardNavigationContext as V, isRtl as Be, tableColumnsVirtualization as $e, Pager as je, tableKeyboardNavigationScopeAttributes as le, TableSelection as ne, tableKeyboardNavigationBodyAttributes as he, DropClue as pe, DragClue as de, updateLeft as qe, updateRight as Je } from "@progress/kendo-react-data-tools";
13
13
  import { GridSelectionCell as Qe } from "./cells/GridSelectionCell.mjs";
14
14
  import { GridHierarchyCell as Xe } from "./cells/GridHierarchyCell.mjs";
@@ -78,8 +78,8 @@ const z = class z extends r.Component {
78
78
  this.props.onContextMenu.call(void 0, n);
79
79
  }
80
80
  }, this.getVirtualScroll = (e) => {
81
- const { rowHeight: t, detailRowHeight: i, detail: n, expandField: h, groupable: l } = e, p = this.isAllData(), v = t !== void 0 && t > 0, R = i !== void 0 && i > 0, I = l === !0 || typeof l == "object" && l.enabled !== !1;
82
- return !v || I && !p || !!(n && h) && (!R || !p) ? nt : ue;
81
+ const { rowHeight: t, detailRowHeight: i, detail: n, expandField: h, groupable: l } = e, d = this.isAllData(), v = t !== void 0 && t > 0, R = i !== void 0 && i > 0, I = l === !0 || typeof l == "object" && l.enabled !== !1;
82
+ return !v || I && !d || !!(n && h) && (!R || !d) ? nt : ue;
83
83
  }, this.isAllData = () => {
84
84
  const { data: e, total: t } = this.props;
85
85
  return Array.isArray(e) ? e.length === t : e ? t === e.total : !1;
@@ -100,8 +100,8 @@ const z = class z extends r.Component {
100
100
  const { rowHeight: i = 0, detail: n, expandField: h } = this.props;
101
101
  let { detailRowHeight: l = 0 } = this.props;
102
102
  l = n && h ? l : i, this.isAllData() ? (this.vs.total = this._data.length, this._slicedData = this._data.slice(this.vs.realSkip, this.vs.realSkip + this.vs.pageSize), this.vs.rowHeightService = this.rowHeightService(this.vs, this._data.length, i, l, this._data)) : this.vs.rowHeightService = new ge(e, i, l);
103
- const p = this.vs.rowHeightService.totalHeight();
104
- this.vs.containerHeight = me ? Math.min(fe, p) : p;
103
+ const d = this.vs.rowHeightService.totalHeight();
104
+ this.vs.containerHeight = me ? Math.min(fe, d) : d;
105
105
  }
106
106
  }, this.scrollHandler = (e) => {
107
107
  if (e.target !== e.currentTarget)
@@ -252,10 +252,10 @@ const z = class z extends r.Component {
252
252
  );
253
253
  }
254
254
  }, this.inActiveElement = () => {
255
- var h, l, p;
255
+ var h, l, d;
256
256
  if (!U)
257
257
  return !1;
258
- const e = Ge(this.document), t = e ? e.matches(".k-table-td") ? e : (h = this.document) == null ? void 0 : h.body : (l = this.document) == null ? void 0 : l.body, i = t.closest(".k-grid-container"), n = t && ((p = this._element) == null ? void 0 : p.contains(t));
258
+ const e = Ge(this.document), t = e ? e.matches(".k-table-td") ? e : (h = this.document) == null ? void 0 : h.body : (l = this.document) == null ? void 0 : l.body, i = t.closest(".k-grid-container"), n = t && ((d = this._element) == null ? void 0 : d.contains(t));
259
259
  return !!(t && n && i);
260
260
  }, this.onResize = (e, t, i, n, h, l) => {
261
261
  this.resetTableWidth(), this._shouldUpdateLeftRight = !0, this._resized = !0, this._columnsMutations++, this.props.onColumnResize && this.props.onColumnResize.call(
@@ -273,9 +273,9 @@ const z = class z extends r.Component {
273
273
  );
274
274
  }, this.reInitVirtualization = S((e, t, i, n, h, l) => {
275
275
  this.vs.reset();
276
- const p = this.getVirtualScroll(this.props);
277
- this.vs = new p(l);
278
- }), this.flatData = S((e, t, i, n, h, l, p) => {
276
+ const d = this.getVirtualScroll(this.props);
277
+ this.vs = new d(l);
278
+ }), this.flatData = S((e, t, i, n, h, l, d) => {
279
279
  const v = [], R = dt(
280
280
  v,
281
281
  e,
@@ -332,7 +332,7 @@ const z = class z extends r.Component {
332
332
  locked: this.props.lockGroups
333
333
  }), h++;
334
334
  e.slice(h).forEach((l) => l.parentIndex >= 0 && (l.parentIndex += h));
335
- }), this.getHeaderRow = S((e, t, i, n, h, l, p, v, R, I, b, F) => /* @__PURE__ */ r.createElement(
335
+ }), this.getHeaderRow = S((e, t, i, n, h, l, d, v, R, I, b, F) => /* @__PURE__ */ r.createElement(
336
336
  et,
337
337
  {
338
338
  cells: this.props.cells,
@@ -344,7 +344,7 @@ const z = class z extends r.Component {
344
344
  groupChange: this.groupChange,
345
345
  filter: h,
346
346
  filterable: l,
347
- filterOperators: p,
347
+ filterOperators: d,
348
348
  filterChange: this.filterChange,
349
349
  columnMenu: R,
350
350
  selectionChange: this.onHeaderSelectionChange,
@@ -358,18 +358,19 @@ const z = class z extends r.Component {
358
358
  isRtl: F,
359
359
  dragClue: this.dragLogic.dragClueRef,
360
360
  headerRef: this.headerElementRef,
361
- containerRef: this.containerRef
361
+ containerRef: this.containerRef,
362
+ columnGroupChange: this.columnGroupChange
362
363
  }
363
364
  )), this.resolveTitle = (e) => {
364
365
  const t = this._columns.find((n) => n.field === e), i = t && (t.title || t.field);
365
366
  return i === void 0 ? e : i;
366
367
  }, this.getLeafDataItems = () => this._data.filter((e) => e.rowType === "data").map((e) => e.dataItem), Ke(Re), this.showLicenseWatermark = Oe(Re);
367
- const d = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(a);
368
- this.vs = new c(d || a.rowHeight === void 0 || a.rowHeight === 0), this.dragLogic = new pt(
368
+ const p = this.props.groupable === !0 || typeof this.props.groupable == "object" && this.props.groupable.enabled !== !1, c = this.getVirtualScroll(a);
369
+ this.vs = new c(p || a.rowHeight === void 0 || a.rowHeight === 0), this.dragLogic = new pt(
369
370
  this.columnReorder.bind(this),
370
371
  this.groupReorder.bind(this),
371
372
  this.columnToGroup.bind(this)
372
- ), this.columnResize = new ht(this.onResize), this.props.clipboard && (this.clipboardService = new We(this.onClipboard)), x.onConstructor({
373
+ ), this.columnGroupChange = this.columnGroupChange.bind(this), this.columnResize = new ht(this.onResize), this.props.clipboard && (this.clipboardService = new We(this.onClipboard)), x.onConstructor({
373
374
  navigatable: !!a.navigatable,
374
375
  contextStateRef: this.contextStateRef,
375
376
  navigationStateRef: this.navigationStateRef,
@@ -417,7 +418,7 @@ const z = class z extends r.Component {
417
418
  */
418
419
  // tslint:enable:max-line-length
419
420
  get columns() {
420
- const a = this._columns.filter((d) => d.declarationIndex >= 0 && d.parentIndex === -1);
421
+ const a = this._columns.filter((p) => p.declarationIndex >= 0 && p.parentIndex === -1);
421
422
  return ut(a);
422
423
  }
423
424
  /**
@@ -447,11 +448,11 @@ const z = class z extends r.Component {
447
448
  contextStateRef: this.contextStateRef,
448
449
  navigationStateRef: this.navigationStateRef
449
450
  }), this.isRtl && this.forceUpdate();
450
- const d = {
451
+ const p = {
451
452
  rootMargin: "0px",
452
453
  threshold: 0.9
453
454
  };
454
- this.clipboardService && this.clipboardService.addEventListeners(this.document), this.observer = U && window.IntersectionObserver && new window.IntersectionObserver(this.handleIntersection, d) || null;
455
+ this.clipboardService && this.clipboardService.addEventListeners(this.document), this.observer = U && window.IntersectionObserver && new window.IntersectionObserver(this.handleIntersection, p) || null;
455
456
  }
456
457
  /**
457
458
  * @hidden
@@ -485,7 +486,7 @@ const z = class z extends r.Component {
485
486
  render() {
486
487
  var ie;
487
488
  let a = this.props.total || 0;
488
- const d = _.getIdPrefix(this.navigationStateRef), c = ot(this);
489
+ const p = _.getIdPrefix(this.navigationStateRef), c = ot(this);
489
490
  let e = [];
490
491
  Array.isArray(this.props.data) ? (e = this.props.data, a = a || this.props.data.length) : this.props.data && (e = this.props.data.data, a = a || this.props.data.total);
491
492
  const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", { resolvedGroupsCount: i, flattedData: n } = this.flatData(
@@ -502,9 +503,9 @@ const z = class z extends r.Component {
502
503
  this.columnResize.resizable = this.props.resizable || !1, this.dragLogic.reorderable = this.props.reorderable || !1, this.dragLogic.groupable = h;
503
504
  const l = this.props.selectable && this.props.selectable.drag ? "none" : void 0;
504
505
  this.initializeVirtualization(a, h);
505
- const p = this.childrenToArray(this.props.children);
506
- this.initColumns(p, i);
507
- const v = p.map((o) => o && o.type && o.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(o, { ...o.props, ariaControls: this._gridId }) : null), R = p.filter((o) => o && o.type && o.type.displayName === "KendoReactGridNoRecords"), I = p.filter((o) => o && o.type && o.type.displayName === "KendoReactGridStatusBar"), b = this._columns.filter((o) => o.children.length === 0), F = h && /* @__PURE__ */ r.createElement(
506
+ const d = this.childrenToArray(this.props.children);
507
+ this.initColumns(d, i);
508
+ const v = d.map((o) => o && o.type && o.type.displayName === "KendoReactGridToolbar" ? r.cloneElement(o, { ...o.props, ariaControls: this._gridId }) : null), R = d.filter((o) => o && o.type && o.type.displayName === "KendoReactGridNoRecords"), I = d.filter((o) => o && o.type && o.type.displayName === "KendoReactGridStatusBar"), b = this._columns.filter((o) => o.children.length === 0), F = h && /* @__PURE__ */ r.createElement(
508
509
  st,
509
510
  {
510
511
  group: this.props.group || [],
@@ -569,7 +570,7 @@ const z = class z extends r.Component {
569
570
  columns: b,
570
571
  tableViewPortWidth: De,
571
572
  scrollLeft: ze
572
- }), Ne = (o, g, m) => {
573
+ }), Le = (o, g, m) => {
573
574
  let E = !1;
574
575
  const k = this.props.selectedField ? ve(this.props.selectedField, o.dataItem) : void 0;
575
576
  return {
@@ -589,7 +590,7 @@ const z = class z extends r.Component {
589
590
  onContextMenu: this.onContextMenu,
590
591
  key: H,
591
592
  locked: this.props.lockGroups,
592
- id: _.generateNavigatableId(`${g}-${String(f)}`, d),
593
+ id: _.generateNavigatableId(`${g}-${String(f)}`, p),
593
594
  colSpan: He[f],
594
595
  dataItem: o.dataItem,
595
596
  field: u.field,
@@ -637,7 +638,7 @@ const z = class z extends r.Component {
637
638
  let o = -1, g = 0;
638
639
  (this._slicedData || this._data).forEach((m, E) => {
639
640
  m.rowType === "data" && (J++, o++);
640
- const k = J % 2 === 0, u = this.props.dataItemKey && Pe(this.props.dataItemKey)(m.dataItem), f = E + (this.vs.realSkip || 0), H = u || "ai" + f, T = H + "_1", y = Ne(m, H, o);
641
+ const k = J % 2 === 0, u = this.props.dataItemKey && Pe(this.props.dataItemKey)(m.dataItem), f = E + (this.vs.realSkip || 0), H = u || "ai" + f, T = H + "_1", y = Le(m, H, o);
641
642
  if (D = f + O + g, M.push(/* @__PURE__ */ r.createElement(
642
643
  vt,
643
644
  {
@@ -664,7 +665,7 @@ const z = class z extends r.Component {
664
665
  "tr",
665
666
  {
666
667
  key: T,
667
- className: L(
668
+ className: N(
668
669
  "k-table-row",
669
670
  k ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
670
671
  ),
@@ -674,7 +675,7 @@ const z = class z extends r.Component {
674
675
  },
675
676
  this.props.group && this.props.group.map((P, C) => {
676
677
  var oe;
677
- const N = (oe = y == null ? void 0 : y.row[C]) == null ? void 0 : oe.props.style, Me = N ? this.isRtl ? { left: N.right, right: N.left } : { left: N.left, right: N.right } : {};
678
+ const L = (oe = y == null ? void 0 : y.row[C]) == null ? void 0 : oe.props.style, Me = L ? this.isRtl ? { left: L.right, right: L.left } : { left: L.left, right: L.right } : {};
678
679
  return /* @__PURE__ */ r.createElement(
679
680
  be,
680
681
  {
@@ -695,7 +696,7 @@ const z = class z extends r.Component {
695
696
  this.props.expandField && /* @__PURE__ */ r.createElement(
696
697
  St,
697
698
  {
698
- id: _.generateNavigatableId(`${T}-dhcell`, d)
699
+ id: _.generateNavigatableId(`${T}-dhcell`, p)
699
700
  }
700
701
  ),
701
702
  /* @__PURE__ */ r.createElement(
@@ -707,7 +708,7 @@ const z = class z extends r.Component {
707
708
  colSpan: w,
708
709
  ariaColIndex: 2 + (this.props.group ? this.props.group.length : 0),
709
710
  detail: this.props.detail,
710
- id: _.generateNavigatableId(`${T}-dcell`, d)
711
+ id: _.generateNavigatableId(`${T}-dcell`, p)
711
712
  }
712
713
  )
713
714
  ));
@@ -724,7 +725,7 @@ const z = class z extends r.Component {
724
725
  take: (this.props.take !== void 0 ? this.props.take : this.props.pageSize) || 10,
725
726
  messagesMap: at,
726
727
  ...yt(this.props.pageable || {})
727
- }, Y = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...X }) : /* @__PURE__ */ r.createElement(je, { className: "k-grid-pager", ...X }), Le = (o) => this.props.sort && this.props.sort.filter((g) => g.field === o).length > 0, Fe = (o, g) => /* @__PURE__ */ r.createElement(
728
+ }, Y = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...X }) : /* @__PURE__ */ r.createElement(je, { className: "k-grid-pager", ...X }), Ne = (o) => this.props.sort && this.props.sort.filter((g) => g.field === o).length > 0, Fe = (o, g) => /* @__PURE__ */ r.createElement(
728
729
  "col",
729
730
  {
730
731
  key: g.toString(),
@@ -765,7 +766,7 @@ const z = class z extends r.Component {
765
766
  "col",
766
767
  {
767
768
  key: g.toString(),
768
- className: Le(o.field) ? "k-sorted" : void 0,
769
+ className: Ne(o.field) ? "k-sorted" : void 0,
769
770
  width: W(o)
770
771
  }
771
772
  )
@@ -777,7 +778,7 @@ const z = class z extends r.Component {
777
778
  {
778
779
  id: this.props.id,
779
780
  style: this.props.style,
780
- className: L(
781
+ className: N(
781
782
  "k-grid",
782
783
  {
783
784
  "k-grid-md": !this.props.size,
@@ -807,7 +808,7 @@ const z = class z extends r.Component {
807
808
  /* @__PURE__ */ r.createElement(
808
809
  "table",
809
810
  {
810
- className: L(
811
+ className: N(
811
812
  "k-table k-grid-table",
812
813
  { [`k-table-${G.sizeMap[this.props.size] || this.props.size}`]: this.props.size }
813
814
  ),
@@ -828,7 +829,7 @@ const z = class z extends r.Component {
828
829
  {
829
830
  id: this.props.id,
830
831
  style: A,
831
- className: L(
832
+ className: N(
832
833
  "k-grid",
833
834
  {
834
835
  "k-grid-md": !this.props.size,
@@ -878,7 +879,7 @@ const z = class z extends r.Component {
878
879
  /* @__PURE__ */ r.createElement(
879
880
  "table",
880
881
  {
881
- className: L(
882
+ className: N(
882
883
  "k-table k-grid-table",
883
884
  {
884
885
  "k-table-md": !this.props.size,
@@ -918,8 +919,8 @@ const z = class z extends r.Component {
918
919
  }
919
920
  selectionChange(a) {
920
921
  if (this.props.onSelectionChange) {
921
- const { event: d, dataItem: c, dataIndex: e, columnIndex: t } = a, { mode: i, cell: n } = ae(this.props.selectable), h = {
922
- ...this.getArguments(d.syntheticEvent),
922
+ const { event: p, dataItem: c, dataIndex: e, columnIndex: t } = a, { mode: i, cell: n } = ae(this.props.selectable), h = {
923
+ ...this.getArguments(p.syntheticEvent),
923
924
  dataItem: c,
924
925
  startColIndex: t,
925
926
  endColIndex: t,
@@ -939,10 +940,10 @@ const z = class z extends r.Component {
939
940
  this.props.onSelectionChange.call(void 0, h);
940
941
  }
941
942
  }
942
- raiseDataEvent(a, d, c, e, t) {
943
+ raiseDataEvent(a, p, c, e, t) {
943
944
  const i = this.props.onDataStateChange;
944
945
  if (a) {
945
- const n = { ...this.getArguments(e), ...d, targetEvent: t };
946
+ const n = { ...this.getArguments(e), ...p, targetEvent: t };
946
947
  a.call(void 0, n);
947
948
  } else
948
949
  i && i.call(
@@ -957,56 +958,60 @@ const z = class z extends r.Component {
957
958
  }
958
959
  );
959
960
  }
960
- columnReorder(a, d, c) {
961
- const e = this._columns[a], t = e.depth, i = (p) => {
961
+ columnReorder(a, p, c) {
962
+ const e = this._columns[a], t = e.depth, i = (d) => {
962
963
  do
963
- p++;
964
- while (p < this._columns.length && this._columns[p].depth > t);
965
- return p;
964
+ d++;
965
+ while (d < this._columns.length && this._columns[d].depth > t);
966
+ return d;
966
967
  }, n = this._columns.splice(a, i(a) - a);
967
- this._columns.splice(a < d ? i(d - n.length) : d, 0, ...n), this._columns.filter((p) => p.declarationIndex >= 0).forEach((p, v) => p.orderIndex = v), this._columnsMutations++;
968
- const h = this._columns[a].locked && this._columns[d].locked;
968
+ this._columns.splice(a < p ? i(p - n.length) : p, 0, ...n), this._columns.filter((d) => d.declarationIndex >= 0).forEach((d, v) => d.orderIndex = v), this._columnsMutations++;
969
+ const h = this._columns[a].locked && this._columns[p].locked;
969
970
  qe(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), Je(this._columnsMap, this._columns, h || this._shouldUpdateLeftRight), this._resized && (this._shouldUpdateLeftRight = !1, this._resized = !1);
970
971
  const l = this.columns;
971
972
  if (this.forceUpdate(), this.props.onColumnReorder) {
972
- const p = {
973
+ const d = {
973
974
  target: this,
974
975
  columns: l,
975
976
  columnId: e.id,
976
977
  nativeEvent: c
977
978
  };
978
- this.props.onColumnReorder.call(void 0, p);
979
+ this.props.onColumnReorder.call(void 0, d);
979
980
  }
980
981
  }
981
- groupReorder(a, d, c) {
982
+ groupReorder(a, p, c) {
982
983
  if (this.props.group === void 0)
983
984
  return;
984
985
  const e = this.props.group.slice();
985
- e.splice(d, 0, ...e.splice(a, 1)), this.groupChange(e, c);
986
+ e.splice(p, 0, ...e.splice(a, 1)), this.groupChange(e, c);
986
987
  }
987
- columnToGroup(a, d, c) {
988
+ columnToGroup(a, p, c) {
988
989
  const e = this._columns[a].field;
989
990
  if (!e)
990
991
  return;
991
992
  const t = (this.props.group || []).slice();
992
- t.splice(d, 0, { field: e }), this.groupChange(t, c);
993
+ t.splice(p, 0, { field: e }), this.groupChange(t, c);
994
+ }
995
+ columnGroupChange(a, p) {
996
+ const c = this.dragLogic.getCurrentGroupsLength;
997
+ this.columnToGroup(a, c, p);
993
998
  }
994
999
  resetTableWidth() {
995
1000
  let a = 0;
996
1001
  if (!this.columnResize.colGroupMain)
997
1002
  return;
998
- const d = this.columnResize.colGroupMain.children;
999
- for (let c = 0; c < d.length; c++) {
1000
- const e = d[c].width;
1003
+ const p = this.columnResize.colGroupMain.children;
1004
+ for (let c = 0; c < p.length; c++) {
1005
+ const e = p[c].width;
1001
1006
  if (!e)
1002
1007
  return;
1003
1008
  a += parseFloat(e.toString());
1004
1009
  }
1005
1010
  a = Math.round(a), this._header && this._header.setWidth(a), this._footer && this._footer.setWidth(a), this.tableElement && (this.tableElement.style.width = a + "px");
1006
1011
  }
1007
- initColumns(a, d) {
1012
+ initColumns(a, p) {
1008
1013
  const c = _.getIdPrefix(this.navigationStateRef);
1009
- this._columns = this.readColumns(a, c, this._columnsMutations), this._columns.length === 0 && (this._columns = gt(this.props.data, this.props.group, this.props.expandField, { prevId: 0, idPrefix: c })), this.configureColumns(this._columns, d, c), this._columnsMap = this.mapColumns(this._columns), this.columnResize.columns = this._columns, this.dragLogic.columns = this._columns;
1014
+ this._columns = this.readColumns(a, c, this._columnsMutations), this._columns.length === 0 && (this._columns = gt(this.props.data, this.props.group, this.props.expandField, { prevId: 0, idPrefix: c })), this.configureColumns(this._columns, p, c), this._columnsMap = this.mapColumns(this._columns), this.columnResize.columns = this._columns, this.dragLogic.columns = this._columns;
1010
1015
  }
1011
1016
  getDataState() {
1012
1017
  return {