@progress/kendo-react-grid 7.3.0-develop.3 → 7.3.0
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 +1 -1
- package/Grid.mjs +60 -57
- package/cells/GridDetailHierarchyCell.js +1 -1
- package/cells/GridDetailHierarchyCell.mjs +2 -6
- package/cells/GridSelectionCell.js +1 -1
- package/cells/GridSelectionCell.mjs +48 -32
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/header/GridHeaderSelectionCell.js +1 -1
- package/header/GridHeaderSelectionCell.mjs +8 -7
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
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"),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;
|
|
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"),Ee=require("./cells/GridHierarchyCell.js"),Ie=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"),Fe=require("./drag/CommonDragLogic.js"),v=require("./utils/index.js"),Ge=require("./cells/GridCell.js"),ie=require("./cells/GridGroupCell.js"),Le=require("./rows/GridRow.js"),Me=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||Me.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:Ee.GridHierarchyCell,field:this.props.expandField,headerClassName:"k-hierarchy-cell k-header"}),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,G)=>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:G,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 Fe.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),G=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 I=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 E=!1;if(f.editable&&this.props.editField){const S=v.getNestedValue(this.props.editField,o.dataItem);S&&(S===!0||S===f.field)&&(_=!0,E=!0)}const V=f.cell||E&&Ie.GridEditCell||Ge.GridCell,F=this.props.expandField&&this.props.detail&&f.field===this.props.expandField;return r.createElement(V,{onContextMenu:this.onContextMenu,key:T,locked:this.props.lockGroups,id:c.tableKeyboardNavigationTools.generateNavigatableId(`${m}-${String(C)}`,h,F?"nodata":"cell"),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(I)&&I.indexOf(C)>-1})}),isInEdit:_,isSelected:typeof I=="boolean"&&I}};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 I=$%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:I,isInEdit:k.isInEdit,rowType:b.rowType,isHidden:B(_),onClick:E=>this.rowClick(E,b),onDoubleClick:E=>this.rowDblClick(E,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 E=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",I?"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,F)=>{var se;const S=(se=k==null?void 0:k.row[F])==null?void 0:se.props.style,Se=S?this.isRtl?{left:S.right,right:S.left}:{left:S.left,right:S.right}:{};return r.createElement(ie.GridGroupCell,{id:"",dataIndex:b.dataIndex,field:V.field,dataItem:b.dataItem,key:F,style:Se,ariaColumnIndex:1+F,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:E,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,G,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},L),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 M=this.props.style||{};return this.props.scrollable==="virtual"&&(M.height||(M=Object.assign({},M,{height:"450px"}))),r.createElement(c.TableKeyboardNavigationContext.Provider,{value:this.contextStateRef.current},r.createElement("div",{id:this.props.id,style:M,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,G,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},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(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,8 +8,8 @@
|
|
|
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
|
|
12
|
-
import { tableKeyboardNavigation as x, getSelectionOptions as ae, mapColumns as Ve,
|
|
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";
|
|
12
|
+
import { tableKeyboardNavigation as x, getSelectionOptions as ae, mapColumns as Ve, ClipboardService as We, TableKeyboardNavigationContext as V, isRtl as Be, tableKeyboardNavigationTools as F, 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";
|
|
15
15
|
import { GridEditCell as Ye } from "./cells/GridEditCell.mjs";
|
|
@@ -36,7 +36,7 @@ import { normalize as yt } from "./paging/GridPagerSettings.mjs";
|
|
|
36
36
|
import { packageMetadata as Re } from "./package-metadata.mjs";
|
|
37
37
|
import { GridDetailCell as wt } from "./cells/GridDetailCell.mjs";
|
|
38
38
|
import { GridDetailHierarchyCell as St } from "./cells/GridDetailHierarchyCell.mjs";
|
|
39
|
-
const
|
|
39
|
+
const _ = class _ extends r.Component {
|
|
40
40
|
constructor(a) {
|
|
41
41
|
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) => {
|
|
42
42
|
const t = { rowIndex: this.rowIndex };
|
|
@@ -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, d = this.isAllData(), v = t !== void 0 && t > 0, R = i !== void 0 && i > 0,
|
|
82
|
-
return !v ||
|
|
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, E = l === !0 || typeof l == "object" && l.enabled !== !1;
|
|
82
|
+
return !v || E && !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;
|
|
@@ -320,8 +320,7 @@ const z = class z extends r.Component {
|
|
|
320
320
|
...n,
|
|
321
321
|
cell: Xe,
|
|
322
322
|
field: this.props.expandField,
|
|
323
|
-
headerClassName: "k-hierarchy-cell k-header"
|
|
324
|
-
id: _.generateNavigatableId(`${this._columns.length}`, i, "column")
|
|
323
|
+
headerClassName: "k-hierarchy-cell k-header"
|
|
325
324
|
}), h++);
|
|
326
325
|
for (let l = 0; l < t; l++)
|
|
327
326
|
e.unshift({
|
|
@@ -332,7 +331,7 @@ const z = class z extends r.Component {
|
|
|
332
331
|
locked: this.props.lockGroups
|
|
333
332
|
}), h++;
|
|
334
333
|
e.slice(h).forEach((l) => l.parentIndex >= 0 && (l.parentIndex += h));
|
|
335
|
-
}), this.getHeaderRow = S((e, t, i, n, h, l, d, v, R,
|
|
334
|
+
}), this.getHeaderRow = S((e, t, i, n, h, l, d, v, R, E, b, N) => /* @__PURE__ */ r.createElement(
|
|
336
335
|
et,
|
|
337
336
|
{
|
|
338
337
|
cells: this.props.cells,
|
|
@@ -348,14 +347,14 @@ const z = class z extends r.Component {
|
|
|
348
347
|
filterChange: this.filterChange,
|
|
349
348
|
columnMenu: R,
|
|
350
349
|
selectionChange: this.onHeaderSelectionChange,
|
|
351
|
-
columns:
|
|
350
|
+
columns: E,
|
|
352
351
|
columnResize: this.columnResize,
|
|
353
352
|
pressHandler: this.dragLogic.pressHandler,
|
|
354
353
|
dragHandler: this.dragLogic.dragHandler,
|
|
355
354
|
releaseHandler: this.dragLogic.releaseHandler,
|
|
356
355
|
columnsMap: b,
|
|
357
356
|
cellRender: v,
|
|
358
|
-
isRtl:
|
|
357
|
+
isRtl: N,
|
|
359
358
|
dragClue: this.dragLogic.dragClueRef,
|
|
360
359
|
headerRef: this.headerElementRef,
|
|
361
360
|
containerRef: this.containerRef,
|
|
@@ -486,7 +485,7 @@ const z = class z extends r.Component {
|
|
|
486
485
|
render() {
|
|
487
486
|
var ie;
|
|
488
487
|
let a = this.props.total || 0;
|
|
489
|
-
const p =
|
|
488
|
+
const p = F.getIdPrefix(this.navigationStateRef), c = ot(this);
|
|
490
489
|
let e = [];
|
|
491
490
|
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);
|
|
492
491
|
const t = typeof this.props.groupable == "object" && this.props.groupable.footer || "none", { resolvedGroupsCount: i, flattedData: n } = this.flatData(
|
|
@@ -505,7 +504,7 @@ const z = class z extends r.Component {
|
|
|
505
504
|
this.initializeVirtualization(a, h);
|
|
506
505
|
const d = this.childrenToArray(this.props.children);
|
|
507
506
|
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"),
|
|
507
|
+
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"), E = d.filter((o) => o && o.type && o.type.displayName === "KendoReactGridStatusBar"), b = this._columns.filter((o) => o.children.length === 0), N = h && /* @__PURE__ */ r.createElement(
|
|
509
508
|
st,
|
|
510
509
|
{
|
|
511
510
|
group: this.props.group || [],
|
|
@@ -518,7 +517,7 @@ const z = class z extends r.Component {
|
|
|
518
517
|
ariaControls: this._gridId,
|
|
519
518
|
onContextMenu: this.onContextMenu
|
|
520
519
|
}
|
|
521
|
-
), { sort: ye, sortable: we, group: Se, filter: ke, filterable:
|
|
520
|
+
), { sort: ye, sortable: we, group: Se, filter: ke, filterable: Ee, filterOperators: Ie = Ce, headerCellRender: xe, columnMenu: _e } = this.props, $ = /* @__PURE__ */ r.createElement(
|
|
522
521
|
Ze,
|
|
523
522
|
{
|
|
524
523
|
size: this.props.size,
|
|
@@ -534,8 +533,8 @@ const z = class z extends r.Component {
|
|
|
534
533
|
Se,
|
|
535
534
|
h,
|
|
536
535
|
ke,
|
|
537
|
-
Ie,
|
|
538
536
|
Ee,
|
|
537
|
+
Ie,
|
|
539
538
|
xe,
|
|
540
539
|
_e,
|
|
541
540
|
this._columns,
|
|
@@ -571,32 +570,36 @@ const z = class z extends r.Component {
|
|
|
571
570
|
tableViewPortWidth: De,
|
|
572
571
|
scrollLeft: ze
|
|
573
572
|
}), Le = (o, g, m) => {
|
|
574
|
-
let
|
|
573
|
+
let I = !1;
|
|
575
574
|
const k = this.props.selectedField ? ve(this.props.selectedField, o.dataItem) : void 0;
|
|
576
575
|
return {
|
|
577
576
|
row: b.map((u, f) => {
|
|
578
577
|
if (Te[f])
|
|
579
578
|
return null;
|
|
580
|
-
const
|
|
579
|
+
const D = u.id ? u.id : f, H = `${u.className ? u.className + " " : ""}${u.locked ? "k-grid-content-sticky" : ""}`, y = u.left !== void 0 ? this.isRtl ? { left: u.right, right: u.left } : { left: u.left, right: u.right } : {};
|
|
581
580
|
let w = !1;
|
|
582
581
|
if (u.editable && this.props.editField) {
|
|
583
582
|
const C = ve(this.props.editField, o.dataItem);
|
|
584
|
-
C && (C === !0 || C === u.field) && (
|
|
583
|
+
C && (C === !0 || C === u.field) && (I = !0, w = !0);
|
|
585
584
|
}
|
|
586
|
-
const P = u.cell || w && Ye || ft;
|
|
585
|
+
const P = u.cell || w && Ye || ft, T = this.props.expandField && this.props.detail && u.field === this.props.expandField;
|
|
587
586
|
return /* @__PURE__ */ r.createElement(
|
|
588
587
|
P,
|
|
589
588
|
{
|
|
590
589
|
onContextMenu: this.onContextMenu,
|
|
591
|
-
key:
|
|
590
|
+
key: D,
|
|
592
591
|
locked: this.props.lockGroups,
|
|
593
|
-
id:
|
|
592
|
+
id: F.generateNavigatableId(
|
|
593
|
+
`${g}-${String(f)}`,
|
|
594
|
+
p,
|
|
595
|
+
T ? "nodata" : "cell"
|
|
596
|
+
),
|
|
594
597
|
colSpan: He[f],
|
|
595
598
|
dataItem: o.dataItem,
|
|
596
599
|
field: u.field,
|
|
597
600
|
editor: u.editor,
|
|
598
601
|
format: u.format,
|
|
599
|
-
className:
|
|
602
|
+
className: H,
|
|
600
603
|
render: this.props.cellRender,
|
|
601
604
|
cells: mt(this.props.cells, u.cells),
|
|
602
605
|
onChange: this.itemChange,
|
|
@@ -615,7 +618,7 @@ const z = class z extends r.Component {
|
|
|
615
618
|
}
|
|
616
619
|
);
|
|
617
620
|
}),
|
|
618
|
-
isInEdit:
|
|
621
|
+
isInEdit: I,
|
|
619
622
|
isSelected: typeof k == "boolean" && k
|
|
620
623
|
};
|
|
621
624
|
};
|
|
@@ -633,27 +636,27 @@ const z = class z extends r.Component {
|
|
|
633
636
|
const M = [];
|
|
634
637
|
let K = !1;
|
|
635
638
|
const O = this._columnsMap.length + (this.props.filterable ? 1 : 0) + 1, Q = /* @__PURE__ */ r.createElement("div", { key: "no-records", className: "k-grid-norecords", "aria-rowindex": O }, /* @__PURE__ */ r.createElement("div", { className: "k-grid-norecords-template" }, R.length ? R : /* @__PURE__ */ r.createElement(Ct, null)));
|
|
636
|
-
let
|
|
639
|
+
let z = 0;
|
|
637
640
|
if (this._data.length) {
|
|
638
641
|
let o = -1, g = 0;
|
|
639
|
-
(this._slicedData || this._data).forEach((m,
|
|
642
|
+
(this._slicedData || this._data).forEach((m, I) => {
|
|
640
643
|
m.rowType === "data" && (J++, o++);
|
|
641
|
-
const k = J % 2 === 0, u = this.props.dataItemKey && Pe(this.props.dataItemKey)(m.dataItem), f =
|
|
642
|
-
if (
|
|
644
|
+
const k = J % 2 === 0, u = this.props.dataItemKey && Pe(this.props.dataItemKey)(m.dataItem), f = I + (this.vs.realSkip || 0), D = u || "ai" + f, H = D + "_1", y = Le(m, D, o);
|
|
645
|
+
if (z = f + O + g, M.push(/* @__PURE__ */ r.createElement(
|
|
643
646
|
vt,
|
|
644
647
|
{
|
|
645
|
-
key:
|
|
648
|
+
key: D,
|
|
646
649
|
dataItem: m.dataItem,
|
|
647
650
|
isAltRow: k,
|
|
648
651
|
isInEdit: y.isInEdit,
|
|
649
652
|
rowType: m.rowType,
|
|
650
|
-
isHidden: q(
|
|
653
|
+
isHidden: q(I),
|
|
651
654
|
onClick: (w) => this.rowClick(w, m),
|
|
652
655
|
onDoubleClick: (w) => this.rowDblClick(w, m),
|
|
653
656
|
selectedField: this.props.selectedField,
|
|
654
657
|
rowHeight: this.props.rowHeight,
|
|
655
658
|
render: this.props.rowRender,
|
|
656
|
-
ariaRowIndex:
|
|
659
|
+
ariaRowIndex: z,
|
|
657
660
|
absoluteRowIndex: f,
|
|
658
661
|
dataIndex: o,
|
|
659
662
|
isSelected: y.isSelected
|
|
@@ -661,21 +664,21 @@ const z = class z extends r.Component {
|
|
|
661
664
|
y.row
|
|
662
665
|
)), this.props.detail && m.rowType === "data" && m.expanded) {
|
|
663
666
|
const w = b.length - (this.props.expandField ? 1 : 0) - (this.props.group ? this.props.group.length : 0) || 1;
|
|
664
|
-
g++,
|
|
667
|
+
g++, z = f + O + g, M.push(/* @__PURE__ */ r.createElement(
|
|
665
668
|
"tr",
|
|
666
669
|
{
|
|
667
|
-
key:
|
|
668
|
-
className:
|
|
670
|
+
key: H,
|
|
671
|
+
className: L(
|
|
669
672
|
"k-table-row",
|
|
670
673
|
k ? "k-detail-row k-table-alt-row k-alt" : "k-detail-row"
|
|
671
674
|
),
|
|
672
|
-
style: { visibility: q(
|
|
675
|
+
style: { visibility: q(I) ? "hidden" : "", height: this.props.detailRowHeight },
|
|
673
676
|
role: "row",
|
|
674
|
-
"aria-rowindex":
|
|
677
|
+
"aria-rowindex": z
|
|
675
678
|
},
|
|
676
|
-
this.props.group && this.props.group.map((P,
|
|
679
|
+
this.props.group && this.props.group.map((P, T) => {
|
|
677
680
|
var oe;
|
|
678
|
-
const
|
|
681
|
+
const C = (oe = y == null ? void 0 : y.row[T]) == null ? void 0 : oe.props.style, Me = C ? this.isRtl ? { left: C.right, right: C.left } : { left: C.left, right: C.right } : {};
|
|
679
682
|
return /* @__PURE__ */ r.createElement(
|
|
680
683
|
be,
|
|
681
684
|
{
|
|
@@ -683,9 +686,9 @@ const z = class z extends r.Component {
|
|
|
683
686
|
dataIndex: m.dataIndex,
|
|
684
687
|
field: P.field,
|
|
685
688
|
dataItem: m.dataItem,
|
|
686
|
-
key:
|
|
689
|
+
key: T,
|
|
687
690
|
style: Me,
|
|
688
|
-
ariaColumnIndex: 1 +
|
|
691
|
+
ariaColumnIndex: 1 + T,
|
|
689
692
|
isSelected: !1,
|
|
690
693
|
locked: this.props.lockGroups,
|
|
691
694
|
isRtl: this.isRtl,
|
|
@@ -696,7 +699,7 @@ const z = class z extends r.Component {
|
|
|
696
699
|
this.props.expandField && /* @__PURE__ */ r.createElement(
|
|
697
700
|
St,
|
|
698
701
|
{
|
|
699
|
-
id:
|
|
702
|
+
id: F.generateNavigatableId(`${H}-dhcell`, p)
|
|
700
703
|
}
|
|
701
704
|
),
|
|
702
705
|
/* @__PURE__ */ r.createElement(
|
|
@@ -708,7 +711,7 @@ const z = class z extends r.Component {
|
|
|
708
711
|
colSpan: w,
|
|
709
712
|
ariaColIndex: 2 + (this.props.group ? this.props.group.length : 0),
|
|
710
713
|
detail: this.props.detail,
|
|
711
|
-
id:
|
|
714
|
+
id: F.generateNavigatableId(`${H}-dcell`, p)
|
|
712
715
|
}
|
|
713
716
|
)
|
|
714
717
|
));
|
|
@@ -725,7 +728,7 @@ const z = class z extends r.Component {
|
|
|
725
728
|
take: (this.props.take !== void 0 ? this.props.take : this.props.pageSize) || 10,
|
|
726
729
|
messagesMap: at,
|
|
727
730
|
...yt(this.props.pageable || {})
|
|
728
|
-
}, Y = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...X }) : /* @__PURE__ */ r.createElement(je, { className: "k-grid-pager", ...X }),
|
|
731
|
+
}, Y = this.props.pager ? /* @__PURE__ */ r.createElement(this.props.pager, { ...X }) : /* @__PURE__ */ r.createElement(je, { className: "k-grid-pager", ...X }), Fe = (o) => this.props.sort && this.props.sort.filter((g) => g.field === o).length > 0, Ne = (o, g) => /* @__PURE__ */ r.createElement(
|
|
729
732
|
"col",
|
|
730
733
|
{
|
|
731
734
|
key: g.toString(),
|
|
@@ -749,10 +752,10 @@ const z = class z extends r.Component {
|
|
|
749
752
|
cells: this.props.cells,
|
|
750
753
|
columns: this._columns,
|
|
751
754
|
isRtl: this.isRtl,
|
|
752
|
-
ariaRowIndex:
|
|
755
|
+
ariaRowIndex: z + 1
|
|
753
756
|
}
|
|
754
757
|
),
|
|
755
|
-
cols: b.map(
|
|
758
|
+
cols: b.map(Ne)
|
|
756
759
|
}
|
|
757
760
|
) : null, ee = /* @__PURE__ */ r.createElement(
|
|
758
761
|
"colgroup",
|
|
@@ -766,7 +769,7 @@ const z = class z extends r.Component {
|
|
|
766
769
|
"col",
|
|
767
770
|
{
|
|
768
771
|
key: g.toString(),
|
|
769
|
-
className:
|
|
772
|
+
className: Fe(o.field) ? "k-sorted" : void 0,
|
|
770
773
|
width: W(o)
|
|
771
774
|
}
|
|
772
775
|
)
|
|
@@ -778,7 +781,7 @@ const z = class z extends r.Component {
|
|
|
778
781
|
{
|
|
779
782
|
id: this.props.id,
|
|
780
783
|
style: this.props.style,
|
|
781
|
-
className:
|
|
784
|
+
className: L(
|
|
782
785
|
"k-grid",
|
|
783
786
|
{
|
|
784
787
|
"k-grid-md": !this.props.size,
|
|
@@ -795,7 +798,7 @@ const z = class z extends r.Component {
|
|
|
795
798
|
...le
|
|
796
799
|
},
|
|
797
800
|
v,
|
|
798
|
-
|
|
801
|
+
N,
|
|
799
802
|
/* @__PURE__ */ r.createElement(
|
|
800
803
|
ne,
|
|
801
804
|
{
|
|
@@ -808,7 +811,7 @@ const z = class z extends r.Component {
|
|
|
808
811
|
/* @__PURE__ */ r.createElement(
|
|
809
812
|
"table",
|
|
810
813
|
{
|
|
811
|
-
className:
|
|
814
|
+
className: L(
|
|
812
815
|
"k-table k-grid-table",
|
|
813
816
|
{ [`k-table-${G.sizeMap[this.props.size] || this.props.size}`]: this.props.size }
|
|
814
817
|
),
|
|
@@ -822,14 +825,14 @@ const z = class z extends r.Component {
|
|
|
822
825
|
),
|
|
823
826
|
K && Q,
|
|
824
827
|
te && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(pe, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(de, { ref: this.dragLogic.refDragElementClue }))
|
|
825
|
-
),
|
|
828
|
+
), E, this.props.pageable && Y);
|
|
826
829
|
let A = this.props.style || {};
|
|
827
830
|
return this.props.scrollable === "virtual" && (A.height || (A = Object.assign({}, A, { height: "450px" }))), /* @__PURE__ */ r.createElement(V.Provider, { value: this.contextStateRef.current }, /* @__PURE__ */ r.createElement(
|
|
828
831
|
"div",
|
|
829
832
|
{
|
|
830
833
|
id: this.props.id,
|
|
831
834
|
style: A,
|
|
832
|
-
className:
|
|
835
|
+
className: L(
|
|
833
836
|
"k-grid",
|
|
834
837
|
{
|
|
835
838
|
"k-grid-md": !this.props.size,
|
|
@@ -847,7 +850,7 @@ const z = class z extends r.Component {
|
|
|
847
850
|
...le
|
|
848
851
|
},
|
|
849
852
|
v,
|
|
850
|
-
|
|
853
|
+
N,
|
|
851
854
|
/* @__PURE__ */ r.createElement(
|
|
852
855
|
"div",
|
|
853
856
|
{
|
|
@@ -879,7 +882,7 @@ const z = class z extends r.Component {
|
|
|
879
882
|
/* @__PURE__ */ r.createElement(
|
|
880
883
|
"table",
|
|
881
884
|
{
|
|
882
|
-
className:
|
|
885
|
+
className: L(
|
|
883
886
|
"k-table k-grid-table",
|
|
884
887
|
{
|
|
885
888
|
"k-table-md": !this.props.size,
|
|
@@ -913,7 +916,7 @@ const z = class z extends r.Component {
|
|
|
913
916
|
te && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(pe, { ref: this.dragLogic.refDropElementClue }), /* @__PURE__ */ r.createElement(de, { ref: this.dragLogic.refDragElementClue })),
|
|
914
917
|
this.showLicenseWatermark && /* @__PURE__ */ r.createElement(Ue, null)
|
|
915
918
|
),
|
|
916
|
-
|
|
919
|
+
E,
|
|
917
920
|
this.props.pageable && Y
|
|
918
921
|
));
|
|
919
922
|
}
|
|
@@ -1010,7 +1013,7 @@ const z = class z extends r.Component {
|
|
|
1010
1013
|
a = Math.round(a), this._header && this._header.setWidth(a), this._footer && this._footer.setWidth(a), this.tableElement && (this.tableElement.style.width = a + "px");
|
|
1011
1014
|
}
|
|
1012
1015
|
initColumns(a, p) {
|
|
1013
|
-
const c =
|
|
1016
|
+
const c = F.getIdPrefix(this.navigationStateRef);
|
|
1014
1017
|
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;
|
|
1015
1018
|
}
|
|
1016
1019
|
getDataState() {
|
|
@@ -1030,9 +1033,9 @@ const z = class z extends r.Component {
|
|
|
1030
1033
|
};
|
|
1031
1034
|
}
|
|
1032
1035
|
};
|
|
1033
|
-
|
|
1036
|
+
_.displayName = "KendoReactGrid", _.defaultProps = {
|
|
1034
1037
|
// never use this
|
|
1035
|
-
},
|
|
1038
|
+
}, _.propTypes = {
|
|
1036
1039
|
data: s.oneOfType([
|
|
1037
1040
|
s.array,
|
|
1038
1041
|
s.shape({
|
|
@@ -1108,8 +1111,8 @@ z.displayName = "KendoReactGrid", z.defaultProps = {
|
|
|
1108
1111
|
dataItemKey: s.string,
|
|
1109
1112
|
navigatable: s.bool,
|
|
1110
1113
|
size: s.oneOf(["small", "medium"])
|
|
1111
|
-
},
|
|
1112
|
-
let B =
|
|
1114
|
+
}, _.contextType = V;
|
|
1115
|
+
let B = _;
|
|
1113
1116
|
rt(B);
|
|
1114
1117
|
export {
|
|
1115
1118
|
B as Grid
|
|
@@ -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
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react");function a(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const c=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,c.get?c:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const n=a(l),i=e=>n.createElement("td",{className:"k-table-td k-hierarchy-cell",role:"gridcell"});exports.GridDetailHierarchyCell=i;
|
|
@@ -6,12 +6,8 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
const l = (e) => {
|
|
12
|
-
const t = r(e.id);
|
|
13
|
-
return /* @__PURE__ */ a.createElement("td", { className: "k-table-td k-hierarchy-cell", ...t, role: "gridcell" });
|
|
14
|
-
};
|
|
9
|
+
import * as e from "react";
|
|
10
|
+
const l = (r) => /* @__PURE__ */ e.createElement("td", { className: "k-table-td k-hierarchy-cell", role: "gridcell" });
|
|
15
11
|
export {
|
|
16
12
|
l as GridDetailHierarchyCell
|
|
17
13
|
};
|
|
@@ -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
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),T=require("../utils/index.js"),s=require("../messages/index.js"),j=require("@progress/kendo-react-intl"),v=require("@progress/kendo-react-data-tools"),f=require("@progress/kendo-react-common");function E(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const c=E(I),P=e=>{const{selectionChange:t,field:n,dataItem:a,id:p,className:y,colSpan:C,style:h,ariaColumnIndex:S,rowType:r,cells:x,render:i}=e,N=j.useLocalization(),R=c.useCallback(l=>{t&&t({syntheticEvent:l})},[t]),O=f.useId(),d=T.getNestedValue(n,a),q=v.useTableKeyboardNavigation(p),w=f.classNames("k-table-td",y),u={colSpan:C,style:h,className:w,"aria-colindex":S,role:"gridcell",...q},m=typeof d=="boolean"&&d,g=c.createElement("span",{key:1,className:"k-checkbox-wrap"},c.createElement("input",{id:O,tabIndex:-1,type:"checkbox",className:"k-checkbox k-checkbox-md k-rounded-md","aria-label":N.toLanguageString(s.selectRow,s.messages[s.selectRow]),"aria-checked":m,checked:m,onChange:R})),b=r!=="groupHeader"?c.createElement("td",{...u},g):null,k=r||"data",o=x;if(o&&o.select&&o.select[k]){const l=o.select[k];return c.createElement(l,{...e,tdProps:u},g)}return i?i.call(void 0,b,e):b};exports.GridSelectionCell=P;
|