@bolid-ui/data-table 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist/community/components/framework/userCompUtils.cjs +1 -1
  2. package/dist/community/components/framework/userCompUtils.d.cts +7 -0
  3. package/dist/community/components/framework/userCompUtils.d.ts +7 -0
  4. package/dist/community/components/framework/userCompUtils.js +30 -24
  5. package/dist/community/context/context.d.cts +1 -1
  6. package/dist/community/context/context.d.ts +1 -1
  7. package/dist/community/entities/gridOptions.d.cts +30 -4
  8. package/dist/community/entities/gridOptions.d.ts +30 -4
  9. package/dist/community/gridOptionsDefault.cjs +1 -1
  10. package/dist/community/gridOptionsDefault.d.cts +2 -1
  11. package/dist/community/gridOptionsDefault.d.ts +2 -1
  12. package/dist/community/gridOptionsDefault.js +2 -1
  13. package/dist/community/interfaces/iLoadingCellRenderer.d.cts +3 -2
  14. package/dist/community/interfaces/iLoadingCellRenderer.d.ts +3 -2
  15. package/dist/community/pagination/paginationComp.cjs +1 -1
  16. package/dist/community/pagination/paginationComp.js +1 -6
  17. package/dist/community/propertyKeys.cjs +1 -1
  18. package/dist/community/propertyKeys.js +2 -2
  19. package/dist/community/rendering/row/rowCtrl.cjs +1 -1
  20. package/dist/community/rendering/row/rowCtrl.d.cts +1 -0
  21. package/dist/community/rendering/row/rowCtrl.d.ts +1 -0
  22. package/dist/community/rendering/row/rowCtrl.js +39 -27
  23. package/dist/community/validation/rules/userCompValidations.cjs +1 -1
  24. package/dist/community/validation/rules/userCompValidations.js +1 -0
  25. package/dist/enterprise/cellRenderers/enterpriseCellRendererModule.cjs +1 -1
  26. package/dist/enterprise/cellRenderers/enterpriseCellRendererModule.js +8 -4
  27. package/dist/enterprise/cellRenderers/errorCellRenderer.cjs +1 -0
  28. package/dist/enterprise/cellRenderers/errorCellRenderer.d.cts +13 -0
  29. package/dist/enterprise/cellRenderers/errorCellRenderer.d.ts +13 -0
  30. package/dist/enterprise/cellRenderers/errorCellRenderer.js +25 -0
  31. package/dist/enterprise/cellRenderers/loadingCellRenderer.cjs +1 -1
  32. package/dist/enterprise/cellRenderers/loadingCellRenderer.d.cts +0 -1
  33. package/dist/enterprise/cellRenderers/loadingCellRenderer.d.ts +0 -1
  34. package/dist/enterprise/cellRenderers/loadingCellRenderer.js +1 -4
  35. package/dist/enterprise/serverSideRowModel/stores/lazy/lazyBlockLoadingService.cjs +1 -1
  36. package/dist/enterprise/serverSideRowModel/stores/lazy/lazyBlockLoadingService.js +1 -1
  37. package/dist/enterprise/serverSideRowModel/stores/lazy/lazyCache.cjs +1 -1
  38. package/dist/enterprise/serverSideRowModel/stores/lazy/lazyCache.d.cts +19 -0
  39. package/dist/enterprise/serverSideRowModel/stores/lazy/lazyCache.d.ts +19 -0
  40. package/dist/enterprise/serverSideRowModel/stores/lazy/lazyCache.js +28 -6
  41. package/dist/enterprise/serverSideRowModel/stores/lazy/lazyStore.cjs +1 -1
  42. package/dist/enterprise/serverSideRowModel/stores/lazy/lazyStore.js +2 -2
  43. package/dist/locale/ar-EG.cjs +1 -1
  44. package/dist/locale/ar-EG.d.cts +2 -0
  45. package/dist/locale/ar-EG.d.ts +2 -0
  46. package/dist/locale/ar-EG.js +2 -0
  47. package/dist/locale/bg-BG.cjs +1 -1
  48. package/dist/locale/bg-BG.d.cts +2 -0
  49. package/dist/locale/bg-BG.d.ts +2 -0
  50. package/dist/locale/bg-BG.js +2 -0
  51. package/dist/locale/cs-CZ.cjs +1 -1
  52. package/dist/locale/cs-CZ.d.cts +2 -0
  53. package/dist/locale/cs-CZ.d.ts +2 -0
  54. package/dist/locale/cs-CZ.js +2 -0
  55. package/dist/locale/da-DK.cjs +1 -1
  56. package/dist/locale/da-DK.d.cts +2 -0
  57. package/dist/locale/da-DK.d.ts +2 -0
  58. package/dist/locale/da-DK.js +2 -0
  59. package/dist/locale/de-DE.cjs +1 -1
  60. package/dist/locale/de-DE.d.cts +2 -0
  61. package/dist/locale/de-DE.d.ts +2 -0
  62. package/dist/locale/de-DE.js +2 -0
  63. package/dist/locale/el-GR.cjs +1 -1
  64. package/dist/locale/el-GR.d.cts +2 -0
  65. package/dist/locale/el-GR.d.ts +2 -0
  66. package/dist/locale/el-GR.js +2 -0
  67. package/dist/locale/en-US.cjs +1 -1
  68. package/dist/locale/en-US.d.cts +2 -0
  69. package/dist/locale/en-US.d.ts +2 -0
  70. package/dist/locale/en-US.js +2 -0
  71. package/dist/locale/es-ES.cjs +1 -1
  72. package/dist/locale/es-ES.d.cts +2 -0
  73. package/dist/locale/es-ES.d.ts +2 -0
  74. package/dist/locale/es-ES.js +2 -0
  75. package/dist/locale/fa-IR.cjs +1 -1
  76. package/dist/locale/fa-IR.d.cts +2 -0
  77. package/dist/locale/fa-IR.d.ts +2 -0
  78. package/dist/locale/fa-IR.js +2 -0
  79. package/dist/locale/fi-FI.cjs +1 -1
  80. package/dist/locale/fi-FI.d.cts +2 -0
  81. package/dist/locale/fi-FI.d.ts +2 -0
  82. package/dist/locale/fi-FI.js +2 -0
  83. package/dist/locale/fr-FR.cjs +1 -1
  84. package/dist/locale/fr-FR.d.cts +2 -0
  85. package/dist/locale/fr-FR.d.ts +2 -0
  86. package/dist/locale/fr-FR.js +2 -0
  87. package/dist/locale/he-IL.cjs +1 -1
  88. package/dist/locale/he-IL.d.cts +2 -0
  89. package/dist/locale/he-IL.d.ts +2 -0
  90. package/dist/locale/he-IL.js +2 -0
  91. package/dist/locale/hr-HR.cjs +1 -1
  92. package/dist/locale/hr-HR.d.cts +2 -0
  93. package/dist/locale/hr-HR.d.ts +2 -0
  94. package/dist/locale/hr-HR.js +2 -0
  95. package/dist/locale/hu-HU.cjs +1 -1
  96. package/dist/locale/hu-HU.d.cts +2 -0
  97. package/dist/locale/hu-HU.d.ts +2 -0
  98. package/dist/locale/hu-HU.js +2 -0
  99. package/dist/locale/it-IT.cjs +1 -1
  100. package/dist/locale/it-IT.d.cts +2 -0
  101. package/dist/locale/it-IT.d.ts +2 -0
  102. package/dist/locale/it-IT.js +2 -0
  103. package/dist/locale/ja-JP.cjs +1 -1
  104. package/dist/locale/ja-JP.d.cts +2 -0
  105. package/dist/locale/ja-JP.d.ts +2 -0
  106. package/dist/locale/ja-JP.js +2 -0
  107. package/dist/locale/ko-KR.cjs +1 -1
  108. package/dist/locale/ko-KR.d.cts +2 -0
  109. package/dist/locale/ko-KR.d.ts +2 -0
  110. package/dist/locale/ko-KR.js +2 -0
  111. package/dist/locale/nb-NO.cjs +1 -1
  112. package/dist/locale/nb-NO.d.cts +2 -0
  113. package/dist/locale/nb-NO.d.ts +2 -0
  114. package/dist/locale/nb-NO.js +2 -0
  115. package/dist/locale/nl-NL.cjs +1 -1
  116. package/dist/locale/nl-NL.d.cts +2 -0
  117. package/dist/locale/nl-NL.d.ts +2 -0
  118. package/dist/locale/nl-NL.js +2 -0
  119. package/dist/locale/pl-PL.cjs +1 -1
  120. package/dist/locale/pl-PL.d.cts +2 -0
  121. package/dist/locale/pl-PL.d.ts +2 -0
  122. package/dist/locale/pl-PL.js +2 -0
  123. package/dist/locale/pt-BR.cjs +1 -1
  124. package/dist/locale/pt-BR.d.cts +2 -0
  125. package/dist/locale/pt-BR.d.ts +2 -0
  126. package/dist/locale/pt-BR.js +2 -0
  127. package/dist/locale/pt-PT.cjs +1 -1
  128. package/dist/locale/pt-PT.d.cts +2 -0
  129. package/dist/locale/pt-PT.d.ts +2 -0
  130. package/dist/locale/pt-PT.js +2 -0
  131. package/dist/locale/ro-RO.cjs +1 -1
  132. package/dist/locale/ro-RO.d.cts +2 -0
  133. package/dist/locale/ro-RO.d.ts +2 -0
  134. package/dist/locale/ro-RO.js +2 -0
  135. package/dist/locale/ru-RU.cjs +1 -1
  136. package/dist/locale/ru-RU.d.cts +2 -0
  137. package/dist/locale/ru-RU.d.ts +2 -0
  138. package/dist/locale/ru-RU.js +2 -0
  139. package/dist/locale/sk-SK.cjs +1 -1
  140. package/dist/locale/sk-SK.d.cts +2 -0
  141. package/dist/locale/sk-SK.d.ts +2 -0
  142. package/dist/locale/sk-SK.js +2 -0
  143. package/dist/locale/sv-SE.cjs +1 -1
  144. package/dist/locale/sv-SE.d.cts +2 -0
  145. package/dist/locale/sv-SE.d.ts +2 -0
  146. package/dist/locale/sv-SE.js +2 -0
  147. package/dist/locale/tr-TR.cjs +1 -1
  148. package/dist/locale/tr-TR.d.cts +2 -0
  149. package/dist/locale/tr-TR.d.ts +2 -0
  150. package/dist/locale/tr-TR.js +2 -0
  151. package/dist/locale/uk-UA.cjs +1 -1
  152. package/dist/locale/uk-UA.d.cts +2 -0
  153. package/dist/locale/uk-UA.d.ts +2 -0
  154. package/dist/locale/uk-UA.js +2 -0
  155. package/dist/locale/ur-PK.cjs +1 -1
  156. package/dist/locale/ur-PK.d.cts +2 -0
  157. package/dist/locale/ur-PK.d.ts +2 -0
  158. package/dist/locale/ur-PK.js +2 -0
  159. package/dist/locale/vi-VN.cjs +1 -1
  160. package/dist/locale/vi-VN.d.cts +2 -0
  161. package/dist/locale/vi-VN.d.ts +2 -0
  162. package/dist/locale/vi-VN.js +2 -0
  163. package/dist/locale/zh-CN.cjs +1 -1
  164. package/dist/locale/zh-CN.d.cts +2 -0
  165. package/dist/locale/zh-CN.d.ts +2 -0
  166. package/dist/locale/zh-CN.js +2 -0
  167. package/dist/locale/zh-HK.cjs +1 -1
  168. package/dist/locale/zh-HK.d.cts +2 -0
  169. package/dist/locale/zh-HK.d.ts +2 -0
  170. package/dist/locale/zh-HK.js +2 -0
  171. package/dist/locale/zh-TW.cjs +1 -1
  172. package/dist/locale/zh-TW.d.cts +2 -0
  173. package/dist/locale/zh-TW.d.ts +2 -0
  174. package/dist/locale/zh-TW.js +2 -0
  175. package/package.json +3 -3
