Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ag-grid-community/client-side-row-model

Package Overview
Dependencies
Maintainers
3
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ag-grid-community/client-side-row-model - npm Package Compare versions

Comparing version 32.2.0 to 32.2.1

2

dist/package/main.cjs.min.js

@@ -1,1 +0,1 @@

var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of __getOwnPropNames(t))!__hasOwnProp.call(e,r)&&r!==o&&__defProp(e,r,{get:()=>t[r],enumerable:!(i=__getOwnPropDesc(t,r))||i.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{ClientSideRowModelModule:()=>ClientSideRowModelModule}),module.exports=__toCommonJS(main_exports);var import_core9=require("@ag-grid-community/core"),import_core10=require("@ag-grid-community/core"),import_core2=require("@ag-grid-community/core"),import_core=require("@ag-grid-community/core"),ROOT_NODE_ID="ROOT_NODE_ID",TOP_LEVEL=0,ClientSideNodeManager=class{constructor(e,t,o,i,r,s){this.nextId=0,this.rowCountReady=!1,this.allNodesMap={},this.rootNode=e,this.gos=t,this.eventService=o,this.funcColsService=i,this.beans=s,this.selectionService=r,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id=ROOT_NODE_ID,this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterAggFilter=[],this.rootNode.childrenAfterFilter=[]}getCopyOfNodesMap(){return(0,import_core._cloneObject)(this.allNodesMap)}getRowNode(e){return this.allNodesMap[e]}setRowData(e){if(typeof e=="string"){(0,import_core._warnOnce)("rowData must be an array.");return}this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e);const t=this.rootNode,o=this.rootNode.sibling;t.childrenAfterFilter=null,t.childrenAfterGroup=null,t.childrenAfterAggFilter=null,t.childrenAfterSort=null,t.childrenMapped=null,t.updateHasChildren(),this.nextId=0,this.allNodesMap={},e?t.allLeafChildren=e.map((i,r)=>this.createNode(i,this.rootNode,TOP_LEVEL,r)):(t.allLeafChildren=[],t.childrenAfterGroup=[]),o&&(o.childrenAfterFilter=t.childrenAfterFilter,o.childrenAfterGroup=t.childrenAfterGroup,o.childrenAfterAggFilter=t.childrenAfterAggFilter,o.childrenAfterSort=t.childrenAfterSort,o.childrenMapped=t.childrenMapped,o.allLeafChildren=t.allLeafChildren)}updateRowData(e){this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e.add);const t={rowNodeTransaction:{remove:[],update:[],add:[]},rowsInserted:!1},o=[];return this.executeRemove(e,t,o),this.executeUpdate(e,t,o),this.executeAdd(e,t),this.updateSelection(o,"rowDataChanged"),t}updateRowOrderFromRowData(e){const t=this.rootNode.allLeafChildren,o=t?.length??0,i=new Map;let r=-1,s=-1;for(let n=0;n<o;++n){const l=t[n],a=l.data;a!==e[n]&&(s<0&&(r=n),s=n,i.set(a,l))}if(r<0)return!1;for(let n=r;n<=s;++n){const l=i.get(e[n]);l!==void 0&&(t[n]=l,l.sourceRowIndex=n)}return!0}isRowCountReady(){return this.rowCountReady}dispatchRowDataUpdateStartedEvent(e){this.eventService.dispatchEvent({type:"rowDataUpdateStarted",firstRowData:e?.length?e[0]:null})}updateSelection(e,t){const o=e.length>0;o&&this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,source:t}),this.selectionService.updateGroupsFromChildrenSelections(t),o&&this.eventService.dispatchEvent({type:"selectionChanged",source:t})}executeAdd(e,t){const o=e.add;if((0,import_core._missingOrEmpty)(o))return;const i=this.rootNode.allLeafChildren;let r=i.length;if(typeof e.addIndex=="number"&&(r=this.sanitizeAddIndex(e.addIndex),r>0&&this.gos.get("treeData"))){for(let a=0;a<i.length;a++)if(i[a]?.rowIndex==r-1){r=a+1;break}}const s=o.map((l,a)=>this.createNode(l,this.rootNode,TOP_LEVEL,r+a));if(r<i.length){const l=i.slice(0,r),a=i.slice(r,i.length),c=l.length+s.length;for(let u=0,h=a.length;u<h;++u)a[u].sourceRowIndex=c+u;this.rootNode.allLeafChildren=[...l,...s,...a],t.rowsInserted=!0}else this.rootNode.allLeafChildren=i.concat(s);const n=this.rootNode.sibling;n&&(n.allLeafChildren=i),t.rowNodeTransaction.add=s}sanitizeAddIndex(e){const t=this.rootNode.allLeafChildren?.length??0;return e<0||e>=t||Number.isNaN(e)?t:Math.ceil(e)}executeRemove(e,{rowNodeTransaction:t},o){const{remove:i}=e;if((0,import_core._missingOrEmpty)(i))return;const r={};i.forEach(n=>{const l=this.lookupRowNode(n);l&&(l.isSelected()&&o.push(l),l.clearRowTopAndRowIndex(),r[l.id]=!0,delete this.allNodesMap[l.id],t.remove.push(l))}),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren?.filter(n=>!r[n.id])??null,this.rootNode.allLeafChildren?.forEach((n,l)=>{n.sourceRowIndex=l});const s=this.rootNode.sibling;s&&(s.allLeafChildren=this.rootNode.allLeafChildren)}executeUpdate(e,{rowNodeTransaction:t},o){const{update:i}=e;(0,import_core._missingOrEmpty)(i)||i.forEach(r=>{const s=this.lookupRowNode(r);s&&(s.updateData(r),!s.selectable&&s.isSelected()&&o.push(s),this.setMasterForRow(s,r,TOP_LEVEL,!1),t.update.push(s))})}lookupRowNode(e){const t=(0,import_core._getRowIdCallback)(this.gos);let o;if(t){const i=t({data:e,level:0});if(o=this.allNodesMap[i],!o)return(0,import_core._errorOnce)(`could not find row id=${i}, data item was not found for this id`),null}else if(o=this.rootNode.allLeafChildren?.find(i=>i.data===e),!o)return(0,import_core._errorOnce)("could not find data item as object was not found",e),(0,import_core._errorOnce)("Consider using getRowId to help the Grid find matching row data"),null;return o||null}createNode(e,t,o,i){const r=new import_core.RowNode(this.beans);return r.sourceRowIndex=i,r.group=!1,this.setMasterForRow(r,e,o,!0),t&&(r.parent=t),r.level=o,r.setDataAndId(e,this.nextId.toString()),this.allNodesMap[r.id]&&(0,import_core._warnOnce)(`duplicate node id '${r.id}' detected from getRowId callback, this could cause issues in your grid.`),this.allNodesMap[r.id]=r,this.nextId++,r}setMasterForRow(e,t,o,i){if(this.gos.get("treeData"))e.setMaster(!1),i&&(e.expanded=!1);else{if(this.gos.get("masterDetail")){const n=this.gos.get("isRowMaster");n?e.setMaster(n(t)):e.setMaster(!0)}else e.setMaster(!1);if(i){const n=this.funcColsService.getRowGroupColumns(),l=n?n.length:0,a=o+l;e.expanded=e.master?this.isExpanded(a):!1}}}isExpanded(e){const t=this.gos.get("groupDefaultExpanded");return t===-1?!0:e<t}},ClientSideRowModel=class extends import_core2.BeanStub{constructor(){super(...arguments),this.beanName="rowModel",this.onRowHeightChanged_debounced=(0,import_core2._debounce)(this.onRowHeightChanged.bind(this),100),this.rowsToDisplay=[],this.hasStarted=!1,this.shouldSkipSettingDataOnStart=!1,this.isRefreshingModel=!1,this.rowCountReady=!1}wireBeans(e){this.beans=e,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.selectionService=e.selectionService,this.valueCache=e.valueCache,this.environment=e.environment,this.filterStage=e.filterStage,this.sortStage=e.sortStage,this.flattenStage=e.flattenStage,this.groupStage=e.groupStage,this.aggregationStage=e.aggregationStage,this.pivotStage=e.pivotStage,this.filterAggregatesStage=e.filterAggregatesStage}postConstruct(){const e=this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.EVERYTHING}),t=!this.gos.get("suppressAnimationFrame"),o=this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.EVERYTHING,afterColumnsChanged:!0,keepRenderedRows:!0,animate:t});this.addManagedEventListeners({newColumnsLoaded:o,columnRowGroupChanged:e,columnValueChanged:this.onValueChanged.bind(this),columnPivotChanged:this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.PIVOT}),filterChanged:this.onFilterChanged.bind(this),sortChanged:this.onSortChanged.bind(this),columnPivotModeChanged:e,gridStylesChanged:this.onGridStylesChanges.bind(this),gridReady:this.onGridReady.bind(this)}),this.addPropertyListeners(),this.rootNode=new import_core2.RowNode(this.beans),this.nodeManager=new ClientSideNodeManager(this.rootNode,this.gos,this.eventService,this.funcColsService,this.selectionService,this.beans)}addPropertyListeners(){const e=new Set(["treeData","masterDetail"]),t=new Set(["groupDefaultExpanded","groupAllowUnbalanced","initialGroupOrderComparator","groupHideOpenParents","groupDisplayType"]),o=new Set(["excludeChildrenWhenTreeDataFiltering"]),i=new Set(["removePivotHeaderRowWhenSingleValueColumn","pivotRowTotals","pivotColumnGroupTotals","suppressExpandablePivotGroups"]),r=new Set(["getGroupRowAgg","alwaysAggregateAtRootLevel","groupIncludeTotalFooter","suppressAggFilteredOnly","grandTotalRow"]),s=new Set(["postSortRows","groupDisplayType","accentedSort"]),n=new Set([]),l=new Set(["groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupIncludeFooter","groupTotalRow"]),a=[...e,...t,...o,...i,...i,...r,...s,...n,...l];this.addManagedPropertyListeners(a,c=>{const u=c.changeSet?.properties;if(!u)return;const h=d=>u.some(w=>d.has(w));if(h(e)){this.setRowData(this.rootNode.allLeafChildren.map(d=>d.data));return}if(h(t)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING});return}if(h(o)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER});return}if(h(i)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT});return}if(h(r)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE});return}if(h(s)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT});return}if(h(n)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES});return}h(l)&&this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP})}),this.addManagedPropertyListener("rowHeight",()=>this.resetRowHeights())}start(){this.hasStarted=!0,this.shouldSkipSettingDataOnStart?this.dispatchUpdateEventsAndRefresh():this.setInitialData()}setInitialData(){const e=this.gos.get("rowData");e&&(this.shouldSkipSettingDataOnStart=!0,this.setRowData(e))}ensureRowHeightsValid(e,t,o,i){let r,s=!1;do{r=!1;const n=this.getRowIndexAtPixel(e),l=this.getRowIndexAtPixel(t),a=Math.max(n,o),c=Math.min(l,i);for(let u=a;u<=c;u++){const h=this.getRow(u);if(h.rowHeightEstimated){const d=(0,import_core2._getRowHeightForNode)(this.gos,h);h.setRowHeight(d.height),r=!0,s=!0}}r&&this.setRowTopAndRowIndex()}while(r);return s}setRowTopAndRowIndex(){const e=this.environment.getDefaultRowHeight();let t=0;const o=new Set,i=(0,import_core2._isDomLayout)(this.gos,"normal");for(let r=0;r<this.rowsToDisplay.length;r++){const s=this.rowsToDisplay[r];if(s.id!=null&&o.add(s.id),s.rowHeight==null){const n=(0,import_core2._getRowHeightForNode)(this.gos,s,i,e);s.setRowHeight(n.height,n.estimated)}s.setRowTop(t),s.setRowIndex(r),t+=s.rowHeight}return o}clearRowTopAndRowIndex(e,t){const o=e.isActive(),i=s=>{s&&s.id!=null&&!t.has(s.id)&&s.clearRowTopAndRowIndex()},r=s=>{if(i(s),i(s.detailNode),i(s.sibling),s.hasChildren()&&s.childrenAfterGroup){const n=s.level==-1;o&&!n&&!s.expanded||s.childrenAfterGroup.forEach(r)}};r(this.rootNode)}ensureRowsAtPixel(e,t,o=0){const i=this.getRowIndexAtPixel(t),r=this.getRow(i),s=!this.gos.get("suppressAnimationFrame");if(r===e[0])return!1;const n=this.rootNode.allLeafChildren;return e.forEach(l=>{(0,import_core2._removeFromArray)(n,l)}),e.forEach((l,a)=>{(0,import_core2._insertIntoArray)(n,l,Math.max(i+o,0)+a)}),e.forEach((l,a)=>{l.sourceRowIndex=a}),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,keepRenderedRows:!0,keepEditingRows:!0,animate:s,rowNodesOrderChanged:!0}),!0}highlightRowAtPixel(e,t){const o=t!=null?this.getRowIndexAtPixel(t):null,i=o!=null?this.getRow(o):null;if(!i||!e||i===e||t==null){this.lastHighlightedRow&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null);return}const r=this.getHighlightPosition(t,i);this.lastHighlightedRow&&this.lastHighlightedRow!==i&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null),i.setHighlighted(r),this.lastHighlightedRow=i}getHighlightPosition(e,t){if(!t){const r=this.getRowIndexAtPixel(e);if(t=this.getRow(r||0),!t)return import_core2.RowHighlightPosition.Below}const{rowTop:o,rowHeight:i}=t;return e-o<i/2?import_core2.RowHighlightPosition.Above:import_core2.RowHighlightPosition.Below}getLastHighlightedRowNode(){return this.lastHighlightedRow}isLastRowIndexKnown(){return!0}getRowCount(){return this.rowsToDisplay?this.rowsToDisplay.length:0}getTopLevelRowCount(){if(this.rowsToDisplay.length===0)return 0;if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return 1;const t=this.rootNode.childrenAfterAggFilter,o=this.rootNode.sibling?1:0;return(t?t.length:0)+o}getTopLevelRowDisplayedIndex(e){if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return e;let o=e;if(this.rowsToDisplay[0].footer){if(e===0)return 0;o-=1}const i=this.rowsToDisplay[this.rowsToDisplay.length-1],r=o>=this.rootNode.childrenAfterSort.length;if(i.footer&&r)return i.rowIndex;let s=this.rootNode.childrenAfterSort[o];if(this.gos.get("groupHideOpenParents"))for(;s.expanded&&s.childrenAfterSort&&s.childrenAfterSort.length>0;)s=s.childrenAfterSort[0];return s.rowIndex}getRowBounds(e){if((0,import_core2._missing)(this.rowsToDisplay))return null;const t=this.rowsToDisplay[e];return t?{rowTop:t.rowTop,rowHeight:t.rowHeight}:null}onRowGroupOpened(){const e=(0,import_core2._isAnimateRows)(this.gos);this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:e})}onFilterChanged(e){if(e.afterDataChange)return;const t=(0,import_core2._isAnimateRows)(this.gos),i=e.columns.length===0||e.columns.some(r=>r.isPrimary())?import_core2.ClientSideRowModelSteps.FILTER:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES;this.refreshModel({step:i,keepRenderedRows:!0,animate:t})}onSortChanged(){const e=(0,import_core2._isAnimateRows)(this.gos);this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT,keepRenderedRows:!0,animate:e,keepEditingRows:!0})}getType(){return"clientSide"}onValueChanged(){this.columnModel.isPivotActive()?this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT}):this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE})}createChangePath(e){const t=(0,import_core2._missingOrEmpty)(e),o=new import_core2.ChangedPath(!1,this.rootNode);return t&&o.setInactive(),o}isSuppressModelUpdateAfterUpdateTransaction(e){if(!this.gos.get("suppressModelUpdateAfterUpdateTransaction")||e.rowNodeTransactions==null)return!1;const t=e.rowNodeTransactions.filter(i=>i.add!=null&&i.add.length>0||i.remove!=null&&i.remove.length>0);return t==null||t.length==0}buildRefreshModelParams(e){let t=import_core2.ClientSideRowModelSteps.EVERYTHING;const o={everything:import_core2.ClientSideRowModelSteps.EVERYTHING,group:import_core2.ClientSideRowModelSteps.EVERYTHING,filter:import_core2.ClientSideRowModelSteps.FILTER,map:import_core2.ClientSideRowModelSteps.MAP,aggregate:import_core2.ClientSideRowModelSteps.AGGREGATE,sort:import_core2.ClientSideRowModelSteps.SORT,pivot:import_core2.ClientSideRowModelSteps.PIVOT};if((0,import_core2._exists)(e)&&(t=o[e]),(0,import_core2._missing)(t)){(0,import_core2._errorOnce)(`invalid step ${e}, available steps are ${Object.keys(o).join(", ")}`);return}const i=!this.gos.get("suppressAnimationFrame");return{step:t,keepRenderedRows:!0,keepEditingRows:!0,animate:i}}refreshModel(e){if(!this.hasStarted||this.isRefreshingModel||this.columnModel.isChangeEventsDispatching())return;const t=typeof e=="object"&&"step"in e?e:this.buildRefreshModelParams(e);if(!t||this.isSuppressModelUpdateAfterUpdateTransaction(t))return;const o=this.createChangePath(t.rowNodeTransactions);switch(this.isRefreshingModel=!0,t.step){case import_core2.ClientSideRowModelSteps.EVERYTHING:this.doRowGrouping(t.rowNodeTransactions,o,!!t.rowNodesOrderChanged,!!t.afterColumnsChanged);case import_core2.ClientSideRowModelSteps.FILTER:this.doFilter(o);case import_core2.ClientSideRowModelSteps.PIVOT:this.doPivot(o);case import_core2.ClientSideRowModelSteps.AGGREGATE:this.doAggregate(o);case import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES:this.doFilterAggregates(o);case import_core2.ClientSideRowModelSteps.SORT:this.doSort(t.rowNodeTransactions,o);case import_core2.ClientSideRowModelSteps.MAP:this.doRowsToDisplay()}const i=this.setRowTopAndRowIndex();this.clearRowTopAndRowIndex(o,i),this.isRefreshingModel=!1,this.eventService.dispatchEvent({type:"modelUpdated",animate:t.animate,keepRenderedRows:t.keepRenderedRows,newData:t.newData,newPage:!1,keepUndoRedoStack:t.keepUndoRedoStack})}isEmpty(){const e=(0,import_core2._missing)(this.rootNode.allLeafChildren)||this.rootNode.allLeafChildren.length===0;return(0,import_core2._missing)(this.rootNode)||e||!this.columnModel.isReady()}isRowsToRender(){return(0,import_core2._exists)(this.rowsToDisplay)&&this.rowsToDisplay.length>0}getNodesInRangeForSelection(e,t){let o=!1,i=!1;const r=[],s=(0,import_core2._getGroupSelectsDescendants)(this.gos);return this.forEachNodeAfterFilterAndSort(n=>{if(i)return;if(o&&(n===t||n===e)&&(i=!0,n.group&&s)){r.push(...n.allLeafChildren);return}if(!o){if(n!==t&&n!==e)return;o=!0}if(!n.group||!s){r.push(n);return}}),r}setDatasource(e){(0,import_core2._errorOnce)("should never call setDatasource on clientSideRowController")}getTopLevelNodes(){return this.rootNode?this.rootNode.childrenAfterGroup:null}getRootNode(){return this.rootNode}getRow(e){return this.rowsToDisplay[e]}isRowPresent(e){return this.rowsToDisplay.indexOf(e)>=0}getRowIndexAtPixel(e){if(this.isEmpty()||this.rowsToDisplay.length===0)return-1;let t=0,o=this.rowsToDisplay.length-1;if(e<=0)return 0;if((0,import_core2._last)(this.rowsToDisplay).rowTop<=e)return this.rowsToDisplay.length-1;let r=-1,s=-1;for(;;){const n=Math.floor((t+o)/2),l=this.rowsToDisplay[n];if(this.isRowInPixel(l,e)||(l.rowTop<e?t=n+1:l.rowTop>e&&(o=n-1),r===t&&s===o))return n;r=t,s=o}}isRowInPixel(e,t){const o=e.rowTop,i=e.rowTop+e.rowHeight;return o<=t&&i>t}forEachLeafNode(e){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach((t,o)=>e(t,o))}forEachNode(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterGroup||[]],callback:e,recursionType:0,index:0,includeFooterNodes:t})}forEachNodeAfterFilter(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterAggFilter||[]],callback:e,recursionType:1,index:0,includeFooterNodes:t})}forEachNodeAfterFilterAndSort(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterSort||[]],callback:e,recursionType:2,index:0,includeFooterNodes:t})}forEachPivotNode(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[this.rootNode],callback:e,recursionType:3,index:0,includeFooterNodes:t})}recursivelyWalkNodesAndCallback(e){const{nodes:t,callback:o,recursionType:i,includeFooterNodes:r}=e;let{index:s}=e;const n=l=>{const a=t[0]?.parent;if(!a)return;const c=r&&(0,import_core2._getGrandTotalRow)(this.gos),u=(0,import_core2._getGroupTotalRowCallback)(this.gos),h=r&&u({node:a});if(a===this.rootNode){c===l&&(a.createFooter(),o(a.sibling,s++));return}h===l&&(a.createFooter(),o(a.sibling,s++))};n("top");for(let l=0;l<t.length;l++){const a=t[l];if(o(a,s++),a.hasChildren()&&!a.footer){let c=null;switch(i){case 0:c=a.childrenAfterGroup;break;case 1:c=a.childrenAfterAggFilter;break;case 2:c=a.childrenAfterSort;break;case 3:c=a.leafGroup?null:a.childrenAfterSort;break}c&&(s=this.recursivelyWalkNodesAndCallback({nodes:[...c],callback:o,recursionType:i,index:s,includeFooterNodes:r}))}}return n("bottom"),s}doAggregate(e){this.aggregationStage?.execute({rowNode:this.rootNode,changedPath:e})}doFilterAggregates(e){this.filterAggregatesStage?this.filterAggregatesStage.execute({rowNode:this.rootNode,changedPath:e}):this.rootNode.childrenAfterAggFilter=this.rootNode.childrenAfterFilter}expandOrCollapseAll(e){const t=this.gos.get("treeData"),o=this.columnModel.isPivotActive(),i=r=>{r&&r.forEach(s=>{const n=()=>{s.expanded=e,i(s.childrenAfterGroup)};if(t){(0,import_core2._exists)(s.childrenAfterGroup)&&n();return}if(o){!s.leafGroup&&n();return}s.group&&n()})};this.rootNode&&i(this.rootNode.childrenAfterGroup),this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP}),this.eventService.dispatchEvent({type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"})}doSort(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})}doRowGrouping(e,t,o,i){if(this.groupStage)e?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,rowNodesOrderChanged:o,changedPath:t}):this.groupStage.execute({rowNode:this.rootNode,changedPath:t,afterColumnsChanged:i}),(0,import_core2._getGroupSelectsDescendants)(this.gos)&&this.selectionService.updateGroupsFromChildrenSelections("rowGroupChanged",t)&&this.eventService.dispatchEvent({type:"selectionChanged",source:"rowGroupChanged"});else{const r=this.rootNode,s=r.sibling;r.childrenAfterGroup=r.allLeafChildren,s&&(s.childrenAfterGroup=r.childrenAfterGroup),this.rootNode.updateHasChildren()}this.nodeManager.isRowCountReady()&&(this.rowCountReady=!0,this.eventService.dispatchEventOnce({type:"rowCountReady"}))}doFilter(e){this.filterStage.execute({rowNode:this.rootNode,changedPath:e})}doPivot(e){this.pivotStage?.execute({rowNode:this.rootNode,changedPath:e})}getNodeManager(){return this.nodeManager}getRowNode(e){if(typeof e=="string"&&e.indexOf(import_core2.RowNode.ID_PREFIX_ROW_GROUP)==0){let o;return this.forEachNode(i=>{i.id===e&&(o=i)}),o}return this.nodeManager.getRowNode(e)}setRowData(e){this.selectionService.reset("rowDataChanged"),this.nodeManager.setRowData(e),this.hasStarted&&this.dispatchUpdateEventsAndRefresh()}dispatchUpdateEventsAndRefresh(){this.eventService.dispatchEvent({type:"rowDataUpdated"}),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,newData:!0})}batchUpdateRowData(e,t){if(this.applyAsyncTransactionsTimeout==null){this.rowDataTransactionBatch=[];const o=this.gos.get("asyncTransactionWaitMillis");this.applyAsyncTransactionsTimeout=window.setTimeout(()=>{this.isAlive()&&this.executeBatchUpdateRowData()},o)}this.rowDataTransactionBatch.push({rowDataTransaction:e,callback:t})}flushAsyncTransactions(){this.applyAsyncTransactionsTimeout!=null&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())}executeBatchUpdateRowData(){this.valueCache.onDataChanged();const e=[],t=[];let o=!1;this.rowDataTransactionBatch?.forEach(i=>{const{rowNodeTransaction:r,rowsInserted:s}=this.nodeManager.updateRowData(i.rowDataTransaction);s&&(o=!0),t.push(r),i.callback&&e.push(i.callback.bind(null,r))}),this.commonUpdateRowData(t,o),e.length>0&&window.setTimeout(()=>{e.forEach(i=>i())},0),t.length>0&&this.eventService.dispatchEvent({type:"asyncTransactionsFlushed",results:t}),this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0}updateRowData(e){this.valueCache.onDataChanged();const{rowNodeTransaction:t,rowsInserted:o}=this.nodeManager.updateRowData(e);return this.commonUpdateRowData([t],o),t}afterImmutableDataChange(e,t){this.commonUpdateRowData([e],t)}commonUpdateRowData(e,t){if(!this.hasStarted)return;const o=!this.gos.get("suppressAnimationFrame");this.eventService.dispatchEvent({type:"rowDataUpdated"}),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:e,rowNodesOrderChanged:t,keepRenderedRows:!0,keepEditingRows:!0,animate:o})}doRowsToDisplay(){this.rowsToDisplay=this.flattenStage.execute({rowNode:this.rootNode})}onRowHeightChanged(){this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,keepEditingRows:!0,keepUndoRedoStack:!0})}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}resetRowHeights(){const e=this.resetRowHeightsForAllRowNodes();this.rootNode.setRowHeight(this.rootNode.rowHeight,!0),this.rootNode.sibling&&this.rootNode.sibling.setRowHeight(this.rootNode.sibling.rowHeight,!0),e&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let e=!1;return this.forEachNode(t=>{t.setRowHeight(t.rowHeight,!0);const o=t.detailNode;o&&o.setRowHeight(o.rowHeight,!0),t.sibling&&t.sibling.setRowHeight(t.sibling.rowHeight,!0),e=!0}),e}onGridStylesChanges(e){if(e.rowHeightChanged){if(this.columnModel.isAutoRowHeightActive())return;this.resetRowHeights()}}onGridReady(){this.hasStarted||this.setInitialData()}isRowDataLoaded(){return this.rowCountReady}},import_core3=require("@ag-grid-community/core");function onGroupExpandedOrCollapsed(e){e.expansionService.onGroupExpandedOrCollapsed()}function refreshClientSideRowModel(e,t){e.rowModelHelperService?.getClientSideRowModel()?.refreshModel(t)}function isRowDataEmpty(e){return e.rowModelHelperService?.getClientSideRowModel()?.isEmpty()??!0}function forEachLeafNode(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachLeafNode(t)}function forEachNodeAfterFilter(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachNodeAfterFilter(t)}function forEachNodeAfterFilterAndSort(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachNodeAfterFilterAndSort(t)}function resetRowHeights(e){if(e.columnModel.isAutoRowHeightActive()){(0,import_core3._warnOnce)("calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.");return}e.rowModelHelperService?.getClientSideRowModel()?.resetRowHeights()}function applyTransaction(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.rowModelHelperService?.getClientSideRowModel()?.updateRowData(t))}function applyTransactionAsync(e,t,o){e.frameworkOverrides.wrapIncoming(()=>e.rowModelHelperService?.getClientSideRowModel()?.batchUpdateRowData(t,o))}function flushAsyncTransactions(e){e.frameworkOverrides.wrapIncoming(()=>e.rowModelHelperService?.getClientSideRowModel()?.flushAsyncTransactions())}function getBestCostNodeSelection(e){return e.selectionService.getBestCostNodeSelection()}var import_core4=require("@ag-grid-community/core"),FilterStage=class extends import_core4.BeanStub{constructor(){super(...arguments),this.beanName="filterStage"}wireBeans(e){this.filterManager=e.filterManager}execute(e){const{changedPath:t}=e;this.filter(t)}filter(e){const t=!!this.filterManager?.isChildFilterPresent();this.filterNodes(t,e)}filterNodes(e,t){const o=(i,r)=>{i.hasChildren()&&e&&!r?i.childrenAfterFilter=i.childrenAfterGroup.filter(s=>{const n=s.childrenAfterFilter&&s.childrenAfterFilter.length>0,l=s.data&&this.filterManager.doesRowPassFilter({rowNode:s});return n||l}):i.childrenAfterFilter=i.childrenAfterGroup,i.sibling&&(i.sibling.childrenAfterFilter=i.childrenAfterFilter)};if(this.doingTreeDataFiltering()){const i=(s,n)=>{if(s.childrenAfterGroup)for(let l=0;l<s.childrenAfterGroup.length;l++){const a=s.childrenAfterGroup[l],c=n||this.filterManager.doesRowPassFilter({rowNode:a});a.childrenAfterGroup?i(s.childrenAfterGroup[l],c):o(a,c)}o(s,n)},r=s=>i(s,!1);t.executeFromRootNode(r)}else{const i=r=>o(r,!1);t.forEachChangedNodeDepthFirst(i,!0)}}doingTreeDataFiltering(){return this.gos.get("treeData")&&!this.gos.get("excludeChildrenWhenTreeDataFiltering")}},import_core5=require("@ag-grid-community/core"),FlattenStage=class extends import_core5.BeanStub{constructor(){super(...arguments),this.beanName="flattenStage"}wireBeans(e){this.beans=e,this.columnModel=e.columnModel}execute(e){const t=e.rowNode,o=[],i=this.columnModel.isPivotMode(),r=i&&t.leafGroup,s=r?[t]:t.childrenAfterSort,n=this.getFlattenDetails();this.recursivelyAddToRowsToDisplay(n,s,o,i,0);const l=o.length>0;if(!r&&l&&n.grandTotalRow){t.createFooter();const c=n.grandTotalRow==="top";this.addRowNodeToRowsToDisplay(n,t.sibling,o,0,c)}return o}getFlattenDetails(){const e=this.gos.get("groupRemoveSingleChildren");return{groupRemoveLowestSingleChildren:!e&&this.gos.get("groupRemoveLowestSingleChildren"),groupRemoveSingleChildren:e,isGroupMultiAutoColumn:(0,import_core5._isGroupMultiAutoColumn)(this.gos),hideOpenParents:this.gos.get("groupHideOpenParents"),grandTotalRow:(0,import_core5._getGrandTotalRow)(this.gos),groupTotalRow:(0,import_core5._getGroupTotalRowCallback)(this.gos)}}recursivelyAddToRowsToDisplay(e,t,o,i,r){if(!(0,import_core5._missingOrEmpty)(t))for(let s=0;s<t.length;s++){const n=t[s],l=n.hasChildren(),a=i&&!l,c=e.groupRemoveSingleChildren&&l&&n.childrenAfterGroup.length===1,u=e.groupRemoveLowestSingleChildren&&l&&n.leafGroup&&n.childrenAfterGroup.length===1,h=i&&n.leafGroup,d=e.hideOpenParents&&n.expanded&&!n.master&&!h;if(!a&&!d&&!c&&!u&&this.addRowNodeToRowsToDisplay(e,n,o,r),!(i&&n.leafGroup)){if(l){const p=c||u;if(n.expanded||p){const g=e.groupTotalRow({node:n});g||n.destroyFooter();const f=p?r:r+1;g==="top"&&(n.createFooter(),this.addRowNodeToRowsToDisplay(e,n.sibling,o,f)),this.recursivelyAddToRowsToDisplay(e,n.childrenAfterSort,o,i,f),g==="bottom"&&(n.createFooter(),this.addRowNodeToRowsToDisplay(e,n.sibling,o,f))}}else if(n.master&&n.expanded){const p=this.createDetailNode(n);this.addRowNodeToRowsToDisplay(e,p,o,r)}}}}addRowNodeToRowsToDisplay(e,t,o,i,r){r?o.unshift(t):o.push(t),t.setUiLevel(e.isGroupMultiAutoColumn?0:i)}createDetailNode(e){if((0,import_core5._exists)(e.detailNode))return e.detailNode;const t=new import_core5.RowNode(this.beans);return t.detail=!0,t.selectable=!1,t.parent=e,(0,import_core5._exists)(e.id)&&(t.id="detail_"+e.id),t.data=e.data,t.level=e.level+1,e.detailNode=t,t}},import_core6=require("@ag-grid-community/core"),ImmutableService=class extends import_core6.BeanStub{constructor(){super(...arguments),this.beanName="immutableService"}wireBeans(e){this.rowModel=e.rowModel,this.selectionService=e.selectionService}postConstruct(){(0,import_core6._isClientSideRowModel)(this.gos)&&(this.clientSideRowModel=this.rowModel,this.addManagedPropertyListener("rowData",()=>this.onRowDataUpdated()))}isActive(){const e=this.gos.exists("getRowId");return this.gos.get("resetRowDataOnUpdate")?!1:e}setRowData(e){const t=this.createTransactionForRowData(e);if(!t)return;const o=this.clientSideRowModel.getNodeManager(),{rowNodeTransaction:i,rowsInserted:r}=o.updateRowData(t);let s=!1;this.gos.get("suppressMaintainUnsortedOrder")||(s=o.updateRowOrderFromRowData(e)),this.clientSideRowModel.afterImmutableDataChange(i,s||r)}createTransactionForRowData(e){if(!(0,import_core6._isClientSideRowModel)(this.gos))return(0,import_core6._errorOnce)("ImmutableService only works with ClientSideRowModel"),null;const t=(0,import_core6._getRowIdCallback)(this.gos);if(t==null)return(0,import_core6._errorOnce)("ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!"),null;const o=this.clientSideRowModel.getNodeManager().getCopyOfNodesMap(),i=[],r=[],s=[];return(0,import_core6._exists)(e)&&e.forEach(n=>{const l=t({data:n,level:0}),a=o[l];a?(a.data!==n&&r.push(n),o[l]=void 0):s.push(n)}),(0,import_core6._iterateObject)(o,(n,l)=>{l&&i.push(l.data)}),{remove:i,update:r,add:s}}onRowDataUpdated(){const e=this.gos.get("rowData");e&&(this.isActive()?this.setRowData(e):(this.selectionService.reset("rowDataChanged"),this.clientSideRowModel.setRowData(e)))}},import_core7=require("@ag-grid-community/core"),SortService=class extends import_core7.BeanStub{constructor(){super(...arguments),this.beanName="sortService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.rowNodeSorter=e.rowNodeSorter,this.showRowGroupColsService=e.showRowGroupColsService}sort(e,t,o,i,r,s){const n=this.gos.get("groupMaintainOrder"),l=this.columnModel.getCols().some(d=>d.isRowGroupActive());let a={};o&&i&&(a=this.calculateDirtyNodes(i));const c=this.columnModel.isPivotMode(),u=this.gos.getCallback("postSortRows"),h=d=>{this.pullDownGroupDataForHideOpenParents(d.childrenAfterAggFilter,!0);const w=c&&d.leafGroup;if(n&&l&&!d.leafGroup&&!s){const f=this.funcColsService.getRowGroupColumns()?.[d.level+1]?.getSort()===null,m=d.childrenAfterAggFilter.slice(0);if(d.childrenAfterSort&&!f){const R={};d.childrenAfterSort.forEach((S,C)=>{R[S.id]=C}),m.sort((S,C)=>(R[S.id]??0)-(R[C.id]??0))}d.childrenAfterSort=m}else!t||w?d.childrenAfterSort=d.childrenAfterAggFilter.slice(0):o?d.childrenAfterSort=this.doDeltaSort(d,a,r,e):d.childrenAfterSort=this.rowNodeSorter.doFullSort(d.childrenAfterAggFilter,e);if(d.sibling&&(d.sibling.childrenAfterSort=d.childrenAfterSort),this.updateChildIndexes(d),u){const g={nodes:d.childrenAfterSort};u(g)}};r&&r.forEachChangedNodeDepthFirst(h),this.updateGroupDataForHideOpenParents(r)}calculateDirtyNodes(e){const t={},o=i=>{i&&i.forEach(r=>t[r.id]=!0)};return e&&e.forEach(i=>{o(i.add),o(i.update),o(i.remove)}),t}doDeltaSort(e,t,o,i){const r=e.childrenAfterAggFilter,s=e.childrenAfterSort;if(!s)return this.rowNodeSorter.doFullSort(r,i);const n={},l=[];r.forEach(h=>{t[h.id]||!o.canSkip(h)?l.push(h):n[h.id]=!0});const a=s.filter(h=>n[h.id]),c=(h,d)=>({currentPos:d,rowNode:h}),u=l.map(c).sort((h,d)=>this.rowNodeSorter.compareRowNodes(i,h,d));return this.mergeSortedArrays(i,u,a.map(c)).map(({rowNode:h})=>h)}mergeSortedArrays(e,t,o){const i=[];let r=0,s=0;for(;r<t.length&&s<o.length;)this.rowNodeSorter.compareRowNodes(e,t[r],o[s])<0?i.push(t[r++]):i.push(o[s++]);for(;r<t.length;)i.push(t[r++]);for(;s<o.length;)i.push(o[s++]);return i}updateChildIndexes(e){if((0,import_core7._missing)(e.childrenAfterSort))return;const t=e.childrenAfterSort;for(let o=0;o<t.length;o++){const i=t[o],r=o===0,s=o===e.childrenAfterSort.length-1;i.setFirstChild(r),i.setLastChild(s),i.setChildIndex(o)}}updateGroupDataForHideOpenParents(e){if(!this.gos.get("groupHideOpenParents"))return;if(this.gos.get("treeData"))return(0,import_core7._warnOnce)("The property hideOpenParents dose not work with Tree Data. This is because Tree Data has values at the group level, it doesn't make sense to hide them."),!1;const t=o=>{this.pullDownGroupDataForHideOpenParents(o.childrenAfterSort,!1),o.childrenAfterSort.forEach(i=>{i.hasChildren()&&t(i)})};e&&e.executeFromRootNode(o=>t(o))}pullDownGroupDataForHideOpenParents(e,t){!this.gos.get("groupHideOpenParents")||(0,import_core7._missing)(e)||e.forEach(o=>{(this.showRowGroupColsService?.getShowRowGroupCols()??[]).forEach(r=>{const s=r.getColDef().showRowGroup;if(typeof s!="string"){(0,import_core7._errorOnce)("groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup");return}const n=s,l=this.columnModel.getColDefCol(n);if(l!==o.rowGroupColumn)if(t)o.setGroupValue(r.getId(),void 0);else{const c=this.getFirstChildOfFirstChild(o,l);c&&o.setGroupValue(r.getId(),c.key)}})})}getFirstChildOfFirstChild(e,t){let o=e;for(;o;){const i=o.parent;if(i&&o.firstChild){if(i.rowGroupColumn===t)return i}else return null;o=i}return null}},import_core8=require("@ag-grid-community/core"),SortStage=class extends import_core8.BeanStub{constructor(){super(...arguments),this.beanName="sortStage"}wireBeans(e){this.sortService=e.sortService,this.sortController=e.sortController}execute(e){const t=this.sortController.getSortOptions(),o=(0,import_core8._exists)(t)&&t.length>0,i=o&&(0,import_core8._exists)(e.rowNodeTransactions)&&this.gos.get("deltaSort"),r=t.some(s=>(0,import_core8._isColumnsSortingCoupledToGroup)(this.gos)?s.column.isPrimary()&&s.column.isRowGroupActive():!!s.column.getColDef().showRowGroup);this.sortService.sort(t,o,i,e.rowNodeTransactions,e.changedPath,r)}},VERSION="32.2.0",ClientSideRowModelCoreModule=(0,import_core9._defineModule)({version:VERSION,moduleName:`${import_core10.ModuleNames.ClientSideRowModelModule}-core`,rowModel:"clientSide",beans:[ClientSideRowModel,FilterStage,SortStage,FlattenStage,SortService,ImmutableService]}),ClientSideRowModelApiModule=(0,import_core9._defineModule)({version:VERSION,moduleName:`${import_core10.ModuleNames.ClientSideRowModelModule}-api`,beans:[import_core10.RowModelHelperService],apiFunctions:{onGroupExpandedOrCollapsed,refreshClientSideRowModel,isRowDataEmpty,forEachLeafNode,forEachNodeAfterFilter,forEachNodeAfterFilterAndSort,resetRowHeights,applyTransaction,applyTransactionAsync,flushAsyncTransactions,getBestCostNodeSelection},dependantModules:[ClientSideRowModelCoreModule,import_core10._CsrmSsrmSharedApiModule]}),ClientSideRowModelModule=(0,import_core9._defineModule)({version:VERSION,moduleName:import_core10.ModuleNames.ClientSideRowModelModule,dependantModules:[ClientSideRowModelCoreModule,ClientSideRowModelApiModule]});
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of __getOwnPropNames(t))!__hasOwnProp.call(e,r)&&r!==o&&__defProp(e,r,{get:()=>t[r],enumerable:!(i=__getOwnPropDesc(t,r))||i.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{ClientSideRowModelModule:()=>ClientSideRowModelModule}),module.exports=__toCommonJS(main_exports);var import_core9=require("@ag-grid-community/core"),import_core10=require("@ag-grid-community/core"),import_core2=require("@ag-grid-community/core"),import_core=require("@ag-grid-community/core"),ROOT_NODE_ID="ROOT_NODE_ID",TOP_LEVEL=0,ClientSideNodeManager=class{constructor(e,t,o,i,r,s){this.nextId=0,this.rowCountReady=!1,this.allNodesMap={},this.rootNode=e,this.gos=t,this.eventService=o,this.funcColsService=i,this.beans=s,this.selectionService=r,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id=ROOT_NODE_ID,this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterAggFilter=[],this.rootNode.childrenAfterFilter=[]}getCopyOfNodesMap(){return(0,import_core._cloneObject)(this.allNodesMap)}getRowNode(e){return this.allNodesMap[e]}setRowData(e){if(typeof e=="string"){(0,import_core._warnOnce)("rowData must be an array.");return}this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e);const t=this.rootNode,o=this.rootNode.sibling;t.childrenAfterFilter=null,t.childrenAfterGroup=null,t.childrenAfterAggFilter=null,t.childrenAfterSort=null,t.childrenMapped=null,t.updateHasChildren(),this.nextId=0,this.allNodesMap={},e?t.allLeafChildren=e.map((i,r)=>this.createNode(i,this.rootNode,TOP_LEVEL,r)):(t.allLeafChildren=[],t.childrenAfterGroup=[]),o&&(o.childrenAfterFilter=t.childrenAfterFilter,o.childrenAfterGroup=t.childrenAfterGroup,o.childrenAfterAggFilter=t.childrenAfterAggFilter,o.childrenAfterSort=t.childrenAfterSort,o.childrenMapped=t.childrenMapped,o.allLeafChildren=t.allLeafChildren)}updateRowData(e){this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e.add);const t={rowNodeTransaction:{remove:[],update:[],add:[]},rowsInserted:!1},o=[];return this.executeRemove(e,t,o),this.executeUpdate(e,t,o),this.executeAdd(e,t),this.updateSelection(o,"rowDataChanged"),t}updateRowOrderFromRowData(e){const t=this.rootNode.allLeafChildren,o=t?.length??0,i=new Map;let r=-1,s=-1;for(let n=0;n<o;++n){const l=t[n],a=l.data;a!==e[n]&&(s<0&&(r=n),s=n,i.set(a,l))}if(r<0)return!1;for(let n=r;n<=s;++n){const l=i.get(e[n]);l!==void 0&&(t[n]=l,l.sourceRowIndex=n)}return!0}isRowCountReady(){return this.rowCountReady}dispatchRowDataUpdateStartedEvent(e){this.eventService.dispatchEvent({type:"rowDataUpdateStarted",firstRowData:e?.length?e[0]:null})}updateSelection(e,t){const o=e.length>0;o&&this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,source:t}),this.selectionService.updateGroupsFromChildrenSelections(t),o&&this.eventService.dispatchEvent({type:"selectionChanged",source:t})}executeAdd(e,t){const o=e.add;if((0,import_core._missingOrEmpty)(o))return;const i=this.rootNode.allLeafChildren;let r=i.length;if(typeof e.addIndex=="number"&&(r=this.sanitizeAddIndex(e.addIndex),r>0&&this.gos.get("treeData"))){for(let a=0;a<i.length;a++)if(i[a]?.rowIndex==r-1){r=a+1;break}}const s=o.map((l,a)=>this.createNode(l,this.rootNode,TOP_LEVEL,r+a));if(r<i.length){const l=i.slice(0,r),a=i.slice(r,i.length),c=l.length+s.length;for(let u=0,h=a.length;u<h;++u)a[u].sourceRowIndex=c+u;this.rootNode.allLeafChildren=[...l,...s,...a],t.rowsInserted=!0}else this.rootNode.allLeafChildren=i.concat(s);const n=this.rootNode.sibling;n&&(n.allLeafChildren=i),t.rowNodeTransaction.add=s}sanitizeAddIndex(e){const t=this.rootNode.allLeafChildren?.length??0;return e<0||e>=t||Number.isNaN(e)?t:Math.ceil(e)}executeRemove(e,{rowNodeTransaction:t},o){const{remove:i}=e;if((0,import_core._missingOrEmpty)(i))return;const r={};i.forEach(n=>{const l=this.lookupRowNode(n);l&&(l.isSelected()&&o.push(l),l.clearRowTopAndRowIndex(),r[l.id]=!0,delete this.allNodesMap[l.id],t.remove.push(l))}),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren?.filter(n=>!r[n.id])??null,this.rootNode.allLeafChildren?.forEach((n,l)=>{n.sourceRowIndex=l});const s=this.rootNode.sibling;s&&(s.allLeafChildren=this.rootNode.allLeafChildren)}executeUpdate(e,{rowNodeTransaction:t},o){const{update:i}=e;(0,import_core._missingOrEmpty)(i)||i.forEach(r=>{const s=this.lookupRowNode(r);s&&(s.updateData(r),!s.selectable&&s.isSelected()&&o.push(s),this.setMasterForRow(s,r,TOP_LEVEL,!1),t.update.push(s))})}lookupRowNode(e){const t=(0,import_core._getRowIdCallback)(this.gos);let o;if(t){const i=t({data:e,level:0});if(o=this.allNodesMap[i],!o)return(0,import_core._errorOnce)(`could not find row id=${i}, data item was not found for this id`),null}else if(o=this.rootNode.allLeafChildren?.find(i=>i.data===e),!o)return(0,import_core._errorOnce)("could not find data item as object was not found",e),(0,import_core._errorOnce)("Consider using getRowId to help the Grid find matching row data"),null;return o||null}createNode(e,t,o,i){const r=new import_core.RowNode(this.beans);return r.sourceRowIndex=i,r.group=!1,this.setMasterForRow(r,e,o,!0),t&&(r.parent=t),r.level=o,r.setDataAndId(e,this.nextId.toString()),this.allNodesMap[r.id]&&(0,import_core._warnOnce)(`duplicate node id '${r.id}' detected from getRowId callback, this could cause issues in your grid.`),this.allNodesMap[r.id]=r,this.nextId++,r}setMasterForRow(e,t,o,i){if(this.gos.get("treeData"))e.setMaster(!1),i&&(e.expanded=!1);else{if(this.gos.get("masterDetail")){const n=this.gos.get("isRowMaster");n?e.setMaster(n(t)):e.setMaster(!0)}else e.setMaster(!1);if(i){const n=this.funcColsService.getRowGroupColumns(),l=n?n.length:0,a=o+l;e.expanded=e.master?this.isExpanded(a):!1}}}isExpanded(e){const t=this.gos.get("groupDefaultExpanded");return t===-1?!0:e<t}},ClientSideRowModel=class extends import_core2.BeanStub{constructor(){super(...arguments),this.beanName="rowModel",this.onRowHeightChanged_debounced=(0,import_core2._debounce)(this.onRowHeightChanged.bind(this),100),this.rowsToDisplay=[],this.hasStarted=!1,this.shouldSkipSettingDataOnStart=!1,this.isRefreshingModel=!1,this.rowCountReady=!1}wireBeans(e){this.beans=e,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.selectionService=e.selectionService,this.valueCache=e.valueCache,this.environment=e.environment,this.filterStage=e.filterStage,this.sortStage=e.sortStage,this.flattenStage=e.flattenStage,this.groupStage=e.groupStage,this.aggregationStage=e.aggregationStage,this.pivotStage=e.pivotStage,this.filterAggregatesStage=e.filterAggregatesStage}postConstruct(){const e=this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.EVERYTHING}),t=!this.gos.get("suppressAnimationFrame"),o=this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.EVERYTHING,afterColumnsChanged:!0,keepRenderedRows:!0,animate:t});this.addManagedEventListeners({newColumnsLoaded:o,columnRowGroupChanged:e,columnValueChanged:this.onValueChanged.bind(this),columnPivotChanged:this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.PIVOT}),filterChanged:this.onFilterChanged.bind(this),sortChanged:this.onSortChanged.bind(this),columnPivotModeChanged:e,gridStylesChanged:this.onGridStylesChanges.bind(this),gridReady:this.onGridReady.bind(this)}),this.addPropertyListeners(),this.rootNode=new import_core2.RowNode(this.beans),this.nodeManager=new ClientSideNodeManager(this.rootNode,this.gos,this.eventService,this.funcColsService,this.selectionService,this.beans)}addPropertyListeners(){const e=new Set(["treeData","masterDetail"]),t=new Set(["groupDefaultExpanded","groupAllowUnbalanced","initialGroupOrderComparator","groupHideOpenParents","groupDisplayType"]),o=new Set(["excludeChildrenWhenTreeDataFiltering"]),i=new Set(["removePivotHeaderRowWhenSingleValueColumn","pivotRowTotals","pivotColumnGroupTotals","suppressExpandablePivotGroups"]),r=new Set(["getGroupRowAgg","alwaysAggregateAtRootLevel","groupIncludeTotalFooter","suppressAggFilteredOnly","grandTotalRow"]),s=new Set(["postSortRows","groupDisplayType","accentedSort"]),n=new Set([]),l=new Set(["groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupIncludeFooter","groupTotalRow"]),a=[...e,...t,...o,...i,...i,...r,...s,...n,...l];this.addManagedPropertyListeners(a,c=>{const u=c.changeSet?.properties;if(!u)return;const h=d=>u.some(w=>d.has(w));if(h(e)){this.setRowData(this.rootNode.allLeafChildren.map(d=>d.data));return}if(h(t)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING});return}if(h(o)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER});return}if(h(i)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT});return}if(h(r)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE});return}if(h(s)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT});return}if(h(n)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES});return}h(l)&&this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP})}),this.addManagedPropertyListener("rowHeight",()=>this.resetRowHeights())}start(){this.hasStarted=!0,this.shouldSkipSettingDataOnStart?this.dispatchUpdateEventsAndRefresh():this.setInitialData()}setInitialData(){const e=this.gos.get("rowData");e&&(this.shouldSkipSettingDataOnStart=!0,this.setRowData(e))}ensureRowHeightsValid(e,t,o,i){let r,s=!1;do{r=!1;const n=this.getRowIndexAtPixel(e),l=this.getRowIndexAtPixel(t),a=Math.max(n,o),c=Math.min(l,i);for(let u=a;u<=c;u++){const h=this.getRow(u);if(h.rowHeightEstimated){const d=(0,import_core2._getRowHeightForNode)(this.gos,h);h.setRowHeight(d.height),r=!0,s=!0}}r&&this.setRowTopAndRowIndex()}while(r);return s}setRowTopAndRowIndex(){const e=this.environment.getDefaultRowHeight();let t=0;const o=new Set,i=(0,import_core2._isDomLayout)(this.gos,"normal");for(let r=0;r<this.rowsToDisplay.length;r++){const s=this.rowsToDisplay[r];if(s.id!=null&&o.add(s.id),s.rowHeight==null){const n=(0,import_core2._getRowHeightForNode)(this.gos,s,i,e);s.setRowHeight(n.height,n.estimated)}s.setRowTop(t),s.setRowIndex(r),t+=s.rowHeight}return o}clearRowTopAndRowIndex(e,t){const o=e.isActive(),i=s=>{s&&s.id!=null&&!t.has(s.id)&&s.clearRowTopAndRowIndex()},r=s=>{if(i(s),i(s.detailNode),i(s.sibling),s.hasChildren()&&s.childrenAfterGroup){const n=s.level==-1;o&&!n&&!s.expanded||s.childrenAfterGroup.forEach(r)}};r(this.rootNode)}ensureRowsAtPixel(e,t,o=0){const i=this.getRowIndexAtPixel(t),r=this.getRow(i),s=!this.gos.get("suppressAnimationFrame");if(r===e[0])return!1;const n=this.rootNode.allLeafChildren;return e.forEach(l=>{(0,import_core2._removeFromArray)(n,l)}),e.forEach((l,a)=>{(0,import_core2._insertIntoArray)(n,l,Math.max(i+o,0)+a)}),e.forEach((l,a)=>{l.sourceRowIndex=a}),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,keepRenderedRows:!0,keepEditingRows:!0,animate:s,rowNodesOrderChanged:!0}),!0}highlightRowAtPixel(e,t){const o=t!=null?this.getRowIndexAtPixel(t):null,i=o!=null?this.getRow(o):null;if(!i||!e||i===e||t==null){this.lastHighlightedRow&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null);return}const r=this.getHighlightPosition(t,i);this.lastHighlightedRow&&this.lastHighlightedRow!==i&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null),i.setHighlighted(r),this.lastHighlightedRow=i}getHighlightPosition(e,t){if(!t){const r=this.getRowIndexAtPixel(e);if(t=this.getRow(r||0),!t)return import_core2.RowHighlightPosition.Below}const{rowTop:o,rowHeight:i}=t;return e-o<i/2?import_core2.RowHighlightPosition.Above:import_core2.RowHighlightPosition.Below}getLastHighlightedRowNode(){return this.lastHighlightedRow}isLastRowIndexKnown(){return!0}getRowCount(){return this.rowsToDisplay?this.rowsToDisplay.length:0}getTopLevelRowCount(){if(this.rowsToDisplay.length===0)return 0;if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return 1;const t=this.rootNode.childrenAfterAggFilter,o=this.rootNode.sibling?1:0;return(t?t.length:0)+o}getTopLevelRowDisplayedIndex(e){if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return e;let o=e;if(this.rowsToDisplay[0].footer){if(e===0)return 0;o-=1}const i=this.rowsToDisplay[this.rowsToDisplay.length-1],r=o>=this.rootNode.childrenAfterSort.length;if(i.footer&&r)return i.rowIndex;let s=this.rootNode.childrenAfterSort[o];if(this.gos.get("groupHideOpenParents"))for(;s.expanded&&s.childrenAfterSort&&s.childrenAfterSort.length>0;)s=s.childrenAfterSort[0];return s.rowIndex}getRowBounds(e){if((0,import_core2._missing)(this.rowsToDisplay))return null;const t=this.rowsToDisplay[e];return t?{rowTop:t.rowTop,rowHeight:t.rowHeight}:null}onRowGroupOpened(){const e=(0,import_core2._isAnimateRows)(this.gos);this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:e})}onFilterChanged(e){if(e.afterDataChange)return;const t=(0,import_core2._isAnimateRows)(this.gos),i=e.columns.length===0||e.columns.some(r=>r.isPrimary())?import_core2.ClientSideRowModelSteps.FILTER:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES;this.refreshModel({step:i,keepRenderedRows:!0,animate:t})}onSortChanged(){const e=(0,import_core2._isAnimateRows)(this.gos);this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT,keepRenderedRows:!0,animate:e,keepEditingRows:!0})}getType(){return"clientSide"}onValueChanged(){this.columnModel.isPivotActive()?this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT}):this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE})}createChangePath(e){const t=(0,import_core2._missingOrEmpty)(e),o=new import_core2.ChangedPath(!1,this.rootNode);return t&&o.setInactive(),o}isSuppressModelUpdateAfterUpdateTransaction(e){if(!this.gos.get("suppressModelUpdateAfterUpdateTransaction")||e.rowNodeTransactions==null)return!1;const t=e.rowNodeTransactions.filter(i=>i.add!=null&&i.add.length>0||i.remove!=null&&i.remove.length>0);return t==null||t.length==0}buildRefreshModelParams(e){let t=import_core2.ClientSideRowModelSteps.EVERYTHING;const o={everything:import_core2.ClientSideRowModelSteps.EVERYTHING,group:import_core2.ClientSideRowModelSteps.EVERYTHING,filter:import_core2.ClientSideRowModelSteps.FILTER,map:import_core2.ClientSideRowModelSteps.MAP,aggregate:import_core2.ClientSideRowModelSteps.AGGREGATE,sort:import_core2.ClientSideRowModelSteps.SORT,pivot:import_core2.ClientSideRowModelSteps.PIVOT};if((0,import_core2._exists)(e)&&(t=o[e]),(0,import_core2._missing)(t)){(0,import_core2._errorOnce)(`invalid step ${e}, available steps are ${Object.keys(o).join(", ")}`);return}const i=!this.gos.get("suppressAnimationFrame");return{step:t,keepRenderedRows:!0,keepEditingRows:!0,animate:i}}refreshModel(e){if(!this.hasStarted||this.isRefreshingModel||this.columnModel.isChangeEventsDispatching())return;const t=typeof e=="object"&&"step"in e?e:this.buildRefreshModelParams(e);if(!t||this.isSuppressModelUpdateAfterUpdateTransaction(t))return;const o=this.createChangePath(t.rowNodeTransactions);switch(this.isRefreshingModel=!0,t.step){case import_core2.ClientSideRowModelSteps.EVERYTHING:this.doRowGrouping(t.rowNodeTransactions,o,!!t.rowNodesOrderChanged,!!t.afterColumnsChanged);case import_core2.ClientSideRowModelSteps.FILTER:this.doFilter(o);case import_core2.ClientSideRowModelSteps.PIVOT:this.doPivot(o);case import_core2.ClientSideRowModelSteps.AGGREGATE:this.doAggregate(o);case import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES:this.doFilterAggregates(o);case import_core2.ClientSideRowModelSteps.SORT:this.doSort(t.rowNodeTransactions,o);case import_core2.ClientSideRowModelSteps.MAP:this.doRowsToDisplay()}const i=this.setRowTopAndRowIndex();this.clearRowTopAndRowIndex(o,i),this.isRefreshingModel=!1,this.eventService.dispatchEvent({type:"modelUpdated",animate:t.animate,keepRenderedRows:t.keepRenderedRows,newData:t.newData,newPage:!1,keepUndoRedoStack:t.keepUndoRedoStack})}isEmpty(){const e=(0,import_core2._missing)(this.rootNode.allLeafChildren)||this.rootNode.allLeafChildren.length===0;return(0,import_core2._missing)(this.rootNode)||e||!this.columnModel.isReady()}isRowsToRender(){return(0,import_core2._exists)(this.rowsToDisplay)&&this.rowsToDisplay.length>0}getNodesInRangeForSelection(e,t){let o=!1,i=!1;const r=[],s=(0,import_core2._getGroupSelectsDescendants)(this.gos);return this.forEachNodeAfterFilterAndSort(n=>{if(i)return;if(o&&(n===t||n===e)&&(i=!0,n.group&&s)){r.push(...n.allLeafChildren);return}if(!o){if(n!==t&&n!==e)return;o=!0}if(!n.group||!s){r.push(n);return}}),r}setDatasource(e){(0,import_core2._errorOnce)("should never call setDatasource on clientSideRowController")}getTopLevelNodes(){return this.rootNode?this.rootNode.childrenAfterGroup:null}getRootNode(){return this.rootNode}getRow(e){return this.rowsToDisplay[e]}isRowPresent(e){return this.rowsToDisplay.indexOf(e)>=0}getRowIndexAtPixel(e){if(this.isEmpty()||this.rowsToDisplay.length===0)return-1;let t=0,o=this.rowsToDisplay.length-1;if(e<=0)return 0;if((0,import_core2._last)(this.rowsToDisplay).rowTop<=e)return this.rowsToDisplay.length-1;let r=-1,s=-1;for(;;){const n=Math.floor((t+o)/2),l=this.rowsToDisplay[n];if(this.isRowInPixel(l,e)||(l.rowTop<e?t=n+1:l.rowTop>e&&(o=n-1),r===t&&s===o))return n;r=t,s=o}}isRowInPixel(e,t){const o=e.rowTop,i=e.rowTop+e.rowHeight;return o<=t&&i>t}forEachLeafNode(e){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach((t,o)=>e(t,o))}forEachNode(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterGroup||[]],callback:e,recursionType:0,index:0,includeFooterNodes:t})}forEachNodeAfterFilter(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterAggFilter||[]],callback:e,recursionType:1,index:0,includeFooterNodes:t})}forEachNodeAfterFilterAndSort(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterSort||[]],callback:e,recursionType:2,index:0,includeFooterNodes:t})}forEachPivotNode(e,t=!1){this.recursivelyWalkNodesAndCallback({nodes:[this.rootNode],callback:e,recursionType:3,index:0,includeFooterNodes:t})}recursivelyWalkNodesAndCallback(e){const{nodes:t,callback:o,recursionType:i,includeFooterNodes:r}=e;let{index:s}=e;const n=l=>{const a=t[0]?.parent;if(!a)return;const c=r&&(0,import_core2._getGrandTotalRow)(this.gos),u=(0,import_core2._getGroupTotalRowCallback)(this.gos),h=r&&u({node:a});if(a===this.rootNode){c===l&&(a.createFooter(),o(a.sibling,s++));return}h===l&&(a.createFooter(),o(a.sibling,s++))};n("top");for(let l=0;l<t.length;l++){const a=t[l];if(o(a,s++),a.hasChildren()&&!a.footer){let c=null;switch(i){case 0:c=a.childrenAfterGroup;break;case 1:c=a.childrenAfterAggFilter;break;case 2:c=a.childrenAfterSort;break;case 3:c=a.leafGroup?null:a.childrenAfterSort;break}c&&(s=this.recursivelyWalkNodesAndCallback({nodes:[...c],callback:o,recursionType:i,index:s,includeFooterNodes:r}))}}return n("bottom"),s}doAggregate(e){this.aggregationStage?.execute({rowNode:this.rootNode,changedPath:e})}doFilterAggregates(e){this.filterAggregatesStage?this.filterAggregatesStage.execute({rowNode:this.rootNode,changedPath:e}):this.rootNode.childrenAfterAggFilter=this.rootNode.childrenAfterFilter}expandOrCollapseAll(e){const t=this.gos.get("treeData"),o=this.columnModel.isPivotActive(),i=r=>{r&&r.forEach(s=>{const n=()=>{s.expanded=e,i(s.childrenAfterGroup)};if(t){(0,import_core2._exists)(s.childrenAfterGroup)&&n();return}if(o){!s.leafGroup&&n();return}s.group&&n()})};this.rootNode&&i(this.rootNode.childrenAfterGroup),this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP}),this.eventService.dispatchEvent({type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"})}doSort(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})}doRowGrouping(e,t,o,i){if(this.groupStage)e?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,rowNodesOrderChanged:o,changedPath:t}):this.groupStage.execute({rowNode:this.rootNode,changedPath:t,afterColumnsChanged:i}),(0,import_core2._getGroupSelectsDescendants)(this.gos)&&this.selectionService.updateGroupsFromChildrenSelections("rowGroupChanged",t)&&this.eventService.dispatchEvent({type:"selectionChanged",source:"rowGroupChanged"});else{const r=this.rootNode,s=r.sibling;r.childrenAfterGroup=r.allLeafChildren,s&&(s.childrenAfterGroup=r.childrenAfterGroup),this.rootNode.updateHasChildren()}this.nodeManager.isRowCountReady()&&(this.rowCountReady=!0,this.eventService.dispatchEventOnce({type:"rowCountReady"}))}doFilter(e){this.filterStage.execute({rowNode:this.rootNode,changedPath:e})}doPivot(e){this.pivotStage?.execute({rowNode:this.rootNode,changedPath:e})}getNodeManager(){return this.nodeManager}getRowNode(e){if(typeof e=="string"&&e.indexOf(import_core2.RowNode.ID_PREFIX_ROW_GROUP)==0){let o;return this.forEachNode(i=>{i.id===e&&(o=i)}),o}return this.nodeManager.getRowNode(e)}setRowData(e){this.selectionService.reset("rowDataChanged"),this.nodeManager.setRowData(e),this.hasStarted&&this.dispatchUpdateEventsAndRefresh()}dispatchUpdateEventsAndRefresh(){this.eventService.dispatchEvent({type:"rowDataUpdated"}),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,newData:!0})}batchUpdateRowData(e,t){if(this.applyAsyncTransactionsTimeout==null){this.rowDataTransactionBatch=[];const o=this.gos.get("asyncTransactionWaitMillis");this.applyAsyncTransactionsTimeout=window.setTimeout(()=>{this.isAlive()&&this.executeBatchUpdateRowData()},o)}this.rowDataTransactionBatch.push({rowDataTransaction:e,callback:t})}flushAsyncTransactions(){this.applyAsyncTransactionsTimeout!=null&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())}executeBatchUpdateRowData(){this.valueCache.onDataChanged();const e=[],t=[];let o=!1;this.rowDataTransactionBatch?.forEach(i=>{const{rowNodeTransaction:r,rowsInserted:s}=this.nodeManager.updateRowData(i.rowDataTransaction);s&&(o=!0),t.push(r),i.callback&&e.push(i.callback.bind(null,r))}),this.commonUpdateRowData(t,o),e.length>0&&window.setTimeout(()=>{e.forEach(i=>i())},0),t.length>0&&this.eventService.dispatchEvent({type:"asyncTransactionsFlushed",results:t}),this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0}updateRowData(e){this.valueCache.onDataChanged();const{rowNodeTransaction:t,rowsInserted:o}=this.nodeManager.updateRowData(e);return this.commonUpdateRowData([t],o),t}afterImmutableDataChange(e,t){this.commonUpdateRowData([e],t)}commonUpdateRowData(e,t){if(!this.hasStarted)return;const o=!this.gos.get("suppressAnimationFrame");this.eventService.dispatchEvent({type:"rowDataUpdated"}),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:e,rowNodesOrderChanged:t,keepRenderedRows:!0,keepEditingRows:!0,animate:o})}doRowsToDisplay(){this.rowsToDisplay=this.flattenStage.execute({rowNode:this.rootNode})}onRowHeightChanged(){this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,keepEditingRows:!0,keepUndoRedoStack:!0})}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}resetRowHeights(){const e=this.resetRowHeightsForAllRowNodes();this.rootNode.setRowHeight(this.rootNode.rowHeight,!0),this.rootNode.sibling&&this.rootNode.sibling.setRowHeight(this.rootNode.sibling.rowHeight,!0),e&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let e=!1;return this.forEachNode(t=>{t.setRowHeight(t.rowHeight,!0);const o=t.detailNode;o&&o.setRowHeight(o.rowHeight,!0),t.sibling&&t.sibling.setRowHeight(t.sibling.rowHeight,!0),e=!0}),e}onGridStylesChanges(e){if(e.rowHeightChanged){if(this.columnModel.isAutoRowHeightActive())return;this.resetRowHeights()}}onGridReady(){this.hasStarted||this.setInitialData()}isRowDataLoaded(){return this.rowCountReady}},import_core3=require("@ag-grid-community/core");function onGroupExpandedOrCollapsed(e){e.expansionService.onGroupExpandedOrCollapsed()}function refreshClientSideRowModel(e,t){e.rowModelHelperService?.getClientSideRowModel()?.refreshModel(t)}function isRowDataEmpty(e){return e.rowModelHelperService?.getClientSideRowModel()?.isEmpty()??!0}function forEachLeafNode(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachLeafNode(t)}function forEachNodeAfterFilter(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachNodeAfterFilter(t)}function forEachNodeAfterFilterAndSort(e,t){e.rowModelHelperService?.getClientSideRowModel()?.forEachNodeAfterFilterAndSort(t)}function resetRowHeights(e){if(e.columnModel.isAutoRowHeightActive()){(0,import_core3._warnOnce)("calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.");return}e.rowModelHelperService?.getClientSideRowModel()?.resetRowHeights()}function applyTransaction(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.rowModelHelperService?.getClientSideRowModel()?.updateRowData(t))}function applyTransactionAsync(e,t,o){e.frameworkOverrides.wrapIncoming(()=>e.rowModelHelperService?.getClientSideRowModel()?.batchUpdateRowData(t,o))}function flushAsyncTransactions(e){e.frameworkOverrides.wrapIncoming(()=>e.rowModelHelperService?.getClientSideRowModel()?.flushAsyncTransactions())}function getBestCostNodeSelection(e){return e.selectionService.getBestCostNodeSelection()}var import_core4=require("@ag-grid-community/core"),FilterStage=class extends import_core4.BeanStub{constructor(){super(...arguments),this.beanName="filterStage"}wireBeans(e){this.filterManager=e.filterManager}execute(e){const{changedPath:t}=e;this.filter(t)}filter(e){const t=!!this.filterManager?.isChildFilterPresent();this.filterNodes(t,e)}filterNodes(e,t){const o=(i,r)=>{i.hasChildren()&&e&&!r?i.childrenAfterFilter=i.childrenAfterGroup.filter(s=>{const n=s.childrenAfterFilter&&s.childrenAfterFilter.length>0,l=s.data&&this.filterManager.doesRowPassFilter({rowNode:s});return n||l}):i.childrenAfterFilter=i.childrenAfterGroup,i.sibling&&(i.sibling.childrenAfterFilter=i.childrenAfterFilter)};if(this.doingTreeDataFiltering()){const i=(s,n)=>{if(s.childrenAfterGroup)for(let l=0;l<s.childrenAfterGroup.length;l++){const a=s.childrenAfterGroup[l],c=n||this.filterManager.doesRowPassFilter({rowNode:a});a.childrenAfterGroup?i(s.childrenAfterGroup[l],c):o(a,c)}o(s,n)},r=s=>i(s,!1);t.executeFromRootNode(r)}else{const i=r=>o(r,!1);t.forEachChangedNodeDepthFirst(i,!0)}}doingTreeDataFiltering(){return this.gos.get("treeData")&&!this.gos.get("excludeChildrenWhenTreeDataFiltering")}},import_core5=require("@ag-grid-community/core"),FlattenStage=class extends import_core5.BeanStub{constructor(){super(...arguments),this.beanName="flattenStage"}wireBeans(e){this.beans=e,this.columnModel=e.columnModel}execute(e){const t=e.rowNode,o=[],i=this.columnModel.isPivotMode(),r=i&&t.leafGroup,s=r?[t]:t.childrenAfterSort,n=this.getFlattenDetails();this.recursivelyAddToRowsToDisplay(n,s,o,i,0);const l=o.length>0;if(!r&&l&&n.grandTotalRow){t.createFooter();const c=n.grandTotalRow==="top";this.addRowNodeToRowsToDisplay(n,t.sibling,o,0,c)}return o}getFlattenDetails(){const e=this.gos.get("groupRemoveSingleChildren");return{groupRemoveLowestSingleChildren:!e&&this.gos.get("groupRemoveLowestSingleChildren"),groupRemoveSingleChildren:e,isGroupMultiAutoColumn:(0,import_core5._isGroupMultiAutoColumn)(this.gos),hideOpenParents:this.gos.get("groupHideOpenParents"),grandTotalRow:(0,import_core5._getGrandTotalRow)(this.gos),groupTotalRow:(0,import_core5._getGroupTotalRowCallback)(this.gos)}}recursivelyAddToRowsToDisplay(e,t,o,i,r){if(!(0,import_core5._missingOrEmpty)(t))for(let s=0;s<t.length;s++){const n=t[s],l=n.hasChildren(),a=i&&!l,c=e.groupRemoveSingleChildren&&l&&n.childrenAfterGroup.length===1,u=e.groupRemoveLowestSingleChildren&&l&&n.leafGroup&&n.childrenAfterGroup.length===1,h=i&&n.leafGroup,d=e.hideOpenParents&&n.expanded&&!n.master&&!h;if(!a&&!d&&!c&&!u&&this.addRowNodeToRowsToDisplay(e,n,o,r),!(i&&n.leafGroup)){if(l){const p=c||u;if(n.expanded||p){const g=e.groupTotalRow({node:n});g||n.destroyFooter();const f=p?r:r+1;g==="top"&&(n.createFooter(),this.addRowNodeToRowsToDisplay(e,n.sibling,o,f)),this.recursivelyAddToRowsToDisplay(e,n.childrenAfterSort,o,i,f),g==="bottom"&&(n.createFooter(),this.addRowNodeToRowsToDisplay(e,n.sibling,o,f))}}else if(n.master&&n.expanded){const p=this.createDetailNode(n);this.addRowNodeToRowsToDisplay(e,p,o,r)}}}}addRowNodeToRowsToDisplay(e,t,o,i,r){r?o.unshift(t):o.push(t),t.setUiLevel(e.isGroupMultiAutoColumn?0:i)}createDetailNode(e){if((0,import_core5._exists)(e.detailNode))return e.detailNode;const t=new import_core5.RowNode(this.beans);return t.detail=!0,t.selectable=!1,t.parent=e,(0,import_core5._exists)(e.id)&&(t.id="detail_"+e.id),t.data=e.data,t.level=e.level+1,e.detailNode=t,t}},import_core6=require("@ag-grid-community/core"),ImmutableService=class extends import_core6.BeanStub{constructor(){super(...arguments),this.beanName="immutableService"}wireBeans(e){this.rowModel=e.rowModel,this.selectionService=e.selectionService}postConstruct(){(0,import_core6._isClientSideRowModel)(this.gos)&&(this.clientSideRowModel=this.rowModel,this.addManagedPropertyListener("rowData",()=>this.onRowDataUpdated()))}isActive(){const e=this.gos.exists("getRowId");return this.gos.get("resetRowDataOnUpdate")?!1:e}setRowData(e){const t=this.createTransactionForRowData(e);if(!t)return;const o=this.clientSideRowModel.getNodeManager(),{rowNodeTransaction:i,rowsInserted:r}=o.updateRowData(t);let s=!1;this.gos.get("suppressMaintainUnsortedOrder")||(s=o.updateRowOrderFromRowData(e)),this.clientSideRowModel.afterImmutableDataChange(i,s||r)}createTransactionForRowData(e){if(!(0,import_core6._isClientSideRowModel)(this.gos))return(0,import_core6._errorOnce)("ImmutableService only works with ClientSideRowModel"),null;const t=(0,import_core6._getRowIdCallback)(this.gos);if(t==null)return(0,import_core6._errorOnce)("ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!"),null;const o=this.clientSideRowModel.getNodeManager().getCopyOfNodesMap(),i=[],r=[],s=[];return(0,import_core6._exists)(e)&&e.forEach(n=>{const l=t({data:n,level:0}),a=o[l];a?(a.data!==n&&r.push(n),o[l]=void 0):s.push(n)}),(0,import_core6._iterateObject)(o,(n,l)=>{l&&i.push(l.data)}),{remove:i,update:r,add:s}}onRowDataUpdated(){const e=this.gos.get("rowData");e&&(this.isActive()?this.setRowData(e):(this.selectionService.reset("rowDataChanged"),this.clientSideRowModel.setRowData(e)))}},import_core7=require("@ag-grid-community/core"),SortService=class extends import_core7.BeanStub{constructor(){super(...arguments),this.beanName="sortService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.rowNodeSorter=e.rowNodeSorter,this.showRowGroupColsService=e.showRowGroupColsService}sort(e,t,o,i,r,s){const n=this.gos.get("groupMaintainOrder"),l=this.columnModel.getCols().some(d=>d.isRowGroupActive());let a={};o&&i&&(a=this.calculateDirtyNodes(i));const c=this.columnModel.isPivotMode(),u=this.gos.getCallback("postSortRows"),h=d=>{this.pullDownGroupDataForHideOpenParents(d.childrenAfterAggFilter,!0);const w=c&&d.leafGroup;if(n&&l&&!d.leafGroup&&!s){const f=this.funcColsService.getRowGroupColumns()?.[d.level+1]?.getSort()===null,m=d.childrenAfterAggFilter.slice(0);if(d.childrenAfterSort&&!f){const R={};d.childrenAfterSort.forEach((S,C)=>{R[S.id]=C}),m.sort((S,C)=>(R[S.id]??0)-(R[C.id]??0))}d.childrenAfterSort=m}else!t||w?d.childrenAfterSort=d.childrenAfterAggFilter.slice(0):o?d.childrenAfterSort=this.doDeltaSort(d,a,r,e):d.childrenAfterSort=this.rowNodeSorter.doFullSort(d.childrenAfterAggFilter,e);if(d.sibling&&(d.sibling.childrenAfterSort=d.childrenAfterSort),this.updateChildIndexes(d),u){const g={nodes:d.childrenAfterSort};u(g)}};r&&r.forEachChangedNodeDepthFirst(h),this.updateGroupDataForHideOpenParents(r)}calculateDirtyNodes(e){const t={},o=i=>{i&&i.forEach(r=>t[r.id]=!0)};return e&&e.forEach(i=>{o(i.add),o(i.update),o(i.remove)}),t}doDeltaSort(e,t,o,i){const r=e.childrenAfterAggFilter,s=e.childrenAfterSort;if(!s)return this.rowNodeSorter.doFullSort(r,i);const n={},l=[];r.forEach(h=>{t[h.id]||!o.canSkip(h)?l.push(h):n[h.id]=!0});const a=s.filter(h=>n[h.id]),c=(h,d)=>({currentPos:d,rowNode:h}),u=l.map(c).sort((h,d)=>this.rowNodeSorter.compareRowNodes(i,h,d));return this.mergeSortedArrays(i,u,a.map(c)).map(({rowNode:h})=>h)}mergeSortedArrays(e,t,o){const i=[];let r=0,s=0;for(;r<t.length&&s<o.length;)this.rowNodeSorter.compareRowNodes(e,t[r],o[s])<0?i.push(t[r++]):i.push(o[s++]);for(;r<t.length;)i.push(t[r++]);for(;s<o.length;)i.push(o[s++]);return i}updateChildIndexes(e){if((0,import_core7._missing)(e.childrenAfterSort))return;const t=e.childrenAfterSort;for(let o=0;o<t.length;o++){const i=t[o],r=o===0,s=o===e.childrenAfterSort.length-1;i.setFirstChild(r),i.setLastChild(s),i.setChildIndex(o)}}updateGroupDataForHideOpenParents(e){if(!this.gos.get("groupHideOpenParents"))return;if(this.gos.get("treeData"))return(0,import_core7._warnOnce)("The property hideOpenParents dose not work with Tree Data. This is because Tree Data has values at the group level, it doesn't make sense to hide them."),!1;const t=o=>{this.pullDownGroupDataForHideOpenParents(o.childrenAfterSort,!1),o.childrenAfterSort.forEach(i=>{i.hasChildren()&&t(i)})};e&&e.executeFromRootNode(o=>t(o))}pullDownGroupDataForHideOpenParents(e,t){!this.gos.get("groupHideOpenParents")||(0,import_core7._missing)(e)||e.forEach(o=>{(this.showRowGroupColsService?.getShowRowGroupCols()??[]).forEach(r=>{const s=r.getColDef().showRowGroup;if(typeof s!="string"){(0,import_core7._errorOnce)("groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup");return}const n=s,l=this.columnModel.getColDefCol(n);if(l!==o.rowGroupColumn)if(t)o.setGroupValue(r.getId(),void 0);else{const c=this.getFirstChildOfFirstChild(o,l);c&&o.setGroupValue(r.getId(),c.key)}})})}getFirstChildOfFirstChild(e,t){let o=e;for(;o;){const i=o.parent;if(i&&o.firstChild){if(i.rowGroupColumn===t)return i}else return null;o=i}return null}},import_core8=require("@ag-grid-community/core"),SortStage=class extends import_core8.BeanStub{constructor(){super(...arguments),this.beanName="sortStage"}wireBeans(e){this.sortService=e.sortService,this.sortController=e.sortController}execute(e){const t=this.sortController.getSortOptions(),o=(0,import_core8._exists)(t)&&t.length>0,i=o&&(0,import_core8._exists)(e.rowNodeTransactions)&&this.gos.get("deltaSort"),r=t.some(s=>(0,import_core8._isColumnsSortingCoupledToGroup)(this.gos)?s.column.isPrimary()&&s.column.isRowGroupActive():!!s.column.getColDef().showRowGroup);this.sortService.sort(t,o,i,e.rowNodeTransactions,e.changedPath,r)}},VERSION="32.2.1",ClientSideRowModelCoreModule=(0,import_core9._defineModule)({version:VERSION,moduleName:`${import_core10.ModuleNames.ClientSideRowModelModule}-core`,rowModel:"clientSide",beans:[ClientSideRowModel,FilterStage,SortStage,FlattenStage,SortService,ImmutableService]}),ClientSideRowModelApiModule=(0,import_core9._defineModule)({version:VERSION,moduleName:`${import_core10.ModuleNames.ClientSideRowModelModule}-api`,beans:[import_core10.RowModelHelperService],apiFunctions:{onGroupExpandedOrCollapsed,refreshClientSideRowModel,isRowDataEmpty,forEachLeafNode,forEachNodeAfterFilter,forEachNodeAfterFilterAndSort,resetRowHeights,applyTransaction,applyTransactionAsync,flushAsyncTransactions,getBestCostNodeSelection},dependantModules:[ClientSideRowModelCoreModule,import_core10._CsrmSsrmSharedApiModule]}),ClientSideRowModelModule=(0,import_core9._defineModule)({version:VERSION,moduleName:import_core10.ModuleNames.ClientSideRowModelModule,dependantModules:[ClientSideRowModelCoreModule,ClientSideRowModelApiModule]});
{
"name": "@ag-grid-community/client-side-row-model",
"version": "32.2.0",
"version": "32.2.1",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",
"dependencies": {
"tslib": "^2.3.0",
"@ag-grid-community/core": "32.2.0"
"@ag-grid-community/core": "32.2.1"
},

@@ -9,0 +9,0 @@ "main": "./dist/package/main.cjs.js",

{
"name": "@ag-grid-community/client-side-row-model",
"version": "32.2.0",
"version": "32.2.1",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",
"dependencies": {
"tslib": "^2.3.0",
"@ag-grid-community/core": "32.2.0"
"@ag-grid-community/core": "32.2.1"
},

@@ -9,0 +9,0 @@ "main": "./src/main.js",

@@ -1,1 +0,1 @@

export declare const VERSION = "32.2.0";
export declare const VERSION = "32.2.1";
{
"name": "@ag-grid-community/client-side-row-model",
"version": "32.2.0",
"version": "32.2.1",
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue",
"dependencies": {
"tslib": "^2.3.0",
"@ag-grid-community/core": "32.2.0"
"@ag-grid-community/core": "32.2.1"
},

@@ -9,0 +9,0 @@ "main": "./dist/package/main.cjs.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc