@progress/kendo-react-grid 9.4.0-develop.27 → 9.4.0-develop.29

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.
@@ -6,4 +6,4 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Mt=require("react"),b=require("@progress/kendo-react-common"),l=require("@progress/kendo-react-data-tools"),Tt=require("./drag/ColumnResize.js"),At=require("./drag/CommonDragLogic.js"),Ht=require("./constants/index.js"),w=require("./utils/index.js"),Ae=require("./VirtualScrollFixed.js"),Gt=require("./VirtualScroll.js"),Ft=require("./contextMenu/GridContextMenu.js"),He=require("./contextMenu/enums.js"),Ge=require("./sortCommon.js");function Lt(t){const R=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const h in t)if(h!=="default"){const H=Object.getOwnPropertyDescriptor(t,h);Object.defineProperty(R,h,H.get?H:{enumerable:!0,get:()=>t[h]})}}return R.default=t,Object.freeze(R)}const i=Lt(Mt),Fe=i.createContext(void 0),Ot=t=>{var Se,De;const R=t.gridProps.isClient,[h,H]=i.useState({}),Le=e=>{e.event.preventDefault(),H({...h,show:!0,offset:{left:e.event.pageX,top:e.event.pageY},dataItem:e.dataItem,field:e.field})},me=()=>{H({})},I=i.useMemo(()=>t.columnsRef.current.find(e=>e.field===h.field),[t.columnsRef,h]),Pe=i.useMemo(()=>{const e=t.gridProps.sortable&&(I==null?void 0:I.sortable);return w.getDefaultHeadContextMenuItems({sortable:!!e,selectable:l.getSelectionOptions(t.gridProps.selectable).enabled,clipboard:!!t.gridProps.clipboard})},[I,t.gridProps.sortable,t.gridProps.selectable,t.gridProps.clipboard]),he=i.useMemo(()=>{const e=t.gridProps.sortable&&(I==null?void 0:I.sortable);return w.getDefaultBodyContextMenuItems({sortable:!!e,selectable:l.getSelectionOptions(t.gridProps.selectable).enabled,clipboard:!!t.gridProps.clipboard,rowReorderable:w.isRowReorderEnabled(t.gridProps.rowReorderable)})},[I,t.gridProps.sortable,t.gridProps.selectable,t.gridProps.clipboard]),Oe=i.useMemo(()=>{const e=(I==null?void 0:I.contextMenu)||t.gridProps.contextMenu,r=typeof e=="function"?e(h):e;if(r&&h.offset){const n=h.dataItem?He.GridContextMenuAnchorPart.body:He.GridContextMenuAnchorPart.head,a=r[n],o=h.dataItem?he:Pe;return a===!1?void 0:a===!0||a===void 0?o:a}},[t.gridProps.contextMenu,h,he,Pe,I]),ze=e=>{var s,m,P,u,y,ke,Ke,Me,Te;const r=e.event.item,n={target:E.current,syntheticEvent:e.event.syntheticEvent,nativeEvent:e.event.nativeEvent,menuItem:r,...e};t.gridProps.onContextMenuItemClick&&g(t.gridProps.onContextMenuItemClick,n);const a=B(),o={selectedField:t.gridProps.selectedField||"",componentId:t.id,dataItems:a,dataItem:e.dataItem,startRowIndex:-1,endRowIndex:-1,startColIndex:-1,endColIndex:-1,ctrlKey:!1,altKey:!1,metaKey:!1,shiftKey:!1,isDrag:!1,...l.getSelectionOptions(t.gridProps.selectable),...n},c=a.findIndex(fe=>fe===e.dataItem);switch((s=r.data)==null?void 0:s.action){case"SortCommand":if(I){const fe=(m=r.name)==null?void 0:m.toLowerCase().includes("asc"),Dt=((P=r.name)==null?void 0:P.toLowerCase().includes("desc"))?"desc":void 0,kt=fe?"asc":Dt,Kt=r.name?kt:void 0;be(e.event.syntheticEvent,I,Kt)}break;case"SelectRowCommand":et(o);break;case"SelectAllRowsCommand":pe(o);break;case"ClearSelectionCommand":tt(o);break;case"ReorderRowCommand":N.current=e.dataItem,(u=r.name)!=null&&u.toLowerCase().includes("rowup")&&c>0&&F(e.event.syntheticEvent,c-1,"before"),(y=r.name)!=null&&y.toLowerCase().includes("rowdown")&&c<a.length-1&&F(e.event.syntheticEvent,c+1,"after"),(ke=r.name)!=null&&ke.toLowerCase().includes("rowtop")&&F(e.event.syntheticEvent,0,"before"),(Ke=r.name)!=null&&Ke.toLowerCase().includes("rowbottom")&&F(e.event.syntheticEvent,a.length-1,"after");break;case"CopySelectionCommand":W(l.ClipboardActionType.copy,e.event.nativeEvent,{copyHeaders:!((Me=r.name)!=null&&Me.toLowerCase().includes("noheaders"))},e.dataItem,e.field);break;case"PasteCommand":W(l.ClipboardActionType.paste,e.event.nativeEvent,{copyHeaders:!((Te=r.name)!=null&&Te.toLowerCase().includes("noheaders"))},e.dataItem,e.field);break}me()},q=()=>{const e=f.current.filter(r=>r.declarationIndex>=0&&r.parentIndex===-1);return w.sanitizeColumns(e)},Ne=(e,r,n)=>{if(t.gridProps.onContextMenu&&R){const a={target:E.current,syntheticEvent:e,nativeEvent:e.nativeEvent,dataItem:r,field:n};g(t.gridProps.onContextMenu,a)}t.gridProps.contextMenu&&Le({event:e,dataItem:r,field:n})},qe=e=>{if(e.target!==e.currentTarget)return;clearTimeout(se.current),d.current&&(d.current.table=k.current);const r=e.currentTarget.scrollLeft,n=e.currentTarget.scrollTop,a=t.gridProps.scrollable==="virtual";t.gridProps.columnVirtualization&&(!a||n===le.current)&&(se.current=window.setTimeout(()=>{re()},0)),t.gridProps.scrollLeftRef&&(t.gridProps.scrollLeftRef.current=r),z.current&&z.current.setScrollLeft(r),O.current&&O.current.setScrollLeft(r),d.current&&n!==le.current&&d.current.scrollHandler(e),t.gridProps.onScroll&&R&&g(t.gridProps.onScroll,{...C(e)}),le.current=n},Ue=e=>{var n,a;l.tableKeyboardNavigation.onKeyDown(e,{navigatable:t.gridProps.navigatable||!1,contextStateRef:D,navigationStateRef:M,onNavigationAction:We,columns:q()}),l.tableKeyboardNavigation.onGetSnapshotBeforeUpdate({document:x(),contextStateRef:D,navigationStateRef:M});const r={dataItems:_(),mode:v.mode,cell:v.cell,componentId:t.id,selectedField:t.gridProps.selectedField,...C(e)};if(t.gridProps.onKeyDown&&R&&g(t.gridProps.onKeyDown,r),!t.gridProps.selectedField&&v.enabled&&t.gridProps.dataItemKey){const o=l.getSelectedStateFromKeyDown({event:r,selectedState:(n=t.gridProps.select)!=null?n:{},dataItemKey:t.gridProps.dataItemKey});if(o===t.gridProps.select)return;const c=e.target,s=l.closestTagName(c,"TD"),m=l.closestTagName(c,"TR"),P=l.getColumnIndex(s),u=l.getRowIndex(m);if(P!==void 0&&u!==void 0){const y=(a=w.getDataAsArray(t.gridProps.data))==null?void 0:a[u];t.gridProps.onSelectionChange&&g(t.gridProps.onSelectionChange,{...r,select:o,dataItem:y,startRowIndex:u,startColIndex:P,startDataItem:y,endDataItem:y,endRowIndex:u,endColIndex:P,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isDrag:!1})}}},Ve=e=>{l.tableKeyboardNavigation.onFocus(e,{navigatable:!!t.gridProps.navigatable,contextStateRef:D})},We=e=>{if(e.action==="moveToNextPage"&&nt(e.event),e.action==="moveToPrevPage"&&at(e.event),e.focusElement&&e.action==="reorderToRight"){const r=parseInt(e.focusElement.ariaColIndex,10)-1;r<f.current.length-1&&Z(r,r+1,e.event)}if(e.focusElement&&e.action==="reorderToLeft"){const r=parseInt(e.focusElement.ariaColIndex,10)-1;r>0&&Z(r,r-1,e.event)}if(t.gridProps.onNavigationAction&&R){const r={focusElement:e.focusElement,...C(e.event)};g(t.gridProps.onNavigationAction,r)}},_e=(e,r)=>{t.gridProps.onRowClick&&e.target.nodeName==="TD"&&g(t.gridProps.onRowClick,{dataItem:r,...C(e)})},Be=(e,r)=>{t.gridProps.onRowDoubleClick&&e.target.nodeName==="TD"&&g(t.gridProps.onRowDoubleClick,{dataItem:r,...C(e)})},je=(e,r,n)=>{if(we.enabled&&we.mode==="incell"&&t.gridProps.dataItemKey){const a=l.editReducer(t.gridProps.edit,{type:l.EDIT_ACTION.ENTER_FIELD_EDIT,payload:{id:r[t.gridProps.dataItemKey],field:n}});t.gridProps.onEditChange&&g(t.gridProps.onEditChange,{edit:a,...C(e)})}},$e=(e,r)=>{var a;if(l.getDetailExpandableOptions(t.detailExpandable).enabled){const o=l.detailExpandReducer((a=t.gridProps.detailExpand)!=null?a:{},e);t.gridProps.onDetailExpandChange&&g(t.gridProps.onDetailExpandChange,{...C(r),detailExpand:o})}},Xe=(e,r)=>{var a;const n=l.getGroupExpandableOptions(typeof t.gridProps.groupable=="object"?t.gridProps.groupable.expandable!==!1:t.gridProps.groupable);if(n.enabled){const o=l.groupExpandReducer((a=t.gridProps.groupExpand)!=null?a:[],e,n);t.gridProps.onGroupExpandChange&&g(t.gridProps.onGroupExpandChange,{...C(r),groupExpand:o})}},be=(e,r,n)=>{const{allowUnsort:a,mode:o}=Ge.normalize(t.gridProps.sortable||!1,r.sortable||!1),c=(t.gridProps.sort||[]).filter(P=>P.field===r.field)[0],s=n||Ge.firstLevelSortSeqMap[a][c&&c.dir||""],m=o==="single"?[]:(t.gridProps.sort||[]).filter(P=>P.field!==r.field);s!==""&&r.field&&m.push({field:r.field,dir:s}),Ie(m,e)},Je=e=>{var r;if(e.field===t.gridProps.expandField||e._expand||t.gridProps.group&&e.field===void 0){if(t.gridProps.onExpandChange){const n=t.gridProps.dataItemKey?l.detailExpandReducer((r=t.gridProps.detailExpand)!=null?r:{},{type:l.DETAIL_EXPAND_ACTION.SET,id:e.dataItem[t.gridProps.dataItemKey],payload:e.value}):t.gridProps.detailExpand;g(t.gridProps.onExpandChange,{...C(e.syntheticEvent),expand:n,dataItem:e.dataItem,dataIndex:e.dataIndex,value:e.value})}return}t.gridProps.onItemChange&&g(t.gridProps.onItemChange,{...C(e.syntheticEvent),dataItem:e.dataItem,dataIndex:e.dataIndex,field:e.field,value:e.value})},Ye=e=>{var r;if(t.gridProps.onSelectionChange&&v.enabled){const{event:n,dataItem:a,dataIndex:o,columnIndex:c}=e,s={...C(n.syntheticEvent),dataItem:a,startColIndex:c,endColIndex:c,startRowIndex:o,endRowIndex:o,dataItems:_(),altKey:!1,ctrlKey:!1,shiftKey:!1,metaKey:!1,mode:v.mode,cell:v.cell,isDrag:!1,componentId:t.id,selectedField:t.gridProps.selectedField||""};g(t.gridProps.onSelectionChange,{...s,select:t.gridProps.dataItemKey?l.getSelectedState({event:s,selectedState:(r=t.gridProps.select)!=null?r:{},dataItemKey:t.gridProps.dataItemKey}):{}})}},Qe=e=>{var r;if(t.gridProps.onHeaderSelectionChange&&v.enabled){const n=_();g(t.gridProps.onHeaderSelectionChange,{select:e.syntheticEvent.target.checked?n.reduce((a,o)=>(t.gridProps.dataItemKey&&b.getter(t.gridProps.dataItemKey)(o)!==void 0&&(a[b.getter(t.gridProps.dataItemKey)(o)]=!0),a),{}):{},field:e.field,nativeEvent:e.syntheticEvent&&e.syntheticEvent.nativeEvent,syntheticEvent:e.syntheticEvent,target:E.current,dataItems:n,selectedField:(r=t.gridProps.selectedField)!=null?r:""})}},U=(e,r)=>{t.gridProps.onSelectionChange&&R&&v.enabled&&g(t.gridProps.onSelectionChange,{...e,select:r})},Ze=e=>{var r;if(t.gridProps.onSelectionChange&&v.enabled){const n=B()[e.startRowIndex],a=B()[e.endRowIndex],o={syntheticEvent:void 0,target:E.current,selectedField:t.gridProps.selectedField||"",componentId:t.id,dataItems:_(),dataItem:null,startDataItem:n,endDataItem:a,...e},c=l.getSelectedState({event:o,selectedState:(r=t.gridProps.select)!=null?r:{},dataItemKey:t.gridProps.dataItemKey});U(o,c)}},pe=e=>{if(t.gridProps.onSelectionChange&&v.enabled){const r=e.dataItems[0],n=e.dataItems[e.dataItems.length-1],a={},o={...e,startDataItem:r,endDataItem:n,startRowIndex:0,endRowIndex:e.dataItems.length-1,startColIndex:0,endColIndex:f.current.length-1};e.dataItems.forEach(c=>{const m=b.getter(t.gridProps.dataItemKey)(c);a[m]=e.cell?[...Array(f.current.length).keys()]:!0}),U(o,a)}},et=e=>{if(t.gridProps.onSelectionChange&&v.enabled){const n=b.getter(t.gridProps.dataItemKey)(e.dataItem),a=0,o=f.current.length-1,c=e.dataItems.findIndex(y=>y[t.gridProps.dataItemKey]===e.dataItem[t.gridProps.dataItemKey]),P={...e,startDataItem:c,endDataItem:c,startRowIndex:c,endRowIndex:c,startColIndex:a,endColIndex:o},u=e.mode==="multiple"?t.gridProps.select||{}:{};u[n]===!0||Array.isArray(u[n])&&u[n].length===f.current.length?delete u[n]:u[n]=e.cell?[...Array(f.current.length).keys()]:!0,U(P,u)}},tt=e=>{t.gridProps.onSelectionChange&&v.enabled&&U(e,{})},G=(e,r,n,a,o)=>{const c=t.gridProps.onDataStateChange;if(e){const s={...C(a),...r,targetEvent:o};g(e,s)}else c&&g(c,{...C(a),targetEvent:o||{},dataState:{...ft(),...n}})},V=(e,r,n)=>{G(t.gridProps.onPageChange,{page:e},{skip:e.skip,take:e.take},r,n)},rt=()=>{let e=t.gridProps.total||0;return Array.isArray(t.gridProps.data)?e=e||t.gridProps.data.length:t.gridProps.data&&(e=e||t.gridProps.data.total),e},nt=e=>{var o,c;const r=(c=(o=t.gridProps.take)!=null?o:t.gridProps.pageSize)!=null?c:0,n=(t.gridProps.skip||0)+r,a=rt();n<a&&V({skip:n,take:r},e)},at=e=>{var a,o;const r=(o=(a=t.gridProps.take)!=null?a:t.gridProps.pageSize)!=null?o:0,n=(t.gridProps.skip||0)-r;n>=0&&V({skip:n,take:r},e)},ot=e=>{V({skip:e.skip,take:e.take},e.syntheticEvent,e.targetEvent)},Ie=(e,r)=>{G(t.gridProps.onSortChange,{sort:e},{sort:e,...t.gridProps.scrollable==="virtual"?{skip:0}:{}},r)},it=(e,r)=>{G(t.gridProps.onFilterChange,{filter:e},{filter:e||void 0,skip:0},r)},ct=e=>{const r=t.gridProps.searchFields||f.current.map(o=>o.field)||[],n=e.nativeEvent.target.value,a={logic:"or",filters:r.filter(o=>o!==void 0).map(o=>{var c;return typeof o=="string"?{field:o,value:n,operator:"contains"}:{value:n,operator:(c=o.operator)!=null?c:"contains",field:o.field,ignoreCase:o.ignoreCase}})};G(t.gridProps.onSearchChange,{search:a},{},e.syntheticEvent)},Q=(e,r)=>{const n=r.nativeEvent?r:{nativeEvent:r.nativeEvent||r.originalEvent};e.length===0&&t.gridProps.navigatable&&(ie.current=!0),G(t.gridProps.onGroupChange,{group:e},{group:e,skip:0},n)},dt=e=>{if(t.gridProps.onColumnsStateChange){const r={target:E.current,columnsState:e};g(t.gridProps.onColumnsStateChange,r)}},Z=(e,r,n)=>{const a=f.current[e],o=a.depth,c=u=>{do u++;while(u<f.current.length&&f.current[u].depth>o);return u},s=f.current.splice(e,c(e)-e);f.current.splice(e<r?c(r-s.length):r,0,...s),f.current.filter(u=>u.declarationIndex>=0).forEach((u,y)=>u.orderIndex=y);const m=f.current[e].locked&&f.current[r].locked;l.updateLeft(t.columnsMapRef,f.current,m||Y.current),l.updateRight(t.columnsMapRef,f.current,m||Y.current),oe.current&&(Y.current=!1,oe.current=!1);const P=q();if(re(),t.gridProps.onColumnReorder){const u={target:E.current,columns:P,columnId:a.id,nativeEvent:n};g(t.gridProps.onColumnReorder,u)}},F=(e,r,n)=>{const a=typeof t.gridProps.rowReorderable=="object"?t.gridProps.rowReorderable.enabled:t.gridProps.rowReorderable;if(n==="forbidden"||!a||!N.current)return;const{slicedData:o,dataRef:c}=t,s=(o||c)[r];t.gridProps.onRowReorder&&g(t.gridProps.onRowReorder,{draggedDataItems:[N.current],droppedDataItem:s==null?void 0:s.dataItem,dropPosition:n,nativeEvent:e.originalEvent,dragEvent:e,target:E.current}),N.current=null},lt=(e,r,n)=>{if(t.gridProps.group===void 0)return;const a=t.gridProps.group.slice();a.splice(r,0,...a.splice(e,1)),Q(a,n)},Ce=(e,r,n)=>{const a=f.current[e].field;if(!a)return;const o=(t.gridProps.group||[]).slice();o.splice(r,0,{field:a}),Q(o,n)},st=(e,r)=>{const n=K.current.getCurrentGroupsLength;Ce(e,n,r)},p=()=>{let e=0;if(!S.current.colGroupMain)return;const r=S.current.colGroupMain.children;for(let n=0;n<r.length;n++){const a=r[n].width;if(!a)return;e+=parseFloat(a.toString())}e=Math.round(e),z.current&&z.current.setWidth(e),O.current&&O.current.setWidth(e),k.current&&(k.current.style.width=e+"px")},W=i.useCallback((e,r,n,a,o)=>{var P;if(!ut()&&!n||!e)return;const c={type:e,nativeEvent:r,columns:f.current,dataItemKey:t.gridProps.dataItemKey||"",dataItem:a,field:o,...typeof t.gridProps.clipboard!="boolean"?t.gridProps.clipboard:{},...n},s=B(),m=l.populateClipboardData({event:c,data:s,selectedState:(P=t.gridProps.select)!=null?P:{},previousCopiedItems:Ee.current});e!==l.ClipboardActionType.paste&&(Ee.current=m.copiedItems),t.gridProps.onClipboard&&R&&g(t.gridProps.onClipboard,{...c,...m})},[t.gridProps.select,t.gridProps.dataItemKey,t.gridProps.data,t.gridProps.clipboard,t.gridProps.onClipboard]),ut=()=>{var o,c,s;if(!b.canUseDOM)return!1;const e=b.getActiveElement(x()),r=e?e.matches(".k-table-td")?e:(o=x())==null?void 0:o.body:(c=x())==null?void 0:c.body,n=r.closest(".k-grid-container"),a=r&&((s=A.current)==null?void 0:s.contains(r));return!!(r&&a&&n)},gt=(e,r,n,a,o,c)=>{p(),Y.current=!0,oe.current=!0,t.gridProps.onColumnResize&&R&&g(t.gridProps.onColumnResize,{columns:q(),nativeEvent:a,targetColumnId:c,index:e,newWidth:r,oldWidth:n,end:o,target:E.current})},ft=()=>{var e;return{filter:t.gridProps.filter,sort:t.gridProps.sort,skip:t.gridProps.skip,take:(e=t.gridProps.take)!=null?e:t.gridProps.pageSize,group:t.gridProps.group}},C=e=>({nativeEvent:e&&e.nativeEvent,syntheticEvent:e,target:E.current}),mt=e=>({...e,nativeEvent:void 0,syntheticEvent:void 0,target:void 0,targetEvent:void 0,focusElement:void 0}),g=(e,r)=>{if(t.gridProps.isClient){e(r);return}e(mt(r))},Pt=()=>{var e,r,n;if(L.current&&((e=L.current)==null?void 0:e.getElementsByClassName("k-grid-edit-row").length)>0){de.current=!1,(r=document.activeElement)!=null&&r.closest(".k-grid-edit-row")?ce.current=document.activeElement:ce.current=void 0;const a=Array.from((n=L.current)==null?void 0:n.getElementsByClassName("k-grid-edit-row"));a.length>ge.current.length?J.current=a.filter(o=>!ge.current.includes(o))[0]:a.length===1&&(J.current=a[0],de.current=!0),ge.current=a}},_=()=>t.dataRef.filter(e=>e.rowType==="data").map(e=>e.dataItem),B=()=>(t.slicedData||t.dataRef).filter(e=>e.rowType==="data").map(e=>e.dataItem),ee=()=>(ae.current||(ae.current=b.getScrollbarWidth()||void 0),ae.current),x=()=>{var e;if(b.canUseDOM)return((e=j())==null?void 0:e.ownerDocument)||document},j=()=>A.current,te=i.useCallback(e=>{var a;if(!d.current||!((a=d.current)!=null&&a.container)||t.gridProps.scrollable==="none")return;T.current&&T.current.disconnect();const{rowIndex:r}=e,n=j();if(t.gridProps.scrollable==="virtual")d.current.askedSkip=r,d.current.container.scroll(0,Math.round(d.current.askedSkip/d.current.total*d.current.container.scrollHeight));else if(n){const o=r<1?n.querySelector("tbody > tr:nth-child(1)"):n.querySelector(`tbody > tr:nth-child(${r+1})`);o&&X.current&&(X.current.scrollTop=o.offsetTop)}},[t.gridProps.scrollable]),Re=e=>JSON.stringify(e.map(r=>({id:r.id,field:r.field,title:r.title,children:r.children}))),ht=()=>Re(xt)===Re(f.current),bt=()=>{ht()||re()},It=()=>{const{data:e,total:r}=t.gridProps;return Array.isArray(e)?e.length===r:e?r===e.total:!1},Ct=(e,r)=>{var n,a;if(d.current){if(d.current.fixedScroll=t.gridProps.fixedScroll||!1,d.current.PageChange=V,d.current.realSkip=t.gridProps.skip||0,d.current.pageSize=(a=(n=t.gridProps.take)!=null?n:t.gridProps.pageSize)!=null?a:0,d.current.scrollableVirtual=t.gridProps.scrollable==="virtual",d.current.total=e,d.current.propsSkip=(t.gridProps.skip||0)+(t.gridProps.scrollable==="virtual"?d.current.topCacheCount+(d.current.attendedSkip-(t.gridProps.skip||0)):0),t.gridProps.rowHeight!==void 0&&t.gridProps.rowHeight>0&&!r){const o=t.gridProps.rowHeight*e;d.current.containerHeight=w.firefox?Math.min(w.firefoxMaxHeight,o):o}else d.current.containerHeight=1533915;if(d.current.containerRef=X,d.current.tableBodyRef=L,d.current.table=k.current,d.current instanceof Ae.VirtualScrollFixed){const{rowHeight:o=0,detail:c,expandField:s}=t.gridProps;let{detailRowHeight:m=0}=t.gridProps;m=c&&s?m:o,It()?(d.current.total=t.dataRef.length,d.current.rowHeightService=new b.RowHeightService(t.dataRef.length,o,m,t.dataRef)):d.current.rowHeightService=new b.RowHeightService(e,o,m);const P=d.current.rowHeightService.totalHeight();d.current.containerHeight=w.firefox?Math.min(w.firefoxMaxHeight,P):P}}},Rt=()=>{const e=n=>n.map(a=>({id:a.id,field:a.field,title:a.title,hidden:!1,children:a.children?e(a.children):null})),r=t.columnsRef.current.filter(n=>n.depth===0);return e(r)},ve=i.useCallback(e=>{const r={rowIndex:ue.current};e.forEach(n=>{n.isIntersecting||te(r)})},[te]),re=()=>{t.gridProps.forceUpdate&&t.gridProps.forceUpdate()},vt=e=>e.left!==void 0?ye!=="rtl"?{left:e.left,right:e.right}:{left:e.right,right:e.left}:{},E=i.useRef(null),f=t.columnsRef,d=i.useRef(),S=i.useRef(),K=i.useRef(),D=i.useRef(),M=i.useRef(),$=i.useRef(),T=i.useRef(null),L=i.useRef(null),Et=i.useRef(null),X=i.useRef(null),k=i.useRef(null),ne=i.useRef(null),A=i.useRef(null),O=i.useRef(null),z=i.useRef(null),ae=i.useRef(),oe=i.useRef(!1),ie=i.useRef(!1),J=i.useRef(),ce=i.useRef(),de=i.useRef(!1),Y=i.useRef(!0),le=i.useRef(0),se=i.useRef(),ue=i.useRef(),ge=i.useRef([]),Ee=i.useRef([]),N=i.useRef(null),yt=i.useRef(null),wt=i.useRef(null),ye=b.useDir(A),xt=i.useMemo(()=>i.Children.toArray(t.gridProps.children),[t.gridProps.children]),v=l.getSelectionOptions((Se=t.gridProps.selectable)!=null?Se:!!t.gridProps.selectedField),we=l.getEditableOptions((De=t.gridProps.editable)!=null?De:!!t.gridProps.editField);i.useMemo(()=>{l.tableKeyboardNavigation.onConstructor({navigatable:!!t.gridProps.navigatable,contextStateRef:D,navigationStateRef:M,idPrefix:t.id})},[]),i.useMemo(()=>{var n;(n=d.current)==null||n.reset();const e=t.gridProps.groupable===!0||typeof t.gridProps.groupable=="object"&&t.gridProps.groupable.enabled!==!1,r=t.isFixedVirtualScroll?Ae.VirtualScrollFixed:Gt.VirtualScroll;d.current=new r(e||t.gridProps.rowHeight===void 0||t.gridProps.rowHeight===0)},[t.gridProps.scrollable,t.gridProps.total,t.gridProps.filter,t.gridProps.group,t.gridProps.groupable,t.gridProps.sort,t.gridProps.rowHeight]),i.useEffect(()=>(t.gridProps.clipboard&&($.current=new l.ClipboardService(W),$.current.addEventListeners(x())),()=>{$.current&&$.current.removeEventListeners(x())}),[t.gridProps.onClipboard,t.gridProps.clipboard,W,x]),i.useEffect(()=>(t.gridProps.columnVirtualization&&!window.navigator.userAgent.match(Ht.SAFARI_REGEX)&&(ne.current&&(ne.current.style.display="block"),k.current&&(k.current.style.display="block")),p(),b.setScrollbarWidth(ee()),l.tableKeyboardNavigation.onComponentDidMount({scope:A.current||void 0,contextStateRef:D,navigationStateRef:M}),()=>{clearTimeout(se.current)}),[]),i.useEffect(()=>{var e;p(),b.setScrollbarWidth(ee()),(e=d.current)!=null&&e.tableTransform&&d.current.table&&(d.current.table.style.transform=d.current.tableTransform,d.current.tableTransform=""),Pt(),l.tableKeyboardNavigation.onComponentDidUpdate({scope:A.current||void 0,contextStateRef:D,navigationStateRef:M,focusFirst:ie.current,newEditableRow:J.current,singleEditRow:de.current,lastActiveElement:ce.current,navigatable:t.gridProps.navigatable}),ie.current=!1,J.current=void 0}),i.useEffect(()=>{if(b.canUseDOM){const e={rootMargin:"0px",threshold:.9};T.current=window.IntersectionObserver&&new window.IntersectionObserver(ve,e)||null}},[ve]),i.useEffect(()=>{var r;let e;return b.canUseDOM&&window.ResizeObserver&&(e=new window.ResizeObserver(bt),e.observe((r=x())==null?void 0:r.body)),()=>{e==null||e.disconnect()}},[]),i.useImperativeHandle(E,()=>({get element(){return j()},props:t.gridProps,get columns(){return q()},scrollIntoView:e=>{var a;if(!((a=d.current)!=null&&a.container)||t.gridProps.scrollable==="none")return;const{rowIndex:r}=e;ue.current=r;const n=j();if(T.current&&n){T.current.disconnect();const o=n.querySelector(`[absolute-row-index="${ue.current}"]`);o?T.current.observe(o):te(e)}},fitColumns:e=>{S.current.dblClickHandler(null,e)}})),i.useImperativeHandle(t.gridRef,()=>E.current),i.useMemo(()=>{S.current=new Tt.ColumnResize(gt)},[t.gridProps.onColumnResize]),i.useMemo(()=>{K.current=new At.CommonDragLogic(Z,lt,Ce)},[t.gridProps.onColumnReorder,t.gridProps.onGroupChange,t.gridProps.group,t.gridProps.groupable]),S.current.resizable=t.gridProps.resizable||!1,S.current.columns=f.current;const xe=t.gridProps.groupable===!0||typeof t.gridProps.groupable=="object"&&t.gridProps.groupable.enabled!==!1;K.current.reorderable=t.gridProps.reorderable||!1,K.current.groupable=xe,K.current.columns=f.current,Ct(t.total,xe);const St=t.gridProps.columnsState||Rt();return i.createElement(Fe.Provider,{value:{isClient:R,rowReorder:F,activeDragRowDataItemRef:N,reorderRowDragTargetRef:yt,reorderRowDropTargetRef:wt,dir:ye,getCellPositionStyle:vt,dataItemKey:t.gridProps.dataItemKey,columnsState:St,onColumnsStateChange:dt,groupChange:Q,selectionRelease:Ze,pagerPageChange:ot,onContextMenu:Ne,rowClick:_e,rowDblClick:Be,cellClick:je,headerCellClick:be,itemChange:Je,sortChange:Ie,filterChange:it,searchChange:ct,onHeaderSelectionChange:Qe,columnGroupChange:st,onKeyDown:Ue,onFocus:Ve,scrollHandler:qe,selectionChange:Ye,dispatchDetailExpand:$e,dispatchGroupExpand:Xe,columnResizeRef:S,dragLogicRef:K,navigationStateRef:M,tableElementRef:k,tableBodyElementRef:L,headerElementRef:Et,containerElementRef:X,headTableElementRef:ne,elementRef:A,footerRef:O,headerRef:z,getCachedScrollbarWidth:ee,vsRef:d}},i.createElement(l.TableKeyboardNavigationContext.Provider,{value:D.current},t.children),i.createElement(Ft.GridContextMenu,{show:h.show,dataItem:h.dataItem,field:h.field,items:Oe,offset:h.offset,onClose:me,onSelect:ze}))};exports.GridClientWrapper=Ot;exports.GridContext=Fe;
9
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Mt=require("react"),b=require("@progress/kendo-react-common"),l=require("@progress/kendo-react-data-tools"),Tt=require("./drag/ColumnResize.js"),At=require("./drag/CommonDragLogic.js"),Ht=require("./constants/index.js"),w=require("./utils/index.js"),Ae=require("./VirtualScrollFixed.js"),Gt=require("./VirtualScroll.js"),Ft=require("./contextMenu/GridContextMenu.js"),He=require("./contextMenu/enums.js"),Ge=require("./sortCommon.js");function Lt(t){const v=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const h in t)if(h!=="default"){const H=Object.getOwnPropertyDescriptor(t,h);Object.defineProperty(v,h,H.get?H:{enumerable:!0,get:()=>t[h]})}}return v.default=t,Object.freeze(v)}const i=Lt(Mt),Fe=i.createContext(void 0),Ot=t=>{var Se,De;const v=t.gridProps.isClient,[h,H]=i.useState({}),Le=e=>{e.event.preventDefault(),H({...h,show:!0,offset:{left:e.event.pageX,top:e.event.pageY},dataItem:e.dataItem,field:e.field})},me=()=>{H({})},I=i.useMemo(()=>t.columnsRef.current.find(e=>e.field===h.field),[t.columnsRef,h]),Pe=i.useMemo(()=>{const e=t.gridProps.sortable&&(I==null?void 0:I.sortable);return w.getDefaultHeadContextMenuItems({sortable:!!e,selectable:l.getSelectionOptions(t.gridProps.selectable).enabled,clipboard:!!t.gridProps.clipboard})},[I,t.gridProps.sortable,t.gridProps.selectable,t.gridProps.clipboard]),he=i.useMemo(()=>{const e=t.gridProps.sortable&&(I==null?void 0:I.sortable);return w.getDefaultBodyContextMenuItems({sortable:!!e,selectable:l.getSelectionOptions(t.gridProps.selectable).enabled,clipboard:!!t.gridProps.clipboard,rowReorderable:w.isRowReorderEnabled(t.gridProps.rowReorderable)})},[I,t.gridProps.sortable,t.gridProps.selectable,t.gridProps.clipboard]),Oe=i.useMemo(()=>{const e=(I==null?void 0:I.contextMenu)||t.gridProps.contextMenu,r=typeof e=="function"?e(h):e;if(r&&h.offset){const n=h.dataItem?He.GridContextMenuAnchorPart.body:He.GridContextMenuAnchorPart.head,a=r[n],o=h.dataItem?he:Pe;return a===!1?void 0:a===!0||a===void 0?o:a}},[t.gridProps.contextMenu,h,he,Pe,I]),ze=e=>{var s,m,P,u,y,ke,Ke,Me,Te;const r=e.event.item,n={target:E.current,syntheticEvent:e.event.syntheticEvent,nativeEvent:e.event.nativeEvent,menuItem:r,...e};t.gridProps.onContextMenuItemClick&&g(t.gridProps.onContextMenuItemClick,n);const a=B(),o={selectedField:t.gridProps.selectedField||"",componentId:t.id,dataItems:a,dataItem:e.dataItem,startRowIndex:-1,endRowIndex:-1,startColIndex:-1,endColIndex:-1,ctrlKey:!1,altKey:!1,metaKey:!1,shiftKey:!1,isDrag:!1,...l.getSelectionOptions(t.gridProps.selectable),...n},c=a.findIndex(fe=>fe===e.dataItem);switch((s=r.data)==null?void 0:s.action){case"SortCommand":if(I){const fe=(m=r.name)==null?void 0:m.toLowerCase().includes("asc"),Dt=((P=r.name)==null?void 0:P.toLowerCase().includes("desc"))?"desc":void 0,kt=fe?"asc":Dt,Kt=r.name?kt:void 0;be(e.event.syntheticEvent,I,Kt)}break;case"SelectRowCommand":et(o);break;case"SelectAllRowsCommand":pe(o);break;case"ClearSelectionCommand":tt(o);break;case"ReorderRowCommand":N.current=e.dataItem,(u=r.name)!=null&&u.toLowerCase().includes("rowup")&&c>0&&F(e.event.syntheticEvent,c-1,"before"),(y=r.name)!=null&&y.toLowerCase().includes("rowdown")&&c<a.length-1&&F(e.event.syntheticEvent,c+1,"after"),(ke=r.name)!=null&&ke.toLowerCase().includes("rowtop")&&F(e.event.syntheticEvent,0,"before"),(Ke=r.name)!=null&&Ke.toLowerCase().includes("rowbottom")&&F(e.event.syntheticEvent,a.length-1,"after");break;case"CopySelectionCommand":W(l.ClipboardActionType.copy,e.event.nativeEvent,{copyHeaders:!((Me=r.name)!=null&&Me.toLowerCase().includes("noheaders"))},e.dataItem,e.field);break;case"PasteCommand":W(l.ClipboardActionType.paste,e.event.nativeEvent,{copyHeaders:!((Te=r.name)!=null&&Te.toLowerCase().includes("noheaders"))},e.dataItem,e.field);break}me()},q=()=>{const e=f.current.filter(r=>r.declarationIndex>=0&&r.parentIndex===-1);return w.sanitizeColumns(e)},Ne=(e,r,n)=>{if(t.gridProps.onContextMenu&&v){const a={target:E.current,syntheticEvent:e,nativeEvent:e.nativeEvent,dataItem:r,field:n};g(t.gridProps.onContextMenu,a)}t.gridProps.contextMenu&&Le({event:e,dataItem:r,field:n})},qe=e=>{if(e.target!==e.currentTarget)return;clearTimeout(se.current),d.current&&(d.current.table=k.current);const r=e.currentTarget.scrollLeft,n=e.currentTarget.scrollTop,a=t.gridProps.scrollable==="virtual";t.gridProps.columnVirtualization&&(!a||n===le.current)&&(se.current=window.setTimeout(()=>{re()},0)),t.gridProps.scrollLeftRef&&(t.gridProps.scrollLeftRef.current=r),z.current&&z.current.setScrollLeft(r),O.current&&O.current.setScrollLeft(r),d.current&&n!==le.current&&d.current.scrollHandler(e),t.gridProps.onScroll&&v&&g(t.gridProps.onScroll,{...C(e)}),le.current=n},Ue=e=>{var n,a;l.tableKeyboardNavigation.onKeyDown(e,{navigatable:t.gridProps.navigatable||!1,contextStateRef:D,navigationStateRef:M,onNavigationAction:We,columns:q()}),l.tableKeyboardNavigation.onGetSnapshotBeforeUpdate({document:x(),contextStateRef:D,navigationStateRef:M});const r={dataItems:_(),mode:R.mode,cell:R.cell,componentId:t.id,selectedField:t.gridProps.selectedField,...C(e)};if(t.gridProps.onKeyDown&&v&&g(t.gridProps.onKeyDown,r),!t.gridProps.selectedField&&R.enabled&&t.gridProps.dataItemKey){const o=l.getSelectedStateFromKeyDown({event:r,selectedState:(n=t.gridProps.select)!=null?n:{},dataItemKey:t.gridProps.dataItemKey});if(o===t.gridProps.select)return;const c=e.target,s=l.closestTagName(c,"TD"),m=l.closestTagName(c,"TR"),P=l.getColumnIndex(s),u=l.getRowIndex(m);if(P!==void 0&&u!==void 0){const y=(a=w.getDataAsArray(t.gridProps.data))==null?void 0:a[u];t.gridProps.onSelectionChange&&g(t.gridProps.onSelectionChange,{...r,select:o,dataItem:y,startRowIndex:u,startColIndex:P,startDataItem:y,endDataItem:y,endRowIndex:u,endColIndex:P,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isDrag:!1})}}},Ve=e=>{l.tableKeyboardNavigation.onFocus(e,{navigatable:!!t.gridProps.navigatable,contextStateRef:D})},We=e=>{if(e.action==="moveToNextPage"&&nt(e.event),e.action==="moveToPrevPage"&&at(e.event),e.focusElement&&e.action==="reorderToRight"){const r=parseInt(e.focusElement.ariaColIndex,10)-1;r<f.current.length-1&&Z(r,r+1,e.event)}if(e.focusElement&&e.action==="reorderToLeft"){const r=parseInt(e.focusElement.ariaColIndex,10)-1;r>0&&Z(r,r-1,e.event)}if(t.gridProps.onNavigationAction&&v){const r={focusElement:e.focusElement,...C(e.event)};g(t.gridProps.onNavigationAction,r)}},_e=(e,r)=>{t.gridProps.onRowClick&&e.target.nodeName==="TD"&&g(t.gridProps.onRowClick,{dataItem:r,...C(e)})},Be=(e,r)=>{t.gridProps.onRowDoubleClick&&e.target.nodeName==="TD"&&g(t.gridProps.onRowDoubleClick,{dataItem:r,...C(e)})},je=(e,r,n)=>{if(we.enabled&&we.mode==="incell"&&t.gridProps.dataItemKey){const a=l.editReducer(t.gridProps.edit,{type:l.EDIT_ACTION.ENTER_FIELD_EDIT,payload:{id:r[t.gridProps.dataItemKey],field:n}});t.gridProps.onEditChange&&g(t.gridProps.onEditChange,{edit:a,...C(e)})}},$e=(e,r)=>{var a;if(l.getDetailExpandableOptions(t.detailExpandable).enabled){const o=l.detailExpandReducer((a=t.gridProps.detailExpand)!=null?a:{},e);t.gridProps.onDetailExpandChange&&g(t.gridProps.onDetailExpandChange,{...C(r),detailExpand:o})}},Xe=(e,r)=>{var a;const n=l.getGroupExpandableOptions(typeof t.gridProps.groupable=="object"?t.gridProps.groupable.expandable!==!1:t.gridProps.groupable);if(n.enabled){const o=l.groupExpandReducer((a=t.gridProps.groupExpand)!=null?a:[],e,n);t.gridProps.onGroupExpandChange&&g(t.gridProps.onGroupExpandChange,{...C(r),groupExpand:o})}},be=(e,r,n)=>{const{allowUnsort:a,mode:o}=Ge.normalize(t.gridProps.sortable||!1,r.sortable||!1),c=(t.gridProps.sort||[]).filter(P=>P.field===r.field)[0],s=n||Ge.firstLevelSortSeqMap[a][c&&c.dir||""],m=o==="single"?[]:(t.gridProps.sort||[]).filter(P=>P.field!==r.field);s!==""&&r.field&&m.push({field:r.field,dir:s}),Ie(m,e)},Je=e=>{var r;if(e.field===t.gridProps.expandField||e._expand||t.gridProps.group&&e.field===void 0){if(t.gridProps.onExpandChange){const n=t.gridProps.dataItemKey?l.detailExpandReducer((r=t.gridProps.detailExpand)!=null?r:{},{type:l.DETAIL_EXPAND_ACTION.SET,id:e.dataItem[t.gridProps.dataItemKey],payload:e.value}):t.gridProps.detailExpand;g(t.gridProps.onExpandChange,{...C(e.syntheticEvent),expand:n,dataItem:e.dataItem,dataIndex:e.dataIndex,value:e.value})}return}t.gridProps.onItemChange&&g(t.gridProps.onItemChange,{...C(e.syntheticEvent),dataItem:e.dataItem,dataIndex:e.dataIndex,field:e.field,value:e.value})},Ye=e=>{var r;if(t.gridProps.onSelectionChange&&R.enabled){const{event:n,dataItem:a,dataIndex:o,columnIndex:c}=e,s={...C(n.syntheticEvent),dataItem:a,startColIndex:c,endColIndex:c,startRowIndex:o,endRowIndex:o,dataItems:_(),altKey:!1,ctrlKey:!1,shiftKey:!1,metaKey:!1,mode:R.mode,cell:R.cell,isDrag:!1,componentId:t.id,selectedField:t.gridProps.selectedField||""};g(t.gridProps.onSelectionChange,{...s,select:t.gridProps.dataItemKey?l.getSelectedState({event:s,selectedState:(r=t.gridProps.select)!=null?r:{},dataItemKey:t.gridProps.dataItemKey}):{}})}},Qe=e=>{var r;if(t.gridProps.onHeaderSelectionChange&&R.enabled){const n=_();g(t.gridProps.onHeaderSelectionChange,{select:e.syntheticEvent.target.checked?n.reduce((a,o)=>(t.gridProps.dataItemKey&&b.getter(t.gridProps.dataItemKey)(o)!==void 0&&(a[b.getter(t.gridProps.dataItemKey)(o)]=!0),a),{}):{},field:e.field,nativeEvent:e.syntheticEvent&&e.syntheticEvent.nativeEvent,syntheticEvent:e.syntheticEvent,target:E.current,dataItems:n,selectedField:(r=t.gridProps.selectedField)!=null?r:""})}},U=(e,r)=>{t.gridProps.onSelectionChange&&R.enabled&&g(t.gridProps.onSelectionChange,{...e,select:r})},Ze=e=>{var r;if(t.gridProps.onSelectionChange&&R.enabled){const n=B()[e.startRowIndex],a=B()[e.endRowIndex],o={syntheticEvent:void 0,target:E.current,selectedField:t.gridProps.selectedField||"",componentId:t.id,dataItems:_(),dataItem:null,startDataItem:n,endDataItem:a,...e},c=l.getSelectedState({event:o,selectedState:(r=t.gridProps.select)!=null?r:{},dataItemKey:t.gridProps.dataItemKey});U(o,c)}},pe=e=>{if(t.gridProps.onSelectionChange&&R.enabled){const r=e.dataItems[0],n=e.dataItems[e.dataItems.length-1],a={},o={...e,startDataItem:r,endDataItem:n,startRowIndex:0,endRowIndex:e.dataItems.length-1,startColIndex:0,endColIndex:f.current.length-1};e.dataItems.forEach(c=>{const m=b.getter(t.gridProps.dataItemKey)(c);a[m]=e.cell?[...Array(f.current.length).keys()]:!0}),U(o,a)}},et=e=>{if(t.gridProps.onSelectionChange&&R.enabled){const n=b.getter(t.gridProps.dataItemKey)(e.dataItem),a=0,o=f.current.length-1,c=e.dataItems.findIndex(y=>y[t.gridProps.dataItemKey]===e.dataItem[t.gridProps.dataItemKey]),P={...e,startDataItem:c,endDataItem:c,startRowIndex:c,endRowIndex:c,startColIndex:a,endColIndex:o},u=e.mode==="multiple"?t.gridProps.select||{}:{};u[n]===!0||Array.isArray(u[n])&&u[n].length===f.current.length?delete u[n]:u[n]=e.cell?[...Array(f.current.length).keys()]:!0,U(P,u)}},tt=e=>{t.gridProps.onSelectionChange&&R.enabled&&U(e,{})},G=(e,r,n,a,o)=>{const c=t.gridProps.onDataStateChange;if(e){const s={...C(a),...r,targetEvent:o};g(e,s)}else c&&g(c,{...C(a),targetEvent:o||{},dataState:{...ft(),...n}})},V=(e,r,n)=>{G(t.gridProps.onPageChange,{page:e},{skip:e.skip,take:e.take},r,n)},rt=()=>{let e=t.gridProps.total||0;return Array.isArray(t.gridProps.data)?e=e||t.gridProps.data.length:t.gridProps.data&&(e=e||t.gridProps.data.total),e},nt=e=>{var o,c;const r=(c=(o=t.gridProps.take)!=null?o:t.gridProps.pageSize)!=null?c:0,n=(t.gridProps.skip||0)+r,a=rt();n<a&&V({skip:n,take:r},e)},at=e=>{var a,o;const r=(o=(a=t.gridProps.take)!=null?a:t.gridProps.pageSize)!=null?o:0,n=(t.gridProps.skip||0)-r;n>=0&&V({skip:n,take:r},e)},ot=e=>{V({skip:e.skip,take:e.take},e.syntheticEvent,e.targetEvent)},Ie=(e,r)=>{G(t.gridProps.onSortChange,{sort:e},{sort:e,...t.gridProps.scrollable==="virtual"?{skip:0}:{}},r)},it=(e,r)=>{G(t.gridProps.onFilterChange,{filter:e},{filter:e||void 0,skip:0},r)},ct=e=>{const r=t.gridProps.searchFields||f.current.map(o=>o.field)||[],n=e.nativeEvent.target.value,a={logic:"or",filters:r.filter(o=>o!==void 0).map(o=>{var c;return typeof o=="string"?{field:o,value:n,operator:"contains"}:{value:n,operator:(c=o.operator)!=null?c:"contains",field:o.field,ignoreCase:o.ignoreCase}})};G(t.gridProps.onSearchChange,{search:a},{},e.syntheticEvent)},Q=(e,r)=>{const n=r.nativeEvent?r:{nativeEvent:r.nativeEvent||r.originalEvent};e.length===0&&t.gridProps.navigatable&&(ie.current=!0),G(t.gridProps.onGroupChange,{group:e},{group:e,skip:0},n)},dt=e=>{if(t.gridProps.onColumnsStateChange){const r={target:E.current,columnsState:e};g(t.gridProps.onColumnsStateChange,r)}},Z=(e,r,n)=>{const a=f.current[e],o=a.depth,c=u=>{do u++;while(u<f.current.length&&f.current[u].depth>o);return u},s=f.current.splice(e,c(e)-e);f.current.splice(e<r?c(r-s.length):r,0,...s),f.current.filter(u=>u.declarationIndex>=0).forEach((u,y)=>u.orderIndex=y);const m=f.current[e].locked&&f.current[r].locked;l.updateLeft(t.columnsMapRef,f.current,m||Y.current),l.updateRight(t.columnsMapRef,f.current,m||Y.current),oe.current&&(Y.current=!1,oe.current=!1);const P=q();if(re(),t.gridProps.onColumnReorder){const u={target:E.current,columns:P,columnId:a.id,nativeEvent:n};g(t.gridProps.onColumnReorder,u)}},F=(e,r,n)=>{const a=typeof t.gridProps.rowReorderable=="object"?t.gridProps.rowReorderable.enabled:t.gridProps.rowReorderable;if(n==="forbidden"||!a||!N.current)return;const{slicedData:o,dataRef:c}=t,s=(o||c)[r];t.gridProps.onRowReorder&&g(t.gridProps.onRowReorder,{draggedDataItems:[N.current],droppedDataItem:s==null?void 0:s.dataItem,dropPosition:n,nativeEvent:e.originalEvent,dragEvent:e,target:E.current}),N.current=null},lt=(e,r,n)=>{if(t.gridProps.group===void 0)return;const a=t.gridProps.group.slice();a.splice(r,0,...a.splice(e,1)),Q(a,n)},Ce=(e,r,n)=>{const a=f.current[e].field;if(!a)return;const o=(t.gridProps.group||[]).slice();o.splice(r,0,{field:a}),Q(o,n)},st=(e,r)=>{const n=K.current.getCurrentGroupsLength;Ce(e,n,r)},p=()=>{let e=0;if(!S.current.colGroupMain)return;const r=S.current.colGroupMain.children;for(let n=0;n<r.length;n++){const a=r[n].width;if(!a)return;e+=parseFloat(a.toString())}e=Math.round(e),z.current&&z.current.setWidth(e),O.current&&O.current.setWidth(e),k.current&&(k.current.style.width=e+"px")},W=i.useCallback((e,r,n,a,o)=>{var P;if(!ut()&&!n||!e)return;const c={type:e,nativeEvent:r,columns:f.current,dataItemKey:t.gridProps.dataItemKey||"",dataItem:a,field:o,...typeof t.gridProps.clipboard!="boolean"?t.gridProps.clipboard:{},...n},s=B(),m=l.populateClipboardData({event:c,data:s,selectedState:(P=t.gridProps.select)!=null?P:{},previousCopiedItems:Ee.current});e!==l.ClipboardActionType.paste&&(Ee.current=m.copiedItems),t.gridProps.onClipboard&&v&&g(t.gridProps.onClipboard,{...c,...m})},[t.gridProps.select,t.gridProps.dataItemKey,t.gridProps.data,t.gridProps.clipboard,t.gridProps.onClipboard]),ut=()=>{var o,c,s;if(!b.canUseDOM)return!1;const e=b.getActiveElement(x()),r=e?e.matches(".k-table-td")?e:(o=x())==null?void 0:o.body:(c=x())==null?void 0:c.body,n=r.closest(".k-grid-container"),a=r&&((s=A.current)==null?void 0:s.contains(r));return!!(r&&a&&n)},gt=(e,r,n,a,o,c)=>{p(),Y.current=!0,oe.current=!0,t.gridProps.onColumnResize&&v&&g(t.gridProps.onColumnResize,{columns:q(),nativeEvent:a,targetColumnId:c,index:e,newWidth:r,oldWidth:n,end:o,target:E.current})},ft=()=>{var e;return{filter:t.gridProps.filter,sort:t.gridProps.sort,skip:t.gridProps.skip,take:(e=t.gridProps.take)!=null?e:t.gridProps.pageSize,group:t.gridProps.group}},C=e=>({nativeEvent:e&&e.nativeEvent,syntheticEvent:e,target:E.current}),mt=e=>({...e,nativeEvent:void 0,syntheticEvent:void 0,target:void 0,targetEvent:void 0,focusElement:void 0}),g=(e,r)=>{if(t.gridProps.isClient){e(r);return}e(mt(r))},Pt=()=>{var e,r,n;if(L.current&&((e=L.current)==null?void 0:e.getElementsByClassName("k-grid-edit-row").length)>0){de.current=!1,(r=document.activeElement)!=null&&r.closest(".k-grid-edit-row")?ce.current=document.activeElement:ce.current=void 0;const a=Array.from((n=L.current)==null?void 0:n.getElementsByClassName("k-grid-edit-row"));a.length>ge.current.length?J.current=a.filter(o=>!ge.current.includes(o))[0]:a.length===1&&(J.current=a[0],de.current=!0),ge.current=a}},_=()=>t.dataRef.filter(e=>e.rowType==="data").map(e=>e.dataItem),B=()=>(t.slicedData||t.dataRef).filter(e=>e.rowType==="data").map(e=>e.dataItem),ee=()=>(ae.current||(ae.current=b.getScrollbarWidth()||void 0),ae.current),x=()=>{var e;if(b.canUseDOM)return((e=j())==null?void 0:e.ownerDocument)||document},j=()=>A.current,te=i.useCallback(e=>{var a;if(!d.current||!((a=d.current)!=null&&a.container)||t.gridProps.scrollable==="none")return;T.current&&T.current.disconnect();const{rowIndex:r}=e,n=j();if(t.gridProps.scrollable==="virtual")d.current.askedSkip=r,d.current.container.scroll(0,Math.round(d.current.askedSkip/d.current.total*d.current.container.scrollHeight));else if(n){const o=r<1?n.querySelector("tbody > tr:nth-child(1)"):n.querySelector(`tbody > tr:nth-child(${r+1})`);o&&X.current&&(X.current.scrollTop=o.offsetTop)}},[t.gridProps.scrollable]),Re=e=>JSON.stringify(e.map(r=>({id:r.id,field:r.field,title:r.title,children:r.children}))),ht=()=>Re(xt)===Re(f.current),bt=()=>{ht()||re()},It=()=>{const{data:e,total:r}=t.gridProps;return Array.isArray(e)?e.length===r:e?r===e.total:!1},Ct=(e,r)=>{var n,a;if(d.current){if(d.current.fixedScroll=t.gridProps.fixedScroll||!1,d.current.PageChange=V,d.current.realSkip=t.gridProps.skip||0,d.current.pageSize=(a=(n=t.gridProps.take)!=null?n:t.gridProps.pageSize)!=null?a:0,d.current.scrollableVirtual=t.gridProps.scrollable==="virtual",d.current.total=e,d.current.propsSkip=(t.gridProps.skip||0)+(t.gridProps.scrollable==="virtual"?d.current.topCacheCount+(d.current.attendedSkip-(t.gridProps.skip||0)):0),t.gridProps.rowHeight!==void 0&&t.gridProps.rowHeight>0&&!r){const o=t.gridProps.rowHeight*e;d.current.containerHeight=w.firefox?Math.min(w.firefoxMaxHeight,o):o}else d.current.containerHeight=1533915;if(d.current.containerRef=X,d.current.tableBodyRef=L,d.current.table=k.current,d.current instanceof Ae.VirtualScrollFixed){const{rowHeight:o=0,detail:c,expandField:s}=t.gridProps;let{detailRowHeight:m=0}=t.gridProps;m=c&&s?m:o,It()?(d.current.total=t.dataRef.length,d.current.rowHeightService=new b.RowHeightService(t.dataRef.length,o,m,t.dataRef)):d.current.rowHeightService=new b.RowHeightService(e,o,m);const P=d.current.rowHeightService.totalHeight();d.current.containerHeight=w.firefox?Math.min(w.firefoxMaxHeight,P):P}}},Rt=()=>{const e=n=>n.map(a=>({id:a.id,field:a.field,title:a.title,hidden:!1,children:a.children?e(a.children):null})),r=t.columnsRef.current.filter(n=>n.depth===0);return e(r)},ve=i.useCallback(e=>{const r={rowIndex:ue.current};e.forEach(n=>{n.isIntersecting||te(r)})},[te]),re=()=>{t.gridProps.forceUpdate&&t.gridProps.forceUpdate()},vt=e=>e.left!==void 0?ye!=="rtl"?{left:e.left,right:e.right}:{left:e.right,right:e.left}:{},E=i.useRef(null),f=t.columnsRef,d=i.useRef(),S=i.useRef(),K=i.useRef(),D=i.useRef(),M=i.useRef(),$=i.useRef(),T=i.useRef(null),L=i.useRef(null),Et=i.useRef(null),X=i.useRef(null),k=i.useRef(null),ne=i.useRef(null),A=i.useRef(null),O=i.useRef(null),z=i.useRef(null),ae=i.useRef(),oe=i.useRef(!1),ie=i.useRef(!1),J=i.useRef(),ce=i.useRef(),de=i.useRef(!1),Y=i.useRef(!0),le=i.useRef(0),se=i.useRef(),ue=i.useRef(),ge=i.useRef([]),Ee=i.useRef([]),N=i.useRef(null),yt=i.useRef(null),wt=i.useRef(null),ye=b.useDir(A),xt=i.useMemo(()=>i.Children.toArray(t.gridProps.children),[t.gridProps.children]),R=l.getSelectionOptions((Se=t.gridProps.selectable)!=null?Se:!!t.gridProps.selectedField),we=l.getEditableOptions((De=t.gridProps.editable)!=null?De:!!t.gridProps.editField);i.useMemo(()=>{l.tableKeyboardNavigation.onConstructor({navigatable:!!t.gridProps.navigatable,contextStateRef:D,navigationStateRef:M,idPrefix:t.id})},[]),i.useMemo(()=>{var n;(n=d.current)==null||n.reset();const e=t.gridProps.groupable===!0||typeof t.gridProps.groupable=="object"&&t.gridProps.groupable.enabled!==!1,r=t.isFixedVirtualScroll?Ae.VirtualScrollFixed:Gt.VirtualScroll;d.current=new r(e||t.gridProps.rowHeight===void 0||t.gridProps.rowHeight===0)},[t.gridProps.scrollable,t.gridProps.total,t.gridProps.filter,t.gridProps.group,t.gridProps.groupable,t.gridProps.sort,t.gridProps.rowHeight]),i.useEffect(()=>(t.gridProps.clipboard&&($.current=new l.ClipboardService(W),$.current.addEventListeners(x())),()=>{$.current&&$.current.removeEventListeners(x())}),[t.gridProps.onClipboard,t.gridProps.clipboard,W,x]),i.useEffect(()=>(t.gridProps.columnVirtualization&&!window.navigator.userAgent.match(Ht.SAFARI_REGEX)&&(ne.current&&(ne.current.style.display="block"),k.current&&(k.current.style.display="block")),p(),b.setScrollbarWidth(ee()),l.tableKeyboardNavigation.onComponentDidMount({scope:A.current||void 0,contextStateRef:D,navigationStateRef:M}),()=>{clearTimeout(se.current)}),[]),i.useEffect(()=>{var e;p(),b.setScrollbarWidth(ee()),(e=d.current)!=null&&e.tableTransform&&d.current.table&&(d.current.table.style.transform=d.current.tableTransform,d.current.tableTransform=""),Pt(),l.tableKeyboardNavigation.onComponentDidUpdate({scope:A.current||void 0,contextStateRef:D,navigationStateRef:M,focusFirst:ie.current,newEditableRow:J.current,singleEditRow:de.current,lastActiveElement:ce.current,navigatable:t.gridProps.navigatable}),ie.current=!1,J.current=void 0}),i.useEffect(()=>{if(b.canUseDOM){const e={rootMargin:"0px",threshold:.9};T.current=window.IntersectionObserver&&new window.IntersectionObserver(ve,e)||null}},[ve]),i.useEffect(()=>{var r;let e;return b.canUseDOM&&window.ResizeObserver&&(e=new window.ResizeObserver(bt),e.observe((r=x())==null?void 0:r.body)),()=>{e==null||e.disconnect()}},[]),i.useImperativeHandle(E,()=>({get element(){return j()},props:t.gridProps,get columns(){return q()},scrollIntoView:e=>{var a;if(!((a=d.current)!=null&&a.container)||t.gridProps.scrollable==="none")return;const{rowIndex:r}=e;ue.current=r;const n=j();if(T.current&&n){T.current.disconnect();const o=n.querySelector(`[absolute-row-index="${ue.current}"]`);o?T.current.observe(o):te(e)}},fitColumns:e=>{S.current.dblClickHandler(null,e)}})),i.useImperativeHandle(t.gridRef,()=>E.current),i.useMemo(()=>{S.current=new Tt.ColumnResize(gt)},[t.gridProps.onColumnResize]),i.useMemo(()=>{K.current=new At.CommonDragLogic(Z,lt,Ce)},[t.gridProps.onColumnReorder,t.gridProps.onGroupChange,t.gridProps.group,t.gridProps.groupable]),S.current.resizable=t.gridProps.resizable||!1,S.current.columns=f.current;const xe=t.gridProps.groupable===!0||typeof t.gridProps.groupable=="object"&&t.gridProps.groupable.enabled!==!1;K.current.reorderable=t.gridProps.reorderable||!1,K.current.groupable=xe,K.current.columns=f.current,Ct(t.total,xe);const St=t.gridProps.columnsState||Rt();return i.createElement(Fe.Provider,{value:{isClient:v,rowReorder:F,activeDragRowDataItemRef:N,reorderRowDragTargetRef:yt,reorderRowDropTargetRef:wt,dir:ye,getCellPositionStyle:vt,dataItemKey:t.gridProps.dataItemKey,columnsState:St,onColumnsStateChange:dt,groupChange:Q,selectionRelease:Ze,pagerPageChange:ot,onContextMenu:Ne,rowClick:_e,rowDblClick:Be,cellClick:je,headerCellClick:be,itemChange:Je,sortChange:Ie,filterChange:it,searchChange:ct,onHeaderSelectionChange:Qe,columnGroupChange:st,onKeyDown:Ue,onFocus:Ve,scrollHandler:qe,selectionChange:Ye,dispatchDetailExpand:$e,dispatchGroupExpand:Xe,columnResizeRef:S,dragLogicRef:K,navigationStateRef:M,tableElementRef:k,tableBodyElementRef:L,headerElementRef:Et,containerElementRef:X,headTableElementRef:ne,elementRef:A,footerRef:O,headerRef:z,getCachedScrollbarWidth:ee,vsRef:d}},i.createElement(l.TableKeyboardNavigationContext.Provider,{value:D.current},t.children),i.createElement(Ft.GridContextMenu,{show:h.show,dataItem:h.dataItem,field:h.field,items:Oe,offset:h.offset,onClose:me,onSelect:ze}))};exports.GridClientWrapper=Ot;exports.GridContext=Fe;
@@ -20,7 +20,7 @@ import { GridContextMenuAnchorPart as Ve } from "./contextMenu/enums.mjs";
20
20
  import { normalize as ur, firstLevelSortSeqMap as gr } from "./sortCommon.mjs";