@@ -1 +1 @@
1
- const e=require("../../dataTableStack/utils/generic.cjs"),t=require("../../dataTableStack/utils/document.cjs"),n=require("../../dataTableStack/utils/aria.cjs"),r=require("../../dataTableStack/utils/dom.cjs"),i=require("../../context/beanStub.cjs"),a=require("../../dataTableStack/utils/string.cjs"),o=require("../../dataTableStack/utils/function.cjs"),s=require("../../gridOptionsUtils.cjs"),c=require("../../components/framework/userCompUtils.cjs"),l=require("../../dataTableStack/utils/browser.cjs"),u=require("../../dataTableStack/utils/focus.cjs"),d=require("../../utils/gridEvent.cjs"),f=require("../../components/emptyBean.cjs"),p=require("../renderUtils.cjs"),m=require("../cell/cellCtrl.cjs"),h=require("../../styling/rowStyleService.cjs");var g=0,_=class extends i.BeanStub{instanceId;tooltipFeature;rowType;leftGui;centerGui;rightGui;fullWidthGui;allRowGuis=[];firstRowOnPage;lastRowOnPage;active=!0;rowFocused;centerCellCtrls={list:[],map:{}};leftCellCtrls={list:[],map:{}};rightCellCtrls={list:[],map:{}};slideInAnimation={left:!1,center:!1,right:!1,fullWidth:!1};fadeInAnimation={left:!1,center:!1,right:!1,fullWidth:!1};rowDragComps=[];paginationPage;lastMouseDownOnDragger=!1;rowLevel;rowStyles;emptyStyle={};suppressRowTransform;updateColumnListsPending=!1;rowId=null;businessKey=null;businessKeyForNodeFunc;rowEditStyleFeature;rowNode;useAnimationFrameForCreate;printLayout;constructor(e,t,n,r,i){super(),this.rowNode=e,this.useAnimationFrameForCreate=r,this.printLayout=i,this.beans=t,this.gos=t.gos,this.paginationPage=t.pagination?.getCurrentPage()??0,this.suppressRowTransform=this.gos.get(`suppressRowTransform`),this.instanceId=e.id+`-`+ g++,this.rowId=a._escapeString(e.id),this.initRowBusinessKey(),this.rowFocused=t.focusSvc.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned),this.rowLevel=h.calculateRowLevel(this.rowNode),this.setRowType(),this.setAnimateFlags(n),this.rowStyles=this.processStylesFromGridOptions(),this.rowEditStyleFeature=t.editSvc?.createRowStyleFeature(this),this.addListeners()}initRowBusinessKey(){this.businessKeyForNodeFunc=this.gos.get(`getBusinessKeyForNode`),this.updateRowBusinessKey()}updateRowBusinessKey(){if(typeof this.businessKeyForNodeFunc!=`function`)return;let e=this.businessKeyForNodeFunc(this.rowNode);this.businessKey=a._escapeString(e)}updateGui(e,t){e===`left`?this.leftGui=t:e===`right`?this.rightGui=t:e===`fullWidth`?this.fullWidthGui=t:this.centerGui=t}setComp(e,t,n,r){let{context:i,focusSvc:a}=this.beans;r=f.setupCompBean(this,i,r);let o={rowComp:e,element:t,containerType:n,compBean:r};this.allRowGuis.push(o),this.updateGui(n,o),this.initialiseRowComp(o);let s=this.rowNode,c=this.rowType===`FullWidthLoading`||s.stub,l=!s.data&&this.beans.rowModel.getType()===`infinite`;!c&&!l&&!s.rowPinned&&this.beans.rowRenderer.dispatchFirstDataRenderedEvent();let u=this.fullWidthGui?.element;u&&!this.beans.editSvc?.isEditing(this)&&a.isRowFocused(s.rowIndex,s.rowPinned)&&a.shouldTakeFocus()&&setTimeout(()=>u.focus({preventScroll:!0}),0)}unsetComp(e){this.allRowGuis=this.allRowGuis.filter(t=>t.containerType!==e),this.updateGui(e,void 0)}isCacheable(){return this.rowType===`FullWidthDetail`&&this.gos.get(`keepDetailRows`)}setCached(e){let t=e?`none`:``;for(let e of this.allRowGuis)e.element.style.display=t}initialiseRowComp(e){let t=this.gos;this.onSuppressCellFocusChanged(this.beans.gos.get(`suppressCellFocus`)),this.listenOnDomOrder(e),this.onRowHeightChanged(e),this.updateRowIndexes(e),this.setFocusedClasses(e),this.setStylesFromGridOptions(!1,e),s._isRowSelection(t)&&this.rowNode.selectable&&this.onRowSelected(e),this.updateColumnLists(!this.useAnimationFrameForCreate);let r=e.rowComp,i=this.getInitialRowClasses(e.containerType);for(let e of i)r.toggleCss(e,!0);this.executeSlideAndFadeAnimations(e),this.rowNode.group&&n._setAriaExpanded(e.element,this.rowNode.expanded==1),this.setRowCompRowId(r),this.setRowCompRowBusinessKey(r),s._setDomData(t,e.element,p.DOM_DATA_KEY_ROW_CTRL,this),e.compBean.addDestroyFunc(()=>s._setDomData(t,e.element,p.DOM_DATA_KEY_ROW_CTRL,null)),this.useAnimationFrameForCreate?this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this,e),this.rowNode.rowIndex,`p2`,!1):this.addHoverFunctionality(e),this.isFullWidth()&&this.setupFullWidth(e),t.get(`rowDragEntireRow`)&&this.addRowDraggerToRow(e),this.useAnimationFrameForCreate&&this.beans.animationFrameSvc.addDestroyTask(()=>{this.isAlive()&&e.rowComp.toggleCss(`data-table-after-created`,!0)}),this.executeProcessRowPostCreateFunc()}setRowCompRowBusinessKey(e){this.businessKey!=null&&e.setRowBusinessKey(this.businessKey)}setRowCompRowId(e){let t=a._escapeString(this.rowNode.id);this.rowId=t,t!=null&&e.setRowId(t)}executeSlideAndFadeAnimations(e){let{containerType:t}=e;this.slideInAnimation[t]&&(o._batchCall(()=>{this.onTopChanged()}),this.slideInAnimation[t]=!1),this.fadeInAnimation[t]&&(o._batchCall(()=>{e.rowComp.toggleCss(`data-table-opacity-zero`,!1)}),this.fadeInAnimation[t]=!1)}addRowDraggerToRow(e){let t=this.beans.rowDragSvc?.createRowDragCompForRow(this.rowNode,e.element);if(!t)return;let n=this.createBean(t,this.beans.context);this.rowDragComps.push(n),e.compBean.addDestroyFunc(()=>{this.rowDragComps=this.rowDragComps.filter(e=>e!==n),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,this.beans.context),this.destroyBean(n,this.beans.context)})}setupFullWidth(e){let t=this.getPinnedForContainer(e.containerType),n=this.createFullWidthCompDetails(e.element,t);e.rowComp.showFullWidth(n)}getFullWidthCellRenderers(){return this.gos.get(`embedFullWidthRows`)?this.allRowGuis.map(e=>e?.rowComp?.getFullWidthCellRenderer()):[this.fullWidthGui?.rowComp?.getFullWidthCellRenderer()]}executeProcessRowPostCreateFunc(){let e=this.gos.getCallback(`processRowPostCreate`);!e||!this.areAllContainersReady()||e({eRow:this.centerGui.element,ePinnedLeftRow:this.leftGui?this.leftGui.element:void 0,ePinnedRightRow:this.rightGui?this.rightGui.element:void 0,node:this.rowNode,rowIndex:this.rowNode.rowIndex,addRenderedRowListener:this.addEventListener.bind(this)})}areAllContainersReady(){let{leftGui:e,centerGui:t,rightGui:n,beans:{visibleCols:r}}=this,i=!!e||!r.isPinningLeft(),a=!!t,o=!!n||!r.isPinningRight();return i&&a&&o}isNodeFullWidthCell(){if(this.rowNode.detail)return!0;let e=this.beans.gos.getCallback(`isFullWidthRow`);return e?e({rowNode:this.rowNode}):!1}setRowType(){let{rowNode:e,gos:t,beans:{colModel:n}}=this,r=e.stub&&!e.__wasEvicted&&!t.get(`suppressServerSideFullWidthLoadingRow`)&&!t.get(`groupHideOpenParents`),i=this.isNodeFullWidthCell(),a=t.get(`masterDetail`)&&e.detail,o=s._isFullWidthGroupRow(t,e,n.isPivotMode());r?this.rowType=`FullWidthLoading`:a?this.rowType=`FullWidthDetail`:i?this.rowType=`FullWidth`:o?this.rowType=`FullWidthGroup`:this.rowType=`Normal`}updateColumnLists(e=!1,t=!1){if(this.isFullWidth())return;let{animationFrameSvc:n}=this.beans;if(!n?.active||e||this.printLayout){this.updateColumnListsImpl(t);return}this.updateColumnListsPending||=(n.createTask(()=>{this.active&&this.updateColumnListsImpl(!0)},this.rowNode.rowIndex,`p1`,!1),!0)}getNewCellCtrl(e){if(!this.beans.rowSpanSvc?.isCellSpanning(e,this.rowNode))return new m.CellCtrl(e,this.rowNode,this.beans,this)}isCorrectCtrlForSpan(e){return!this.beans.rowSpanSvc?.isCellSpanning(e.column,this.rowNode)}createCellCtrls(e,t,n=null){let r={list:[],map:{}},i=(e,t,n)=>{n==null?r.list.push(t):r.list.splice(n,0,t),r.map[e]=t},a=[];for(let n of t){let t=n.getInstanceId(),r=e.map[t];r&&!this.isCorrectCtrlForSpan(r)&&(r.destroy(),r=void 0),r||=this.getNewCellCtrl(n),r&&i(t,r)}for(let t of e.list){let e=t.column.getInstanceId();r.map[e]??(this.isCellEligibleToBeRemoved(t,n)?t.destroy():a.push([e,t]))}if(a.length)for(let[e,t]of a){let n=r.list.findIndex(e=>e.column.getLeft()>t.column.getLeft());i(e,t,n===-1?void 0:Math.max(n-1,0))}let{focusSvc:o,visibleCols:s}=this.beans,c=o.getFocusedCell();if(c&&c.column.getPinned()==n){let e=c.column.getInstanceId();if(!r.map[e]&&s.allCols.includes(c.column)){let t=this.createFocusedCellCtrl();if(t){let n=r.list.findIndex(e=>e.column.getLeft()>t.column.getLeft());i(e,t,n===-1?void 0:Math.max(n-1,0))}}}return r}createFocusedCellCtrl(){let{focusSvc:e,rowSpanSvc:t}=this.beans,n=e.getFocusedCell();if(!n)return;let r=t?.getCellSpan(n.column,this.rowNode);if(r){if(r.firstNode!==this.rowNode||!r.doesSpanContain(n))return}else if(!e.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))return;return this.getNewCellCtrl(n.column)}updateColumnListsImpl(e){this.updateColumnListsPending=!1,this.createAllCellCtrls(),this.setCellCtrls(e)}setCellCtrls(e){for(let t of this.allRowGuis){let n=this.getCellCtrlsForContainer(t.containerType);t.rowComp.setCellCtrls(n,e)}}getCellCtrlsForContainer(e){switch(e){case`left`:return this.leftCellCtrls.list;case`right`:return this.rightCellCtrls.list;case`fullWidth`:return[];case`center`:return this.centerCellCtrls.list}}createAllCellCtrls(){let e=this.beans.colViewport,t=this.beans.visibleCols;if(this.printLayout)this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,t.allCols),this.leftCellCtrls={list:[],map:{}},this.rightCellCtrls={list:[],map:{}};else{let n=e.getColsWithinViewport(this.rowNode);this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,n);let r=t.getLeftColsForRow(this.rowNode);this.leftCellCtrls=this.createCellCtrls(this.leftCellCtrls,r,`left`);let i=t.getRightColsForRow(this.rowNode);this.rightCellCtrls=this.createCellCtrls(this.rightCellCtrls,i,`right`)}}isCellEligibleToBeRemoved(e,t){let{column:n}=e;if(n.getPinned()!=t||!this.isCorrectCtrlForSpan(e))return!0;let{visibleCols:r,editSvc:i}=this.beans,a=i?.isEditing(e),o=e.isCellFocused();return a||o?!(r.allCols.indexOf(n)>=0):!0}getDomOrder(){return this.gos.get(`ensureDomOrder`)||s._isDomLayout(this.gos,`print`)}listenOnDomOrder(e){e.compBean.addManagedPropertyListeners([`domLayout`,`ensureDomOrder`],()=>{e.rowComp.setDomOrder(this.getDomOrder())})}setAnimateFlags(t){if(this.rowNode.sticky||!t)return;let n=e._exists(this.rowNode.oldRowTop),{visibleCols:r}=this.beans,i=r.isPinningLeft(),a=r.isPinningRight();if(n){let{slideInAnimation:e}=this;if(this.isFullWidth()&&!this.gos.get(`embedFullWidthRows`)){e.fullWidth=!0;return}e.center=!0,e.left=i,e.right=a}else{let{fadeInAnimation:e}=this;if(this.isFullWidth()&&!this.gos.get(`embedFullWidthRows`)){e.fullWidth=!0;return}e.center=!0,e.left=i,e.right=a}}isFullWidth(){return this.rowType!==`Normal`}refreshFullWidth(){let e=(e,t)=>e?e.rowComp.refreshFullWidth(()=>this.createFullWidthCompDetails(e.element,t).params):!0,t=e(this.fullWidthGui,null),n=e(this.centerGui,null),r=e(this.leftGui,`left`),i=e(this.rightGui,`right`);return t&&n&&r&&i}addListeners(){let{beans:e,gos:t,rowNode:n}=this,{expansionSvc:r,eventSvc:i,context:a,rowSpanSvc:o}=e;this.addManagedListeners(this.rowNode,{heightChanged:()=>this.onRowHeightChanged(),rowSelected:()=>this.onRowSelected(),rowIndexChanged:this.onRowIndexChanged.bind(this),topChanged:this.onTopChanged.bind(this),...r?.getRowExpandedListeners(this)??{}}),n.detail&&this.addManagedListeners(n.parent,{dataChanged:this.onRowNodeDataChanged.bind(this)}),this.addManagedListeners(n,{dataChanged:this.onRowNodeDataChanged.bind(this),cellChanged:this.postProcessCss.bind(this),rowHighlightChanged:this.onRowNodeHighlightChanged.bind(this),draggingChanged:this.postProcessRowDragging.bind(this),uiLevelChanged:this.onUiLevelChanged.bind(this),rowPinned:this.onRowPinned.bind(this)}),this.addManagedListeners(i,{paginationPixelOffsetChanged:this.onPaginationPixelOffsetChanged.bind(this),heightScaleChanged:this.onTopChanged.bind(this),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),virtualColumnsChanged:this.onVirtualColumnsChanged.bind(this),cellFocused:this.onCellFocusChanged.bind(this),cellFocusCleared:this.onCellFocusChanged.bind(this),paginationChanged:this.onPaginationChanged.bind(this),modelUpdated:this.refreshFirstAndLastRowStyles.bind(this),columnMoved:()=>this.updateColumnLists()}),o&&this.addManagedListeners(o,{spannedCellsUpdated:({pinned:e})=>{e&&!n.rowPinned||this.updateColumnLists()}}),this.addDestroyFunc(()=>{this.rowDragComps=this.destroyBeans(this.rowDragComps,a),this.tooltipFeature=this.destroyBean(this.tooltipFeature,a),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,a)}),this.addManagedPropertyListeners([`rowStyle`,`getRowStyle`,`rowClass`,`getRowClass`,`rowClassRules`],this.postProcessCss.bind(this)),this.addManagedPropertyListener(`rowDragEntireRow`,()=>{if(t.get(`rowDragEntireRow`)){for(let e of this.allRowGuis)this.addRowDraggerToRow(e);return}this.rowDragComps=this.destroyBeans(this.rowDragComps,a)}),this.addListenersForCellComps()}addListenersForCellComps(){this.addManagedListeners(this.rowNode,{rowIndexChanged:()=>{for(let e of this.getAllCellCtrls())e.onRowIndexChanged()},cellChanged:e=>{for(let t of this.getAllCellCtrls())t.onCellChanged(e)}})}onRowPinned(){for(let e of this.allRowGuis)e.rowComp.toggleCss(`data-table-row-pinned-source`,!!this.rowNode.pinnedSibling)}onRowNodeDataChanged(e){this.refreshRow({suppressFlash:!e.update,newData:!e.update})}refreshRow(e){if(this.isFullWidth()!==!!this.isNodeFullWidthCell()){this.beans.rowRenderer.redrawRow(this.rowNode);return}if(this.isFullWidth()){this.refreshFullWidth()||this.beans.rowRenderer.redrawRow(this.rowNode);return}for(let t of this.getAllCellCtrls())t.refreshCell(e);for(let e of this.allRowGuis)this.setRowCompRowId(e.rowComp),this.updateRowBusinessKey(),this.setRowCompRowBusinessKey(e.rowComp);this.onRowSelected(),this.postProcessCss()}postProcessCss(){this.setStylesFromGridOptions(!0),this.postProcessClassesFromGridOptions(),this.postProcessRowClassRules(),this.rowEditStyleFeature?.applyRowStyles(),this.postProcessRowDragging()}onRowNodeHighlightChanged(){let e=this.beans.rowDropHighlightSvc,t=e?.row===this.rowNode?e.position:`none`,n=t===`above`,r=t===`inside`,i=t===`below`,a=t!==`none`,o=n||i,s=this.rowNode.uiLevel,c=o&&s>0,l=c?s.toString():`0`;for(let e of this.allRowGuis){let t=e.rowComp;t.toggleCss(`data-table-row-highlight-above`,n),t.toggleCss(`data-table-row-highlight-inside`,r),t.toggleCss(`data-table-row-highlight-below`,i),t.toggleCss(`data-table-row-highlight-indent`,c),a?e.element.style.setProperty(`--data-table-row-highlight-level`,l):e.element.style.removeProperty(`--data-table-row-highlight-level`)}}postProcessRowDragging(){let e=this.rowNode.dragging;for(let t of this.allRowGuis)t.rowComp.toggleCss(`data-table-row-dragging`,e)}onDisplayedColumnsChanged(){this.updateColumnLists(!0),this.beans.rowAutoHeight?.requestCheckAutoHeight()}onVirtualColumnsChanged(){this.updateColumnLists(!1,!0)}getRowPosition(){return{rowPinned:e._makeNull(this.rowNode.rowPinned),rowIndex:this.rowNode.rowIndex}}onKeyboardNavigate(e){let t=this.findFullWidthInfoForEvent(e);if(!t)return;let{rowGui:n,column:r}=t;if(n.element!==e.target)return;let i=this.rowNode,{focusSvc:a,navigation:o}=this.beans,s=a.getFocusedCell(),c={rowIndex:i.rowIndex,rowPinned:i.rowPinned,column:s?.column??r};o?.navigateToNextCell(e,e.key,c,!0),e.preventDefault()}onTabKeyDown(e){if(e.defaultPrevented||d._isStopPropagationForDataTable(e))return;let n=this.allRowGuis.find(t=>t.element.contains(e.target)),r=n?n.element:null,i=r===e.target,a=t._getActiveDomElement(this.beans),o=!1;r&&a&&(o=r.contains(a)&&a.classList.contains(`data-table-cell`));let s=null;!i&&!o&&(s=u._findNextFocusableElement(this.beans,r,!1,e.shiftKey)),(this.isFullWidth()&&i||!s)&&this.beans.navigation?.onTabKeyDown(this,e)}getFullWidthElement(){return this.fullWidthGui?this.fullWidthGui.element:null}getRowYPosition(){let e=this.allRowGuis.find(e=>r._isVisible(e.element))?.element;return e?e.getBoundingClientRect().top:0}onSuppressCellFocusChanged(e){let t=this.isFullWidth()&&e?void 0:this.gos.get(`tabIndex`);for(let e of this.allRowGuis)r._addOrRemoveAttribute(e.element,`tabindex`,t)}onFullWidthRowFocused(e){let t=this.rowNode,n=e?this.isFullWidth()&&e.rowIndex===t.rowIndex&&e.rowPinned==t.rowPinned:!1,r;if(this.fullWidthGui)r=this.fullWidthGui.element;else{let t=this.beans.colModel.getCol(e?.column)?.pinned;r=t?t===`right`?this.rightGui?.element:this.leftGui?.element:this.centerGui?.element}r&&(r.classList.toggle(`data-table-full-width-focus`,n),n&&e?.forceBrowserFocus&&r.focus({preventScroll:!0}))}recreateCell(e){this.centerCellCtrls=this.removeCellCtrl(this.centerCellCtrls,e),this.leftCellCtrls=this.removeCellCtrl(this.leftCellCtrls,e),this.rightCellCtrls=this.removeCellCtrl(this.rightCellCtrls,e),e.destroy(),this.updateColumnLists()}removeCellCtrl(e,t){let n={list:[],map:{}};for(let r of e.list)r!==t&&(n.list.push(r),n.map[r.column.getInstanceId()]=r);return n}onMouseEvent(e,t){switch(e){case`dblclick`:this.onRowDblClick(t);break;case`click`:this.onRowClick(t);break;case`touchstart`:case`mousedown`:this.onRowMouseDown(t);break}}createRowEvent(e,t){let{rowNode:n}=this;return s._addGridCommonParams(this.gos,{type:e,node:n,data:n.data,rowIndex:n.rowIndex,rowPinned:n.rowPinned,event:t})}createRowEventWithSource(e,t){let n=this.createRowEvent(e,t);return n.source=this,n}onRowDblClick(e){if(d._isStopPropagationForDataTable(e))return;let t=this.createRowEventWithSource(`rowDoubleClicked`,e);t.isEventHandlingSuppressed=this.isSuppressMouseEvent(e),this.beans.eventSvc.dispatchEvent(t)}findFullWidthInfoForEvent(e){if(!e)return;let t=this.findFullWidthRowGui(e.target),n=this.getColumnForFullWidth(t);if(!(!t||!n))return{rowGui:t,column:n}}findFullWidthRowGui(e){return this.allRowGuis.find(t=>t.element.contains(e))}getColumnForFullWidth(e){let{visibleCols:t}=this.beans;switch(e?.containerType){case`center`:return t.centerCols[0];case`left`:return t.leftCols[0];case`right`:return t.rightCols[0];default:return t.allCols[0]}}onRowMouseDown(e){if(this.lastMouseDownOnDragger=r._isElementChildOfClass(e.target,`data-table-row-drag`,3),!this.isFullWidth()||this.isSuppressMouseEvent(e))return;let{rangeSvc:t,focusSvc:n}=this.beans;t?.removeAllCellRanges();let i=this.findFullWidthInfoForEvent(e);if(!i)return;let{rowGui:a,column:o}=i,s=a.element,c=e.target,u=this.rowNode,d=e.defaultPrevented||l._isBrowserSafari();s&&s.contains(c)&&r._isFocusableFormField(c)&&(d=!1),n.setFocusedCell({rowIndex:u.rowIndex,column:o,rowPinned:u.rowPinned,forceBrowserFocus:d})}isSuppressMouseEvent(e){let{gos:t,rowNode:n}=this;if(this.isFullWidth())return p._suppressFullWidthMouseEvent(t,this.findFullWidthRowGui(e.target)?.rowComp.getFullWidthCellRendererParams(),n,e);let r=p._getCellCtrlForEventTarget(t,e.target);return r!=null&&p._suppressCellMouseEvent(t,r.column,n,e)}onRowClick(e){if(d._isStopPropagationForDataTable(e)||this.lastMouseDownOnDragger)return;let t=this.isSuppressMouseEvent(e),{eventSvc:n,selectionSvc:r}=this.beans,i=this.createRowEventWithSource(`rowClicked`,e);i.isEventHandlingSuppressed=t,n.dispatchEvent(i),!t&&r?.handleSelectionEvent(e,this.rowNode,`rowClicked`)}setupDetailRowAutoHeight(e){this.rowType===`FullWidthDetail`&&this.beans.masterDetailSvc?.setupDetailRowAutoHeight(this,e)}createFullWidthCompDetails(e,t){let{gos:n,rowNode:r}=this,i=s._addGridCommonParams(n,{fullWidth:!0,data:r.data,node:r,value:r.key,valueFormatted:r.key,eGridCell:e,eParentOfValue:e,pinned:t,addRenderedRowListener:this.addEventListener.bind(this),registerRowDragger:(e,t,n,r)=>this.addFullWidthRowDragging(e,t,n,r),setTooltip:(e,t)=>{n.assertModuleRegistered(`Tooltip`,3),this.setupFullWidthRowTooltip(e,t)}}),a=this.beans.userCompFactory;switch(this.rowType){case`FullWidthDetail`:return c._getFullWidthDetailCellRendererDetails(a,i);case`FullWidthGroup`:{let{value:e,valueFormatted:t}=this.beans.valueSvc.getValueForDisplay({node:this.rowNode,includeValueFormatted:!0});return i.value=e,i.valueFormatted=t,c._getFullWidthGroupCellRendererDetails(a,i)}case`FullWidthLoading`:return n.get(`suppressDuplicateLoadingRows`)&&(i.isFirstLoadingRow=(r.rowIndex??0)===(this.beans.pageBounds?.getFirstRow()??0)),c._getFullWidthLoadingCellRendererDetails(a,i);default:return c._getFullWidthCellRendererDetails(a,i)}}setupFullWidthRowTooltip(e,t){this.fullWidthGui&&(this.tooltipFeature=this.beans.tooltipSvc?.setupFullWidthRowTooltip(this.tooltipFeature,this,e,t))}addFullWidthRowDragging(e,t,n=``,r){let{rowDragSvc:i,context:a}=this.beans;if(!i||!this.isFullWidth())return;let o=i.createRowDragComp(()=>n,this.rowNode,void 0,e,t,r);this.createBean(o,a),this.addDestroyFunc(()=>{this.destroyBean(o,a)})}onUiLevelChanged(){let e=h.calculateRowLevel(this.rowNode);if(this.rowLevel!=e){let t=`data-table-row-level-`+e,n=`data-table-row-level-`+this.rowLevel;for(let e of this.allRowGuis)e.rowComp.toggleCss(t,!0),e.rowComp.toggleCss(n,!1)}this.rowLevel=e}isFirstRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getFirstRow()}isLastRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getLastRow()}refreshFirstAndLastRowStyles(){let e=this.isFirstRowOnPage(),t=this.isLastRowOnPage();if(this.firstRowOnPage!==e){this.firstRowOnPage=e;for(let t of this.allRowGuis)t.rowComp.toggleCss(`data-table-row-first`,e)}if(this.lastRowOnPage!==t){this.lastRowOnPage=t;for(let e of this.allRowGuis)e.rowComp.toggleCss(`data-table-row-last`,t)}}getAllCellCtrls(){return this.leftCellCtrls.list.length===0&&this.rightCellCtrls.list.length===0?this.centerCellCtrls.list:[...this.centerCellCtrls.list,...this.leftCellCtrls.list,...this.rightCellCtrls.list]}postProcessClassesFromGridOptions(){let e=[];if(this.beans.rowStyleSvc?.processClassesFromGridOptions(e,this.rowNode),e.length)for(let t of e)for(let e of this.allRowGuis)e.rowComp.toggleCss(t,!0)}postProcessRowClassRules(){this.beans.rowStyleSvc?.processRowClassRules(this.rowNode,e=>{for(let t of this.allRowGuis)t.rowComp.toggleCss(e,!0)},e=>{for(let t of this.allRowGuis)t.rowComp.toggleCss(e,!1)})}setStylesFromGridOptions(e,t){e&&(this.rowStyles=this.processStylesFromGridOptions()),this.forEachGui(t,e=>e.rowComp.setUserStyles(this.rowStyles))}getPinnedForContainer(e){return e===`left`||e===`right`?e:null}getInitialRowClasses(e){let t=this.getPinnedForContainer(e),n=this.isFullWidth(),{rowNode:r,beans:i}=this,a=[];a.push(`data-table-row`),a.push(this.rowFocused?`data-table-row-focus`:`data-table-row-no-focus`),this.fadeInAnimation[e]&&a.push(`data-table-opacity-zero`),a.push(r.rowIndex%2==0?`data-table-row-even`:`data-table-row-odd`),r.isRowPinned()&&(a.push(`data-table-row-pinned`),i.pinnedRowModel?.isManual()&&a.push(`data-table-row-pinned-manual`)),!r.isRowPinned()&&r.pinnedSibling&&a.push(`data-table-row-pinned-source`),r.isSelected()&&a.push(`data-table-row-selected`),r.footer&&a.push(`data-table-row-footer`),a.push(`data-table-row-level-`+this.rowLevel),r.stub&&a.push(`data-table-row-loading`),n&&a.push(`data-table-full-width-row`),i.expansionSvc?.addExpandedCss(a,r),r.dragging&&a.push(`data-table-row-dragging`);let{rowStyleSvc:o}=i;return o&&(o.processClassesFromGridOptions(a,r),o.preProcessRowClassRules(a,r)),a.push(this.printLayout?`data-table-row-position-relative`:`data-table-row-position-absolute`),this.isFirstRowOnPage()&&a.push(`data-table-row-first`),this.isLastRowOnPage()&&a.push(`data-table-row-last`),n&&(t===`left`&&a.push(`data-table-cell-last-left-pinned`),t===`right`&&a.push(`data-table-cell-first-right-pinned`)),a}processStylesFromGridOptions(){return this.beans.rowStyleSvc?.processStylesFromGridOptions(this.rowNode)??this.emptyStyle}onRowSelected(e){this.beans.selectionSvc?.onRowCtrlSelected(this,e=>{(e===this.centerGui||e===this.fullWidthGui)&&this.announceDescription()},e)}announceDescription(){this.beans.selectionSvc?.announceAriaRowSelection(this.rowNode)}addHoverFunctionality(e){if(!this.active)return;let{element:t,compBean:n}=e,{rowNode:r,beans:i,gos:a}=this;n.addManagedListeners(t,{pointerenter:e=>{e.pointerType===`mouse`&&r.dispatchRowEvent(`mouseEnter`)},pointerleave:e=>{e.pointerType===`mouse`&&r.dispatchRowEvent(`mouseLeave`)}}),n.addManagedListeners(r,{mouseEnter:()=>{!i.dragSvc?.dragging&&!a.get(`suppressRowHoverHighlight`)&&(t.classList.add(`data-table-row-hover`),r.setHovered(!0))},mouseLeave:()=>{this.resetHoveredStatus(t)}})}resetHoveredStatus(e){let t=e?[e]:this.allRowGuis.map(e=>e.element);for(let e of t)e.classList.remove(`data-table-row-hover`);this.rowNode.setHovered(!1)}roundRowTopToBounds(e){let t=this.beans.ctrlsSvc.getScrollFeature().getApproximateVScollPosition(),n=this.applyPaginationOffset(t.top,!0)-100,r=this.applyPaginationOffset(t.bottom,!0)+100;return Math.min(Math.max(n,e),r)}forEachGui(e,t){if(e)t(e);else for(let e of this.allRowGuis)t(e)}isRowRendered(){return this.allRowGuis.length>0}onRowHeightChanged(e){if(this.rowNode.rowHeight==null)return;let t=this.rowNode.rowHeight,n=this.beans.environment.getDefaultRowHeight(),r=s._isGetRowHeightFunction(this.gos)?s._getRowHeightForNode(this.beans,this.rowNode).height:void 0,i=r?`${Math.min(n,r)-2}px`:void 0;this.forEachGui(e,e=>{e.element.style.height=`${t}px`,i&&e.element.style.setProperty(`--data-table-line-height`,i)})}destroyFirstPass(e=!1){this.active=!1;let{rowNode:n}=this;if(!e&&s._isAnimateRows(this.gos)&&!n.sticky)if(n.rowTop!=null){let e=this.roundRowTopToBounds(n.rowTop);this.setRowTop(e)}else for(let e of this.allRowGuis)e.rowComp.toggleCss(`data-table-opacity-zero`,!0);this.fullWidthGui?.element.contains(t._getActiveDomElement(this.beans))&&this.beans.focusSvc.attemptToRecoverFocus(),n.setHovered(!1);let r=this.createRowEvent(`virtualRowRemoved`);this.dispatchLocalEvent(r),this.beans.eventSvc.dispatchEvent(r),super.destroy()}destroySecondPass(){this.allRowGuis.length=0;let e=e=>{for(let t of e.list)t.destroy();return{list:[],map:{}}};this.centerCellCtrls=e(this.centerCellCtrls),this.leftCellCtrls=e(this.leftCellCtrls),this.rightCellCtrls=e(this.rightCellCtrls)}setFocusedClasses(e){this.forEachGui(e,e=>{e.rowComp.toggleCss(`data-table-row-focus`,this.rowFocused),e.rowComp.toggleCss(`data-table-row-no-focus`,!this.rowFocused)})}onCellFocusChanged(){let{focusSvc:e}=this.beans,t=e.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned);t!==this.rowFocused&&(this.rowFocused=t,this.setFocusedClasses())}onPaginationChanged(){let e=this.beans.pagination?.getCurrentPage()??0;this.paginationPage!==e&&(this.paginationPage=e,this.onTopChanged()),this.refreshFirstAndLastRowStyles()}onTopChanged(){this.setRowTop(this.rowNode.rowTop)}onPaginationPixelOffsetChanged(){this.onTopChanged()}applyPaginationOffset(e,t=!1){return this.rowNode.isRowPinned()||this.rowNode.sticky?e:e+this.beans.pageBounds.getPixelOffset()*(t?1:-1)}setRowTop(t){if(!this.printLayout&&e._exists(t)){let e=this.applyPaginationOffset(t),n=`${this.rowNode.isRowPinned()||this.rowNode.sticky?e:this.beans.rowContainerHeight.getRealPixelPosition(e)}px`;this.setRowTopStyle(n)}}getInitialRowTop(e){return this.suppressRowTransform?this.getInitialRowTopShared(e):void 0}getInitialTransform(e){return this.suppressRowTransform?void 0:`translateY(${this.getInitialRowTopShared(e)})`}getInitialRowTopShared(e){if(this.printLayout)return``;let t=this.rowNode,n;if(t.sticky)n=t.stickyRowTop;else{let r=this.slideInAnimation[e]?this.roundRowTopToBounds(t.oldRowTop):t.rowTop,i=this.applyPaginationOffset(r);n=t.isRowPinned()?i:this.beans.rowContainerHeight.getRealPixelPosition(i)}return n+`px`}setRowTopStyle(e){for(let t of this.allRowGuis)this.suppressRowTransform?t.rowComp.setTop(e):t.rowComp.setTransform(`translateY(${e})`)}getCellCtrl(e,t=!1){let n=null;for(let t of this.getAllCellCtrls())t.column==e&&(n=t);if(n!=null||t)return n;for(let t of this.getAllCellCtrls())t?.getColSpanningList().indexOf(e)>=0&&(n=t);return n}onRowIndexChanged(){this.rowNode.rowIndex!=null&&(this.onCellFocusChanged(),this.updateRowIndexes(),this.postProcessCss())}updateRowIndexes(e){let t=this.rowNode.getRowIndexString();if(t===null)return;let r=(this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.beans.filterManager?.getHeaderRowCount()??0),i=this.rowNode.rowIndex%2==0,a=r+this.rowNode.rowIndex+1;this.forEachGui(e,e=>{e.rowComp.setRowIndex(t),e.rowComp.toggleCss(`data-table-row-even`,i),e.rowComp.toggleCss(`data-table-row-odd`,!i),n._setAriaRowIndex(e.element,a)})}};exports.RowCtrl=_;
1
+ const e=require("../../dataTableStack/utils/generic.cjs"),t=require("../../dataTableStack/utils/document.cjs"),n=require("../../dataTableStack/utils/aria.cjs"),r=require("../../dataTableStack/utils/dom.cjs"),i=require("../../context/beanStub.cjs"),a=require("../../dataTableStack/utils/string.cjs"),o=require("../../dataTableStack/utils/function.cjs"),s=require("../../gridOptionsUtils.cjs"),c=require("../../components/framework/userCompUtils.cjs"),l=require("../../dataTableStack/utils/browser.cjs"),u=require("../../dataTableStack/utils/focus.cjs"),d=require("../../utils/gridEvent.cjs"),f=require("../../components/emptyBean.cjs"),p=require("../renderUtils.cjs"),m=require("../cell/cellCtrl.cjs"),h=require("../../styling/rowStyleService.cjs");var g=0,_=class extends i.BeanStub{instanceId;tooltipFeature;rowType;leftGui;centerGui;rightGui;fullWidthGui;allRowGuis=[];firstRowOnPage;lastRowOnPage;active=!0;rowFocused;centerCellCtrls={list:[],map:{}};leftCellCtrls={list:[],map:{}};rightCellCtrls={list:[],map:{}};slideInAnimation={left:!1,center:!1,right:!1,fullWidth:!1};fadeInAnimation={left:!1,center:!1,right:!1,fullWidth:!1};rowDragComps=[];paginationPage;lastMouseDownOnDragger=!1;rowLevel;rowStyles;emptyStyle={};suppressRowTransform;updateColumnListsPending=!1;rowId=null;businessKey=null;businessKeyForNodeFunc;rowEditStyleFeature;rowNode;useAnimationFrameForCreate;printLayout;constructor(e,t,n,r,i){super(),this.rowNode=e,this.useAnimationFrameForCreate=r,this.printLayout=i,this.beans=t,this.gos=t.gos,this.paginationPage=t.pagination?.getCurrentPage()??0,this.suppressRowTransform=this.gos.get(`suppressRowTransform`),this.instanceId=e.id+`-`+ g++,this.rowId=a._escapeString(e.id),this.initRowBusinessKey(),this.rowFocused=t.focusSvc.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned),this.rowLevel=h.calculateRowLevel(this.rowNode),this.setRowType(),this.setAnimateFlags(n),this.rowStyles=this.processStylesFromGridOptions(),this.rowEditStyleFeature=t.editSvc?.createRowStyleFeature(this),this.addListeners()}initRowBusinessKey(){this.businessKeyForNodeFunc=this.gos.get(`getBusinessKeyForNode`),this.updateRowBusinessKey()}updateRowBusinessKey(){if(typeof this.businessKeyForNodeFunc!=`function`)return;let e=this.businessKeyForNodeFunc(this.rowNode);this.businessKey=a._escapeString(e)}updateGui(e,t){e===`left`?this.leftGui=t:e===`right`?this.rightGui=t:e===`fullWidth`?this.fullWidthGui=t:this.centerGui=t}setComp(e,t,n,r){let{context:i,focusSvc:a}=this.beans;r=f.setupCompBean(this,i,r);let o={rowComp:e,element:t,containerType:n,compBean:r};this.allRowGuis.push(o),this.updateGui(n,o),this.initialiseRowComp(o);let s=this.rowNode,c=this.rowType===`FullWidthLoading`||s.stub,l=!s.data&&this.beans.rowModel.getType()===`infinite`;!c&&!l&&!s.rowPinned&&this.beans.rowRenderer.dispatchFirstDataRenderedEvent();let u=this.fullWidthGui?.element;u&&!this.beans.editSvc?.isEditing(this)&&a.isRowFocused(s.rowIndex,s.rowPinned)&&a.shouldTakeFocus()&&setTimeout(()=>u.focus({preventScroll:!0}),0)}unsetComp(e){this.allRowGuis=this.allRowGuis.filter(t=>t.containerType!==e),this.updateGui(e,void 0)}isCacheable(){return this.rowType===`FullWidthDetail`&&this.gos.get(`keepDetailRows`)}setCached(e){let t=e?`none`:``;for(let e of this.allRowGuis)e.element.style.display=t}initialiseRowComp(e){let t=this.gos;this.onSuppressCellFocusChanged(this.beans.gos.get(`suppressCellFocus`)),this.listenOnDomOrder(e),this.onRowHeightChanged(e),this.updateRowIndexes(e),this.setFocusedClasses(e),this.setStylesFromGridOptions(!1,e),s._isRowSelection(t)&&this.rowNode.selectable&&this.onRowSelected(e),this.updateColumnLists(!this.useAnimationFrameForCreate);let r=e.rowComp,i=this.getInitialRowClasses(e.containerType);for(let e of i)r.toggleCss(e,!0);this.executeSlideAndFadeAnimations(e),this.rowNode.group&&n._setAriaExpanded(e.element,this.rowNode.expanded==1),this.setRowCompRowId(r),this.setRowCompRowBusinessKey(r),s._setDomData(t,e.element,p.DOM_DATA_KEY_ROW_CTRL,this),e.compBean.addDestroyFunc(()=>s._setDomData(t,e.element,p.DOM_DATA_KEY_ROW_CTRL,null)),this.useAnimationFrameForCreate?this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this,e),this.rowNode.rowIndex,`p2`,!1):this.addHoverFunctionality(e),this.isFullWidth()&&this.setupFullWidth(e),t.get(`rowDragEntireRow`)&&this.addRowDraggerToRow(e),this.useAnimationFrameForCreate&&this.beans.animationFrameSvc.addDestroyTask(()=>{this.isAlive()&&e.rowComp.toggleCss(`data-table-after-created`,!0)}),this.executeProcessRowPostCreateFunc()}setRowCompRowBusinessKey(e){this.businessKey!=null&&e.setRowBusinessKey(this.businessKey)}setRowCompRowId(e){let t=a._escapeString(this.rowNode.id);this.rowId=t,t!=null&&e.setRowId(t)}executeSlideAndFadeAnimations(e){let{containerType:t}=e;this.slideInAnimation[t]&&(o._batchCall(()=>{this.onTopChanged()}),this.slideInAnimation[t]=!1),this.fadeInAnimation[t]&&(o._batchCall(()=>{e.rowComp.toggleCss(`data-table-opacity-zero`,!1)}),this.fadeInAnimation[t]=!1)}addRowDraggerToRow(e){let t=this.beans.rowDragSvc?.createRowDragCompForRow(this.rowNode,e.element);if(!t)return;let n=this.createBean(t,this.beans.context);this.rowDragComps.push(n),e.compBean.addDestroyFunc(()=>{this.rowDragComps=this.rowDragComps.filter(e=>e!==n),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,this.beans.context),this.destroyBean(n,this.beans.context)})}setupFullWidth(e){let t=this.getPinnedForContainer(e.containerType),n=this.createFullWidthCompDetails(e.element,t);e.rowComp.showFullWidth(n)}getFullWidthCellRenderers(){return this.gos.get(`embedFullWidthRows`)?this.allRowGuis.map(e=>e?.rowComp?.getFullWidthCellRenderer()):[this.fullWidthGui?.rowComp?.getFullWidthCellRenderer()]}executeProcessRowPostCreateFunc(){let e=this.gos.getCallback(`processRowPostCreate`);!e||!this.areAllContainersReady()||e({eRow:this.centerGui.element,ePinnedLeftRow:this.leftGui?this.leftGui.element:void 0,ePinnedRightRow:this.rightGui?this.rightGui.element:void 0,node:this.rowNode,rowIndex:this.rowNode.rowIndex,addRenderedRowListener:this.addEventListener.bind(this)})}areAllContainersReady(){let{leftGui:e,centerGui:t,rightGui:n,beans:{visibleCols:r}}=this,i=!!e||!r.isPinningLeft(),a=!!t,o=!!n||!r.isPinningRight();return i&&a&&o}isNodeFullWidthCell(){if(this.rowNode.detail)return!0;let e=this.beans.gos.getCallback(`isFullWidthRow`);return e?e({rowNode:this.rowNode}):!1}setRowType(){let{rowNode:e,gos:t,beans:{colModel:n}}=this,r=e.stub&&!e.__wasEvicted&&!t.get(`suppressServerSideFullWidthLoadingRow`)&&!t.get(`groupHideOpenParents`),i=!!e.failedLoad&&!t.get(`groupHideOpenParents`),a=this.isNodeFullWidthCell(),o=t.get(`masterDetail`)&&e.detail,c=s._isFullWidthGroupRow(t,e,n.isPivotMode());r||i?this.rowType=`FullWidthLoading`:o?this.rowType=`FullWidthDetail`:a?this.rowType=`FullWidth`:c?this.rowType=`FullWidthGroup`:this.rowType=`Normal`}isFirstLoadingRowInRun(){let{rowNode:e,beans:t,gos:n}=this,r=!!e.failedLoad;if(!(r?n.get(`collapseFailedRows`):n.get(`collapseLoadingRows`)))return!0;let i=e.rowIndex;if(i==null)return!0;let{rowModel:a}=t,o=e=>!!e&&(!!e.stub||!!e.failedLoad)&&!!e.failedLoad===r,s=i;for(;s>0&&o(a.getRow(s-1));)s--;let c=i,l=a.getRowCount();for(;c<l-1&&o(a.getRow(c+1));)c++;let u=s>0?a.getRow(s-1):void 0,d=!!u&&!u.stub&&!u.failedLoad,f=c<l-1?a.getRow(c+1):void 0,p=!!f&&!f.stub&&!f.failedLoad;return r&&p?!0:i===(!d&&p?c:s)}updateColumnLists(e=!1,t=!1){if(this.isFullWidth())return;let{animationFrameSvc:n}=this.beans;if(!n?.active||e||this.printLayout){this.updateColumnListsImpl(t);return}this.updateColumnListsPending||=(n.createTask(()=>{this.active&&this.updateColumnListsImpl(!0)},this.rowNode.rowIndex,`p1`,!1),!0)}getNewCellCtrl(e){if(!this.beans.rowSpanSvc?.isCellSpanning(e,this.rowNode))return new m.CellCtrl(e,this.rowNode,this.beans,this)}isCorrectCtrlForSpan(e){return!this.beans.rowSpanSvc?.isCellSpanning(e.column,this.rowNode)}createCellCtrls(e,t,n=null){let r={list:[],map:{}},i=(e,t,n)=>{n==null?r.list.push(t):r.list.splice(n,0,t),r.map[e]=t},a=[];for(let n of t){let t=n.getInstanceId(),r=e.map[t];r&&!this.isCorrectCtrlForSpan(r)&&(r.destroy(),r=void 0),r||=this.getNewCellCtrl(n),r&&i(t,r)}for(let t of e.list){let e=t.column.getInstanceId();r.map[e]??(this.isCellEligibleToBeRemoved(t,n)?t.destroy():a.push([e,t]))}if(a.length)for(let[e,t]of a){let n=r.list.findIndex(e=>e.column.getLeft()>t.column.getLeft());i(e,t,n===-1?void 0:Math.max(n-1,0))}let{focusSvc:o,visibleCols:s}=this.beans,c=o.getFocusedCell();if(c&&c.column.getPinned()==n){let e=c.column.getInstanceId();if(!r.map[e]&&s.allCols.includes(c.column)){let t=this.createFocusedCellCtrl();if(t){let n=r.list.findIndex(e=>e.column.getLeft()>t.column.getLeft());i(e,t,n===-1?void 0:Math.max(n-1,0))}}}return r}createFocusedCellCtrl(){let{focusSvc:e,rowSpanSvc:t}=this.beans,n=e.getFocusedCell();if(!n)return;let r=t?.getCellSpan(n.column,this.rowNode);if(r){if(r.firstNode!==this.rowNode||!r.doesSpanContain(n))return}else if(!e.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))return;return this.getNewCellCtrl(n.column)}updateColumnListsImpl(e){this.updateColumnListsPending=!1,this.createAllCellCtrls(),this.setCellCtrls(e)}setCellCtrls(e){for(let t of this.allRowGuis){let n=this.getCellCtrlsForContainer(t.containerType);t.rowComp.setCellCtrls(n,e)}}getCellCtrlsForContainer(e){switch(e){case`left`:return this.leftCellCtrls.list;case`right`:return this.rightCellCtrls.list;case`fullWidth`:return[];case`center`:return this.centerCellCtrls.list}}createAllCellCtrls(){let e=this.beans.colViewport,t=this.beans.visibleCols;if(this.printLayout)this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,t.allCols),this.leftCellCtrls={list:[],map:{}},this.rightCellCtrls={list:[],map:{}};else{let n=e.getColsWithinViewport(this.rowNode);this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,n);let r=t.getLeftColsForRow(this.rowNode);this.leftCellCtrls=this.createCellCtrls(this.leftCellCtrls,r,`left`);let i=t.getRightColsForRow(this.rowNode);this.rightCellCtrls=this.createCellCtrls(this.rightCellCtrls,i,`right`)}}isCellEligibleToBeRemoved(e,t){let{column:n}=e;if(n.getPinned()!=t||!this.isCorrectCtrlForSpan(e))return!0;let{visibleCols:r,editSvc:i}=this.beans,a=i?.isEditing(e),o=e.isCellFocused();return a||o?!(r.allCols.indexOf(n)>=0):!0}getDomOrder(){return this.gos.get(`ensureDomOrder`)||s._isDomLayout(this.gos,`print`)}listenOnDomOrder(e){e.compBean.addManagedPropertyListeners([`domLayout`,`ensureDomOrder`],()=>{e.rowComp.setDomOrder(this.getDomOrder())})}setAnimateFlags(t){if(this.rowNode.sticky||!t)return;let n=e._exists(this.rowNode.oldRowTop),{visibleCols:r}=this.beans,i=r.isPinningLeft(),a=r.isPinningRight();if(n){let{slideInAnimation:e}=this;if(this.isFullWidth()&&!this.gos.get(`embedFullWidthRows`)){e.fullWidth=!0;return}e.center=!0,e.left=i,e.right=a}else{let{fadeInAnimation:e}=this;if(this.isFullWidth()&&!this.gos.get(`embedFullWidthRows`)){e.fullWidth=!0;return}e.center=!0,e.left=i,e.right=a}}isFullWidth(){return this.rowType!==`Normal`}refreshFullWidth(){let e=(e,t)=>e?e.rowComp.refreshFullWidth(()=>this.createFullWidthCompDetails(e.element,t).params):!0,t=e(this.fullWidthGui,null),n=e(this.centerGui,null),r=e(this.leftGui,`left`),i=e(this.rightGui,`right`);return t&&n&&r&&i}addListeners(){let{beans:e,gos:t,rowNode:n}=this,{expansionSvc:r,eventSvc:i,context:a,rowSpanSvc:o}=e;this.addManagedListeners(this.rowNode,{heightChanged:()=>this.onRowHeightChanged(),rowSelected:()=>this.onRowSelected(),rowIndexChanged:this.onRowIndexChanged.bind(this),topChanged:this.onTopChanged.bind(this),...r?.getRowExpandedListeners(this)??{}}),n.detail&&this.addManagedListeners(n.parent,{dataChanged:this.onRowNodeDataChanged.bind(this)}),this.addManagedListeners(n,{dataChanged:this.onRowNodeDataChanged.bind(this),cellChanged:this.postProcessCss.bind(this),rowHighlightChanged:this.onRowNodeHighlightChanged.bind(this),draggingChanged:this.postProcessRowDragging.bind(this),uiLevelChanged:this.onUiLevelChanged.bind(this),rowPinned:this.onRowPinned.bind(this)}),this.addManagedListeners(i,{paginationPixelOffsetChanged:this.onPaginationPixelOffsetChanged.bind(this),heightScaleChanged:this.onTopChanged.bind(this),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),virtualColumnsChanged:this.onVirtualColumnsChanged.bind(this),cellFocused:this.onCellFocusChanged.bind(this),cellFocusCleared:this.onCellFocusChanged.bind(this),paginationChanged:this.onPaginationChanged.bind(this),modelUpdated:this.refreshFirstAndLastRowStyles.bind(this),columnMoved:()=>this.updateColumnLists()}),o&&this.addManagedListeners(o,{spannedCellsUpdated:({pinned:e})=>{e&&!n.rowPinned||this.updateColumnLists()}}),this.addDestroyFunc(()=>{this.rowDragComps=this.destroyBeans(this.rowDragComps,a),this.tooltipFeature=this.destroyBean(this.tooltipFeature,a),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,a)}),this.addManagedPropertyListeners([`rowStyle`,`getRowStyle`,`rowClass`,`getRowClass`,`rowClassRules`],this.postProcessCss.bind(this)),this.addManagedPropertyListener(`rowDragEntireRow`,()=>{if(t.get(`rowDragEntireRow`)){for(let e of this.allRowGuis)this.addRowDraggerToRow(e);return}this.rowDragComps=this.destroyBeans(this.rowDragComps,a)}),this.addListenersForCellComps()}addListenersForCellComps(){this.addManagedListeners(this.rowNode,{rowIndexChanged:()=>{for(let e of this.getAllCellCtrls())e.onRowIndexChanged()},cellChanged:e=>{for(let t of this.getAllCellCtrls())t.onCellChanged(e)}})}onRowPinned(){for(let e of this.allRowGuis)e.rowComp.toggleCss(`data-table-row-pinned-source`,!!this.rowNode.pinnedSibling)}onRowNodeDataChanged(e){this.refreshRow({suppressFlash:!e.update,newData:!e.update})}refreshRow(e){if(this.isFullWidth()!==!!this.isNodeFullWidthCell()){this.beans.rowRenderer.redrawRow(this.rowNode);return}if(this.isFullWidth()){this.refreshFullWidth()||this.beans.rowRenderer.redrawRow(this.rowNode);return}for(let t of this.getAllCellCtrls())t.refreshCell(e);for(let e of this.allRowGuis)this.setRowCompRowId(e.rowComp),this.updateRowBusinessKey(),this.setRowCompRowBusinessKey(e.rowComp);this.onRowSelected(),this.postProcessCss()}postProcessCss(){this.setStylesFromGridOptions(!0),this.postProcessClassesFromGridOptions(),this.postProcessRowClassRules(),this.rowEditStyleFeature?.applyRowStyles(),this.postProcessRowDragging()}onRowNodeHighlightChanged(){let e=this.beans.rowDropHighlightSvc,t=e?.row===this.rowNode?e.position:`none`,n=t===`above`,r=t===`inside`,i=t===`below`,a=t!==`none`,o=n||i,s=this.rowNode.uiLevel,c=o&&s>0,l=c?s.toString():`0`;for(let e of this.allRowGuis){let t=e.rowComp;t.toggleCss(`data-table-row-highlight-above`,n),t.toggleCss(`data-table-row-highlight-inside`,r),t.toggleCss(`data-table-row-highlight-below`,i),t.toggleCss(`data-table-row-highlight-indent`,c),a?e.element.style.setProperty(`--data-table-row-highlight-level`,l):e.element.style.removeProperty(`--data-table-row-highlight-level`)}}postProcessRowDragging(){let e=this.rowNode.dragging;for(let t of this.allRowGuis)t.rowComp.toggleCss(`data-table-row-dragging`,e)}onDisplayedColumnsChanged(){this.updateColumnLists(!0),this.beans.rowAutoHeight?.requestCheckAutoHeight()}onVirtualColumnsChanged(){this.updateColumnLists(!1,!0)}getRowPosition(){return{rowPinned:e._makeNull(this.rowNode.rowPinned),rowIndex:this.rowNode.rowIndex}}onKeyboardNavigate(e){let t=this.findFullWidthInfoForEvent(e);if(!t)return;let{rowGui:n,column:r}=t;if(n.element!==e.target)return;let i=this.rowNode,{focusSvc:a,navigation:o}=this.beans,s=a.getFocusedCell(),c={rowIndex:i.rowIndex,rowPinned:i.rowPinned,column:s?.column??r};o?.navigateToNextCell(e,e.key,c,!0),e.preventDefault()}onTabKeyDown(e){if(e.defaultPrevented||d._isStopPropagationForDataTable(e))return;let n=this.allRowGuis.find(t=>t.element.contains(e.target)),r=n?n.element:null,i=r===e.target,a=t._getActiveDomElement(this.beans),o=!1;r&&a&&(o=r.contains(a)&&a.classList.contains(`data-table-cell`));let s=null;!i&&!o&&(s=u._findNextFocusableElement(this.beans,r,!1,e.shiftKey)),(this.isFullWidth()&&i||!s)&&this.beans.navigation?.onTabKeyDown(this,e)}getFullWidthElement(){return this.fullWidthGui?this.fullWidthGui.element:null}getRowYPosition(){let e=this.allRowGuis.find(e=>r._isVisible(e.element))?.element;return e?e.getBoundingClientRect().top:0}onSuppressCellFocusChanged(e){let t=this.isFullWidth()&&e?void 0:this.gos.get(`tabIndex`);for(let e of this.allRowGuis)r._addOrRemoveAttribute(e.element,`tabindex`,t)}onFullWidthRowFocused(e){let t=this.rowNode,n=e?this.isFullWidth()&&e.rowIndex===t.rowIndex&&e.rowPinned==t.rowPinned:!1,r;if(this.fullWidthGui)r=this.fullWidthGui.element;else{let t=this.beans.colModel.getCol(e?.column)?.pinned;r=t?t===`right`?this.rightGui?.element:this.leftGui?.element:this.centerGui?.element}r&&(r.classList.toggle(`data-table-full-width-focus`,n),n&&e?.forceBrowserFocus&&r.focus({preventScroll:!0}))}recreateCell(e){this.centerCellCtrls=this.removeCellCtrl(this.centerCellCtrls,e),this.leftCellCtrls=this.removeCellCtrl(this.leftCellCtrls,e),this.rightCellCtrls=this.removeCellCtrl(this.rightCellCtrls,e),e.destroy(),this.updateColumnLists()}removeCellCtrl(e,t){let n={list:[],map:{}};for(let r of e.list)r!==t&&(n.list.push(r),n.map[r.column.getInstanceId()]=r);return n}onMouseEvent(e,t){switch(e){case`dblclick`:this.onRowDblClick(t);break;case`click`:this.onRowClick(t);break;case`touchstart`:case`mousedown`:this.onRowMouseDown(t);break}}createRowEvent(e,t){let{rowNode:n}=this;return s._addGridCommonParams(this.gos,{type:e,node:n,data:n.data,rowIndex:n.rowIndex,rowPinned:n.rowPinned,event:t})}createRowEventWithSource(e,t){let n=this.createRowEvent(e,t);return n.source=this,n}onRowDblClick(e){if(d._isStopPropagationForDataTable(e))return;let t=this.createRowEventWithSource(`rowDoubleClicked`,e);t.isEventHandlingSuppressed=this.isSuppressMouseEvent(e),this.beans.eventSvc.dispatchEvent(t)}findFullWidthInfoForEvent(e){if(!e)return;let t=this.findFullWidthRowGui(e.target),n=this.getColumnForFullWidth(t);if(!(!t||!n))return{rowGui:t,column:n}}findFullWidthRowGui(e){return this.allRowGuis.find(t=>t.element.contains(e))}getColumnForFullWidth(e){let{visibleCols:t}=this.beans;switch(e?.containerType){case`center`:return t.centerCols[0];case`left`:return t.leftCols[0];case`right`:return t.rightCols[0];default:return t.allCols[0]}}onRowMouseDown(e){if(this.lastMouseDownOnDragger=r._isElementChildOfClass(e.target,`data-table-row-drag`,3),!this.isFullWidth()||this.isSuppressMouseEvent(e))return;let{rangeSvc:t,focusSvc:n}=this.beans;t?.removeAllCellRanges();let i=this.findFullWidthInfoForEvent(e);if(!i)return;let{rowGui:a,column:o}=i,s=a.element,c=e.target,u=this.rowNode,d=e.defaultPrevented||l._isBrowserSafari();s&&s.contains(c)&&r._isFocusableFormField(c)&&(d=!1),n.setFocusedCell({rowIndex:u.rowIndex,column:o,rowPinned:u.rowPinned,forceBrowserFocus:d})}isSuppressMouseEvent(e){let{gos:t,rowNode:n}=this;if(this.isFullWidth())return p._suppressFullWidthMouseEvent(t,this.findFullWidthRowGui(e.target)?.rowComp.getFullWidthCellRendererParams(),n,e);let r=p._getCellCtrlForEventTarget(t,e.target);return r!=null&&p._suppressCellMouseEvent(t,r.column,n,e)}onRowClick(e){if(d._isStopPropagationForDataTable(e)||this.lastMouseDownOnDragger)return;let t=this.isSuppressMouseEvent(e),{eventSvc:n,selectionSvc:r}=this.beans,i=this.createRowEventWithSource(`rowClicked`,e);i.isEventHandlingSuppressed=t,n.dispatchEvent(i),!t&&r?.handleSelectionEvent(e,this.rowNode,`rowClicked`)}setupDetailRowAutoHeight(e){this.rowType===`FullWidthDetail`&&this.beans.masterDetailSvc?.setupDetailRowAutoHeight(this,e)}createFullWidthCompDetails(e,t){let{gos:n,rowNode:r}=this,i=s._addGridCommonParams(n,{fullWidth:!0,data:r.data,node:r,value:r.key,valueFormatted:r.key,eGridCell:e,eParentOfValue:e,pinned:t,addRenderedRowListener:this.addEventListener.bind(this),registerRowDragger:(e,t,n,r)=>this.addFullWidthRowDragging(e,t,n,r),setTooltip:(e,t)=>{n.assertModuleRegistered(`Tooltip`,3),this.setupFullWidthRowTooltip(e,t)}}),a=this.beans.userCompFactory;switch(this.rowType){case`FullWidthDetail`:return c._getFullWidthDetailCellRendererDetails(a,i);case`FullWidthGroup`:{let{value:e,valueFormatted:t}=this.beans.valueSvc.getValueForDisplay({node:this.rowNode,includeValueFormatted:!0});return i.value=e,i.valueFormatted=t,c._getFullWidthGroupCellRendererDetails(a,i)}case`FullWidthLoading`:return i.isFirstLoadingRow=this.isFirstLoadingRowInRun(),r.failedLoad?c._getFullWidthErrorCellRendererDetails(a,i):c._getFullWidthLoadingCellRendererDetails(a,i);default:return c._getFullWidthCellRendererDetails(a,i)}}setupFullWidthRowTooltip(e,t){this.fullWidthGui&&(this.tooltipFeature=this.beans.tooltipSvc?.setupFullWidthRowTooltip(this.tooltipFeature,this,e,t))}addFullWidthRowDragging(e,t,n=``,r){let{rowDragSvc:i,context:a}=this.beans;if(!i||!this.isFullWidth())return;let o=i.createRowDragComp(()=>n,this.rowNode,void 0,e,t,r);this.createBean(o,a),this.addDestroyFunc(()=>{this.destroyBean(o,a)})}onUiLevelChanged(){let e=h.calculateRowLevel(this.rowNode);if(this.rowLevel!=e){let t=`data-table-row-level-`+e,n=`data-table-row-level-`+this.rowLevel;for(let e of this.allRowGuis)e.rowComp.toggleCss(t,!0),e.rowComp.toggleCss(n,!1)}this.rowLevel=e}isFirstRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getFirstRow()}isLastRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getLastRow()}refreshFirstAndLastRowStyles(){let e=this.isFirstRowOnPage(),t=this.isLastRowOnPage();if(this.firstRowOnPage!==e){this.firstRowOnPage=e;for(let t of this.allRowGuis)t.rowComp.toggleCss(`data-table-row-first`,e)}if(this.lastRowOnPage!==t){this.lastRowOnPage=t;for(let e of this.allRowGuis)e.rowComp.toggleCss(`data-table-row-last`,t)}}getAllCellCtrls(){return this.leftCellCtrls.list.length===0&&this.rightCellCtrls.list.length===0?this.centerCellCtrls.list:[...this.centerCellCtrls.list,...this.leftCellCtrls.list,...this.rightCellCtrls.list]}postProcessClassesFromGridOptions(){let e=[];if(this.beans.rowStyleSvc?.processClassesFromGridOptions(e,this.rowNode),e.length)for(let t of e)for(let e of this.allRowGuis)e.rowComp.toggleCss(t,!0)}postProcessRowClassRules(){this.beans.rowStyleSvc?.processRowClassRules(this.rowNode,e=>{for(let t of this.allRowGuis)t.rowComp.toggleCss(e,!0)},e=>{for(let t of this.allRowGuis)t.rowComp.toggleCss(e,!1)})}setStylesFromGridOptions(e,t){e&&(this.rowStyles=this.processStylesFromGridOptions()),this.forEachGui(t,e=>e.rowComp.setUserStyles(this.rowStyles))}getPinnedForContainer(e){return e===`left`||e===`right`?e:null}getInitialRowClasses(e){let t=this.getPinnedForContainer(e),n=this.isFullWidth(),{rowNode:r,beans:i}=this,a=[];a.push(`data-table-row`),a.push(this.rowFocused?`data-table-row-focus`:`data-table-row-no-focus`),this.fadeInAnimation[e]&&a.push(`data-table-opacity-zero`),a.push(r.rowIndex%2==0?`data-table-row-even`:`data-table-row-odd`),r.isRowPinned()&&(a.push(`data-table-row-pinned`),i.pinnedRowModel?.isManual()&&a.push(`data-table-row-pinned-manual`)),!r.isRowPinned()&&r.pinnedSibling&&a.push(`data-table-row-pinned-source`),r.isSelected()&&a.push(`data-table-row-selected`),r.footer&&a.push(`data-table-row-footer`),a.push(`data-table-row-level-`+this.rowLevel),r.stub&&a.push(`data-table-row-loading`),n&&a.push(`data-table-full-width-row`),i.expansionSvc?.addExpandedCss(a,r),r.dragging&&a.push(`data-table-row-dragging`);let{rowStyleSvc:o}=i;return o&&(o.processClassesFromGridOptions(a,r),o.preProcessRowClassRules(a,r)),a.push(this.printLayout?`data-table-row-position-relative`:`data-table-row-position-absolute`),this.isFirstRowOnPage()&&a.push(`data-table-row-first`),this.isLastRowOnPage()&&a.push(`data-table-row-last`),n&&(t===`left`&&a.push(`data-table-cell-last-left-pinned`),t===`right`&&a.push(`data-table-cell-first-right-pinned`)),a}processStylesFromGridOptions(){return this.beans.rowStyleSvc?.processStylesFromGridOptions(this.rowNode)??this.emptyStyle}onRowSelected(e){this.beans.selectionSvc?.onRowCtrlSelected(this,e=>{(e===this.centerGui||e===this.fullWidthGui)&&this.announceDescription()},e)}announceDescription(){this.beans.selectionSvc?.announceAriaRowSelection(this.rowNode)}addHoverFunctionality(e){if(!this.active)return;let{element:t,compBean:n}=e,{rowNode:r,beans:i,gos:a}=this;n.addManagedListeners(t,{pointerenter:e=>{e.pointerType===`mouse`&&r.dispatchRowEvent(`mouseEnter`)},pointerleave:e=>{e.pointerType===`mouse`&&r.dispatchRowEvent(`mouseLeave`)}}),n.addManagedListeners(r,{mouseEnter:()=>{!i.dragSvc?.dragging&&!a.get(`suppressRowHoverHighlight`)&&(t.classList.add(`data-table-row-hover`),r.setHovered(!0))},mouseLeave:()=>{this.resetHoveredStatus(t)}})}resetHoveredStatus(e){let t=e?[e]:this.allRowGuis.map(e=>e.element);for(let e of t)e.classList.remove(`data-table-row-hover`);this.rowNode.setHovered(!1)}roundRowTopToBounds(e){let t=this.beans.ctrlsSvc.getScrollFeature().getApproximateVScollPosition(),n=this.applyPaginationOffset(t.top,!0)-100,r=this.applyPaginationOffset(t.bottom,!0)+100;return Math.min(Math.max(n,e),r)}forEachGui(e,t){if(e)t(e);else for(let e of this.allRowGuis)t(e)}isRowRendered(){return this.allRowGuis.length>0}onRowHeightChanged(e){if(this.rowNode.rowHeight==null)return;let t=this.rowNode.rowHeight,n=this.beans.environment.getDefaultRowHeight(),r=s._isGetRowHeightFunction(this.gos)?s._getRowHeightForNode(this.beans,this.rowNode).height:void 0,i=r?`${Math.min(n,r)-2}px`:void 0;this.forEachGui(e,e=>{e.element.style.height=`${t}px`,i&&e.element.style.setProperty(`--data-table-line-height`,i)})}destroyFirstPass(e=!1){this.active=!1;let{rowNode:n}=this;if(!e&&s._isAnimateRows(this.gos)&&!n.sticky)if(n.rowTop!=null){let e=this.roundRowTopToBounds(n.rowTop);this.setRowTop(e)}else for(let e of this.allRowGuis)e.rowComp.toggleCss(`data-table-opacity-zero`,!0);this.fullWidthGui?.element.contains(t._getActiveDomElement(this.beans))&&this.beans.focusSvc.attemptToRecoverFocus(),n.setHovered(!1);let r=this.createRowEvent(`virtualRowRemoved`);this.dispatchLocalEvent(r),this.beans.eventSvc.dispatchEvent(r),super.destroy()}destroySecondPass(){this.allRowGuis.length=0;let e=e=>{for(let t of e.list)t.destroy();return{list:[],map:{}}};this.centerCellCtrls=e(this.centerCellCtrls),this.leftCellCtrls=e(this.leftCellCtrls),this.rightCellCtrls=e(this.rightCellCtrls)}setFocusedClasses(e){this.forEachGui(e,e=>{e.rowComp.toggleCss(`data-table-row-focus`,this.rowFocused),e.rowComp.toggleCss(`data-table-row-no-focus`,!this.rowFocused)})}onCellFocusChanged(){let{focusSvc:e}=this.beans,t=e.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned);t!==this.rowFocused&&(this.rowFocused=t,this.setFocusedClasses())}onPaginationChanged(){let e=this.beans.pagination?.getCurrentPage()??0;this.paginationPage!==e&&(this.paginationPage=e,this.onTopChanged()),this.refreshFirstAndLastRowStyles()}onTopChanged(){this.setRowTop(this.rowNode.rowTop)}onPaginationPixelOffsetChanged(){this.onTopChanged()}applyPaginationOffset(e,t=!1){return this.rowNode.isRowPinned()||this.rowNode.sticky?e:e+this.beans.pageBounds.getPixelOffset()*(t?1:-1)}setRowTop(t){if(!this.printLayout&&e._exists(t)){let e=this.applyPaginationOffset(t),n=`${this.rowNode.isRowPinned()||this.rowNode.sticky?e:this.beans.rowContainerHeight.getRealPixelPosition(e)}px`;this.setRowTopStyle(n)}}getInitialRowTop(e){return this.suppressRowTransform?this.getInitialRowTopShared(e):void 0}getInitialTransform(e){return this.suppressRowTransform?void 0:`translateY(${this.getInitialRowTopShared(e)})`}getInitialRowTopShared(e){if(this.printLayout)return``;let t=this.rowNode,n;if(t.sticky)n=t.stickyRowTop;else{let r=this.slideInAnimation[e]?this.roundRowTopToBounds(t.oldRowTop):t.rowTop,i=this.applyPaginationOffset(r);n=t.isRowPinned()?i:this.beans.rowContainerHeight.getRealPixelPosition(i)}return n+`px`}setRowTopStyle(e){for(let t of this.allRowGuis)this.suppressRowTransform?t.rowComp.setTop(e):t.rowComp.setTransform(`translateY(${e})`)}getCellCtrl(e,t=!1){let n=null;for(let t of this.getAllCellCtrls())t.column==e&&(n=t);if(n!=null||t)return n;for(let t of this.getAllCellCtrls())t?.getColSpanningList().indexOf(e)>=0&&(n=t);return n}onRowIndexChanged(){this.rowNode.rowIndex!=null&&(this.onCellFocusChanged(),this.updateRowIndexes(),this.postProcessCss())}updateRowIndexes(e){let t=this.rowNode.getRowIndexString();if(t===null)return;let r=(this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.beans.filterManager?.getHeaderRowCount()??0),i=this.rowNode.rowIndex%2==0,a=r+this.rowNode.rowIndex+1;this.forEachGui(e,e=>{e.rowComp.setRowIndex(t),e.rowComp.toggleCss(`data-table-row-even`,i),e.rowComp.toggleCss(`data-table-row-odd`,!i),n._setAriaRowIndex(e.element,a)})}};exports.RowCtrl=_;
@@ -90,6 +90,7 @@ export declare class RowCtrl extends BeanStub<RowCtrlEvent> {
90
90
  private areAllContainersReady;
91
91
  private isNodeFullWidthCell;
92
92
  private setRowType;
93
+ private isFirstLoadingRowInRun;
93
94
  private updateColumnLists;
94
95
  /**
95
96
  * Overridden by SpannedRowCtrl
@@ -90,6 +90,7 @@ export declare class RowCtrl extends BeanStub<RowCtrlEvent> {
90
90
  private areAllContainersReady;
91
91
  private isNodeFullWidthCell;
92
92
  private setRowType;
93
+ private isFirstLoadingRowInRun;
93
94
  private updateColumnLists;
94
95
  /**
95
96
  * Overridden by SpannedRowCtrl
@@ -6,16 +6,16 @@ import { BeanStub as l } from "../../context/beanStub.js";
6
6
  import { _escapeString as u } from "../../dataTableStack/utils/string.js";
7
7
  import { _batchCall as d } from "../../dataTableStack/utils/function.js";
8
8
  import { _addGridCommonParams as f, _getRowHeightForNode as p, _isAnimateRows as m, _isDomLayout as h, _isFullWidthGroupRow as g, _isGetRowHeightFunction as _, _isRowSelection as v, _setDomData as y } from "../../gridOptionsUtils.js";
9
- import { _getFullWidthCellRendererDetails as b, _getFullWidthDetailCellRendererDetails as x, _getFullWidthGroupCellRendererDetails as S, _getFullWidthLoadingCellRendererDetails as C } from "../../components/framework/userCompUtils.js";
10
- import { _isBrowserSafari as w } from "../../dataTableStack/utils/browser.js";
11
- import { _findNextFocusableElement as T } from "../../dataTableStack/utils/focus.js";
12
- import { _isStopPropagationForDataTable as E } from "../../utils/gridEvent.js";
13
- import { setupCompBean as D } from "../../components/emptyBean.js";
14
- import { DOM_DATA_KEY_ROW_CTRL as O, _getCellCtrlForEventTarget as k, _suppressCellMouseEvent as A, _suppressFullWidthMouseEvent as j } from "../renderUtils.js";
15
- import { CellCtrl as M } from "../cell/cellCtrl.js";
16
- import { calculateRowLevel as N } from "../../styling/rowStyleService.js";
9
+ import { _getFullWidthCellRendererDetails as b, _getFullWidthDetailCellRendererDetails as x, _getFullWidthErrorCellRendererDetails as S, _getFullWidthGroupCellRendererDetails as C, _getFullWidthLoadingCellRendererDetails as w } from "../../components/framework/userCompUtils.js";
10
+ import { _isBrowserSafari as T } from "../../dataTableStack/utils/browser.js";
11
+ import { _findNextFocusableElement as E } from "../../dataTableStack/utils/focus.js";
12
+ import { _isStopPropagationForDataTable as D } from "../../utils/gridEvent.js";
13
+ import { setupCompBean as O } from "../../components/emptyBean.js";
14
+ import { DOM_DATA_KEY_ROW_CTRL as k, _getCellCtrlForEventTarget as A, _suppressCellMouseEvent as j, _suppressFullWidthMouseEvent as M } from "../renderUtils.js";
15
+ import { CellCtrl as N } from "../cell/cellCtrl.js";
16
+ import { calculateRowLevel as P } from "../../styling/rowStyleService.js";
17
17
  //#region src/community/rendering/row/rowCtrl.ts
18
- var P = 0, F = class extends l {
18
+ var F = 0, I = class extends l {
19
19
  instanceId;
20
20
  tooltipFeature;
21
21
  rowType;
@@ -68,7 +68,7 @@ var P = 0, F = class extends l {
68
68
  useAnimationFrameForCreate;
69
69
  printLayout;
70
70
  constructor(e, t, n, r, i) {
71
- super(), this.rowNode = e, this.useAnimationFrameForCreate = r, this.printLayout = i, this.beans = t, this.gos = t.gos, this.paginationPage = t.pagination?.getCurrentPage() ?? 0, this.suppressRowTransform = this.gos.get("suppressRowTransform"), this.instanceId = e.id + "-" + P++, this.rowId = u(e.id), this.initRowBusinessKey(), this.rowFocused = t.focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned), this.rowLevel = N(this.rowNode), this.setRowType(), this.setAnimateFlags(n), this.rowStyles = this.processStylesFromGridOptions(), this.rowEditStyleFeature = t.editSvc?.createRowStyleFeature(this), this.addListeners();
71
+ super(), this.rowNode = e, this.useAnimationFrameForCreate = r, this.printLayout = i, this.beans = t, this.gos = t.gos, this.paginationPage = t.pagination?.getCurrentPage() ?? 0, this.suppressRowTransform = this.gos.get("suppressRowTransform"), this.instanceId = e.id + "-" + F++, this.rowId = u(e.id), this.initRowBusinessKey(), this.rowFocused = t.focusSvc.isRowFocused(this.rowNode.rowIndex, this.rowNode.rowPinned), this.rowLevel = P(this.rowNode), this.setRowType(), this.setAnimateFlags(n), this.rowStyles = this.processStylesFromGridOptions(), this.rowEditStyleFeature = t.editSvc?.createRowStyleFeature(this), this.addListeners();
72
72
  }
73
73
  initRowBusinessKey() {
74
74
  this.businessKeyForNodeFunc = this.gos.get("getBusinessKeyForNode"), this.updateRowBusinessKey();
@@ -83,7 +83,7 @@ var P = 0, F = class extends l {
83
83
  }
84
84
  setComp(e, t, n, r) {
85
85
  let { context: i, focusSvc: a } = this.beans;
86
- r = D(this, i, r);
86
+ r = O(this, i, r);
87
87
  let o = {
88
88
  rowComp: e,
89
89
  element: t,
@@ -111,7 +111,7 @@ var P = 0, F = class extends l {
111
111
  this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")), this.listenOnDomOrder(e), this.onRowHeightChanged(e), this.updateRowIndexes(e), this.setFocusedClasses(e), this.setStylesFromGridOptions(!1, e), v(t) && this.rowNode.selectable && this.onRowSelected(e), this.updateColumnLists(!this.useAnimationFrameForCreate);
112
112
  let n = e.rowComp, i = this.getInitialRowClasses(e.containerType);
113
113
  for (let e of i) n.toggleCss(e, !0);
114
- this.executeSlideAndFadeAnimations(e), this.rowNode.group && r(e.element, this.rowNode.expanded == 1), this.setRowCompRowId(n), this.setRowCompRowBusinessKey(n), y(t, e.element, O, this), e.compBean.addDestroyFunc(() => y(t, e.element, O, null)), this.useAnimationFrameForCreate ? this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this, e), this.rowNode.rowIndex, "p2", !1) : this.addHoverFunctionality(e), this.isFullWidth() && this.setupFullWidth(e), t.get("rowDragEntireRow") && this.addRowDraggerToRow(e), this.useAnimationFrameForCreate && this.beans.animationFrameSvc.addDestroyTask(() => {
114
+ this.executeSlideAndFadeAnimations(e), this.rowNode.group && r(e.element, this.rowNode.expanded == 1), this.setRowCompRowId(n), this.setRowCompRowBusinessKey(n), y(t, e.element, k, this), e.compBean.addDestroyFunc(() => y(t, e.element, k, null)), this.useAnimationFrameForCreate ? this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this, e), this.rowNode.rowIndex, "p2", !1) : this.addHoverFunctionality(e), this.isFullWidth() && this.setupFullWidth(e), t.get("rowDragEntireRow") && this.addRowDraggerToRow(e), this.useAnimationFrameForCreate && this.beans.animationFrameSvc.addDestroyTask(() => {
115
115
  this.isAlive() && e.rowComp.toggleCss("data-table-after-created", !0);
116
116
  }), this.executeProcessRowPostCreateFunc();
117
117
  }
@@ -166,8 +166,20 @@ var P = 0, F = class extends l {
166
166
  return e ? e({ rowNode: this.rowNode }) : !1;
167
167
  }
168
168
  setRowType() {
169
- let { rowNode: e, gos: t, beans: { colModel: n } } = this, r = e.stub && !e.__wasEvicted && !t.get("suppressServerSideFullWidthLoadingRow") && !t.get("groupHideOpenParents"), i = this.isNodeFullWidthCell(), a = t.get("masterDetail") && e.detail, o = g(t, e, n.isPivotMode());
170
- r ? this.rowType = "FullWidthLoading" : a ? this.rowType = "FullWidthDetail" : i ? this.rowType = "FullWidth" : o ? this.rowType = "FullWidthGroup" : this.rowType = "Normal";
169
+ let { rowNode: e, gos: t, beans: { colModel: n } } = this, r = e.stub && !e.__wasEvicted && !t.get("suppressServerSideFullWidthLoadingRow") && !t.get("groupHideOpenParents"), i = !!e.failedLoad && !t.get("groupHideOpenParents"), a = this.isNodeFullWidthCell(), o = t.get("masterDetail") && e.detail, s = g(t, e, n.isPivotMode());
170
+ r || i ? this.rowType = "FullWidthLoading" : o ? this.rowType = "FullWidthDetail" : a ? this.rowType = "FullWidth" : s ? this.rowType = "FullWidthGroup" : this.rowType = "Normal";
171
+ }
172
+ isFirstLoadingRowInRun() {
173
+ let { rowNode: e, beans: t, gos: n } = this, r = !!e.failedLoad;
174
+ if (!(r ? n.get("collapseFailedRows") : n.get("collapseLoadingRows"))) return !0;
175
+ let i = e.rowIndex;
176
+ if (i == null) return !0;
177
+ let { rowModel: a } = t, o = (e) => !!e && (!!e.stub || !!e.failedLoad) && !!e.failedLoad === r, s = i;
178
+ for (; s > 0 && o(a.getRow(s - 1));) s--;
179
+ let c = i, l = a.getRowCount();
180
+ for (; c < l - 1 && o(a.getRow(c + 1));) c++;
181
+ let u = s > 0 ? a.getRow(s - 1) : void 0, d = !!u && !u.stub && !u.failedLoad, f = c < l - 1 ? a.getRow(c + 1) : void 0, p = !!f && !f.stub && !f.failedLoad;
182
+ return r && p ? !0 : i === (!d && p ? c : s);
171
183
  }
172
184
  updateColumnLists(e = !1, t = !1) {
173
185
  if (this.isFullWidth()) return;
@@ -181,7 +193,7 @@ var P = 0, F = class extends l {
181
193
  }, this.rowNode.rowIndex, "p1", !1), !0);
182
194
  }
183
195
  getNewCellCtrl(e) {
184
- if (!this.beans.rowSpanSvc?.isCellSpanning(e, this.rowNode)) return new M(e, this.rowNode, this.beans, this);
196
+ if (!this.beans.rowSpanSvc?.isCellSpanning(e, this.rowNode)) return new N(e, this.rowNode, this.beans, this);
185
197
  }
186
198
  isCorrectCtrlForSpan(e) {
187
199
  return !this.beans.rowSpanSvc?.isCellSpanning(e.column, this.rowNode);
@@ -416,11 +428,11 @@ var P = 0, F = class extends l {
416
428
  o?.navigateToNextCell(e, e.key, c, !0), e.preventDefault();
417
429
  }
418
430
  onTabKeyDown(e) {
419
- if (e.defaultPrevented || E(e)) return;
431
+ if (e.defaultPrevented || D(e)) return;
420
432
  let t = this.allRowGuis.find((t) => t.element.contains(e.target)), r = t ? t.element : null, i = r === e.target, a = n(this.beans), o = !1;
421
433
  r && a && (o = r.contains(a) && a.classList.contains("data-table-cell"));
422
434
  let s = null;
423
- !i && !o && (s = T(this.beans, r, !1, e.shiftKey)), (this.isFullWidth() && i || !s) && this.beans.navigation?.onTabKeyDown(this, e);
435
+ !i && !o && (s = E(this.beans, r, !1, e.shiftKey)), (this.isFullWidth() && i || !s) && this.beans.navigation?.onTabKeyDown(this, e);
424
436
  }
425
437
  getFullWidthElement() {
426
438
  return this.fullWidthGui ? this.fullWidthGui.element : null;
@@ -483,7 +495,7 @@ var P = 0, F = class extends l {
483
495
  return n.source = this, n;
484
496
  }
485
497
  onRowDblClick(e) {
486
- if (E(e)) return;
498
+ if (D(e)) return;
487
499
  let t = this.createRowEventWithSource("rowDoubleClicked", e);
488
500
  t.isEventHandlingSuppressed = this.isSuppressMouseEvent(e), this.beans.eventSvc.dispatchEvent(t);
489
501
  }
@@ -513,7 +525,7 @@ var P = 0, F = class extends l {
513
525
  t?.removeAllCellRanges();
514
526
  let r = this.findFullWidthInfoForEvent(e);
515
527
  if (!r) return;
516
- let { rowGui: i, column: a } = r, c = i.element, l = e.target, u = this.rowNode, d = e.defaultPrevented || w();
528
+ let { rowGui: i, column: a } = r, c = i.element, l = e.target, u = this.rowNode, d = e.defaultPrevented || T();
517
529
  c && c.contains(l) && s(l) && (d = !1), n.setFocusedCell({
518
530
  rowIndex: u.rowIndex,
519
531
  column: a,
@@ -523,12 +535,12 @@ var P = 0, F = class extends l {
523
535
  }
524
536
  isSuppressMouseEvent(e) {
525
537
  let { gos: t, rowNode: n } = this;
526
- if (this.isFullWidth()) return j(t, this.findFullWidthRowGui(e.target)?.rowComp.getFullWidthCellRendererParams(), n, e);
527
- let r = k(t, e.target);
528
- return r != null && A(t, r.column, n, e);
538
+ if (this.isFullWidth()) return M(t, this.findFullWidthRowGui(e.target)?.rowComp.getFullWidthCellRendererParams(), n, e);
539
+ let r = A(t, e.target);
540
+ return r != null && j(t, r.column, n, e);
529
541
  }
530
542
  onRowClick(e) {
531
- if (E(e) || this.lastMouseDownOnDragger) return;
543
+ if (D(e) || this.lastMouseDownOnDragger) return;
532
544
  let t = this.isSuppressMouseEvent(e), { eventSvc: n, selectionSvc: r } = this.beans, i = this.createRowEventWithSource("rowClicked", e);
533
545
  i.isEventHandlingSuppressed = t, n.dispatchEvent(i), !t && r?.handleSelectionEvent(e, this.rowNode, "rowClicked");
534
546
  }
@@ -558,9 +570,9 @@ var P = 0, F = class extends l {
558
570
  node: this.rowNode,
559
571
  includeValueFormatted: !0
560
572
  });
561
- return i.value = e, i.valueFormatted = t, S(a, i);
573
+ return i.value = e, i.valueFormatted = t, C(a, i);
562
574
  }
563
- case "FullWidthLoading": return n.get("suppressDuplicateLoadingRows") && (i.isFirstLoadingRow = (r.rowIndex ?? 0) === (this.beans.pageBounds?.getFirstRow() ?? 0)), C(a, i);
575
+ case "FullWidthLoading": return i.isFirstLoadingRow = this.isFirstLoadingRowInRun(), r.failedLoad ? S(a, i) : w(a, i);
564
576
  default: return b(a, i);
565
577
  }
566
578
  }
@@ -576,7 +588,7 @@ var P = 0, F = class extends l {
576
588
  });
577
589
  }
578
590
  onUiLevelChanged() {
579
- let e = N(this.rowNode);
591
+ let e = P(this.rowNode);
580
592
  if (this.rowLevel != e) {
581
593
  let t = "data-table-row-level-" + e, n = "data-table-row-level-" + this.rowLevel;
582
594
  for (let e of this.allRowGuis) e.rowComp.toggleCss(t, !0), e.rowComp.toggleCss(n, !1);
@@ -772,4 +784,4 @@ var P = 0, F = class extends l {
772
784
  }
773
785
  };
774
786
  //#endregion
775
- export { F as RowCtrl };
787
+ export { I as RowCtrl };
@@ -1 +1 @@
1
- var e={dataTableSetColumnFilter:`SetFilter`,dataTableSetColumnFloatingFilter:`SetFilter`,dataTableMultiColumnFilter:`MultiFilter`,dataTableMultiColumnFloatingFilter:`MultiFilter`,dataTableGroupColumnFilter:`GroupFilter`,dataTableGroupColumnFloatingFilter:`GroupFilter`,dataTableGroupCellRenderer:`GroupCellRenderer`,dataTableGroupRowRenderer:`GroupCellRenderer`,dataTableRichSelect:`RichSelect`,dataTableRichSelectCellEditor:`RichSelect`,dataTableDetailCellRenderer:`SharedMasterDetail`,dataTableSparklineCellRenderer:`Sparklines`,dataTableDragAndDropImage:`SharedDragAndDrop`,dataTableColumnHeader:`ColumnHeaderComp`,dataTableColumnGroupHeader:`ColumnGroupHeaderComp`,dataTableSortIndicator:`Sort`,dataTableAnimateShowChangeCellRenderer:`HighlightChanges`,dataTableAnimateSlideCellRenderer:`HighlightChanges`,dataTableLoadingCellRenderer:`LoadingCellRenderer`,dataTableSkeletonCellRenderer:`SkeletonCellRenderer`,dataTableCheckboxCellRenderer:`CheckboxCellRenderer`,dataTableLoadingOverlay:`Overlay`,dataTableExportingOverlay:`Overlay`,dataTableNoRowsOverlay:`Overlay`,dataTableNoMatchingRowsOverlay:`Overlay`,dataTableTooltipComponent:`Tooltip`,dataTableReadOnlyFloatingFilter:`CustomFilter`,dataTableTextColumnFilter:`TextFilter`,dataTableNumberColumnFilter:`NumberFilter`,dataTableDateColumnFilter:`DateFilter`,dataTableDateInput:`DateFilter`,dataTableTextColumnFloatingFilter:`TextFilter`,dataTableNumberColumnFloatingFilter:`NumberFilter`,dataTableDateColumnFloatingFilter:`DateFilter`,dataTableFormulaCellEditor:`Formula`,dataTableCellEditor:`TextEditor`,dataTableSelectCellEditor:`SelectEditor`,dataTableTextCellEditor:`TextEditor`,dataTableNumberCellEditor:`NumberEditor`,dataTableDateCellEditor:`DateEditor`,dataTableDateStringCellEditor:`DateEditor`,dataTableCheckboxCellEditor:`CheckboxEditor`,dataTableLargeTextCellEditor:`LargeTextEditor`,dataTableMenuItem:`MenuItem`,dataTableColumnsToolPanel:`ColumnsToolPanel`,dataTableFiltersToolPanel:`FiltersToolPanel`,dataTableNewFiltersToolPanel:`NewFiltersToolPanel`,dataTableAggregationComponent:`StatusBar`,dataTableSelectedRowCountComponent:`StatusBar`,dataTableTotalRowCountComponent:`StatusBar`,dataTableFilteredRowCountComponent:`StatusBar`,dataTableTotalAndFilteredRowCountComponent:`StatusBar`,dataTableFindCellRenderer:`Find`};exports.USER_COMP_MODULES=e;
1
+ var e={dataTableSetColumnFilter:`SetFilter`,dataTableSetColumnFloatingFilter:`SetFilter`,dataTableMultiColumnFilter:`MultiFilter`,dataTableMultiColumnFloatingFilter:`MultiFilter`,dataTableGroupColumnFilter:`GroupFilter`,dataTableGroupColumnFloatingFilter:`GroupFilter`,dataTableGroupCellRenderer:`GroupCellRenderer`,dataTableGroupRowRenderer:`GroupCellRenderer`,dataTableRichSelect:`RichSelect`,dataTableRichSelectCellEditor:`RichSelect`,dataTableDetailCellRenderer:`SharedMasterDetail`,dataTableSparklineCellRenderer:`Sparklines`,dataTableDragAndDropImage:`SharedDragAndDrop`,dataTableColumnHeader:`ColumnHeaderComp`,dataTableColumnGroupHeader:`ColumnGroupHeaderComp`,dataTableSortIndicator:`Sort`,dataTableAnimateShowChangeCellRenderer:`HighlightChanges`,dataTableAnimateSlideCellRenderer:`HighlightChanges`,dataTableLoadingCellRenderer:`LoadingCellRenderer`,dataTableErrorCellRenderer:`LoadingCellRenderer`,dataTableSkeletonCellRenderer:`SkeletonCellRenderer`,dataTableCheckboxCellRenderer:`CheckboxCellRenderer`,dataTableLoadingOverlay:`Overlay`,dataTableExportingOverlay:`Overlay`,dataTableNoRowsOverlay:`Overlay`,dataTableNoMatchingRowsOverlay:`Overlay`,dataTableTooltipComponent:`Tooltip`,dataTableReadOnlyFloatingFilter:`CustomFilter`,dataTableTextColumnFilter:`TextFilter`,dataTableNumberColumnFilter:`NumberFilter`,dataTableDateColumnFilter:`DateFilter`,dataTableDateInput:`DateFilter`,dataTableTextColumnFloatingFilter:`TextFilter`,dataTableNumberColumnFloatingFilter:`NumberFilter`,dataTableDateColumnFloatingFilter:`DateFilter`,dataTableFormulaCellEditor:`Formula`,dataTableCellEditor:`TextEditor`,dataTableSelectCellEditor:`SelectEditor`,dataTableTextCellEditor:`TextEditor`,dataTableNumberCellEditor:`NumberEditor`,dataTableDateCellEditor:`DateEditor`,dataTableDateStringCellEditor:`DateEditor`,dataTableCheckboxCellEditor:`CheckboxEditor`,dataTableLargeTextCellEditor:`LargeTextEditor`,dataTableMenuItem:`MenuItem`,dataTableColumnsToolPanel:`ColumnsToolPanel`,dataTableFiltersToolPanel:`FiltersToolPanel`,dataTableNewFiltersToolPanel:`NewFiltersToolPanel`,dataTableAggregationComponent:`StatusBar`,dataTableSelectedRowCountComponent:`StatusBar`,dataTableTotalRowCountComponent:`StatusBar`,dataTableFilteredRowCountComponent:`StatusBar`,dataTableTotalAndFilteredRowCountComponent:`StatusBar`,dataTableFindCellRenderer:`Find`};exports.USER_COMP_MODULES=e;
@@ -19,6 +19,7 @@ var e = {
19
19
  dataTableAnimateShowChangeCellRenderer: "HighlightChanges",
20
20
  dataTableAnimateSlideCellRenderer: "HighlightChanges",
21
21
  dataTableLoadingCellRenderer: "LoadingCellRenderer",
22
+ dataTableErrorCellRenderer: "LoadingCellRenderer",
22
23
  dataTableSkeletonCellRenderer: "SkeletonCellRenderer",
23
24
  dataTableCheckboxCellRenderer: "CheckboxCellRenderer",
24
25
  dataTableLoadingOverlay: "Overlay",
@@ -1 +1 @@
1
- const e=require("../version.cjs"),t=require("../dataTableEnterpriseModule.cjs"),n=require("./loadingCellRenderer.cjs");var r={moduleName:`LoadingCellRenderer`,version:e.VERSION,userComponents:{dataTableLoadingCellRenderer:n.LoadingCellRenderer},icons:{groupLoading:`loading`},dependsOn:[t.EnterpriseCoreModule]};exports.LoadingCellRendererModule=r;
1
+ const e=require("../version.cjs"),t=require("../dataTableEnterpriseModule.cjs"),n=require("./errorCellRenderer.cjs"),r=require("./loadingCellRenderer.cjs");var i={moduleName:`LoadingCellRenderer`,version:e.VERSION,userComponents:{dataTableLoadingCellRenderer:r.LoadingCellRenderer,dataTableErrorCellRenderer:n.ErrorCellRenderer},icons:{groupLoading:`loading`},dependsOn:[t.EnterpriseCoreModule]};exports.LoadingCellRendererModule=i;
@@ -1,13 +1,17 @@
1
1
  import { VERSION as e } from "../version.js";
2
2
  import { EnterpriseCoreModule as t } from "../dataTableEnterpriseModule.js";
3
- import { LoadingCellRenderer as n } from "./loadingCellRenderer.js";
3
+ import { ErrorCellRenderer as n } from "./errorCellRenderer.js";
4
+ import { LoadingCellRenderer as r } from "./loadingCellRenderer.js";
4
5
  //#region src/enterprise/cellRenderers/enterpriseCellRendererModule.ts
5
- var r = {
6
+ var i = {
6
7
  moduleName: "LoadingCellRenderer",
7
8
  version: e,
8
- userComponents: { dataTableLoadingCellRenderer: n },
9
+ userComponents: {
10
+ dataTableLoadingCellRenderer: r,
11
+ dataTableErrorCellRenderer: n
12
+ },
9
13
  icons: { groupLoading: "loading" },
10
14
  dependsOn: [t]
11
15
  };
12
16
  //#endregion
13
- export { r as LoadingCellRendererModule };
17
+ export { i as LoadingCellRendererModule };
@@ -0,0 +1 @@
1
+ require("../../community/dataTableStack/interfaces/dataTableComponent.cjs");const e=require("../../community/widgets/component.cjs");var t={tag:`div`,cls:`data-table-loading`,children:[{tag:`span`,ref:`eErrorText`,cls:`data-table-loading-text`}]},n=class extends e.Component{eErrorText=null;constructor(){super(t)}init(e){e.isFirstLoadingRow!==!1&&(this.eErrorText.textContent=this.getLocaleTextFunc()(`loadingError`,`ERR`))}refresh(e){return!1}};exports.ErrorCellRenderer=n;
@@ -0,0 +1,13 @@
1
+ import { ILoadingCellRendererComp, ILoadingCellRendererParams, Component } from '../../community';
2
+ /**
3
+ * Default full-width renderer for a failed (server-side) row. Used when no custom
4
+ * `errorCellRenderer` is provided, so a failed block still shows an error instead
5
+ * of falling back to the loading spinner. Custom renderers (e.g. with a retry
6
+ * button) can be supplied via the `errorCellRenderer` grid option.
7
+ */
8
+ export declare class ErrorCellRenderer extends Component implements ILoadingCellRendererComp {
9
+ private readonly eErrorText;
10
+ constructor();
11
+ init(params: ILoadingCellRendererParams): void;
12
+ refresh(_params: ILoadingCellRendererParams): boolean;
13
+ }
@@ -0,0 +1,13 @@
1
+ import { ILoadingCellRendererComp, ILoadingCellRendererParams, Component } from '../../community';
2
+ /**
3
+ * Default full-width renderer for a failed (server-side) row. Used when no custom
4
+ * `errorCellRenderer` is provided, so a failed block still shows an error instead
5
+ * of falling back to the loading spinner. Custom renderers (e.g. with a retry
6
+ * button) can be supplied via the `errorCellRenderer` grid option.
7
+ */
8
+ export declare class ErrorCellRenderer extends Component implements ILoadingCellRendererComp {
9
+ private readonly eErrorText;
10
+ constructor();
11
+ init(params: ILoadingCellRendererParams): void;
12
+ refresh(_params: ILoadingCellRendererParams): boolean;
13
+ }
@@ -0,0 +1,25 @@
1
+ import "../../community/dataTableStack/interfaces/dataTableComponent.js";
2
+ import { Component as e } from "../../community/widgets/component.js";
3
+ //#region src/enterprise/cellRenderers/errorCellRenderer.ts
4
+ var t = {
5
+ tag: "div",
6
+ cls: "data-table-loading",
7
+ children: [{
8
+ tag: "span",
9
+ ref: "eErrorText",
10
+ cls: "data-table-loading-text"
11
+ }]
12
+ }, n = class extends e {
13
+ eErrorText = null;
14
+ constructor() {
15
+ super(t);
16
+ }
17
+ init(e) {
18
+ e.isFirstLoadingRow !== !1 && (this.eErrorText.textContent = this.getLocaleTextFunc()("loadingError", "ERR"));
19
+ }
20
+ refresh(e) {
21
+ return !1;
22
+ }
23
+ };
24
+ //#endregion
25
+ export { n as ErrorCellRenderer };
@@ -1 +1 @@
1
- require("../../community/dataTableStack/interfaces/dataTableComponent.cjs");const e=require("../../community/widgets/component.cjs"),t=require("../../community/utils/icon.cjs");var n={tag:`div`,cls:`data-table-loading`,children:[{tag:`span`,ref:`eLoadingIcon`,cls:`data-table-loading-icon`},{tag:`span`,ref:`eLoadingText`,cls:`data-table-loading-text`}]},r=class extends e.Component{eLoadingIcon=null;eLoadingText=null;constructor(){super(n)}init(e){e.isFirstLoadingRow!==!1&&(e.node.failedLoad?this.setupFailed():this.setupLoading())}setupFailed(){this.eLoadingText.textContent=this.getLocaleTextFunc()(`loadingError`,`ERR`)}setupLoading(){let e=t._createIconNoSpan(`groupLoading`,this.beans,null);e&&this.eLoadingIcon.appendChild(e),this.eLoadingText.textContent=this.getLocaleTextFunc()(`loadingOoo`,`Loading...`)}refresh(e){return!1}};exports.LoadingCellRenderer=r;
1
+ require("../../community/dataTableStack/interfaces/dataTableComponent.cjs");const e=require("../../community/widgets/component.cjs"),t=require("../../community/utils/icon.cjs");var n={tag:`div`,cls:`data-table-loading`,children:[{tag:`span`,ref:`eLoadingIcon`,cls:`data-table-loading-icon`},{tag:`span`,ref:`eLoadingText`,cls:`data-table-loading-text`}]},r=class extends e.Component{eLoadingIcon=null;eLoadingText=null;constructor(){super(n)}init(e){e.isFirstLoadingRow!==!1&&this.setupLoading()}setupLoading(){let e=t._createIconNoSpan(`groupLoading`,this.beans,null);e&&this.eLoadingIcon.appendChild(e),this.eLoadingText.textContent=this.getLocaleTextFunc()(`loadingOoo`,`Loading...`)}refresh(e){return!1}};exports.LoadingCellRenderer=r;
@@ -4,7 +4,6 @@ export declare class LoadingCellRenderer extends Component implements ILoadingCe
4
4
  private readonly eLoadingText;
5
5
  constructor();
6
6
  init(params: ILoadingCellRendererParams): void;
7
- private setupFailed;
8
7
  private setupLoading;
9
8
  refresh(_params: ILoadingCellRendererParams): boolean;
10
9
  }
