@ag-grid-community/client-side-row-model
Advanced tools
Comparing version 32.0.1 to 32.0.2
@@ -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_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=>this.createNode(i,this.rootNode,TOP_LEVEL)):(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,t){this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e.add);const o={remove:[],update:[],add:[]},i=[];return this.executeRemove(e,o,i),this.executeUpdate(e,o,i),this.executeAdd(e,o),this.updateSelection(i,"rowDataChanged"),t&&(0,import_core._sortRowNodesByOrder)(this.rootNode.allLeafChildren,t),o}isRowCountReady(){return this.rowCountReady}dispatchRowDataUpdateStartedEvent(e){const t={type:"rowDataUpdateStarted",firstRowData:e?.length?e[0]:null};this.eventService.dispatchEvent(t)}updateSelection(e,t){const o=e.length>0;if(o&&this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,source:t}),this.selectionService.updateGroupsFromChildrenSelections(t),o){const i={type:"selectionChanged",source:t};this.eventService.dispatchEvent(i)}}executeAdd(e,t){const{add:o,addIndex:i}=e;if((0,import_core._missingOrEmpty)(o))return;const r=o.map(n=>this.createNode(n,this.rootNode,TOP_LEVEL)),s=this.rootNode.allLeafChildren;if(typeof i=="number"&&i>=0){const n=s.length;let l=i;if(this.gos.get("treeData")&&i>0&&n>0){for(let d=0;d<n;d++)if(s[d]?.rowIndex==i-1){l=d+1;break}}const h=s.slice(0,l),u=s.slice(l,s.length);this.rootNode.allLeafChildren=[...h,...r,...u]}else this.rootNode.allLeafChildren=[...s,...r];this.rootNode.sibling&&(this.rootNode.sibling.allLeafChildren=s),t.add=r}executeRemove(e,t,o){const{remove:i}=e;if((0,import_core._missingOrEmpty)(i))return;const r={};i.forEach(s=>{const n=this.lookupRowNode(s);n&&(n.isSelected()&&o.push(n),n.clearRowTopAndRowIndex(),r[n.id]=!0,delete this.allNodesMap[n.id],t.remove.push(n))}),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren?.filter(s=>!r[s.id])??null,this.rootNode.sibling&&(this.rootNode.sibling.allLeafChildren=this.rootNode.allLeafChildren)}executeUpdate(e,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=this.gos.getRowIdCallback();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){const i=new import_core.RowNode(this.beans);return i.group=!1,this.setMasterForRow(i,e,o,!0),t&&(i.parent=t),i.level=o,i.setDataAndId(e,this.nextId.toString()),this.allNodesMap[i.id]&&(0,import_core._warnOnce)(`duplicate node id '${i.id}' detected from getRowId callback, this could cause issues in your grid.`),this.allNodesMap[i.id]=i,this.nextId++,i}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,h=>{const u=h.changeSet?.properties;if(!u)return;const d=c=>u.some(w=>c.has(w));if(d(e)){this.setRowData(this.rootNode.allLeafChildren.map(c=>c.data));return}if(d(t)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING});return}if(d(o)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER});return}if(d(i)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT});return}if(d(r)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE});return}if(d(s)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT});return}if(d(n)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES});return}d(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),h=Math.min(l,i);for(let u=a;u<=h;u++){const d=this.getRow(u);if(d.rowHeightEstimated){const c=this.gos.getRowHeightForNode(d);d.setRowHeight(c.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=this.gos.isDomLayout("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=this.gos.getRowHeightForNode(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");return r===e[0]?!1:(e.forEach(n=>{(0,import_core2._removeFromArray)(this.rootNode.allLeafChildren,n)}),e.forEach((n,l)=>{(0,import_core2._insertIntoArray)(this.rootNode.allLeafChildren,n,Math.max(i+o,0)+l)}),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,keepRenderedRows:!0,keepEditingRows:!0,animate:s}),!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&&this.rowsToDisplay[0]===this.rootNode)return 1;const t=this.rootNode.sibling?1:0,o=this.rootNode.childrenAfterAggFilter;return(o?o.length:0)+t}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}let i=this.rootNode.childrenAfterSort[o];if(this.gos.get("groupHideOpenParents"))for(;i.expanded&&i.childrenAfterSort&&i.childrenAfterSort.length>0;)i=i.childrenAfterSort[0];return i.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=this.gos.isAnimateRows();this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:e})}onFilterChanged(e){if(e.afterDataChange)return;const t=this.gos.isAnimateRows(),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=this.gos.isAnimateRows();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||this.gos.get("treeData"))&&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,t.rowNodeOrder,o,!!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;const r={type:"modelUpdated",animate:t.animate,keepRenderedRows:t.keepRenderedRows,newData:t.newData,newPage:!1,keepUndoRedoStack:t.keepUndoRedoStack};this.eventService.dispatchEvent(r)}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=this.gos.get("groupSelectsChildren");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 h=r&&this.gos.getGrandTotalRow(),u=this.gos.getGroupTotalRowCallback(),d=r&&u({node:a});if(a===this.rootNode){h===l&&(a.createFooter(),o(a.sibling,s++));return}d===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 h=null;switch(i){case 0:h=a.childrenAfterGroup;break;case 1:h=a.childrenAfterAggFilter;break;case 2:h=a.childrenAfterSort;break;case 3:h=a.leafGroup?null:a.childrenAfterSort;break}h&&(s=this.recursivelyWalkNodesAndCallback({nodes:[...h],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=n=>{n&&n.forEach(l=>{const a=()=>{l.expanded=e,i(l.childrenAfterGroup)};if(t){(0,import_core2._exists)(l.childrenAfterGroup)&&a();return}if(o){!l.leafGroup&&a();return}l.group&&a()})};this.rootNode&&i(this.rootNode.childrenAfterGroup),this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP});const s={type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"};this.eventService.dispatchEvent(s)}doSort(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})}doRowGrouping(e,t,o,i){if(this.groupStage){if(e?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,rowNodeOrder:t,changedPath:o}):this.groupStage.execute({rowNode:this.rootNode,changedPath:o,afterColumnsChanged:i}),this.gos.get("groupSelectsChildren")&&this.selectionService.updateGroupsFromChildrenSelections("rowGroupChanged",o)){const s={type:"selectionChanged",source:"rowGroupChanged"};this.eventService.dispatchEvent(s)}}else this.rootNode.childrenAfterGroup=this.rootNode.allLeafChildren,this.rootNode.sibling&&(this.rootNode.sibling.childrenAfterGroup=this.rootNode.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})}getCopyOfNodesMap(){return this.nodeManager.getCopyOfNodesMap()}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(){const e={type:"rowDataUpdated"};this.eventService.dispatchEvent(e),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,newData:!0})}batchUpdateRowData(e,t){if(this.applyAsyncTransactionsTimeout==null){this.rowDataTransactionBatch=[];const o=this.gos.getAsyncTransactionWaitMillis();this.applyAsyncTransactionsTimeout=window.setTimeout(()=>{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;if(this.rowDataTransactionBatch&&this.rowDataTransactionBatch.forEach(i=>{const r=this.nodeManager.updateRowData(i.rowDataTransaction,void 0);t.push(r),i.callback&&e.push(i.callback.bind(null,r)),typeof i.rowDataTransaction.addIndex=="number"&&(o=!0)}),this.commonUpdateRowData(t,void 0,o),e.length>0&&window.setTimeout(()=>{e.forEach(i=>i())},0),t.length>0){const i={type:"asyncTransactionsFlushed",results:t};this.eventService.dispatchEvent(i)}this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0}updateRowData(e,t){this.valueCache.onDataChanged();const o=this.nodeManager.updateRowData(e,t),i=typeof e.addIndex=="number";return this.commonUpdateRowData([o],t,i),o}createRowNodeOrder(){if(this.gos.get("suppressMaintainUnsortedOrder"))return;const t={};if(this.rootNode&&this.rootNode.allLeafChildren)for(let o=0;o<this.rootNode.allLeafChildren.length;o++){const i=this.rootNode.allLeafChildren[o];t[i.id]=o}return t}commonUpdateRowData(e,t,o){if(!this.hasStarted)return;const i=!this.gos.get("suppressAnimationFrame");o&&(t=this.createRowNodeOrder());const r={type:"rowDataUpdated"};this.eventService.dispatchEvent(r),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:e,rowNodeOrder:t,keepRenderedRows:!0,keepEditingRows:!0,animate:i})}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 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],h=n||this.filterManager.doesRowPassFilter({rowNode:a});a.childrenAfterGroup?i(s.childrenAfterGroup[l],h):o(a,h)}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 h=n.grandTotalRow==="top";this.addRowNodeToRowsToDisplay(n,t.sibling,o,0,h)}return o}getFlattenDetails(){const e=this.gos.get("groupRemoveSingleChildren");return{groupRemoveLowestSingleChildren:!e&&this.gos.get("groupRemoveLowestSingleChildren"),groupRemoveSingleChildren:e,isGroupMultiAutoColumn:this.gos.isGroupMultiAutoColumn(),hideOpenParents:this.gos.get("groupHideOpenParents"),grandTotalRow:this.gos.getGrandTotalRow(),groupTotalRow:this.gos.getGroupTotalRowCallback()}}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,h=e.groupRemoveSingleChildren&&l&&n.childrenAfterGroup.length===1,u=e.groupRemoveLowestSingleChildren&&l&&n.leafGroup&&n.childrenAfterGroup.length===1,d=i&&n.leafGroup,c=e.hideOpenParents&&n.expanded&&!n.master&&!d;if(!a&&!c&&!h&&!u&&this.addRowNodeToRowsToDisplay(e,n,o,r),!(i&&n.leafGroup)){if(l){const g=h||u;if(n.expanded||g){const p=e.groupTotalRow({node:n});p||n.destroyFooter();const f=g?r:r+1;p==="top"&&(n.createFooter(),this.addRowNodeToRowsToDisplay(e,n.sibling,o,f)),this.recursivelyAddToRowsToDisplay(e,n.childrenAfterSort,o,i,f),p==="bottom"&&(n.createFooter(),this.addRowNodeToRowsToDisplay(e,n.sibling,o,f))}}else if(n.master&&n.expanded){const g=this.createDetailNode(n);this.addRowNodeToRowsToDisplay(e,g,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(){this.rowModel.getType()==="clientSide"&&(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,i]=t;this.clientSideRowModel.updateRowData(o,i)}createTransactionForRowData(e){if((0,import_core6._missing)(this.clientSideRowModel)){(0,import_core6._errorOnce)("ImmutableService only works with ClientSideRowModel");return}const t=this.gos.getRowIdCallback();if(t==null){(0,import_core6._errorOnce)("ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!");return}const o={remove:[],update:[],add:[]},i=this.clientSideRowModel.getCopyOfNodesMap(),s=this.gos.get("suppressMaintainUnsortedOrder")?void 0:{};return(0,import_core6._exists)(e)&&e.forEach((n,l)=>{const a=t({data:n,level:0}),h=i[a];s&&(s[a]=l),h?(h.data!==n&&o.update.push(n),i[a]=void 0):o.add.push(n)}),(0,import_core6._iterateObject)(i,(n,l)=>{l&&o.remove.push(l.data)}),[o,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(c=>c.isRowGroupActive());let a={};o&&i&&(a=this.calculateDirtyNodes(i));const h=this.columnModel.isPivotMode(),u=this.gos.getCallback("postSortRows"),d=c=>{this.pullDownGroupDataForHideOpenParents(c.childrenAfterAggFilter,!0);const w=h&&c.leafGroup;if(n&&l&&!c.leafGroup&&!s){const f=this.funcColsService.getRowGroupColumns()?.[c.level+1]?.getSort()===null,m=c.childrenAfterAggFilter.slice(0);if(c.childrenAfterSort&&!f){const R={};c.childrenAfterSort.forEach((S,C)=>{R[S.id]=C}),m.sort((S,C)=>(R[S.id]??0)-(R[C.id]??0))}c.childrenAfterSort=m}else!t||w?c.childrenAfterSort=c.childrenAfterAggFilter.slice(0):o?c.childrenAfterSort=this.doDeltaSort(c,a,r,e):c.childrenAfterSort=this.rowNodeSorter.doFullSort(c.childrenAfterAggFilter,e);if(c.sibling&&(c.sibling.childrenAfterSort=c.childrenAfterSort),this.updateChildIndexes(c),u){const p={nodes:c.childrenAfterSort};u(p)}};r&&r.forEachChangedNodeDepthFirst(d),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(d=>{t[d.id]||!o.canSkip(d)?l.push(d):n[d.id]=!0});const a=s.filter(d=>n[d.id]),h=(d,c)=>({currentPos:c,rowNode:d}),u=l.map(h).sort((d,c)=>this.rowNodeSorter.compareRowNodes(i,d,c));return this.mergeSortedArrays(i,u,a.map(h)).map(({rowNode:d})=>d)}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 h=o.getFirstChildOfFirstChild(l);h&&o.setGroupValue(r.getId(),h.key)}})})}},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=>this.gos.isColumnsSortingCoupledToGroup()?s.column.isPrimary()&&s.column.isRowGroupActive():!!s.column.getColDef().showRowGroup);this.sortService.sort(t,o,i,e.rowNodeTransactions,e.changedPath,r)}},VERSION="32.0.1",ClientSideRowModelCoreModule={version:VERSION,moduleName:`${import_core9.ModuleNames.ClientSideRowModelModule}-core`,rowModel:"clientSide",beans:[ClientSideRowModel,FilterStage,SortStage,FlattenStage,SortService,ImmutableService]},ClientSideRowModelApiModule={version:VERSION,moduleName:`${import_core9.ModuleNames.ClientSideRowModelModule}-api`,beans:[import_core9.RowModelHelperService],apiFunctions:{onGroupExpandedOrCollapsed,refreshClientSideRowModel,forEachLeafNode,forEachNodeAfterFilter,forEachNodeAfterFilterAndSort,resetRowHeights,applyTransaction,applyTransactionAsync,flushAsyncTransactions,getBestCostNodeSelection},dependantModules:[ClientSideRowModelCoreModule,import_core9._CsrmSsrmSharedApiModule]},ClientSideRowModelModule={version:VERSION,moduleName:import_core9.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_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=>this.createNode(i,this.rootNode,TOP_LEVEL)):(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,t){this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e.add);const o={remove:[],update:[],add:[]},i=[];return this.executeRemove(e,o,i),this.executeUpdate(e,o,i),this.executeAdd(e,o),this.updateSelection(i,"rowDataChanged"),t&&(0,import_core._sortRowNodesByOrder)(this.rootNode.allLeafChildren,t),o}isRowCountReady(){return this.rowCountReady}dispatchRowDataUpdateStartedEvent(e){const t={type:"rowDataUpdateStarted",firstRowData:e?.length?e[0]:null};this.eventService.dispatchEvent(t)}updateSelection(e,t){const o=e.length>0;if(o&&this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,source:t}),this.selectionService.updateGroupsFromChildrenSelections(t),o){const i={type:"selectionChanged",source:t};this.eventService.dispatchEvent(i)}}executeAdd(e,t){const{add:o,addIndex:i}=e;if((0,import_core._missingOrEmpty)(o))return;const r=o.map(n=>this.createNode(n,this.rootNode,TOP_LEVEL)),s=this.rootNode.allLeafChildren;if(typeof i=="number"&&i>=0){const n=s.length;let l=i;if(this.gos.get("treeData")&&i>0&&n>0){for(let d=0;d<n;d++)if(s[d]?.rowIndex==i-1){l=d+1;break}}const h=s.slice(0,l),u=s.slice(l,s.length);this.rootNode.allLeafChildren=[...h,...r,...u]}else this.rootNode.allLeafChildren=[...s,...r];this.rootNode.sibling&&(this.rootNode.sibling.allLeafChildren=s),t.add=r}executeRemove(e,t,o){const{remove:i}=e;if((0,import_core._missingOrEmpty)(i))return;const r={};i.forEach(s=>{const n=this.lookupRowNode(s);n&&(n.isSelected()&&o.push(n),n.clearRowTopAndRowIndex(),r[n.id]=!0,delete this.allNodesMap[n.id],t.remove.push(n))}),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren?.filter(s=>!r[s.id])??null,this.rootNode.sibling&&(this.rootNode.sibling.allLeafChildren=this.rootNode.allLeafChildren)}executeUpdate(e,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=this.gos.getRowIdCallback();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){const i=new import_core.RowNode(this.beans);return i.group=!1,this.setMasterForRow(i,e,o,!0),t&&(i.parent=t),i.level=o,i.setDataAndId(e,this.nextId.toString()),this.allNodesMap[i.id]&&(0,import_core._warnOnce)(`duplicate node id '${i.id}' detected from getRowId callback, this could cause issues in your grid.`),this.allNodesMap[i.id]=i,this.nextId++,i}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,h=>{const u=h.changeSet?.properties;if(!u)return;const d=c=>u.some(w=>c.has(w));if(d(e)){this.setRowData(this.rootNode.allLeafChildren.map(c=>c.data));return}if(d(t)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING});return}if(d(o)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER});return}if(d(i)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT});return}if(d(r)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE});return}if(d(s)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT});return}if(d(n)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES});return}d(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),h=Math.min(l,i);for(let u=a;u<=h;u++){const d=this.getRow(u);if(d.rowHeightEstimated){const c=this.gos.getRowHeightForNode(d);d.setRowHeight(c.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=this.gos.isDomLayout("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=this.gos.getRowHeightForNode(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");return r===e[0]?!1:(e.forEach(n=>{(0,import_core2._removeFromArray)(this.rootNode.allLeafChildren,n)}),e.forEach((n,l)=>{(0,import_core2._insertIntoArray)(this.rootNode.allLeafChildren,n,Math.max(i+o,0)+l)}),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,keepRenderedRows:!0,keepEditingRows:!0,animate:s}),!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&&this.rowsToDisplay[0]===this.rootNode)return 1;const t=this.rootNode.sibling?1:0,o=this.rootNode.childrenAfterAggFilter;return(o?o.length:0)+t}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}let i=this.rootNode.childrenAfterSort[o];if(this.gos.get("groupHideOpenParents"))for(;i.expanded&&i.childrenAfterSort&&i.childrenAfterSort.length>0;)i=i.childrenAfterSort[0];return i.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=this.gos.isAnimateRows();this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:e})}onFilterChanged(e){if(e.afterDataChange)return;const t=this.gos.isAnimateRows(),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=this.gos.isAnimateRows();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||this.gos.get("treeData"))&&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,t.rowNodeOrder,o,!!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;const r={type:"modelUpdated",animate:t.animate,keepRenderedRows:t.keepRenderedRows,newData:t.newData,newPage:!1,keepUndoRedoStack:t.keepUndoRedoStack};this.eventService.dispatchEvent(r)}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=this.gos.get("groupSelectsChildren");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 h=r&&this.gos.getGrandTotalRow(),u=this.gos.getGroupTotalRowCallback(),d=r&&u({node:a});if(a===this.rootNode){h===l&&(a.createFooter(),o(a.sibling,s++));return}d===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 h=null;switch(i){case 0:h=a.childrenAfterGroup;break;case 1:h=a.childrenAfterAggFilter;break;case 2:h=a.childrenAfterSort;break;case 3:h=a.leafGroup?null:a.childrenAfterSort;break}h&&(s=this.recursivelyWalkNodesAndCallback({nodes:[...h],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=n=>{n&&n.forEach(l=>{const a=()=>{l.expanded=e,i(l.childrenAfterGroup)};if(t){(0,import_core2._exists)(l.childrenAfterGroup)&&a();return}if(o){!l.leafGroup&&a();return}l.group&&a()})};this.rootNode&&i(this.rootNode.childrenAfterGroup),this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP});const s={type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"};this.eventService.dispatchEvent(s)}doSort(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})}doRowGrouping(e,t,o,i){if(this.groupStage){if(e?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,rowNodeOrder:t,changedPath:o}):this.groupStage.execute({rowNode:this.rootNode,changedPath:o,afterColumnsChanged:i}),this.gos.get("groupSelectsChildren")&&this.selectionService.updateGroupsFromChildrenSelections("rowGroupChanged",o)){const s={type:"selectionChanged",source:"rowGroupChanged"};this.eventService.dispatchEvent(s)}}else this.rootNode.childrenAfterGroup=this.rootNode.allLeafChildren,this.rootNode.sibling&&(this.rootNode.sibling.childrenAfterGroup=this.rootNode.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})}getCopyOfNodesMap(){return this.nodeManager.getCopyOfNodesMap()}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(){const e={type:"rowDataUpdated"};this.eventService.dispatchEvent(e),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,newData:!0})}batchUpdateRowData(e,t){if(this.applyAsyncTransactionsTimeout==null){this.rowDataTransactionBatch=[];const o=this.gos.getAsyncTransactionWaitMillis();this.applyAsyncTransactionsTimeout=window.setTimeout(()=>{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;if(this.rowDataTransactionBatch&&this.rowDataTransactionBatch.forEach(i=>{const r=this.nodeManager.updateRowData(i.rowDataTransaction,void 0);t.push(r),i.callback&&e.push(i.callback.bind(null,r)),typeof i.rowDataTransaction.addIndex=="number"&&(o=!0)}),this.commonUpdateRowData(t,void 0,o),e.length>0&&window.setTimeout(()=>{e.forEach(i=>i())},0),t.length>0){const i={type:"asyncTransactionsFlushed",results:t};this.eventService.dispatchEvent(i)}this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0}updateRowData(e,t){this.valueCache.onDataChanged();const o=this.nodeManager.updateRowData(e,t),i=typeof e.addIndex=="number";return this.commonUpdateRowData([o],t,i),o}createRowNodeOrder(){if(this.gos.get("suppressMaintainUnsortedOrder"))return;const t={};if(this.rootNode&&this.rootNode.allLeafChildren)for(let o=0;o<this.rootNode.allLeafChildren.length;o++){const i=this.rootNode.allLeafChildren[o];t[i.id]=o}return t}commonUpdateRowData(e,t,o){if(!this.hasStarted)return;const i=!this.gos.get("suppressAnimationFrame");o&&(t=this.createRowNodeOrder());const r={type:"rowDataUpdated"};this.eventService.dispatchEvent(r),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:e,rowNodeOrder:t,keepRenderedRows:!0,keepEditingRows:!0,animate:i})}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 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],h=n||this.filterManager.doesRowPassFilter({rowNode:a});a.childrenAfterGroup?i(s.childrenAfterGroup[l],h):o(a,h)}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 h=n.grandTotalRow==="top";this.addRowNodeToRowsToDisplay(n,t.sibling,o,0,h)}return o}getFlattenDetails(){const e=this.gos.get("groupRemoveSingleChildren");return{groupRemoveLowestSingleChildren:!e&&this.gos.get("groupRemoveLowestSingleChildren"),groupRemoveSingleChildren:e,isGroupMultiAutoColumn:this.gos.isGroupMultiAutoColumn(),hideOpenParents:this.gos.get("groupHideOpenParents"),grandTotalRow:this.gos.getGrandTotalRow(),groupTotalRow:this.gos.getGroupTotalRowCallback()}}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,h=e.groupRemoveSingleChildren&&l&&n.childrenAfterGroup.length===1,u=e.groupRemoveLowestSingleChildren&&l&&n.leafGroup&&n.childrenAfterGroup.length===1,d=i&&n.leafGroup,c=e.hideOpenParents&&n.expanded&&!n.master&&!d;if(!a&&!c&&!h&&!u&&this.addRowNodeToRowsToDisplay(e,n,o,r),!(i&&n.leafGroup)){if(l){const g=h||u;if(n.expanded||g){const p=e.groupTotalRow({node:n});p||n.destroyFooter();const f=g?r:r+1;p==="top"&&(n.createFooter(),this.addRowNodeToRowsToDisplay(e,n.sibling,o,f)),this.recursivelyAddToRowsToDisplay(e,n.childrenAfterSort,o,i,f),p==="bottom"&&(n.createFooter(),this.addRowNodeToRowsToDisplay(e,n.sibling,o,f))}}else if(n.master&&n.expanded){const g=this.createDetailNode(n);this.addRowNodeToRowsToDisplay(e,g,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(){this.rowModel.getType()==="clientSide"&&(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,i]=t;this.clientSideRowModel.updateRowData(o,i)}createTransactionForRowData(e){if((0,import_core6._missing)(this.clientSideRowModel)){(0,import_core6._errorOnce)("ImmutableService only works with ClientSideRowModel");return}const t=this.gos.getRowIdCallback();if(t==null){(0,import_core6._errorOnce)("ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!");return}const o={remove:[],update:[],add:[]},i=this.clientSideRowModel.getCopyOfNodesMap(),s=this.gos.get("suppressMaintainUnsortedOrder")?void 0:{};return(0,import_core6._exists)(e)&&e.forEach((n,l)=>{const a=t({data:n,level:0}),h=i[a];s&&(s[a]=l),h?(h.data!==n&&o.update.push(n),i[a]=void 0):o.add.push(n)}),(0,import_core6._iterateObject)(i,(n,l)=>{l&&o.remove.push(l.data)}),[o,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(c=>c.isRowGroupActive());let a={};o&&i&&(a=this.calculateDirtyNodes(i));const h=this.columnModel.isPivotMode(),u=this.gos.getCallback("postSortRows"),d=c=>{this.pullDownGroupDataForHideOpenParents(c.childrenAfterAggFilter,!0);const w=h&&c.leafGroup;if(n&&l&&!c.leafGroup&&!s){const f=this.funcColsService.getRowGroupColumns()?.[c.level+1]?.getSort()===null,m=c.childrenAfterAggFilter.slice(0);if(c.childrenAfterSort&&!f){const R={};c.childrenAfterSort.forEach((S,C)=>{R[S.id]=C}),m.sort((S,C)=>(R[S.id]??0)-(R[C.id]??0))}c.childrenAfterSort=m}else!t||w?c.childrenAfterSort=c.childrenAfterAggFilter.slice(0):o?c.childrenAfterSort=this.doDeltaSort(c,a,r,e):c.childrenAfterSort=this.rowNodeSorter.doFullSort(c.childrenAfterAggFilter,e);if(c.sibling&&(c.sibling.childrenAfterSort=c.childrenAfterSort),this.updateChildIndexes(c),u){const p={nodes:c.childrenAfterSort};u(p)}};r&&r.forEachChangedNodeDepthFirst(d),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(d=>{t[d.id]||!o.canSkip(d)?l.push(d):n[d.id]=!0});const a=s.filter(d=>n[d.id]),h=(d,c)=>({currentPos:c,rowNode:d}),u=l.map(h).sort((d,c)=>this.rowNodeSorter.compareRowNodes(i,d,c));return this.mergeSortedArrays(i,u,a.map(h)).map(({rowNode:d})=>d)}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 h=o.getFirstChildOfFirstChild(l);h&&o.setGroupValue(r.getId(),h.key)}})})}},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=>this.gos.isColumnsSortingCoupledToGroup()?s.column.isPrimary()&&s.column.isRowGroupActive():!!s.column.getColDef().showRowGroup);this.sortService.sort(t,o,i,e.rowNodeTransactions,e.changedPath,r)}},VERSION="32.0.2",ClientSideRowModelCoreModule={version:VERSION,moduleName:`${import_core9.ModuleNames.ClientSideRowModelModule}-core`,rowModel:"clientSide",beans:[ClientSideRowModel,FilterStage,SortStage,FlattenStage,SortService,ImmutableService]},ClientSideRowModelApiModule={version:VERSION,moduleName:`${import_core9.ModuleNames.ClientSideRowModelModule}-api`,beans:[import_core9.RowModelHelperService],apiFunctions:{onGroupExpandedOrCollapsed,refreshClientSideRowModel,forEachLeafNode,forEachNodeAfterFilter,forEachNodeAfterFilterAndSort,resetRowHeights,applyTransaction,applyTransactionAsync,flushAsyncTransactions,getBestCostNodeSelection},dependantModules:[ClientSideRowModelCoreModule,import_core9._CsrmSsrmSharedApiModule]},ClientSideRowModelModule={version:VERSION,moduleName:import_core9.ModuleNames.ClientSideRowModelModule,dependantModules:[ClientSideRowModelCoreModule,ClientSideRowModelApiModule]}; |
{ | ||
"name": "@ag-grid-community/client-side-row-model", | ||
"version": "32.0.1", | ||
"version": "32.0.2", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "32.0.1" | ||
"@ag-grid-community/core": "32.0.2" | ||
}, | ||
@@ -9,0 +9,0 @@ "main": "./dist/package/main.cjs.js", |
{ | ||
"name": "@ag-grid-community/client-side-row-model", | ||
"version": "32.0.1", | ||
"version": "32.0.2", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "32.0.1" | ||
"@ag-grid-community/core": "32.0.2" | ||
}, | ||
@@ -9,0 +9,0 @@ "main": "./src/main.js", |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "32.0.1"; | ||
export declare const VERSION = "32.0.2"; |
{ | ||
"name": "@ag-grid-community/client-side-row-model", | ||
"version": "32.0.1", | ||
"version": "32.0.2", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "32.0.1" | ||
"@ag-grid-community/core": "32.0.2" | ||
}, | ||
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
+ Added@ag-grid-community/core@32.0.2(transitive)
+ Addedag-charts-types@10.0.2(transitive)
- Removed@ag-grid-community/core@32.0.1(transitive)
- Removedag-charts-types@10.0.1(transitive)