21
21
  const fr = i.createContext(void 0), Sr = (t) => {
22
22
  var ke, Ke;
23
- const v = t.gridProps.isClient, [b, Pe] = i.useState({}), We = (e) => {
23
+ const E = t.gridProps.isClient, [b, Pe] = i.useState({}), We = (e) => {
24
24
  e.event.preventDefault(), Pe({
25
25
  ...b,
26
26
  show: !0,
@@ -128,7 +128,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
128
128
  const e = g.current.filter((r) => r.declarationIndex >= 0 && r.parentIndex === -1);
129
129
  return dr(e);
130
130
  }, qe = (e, r, n) => {
131
- if (t.gridProps.onContextMenu && v) {
131
+ if (t.gridProps.onContextMenu && E) {
132
132
  const o = {
133
133
  target: R.current,
134
134
  syntheticEvent: e,
@@ -150,7 +150,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
150
150
  const r = e.currentTarget.scrollLeft, n = e.currentTarget.scrollTop, o = t.gridProps.scrollable === "virtual";
151
151
  t.gridProps.columnVirtualization && (!o || n === le.current) && (se.current = window.setTimeout(() => {
152
152
  re();
153
- }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = r), L.current && L.current.setScrollLeft(r), F.current && F.current.setScrollLeft(r), c.current && n !== le.current && c.current.scrollHandler(e), t.gridProps.onScroll && v && u(t.gridProps.onScroll, {
153
+ }, 0)), t.gridProps.scrollLeftRef && (t.gridProps.scrollLeftRef.current = r), L.current && L.current.setScrollLeft(r), F.current && F.current.setScrollLeft(r), c.current && n !== le.current && c.current.scrollHandler(e), t.gridProps.onScroll && E && u(t.gridProps.onScroll, {
154
154
  ...h(e)
155
155
  }), le.current = n;
156
156
  }, $e = (e) => {
@@ -162,7 +162,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
162
162
  onNavigationAction: Ye,
163
163
  columns: z()
164
164
  }), T.onGetSnapshotBeforeUpdate({
165
- document: E(),
165
+ document: v(),
166
166
  contextStateRef: y,
167
167
  navigationStateRef: D
168
168
  });
@@ -174,7 +174,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
174
174
  selectedField: t.gridProps.selectedField,
175
175
  ...h(e)
176
176
  };
177
- if (t.gridProps.onKeyDown && v && u(t.gridProps.onKeyDown, r), !t.gridProps.selectedField && I.enabled && t.gridProps.dataItemKey) {
177
+ if (t.gridProps.onKeyDown && E && u(t.gridProps.onKeyDown, r), !t.gridProps.selectedField && I.enabled && t.gridProps.dataItemKey) {
178
178
  const a = _t({
179
179
  event: r,
180
180
  selectedState: (n = t.gridProps.select) != null ? n : {},
@@ -217,7 +217,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
217
217
  const r = parseInt(e.focusElement.ariaColIndex, 10) - 1;
218
218
  r > 0 && Z(r, r - 1, e.event);
219
219
  }
220
- if (t.gridProps.onNavigationAction && v) {
220
+ if (t.gridProps.onNavigationAction && E) {
221
221
  const r = {
222
222
  focusElement: e.focusElement,
223
223
  ...h(e.event)
@@ -340,7 +340,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
340
340
  });
341
341
  }
342
342
  }, N = (e, r) => {
343
- t.gridProps.onSelectionChange && v && I.enabled && u(t.gridProps.onSelectionChange, {
343
+ t.gridProps.onSelectionChange && I.enabled && u(t.gridProps.onSelectionChange, {
344
344
  ...e,
345
345
  select: r
346
346
  });
@@ -564,7 +564,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
564
564
  selectedState: (m = t.gridProps.select) != null ? m : {},
565
565
  previousCopiedItems: ye.current
566
566
  });
567
- e !== me.paste && (ye.current = f.copiedItems), t.gridProps.onClipboard && v && u(t.gridProps.onClipboard, {
567
+ e !== me.paste && (ye.current = f.copiedItems), t.gridProps.onClipboard && E && u(t.gridProps.onClipboard, {
568
568
  ...d,
569
569
  ...f
570
570
  });
@@ -580,10 +580,10 @@ const fr = i.createContext(void 0), Sr = (t) => {
580
580
  var a, d, l;
581
581
  if (!$)
582
582
  return !1;
583
- const e = zt(E()), r = e ? e.matches(".k-table-td") ? e : (a = E()) == null ? void 0 : a.body : (d = E()) == null ? void 0 : d.body, n = r.closest(".k-grid-container"), o = r && ((l = K.current) == null ? void 0 : l.contains(r));
583
+ const e = zt(v()), r = e ? e.matches(".k-table-td") ? e : (a = v()) == null ? void 0 : a.body : (d = v()) == null ? void 0 : d.body, n = r.closest(".k-grid-container"), o = r && ((l = K.current) == null ? void 0 : l.contains(r));
584
584
  return !!(r && o && n);
585
585
  }, Rt = (e, r, n, o, a, d) => {
586
- p(), X.current = !0, ae.current = !0, t.gridProps.onColumnResize && v && u(t.gridProps.onColumnResize, {
586
+ p(), X.current = !0, ae.current = !0, t.gridProps.onColumnResize && E && u(t.gridProps.onColumnResize, {
587
587
  columns: z(),
588
588
  nativeEvent: o,
589
589
  targetColumnId: d,
@@ -628,7 +628,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
628
628
  (a) => !ge.current.includes(a)
629
629
  )[0] : o.length === 1 && (q.current = o[0], ce.current = !0), ge.current = o;
630
630
  }
631
- }, U = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), V = () => (t.slicedData || t.dataRef).filter((e) => e.rowType === "data").map((e) => e.dataItem), ee = () => (oe.current || (oe.current = Ot() || void 0), oe.current), E = () => {
631
+ }, U = () => t.dataRef.filter((e) => e.rowType === "data").map((e) => e.dataItem), V = () => (t.slicedData || t.dataRef).filter((e) => e.rowType === "data").map((e) => e.dataItem), ee = () => (oe.current || (oe.current = Ot() || void 0), oe.current), v = () => {
632
632
  var e;
633
633
  if ($)
634
634
  return ((e = W()) == null ? void 0 : e.ownerDocument) || document;
@@ -716,9 +716,9 @@ const fr = i.createContext(void 0), Sr = (t) => {
716
716
  t.gridProps.groupable,
717
717
  t.gridProps.sort,
718
718
  t.gridProps.rowHeight
719
- ]), i.useEffect(() => (t.gridProps.clipboard && (_.current = new Vt(B), _.current.addEventListeners(E())), () => {
720
- _.current && _.current.removeEventListeners(E());
721
- }), [t.gridProps.onClipboard, t.gridProps.clipboard, B, E]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(nr) && (ne.current && (ne.current.style.display = "block"), x.current && (x.current.style.display = "block")), p(), Fe(ee()), T.onComponentDidMount({
719
+ ]), i.useEffect(() => (t.gridProps.clipboard && (_.current = new Vt(B), _.current.addEventListeners(v())), () => {
720
+ _.current && _.current.removeEventListeners(v());
721
+ }), [t.gridProps.onClipboard, t.gridProps.clipboard, B, v]), i.useEffect(() => (t.gridProps.columnVirtualization && !window.navigator.userAgent.match(nr) && (ne.current && (ne.current.style.display = "block"), x.current && (x.current.style.display = "block")), p(), Fe(ee()), T.onComponentDidMount({
722
722
  scope: K.current || void 0,
723
723
  contextStateRef: y,
724
724
  navigationStateRef: D
@@ -747,7 +747,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
747
747
  }, [we]), i.useEffect(() => {
748
748
  var r;
749
749
  let e;
750
- return $ && window.ResizeObserver && (e = new window.ResizeObserver(yt), e.observe((r = E()) == null ? void 0 : r.body)), () => {
750
+ return $ && window.ResizeObserver && (e = new window.ResizeObserver(yt), e.observe((r = v()) == null ? void 0 : r.body)), () => {
751
751
  e == null || e.disconnect();
752
752
  };
753
753
  }, []), i.useImperativeHandle(
@@ -794,7 +794,7 @@ const fr = i.createContext(void 0), Sr = (t) => {
794
794
  fr.Provider,
795
795
  {
796
796
  value: {
797
- isClient: v,
797
+ isClient: E,
798
798
  rowReorder: A,
799
799
  activeDragRowDataItemRef: G,
800
800
  reorderRowDragTargetRef: Tt,
package/GridComponent.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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bt=require("react"),d=require("@progress/kendo-react-common"),Ct=require("@progress/kendo-data-query"),b=require("@progress/kendo-react-data-tools"),yt=require("./cells/GridSelectionCell.js"),ht=require("./cells/GridHierarchyCell.js"),wt=require("./cells/GridEditCell.js"),Gt=require("./header/Header.js"),St=require("./header/HeaderRow.js"),Et=require("./header/FilterRow.js"),Rt=require("./header/GroupPanel.js"),It=require("./footer/Footer.js"),s=require("./utils/index.js"),vt=require("./cells/GridCell.js"),He=require("./cells/GridGroupCell.js"),xt=require("./rows/GridRow.js"),Nt=require("./header/GridHeaderSelectionCell.js"),Pe=require("./components/noRecords/GridNoRecords.js"),Ke=require("./filterCommon.js"),kt=require("./footer/FooterRow.js"),qt=require("./paging/GridPagerSettings.js"),Ft=require("./package-metadata.js"),Dt=require("./cells/GridDetailCell.js"),Tt=require("./cells/GridDetailHierarchyCell.js"),Ve=require("./components/noRecords/GridNoRecordsContainer.js"),Ht=require("./GridWatermarkOverlay.js"),Oe=require("./GridClientWrapper.js"),Pt=require("./components/colGroup/GridColGroup.js"),Kt=require("./components/table/GridTable.js"),Ae=require("./components/GridDropClue.js"),Be=require("./components/GridDragClue.js"),Le=require("./components/table/GridTableBody.js"),Vt=require("./components/PagerContainer.js"),Ot=require("./components/table/GridTableScrollable.js"),_e=require("./components/GridElementContainer.js"),At=require("./components/GridContainerElementContainer.js"),Bt=require("./components/VirtualScrollHeightContainer.js"),ze=require("@progress/kendo-react-intl"),te=require("./messages/index.js"),$=require("./VirtualScrollFixed.js"),Lt=require("./VirtualScroll.js"),_t=require("./components/GridCustomCellClientContainer.js"),zt=require("./components/GridDraggableRowsContainer.js"),Mt=require("./cells/GridRowReorderCell.js"),Wt=require("./header/client/GridHeaderRowReorderCell.js"),Me=require("./components/GridLoader.js");function jt(e){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const C in e)if(C!=="default"){const S=Object.getOwnPropertyDescriptor(e,C);Object.defineProperty(k,C,S.get?S:{enumerable:!0,get:()=>e[C]})}}return k.default=e,Object.freeze(k)}const a=jt(bt),We=a.forwardRef((e,k)=>{var Se,Ee,Re,Ie,ve,xe,Ne;const C=e.id+"-role-element-id",S=e.navigatable?C:"";d.validatePackage(Ft.packageMetadata);const je=(t,r,c,o,i,l,u)=>{const g=[],w=s.flatData(g,E,t,{index:r},c!==void 0,o,i,l,lt.defaultExpand,u);return{flattedData:g,resolvedGroupsCount:w}},$e=t=>{const r=t.filter(i=>i&&i.type&&i.type.displayName==="KendoReactGridColumn"),c=f.current.filter(i=>i.declarationIndex>=0&&i.parentIndex===-1),o=s.sanitizeColumns(c);return s.readColumns(r,o,{prevId:0,idPrefix:S})},Ue=t=>t.filter(r=>d.canUseDOM&&r&&r.media?window.matchMedia(r.media).matches:r),Qe=()=>{const t=[],r=(c,o)=>c==null?void 0:c.forEach(i=>{const l=i.hidden||o;t.push({...i,hidden:l}),r(i.children,l)});return r(e.columnsState,!1),t},Je=t=>{const r=Qe();return t.filter(c=>{var o;return!((o=r.find(i=>i.id===c.id))!=null&&o.hidden)})},Xe=(t,r)=>{var i;const c=$e(t),o=Ue(c);f.current=o,f.current.length===0&&(f.current=s.autoGenerateColumns(E,e.group,{column:(i=V.column)!=null?i:e.expandField},{prevId:0,idPrefix:S})),f.current=Je(f.current),Ye(f.current,r),q=s.mapColumns(f.current,!0),le.current=f.current.map(s.clientColumn)},Ye=(t,r)=>{var i;t.filter(l=>e.selectedField&&l.field===e.selectedField||l.columnType==="checkbox").forEach(l=>{l.width=l.width||"50px",l.cell=l.cell||yt.GridSelectionCell,l._type="edit",l.headerCell=l.headerCell||Nt.GridHeaderSelectionCell}),D!==void 0&&t.filter(l=>l.columnType==="reorder").forEach(l=>{l.width=l.width||"50px",l.cell=l.cell||Mt.GridRowReorderCell,l.headerCell=l.headerCell||Wt.GridHeaderRowReorderCell,l.sortable=!1,l.filterable=!1,l.editable=!1});const c={id:"",resizable:!0,width:"32px",title:" ",declarationIndex:-1,orderIndex:-1,children:[],parentIndex:-1,depth:0,colSpan:0,headerColSpan:0,rowSpan:0,left:0,right:0,index:0,rightBorder:!1,ariaColumnIndex:0,isAccessible:!0};let o=0;(e.expandField||V.enabled)&&e.detail&&(t.unshift({...c,_type:"expand",cell:ht.GridHierarchyCell,field:(i=V.column)!=null?i:e.expandField,headerClassName:d.classNames(m.hierarchyCell({}))}),o++);for(let l=0;l<r;l++)t.unshift({...c,isAccessible:!1,cell:He.GridGroupCell,field:"value",locked:e.lockGroups}),o++;t.slice(o).forEach(l=>{l.parentIndex>=0&&(l.parentIndex+=o),l.rowSpannable=l.rowSpannable!==void 0?s.getRowSpanOptions(l.rowSpannable):ne})},ae=()=>E.length===e.total,Ze=()=>{const{rowHeight:t,detailRowHeight:r,detail:c,expandField:o}=e,i=ae(),l=t!==void 0&&t>0,u=r!==void 0&&r>0;return!l||K&&!i||!!(c&&o)&&(!u||!i)?Lt.VirtualScroll:$.VirtualScrollFixed},U=()=>e.isClient?f:le,pe=(t,r,c,o,i,l)=>{let u=s.getColSpan(t,r);if(e.columnVirtualization&&t.colSpan===1)return{colSpan:l,colsToSkip:i};let g=c.length-1===o,w=c.length-o;return e.columnVirtualization&&(g=h.length-1===o,w=h.length-o),u>1&&!g?i=u-1:u=1,w<=u&&!g&&(u=w),{colSpan:u,colsToSkip:i}};let Q,y=[],_;const f=e.columnsRef||{current:[]},le={current:[]};let q=[[]];const et=e.scrollLeftRef||{current:0},z=e.localization||new ze.LocalizationService,tt=e.intl||new ze.IntlService("en"),F=e.unstyled,m=F&&F.uGrid?F.uGrid:d.uGrid,D=s.isRowReorderEnabled(e.rowReorderable),T=e.autoProcessData===!0?{group:!0,sort:!0,filter:!0,search:!0,page:!0}:e.autoProcessData;let E,N;if(Array.isArray(e.data)?(E=e.data,N=(Se=e.total)!=null?Se:E.length):(E=((Ee=e.data)==null?void 0:Ee.data)||[],N=(ve=(Ie=e.total)!=null?Ie:(Re=e.data)==null?void 0:Re.total)!=null?ve:E.length),T){const{data:t,total:r}=Ct.process(E,{group:T.group?e.group:void 0,sort:T.sort?e.sort:void 0,filter:b.combineFilters(T.filter?e.filter:void 0,T.search?e.search:void 0),...T.page?{take:e.take,skip:e.skip}:{}});E=t,N=(xe=e.total)!=null?xe:r}const{size:I="medium"}=e,at=typeof e.groupable=="object"&&e.groupable.footer||"none",H=e.scrollable==="virtual",K=e.groupable===!0||typeof e.groupable=="object"&&e.groupable.enabled!==!1,V=b.getDetailExpandableOptions(!!e.detail),lt=b.getGroupExpandableOptions(typeof e.groupable=="object"&&e.groupable.enabled!==!1?e.groupable.expandable:e.groupable),{resolvedGroupsCount:rt,flattedData:nt}=je(at,e.skip||0,e.group,e.expandField,e.detailExpand,e.groupExpand,e.dataItemKey);y=nt;const J=Ze();J===$.VirtualScrollFixed&&ae()&&(_=y.slice(e.skip||0,(e.skip||0)+((e.take!==void 0?e.take:e.pageSize)||0)));const re=b.getSelectionOptions(e.selectable||!!e.selectedField),ne=s.getRowSpanOptions(e.rowSpannable),it=re&&re.drag?"none":void 0,M=a.Children.toArray(e.children);Xe(M,rt);const ie=M.map(t=>t&&t.type&&t.type.displayName==="KendoReactGridToolbar"?a.cloneElement(t,{...t.props,ariaControls:C}):null),W=M.filter(t=>t&&t.type&&t.type.displayName==="KendoReactGridNoRecords"),oe=M.filter(t=>t&&t.type&&t.type.displayName==="KendoReactGridStatusBar"),h=f.current.filter(t=>t.children.length===0),de=K&&a.createElement(Rt.GroupPanel,{columns:U().current,group:e.group||[],ariaControls:C}),ce=a.createElement(Gt.Header,{size:I,staticHeaders:e.scrollable!=="none",draggable:e.reorderable||K,headerRow:a.createElement(St.HeaderRow,{cells:e.cells,sort:e.sort,sortable:e.sortable,group:e.group||[],groupable:K,filter:e.filter,filterable:e.filterable,filterOperators:e.filterOperators||Ke.operators,columnMenu:e.columnMenu,columnMenuIcon:e.columnMenuIcon,columns:f.current,columnsMap:q,cellRender:e.headerCellRender,navigatable:!!e.navigatable,localization:z,unstyled:F,headerSelectionValue:!!(e.select&&y.filter(t=>t.rowType==="data").every(t=>e.select&&e.dataItemKey&&d.getter(e.dataItemKey)(t.dataItem)!==void 0?e.select[d.getter(e.dataItemKey)(t.dataItem)]:void 0))}),filterRow:e.filterable&&a.createElement(Et.FilterRow,{cells:e.cells,size:I,columns:f.current,filter:e.filter,filterOperators:e.filterOperators||Ke.operators,sort:e.sort,cellRender:e.filterCellRender,navigatable:!!e.navigatable,ariaRowIndex:q.length+1,localization:z})||void 0,cols:h.map((t,r)=>a.createElement("col",{key:r.toString(),width:s.getColumnWidth(t)}))}),ot=et.current||0,dt=parseFloat(((e.style||{}).width||"").toString()),ct=(t,r,c,o,i)=>{let l=!1;const u=e.selectedField?s.getNestedValue(e.selectedField,t.dataItem):e.select&&e.dataItemKey&&d.getter(e.dataItemKey)(t.dataItem)!==void 0?e.select[d.getter(e.dataItemKey)(t.dataItem)]:void 0;let g=0;const{colSpans:w,hiddenColumns:P}=b.tableColumnsVirtualization({enabled:e.columnVirtualization,columns:h,tableViewPortWidth:dt,scrollLeft:ot,getColSpan:s.getColSpan,dataItem:t.dataItem}),v=h.filter((n,G)=>!P[G]);return{row:h.map((n,G)=>{var qe,Fe,De,Te;if(P[G])return null;if(g>0)return g--,null;let R;if((qe=n.rowSpannable)!=null&&qe.enabled&&t.rowType==="data"&&n.field&&i){const x=n.field?(De=(Fe=n.rowSpannable).valueGetter)==null?void 0:De.call(Fe,t.dataItem,n.field):null;R={value:x,count:1},i[n.field]&&((Te=i[n.field])==null?void 0:Te.value)===x&&i[n.field]!==null?(i[n.field].count++,R.count=null):i[n.field]=R}const{colSpan:A,colsToSkip:Z}=pe(n,t.dataItem,v,G,g,w[G]);g=Z;const B=n.id?n.id:G,gt=d.classNames(m.contentSticky({locked:n.locked}),n.className),ft=n.left!==void 0?{left:n.left,right:n.right}:{};let ke=!1;if(n.editable&&(e.editable||e.editField)){const x=e.editField?s.getNestedValue(e.editField,t.dataItem):e.edit&&e.dataItemKey?e.edit[d.getter(e.dataItemKey)(t.dataItem)]:void 0,ee=typeof x=="boolean"?x:Array.isArray(x)?x.indexOf(n.field)>-1:n.field!==void 0&&x===n.field;ee&&n.columnType==="data"&&(ee===!0||ee===n.field)&&(l=!0,ke=!0)}const p=n.cell||ke&&wt.GridEditCell||vt.GridCell,mt=e.expandField&&e.detail&&n.field===e.expandField||n._type==="expand",L={locked:e.lockGroups,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${r}-${String(G)}`,S,mt||t.rowType==="groupHeader"||t.rowType==="groupFooter"||n.field==="value"?"nodata":"cell"),colSpan:A,dataItem:t.dataItem,field:n.field,editor:n.editor,format:n.format,columnType:n.columnType,rowReorderable:D,className:gt,render:e.cellRender,cells:s.resolveCells(e.cells,n.cells),columnIndex:G,columnsCount:h.length,rowType:t.rowType,level:t.level,expanded:t.expanded,dataIndex:t.dataIndex,rowDataIndex:c,columnPosition:ft,style:{},ariaColumnIndex:n.ariaColumnIndex,isSelected:(n==null?void 0:n._type)==="edit"?u:Array.isArray(u)&&u.indexOf(G)>-1,isSorted:!!s.isSorted(n.field,e.sort),isInEdit:l,isAlt:o,unstyled:F,group:t.group,localization:z,intl:tt,_rowSpan:R};return n.cell?a.createElement(_t.GridCustomCellClientContainer,{key:B,isClient:s.isClientReference(p),dataItem:L.dataItem,rowDataIndex:L.rowDataIndex,columnIndex:L.columnIndex},a.createElement(p,{...L})):a.createElement(p,{key:B,...L})}),isInEdit:l,isSelected:typeof u=="boolean"&&u}};let se=0;if(H&&Q)for(let t=0;t<Q.topCacheCount+Q.attendedSkip-(e.skip||0);t++){const r=y.shift();if(r)y.push(r),se++,r.rowType==="groupHeader"&&t--;else break}const ue=t=>t>=y.length-se;let ge=e.skip||0;const X=[],fe=!y.length,me=q.length+(e.filterable?1:0)+1;let O=0;if(y.length){let t=-1,r=0;const c=ne.enabled?{}:void 0;(_||y).forEach((o,i)=>{o.rowType==="data"&&(ge++,t++);const l=ge%2===0,u=e.dataItemKey&&d.getter(e.dataItemKey)(o.dataItem),g=i+(e.skip||0),w=u||"ai"+g,P=w+"_1",v=ct(o,w,t,l,c);if(O=g+me+r,X.push(a.createElement(xt.GridRow,{key:w,dataItem:o.dataItem,isAltRow:l,isInEdit:v.isInEdit,rowType:o.rowType,isRowReorderable:D,isHidden:ue(i),onClick:null,onDoubleClick:null,selectedField:e.selectedField,rowHeight:e.rowHeight,render:e.rowRender,ariaRowIndex:O,absoluteRowIndex:g,dataIndex:H&&!e.groupable?g:t,isSelected:v.isSelected,rows:e.rows},v.row)),e.detail&&o.rowType==="data"&&o.expanded){const n=h.length-(e.expandField||V.enabled?1:0)-(e.group?e.group.length:0)||1;r++,O=g+me+r,X.push(a.createElement("tr",{key:P,className:d.classNames(m.detailTr({isAlt:l})),style:{visibility:ue(i)?"hidden":"",height:e.detailRowHeight},role:"row","aria-rowindex":O},e.group&&e.group.map((G,R)=>{var B;const A=(B=v==null?void 0:v.row[R])==null?void 0:B.props.style,Z=A?{left:A.left,right:A.right}:{};return a.createElement(He.GridGroupCell,{id:"",dataIndex:o.dataIndex,field:G.field,dataItem:o.dataItem,key:R,columnPosition:Z,style:{},ariaColumnIndex:1+R,isSelected:!1,locked:e.lockGroups,cells:e.cells,group:o.group})}),(e.expandField||V.enabled)&&a.createElement(Tt.GridDetailHierarchyCell,{unstyled:F,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${P}-dhcell`,S)}),a.createElement(Dt.GridDetailCell,{dataItem:o.dataItem,dataIndex:o.dataIndex,colSpan:n,ariaColIndex:2+(e.group?e.group.length:0),detail:e.detail,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${P}-dcell`,S)})))}})}const be={size:I,total:N,skip:e.skip||0,take:(e.take!==void 0?e.take:e.pageSize)||10,...qt.normalize(e.pageable||{})},Ce=a.createElement(Vt.PagerContainer,null,e.pager?a.createElement(e.pager,{...be}):a.createElement(b.Pager,{className:d.classNames(m.pager({})),...be})),st=(t,r)=>a.createElement("col",{key:r.toString(),width:s.getColumnWidth(t)}),ut=(Ne=e.cells)!=null&&Ne.footerCell||f.current.some(t=>{var r;return!!(t.footerCell||(r=t.cells)!=null&&r.footerCell)})?a.createElement(It.Footer,{size:I,staticHeaders:e.scrollable!=="none",row:a.createElement(kt.FooterRow,{cells:e.cells,idPrefix:S,columns:f.current,ariaRowIndex:O+1}),cols:h.map(st)}):null,ye=a.createElement(Pt.GridColGroup,null,h.map((t,r)=>a.createElement("col",{key:r.toString(),className:s.isSorted(t.field,e.sort)?d.classNames(m.sorted({})):void 0,width:s.getColumnWidth(t)}))),he=e.reorderable||K,{detail:$t,cells:Ut,rows:Qt,...we}=e,Ge=a.createElement("tbody",{role:"rowgroup",className:d.classNames(m.tbody({})),...b.tableKeyboardNavigationBodyAttributes},X);let Y=Ge;if(D&&(Y=a.createElement(zt.GridReorderableRowsContainer,{unstyled:m,columns:f.current,rowReorderSettings:e.rowReorderable},Ge)),e.scrollable==="none")return a.createElement(Oe.GridClientWrapper,{gridRef:k,gridProps:we,columnsRef:U(),columnsMapRef:q,dataRef:y,slicedData:_,isFixedVirtualScroll:J===$.VirtualScrollFixed,id:C,total:N,detailExpandable:!!e.detail},a.createElement(_e.GridElementContainer,null,a.createElement("div",{id:e.id,style:e.style,className:d.classNames(m.wrapper({size:I}),e.className),"aria-label":e.ariaLabel,...b.tableKeyboardNavigationScopeAttributes},ie,de,a.createElement(Kt.GridTable,{selectable:e.selectable,className:d.classNames(m.table({size:I}))},ye,ce,a.createElement(Le.GridTableBody,{rowReorderable:D},Y)),fe&&a.createElement(Ve.GridNoRecordsContainer,null,W.length?W:a.createElement(Pe.GridNoRecords,null)),he&&a.createElement(a.Fragment,null,a.createElement(Ae.GridDropClue,null),a.createElement(Be.GridDragClue,null)))),oe,e.pageable&&Ce,a.createElement(Me.GridLoader,{loader:e.loader,showLoader:e.showLoader}));let j=e.style||{};return H&&(j.height||(j=Object.assign({},j,{height:"450px"}))),a.createElement(Oe.GridClientWrapper,{gridRef:k,gridProps:we,columnsRef:U(),columnsMapRef:q,dataRef:y,slicedData:_,isFixedVirtualScroll:J===$.VirtualScrollFixed,id:C,total:N,detailExpandable:!!e.detail},a.createElement(_e.GridElementContainer,null,a.createElement("div",{id:e.id,style:j,className:d.classNames(m.wrapper({size:I,virtual:H}),e.className),"aria-label":e.ariaLabel,...b.tableKeyboardNavigationScopeAttributes},ie,de,a.createElement("div",{className:d.classNames(m.ariaRoot({})),role:"grid","aria-colcount":h.length,"aria-rowcount":N,id:C,"aria-label":z.toLanguageString(te.gridAriaLabel,te.messages[te.gridAriaLabel])},ce,a.createElement("div",{className:d.classNames(m.container({})),role:"presentation"},a.createElement(At.GridContainerElementContainer,null,a.createElement("div",{className:d.classNames(m.content({})),role:"presentation"},a.createElement("div",{className:d.classNames(m.tableWrap({})),role:"presentation"},a.createElement(Ot.GridTableScrollable,{selectable:e.selectable,tableClassName:d.classNames(m.table({size:I})),tableStyle:{userSelect:it}},ye,a.createElement(Le.GridTableBody,{rowReorderable:D},Y)),fe&&a.createElement(Ve.GridNoRecordsContainer,null,W.length?W:a.createElement(Pe.GridNoRecords,null))),H&&a.createElement("div",{className:d.classNames(m.heightContainer({})),role:"presentation"},a.createElement(Bt.VirtualScrollHeightContainer,{isVirtualScroll:H}))))),ut,he&&a.createElement(a.Fragment,null,a.createElement(Ae.GridDropClue,null),a.createElement(Be.GridDragClue,null)),a.createElement(Ht.GridWatermarkOverlay,null)),oe,e.pageable&&Ce,a.createElement(Me.GridLoader,{loader:e.loader,showLoader:e.showLoader}))))});We.displayName="KendoReactGridComponent";exports.GridComponent=We;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const bt=require("react"),d=require("@progress/kendo-react-common"),Ct=require("@progress/kendo-data-query"),b=require("@progress/kendo-react-data-tools"),yt=require("./cells/GridSelectionCell.js"),ht=require("./cells/GridHierarchyCell.js"),wt=require("./cells/GridEditCell.js"),Gt=require("./header/Header.js"),St=require("./header/HeaderRow.js"),Et=require("./header/FilterRow.js"),Rt=require("./header/GroupPanel.js"),It=require("./footer/Footer.js"),s=require("./utils/index.js"),vt=require("./cells/GridCell.js"),He=require("./cells/GridGroupCell.js"),xt=require("./rows/GridRow.js"),Nt=require("./header/GridHeaderSelectionCell.js"),Pe=require("./components/noRecords/GridNoRecords.js"),Ke=require("./filterCommon.js"),kt=require("./footer/FooterRow.js"),qt=require("./paging/GridPagerSettings.js"),Ft=require("./package-metadata.js"),Dt=require("./cells/GridDetailCell.js"),Tt=require("./cells/GridDetailHierarchyCell.js"),Ve=require("./components/noRecords/GridNoRecordsContainer.js"),Ht=require("./GridWatermarkOverlay.js"),Oe=require("./GridClientWrapper.js"),Pt=require("./components/colGroup/GridColGroup.js"),Kt=require("./components/table/GridTable.js"),Ae=require("./components/GridDropClue.js"),Be=require("./components/GridDragClue.js"),Le=require("./components/table/GridTableBody.js"),Vt=require("./components/PagerContainer.js"),Ot=require("./components/table/GridTableScrollable.js"),_e=require("./components/GridElementContainer.js"),At=require("./components/GridContainerElementContainer.js"),Bt=require("./components/VirtualScrollHeightContainer.js"),ze=require("@progress/kendo-react-intl"),ae=require("./messages/index.js"),$=require("./VirtualScrollFixed.js"),Lt=require("./VirtualScroll.js"),_t=require("./components/GridCustomCellClientContainer.js"),zt=require("./components/GridDraggableRowsContainer.js"),Mt=require("./cells/GridRowReorderCell.js"),Wt=require("./header/client/GridHeaderRowReorderCell.js"),Me=require("./components/GridLoader.js");function jt(e){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const C in e)if(C!=="default"){const S=Object.getOwnPropertyDescriptor(e,C);Object.defineProperty(k,C,S.get?S:{enumerable:!0,get:()=>e[C]})}}return k.default=e,Object.freeze(k)}const a=jt(bt),We=a.forwardRef((e,k)=>{var Ee,Re,Ie,ve,xe,Ne,ke;const C=e.id+"-role-element-id",S=e.navigatable?C:"";d.validatePackage(Ft.packageMetadata);const je=(t,r,c,o,i,l,u)=>{const g=[],w=s.flatData(g,E,t,{index:r},c!==void 0,o,i,l,lt.defaultExpand,u);return{flattedData:g,resolvedGroupsCount:w}},$e=t=>{const r=t.filter(i=>i&&i.type&&i.type.displayName==="KendoReactGridColumn"),c=f.current.filter(i=>i.declarationIndex>=0&&i.parentIndex===-1),o=s.sanitizeColumns(c);return s.readColumns(r,o,{prevId:0,idPrefix:S})},Ue=t=>t.filter(r=>d.canUseDOM&&r&&r.media?window.matchMedia(r.media).matches:r),Qe=()=>{const t=[],r=(c,o)=>c==null?void 0:c.forEach(i=>{const l=i.hidden||o;t.push({...i,hidden:l}),r(i.children,l)});return r(e.columnsState,!1),t},Je=t=>{const r=Qe();return t.filter(c=>{var o;return!((o=r.find(i=>i.id===c.id))!=null&&o.hidden)})},Xe=(t,r)=>{var i;const c=$e(t),o=Ue(c);f.current=o,f.current.length===0&&(f.current=s.autoGenerateColumns(E,e.group,{column:(i=V.column)!=null?i:e.expandField},{prevId:0,idPrefix:S})),f.current=Je(f.current),Ye(f.current,r),q=s.mapColumns(f.current,!0),re.current=f.current.map(s.clientColumn)},Ye=(t,r)=>{var i;t.filter(l=>e.selectedField&&l.field===e.selectedField||l.columnType==="checkbox").forEach(l=>{l.width=l.width||"50px",l.cell=l.cell||yt.GridSelectionCell,l._type="edit",l.headerCell=l.headerCell||Nt.GridHeaderSelectionCell}),D!==void 0&&t.filter(l=>l.columnType==="reorder").forEach(l=>{l.width=l.width||"50px",l.cell=l.cell||Mt.GridRowReorderCell,l.headerCell=l.headerCell||Wt.GridHeaderRowReorderCell,l.sortable=!1,l.filterable=!1,l.editable=!1});const c={id:"",resizable:!0,width:"32px",title:" ",declarationIndex:-1,orderIndex:-1,children:[],parentIndex:-1,depth:0,colSpan:0,headerColSpan:0,rowSpan:0,left:0,right:0,index:0,rightBorder:!1,ariaColumnIndex:0,isAccessible:!0};let o=0;(e.expandField||V.enabled)&&e.detail&&(t.unshift({...c,_type:"expand",cell:ht.GridHierarchyCell,field:(i=V.column)!=null?i:e.expandField,headerClassName:d.classNames(m.hierarchyCell({}))}),o++);for(let l=0;l<r;l++)t.unshift({...c,isAccessible:!1,cell:He.GridGroupCell,field:"value",locked:e.lockGroups}),o++;t.slice(o).forEach(l=>{l.parentIndex>=0&&(l.parentIndex+=o),l.rowSpannable=l.rowSpannable!==void 0?s.getRowSpanOptions(l.rowSpannable):ie})},le=()=>E.length===e.total,Ze=()=>{const{rowHeight:t,detailRowHeight:r,detail:c,expandField:o}=e,i=le(),l=t!==void 0&&t>0,u=r!==void 0&&r>0;return!l||K&&!i||!!(c&&o)&&(!u||!i)?Lt.VirtualScroll:$.VirtualScrollFixed},U=()=>e.isClient?f:re,pe=(t,r,c,o,i,l)=>{let u=s.getColSpan(t,r);if(e.columnVirtualization&&t.colSpan===1)return{colSpan:l,colsToSkip:i};let g=c.length-1===o,w=c.length-o;return e.columnVirtualization&&(g=h.length-1===o,w=h.length-o),u>1&&!g?i=u-1:u=1,w<=u&&!g&&(u=w),{colSpan:u,colsToSkip:i}};let Q,y=[],_;const f=e.columnsRef||{current:[]},re={current:[]};let q=[[]];const et=e.scrollLeftRef||{current:0},z=e.localization||new ze.LocalizationService,tt=e.intl||new ze.IntlService("en"),F=e.unstyled,m=F&&F.uGrid?F.uGrid:d.uGrid,D=s.isRowReorderEnabled(e.rowReorderable),T=e.autoProcessData===!0?{group:!0,sort:!0,filter:!0,search:!0,page:!0}:e.autoProcessData;let E,N;if(Array.isArray(e.data)?(E=e.data,N=(Ee=e.total)!=null?Ee:E.length):(E=((Re=e.data)==null?void 0:Re.data)||[],N=(xe=(ve=e.total)!=null?ve:(Ie=e.data)==null?void 0:Ie.total)!=null?xe:E.length),T){const{data:t,total:r}=Ct.process(E,{group:T.group?e.group:void 0,sort:T.sort?e.sort:void 0,filter:b.combineFilters(T.filter?e.filter:void 0,T.search?e.search:void 0),...T.page?{take:e.take,skip:e.skip}:{}});E=t,N=(Ne=e.total)!=null?Ne:r}const{size:I="medium"}=e,at=typeof e.groupable=="object"&&e.groupable.footer||"none",H=e.scrollable==="virtual",K=e.groupable===!0||typeof e.groupable=="object"&&e.groupable.enabled!==!1,V=b.getDetailExpandableOptions(!!e.detail),lt=b.getGroupExpandableOptions(typeof e.groupable=="object"&&e.groupable.enabled!==!1?e.groupable.expandable:e.groupable),{resolvedGroupsCount:rt,flattedData:nt}=je(at,e.skip||0,e.group,e.expandField,e.detailExpand,e.groupExpand,e.dataItemKey);y=nt;const J=Ze();J===$.VirtualScrollFixed&&le()&&(_=y.slice(e.skip||0,(e.skip||0)+((e.take!==void 0?e.take:e.pageSize)||0)));const ne=b.getSelectionOptions(e.selectable||!!e.selectedField),ie=s.getRowSpanOptions(e.rowSpannable),it=ne&&ne.drag?"none":void 0,M=a.Children.toArray(e.children);Xe(M,rt);const oe=M.map(t=>t&&t.type&&t.type.displayName==="KendoReactGridToolbar"?a.cloneElement(t,{...t.props,ariaControls:C}):null),W=M.filter(t=>t&&t.type&&t.type.displayName==="KendoReactGridNoRecords"),de=M.filter(t=>t&&t.type&&t.type.displayName==="KendoReactGridStatusBar"),h=f.current.filter(t=>t.children.length===0),ce=K&&a.createElement(Rt.GroupPanel,{columns:U().current,group:e.group||[],ariaControls:C}),se=a.createElement(Gt.Header,{size:I,staticHeaders:e.scrollable!=="none",draggable:e.reorderable||K,headerRow:a.createElement(St.HeaderRow,{cells:e.cells,sort:e.sort,sortable:e.sortable,group:e.group||[],groupable:K,filter:e.filter,filterable:e.filterable,filterOperators:e.filterOperators||Ke.operators,columnMenu:e.columnMenu,columnMenuIcon:e.columnMenuIcon,columns:f.current,columnsMap:q,cellRender:e.headerCellRender,navigatable:!!e.navigatable,localization:z,unstyled:F,headerSelectionValue:!!(e.select&&y.filter(t=>t.rowType==="data").every(t=>e.select&&e.dataItemKey&&d.getter(e.dataItemKey)(t.dataItem)!==void 0?e.select[d.getter(e.dataItemKey)(t.dataItem)]:void 0))}),filterRow:e.filterable&&a.createElement(Et.FilterRow,{cells:e.cells,size:I,columns:f.current,filter:e.filter,filterOperators:e.filterOperators||Ke.operators,sort:e.sort,cellRender:e.filterCellRender,navigatable:!!e.navigatable,ariaRowIndex:q.length+1,localization:z})||void 0,cols:h.map((t,r)=>a.createElement("col",{key:r.toString(),width:s.getColumnWidth(t)}))}),ot=et.current||0,dt=parseFloat(((e.style||{}).width||"").toString()),ct=(t,r,c,o,i)=>{let l=!1;const u=e.selectedField?s.getNestedValue(e.selectedField,t.dataItem):e.select&&e.dataItemKey&&d.getter(e.dataItemKey)(t.dataItem)!==void 0?e.select[d.getter(e.dataItemKey)(t.dataItem)]:void 0;let g=0;const{colSpans:w,hiddenColumns:P}=b.tableColumnsVirtualization({enabled:e.columnVirtualization,columns:h,tableViewPortWidth:dt,scrollLeft:ot,getColSpan:s.getColSpan,dataItem:t.dataItem}),v=h.filter((n,G)=>!P[G]);return{row:h.map((n,G)=>{var qe,Fe,De,Te;if(P[G])return null;if(g>0)return g--,null;let R;if((qe=n.rowSpannable)!=null&&qe.enabled&&t.rowType==="data"&&n.field&&i){const x=n.field?(De=(Fe=n.rowSpannable).valueGetter)==null?void 0:De.call(Fe,t.dataItem,n.field):null;R={value:x,count:1},i[n.field]&&((Te=i[n.field])==null?void 0:Te.value)===x&&i[n.field]!==null?(i[n.field].count++,R.count=null):i[n.field]=R}const{colSpan:A,colsToSkip:Z}=pe(n,t.dataItem,v,G,g,w[G]);g=Z;const B=n.id?n.id:G,gt=d.classNames(m.contentSticky({locked:n.locked}),n.className),ft=n.left!==void 0?{left:n.left,right:n.right}:{};let p=!1;if(n.editable&&(e.editable||e.editField)){const x=e.editField?s.getNestedValue(e.editField,t.dataItem):e.edit&&e.dataItemKey?e.edit[d.getter(e.dataItemKey)(t.dataItem)]:void 0,te=typeof x=="boolean"?x:Array.isArray(x)?x.indexOf(n.field)>-1:n.field!==void 0&&x===n.field;te&&n.columnType==="data"&&(te===!0||te===n.field)&&(l=!0,p=!0)}const ee=n.cell||p&&wt.GridEditCell||vt.GridCell,mt=e.expandField&&e.detail&&n.field===e.expandField||n._type==="expand",L={locked:e.lockGroups,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${r}-${String(G)}`,S,mt||t.rowType==="groupHeader"||t.rowType==="groupFooter"||n.field==="value"?"nodata":"cell"),colSpan:A,dataItem:t.dataItem,field:n.field,editor:n.editor,format:n.format,columnType:n.columnType,rowReorderable:D,className:gt,render:e.cellRender,cells:s.resolveCells(e.cells,n.cells),columnIndex:G,columnsCount:h.length,rowType:t.rowType,level:t.level,expanded:t.expanded,dataIndex:t.dataIndex,rowDataIndex:c,columnPosition:ft,style:{},ariaColumnIndex:n.ariaColumnIndex,isSelected:(n==null?void 0:n._type)==="edit"?u:Array.isArray(u)&&u.indexOf(G)>-1,isSorted:!!s.isSorted(n.field,e.sort),isInEdit:p,isAlt:o,unstyled:F,group:t.group,localization:z,intl:tt,_rowSpan:R};return n.cell?a.createElement(_t.GridCustomCellClientContainer,{key:B,isClient:s.isClientReference(ee),dataItem:L.dataItem,rowDataIndex:L.rowDataIndex,columnIndex:L.columnIndex},a.createElement(ee,{...L})):a.createElement(ee,{key:B,...L})}),isInEdit:l,isSelected:typeof u=="boolean"&&u}};let ue=0;if(H&&Q)for(let t=0;t<Q.topCacheCount+Q.attendedSkip-(e.skip||0);t++){const r=y.shift();if(r)y.push(r),ue++,r.rowType==="groupHeader"&&t--;else break}const ge=t=>t>=y.length-ue;let fe=e.skip||0;const X=[],me=!y.length,be=q.length+(e.filterable?1:0)+1;let O=0;if(y.length){let t=-1,r=0;const c=ie.enabled?{}:void 0;(_||y).forEach((o,i)=>{o.rowType==="data"&&(fe++,t++);const l=fe%2===0,u=e.dataItemKey&&d.getter(e.dataItemKey)(o.dataItem),g=i+(e.skip||0),w=u||"ai"+g,P=w+"_1",v=ct(o,w,t,l,c);if(O=g+be+r,X.push(a.createElement(xt.GridRow,{key:w,dataItem:o.dataItem,isAltRow:l,isInEdit:v.isInEdit,rowType:o.rowType,isRowReorderable:D,isHidden:ge(i),onClick:null,onDoubleClick:null,selectedField:e.selectedField,rowHeight:e.rowHeight,render:e.rowRender,ariaRowIndex:O,absoluteRowIndex:g,dataIndex:H&&!e.groupable?g:t,isSelected:v.isSelected,rows:e.rows},v.row)),e.detail&&o.rowType==="data"&&o.expanded){const n=h.length-(e.expandField||V.enabled?1:0)-(e.group?e.group.length:0)||1;r++,O=g+be+r,X.push(a.createElement("tr",{key:P,className:d.classNames(m.detailTr({isAlt:l})),style:{visibility:ge(i)?"hidden":"",height:e.detailRowHeight},role:"row","aria-rowindex":O},e.group&&e.group.map((G,R)=>{var B;const A=(B=v==null?void 0:v.row[R])==null?void 0:B.props.style,Z=A?{left:A.left,right:A.right}:{};return a.createElement(He.GridGroupCell,{id:"",dataIndex:o.dataIndex,field:G.field,dataItem:o.dataItem,key:R,columnPosition:Z,style:{},ariaColumnIndex:1+R,isSelected:!1,locked:e.lockGroups,cells:e.cells,group:o.group})}),(e.expandField||V.enabled)&&a.createElement(Tt.GridDetailHierarchyCell,{unstyled:F,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${P}-dhcell`,S)}),a.createElement(Dt.GridDetailCell,{dataItem:o.dataItem,dataIndex:o.dataIndex,colSpan:n,ariaColIndex:2+(e.group?e.group.length:0),detail:e.detail,id:b.tableKeyboardNavigationTools.generateNavigatableId(`${P}-dcell`,S)})))}})}const Ce={size:I,total:N,skip:e.skip||0,take:(e.take!==void 0?e.take:e.pageSize)||10,...qt.normalize(e.pageable||{})},ye=a.createElement(Vt.PagerContainer,null,e.pager?a.createElement(e.pager,{...Ce}):a.createElement(b.Pager,{className:d.classNames(m.pager({})),...Ce})),st=(t,r)=>a.createElement("col",{key:r.toString(),width:s.getColumnWidth(t)}),ut=(ke=e.cells)!=null&&ke.footerCell||f.current.some(t=>{var r;return!!(t.footerCell||(r=t.cells)!=null&&r.footerCell)})?a.createElement(It.Footer,{size:I,staticHeaders:e.scrollable!=="none",row:a.createElement(kt.FooterRow,{cells:e.cells,idPrefix:S,columns:f.current,ariaRowIndex:O+1}),cols:h.map(st)}):null,he=a.createElement(Pt.GridColGroup,null,h.map((t,r)=>a.createElement("col",{key:r.toString(),className:s.isSorted(t.field,e.sort)?d.classNames(m.sorted({})):void 0,width:s.getColumnWidth(t)}))),we=e.reorderable||K,{detail:$t,cells:Ut,rows:Qt,...Ge}=e,Se=a.createElement("tbody",{role:"rowgroup",className:d.classNames(m.tbody({})),...b.tableKeyboardNavigationBodyAttributes},X);let Y=Se;if(D&&(Y=a.createElement(zt.GridReorderableRowsContainer,{unstyled:m,columns:f.current,rowReorderSettings:e.rowReorderable},Se)),e.scrollable==="none")return a.createElement(Oe.GridClientWrapper,{gridRef:k,gridProps:Ge,columnsRef:U(),columnsMapRef:q,dataRef:y,slicedData:_,isFixedVirtualScroll:J===$.VirtualScrollFixed,id:C,total:N,detailExpandable:!!e.detail},a.createElement(_e.GridElementContainer,null,a.createElement("div",{id:e.id,style:e.style,className:d.classNames(m.wrapper({size:I}),e.className),"aria-label":e.ariaLabel,...b.tableKeyboardNavigationScopeAttributes},oe,ce,a.createElement(Kt.GridTable,{selectable:e.selectable,className:d.classNames(m.table({size:I}))},he,se,a.createElement(Le.GridTableBody,{rowReorderable:D},Y)),me&&a.createElement(Ve.GridNoRecordsContainer,null,W.length?W:a.createElement(Pe.GridNoRecords,null)),we&&a.createElement(a.Fragment,null,a.createElement(Ae.GridDropClue,null),a.createElement(Be.GridDragClue,null)))),de,e.pageable&&ye,a.createElement(Me.GridLoader,{loader:e.loader,showLoader:e.showLoader}));let j=e.style||{};return H&&(j.height||(j=Object.assign({},j,{height:"450px"}))),a.createElement(Oe.GridClientWrapper,{gridRef:k,gridProps:Ge,columnsRef:U(),columnsMapRef:q,dataRef:y,slicedData:_,isFixedVirtualScroll:J===$.VirtualScrollFixed,id:C,total:N,detailExpandable:!!e.detail},a.createElement(_e.GridElementContainer,null,a.createElement("div",{id:e.id,style:j,className:d.classNames(m.wrapper({size:I,virtual:H}),e.className),"aria-label":e.ariaLabel,...b.tableKeyboardNavigationScopeAttributes},oe,ce,a.createElement("div",{className:d.classNames(m.ariaRoot({})),role:"grid","aria-colcount":h.length,"aria-rowcount":N,id:C,"aria-label":z.toLanguageString(ae.gridAriaLabel,ae.messages[ae.gridAriaLabel])},se,a.createElement("div",{className:d.classNames(m.container({})),role:"presentation"},a.createElement(At.GridContainerElementContainer,null,a.createElement("div",{className:d.classNames(m.content({})),role:"presentation"},a.createElement("div",{className:d.classNames(m.tableWrap({})),role:"presentation"},a.createElement(Ot.GridTableScrollable,{selectable:e.selectable,tableClassName:d.classNames(m.table({size:I})),tableStyle:{userSelect:it}},he,a.createElement(Le.GridTableBody,{rowReorderable:D},Y)),me&&a.createElement(Ve.GridNoRecordsContainer,null,W.length?W:a.createElement(Pe.GridNoRecords,null))),H&&a.createElement("div",{className:d.classNames(m.heightContainer({})),role:"presentation"},a.createElement(Bt.VirtualScrollHeightContainer,{isVirtualScroll:H}))))),ut,we&&a.createElement(a.Fragment,null,a.createElement(Ae.GridDropClue,null),a.createElement(Be.GridDragClue,null)),a.createElement(Ht.GridWatermarkOverlay,null)),de,e.pageable&&ye,a.createElement(Me.GridLoader,{loader:e.loader,showLoader:e.showLoader}))))});We.displayName="KendoReactGridComponent";exports.GridComponent=We;