@@ -4,7 +4,6 @@ export declare class LoadingCellRenderer extends Component implements ILoadingCe
4
4
  private readonly eLoadingText;
5
5
  constructor();
6
6
  init(params: ILoadingCellRendererParams): void;
7
- private setupFailed;
8
7
  private setupLoading;
9
8
  refresh(_params: ILoadingCellRendererParams): boolean;
10
9
  }
@@ -21,10 +21,7 @@ var n = {
21
21
  super(n);
22
22
  }
23
23
  init(e) {
24
- e.isFirstLoadingRow !== !1 && (e.node.failedLoad ? this.setupFailed() : this.setupLoading());
25
- }
26
- setupFailed() {
27
- this.eLoadingText.textContent = this.getLocaleTextFunc()("loadingError", "ERR");
24
+ e.isFirstLoadingRow !== !1 && this.setupLoading();
28
25
  }
29
26
  setupLoading() {
30
27
  let e = t("groupLoading", this.beans, null);
@@ -1 +1 @@
1
- const e=require("../../../../community/context/beanStub.cjs"),t=require("../../../../community/gridOptionsUtils.cjs");var n=class extends e.BeanStub{beanName=`lazyBlockLoadingSvc`;outboundRequests=0;maxOutboundRequests;rowRenderer;rowModel;wireBeans(e){this.rowRenderer=e.rowRenderer,this.rowModel=e.rowModel}cacheLoadingNodesMap=new Map;isCheckQueued=!1;nextBlockToLoad=void 0;loaderTimeout;postConstruct(){this.maxOutboundRequests=t._getMaxConcurrentDatasourceRequests(this.gos)}subscribe(e){this.cacheLoadingNodesMap.set(e,new Set)}unsubscribe(e){this.cacheLoadingNodesMap.delete(e)}queueLoadCheck(){this.isCheckQueued||(this.isCheckQueued=!0,setTimeout(()=>{this.queueLoadAction(),this.isCheckQueued=!1}))}onLoadComplete(){--this.outboundRequests,this.queueLoadCheck()}hasAvailableLoadBandwidth(){return this.maxOutboundRequests===void 0?!0:this.outboundRequests<this.maxOutboundRequests}queueLoadAction(){let e=this.getBlockToLoad();if(!e)return;let t=this.nextBlockToLoad&&this.nextBlockToLoad.cache===e.cache&&this.nextBlockToLoad.index===e.index;if(!t&&(!this.nextBlockToLoad||!t)){this.nextBlockToLoad=e,window.clearTimeout(this.loaderTimeout);let t=Number(this.nextBlockToLoad.index),n=this.nextBlockToLoad.cache,r=e.index+e.cache.getBlockSize();this.loaderTimeout=window.setTimeout(()=>{n.isAlive()&&(this.loaderTimeout=void 0,this.attemptLoad(n,t,r),this.nextBlockToLoad=void 0)},this.gos.get(`blockLoadDebounceMillis`))}}attemptLoad(e,t,n){this.hasAvailableLoadBandwidth()&&(this.executeLoad(e,t,n),this.queueLoadCheck())}executeLoad(e,n,r){let i=e.getSsrmParams(),a={startRow:n,endRow:r,rowGroupCols:i.rowGroupCols,valueCols:i.valueCols,pivotCols:i.pivotCols,pivotMode:i.pivotMode,groupKeys:e.store.getParentNode().getRoute()??[],filterModel:i.filterModel,sortModel:i.sortModel},o=this.cacheLoadingNodesMap.get(e),s=()=>{for(let e=0;e<r-n;e++)o.delete(n+e)},c=()=>{for(let e=0;e<r-n;e++)o.add(n+e)},l=t._addGridCommonParams(this.gos,{request:a,success:t=>{this.onLoadComplete(),e.onLoadSuccess(n,r-n,t),s()},fail:()=>{this.onLoadComplete(),e.onLoadFailed(n,r-n),s()},parentNode:e.store.getParentNode()});c(),this.outboundRequests+=1,e.getSsrmParams().datasource?.getRows(l)}getBlockToLoad(){let e=this.rowRenderer.firstRenderedRow,t=this.rowRenderer.lastRenderedRow;for(let n=e;n<=t;n++){let e=this.rowModel.getRow(n);if(!e)continue;let t=e.parent?.childStore;if(!t)continue;let r=t.getCache(),i=r.getNodes().getBy(`node`,e);if(i&&!this.cacheLoadingNodesMap.get(r)?.has(i.index)&&(e.__needsRefreshWhenVisible||e.stub&&!e.failedLoad))return{cache:r,index:r.getBlockStartIndex(i.index)}}let n=null,r=null,i=2**53-1;for(let a of this.cacheLoadingNodesMap.keys())a.getNodesToRefresh().forEach(o=>{if(o.rowIndex==null){r=o,n=a;return}let s=a.getNodes().getBy(`node`,o);if(!s||this.cacheLoadingNodesMap.get(a)?.has(s.index))return;let c=Math.abs(e-o.rowIndex),l=Math.abs(o.rowIndex-t);c<i&&(r=o,i=c,n=a),l<i&&(r=o,i=l,n=a)});if(!n)return;let a=n,o=a.getNodes().getBy(`node`,r)?.index;return o==null?void 0:{cache:a,index:a.getBlockStartIndex(o)}}isRowLoading(e,t){return this.cacheLoadingNodesMap.get(e)?.has(t)??!1}};exports.LazyBlockLoadingService=n;
1
+ const e=require("../../../../community/context/beanStub.cjs"),t=require("../../../../community/gridOptionsUtils.cjs");var n=class extends e.BeanStub{beanName=`lazyBlockLoadingSvc`;outboundRequests=0;maxOutboundRequests;rowRenderer;rowModel;wireBeans(e){this.rowRenderer=e.rowRenderer,this.rowModel=e.rowModel}cacheLoadingNodesMap=new Map;isCheckQueued=!1;nextBlockToLoad=void 0;loaderTimeout;postConstruct(){this.maxOutboundRequests=t._getMaxConcurrentDatasourceRequests(this.gos)}subscribe(e){this.cacheLoadingNodesMap.set(e,new Set)}unsubscribe(e){this.cacheLoadingNodesMap.delete(e)}queueLoadCheck(){this.isCheckQueued||(this.isCheckQueued=!0,setTimeout(()=>{this.queueLoadAction(),this.isCheckQueued=!1}))}onLoadComplete(){--this.outboundRequests,this.queueLoadCheck()}hasAvailableLoadBandwidth(){return this.maxOutboundRequests===void 0?!0:this.outboundRequests<this.maxOutboundRequests}queueLoadAction(){let e=this.getBlockToLoad();if(!e)return;let t=this.nextBlockToLoad&&this.nextBlockToLoad.cache===e.cache&&this.nextBlockToLoad.index===e.index;if(!t&&(!this.nextBlockToLoad||!t)){this.nextBlockToLoad=e,window.clearTimeout(this.loaderTimeout);let t=Number(this.nextBlockToLoad.index),n=this.nextBlockToLoad.cache,r=e.index+e.cache.getBlockSize();this.loaderTimeout=window.setTimeout(()=>{n.isAlive()&&(this.loaderTimeout=void 0,this.attemptLoad(n,t,r),this.nextBlockToLoad=void 0)},this.gos.get(`blockLoadDebounceMillis`))}}attemptLoad(e,t,n){this.hasAvailableLoadBandwidth()&&(this.executeLoad(e,t,n),this.queueLoadCheck())}executeLoad(e,n,r){let i=e.getSsrmParams(),a={startRow:n,endRow:r,rowGroupCols:i.rowGroupCols,valueCols:i.valueCols,pivotCols:i.pivotCols,pivotMode:i.pivotMode,groupKeys:e.store.getParentNode().getRoute()??[],filterModel:i.filterModel,sortModel:i.sortModel},o=this.cacheLoadingNodesMap.get(e),s=()=>{for(let e=0;e<r-n;e++)o.delete(n+e)},c=()=>{for(let e=0;e<r-n;e++)o.add(n+e)},l=t._addGridCommonParams(this.gos,{request:a,success:t=>{this.onLoadComplete(),e.onLoadSuccess(n,r-n,t),s()},fail:()=>{this.onLoadComplete(),e.onLoadFailed(n,r-n),s()},parentNode:e.store.getParentNode()});c(),e.onLoadStarted(n,r-n),this.outboundRequests+=1,e.getSsrmParams().datasource?.getRows(l)}getBlockToLoad(){let e=this.rowRenderer.firstRenderedRow,t=this.rowRenderer.lastRenderedRow;for(let n=e;n<=t;n++){let e=this.rowModel.getRow(n);if(!e)continue;let t=e.parent?.childStore;if(!t)continue;let r=t.getCache(),i=r.getNodes().getBy(`node`,e);if(i&&!this.cacheLoadingNodesMap.get(r)?.has(i.index)&&(e.__needsRefreshWhenVisible||e.stub&&!e.failedLoad))return{cache:r,index:r.getBlockStartIndex(i.index)}}let n=null,r=null,i=2**53-1;for(let a of this.cacheLoadingNodesMap.keys())a.getNodesToRefresh().forEach(o=>{if(o.rowIndex==null){r=o,n=a;return}let s=a.getNodes().getBy(`node`,o);if(!s||this.cacheLoadingNodesMap.get(a)?.has(s.index))return;let c=Math.abs(e-o.rowIndex),l=Math.abs(o.rowIndex-t);c<i&&(r=o,i=c,n=a),l<i&&(r=o,i=l,n=a)});if(!n)return;let a=n,o=a.getNodes().getBy(`node`,r)?.index;return o==null?void 0:{cache:a,index:a.getBlockStartIndex(o)}}isRowLoading(e,t){return this.cacheLoadingNodesMap.get(e)?.has(t)??!1}};exports.LazyBlockLoadingService=n;
@@ -74,7 +74,7 @@ var r = class extends e {
74
74
  },
75
75
  parentNode: e.store.getParentNode()
76
76
  });
77
- c(), this.outboundRequests += 1, e.getSsrmParams().datasource?.getRows(l);
77
+ c(), e.onLoadStarted(n, r - n), this.outboundRequests += 1, e.getSsrmParams().datasource?.getRows(l);
78
78
  }
79
79
  getBlockToLoad() {
80
80
  let e = this.rowRenderer.firstRenderedRow, t = this.rowRenderer.lastRenderedRow;
@@ -1 +1 @@
1
- const e=require("../../../../community/context/beanStub.cjs"),t=require("../../../../community/validation/logging.cjs"),n=require("../../../../community/gridOptionsUtils.cjs"),r=require("../../../rowGrouping/rowGroupingUtils.cjs"),i=require("./multiIndexMap.cjs");var a=100,o=class extends e.BeanStub{rowRenderer;blockUtils;focusSvc;nodeManager;serverSideRowModel;rowNodeSorter;sortSvc;lazyBlockLoadingSvc;colModel;wireBeans(e){this.rowRenderer=e.rowRenderer,this.blockUtils=e.ssrmBlockUtils,this.focusSvc=e.focusSvc,this.nodeManager=e.ssrmNodeManager,this.serverSideRowModel=e.rowModel,this.rowNodeSorter=e.rowNodeSorter,this.sortSvc=e.sortSvc,this.lazyBlockLoadingSvc=e.lazyBlockLoadingSvc,this.colModel=e.colModel}live=!0;nodeMap;nodeDisplayIndexMap;nodesToRefresh;numberOfRows;isLastRowKnown;defaultNodeIdPrefix;store;storeParams;getRowIdFunc;isMasterDetail;removedNodeCache=new Map;loadedBlocks=new Set;constructor(e,t,n,r){super(),this.store=e,this.numberOfRows=t,this.isLastRowKnown=n,this.storeParams=r}postConstruct(){this.lazyBlockLoadingSvc.subscribe(this),this.nodeMap=new i.MultiIndexMap(`index`,`id`,`node`),this.nodeDisplayIndexMap=new Map,this.nodesToRefresh=new Set;let{blockUtils:e,gos:t,store:r}=this;this.defaultNodeIdPrefix=e.createNodeIdPrefix(r.getParentNode()),this.getRowIdFunc=n._getRowIdCallback(t),this.isMasterDetail=t.get(`masterDetail`)}destroy(){this.lazyBlockLoadingSvc.unsubscribe(this),this.numberOfRows=0,this.nodeMap.forEach(e=>this.blockUtils.destroyRowNode(e.node)),this.nodeMap.clear(),this.nodeDisplayIndexMap.clear(),this.nodesToRefresh.clear(),this.live=!1,super.destroy()}getRowByDisplayIndex(e){if(!this.store.isDisplayIndexInStore(e))return;let t=this.nodeDisplayIndexMap.get(e);if(t)return(t.stub||t.__needsRefreshWhenVisible)&&this.lazyBlockLoadingSvc.queueLoadCheck(),t;if(this.gos.get(`groupHideOpenParents`)||this.gos.get(`groupAllowUnbalanced`)){let t=this.nodeMap.find(t=>!!t.node.childStore?.isDisplayIndexInStore(e));if(t)return t.node.childStore?.getRowUsingDisplayIndex(e)}if(e===this.store.getDisplayIndexStart())return this.createStubNode(0,e);let n=this.nodeDisplayIndexMap.get(e-1);if(n){if(this.isMasterDetail&&n.master&&n.expanded)return n.detailNode;if(n.expanded&&n.childStore?.isDisplayIndexInStore(e))return n.childStore?.getRowUsingDisplayIndex(e);let t=this.nodeMap.getBy(`node`,n);return this.createStubNode(t.index+1,e)}let r=this.getSurroundingNodesByDisplayIndex(e);if(r==null){let t=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(t,e)}let{previousNode:i,nextNode:a}=r;if(i?.node.expanded&&i.node.childStore?.isDisplayIndexInStore(e))return i.node.childStore?.getRowUsingDisplayIndex(e);if(a){let t=a.node.rowIndex-e,n=a.index-t;return this.createStubNode(n,e)}let o=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(o,e)}createStubNode(e,t){let n=this.store.getRowBounds(t),i=this.createRowAtIndex(e,null,e=>{e.setRowIndex(t),e.setRowTop(n.rowTop),this.nodeDisplayIndexMap.set(t,e)}),a=this.getBlockStartIndex(e);if(this.loadedBlocks.has(a)&&(i.__wasEvicted=!0),e===0&&this.gos.get(`groupHideOpenParents`)){let e=this.store.getParentNode().groupData;if(e)for(let t of Object.keys(e))r.setRowNodeGroupValue(i,this.colModel,t,e[t])}return this.lazyBlockLoadingSvc.queueLoadCheck(),i}getRowByStoreIndex(e){return this.nodeMap.getBy(`index`,e)?.node}skipDisplayIndexes(e,t,r){if(e===0)return;let i=n._getRowHeightAsNumber(this.beans);t.value+=e,r.value+=e*i}setDisplayIndexes(e,t,n){this.nodeDisplayIndexMap.clear();let i={};this.nodeMap.forEach(e=>{i[e.index]=e.node});let a=-1;for(let o of Object.keys(i)){let s=i[o],c=Number(o),l=c-1-a;this.skipDisplayIndexes(l,e,t);let u=c===0;if(s.firstChild!==u&&(s.firstChild=u,s.dispatchRowEvent(`firstChildChanged`)),u&&this.gos.get(`groupHideOpenParents`)){let e=this.store.getParentNode().groupData;if(e)for(let t of Object.keys(e))r.setRowNodeGroupValue(s,this.colModel,t,u?e[t]:void 0)}this.blockUtils.setDisplayIndex(s,e,t,n),s.rowIndex!=null&&this.nodeDisplayIndexMap.set(s.rowIndex,s),a=c}let o=this.numberOfRows-1-a;this.skipDisplayIndexes(o,e,t),this.purgeExcessRows()}getRowCount(){return this.numberOfRows}setRowCount(e,t){this.numberOfRows=e,t!=null&&(this.isLastRowKnown=t,t===!1&&(this.numberOfRows+=1)),this.fireStoreUpdatedEvent()}getNodes(){return this.nodeMap}getNodeCachedByDisplayIndex(e){return this.nodeDisplayIndexMap.get(e)??null}getNodesToRefresh(){return this.nodesToRefresh}getSurroundingNodesByDisplayIndex(e){let t,n;return this.nodeMap.forEach(r=>{if(e>r.node.rowIndex){(n==null||n.node.rowIndex<r.node.rowIndex)&&(n=r);return}(t==null||t.node.rowIndex>r.node.rowIndex)&&(t=r)}),!n&&!t?null:{previousNode:n,nextNode:t}}getDisplayIndexFromStoreIndex(e){let t=this.nodeMap.getBy(`index`,e);if(t)return t.node.rowIndex;let n,r;if(this.nodeMap.forEach(t=>{if(e>t.index){(r==null||r.index<t.index)&&(r=t);return}(n==null||n.index>t.index)&&(n=t)}),!n)return this.store.getDisplayIndexEnd()-(this.numberOfRows-e);if(!r)return this.store.getDisplayIndexStart()+e;let i=e-r.index;return(r.node.childStore?.getDisplayIndexEnd()??r.node.rowIndex)+i}createRowAtIndex(e,t,n){let r=this.nodeMap.getBy(`index`,e);if(r){let{node:n}=r;if(n.__needsRefreshWhenVisible=!1,this.doesNodeMatch(t,n))return this.blockUtils.updateDataIntoRowNode(n,t),this.nodesToRefresh.delete(n),n;if(this.getRowIdFunc==null&&n.hasChildren()&&n.expanded)return this.nodesToRefresh.delete(n),n;this.destroyRowAtIndex(e)}if(t&&this.getRowIdFunc!=null){let n=this.getRowId(t),r=n&&this.removedNodeCache?.get(n);if(r)return this.removedNodeCache?.delete(n),this.blockUtils.updateDataIntoRowNode(r,t),this.nodeMap.set({id:r.id,node:r,index:e}),this.nodesToRefresh.delete(r),r.__needsRefreshWhenVisible=!1,r;let i=this.nodeMap.getBy(`id`,n);if(i){this.nodeMap.delete(i);let{node:n,index:r}=i;return this.blockUtils.updateDataIntoRowNode(n,t),this.nodeMap.set({id:n.id,node:n,index:e}),this.nodesToRefresh.delete(n),n.__needsRefreshWhenVisible=!1,this.getBlockStartIndex(r)===this.getBlockStartIndex(e)||this.markBlockForVerify(r),n}}let i=this.blockUtils.createRowNode(this.store.getRowDetails());if(t!=null){let e=this.getPrefixedId(this.store.getIdSequence().value++);this.blockUtils.setDataIntoRowNode(i,t,e,void 0),this.blockUtils.checkOpenByDefault(i),this.nodeManager.addRowNode(i)}return this.nodeMap.set({id:i.id,node:i,index:e}),n&&n(i),i}getBlockStates(){let e={},t={};this.nodeMap.forEach(({node:n,index:r})=>{let i=this.getBlockStartIndex(r);!n.stub&&!n.failedLoad&&(e[i]=(e[i]??0)+1);let a=`loaded`;n.failedLoad?a=`failed`:this.lazyBlockLoadingSvc.isRowLoading(this,i)?a=`loading`:(this.nodesToRefresh.has(n)||n.stub)&&(a=`needsLoading`),t[i]||(t[i]=new Set),t[i].add(a)});let n={loading:4,failed:3,needsLoading:2,loaded:1},r=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),i={};for(let a of Object.keys(t)){let o=[...t[a]].sort((e,t)=>(n[e]??0)-(n[t]??0))[0],s=Number(a)/this.getBlockSize(),c=r?`${r}-${s}`:String(s);i[c]={blockNumber:s,startRow:Number(a),endRow:Number(a)+this.getBlockSize(),pageStatus:o,loadedRowCount:e[a]??0}}return i}destroyRowAtIndex(e){let t=this.nodeMap.getBy(`index`,e);t&&(this.nodeMap.delete(t),this.nodeDisplayIndexMap.delete(t.node.rowIndex),this.nodesToRefresh.size>0?this.removedNodeCache.set(t.node.id,t.node):this.blockUtils.destroyRowNode(t.node),this.nodesToRefresh.delete(t.node))}getSsrmParams(){return this.store.getSsrmParams()}getPrefixedId(e){return this.defaultNodeIdPrefix?this.defaultNodeIdPrefix+`-`+e:e.toString()}markBlockForVerify(e){let[t,n]=this.getBlockBounds(e);this.nodeMap.filter(e=>e.index>=t&&e.index<n).forEach(({node:e})=>{e.__needsRefreshWhenVisible=!0})}doesNodeMatch(e,t){if(t.stub)return!1;let n=this.getRowId(e);return n===null?t.data===e:t.id===n}purgeStubsOutsideOfViewport(){let{firstRenderedRow:e,lastRenderedRow:t}=this.rowRenderer,n=this.getBlockStartIndex(e),[,r]=this.getBlockBounds(t);this.nodeMap.forEach(e=>{this.lazyBlockLoadingSvc.isRowLoading(this,e.index)||e.node.failedLoad||e.node.stub&&(e.index<n||e.index>r)&&this.destroyRowAtIndex(e.index)})}getBlocksDistanceFromRow(e,t){let n={};return e.forEach(({node:e,index:r})=>{let[i,a]=this.getBlockBounds(r);if(i in n)return;let o=Math.abs(e.rowIndex-t),s,c=this.nodeMap.getBy(`index`,[a-1]);c&&(s=Math.abs(c.node.rowIndex-t)),n[i]=s==null||o<s?o:s}),Object.entries(n)}purgeExcessRows(){if(this.purgeStubsOutsideOfViewport(),this.store.getDisplayIndexEnd()==null||this.storeParams.maxBlocksInCache==null)return;let{firstRenderedRow:e,lastRenderedRow:t}=this.rowRenderer,n=new Set,r=new Set;this.nodeMap.forEach(({index:i,node:a})=>{let o=this.getBlockStartIndex(i);n.add(o),a.rowIndex>=e&&a.rowIndex<=t&&r.add(o)});let i=Math.max(r.size,this.storeParams.maxBlocksInCache??0),a=n.size-i;if(a<=0)return;let o=2**53-1,s=-(2**53-1);r.forEach(e=>{o>e&&(o=e),s<e&&(s=e)});let c=this.nodeMap.filter(({node:e,index:t})=>{let n=this.getBlockStartIndex(t);return!(n>=o&&n<=s)&&!this.isNodeCached(e)});if(c.length===0)return;let l=e+(t-e)/2,u=this.getBlocksDistanceFromRow(c,l),d=this.getBlockSize();u.sort((e,t)=>Math.sign(t[1]-e[1]));for(let e=0;e<Math.min(a,u.length);e++){let t=Number(u[e][0]);for(let e=t;e<t+d;e++){let t=this.nodeMap.getBy(`index`,e);!t||this.isNodeCached(t.node)||this.destroyRowAtIndex(e)}}}isNodeFocused(e){let t=this.focusSvc.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e.rowIndex}isNodeCached(e){let t=e.isExpandable()&&e.expanded,n=this.gos.get(`groupAllowUnbalanced`)&&e.key===``,r=!!this.beans.editSvc?.isRowEditing(e);return t||this.isNodeFocused(e)||n||r}extractDuplicateIds(e){if(this.getRowIdFunc==null)return[];let t=new Set,n=new Set;return e.forEach(e=>{let r=this.getRowId(e);if(t.has(r)){n.add(r);return}t.add(r)}),[...n]}onLoadSuccess(e,n,r){if(!this.live)return;let i=r.groupLevelInfo;if(this.store.setStoreInfo(i),this.getRowIdFunc!=null){let i=this.extractDuplicateIds(r.rowData);if(i.length>0){t._warn(205,{duplicateIdText:i.join(`, `)}),this.onLoadFailed(e,n);return}}r.pivotResultFields&&this.serverSideRowModel.generateSecondaryColumns(r.pivotResultFields);let a=this.nodesToRefresh.size>0;r.rowData.forEach((t,n)=>{let r=e+n,i=this.nodeMap.getBy(`index`,r);if(i?.node?.stub){this.createRowAtIndex(r,t);return}if(i&&this.doesNodeMatch(t,i.node)){this.blockUtils.updateDataIntoRowNode(i.node,t),this.nodesToRefresh.delete(i.node),i.node.__needsRefreshWhenVisible=!1;return}this.createRowAtIndex(r,t)});let o=this.getBlockStartIndex(e);if(this.loadedBlocks.add(o),r.rowCount!=null&&r.rowCount!==-1)this.numberOfRows=r.rowCount,this.isLastRowKnown=!0;else if(n>r.rowData.length)this.numberOfRows=e+r.rowData.length,this.isLastRowKnown=!0;else if(!this.isLastRowKnown){let t=e+r.rowData.length+1;t>this.numberOfRows&&(this.numberOfRows=t)}this.isLastRowKnown&&this.nodeMap.filter(e=>e.index>=this.numberOfRows).forEach(e=>this.destroyRowAtIndex(e.index)),this.fireStoreUpdatedEvent();let s=this.nodesToRefresh.size===0;a&&s&&this.fireRefreshFinishedEvent()}fireRefreshFinishedEvent(){this.nodesToRefresh.size===0&&(this.removedNodeCache.forEach(e=>{this.blockUtils.destroyRowNode(e)}),this.removedNodeCache=new Map,this.store.fireRefreshFinishedEvent())}isStoreFullyLoaded(){let e=this.isLastRowKnown,t=this.nodeMap.getSize()===this.numberOfRows;if(!e||!t||this.nodesToRefresh.size>0)return;let n=-1;return this.nodeMap.find(e=>(n+=1,!!(e.index!==n||e.node.__needsRefreshWhenVisible||e.node.stub)))==null}isLastRowIndexKnown(){return this.isLastRowKnown}onLoadFailed(e,t){if(!this.live)return;let n=this.nodesToRefresh.size>0;for(let n=e;n<e+t&&n<this.getRowCount();n++){let{node:e}=this.nodeMap.getBy(`index`,n)??{};e&&this.nodesToRefresh.delete(e),e?.stub||(e&&!e.stub&&this.destroyRowAtIndex(n),e=this.createRowAtIndex(n)),e.__needsRefreshWhenVisible=!1,e.failedLoad=!0}let r=this.nodesToRefresh.size===0;n&&r&&this.fireRefreshFinishedEvent(),this.fireStoreUpdatedEvent()}markNodesForRefresh(){this.nodeMap.forEach(e=>{e.node.stub&&!e.node.failedLoad||this.nodesToRefresh.add(e.node)}),this.lazyBlockLoadingSvc.queueLoadCheck(),this.isLastRowKnown&&this.numberOfRows===0&&(this.numberOfRows=1,this.isLastRowKnown=!1,this.fireStoreUpdatedEvent())}isNodeInCache(e){return!!this.nodeMap.getBy(`id`,e)}fireStoreUpdatedEvent(){this.live&&this.store.fireStoreUpdatedEvent()}getRowId(e){if(this.getRowIdFunc==null)return null;let{level:t}=this.store.getRowDetails(),n=this.store.getParentNode().getRoute()??[];return this.getRowIdFunc({data:e,parentKeys:n.length>0?n:void 0,level:t})}getOrderedNodeMap(){let e={};return this.nodeMap.forEach(t=>e[t.index]=t),e}clearDisplayIndexes(){this.nodeDisplayIndexMap.clear()}clientSideSortRows(){let e=this.sortSvc?.getSortOptions()??[],t=e.some(e=>e.sort!=null),n=this.rowNodeSorter;if(!t||!n)return;let r=Array(this.nodeMap.getSize()),i=this.nodeMap;i.forEach(e=>r[e.index]=e.node),i.clear();let a=n.doFullSortInPlace(r,e);for(let e=0,t=a.length;e<t;++e){let t=a[e];i.set({id:t.id,node:t,index:e})}}updateRowNodes(e){let t=[];return e.forEach(e=>{let n=this.getRowId(e),r=this.nodeMap.getBy(`id`,n);r&&(this.blockUtils.updateDataIntoRowNode(r.node,e),t.push(r.node))}),t}insertRowNodes(e,t){let n=this.store.getRowCount()-+!!this.store.getParentNode().sibling,r=t==null&&this.isLastRowKnown?n:t;if(r==null||n<r)return[];let i={};e.forEach(e=>{let t=this.getRowId(e);t&&this.isNodeInCache(t)||(i[t]=e)});let a=Object.values(i),o=a.length;if(o===0)return[];let s=this.nodeMap.filter(e=>e.index>=r);return s.forEach(e=>this.nodeMap.delete(e)),s.forEach(e=>{this.nodeMap.set({node:e.node,index:e.index+o,id:e.id})}),this.numberOfRows+=o,a.map((e,t)=>this.createRowAtIndex(r+t,e))}removeRowNodes(e){let t=[],n=[],r=0,i=[...e],a=this.getOrderedNodeMap(),o=-1;for(let e of Object.keys(a)){o+=1;let s=a[e],c=i.findIndex(e=>e===s.id);if(c!==-1){i.splice(c,1),this.destroyRowAtIndex(Number(e)),t.push(s.node),r+=1;continue}if(r===0)continue;let l=Number(e);o!==l&&n.push(s.node),this.nodeMap.delete(s),this.nodeMap.set({id:s.id,node:s.node,index:l-r})}return this.numberOfRows-=this.isLastRowIndexKnown()?e.length:r,i.length>0&&n.length>0&&(n.forEach(e=>e.__needsRefreshWhenVisible=!0),this.lazyBlockLoadingSvc.queueLoadCheck()),t}getBlockSize(){return this.storeParams.cacheBlockSize||a}getBlockStartIndex(e){return e-e%this.getBlockSize()}getBlockBounds(e){let t=this.getBlockStartIndex(e);return[t,t+this.getBlockSize()]}};exports.LazyCache=o;
1
+ const e=require("../../../../community/context/beanStub.cjs"),t=require("../../../../community/validation/logging.cjs"),n=require("../../../../community/gridOptionsUtils.cjs"),r=require("../../../rowGrouping/rowGroupingUtils.cjs"),i=require("./multiIndexMap.cjs");var a=100,o=class extends e.BeanStub{rowRenderer;blockUtils;focusSvc;nodeManager;serverSideRowModel;rowNodeSorter;sortSvc;lazyBlockLoadingSvc;colModel;wireBeans(e){this.rowRenderer=e.rowRenderer,this.blockUtils=e.ssrmBlockUtils,this.focusSvc=e.focusSvc,this.nodeManager=e.ssrmNodeManager,this.serverSideRowModel=e.rowModel,this.rowNodeSorter=e.rowNodeSorter,this.sortSvc=e.sortSvc,this.lazyBlockLoadingSvc=e.lazyBlockLoadingSvc,this.colModel=e.colModel}live=!0;nodeMap;nodeDisplayIndexMap;nodesToRefresh;numberOfRows;isLastRowKnown;defaultNodeIdPrefix;store;storeParams;getRowIdFunc;isMasterDetail;removedNodeCache=new Map;loadedBlocks=new Set;constructor(e,t,n,r){super(),this.store=e,this.numberOfRows=t,this.isLastRowKnown=n,this.storeParams=r}postConstruct(){this.lazyBlockLoadingSvc.subscribe(this),this.nodeMap=new i.MultiIndexMap(`index`,`id`,`node`),this.nodeDisplayIndexMap=new Map,this.nodesToRefresh=new Set;let{blockUtils:e,gos:t,store:r}=this;this.defaultNodeIdPrefix=e.createNodeIdPrefix(r.getParentNode()),this.getRowIdFunc=n._getRowIdCallback(t),this.isMasterDetail=t.get(`masterDetail`)}destroy(){this.lazyBlockLoadingSvc.unsubscribe(this),this.numberOfRows=0,this.nodeMap.forEach(e=>this.blockUtils.destroyRowNode(e.node)),this.nodeMap.clear(),this.nodeDisplayIndexMap.clear(),this.nodesToRefresh.clear(),this.live=!1,super.destroy()}getRowByDisplayIndex(e){if(!this.store.isDisplayIndexInStore(e))return;let t=this.nodeDisplayIndexMap.get(e);if(t)return(t.stub||t.__needsRefreshWhenVisible)&&this.lazyBlockLoadingSvc.queueLoadCheck(),t;if(this.gos.get(`groupHideOpenParents`)||this.gos.get(`groupAllowUnbalanced`)){let t=this.nodeMap.find(t=>!!t.node.childStore?.isDisplayIndexInStore(e));if(t)return t.node.childStore?.getRowUsingDisplayIndex(e)}if(e===this.store.getDisplayIndexStart())return this.createStubNode(0,e);let n=this.nodeDisplayIndexMap.get(e-1);if(n){if(this.isMasterDetail&&n.master&&n.expanded)return n.detailNode;if(n.expanded&&n.childStore?.isDisplayIndexInStore(e))return n.childStore?.getRowUsingDisplayIndex(e);let t=this.nodeMap.getBy(`node`,n);return this.createStubNode(t.index+1,e)}let r=this.getSurroundingNodesByDisplayIndex(e);if(r==null){let t=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(t,e)}let{previousNode:i,nextNode:a}=r;if(i?.node.expanded&&i.node.childStore?.isDisplayIndexInStore(e))return i.node.childStore?.getRowUsingDisplayIndex(e);if(a){let t=a.node.rowIndex-e,n=a.index-t;return this.createStubNode(n,e)}let o=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(o,e)}createStubNode(e,t){let n=this.store.getRowBounds(t),i=this.createRowAtIndex(e,null,e=>{e.setRowIndex(t),e.setRowTop(n.rowTop),this.nodeDisplayIndexMap.set(t,e)}),a=this.getBlockStartIndex(e);if(this.loadedBlocks.has(a)&&(i.__wasEvicted=!0),e===0&&this.gos.get(`groupHideOpenParents`)){let e=this.store.getParentNode().groupData;if(e)for(let t of Object.keys(e))r.setRowNodeGroupValue(i,this.colModel,t,e[t])}return this.lazyBlockLoadingSvc.queueLoadCheck(),i}getRowByStoreIndex(e){return this.nodeMap.getBy(`index`,e)?.node}skipDisplayIndexes(e,t,r){if(e===0)return;let i=n._getRowHeightAsNumber(this.beans);t.value+=e,r.value+=e*i}setDisplayIndexes(e,t,n){this.nodeDisplayIndexMap.clear();let i={};this.nodeMap.forEach(e=>{i[e.index]=e.node});let a=-1;for(let o of Object.keys(i)){let s=i[o],c=Number(o),l=c-1-a;this.skipDisplayIndexes(l,e,t);let u=c===0;if(s.firstChild!==u&&(s.firstChild=u,s.dispatchRowEvent(`firstChildChanged`)),u&&this.gos.get(`groupHideOpenParents`)){let e=this.store.getParentNode().groupData;if(e)for(let t of Object.keys(e))r.setRowNodeGroupValue(s,this.colModel,t,u?e[t]:void 0)}this.blockUtils.setDisplayIndex(s,e,t,n),s.rowIndex!=null&&this.nodeDisplayIndexMap.set(s.rowIndex,s),a=c}let o=this.numberOfRows-1-a;this.skipDisplayIndexes(o,e,t),this.purgeExcessRows()}getRowCount(){return this.numberOfRows}hasLoadedDataAfter(e){let t=!1;return this.nodeMap.forEach(n=>{n.index>e&&!n.node.stub&&!n.node.failedLoad&&(t=!0)}),t}setRowCount(e,t){this.numberOfRows=e,t!=null&&(this.isLastRowKnown=t,t===!1&&(this.numberOfRows+=1)),this.fireStoreUpdatedEvent()}getNodes(){return this.nodeMap}getNodeCachedByDisplayIndex(e){return this.nodeDisplayIndexMap.get(e)??null}getNodesToRefresh(){return this.nodesToRefresh}getSurroundingNodesByDisplayIndex(e){let t,n;return this.nodeMap.forEach(r=>{if(e>r.node.rowIndex){(n==null||n.node.rowIndex<r.node.rowIndex)&&(n=r);return}(t==null||t.node.rowIndex>r.node.rowIndex)&&(t=r)}),!n&&!t?null:{previousNode:n,nextNode:t}}getDisplayIndexFromStoreIndex(e){let t=this.nodeMap.getBy(`index`,e);if(t)return t.node.rowIndex;let n,r;if(this.nodeMap.forEach(t=>{if(e>t.index){(r==null||r.index<t.index)&&(r=t);return}(n==null||n.index>t.index)&&(n=t)}),!n)return this.store.getDisplayIndexEnd()-(this.numberOfRows-e);if(!r)return this.store.getDisplayIndexStart()+e;let i=e-r.index;return(r.node.childStore?.getDisplayIndexEnd()??r.node.rowIndex)+i}createRowAtIndex(e,t,n){let r=this.nodeMap.getBy(`index`,e);if(r){let{node:n}=r;if(n.__needsRefreshWhenVisible=!1,this.doesNodeMatch(t,n))return this.blockUtils.updateDataIntoRowNode(n,t),this.nodesToRefresh.delete(n),n;if(this.getRowIdFunc==null&&n.hasChildren()&&n.expanded)return this.nodesToRefresh.delete(n),n;this.destroyRowAtIndex(e)}if(t&&this.getRowIdFunc!=null){let n=this.getRowId(t),r=n&&this.removedNodeCache?.get(n);if(r)return this.removedNodeCache?.delete(n),this.blockUtils.updateDataIntoRowNode(r,t),this.nodeMap.set({id:r.id,node:r,index:e}),this.nodesToRefresh.delete(r),r.__needsRefreshWhenVisible=!1,r;let i=this.nodeMap.getBy(`id`,n);if(i){this.nodeMap.delete(i);let{node:n,index:r}=i;return this.blockUtils.updateDataIntoRowNode(n,t),this.nodeMap.set({id:n.id,node:n,index:e}),this.nodesToRefresh.delete(n),n.__needsRefreshWhenVisible=!1,this.getBlockStartIndex(r)===this.getBlockStartIndex(e)||this.markBlockForVerify(r),n}}let i=this.blockUtils.createRowNode(this.store.getRowDetails());if(t!=null){let e=this.getPrefixedId(this.store.getIdSequence().value++);this.blockUtils.setDataIntoRowNode(i,t,e,void 0),this.blockUtils.checkOpenByDefault(i),this.nodeManager.addRowNode(i)}return this.nodeMap.set({id:i.id,node:i,index:e}),n&&n(i),i}getBlockStates(){let e={},t={};this.nodeMap.forEach(({node:n,index:r})=>{let i=this.getBlockStartIndex(r);!n.stub&&!n.failedLoad&&(e[i]=(e[i]??0)+1);let a=`loaded`;n.failedLoad?a=`failed`:this.lazyBlockLoadingSvc.isRowLoading(this,i)?a=`loading`:(this.nodesToRefresh.has(n)||n.stub)&&(a=`needsLoading`),t[i]||(t[i]=new Set),t[i].add(a)});let n={loading:4,failed:3,needsLoading:2,loaded:1},r=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),i={};for(let a of Object.keys(t)){let o=[...t[a]].sort((e,t)=>(n[e]??0)-(n[t]??0))[0],s=Number(a)/this.getBlockSize(),c=r?`${r}-${s}`:String(s);i[c]={blockNumber:s,startRow:Number(a),endRow:Number(a)+this.getBlockSize(),pageStatus:o,loadedRowCount:e[a]??0}}return i}destroyRowAtIndex(e){let t=this.nodeMap.getBy(`index`,e);t&&(this.nodeMap.delete(t),this.nodeDisplayIndexMap.delete(t.node.rowIndex),this.nodesToRefresh.size>0?this.removedNodeCache.set(t.node.id,t.node):this.blockUtils.destroyRowNode(t.node),this.nodesToRefresh.delete(t.node))}getSsrmParams(){return this.store.getSsrmParams()}getPrefixedId(e){return this.defaultNodeIdPrefix?this.defaultNodeIdPrefix+`-`+e:e.toString()}markBlockForVerify(e){let[t,n]=this.getBlockBounds(e);this.nodeMap.filter(e=>e.index>=t&&e.index<n).forEach(({node:e})=>{e.__needsRefreshWhenVisible=!0})}doesNodeMatch(e,t){if(t.stub)return!1;let n=this.getRowId(e);return n===null?t.data===e:t.id===n}purgeStubsOutsideOfViewport(){let{firstRenderedRow:e,lastRenderedRow:t}=this.rowRenderer,n=this.getBlockStartIndex(e),[,r]=this.getBlockBounds(t);this.nodeMap.forEach(e=>{this.lazyBlockLoadingSvc.isRowLoading(this,e.index)||e.node.failedLoad||e.node.stub&&(e.index<n||e.index>r)&&this.destroyRowAtIndex(e.index)})}getBlocksDistanceFromRow(e,t){let n={};return e.forEach(({node:e,index:r})=>{let[i,a]=this.getBlockBounds(r);if(i in n)return;let o=Math.abs(e.rowIndex-t),s,c=this.nodeMap.getBy(`index`,[a-1]);c&&(s=Math.abs(c.node.rowIndex-t)),n[i]=s==null||o<s?o:s}),Object.entries(n)}purgeExcessRows(){if(this.purgeStubsOutsideOfViewport(),this.store.getDisplayIndexEnd()==null||this.storeParams.maxBlocksInCache==null)return;let{firstRenderedRow:e,lastRenderedRow:t}=this.rowRenderer,n=new Set,r=new Set;this.nodeMap.forEach(({index:i,node:a})=>{let o=this.getBlockStartIndex(i);n.add(o),a.rowIndex>=e&&a.rowIndex<=t&&r.add(o)});let i=Math.max(r.size,this.storeParams.maxBlocksInCache??0),a=n.size-i;if(a<=0)return;let o=2**53-1,s=-(2**53-1);r.forEach(e=>{o>e&&(o=e),s<e&&(s=e)});let c=this.nodeMap.filter(({node:e,index:t})=>{let n=this.getBlockStartIndex(t);return!(n>=o&&n<=s)&&!this.isNodeCached(e)});if(c.length===0)return;let l=e+(t-e)/2,u=this.getBlocksDistanceFromRow(c,l),d=this.getBlockSize();u.sort((e,t)=>Math.sign(t[1]-e[1]));for(let e=0;e<Math.min(a,u.length);e++){let t=Number(u[e][0]);for(let e=t;e<t+d;e++){let t=this.nodeMap.getBy(`index`,e);!t||this.isNodeCached(t.node)||this.destroyRowAtIndex(e)}}}isNodeFocused(e){let t=this.focusSvc.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e.rowIndex}isNodeCached(e){let t=e.isExpandable()&&e.expanded,n=this.gos.get(`groupAllowUnbalanced`)&&e.key===``,r=!!this.beans.editSvc?.isRowEditing(e);return t||this.isNodeFocused(e)||n||r}extractDuplicateIds(e){if(this.getRowIdFunc==null)return[];let t=new Set,n=new Set;return e.forEach(e=>{let r=this.getRowId(e);if(t.has(r)){n.add(r);return}t.add(r)}),[...n]}onLoadStarted(e,t){if(!this.live)return;let n=e+t-1;if(!(this.gos.get(`collapseLoadingRows`)&&!this.hasLoadedDataAfter(n)))return;let r=e+1;this.numberOfRows<=r&&!this.isLastRowKnown||(this.nodeMap.filter(e=>e.index>=r).forEach(e=>{this.nodesToRefresh.delete(e.node),this.destroyRowAtIndex(e.index)}),this.numberOfRows=r,this.isLastRowKnown=!1,this.fireStoreUpdatedEvent())}onLoadSuccess(e,n,r){if(!this.live)return;let i=r.groupLevelInfo;if(this.store.setStoreInfo(i),this.getRowIdFunc!=null){let i=this.extractDuplicateIds(r.rowData);if(i.length>0){t._warn(205,{duplicateIdText:i.join(`, `)}),this.onLoadFailed(e,n);return}}r.pivotResultFields&&this.serverSideRowModel.generateSecondaryColumns(r.pivotResultFields);let a=this.nodesToRefresh.size>0;r.rowData.forEach((t,n)=>{let r=e+n,i=this.nodeMap.getBy(`index`,r);if(i?.node?.stub){this.createRowAtIndex(r,t);return}if(i&&this.doesNodeMatch(t,i.node)){this.blockUtils.updateDataIntoRowNode(i.node,t),this.nodesToRefresh.delete(i.node),i.node.__needsRefreshWhenVisible=!1;return}this.createRowAtIndex(r,t)});let o=this.getBlockStartIndex(e);if(this.loadedBlocks.add(o),r.rowCount!=null&&r.rowCount!==-1)this.numberOfRows=r.rowCount,this.isLastRowKnown=!0;else if(n>r.rowData.length)this.numberOfRows=e+r.rowData.length,this.isLastRowKnown=!0;else if(!this.isLastRowKnown){let t=e+r.rowData.length+1;t>this.numberOfRows&&(this.numberOfRows=t)}this.isLastRowKnown&&this.nodeMap.filter(e=>e.index>=this.numberOfRows).forEach(e=>this.destroyRowAtIndex(e.index)),this.fireStoreUpdatedEvent();let s=this.nodesToRefresh.size===0;a&&s&&this.fireRefreshFinishedEvent()}fireRefreshFinishedEvent(){this.nodesToRefresh.size===0&&(this.removedNodeCache.forEach(e=>{this.blockUtils.destroyRowNode(e)}),this.removedNodeCache=new Map,this.store.fireRefreshFinishedEvent())}isStoreFullyLoaded(){let e=this.isLastRowKnown,t=this.nodeMap.getSize()===this.numberOfRows;if(!e||!t||this.nodesToRefresh.size>0)return;let n=-1;return this.nodeMap.find(e=>(n+=1,!!(e.index!==n||e.node.__needsRefreshWhenVisible||e.node.stub)))==null}isLastRowIndexKnown(){return this.isLastRowKnown}onLoadFailed(e,t){if(!this.live)return;let n=this.nodesToRefresh.size>0,r=e+t-1,i=this.gos.get(`collapseFailedRows`)&&!this.hasLoadedDataAfter(r);if(i){let t=e+1;this.nodeMap.filter(e=>e.index>=t).forEach(e=>{this.nodesToRefresh.delete(e.node),this.destroyRowAtIndex(e.index)}),this.numberOfRows=t,this.isLastRowKnown=!0}else this.numberOfRows<e+t&&(this.numberOfRows=e+t,this.isLastRowKnown=!1);let a=i?e:Math.min(e+t,this.getRowCount())-1;for(let t=e;t<=a;t++){let{node:e}=this.nodeMap.getBy(`index`,t)??{};e&&this.nodesToRefresh.delete(e),e?.stub||(e&&!e.stub&&this.destroyRowAtIndex(t),e=this.createRowAtIndex(t)),e.__needsRefreshWhenVisible=!1,e.failedLoad=!0}let o=this.nodesToRefresh.size===0;n&&o&&this.fireRefreshFinishedEvent(),this.fireStoreUpdatedEvent()}markNodesForRefresh(){this.nodeMap.forEach(e=>{e.node.stub&&!e.node.failedLoad||this.nodesToRefresh.add(e.node)}),this.lazyBlockLoadingSvc.queueLoadCheck(),this.isLastRowKnown&&this.numberOfRows===0&&(this.numberOfRows=1,this.isLastRowKnown=!1,this.fireStoreUpdatedEvent())}isNodeInCache(e){return!!this.nodeMap.getBy(`id`,e)}fireStoreUpdatedEvent(){this.live&&this.store.fireStoreUpdatedEvent()}getRowId(e){if(this.getRowIdFunc==null)return null;let{level:t}=this.store.getRowDetails(),n=this.store.getParentNode().getRoute()??[];return this.getRowIdFunc({data:e,parentKeys:n.length>0?n:void 0,level:t})}getOrderedNodeMap(){let e={};return this.nodeMap.forEach(t=>e[t.index]=t),e}clearDisplayIndexes(){this.nodeDisplayIndexMap.clear()}clientSideSortRows(){let e=this.sortSvc?.getSortOptions()??[],t=e.some(e=>e.sort!=null),n=this.rowNodeSorter;if(!t||!n)return;let r=Array(this.nodeMap.getSize()),i=this.nodeMap;i.forEach(e=>r[e.index]=e.node),i.clear();let a=n.doFullSortInPlace(r,e);for(let e=0,t=a.length;e<t;++e){let t=a[e];i.set({id:t.id,node:t,index:e})}}updateRowNodes(e){let t=[];return e.forEach(e=>{let n=this.getRowId(e),r=this.nodeMap.getBy(`id`,n);r&&(this.blockUtils.updateDataIntoRowNode(r.node,e),t.push(r.node))}),t}insertRowNodes(e,t){let n=this.store.getRowCount()-+!!this.store.getParentNode().sibling,r=t==null&&this.isLastRowKnown?n:t;if(r==null||n<r)return[];let i={};e.forEach(e=>{let t=this.getRowId(e);t&&this.isNodeInCache(t)||(i[t]=e)});let a=Object.values(i),o=a.length;if(o===0)return[];let s=this.nodeMap.filter(e=>e.index>=r);return s.forEach(e=>this.nodeMap.delete(e)),s.forEach(e=>{this.nodeMap.set({node:e.node,index:e.index+o,id:e.id})}),this.numberOfRows+=o,a.map((e,t)=>this.createRowAtIndex(r+t,e))}removeRowNodes(e){let t=[],n=[],r=0,i=[...e],a=this.getOrderedNodeMap(),o=-1;for(let e of Object.keys(a)){o+=1;let s=a[e],c=i.findIndex(e=>e===s.id);if(c!==-1){i.splice(c,1),this.destroyRowAtIndex(Number(e)),t.push(s.node),r+=1;continue}if(r===0)continue;let l=Number(e);o!==l&&n.push(s.node),this.nodeMap.delete(s),this.nodeMap.set({id:s.id,node:s.node,index:l-r})}return this.numberOfRows-=this.isLastRowIndexKnown()?e.length:r,i.length>0&&n.length>0&&(n.forEach(e=>e.__needsRefreshWhenVisible=!0),this.lazyBlockLoadingSvc.queueLoadCheck()),t}getBlockSize(){return this.storeParams.cacheBlockSize||a}getBlockStartIndex(e){return e-e%this.getBlockSize()}getBlockBounds(e){let t=this.getBlockStartIndex(e);return[t,t+this.getBlockSize()]}};exports.LazyCache=o;
@@ -99,6 +99,14 @@ export declare class LazyCache extends BeanStub {
99
99
  value: number;
100
100
  }, uiLevel: number): void;
101
101
  getRowCount(): number;
102
+ /**
103
+ * @returns true if any row strictly after the given store index is loaded data
104
+ * (a real, non-stub, non-failed node). Used to decide whether a
105
+ * loading/failed block can be physically collapsed: collapsing truncates the
106
+ * row count, so it is only safe when there is no already-loaded data below the
107
+ * block that would be destroyed.
108
+ */
109
+ private hasLoadedDataAfter;
102
110
  setRowCount(rowCount: number, isLastRowIndexKnown?: boolean): void;
103
111
  getNodes(): MultiIndexMap<LazyStoreNode, "id" | "index" | "node">;
104
112
  getNodeCachedByDisplayIndex(displayIndex: number): RowNode | null;
@@ -144,6 +152,17 @@ export declare class LazyCache extends BeanStub {
144
152
  private isNodeFocused;
145
153
  private isNodeCached;
146
154
  private extractDuplicateIds;
155
+ /**
156
+ * Called when a block's request is fired (before the response). When
157
+ * collapseLoadingRows is on and there is no already-loaded data below the block,
158
+ * physically collapse the loading block to a single loading row: keep one stub
159
+ * at firstRowIndex, drop the rest of the block and any rows after it, and mark
160
+ * the end as unknown (there is more data below). onLoadSuccess/onLoadFailed
161
+ * restore the real count when the response arrives. When there IS loaded data
162
+ * below (a middle block), the count is left intact and the renderer collapses
163
+ * the block visually instead.
164
+ */
165
+ onLoadStarted(firstRowIndex: number, numberOfRowsExpected: number): void;
147
166
  onLoadSuccess(firstRowIndex: number, numberOfRowsExpected: number, response: LoadSuccessParams): void;
148
167
  fireRefreshFinishedEvent(): void;
149
168
  /**