@ag-grid-community/client-side-row-model
Advanced tools
Comparing version 31.2.0 to 31.2.1
@@ -1,1 +0,1 @@ | ||
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(t,e)=>{for(var o in e)__defProp(t,o,{get:e[o],enumerable:!0})},__copyProps=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of __getOwnPropNames(e))!__hasOwnProp.call(t,r)&&r!==o&&__defProp(t,r,{get:()=>e[r],enumerable:!(i=__getOwnPropDesc(e,r))||i.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,o,i)=>{for(var r=i>1?void 0:i?__getOwnPropDesc(e,o):e,s=t.length-1,n;s>=0;s--)(n=t[s])&&(r=(i?n(e,o,r):n(r))||r);return i&&r&&__defProp(e,o,r),r},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"),_ClientSideNodeManager=class w{constructor(e,o,i,r,s,n){this.nextId=0,this.rowCountReady=!1,this.allNodesMap={},this.rootNode=e,this.gridOptionsService=o,this.eventService=i,this.columnModel=r,this.beans=n,this.selectionService=s,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id=w.ROOT_NODE_ID,this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterAggFilter=[],this.rootNode.childrenAfterFilter=[]}getCopyOfNodesMap(){return import_core._.cloneObject(this.allNodesMap)}getRowNode(e){return this.allNodesMap[e]}setRowData(e){if(typeof e=="string"){console.warn("AG Grid: rowData must be an array, however you passed in a string. If you are loading JSON, make sure you convert the JSON string to JavaScript objects first");return}this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e);const o=this.rootNode,i=this.rootNode.sibling;o.childrenAfterFilter=null,o.childrenAfterGroup=null,o.childrenAfterAggFilter=null,o.childrenAfterSort=null,o.childrenMapped=null,o.updateHasChildren(),this.nextId=0,this.allNodesMap={},e?o.allLeafChildren=e.map(r=>this.createNode(r,this.rootNode,w.TOP_LEVEL)):(o.allLeafChildren=[],o.childrenAfterGroup=[]),i&&(i.childrenAfterFilter=o.childrenAfterFilter,i.childrenAfterGroup=o.childrenAfterGroup,i.childrenAfterAggFilter=o.childrenAfterAggFilter,i.childrenAfterSort=o.childrenAfterSort,i.childrenMapped=o.childrenMapped,i.allLeafChildren=o.allLeafChildren)}updateRowData(e,o){this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e.add);const i={remove:[],update:[],add:[]},r=[];return this.executeRemove(e,i,r),this.executeUpdate(e,i,r),this.executeAdd(e,i),this.updateSelection(r,"rowDataChanged"),o&&import_core._.sortRowNodesByOrder(this.rootNode.allLeafChildren,o),i}isRowCountReady(){return this.rowCountReady}dispatchRowDataUpdateStartedEvent(e){const o={type:import_core.Events.EVENT_ROW_DATA_UPDATE_STARTED,firstRowData:e?.length?e[0]:null};this.eventService.dispatchEvent(o)}updateSelection(e,o){const i=e.length>0;if(i&&this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,source:o}),this.selectionService.updateGroupsFromChildrenSelections(o),i){const r={type:import_core.Events.EVENT_SELECTION_CHANGED,source:o};this.eventService.dispatchEvent(r)}}executeAdd(e,o){var i;const{add:r,addIndex:s}=e;if(import_core._.missingOrEmpty(r))return;const n=r.map(l=>this.createNode(l,this.rootNode,w.TOP_LEVEL));if(typeof s=="number"&&s>=0){const{allLeafChildren:l}=this.rootNode,c=l.length;let d=s;if(this.gridOptionsService.get("treeData")&&s>0&&c>0){for(let u=0;u<c;u++)if(((i=l[u])==null?void 0:i.rowIndex)==s-1){d=u+1;break}}const h=l.slice(0,d),a=l.slice(d,l.length);this.rootNode.allLeafChildren=[...h,...n,...a]}else this.rootNode.allLeafChildren=[...this.rootNode.allLeafChildren,...n];this.rootNode.sibling&&(this.rootNode.sibling.allLeafChildren=this.rootNode.allLeafChildren),o.add=n}executeRemove(e,o,i){const{remove:r}=e;if(import_core._.missingOrEmpty(r))return;const s={};r.forEach(n=>{const l=this.lookupRowNode(n);l&&(l.isSelected()&&i.push(l),l.clearRowTopAndRowIndex(),s[l.id]=!0,delete this.allNodesMap[l.id],o.remove.push(l))}),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren.filter(n=>!s[n.id]),this.rootNode.sibling&&(this.rootNode.sibling.allLeafChildren=this.rootNode.allLeafChildren)}executeUpdate(e,o,i){const{update:r}=e;import_core._.missingOrEmpty(r)||r.forEach(s=>{const n=this.lookupRowNode(s);n&&(n.updateData(s),!n.selectable&&n.isSelected()&&i.push(n),this.setMasterForRow(n,s,w.TOP_LEVEL,!1),o.update.push(n))})}lookupRowNode(e){const o=this.gridOptionsService.getCallback("getRowId");let i;if(o){const r=o({data:e,level:0});if(i=this.allNodesMap[r],!i)return console.error(`AG Grid: could not find row id=${r}, data item was not found for this id`),null}else if(i=this.rootNode.allLeafChildren.find(r=>r.data===e),!i)return console.error("AG Grid: could not find data item as object was not found",e),console.error("Consider using getRowId to help the Grid find matching row data"),null;return i||null}createNode(e,o,i){const r=new import_core.RowNode(this.beans);r.group=!1,this.setMasterForRow(r,e,i,!0);const s=this.gridOptionsService.get("suppressParentsInRowNodes");return o&&!s&&(r.parent=o),r.level=i,r.setDataAndId(e,this.nextId.toString()),this.allNodesMap[r.id]&&console.warn(`AG Grid: 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,o,i,r){if(this.gridOptionsService.get("treeData"))e.setMaster(!1),r&&(e.expanded=!1);else{if(this.gridOptionsService.get("masterDetail")){const l=this.gridOptionsService.get("isRowMaster");l?e.setMaster(l(o)):e.setMaster(!0)}else e.setMaster(!1);if(r){const l=this.columnModel.getRowGroupColumns(),c=l?l.length:0,d=i+c;e.expanded=e.master?this.isExpanded(d):!1}}}isExpanded(e){const o=this.gridOptionsService.get("groupDefaultExpanded");return o===-1?!0:e<o}};_ClientSideNodeManager.TOP_LEVEL=0,_ClientSideNodeManager.ROOT_NODE_ID="ROOT_NODE_ID";var ClientSideNodeManager=_ClientSideNodeManager,ClientSideRowModel=class extends import_core2.BeanStub{constructor(){super(...arguments),this.onRowHeightChanged_debounced=import_core2._.debounce(this.onRowHeightChanged.bind(this),100),this.rowsToDisplay=[],this.hasStarted=!1,this.shouldSkipSettingDataOnStart=!1,this.isRefreshingModel=!1,this.rowCountReady=!1}init(){const t=this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.EVERYTHING}),e=!this.gridOptionsService.get("suppressAnimationFrame"),o=this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.EVERYTHING,afterColumnsChanged:!0,keepRenderedRows:!0,animate:e});this.addManagedListener(this.eventService,import_core2.Events.EVENT_NEW_COLUMNS_LOADED,o),this.addManagedListener(this.eventService,import_core2.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,t),this.addManagedListener(this.eventService,import_core2.Events.EVENT_COLUMN_VALUE_CHANGED,this.onValueChanged.bind(this)),this.addManagedListener(this.eventService,import_core2.Events.EVENT_COLUMN_PIVOT_CHANGED,this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.PIVOT})),this.addManagedListener(this.eventService,import_core2.Events.EVENT_FILTER_CHANGED,this.onFilterChanged.bind(this)),this.addManagedListener(this.eventService,import_core2.Events.EVENT_SORT_CHANGED,this.onSortChanged.bind(this)),this.addManagedListener(this.eventService,import_core2.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,t),this.addManagedListener(this.eventService,import_core2.Events.EVENT_GRID_STYLES_CHANGED,this.onGridStylesChanges.bind(this)),this.addManagedListener(this.eventService,import_core2.Events.EVENT_GRID_READY,()=>this.onGridReady()),this.addPropertyListeners(),this.rootNode=new import_core2.RowNode(this.beans),this.nodeManager=new ClientSideNodeManager(this.rootNode,this.gridOptionsService,this.eventService,this.columnModel,this.selectionService,this.beans)}addPropertyListeners(){const t=new Set(["treeData","masterDetail"]),e=new Set(["suppressParentsInRowNodes","groupDefaultExpanded","groupAllowUnbalanced","initialGroupOrderComparator","groupHideOpenParents","groupDisplayType"]),o=new Set(["excludeChildrenWhenTreeDataFiltering"]),i=new Set(["removePivotHeaderRowWhenSingleValueColumn","pivotRowTotals","pivotColumnGroupTotals","suppressExpandablePivotGroups"]),r=new Set(["getGroupRowAgg","alwaysAggregateAtRootLevel","groupIncludeTotalFooter","suppressAggFilteredOnly"]),s=new Set(["postSortRows","groupDisplayType","accentedSort"]),n=new Set([]),l=new Set(["groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupIncludeFooter"]),c=[...t,...e,...o,...i,...i,...r,...s,...n,...l];this.addManagedPropertyListeners(c,d=>{var p;const h=(p=d.changeSet)==null?void 0:p.properties;if(!h)return;const a=u=>h.some(g=>u.has(g));if(a(t)){this.setRowData(this.rootNode.allLeafChildren.map(u=>u.data));return}if(a(e)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING});return}if(a(o)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER});return}if(a(i)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT});return}if(a(r)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE});return}if(a(s)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT});return}if(a(n)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES});return}a(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 t=this.gridOptionsService.get("rowData");t&&(this.shouldSkipSettingDataOnStart=!0,this.setRowData(t))}ensureRowHeightsValid(t,e,o,i){let r,s=!1;do{r=!1;const n=this.getRowIndexAtPixel(t),l=this.getRowIndexAtPixel(e),c=Math.max(n,o),d=Math.min(l,i);for(let p=c;p<=d;p++){const h=this.getRow(p);if(h.rowHeightEstimated){const a=this.gridOptionsService.getRowHeightForNode(h);h.setRowHeight(a.height),r=!0,s=!0}}r&&this.setRowTopAndRowIndex()}while(r);return s}setRowTopAndRowIndex(){const t=this.environment.getDefaultRowHeight();let e=0;const o=new Set,i=this.gridOptionsService.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.gridOptionsService.getRowHeightForNode(s,i,t);s.setRowHeight(n.height,n.estimated)}s.setRowTop(e),s.setRowIndex(r),e+=s.rowHeight}return o}clearRowTopAndRowIndex(t,e){const o=t.isActive(),i=s=>{s&&s.id!=null&&!e.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(t,e,o=0){const i=this.getRowIndexAtPixel(e),r=this.getRow(i),s=!this.gridOptionsService.get("suppressAnimationFrame");return r===t[0]?!1:(t.forEach(n=>{import_core2._.removeFromArray(this.rootNode.allLeafChildren,n)}),t.forEach((n,l)=>{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(t,e){const o=e!=null?this.getRowIndexAtPixel(e):null,i=o!=null?this.getRow(o):null;if(!i||!t||i===t||e==null){this.lastHighlightedRow&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null);return}const r=this.getHighlightPosition(e,i);this.lastHighlightedRow&&this.lastHighlightedRow!==i&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null),i.setHighlighted(r),this.lastHighlightedRow=i}getHighlightPosition(t,e){if(!e){const r=this.getRowIndexAtPixel(t);if(e=this.getRow(r||0),!e)return import_core2.RowHighlightPosition.Below}const{rowTop:o,rowHeight:i}=e;return t-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 e=this.rootNode.childrenAfterAggFilter;return e?e.length:0}getTopLevelRowDisplayedIndex(t){if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return t;let o=this.rootNode.childrenAfterSort[t];if(this.gridOptionsService.get("groupHideOpenParents"))for(;o.expanded&&o.childrenAfterSort&&o.childrenAfterSort.length>0;)o=o.childrenAfterSort[0];return o.rowIndex}getRowBounds(t){if(import_core2._.missing(this.rowsToDisplay))return null;const e=this.rowsToDisplay[t];return e?{rowTop:e.rowTop,rowHeight:e.rowHeight}:null}onRowGroupOpened(){const t=this.gridOptionsService.isAnimateRows();this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:t})}onFilterChanged(t){if(t.afterDataChange)return;const e=this.gridOptionsService.isAnimateRows(),i=t.columns.length===0||t.columns.some(r=>r.isPrimary())?import_core2.ClientSideRowModelSteps.FILTER:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES;this.refreshModel({step:i,keepRenderedRows:!0,animate:e})}onSortChanged(){const t=this.gridOptionsService.isAnimateRows();this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT,keepRenderedRows:!0,animate:t,keepEditingRows:!0})}getType(){return"clientSide"}onValueChanged(){this.columnModel.isPivotActive()?this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT}):this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE})}createChangePath(t){const e=import_core2._.missingOrEmpty(t),o=new import_core2.ChangedPath(!1,this.rootNode);return(e||this.gridOptionsService.get("treeData"))&&o.setInactive(),o}isSuppressModelUpdateAfterUpdateTransaction(t){if(!this.gridOptionsService.get("suppressModelUpdateAfterUpdateTransaction")||t.rowNodeTransactions==null)return!1;const e=t.rowNodeTransactions.filter(i=>i.add!=null&&i.add.length>0||i.remove!=null&&i.remove.length>0);return e==null||e.length==0}buildRefreshModelParams(t){let e=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(import_core2._.exists(t)&&(e=o[t]),import_core2._.missing(e)){console.error(`AG Grid: invalid step ${t}, available steps are ${Object.keys(o).join(", ")}`);return}const i=!this.gridOptionsService.get("suppressAnimationFrame");return{step:e,keepRenderedRows:!0,keepEditingRows:!0,animate:i}}refreshModel(t){if(!this.hasStarted||this.isRefreshingModel||this.columnModel.shouldRowModelIgnoreRefresh())return;let e=typeof t=="object"&&"step"in t?t:this.buildRefreshModelParams(t);if(!e||this.isSuppressModelUpdateAfterUpdateTransaction(e))return;const o=this.createChangePath(e.rowNodeTransactions);switch(this.isRefreshingModel=!0,e.step){case import_core2.ClientSideRowModelSteps.EVERYTHING:this.doRowGrouping(e.rowNodeTransactions,e.rowNodeOrder,o,!!e.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(e.rowNodeTransactions,o);case import_core2.ClientSideRowModelSteps.MAP:this.doRowsToDisplay()}const i=this.setRowTopAndRowIndex();this.clearRowTopAndRowIndex(o,i),this.isRefreshingModel=!1;const r={type:import_core2.Events.EVENT_MODEL_UPDATED,animate:e.animate,keepRenderedRows:e.keepRenderedRows,newData:e.newData,newPage:!1,keepUndoRedoStack:e.keepUndoRedoStack};this.eventService.dispatchEvent(r)}isEmpty(){const t=import_core2._.missing(this.rootNode.allLeafChildren)||this.rootNode.allLeafChildren.length===0;return import_core2._.missing(this.rootNode)||t||!this.columnModel.isReady()}isRowsToRender(){return import_core2._.exists(this.rowsToDisplay)&&this.rowsToDisplay.length>0}getNodesInRangeForSelection(t,e){let o=!e,i=!1;const r=[],s=this.gridOptionsService.get("groupSelectsChildren");return this.forEachNodeAfterFilterAndSort(n=>{if(i)return;if(o&&(n===e||n===t)&&(i=!0,n.group&&s)){r.push(...n.allLeafChildren);return}if(!o){if(n!==e&&n!==t)return;o=!0}if(!n.group||!s){r.push(n);return}}),r}setDatasource(t){console.error("AG Grid: should never call setDatasource on clientSideRowController")}getTopLevelNodes(){return this.rootNode?this.rootNode.childrenAfterGroup:null}getRootNode(){return this.rootNode}getRow(t){return this.rowsToDisplay[t]}isRowPresent(t){return this.rowsToDisplay.indexOf(t)>=0}getRowIndexAtPixel(t){if(this.isEmpty()||this.rowsToDisplay.length===0)return-1;let e=0,o=this.rowsToDisplay.length-1;if(t<=0)return 0;if(import_core2._.last(this.rowsToDisplay).rowTop<=t)return this.rowsToDisplay.length-1;let r=-1,s=-1;for(;;){const n=Math.floor((e+o)/2),l=this.rowsToDisplay[n];if(this.isRowInPixel(l,t)||(l.rowTop<t?e=n+1:l.rowTop>t&&(o=n-1),r===e&&s===o))return n;r=e,s=o}}isRowInPixel(t,e){const o=t.rowTop,i=t.rowTop+t.rowHeight;return o<=e&&i>e}forEachLeafNode(t){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach((e,o)=>t(e,o))}forEachNode(t,e=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterGroup||[]],callback:t,recursionType:0,index:0,includeFooterNodes:e})}forEachNodeAfterFilter(t,e=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterAggFilter||[]],callback:t,recursionType:1,index:0,includeFooterNodes:e})}forEachNodeAfterFilterAndSort(t,e=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterSort||[]],callback:t,recursionType:2,index:0,includeFooterNodes:e})}forEachPivotNode(t,e=!1){this.recursivelyWalkNodesAndCallback({nodes:[this.rootNode],callback:t,recursionType:3,index:0,includeFooterNodes:e})}recursivelyWalkNodesAndCallback(t){var e;const{nodes:o,callback:i,recursionType:r,includeFooterNodes:s}=t;let{index:n}=t;for(let d=0;d<o.length;d++){const p=o[d];if(i(p,n++),p.hasChildren()&&!p.footer){let h=null;switch(r){case 0:h=p.childrenAfterGroup;break;case 1:h=p.childrenAfterAggFilter;break;case 2:h=p.childrenAfterSort;break;case 3:h=p.leafGroup?null:p.childrenAfterSort;break}h&&(n=this.recursivelyWalkNodesAndCallback({nodes:[...h],callback:i,recursionType:r,index:n,includeFooterNodes:s}))}}const l=(e=o[0])==null?void 0:e.parent;if(!s||!l)return n;if(l===this.rootNode){if(!this.gridOptionsService.get("groupIncludeTotalFooter"))return n}else if(!this.gridOptionsService.getGroupIncludeFooter()({node:l}))return n;return l.createFooter(),i(l.sibling,n++),n}doAggregate(t){this.aggregationStage&&this.aggregationStage.execute({rowNode:this.rootNode,changedPath:t})}doFilterAggregates(t){this.filterAggregatesStage?this.filterAggregatesStage.execute({rowNode:this.rootNode,changedPath:t}):this.rootNode.childrenAfterAggFilter=this.rootNode.childrenAfterFilter}expandOrCollapseAll(t){const e=this.gridOptionsService.get("treeData"),o=this.columnModel.isPivotActive(),i=n=>{n&&n.forEach(l=>{const c=()=>{l.expanded=t,i(l.childrenAfterGroup)};if(e){import_core2._.exists(l.childrenAfterGroup)&&c();return}if(o){!l.leafGroup&&c();return}l.group&&c()})};this.rootNode&&i(this.rootNode.childrenAfterGroup),this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP});const r=t?"expandAll":"collapseAll",s={type:import_core2.Events.EVENT_EXPAND_COLLAPSE_ALL,source:r};this.eventService.dispatchEvent(s)}doSort(t,e){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:t,changedPath:e})}doRowGrouping(t,e,o,i){if(this.groupStage){if(t?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:t,rowNodeOrder:e,changedPath:o}):this.groupStage.execute({rowNode:this.rootNode,changedPath:o,afterColumnsChanged:i}),this.gridOptionsService.get("groupSelectsChildren")&&this.selectionService.updateGroupsFromChildrenSelections("rowGroupChanged",o)){const s={type:import_core2.Events.EVENT_SELECTION_CHANGED,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:import_core2.Events.EVENT_ROW_COUNT_READY}))}doFilter(t){this.filterStage.execute({rowNode:this.rootNode,changedPath:t})}doPivot(t){this.pivotStage&&this.pivotStage.execute({rowNode:this.rootNode,changedPath:t})}getCopyOfNodesMap(){return this.nodeManager.getCopyOfNodesMap()}getRowNode(t){if(typeof t=="string"&&t.indexOf(import_core2.RowNode.ID_PREFIX_ROW_GROUP)==0){let o;return this.forEachNode(i=>{i.id===t&&(o=i)}),o}return this.nodeManager.getRowNode(t)}setRowData(t){this.selectionService.reset("rowDataChanged"),this.nodeManager.setRowData(t),this.hasStarted&&this.dispatchUpdateEventsAndRefresh()}dispatchUpdateEventsAndRefresh(){const t={type:import_core2.Events.EVENT_ROW_DATA_UPDATED};this.eventService.dispatchEvent(t),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,newData:!0})}batchUpdateRowData(t,e){if(this.applyAsyncTransactionsTimeout==null){this.rowDataTransactionBatch=[];const o=this.gridOptionsService.getAsyncTransactionWaitMillis();this.applyAsyncTransactionsTimeout=window.setTimeout(()=>{this.executeBatchUpdateRowData()},o)}this.rowDataTransactionBatch.push({rowDataTransaction:t,callback:e})}flushAsyncTransactions(){this.applyAsyncTransactionsTimeout!=null&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())}executeBatchUpdateRowData(){this.valueCache.onDataChanged();const t=[],e=[];let o=!1;if(this.rowDataTransactionBatch&&this.rowDataTransactionBatch.forEach(i=>{const r=this.nodeManager.updateRowData(i.rowDataTransaction,void 0);e.push(r),i.callback&&t.push(i.callback.bind(null,r)),typeof i.rowDataTransaction.addIndex=="number"&&(o=!0)}),this.commonUpdateRowData(e,void 0,o),t.length>0&&window.setTimeout(()=>{t.forEach(i=>i())},0),e.length>0){const i={type:import_core2.Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,results:e};this.eventService.dispatchEvent(i)}this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0}updateRowData(t,e){this.valueCache.onDataChanged();const o=this.nodeManager.updateRowData(t,e),i=typeof t.addIndex=="number";return this.commonUpdateRowData([o],e,i),o}createRowNodeOrder(){if(this.gridOptionsService.get("suppressMaintainUnsortedOrder"))return;const e={};if(this.rootNode&&this.rootNode.allLeafChildren)for(let o=0;o<this.rootNode.allLeafChildren.length;o++){const i=this.rootNode.allLeafChildren[o];e[i.id]=o}return e}commonUpdateRowData(t,e,o){if(!this.hasStarted)return;const i=!this.gridOptionsService.get("suppressAnimationFrame");o&&(e=this.createRowNodeOrder());const r={type:import_core2.Events.EVENT_ROW_DATA_UPDATED};this.eventService.dispatchEvent(r),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:t,rowNodeOrder:e,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 t=this.resetRowHeightsForAllRowNodes();this.rootNode.setRowHeight(this.rootNode.rowHeight,!0),this.rootNode.sibling&&this.rootNode.sibling.setRowHeight(this.rootNode.sibling.rowHeight,!0),t&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let t=!1;return this.forEachNode(e=>{e.setRowHeight(e.rowHeight,!0);const o=e.detailNode;o&&o.setRowHeight(o.rowHeight,!0),e.sibling&&e.sibling.setRowHeight(e.sibling.rowHeight,!0),t=!0}),t}onGridStylesChanges(){this.columnModel.isAutoRowHeightActive()||this.resetRowHeights()}onGridReady(){this.hasStarted||this.setInitialData()}isRowDataLoaded(){return this.rowCountReady}};__decorateClass([(0,import_core2.Autowired)("columnModel")],ClientSideRowModel.prototype,"columnModel",2),__decorateClass([(0,import_core2.Autowired)("selectionService")],ClientSideRowModel.prototype,"selectionService",2),__decorateClass([(0,import_core2.Autowired)("filterManager")],ClientSideRowModel.prototype,"filterManager",2),__decorateClass([(0,import_core2.Autowired)("valueCache")],ClientSideRowModel.prototype,"valueCache",2),__decorateClass([(0,import_core2.Autowired)("beans")],ClientSideRowModel.prototype,"beans",2),__decorateClass([(0,import_core2.Autowired)("filterStage")],ClientSideRowModel.prototype,"filterStage",2),__decorateClass([(0,import_core2.Autowired)("sortStage")],ClientSideRowModel.prototype,"sortStage",2),__decorateClass([(0,import_core2.Autowired)("flattenStage")],ClientSideRowModel.prototype,"flattenStage",2),__decorateClass([(0,import_core2.Optional)("groupStage")],ClientSideRowModel.prototype,"groupStage",2),__decorateClass([(0,import_core2.Optional)("aggregationStage")],ClientSideRowModel.prototype,"aggregationStage",2),__decorateClass([(0,import_core2.Optional)("pivotStage")],ClientSideRowModel.prototype,"pivotStage",2),__decorateClass([(0,import_core2.Optional)("filterAggregatesStage")],ClientSideRowModel.prototype,"filterAggregatesStage",2),__decorateClass([import_core2.PostConstruct],ClientSideRowModel.prototype,"init",1),ClientSideRowModel=__decorateClass([(0,import_core2.Bean)("rowModel")],ClientSideRowModel);var import_core3=require("@ag-grid-community/core"),FilterStage=class extends import_core3.BeanStub{execute(t){const{changedPath:e}=t;this.filterService.filter(e)}};__decorateClass([(0,import_core3.Autowired)("filterService")],FilterStage.prototype,"filterService",2),FilterStage=__decorateClass([(0,import_core3.Bean)("filterStage")],FilterStage);var import_core4=require("@ag-grid-community/core"),SortStage=class extends import_core4.BeanStub{execute(t){const e=this.sortController.getSortOptions(),o=import_core4._.exists(e)&&e.length>0,i=o&&import_core4._.exists(t.rowNodeTransactions)&&this.gridOptionsService.get("deltaSort"),r=e.some(s=>this.gridOptionsService.isColumnsSortingCoupledToGroup()?s.column.isPrimary()&&s.column.isRowGroupActive():!!s.column.getColDef().showRowGroup);this.sortService.sort(e,o,i,t.rowNodeTransactions,t.changedPath,r)}};__decorateClass([(0,import_core4.Autowired)("sortService")],SortStage.prototype,"sortService",2),__decorateClass([(0,import_core4.Autowired)("sortController")],SortStage.prototype,"sortController",2),SortStage=__decorateClass([(0,import_core4.Bean)("sortStage")],SortStage);var import_core5=require("@ag-grid-community/core"),FlattenStage=class extends import_core5.BeanStub{execute(t){const e=t.rowNode,o=[],i=this.columnModel.isPivotMode(),r=i&&e.leafGroup,s=r?[e]:e.childrenAfterSort,n=this.getFlattenDetails();this.recursivelyAddToRowsToDisplay(n,s,o,i,0);const l=o.length>0;return!r&&l&&n.groupIncludeTotalFooter&&(e.createFooter(),this.addRowNodeToRowsToDisplay(n,e.sibling,o,0)),o}getFlattenDetails(){const t=this.gridOptionsService.get("groupRemoveSingleChildren");return{groupRemoveLowestSingleChildren:!t&&this.gridOptionsService.get("groupRemoveLowestSingleChildren"),groupRemoveSingleChildren:t,isGroupMultiAutoColumn:this.gridOptionsService.isGroupMultiAutoColumn(),hideOpenParents:this.gridOptionsService.get("groupHideOpenParents"),groupIncludeTotalFooter:this.gridOptionsService.get("groupIncludeTotalFooter"),getGroupIncludeFooter:this.gridOptionsService.getGroupIncludeFooter()}}recursivelyAddToRowsToDisplay(t,e,o,i,r){if(!import_core5._.missingOrEmpty(e))for(let s=0;s<e.length;s++){const n=e[s],l=n.hasChildren(),c=i&&!l,d=t.groupRemoveSingleChildren&&l&&n.childrenAfterGroup.length===1,p=t.groupRemoveLowestSingleChildren&&l&&n.leafGroup&&n.childrenAfterGroup.length===1,h=i&&n.leafGroup,a=t.hideOpenParents&&n.expanded&&!n.master&&!h;if(!c&&!a&&!d&&!p&&this.addRowNodeToRowsToDisplay(t,n,o,r),!(i&&n.leafGroup)){if(l){const g=d||p;if(n.expanded||g){const S=g?r:r+1;this.recursivelyAddToRowsToDisplay(t,n.childrenAfterSort,o,i,S),t.getGroupIncludeFooter({node:n})?(n.createFooter(),this.addRowNodeToRowsToDisplay(t,n.sibling,o,S)):n.destroyFooter()}}else if(n.master&&n.expanded){const g=this.createDetailNode(n);this.addRowNodeToRowsToDisplay(t,g,o,r)}}}}addRowNodeToRowsToDisplay(t,e,o,i){o.push(e),e.setUiLevel(t.isGroupMultiAutoColumn?0:i)}createDetailNode(t){if(import_core5._.exists(t.detailNode))return t.detailNode;const e=new import_core5.RowNode(this.beans);return e.detail=!0,e.selectable=!1,e.parent=t,import_core5._.exists(t.id)&&(e.id="detail_"+t.id),e.data=t.data,e.level=t.level+1,t.detailNode=e,e}};__decorateClass([(0,import_core5.Autowired)("columnModel")],FlattenStage.prototype,"columnModel",2),__decorateClass([(0,import_core5.Autowired)("beans")],FlattenStage.prototype,"beans",2),FlattenStage=__decorateClass([(0,import_core5.Bean)("flattenStage")],FlattenStage);var import_core6=require("@ag-grid-community/core"),SortService=class extends import_core6.BeanStub{sort(t,e,o,i,r,s){const n=this.gridOptionsService.get("groupMaintainOrder"),l=this.columnModel.getAllGridColumns().some(a=>a.isRowGroupActive());let c={};o&&i&&(c=this.calculateDirtyNodes(i));const d=this.columnModel.isPivotMode(),p=this.gridOptionsService.getCallback("postSortRows"),h=a=>{var u;this.pullDownGroupDataForHideOpenParents(a.childrenAfterAggFilter,!0);const g=d&&a.leafGroup;if(n&&l&&!a.leafGroup&&!s){const f=(u=this.columnModel.getRowGroupColumns())==null?void 0:u[a.level+1],T=f?.getSort()===null,C=a.childrenAfterAggFilter.slice(0);if(a.childrenAfterSort&&!T){const R={};a.childrenAfterSort.forEach((v,A)=>{R[v.id]=A}),C.sort((v,A)=>{var m,E;return((m=R[v.id])!=null?m:0)-((E=R[A.id])!=null?E:0)})}a.childrenAfterSort=C}else!e||g?a.childrenAfterSort=a.childrenAfterAggFilter.slice(0):o?a.childrenAfterSort=this.doDeltaSort(a,c,r,t):a.childrenAfterSort=this.rowNodeSorter.doFullSort(a.childrenAfterAggFilter,t);if(a.sibling&&(a.sibling.childrenAfterSort=a.childrenAfterSort),this.updateChildIndexes(a),p){const f={nodes:a.childrenAfterSort};p(f)}};r&&r.forEachChangedNodeDepthFirst(h),this.updateGroupDataForHideOpenParents(r)}calculateDirtyNodes(t){const e={},o=i=>{i&&i.forEach(r=>e[r.id]=!0)};return t&&t.forEach(i=>{o(i.add),o(i.update),o(i.remove)}),e}doDeltaSort(t,e,o,i){const r=t.childrenAfterAggFilter,s=t.childrenAfterSort;if(!s)return this.rowNodeSorter.doFullSort(r,i);const n={},l=[];r.forEach(h=>{e[h.id]||!o.canSkip(h)?l.push(h):n[h.id]=!0});const c=s.filter(h=>n[h.id]),d=(h,a)=>({currentPos:a,rowNode:h}),p=l.map(d).sort((h,a)=>this.rowNodeSorter.compareRowNodes(i,h,a));return this.mergeSortedArrays(i,p,c.map(d)).map(({rowNode:h})=>h)}mergeSortedArrays(t,e,o){const i=[];let r=0,s=0;for(;r<e.length&&s<o.length;)this.rowNodeSorter.compareRowNodes(t,e[r],o[s])<0?i.push(e[r++]):i.push(o[s++]);for(;r<e.length;)i.push(e[r++]);for(;s<o.length;)i.push(o[s++]);return i}updateChildIndexes(t){if(import_core6._.missing(t.childrenAfterSort))return;const e=t.childrenAfterSort;for(let o=0;o<e.length;o++){const i=e[o],r=o===0,s=o===t.childrenAfterSort.length-1;i.setFirstChild(r),i.setLastChild(s),i.setChildIndex(o)}}updateGroupDataForHideOpenParents(t){if(!this.gridOptionsService.get("groupHideOpenParents"))return;if(this.gridOptionsService.get("treeData"))return import_core6._.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 e=o=>{this.pullDownGroupDataForHideOpenParents(o.childrenAfterSort,!1),o.childrenAfterSort.forEach(i=>{i.hasChildren()&&e(i)})};t&&t.executeFromRootNode(o=>e(o))}pullDownGroupDataForHideOpenParents(t,e){!this.gridOptionsService.get("groupHideOpenParents")||import_core6._.missing(t)||t.forEach(o=>{this.columnModel.getGroupDisplayColumns().forEach(r=>{const s=r.getColDef().showRowGroup;if(typeof s!="string"){console.error("AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup");return}const n=s,l=this.columnModel.getPrimaryColumn(n);if(l!==o.rowGroupColumn)if(e)o.setGroupValue(r.getId(),void 0);else{const d=o.getFirstChildOfFirstChild(l);d&&o.setGroupValue(r.getId(),d.key)}})})}};__decorateClass([(0,import_core6.Autowired)("columnModel")],SortService.prototype,"columnModel",2),__decorateClass([(0,import_core6.Autowired)("rowNodeSorter")],SortService.prototype,"rowNodeSorter",2),SortService=__decorateClass([(0,import_core6.Bean)("sortService")],SortService);var import_core7=require("@ag-grid-community/core"),FilterService=class extends import_core7.BeanStub{filter(t){const e=this.filterManager.isChildFilterPresent();this.filterNodes(e,t)}filterNodes(t,e){const o=(i,r)=>{i.hasChildren()&&t&&!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 c=s.childrenAfterGroup[l],d=n||this.filterManager.doesRowPassFilter({rowNode:c});c.childrenAfterGroup?i(s.childrenAfterGroup[l],d):o(c,d)}o(s,n)},r=s=>i(s,!1);e.executeFromRootNode(r)}else{const i=r=>o(r,!1);e.forEachChangedNodeDepthFirst(i,!0)}}doingTreeDataFiltering(){return this.gridOptionsService.get("treeData")&&!this.gridOptionsService.get("excludeChildrenWhenTreeDataFiltering")}};__decorateClass([(0,import_core7.Autowired)("filterManager")],FilterService.prototype,"filterManager",2),FilterService=__decorateClass([(0,import_core7.Bean)("filterService")],FilterService);var import_core8=require("@ag-grid-community/core"),ImmutableService=class extends import_core8.BeanStub{postConstruct(){this.rowModel.getType()==="clientSide"&&(this.clientSideRowModel=this.rowModel,this.addManagedPropertyListener("rowData",()=>this.onRowDataUpdated()))}isActive(){const t=this.gridOptionsService.exists("getRowId");return this.gridOptionsService.get("resetRowDataOnUpdate")?!1:t}setRowData(t){const e=this.createTransactionForRowData(t);if(!e)return;const[o,i]=e;this.clientSideRowModel.updateRowData(o,i)}createTransactionForRowData(t){if(import_core8._.missing(this.clientSideRowModel)){console.error("AG Grid: ImmutableService only works with ClientSideRowModel");return}const e=this.gridOptionsService.getCallback("getRowId");if(e==null){console.error("AG Grid: ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!");return}const o={remove:[],update:[],add:[]},i=this.clientSideRowModel.getCopyOfNodesMap(),s=this.gridOptionsService.get("suppressMaintainUnsortedOrder")?void 0:{};return import_core8._.exists(t)&&t.forEach((n,l)=>{const c=e({data:n,level:0}),d=i[c];s&&(s[c]=l),d?(d.data!==n&&o.update.push(n),i[c]=void 0):o.add.push(n)}),import_core8._.iterateObject(i,(n,l)=>{l&&o.remove.push(l.data)}),[o,s]}onRowDataUpdated(){const t=this.gridOptionsService.get("rowData");t&&(this.isActive()?this.setRowData(t):(this.selectionService.reset("rowDataChanged"),this.clientSideRowModel.setRowData(t)))}};__decorateClass([(0,import_core8.Autowired)("rowModel")],ImmutableService.prototype,"rowModel",2),__decorateClass([(0,import_core8.Autowired)("rowRenderer")],ImmutableService.prototype,"rowRenderer",2),__decorateClass([(0,import_core8.Autowired)("selectionService")],ImmutableService.prototype,"selectionService",2),__decorateClass([import_core8.PostConstruct],ImmutableService.prototype,"postConstruct",1),ImmutableService=__decorateClass([(0,import_core8.Bean)("immutableService")],ImmutableService);var VERSION="31.2.0",ClientSideRowModelModule={version:VERSION,moduleName:import_core9.ModuleNames.ClientSideRowModelModule,rowModel:"clientSide",beans:[ClientSideRowModel,FilterStage,SortStage,FlattenStage,SortService,FilterService,ImmutableService]}; | ||
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(t,e)=>{for(var o in e)__defProp(t,o,{get:e[o],enumerable:!0})},__copyProps=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of __getOwnPropNames(e))!__hasOwnProp.call(t,r)&&r!==o&&__defProp(t,r,{get:()=>e[r],enumerable:!(i=__getOwnPropDesc(e,r))||i.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,o,i)=>{for(var r=i>1?void 0:i?__getOwnPropDesc(e,o):e,s=t.length-1,n;s>=0;s--)(n=t[s])&&(r=(i?n(e,o,r):n(r))||r);return i&&r&&__defProp(e,o,r),r},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"),_ClientSideNodeManager=class w{constructor(e,o,i,r,s,n){this.nextId=0,this.rowCountReady=!1,this.allNodesMap={},this.rootNode=e,this.gridOptionsService=o,this.eventService=i,this.columnModel=r,this.beans=n,this.selectionService=s,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id=w.ROOT_NODE_ID,this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterAggFilter=[],this.rootNode.childrenAfterFilter=[]}getCopyOfNodesMap(){return import_core._.cloneObject(this.allNodesMap)}getRowNode(e){return this.allNodesMap[e]}setRowData(e){if(typeof e=="string"){console.warn("AG Grid: rowData must be an array, however you passed in a string. If you are loading JSON, make sure you convert the JSON string to JavaScript objects first");return}this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e);const o=this.rootNode,i=this.rootNode.sibling;o.childrenAfterFilter=null,o.childrenAfterGroup=null,o.childrenAfterAggFilter=null,o.childrenAfterSort=null,o.childrenMapped=null,o.updateHasChildren(),this.nextId=0,this.allNodesMap={},e?o.allLeafChildren=e.map(r=>this.createNode(r,this.rootNode,w.TOP_LEVEL)):(o.allLeafChildren=[],o.childrenAfterGroup=[]),i&&(i.childrenAfterFilter=o.childrenAfterFilter,i.childrenAfterGroup=o.childrenAfterGroup,i.childrenAfterAggFilter=o.childrenAfterAggFilter,i.childrenAfterSort=o.childrenAfterSort,i.childrenMapped=o.childrenMapped,i.allLeafChildren=o.allLeafChildren)}updateRowData(e,o){this.rowCountReady=!0,this.dispatchRowDataUpdateStartedEvent(e.add);const i={remove:[],update:[],add:[]},r=[];return this.executeRemove(e,i,r),this.executeUpdate(e,i,r),this.executeAdd(e,i),this.updateSelection(r,"rowDataChanged"),o&&import_core._.sortRowNodesByOrder(this.rootNode.allLeafChildren,o),i}isRowCountReady(){return this.rowCountReady}dispatchRowDataUpdateStartedEvent(e){const o={type:import_core.Events.EVENT_ROW_DATA_UPDATE_STARTED,firstRowData:e?.length?e[0]:null};this.eventService.dispatchEvent(o)}updateSelection(e,o){const i=e.length>0;if(i&&this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,source:o}),this.selectionService.updateGroupsFromChildrenSelections(o),i){const r={type:import_core.Events.EVENT_SELECTION_CHANGED,source:o};this.eventService.dispatchEvent(r)}}executeAdd(e,o){var i;const{add:r,addIndex:s}=e;if(import_core._.missingOrEmpty(r))return;const n=r.map(l=>this.createNode(l,this.rootNode,w.TOP_LEVEL));if(typeof s=="number"&&s>=0){const{allLeafChildren:l}=this.rootNode,c=l.length;let d=s;if(this.gridOptionsService.get("treeData")&&s>0&&c>0){for(let u=0;u<c;u++)if(((i=l[u])==null?void 0:i.rowIndex)==s-1){d=u+1;break}}const h=l.slice(0,d),a=l.slice(d,l.length);this.rootNode.allLeafChildren=[...h,...n,...a]}else this.rootNode.allLeafChildren=[...this.rootNode.allLeafChildren,...n];this.rootNode.sibling&&(this.rootNode.sibling.allLeafChildren=this.rootNode.allLeafChildren),o.add=n}executeRemove(e,o,i){const{remove:r}=e;if(import_core._.missingOrEmpty(r))return;const s={};r.forEach(n=>{const l=this.lookupRowNode(n);l&&(l.isSelected()&&i.push(l),l.clearRowTopAndRowIndex(),s[l.id]=!0,delete this.allNodesMap[l.id],o.remove.push(l))}),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren.filter(n=>!s[n.id]),this.rootNode.sibling&&(this.rootNode.sibling.allLeafChildren=this.rootNode.allLeafChildren)}executeUpdate(e,o,i){const{update:r}=e;import_core._.missingOrEmpty(r)||r.forEach(s=>{const n=this.lookupRowNode(s);n&&(n.updateData(s),!n.selectable&&n.isSelected()&&i.push(n),this.setMasterForRow(n,s,w.TOP_LEVEL,!1),o.update.push(n))})}lookupRowNode(e){const o=this.gridOptionsService.getCallback("getRowId");let i;if(o){const r=o({data:e,level:0});if(i=this.allNodesMap[r],!i)return console.error(`AG Grid: could not find row id=${r}, data item was not found for this id`),null}else if(i=this.rootNode.allLeafChildren.find(r=>r.data===e),!i)return console.error("AG Grid: could not find data item as object was not found",e),console.error("Consider using getRowId to help the Grid find matching row data"),null;return i||null}createNode(e,o,i){const r=new import_core.RowNode(this.beans);r.group=!1,this.setMasterForRow(r,e,i,!0);const s=this.gridOptionsService.get("suppressParentsInRowNodes");return o&&!s&&(r.parent=o),r.level=i,r.setDataAndId(e,this.nextId.toString()),this.allNodesMap[r.id]&&console.warn(`AG Grid: 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,o,i,r){if(this.gridOptionsService.get("treeData"))e.setMaster(!1),r&&(e.expanded=!1);else{if(this.gridOptionsService.get("masterDetail")){const l=this.gridOptionsService.get("isRowMaster");l?e.setMaster(l(o)):e.setMaster(!0)}else e.setMaster(!1);if(r){const l=this.columnModel.getRowGroupColumns(),c=l?l.length:0,d=i+c;e.expanded=e.master?this.isExpanded(d):!1}}}isExpanded(e){const o=this.gridOptionsService.get("groupDefaultExpanded");return o===-1?!0:e<o}};_ClientSideNodeManager.TOP_LEVEL=0,_ClientSideNodeManager.ROOT_NODE_ID="ROOT_NODE_ID";var ClientSideNodeManager=_ClientSideNodeManager,ClientSideRowModel=class extends import_core2.BeanStub{constructor(){super(...arguments),this.onRowHeightChanged_debounced=import_core2._.debounce(this.onRowHeightChanged.bind(this),100),this.rowsToDisplay=[],this.hasStarted=!1,this.shouldSkipSettingDataOnStart=!1,this.isRefreshingModel=!1,this.rowCountReady=!1}init(){const t=this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.EVERYTHING}),e=!this.gridOptionsService.get("suppressAnimationFrame"),o=this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.EVERYTHING,afterColumnsChanged:!0,keepRenderedRows:!0,animate:e});this.addManagedListener(this.eventService,import_core2.Events.EVENT_NEW_COLUMNS_LOADED,o),this.addManagedListener(this.eventService,import_core2.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,t),this.addManagedListener(this.eventService,import_core2.Events.EVENT_COLUMN_VALUE_CHANGED,this.onValueChanged.bind(this)),this.addManagedListener(this.eventService,import_core2.Events.EVENT_COLUMN_PIVOT_CHANGED,this.refreshModel.bind(this,{step:import_core2.ClientSideRowModelSteps.PIVOT})),this.addManagedListener(this.eventService,import_core2.Events.EVENT_FILTER_CHANGED,this.onFilterChanged.bind(this)),this.addManagedListener(this.eventService,import_core2.Events.EVENT_SORT_CHANGED,this.onSortChanged.bind(this)),this.addManagedListener(this.eventService,import_core2.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,t),this.addManagedListener(this.eventService,import_core2.Events.EVENT_GRID_STYLES_CHANGED,this.onGridStylesChanges.bind(this)),this.addManagedListener(this.eventService,import_core2.Events.EVENT_GRID_READY,()=>this.onGridReady()),this.addPropertyListeners(),this.rootNode=new import_core2.RowNode(this.beans),this.nodeManager=new ClientSideNodeManager(this.rootNode,this.gridOptionsService,this.eventService,this.columnModel,this.selectionService,this.beans)}addPropertyListeners(){const t=new Set(["treeData","masterDetail"]),e=new Set(["suppressParentsInRowNodes","groupDefaultExpanded","groupAllowUnbalanced","initialGroupOrderComparator","groupHideOpenParents","groupDisplayType"]),o=new Set(["excludeChildrenWhenTreeDataFiltering"]),i=new Set(["removePivotHeaderRowWhenSingleValueColumn","pivotRowTotals","pivotColumnGroupTotals","suppressExpandablePivotGroups"]),r=new Set(["getGroupRowAgg","alwaysAggregateAtRootLevel","groupIncludeTotalFooter","suppressAggFilteredOnly"]),s=new Set(["postSortRows","groupDisplayType","accentedSort"]),n=new Set([]),l=new Set(["groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupIncludeFooter"]),c=[...t,...e,...o,...i,...i,...r,...s,...n,...l];this.addManagedPropertyListeners(c,d=>{var p;const h=(p=d.changeSet)==null?void 0:p.properties;if(!h)return;const a=u=>h.some(g=>u.has(g));if(a(t)){this.setRowData(this.rootNode.allLeafChildren.map(u=>u.data));return}if(a(e)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING});return}if(a(o)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER});return}if(a(i)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT});return}if(a(r)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE});return}if(a(s)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT});return}if(a(n)){this.refreshModel({step:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES});return}a(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 t=this.gridOptionsService.get("rowData");t&&(this.shouldSkipSettingDataOnStart=!0,this.setRowData(t))}ensureRowHeightsValid(t,e,o,i){let r,s=!1;do{r=!1;const n=this.getRowIndexAtPixel(t),l=this.getRowIndexAtPixel(e),c=Math.max(n,o),d=Math.min(l,i);for(let p=c;p<=d;p++){const h=this.getRow(p);if(h.rowHeightEstimated){const a=this.gridOptionsService.getRowHeightForNode(h);h.setRowHeight(a.height),r=!0,s=!0}}r&&this.setRowTopAndRowIndex()}while(r);return s}setRowTopAndRowIndex(){const t=this.environment.getDefaultRowHeight();let e=0;const o=new Set,i=this.gridOptionsService.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.gridOptionsService.getRowHeightForNode(s,i,t);s.setRowHeight(n.height,n.estimated)}s.setRowTop(e),s.setRowIndex(r),e+=s.rowHeight}return o}clearRowTopAndRowIndex(t,e){const o=t.isActive(),i=s=>{s&&s.id!=null&&!e.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(t,e,o=0){const i=this.getRowIndexAtPixel(e),r=this.getRow(i),s=!this.gridOptionsService.get("suppressAnimationFrame");return r===t[0]?!1:(t.forEach(n=>{import_core2._.removeFromArray(this.rootNode.allLeafChildren,n)}),t.forEach((n,l)=>{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(t,e){const o=e!=null?this.getRowIndexAtPixel(e):null,i=o!=null?this.getRow(o):null;if(!i||!t||i===t||e==null){this.lastHighlightedRow&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null);return}const r=this.getHighlightPosition(e,i);this.lastHighlightedRow&&this.lastHighlightedRow!==i&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null),i.setHighlighted(r),this.lastHighlightedRow=i}getHighlightPosition(t,e){if(!e){const r=this.getRowIndexAtPixel(t);if(e=this.getRow(r||0),!e)return import_core2.RowHighlightPosition.Below}const{rowTop:o,rowHeight:i}=e;return t-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 e=this.rootNode.childrenAfterAggFilter;return e?e.length:0}getTopLevelRowDisplayedIndex(t){if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return t;let o=this.rootNode.childrenAfterSort[t];if(this.gridOptionsService.get("groupHideOpenParents"))for(;o.expanded&&o.childrenAfterSort&&o.childrenAfterSort.length>0;)o=o.childrenAfterSort[0];return o.rowIndex}getRowBounds(t){if(import_core2._.missing(this.rowsToDisplay))return null;const e=this.rowsToDisplay[t];return e?{rowTop:e.rowTop,rowHeight:e.rowHeight}:null}onRowGroupOpened(){const t=this.gridOptionsService.isAnimateRows();this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:t})}onFilterChanged(t){if(t.afterDataChange)return;const e=this.gridOptionsService.isAnimateRows(),i=t.columns.length===0||t.columns.some(r=>r.isPrimary())?import_core2.ClientSideRowModelSteps.FILTER:import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES;this.refreshModel({step:i,keepRenderedRows:!0,animate:e})}onSortChanged(){const t=this.gridOptionsService.isAnimateRows();this.refreshModel({step:import_core2.ClientSideRowModelSteps.SORT,keepRenderedRows:!0,animate:t,keepEditingRows:!0})}getType(){return"clientSide"}onValueChanged(){this.columnModel.isPivotActive()?this.refreshModel({step:import_core2.ClientSideRowModelSteps.PIVOT}):this.refreshModel({step:import_core2.ClientSideRowModelSteps.AGGREGATE})}createChangePath(t){const e=import_core2._.missingOrEmpty(t),o=new import_core2.ChangedPath(!1,this.rootNode);return(e||this.gridOptionsService.get("treeData"))&&o.setInactive(),o}isSuppressModelUpdateAfterUpdateTransaction(t){if(!this.gridOptionsService.get("suppressModelUpdateAfterUpdateTransaction")||t.rowNodeTransactions==null)return!1;const e=t.rowNodeTransactions.filter(i=>i.add!=null&&i.add.length>0||i.remove!=null&&i.remove.length>0);return e==null||e.length==0}buildRefreshModelParams(t){let e=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(import_core2._.exists(t)&&(e=o[t]),import_core2._.missing(e)){console.error(`AG Grid: invalid step ${t}, available steps are ${Object.keys(o).join(", ")}`);return}const i=!this.gridOptionsService.get("suppressAnimationFrame");return{step:e,keepRenderedRows:!0,keepEditingRows:!0,animate:i}}refreshModel(t){if(!this.hasStarted||this.isRefreshingModel||this.columnModel.shouldRowModelIgnoreRefresh())return;let e=typeof t=="object"&&"step"in t?t:this.buildRefreshModelParams(t);if(!e||this.isSuppressModelUpdateAfterUpdateTransaction(e))return;const o=this.createChangePath(e.rowNodeTransactions);switch(this.isRefreshingModel=!0,e.step){case import_core2.ClientSideRowModelSteps.EVERYTHING:this.doRowGrouping(e.rowNodeTransactions,e.rowNodeOrder,o,!!e.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(e.rowNodeTransactions,o);case import_core2.ClientSideRowModelSteps.MAP:this.doRowsToDisplay()}const i=this.setRowTopAndRowIndex();this.clearRowTopAndRowIndex(o,i),this.isRefreshingModel=!1;const r={type:import_core2.Events.EVENT_MODEL_UPDATED,animate:e.animate,keepRenderedRows:e.keepRenderedRows,newData:e.newData,newPage:!1,keepUndoRedoStack:e.keepUndoRedoStack};this.eventService.dispatchEvent(r)}isEmpty(){const t=import_core2._.missing(this.rootNode.allLeafChildren)||this.rootNode.allLeafChildren.length===0;return import_core2._.missing(this.rootNode)||t||!this.columnModel.isReady()}isRowsToRender(){return import_core2._.exists(this.rowsToDisplay)&&this.rowsToDisplay.length>0}getNodesInRangeForSelection(t,e){let o=!e,i=!1;const r=[],s=this.gridOptionsService.get("groupSelectsChildren");return this.forEachNodeAfterFilterAndSort(n=>{if(i)return;if(o&&(n===e||n===t)&&(i=!0,n.group&&s)){r.push(...n.allLeafChildren);return}if(!o){if(n!==e&&n!==t)return;o=!0}if(!n.group||!s){r.push(n);return}}),r}setDatasource(t){console.error("AG Grid: should never call setDatasource on clientSideRowController")}getTopLevelNodes(){return this.rootNode?this.rootNode.childrenAfterGroup:null}getRootNode(){return this.rootNode}getRow(t){return this.rowsToDisplay[t]}isRowPresent(t){return this.rowsToDisplay.indexOf(t)>=0}getRowIndexAtPixel(t){if(this.isEmpty()||this.rowsToDisplay.length===0)return-1;let e=0,o=this.rowsToDisplay.length-1;if(t<=0)return 0;if(import_core2._.last(this.rowsToDisplay).rowTop<=t)return this.rowsToDisplay.length-1;let r=-1,s=-1;for(;;){const n=Math.floor((e+o)/2),l=this.rowsToDisplay[n];if(this.isRowInPixel(l,t)||(l.rowTop<t?e=n+1:l.rowTop>t&&(o=n-1),r===e&&s===o))return n;r=e,s=o}}isRowInPixel(t,e){const o=t.rowTop,i=t.rowTop+t.rowHeight;return o<=e&&i>e}forEachLeafNode(t){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach((e,o)=>t(e,o))}forEachNode(t,e=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterGroup||[]],callback:t,recursionType:0,index:0,includeFooterNodes:e})}forEachNodeAfterFilter(t,e=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterAggFilter||[]],callback:t,recursionType:1,index:0,includeFooterNodes:e})}forEachNodeAfterFilterAndSort(t,e=!1){this.recursivelyWalkNodesAndCallback({nodes:[...this.rootNode.childrenAfterSort||[]],callback:t,recursionType:2,index:0,includeFooterNodes:e})}forEachPivotNode(t,e=!1){this.recursivelyWalkNodesAndCallback({nodes:[this.rootNode],callback:t,recursionType:3,index:0,includeFooterNodes:e})}recursivelyWalkNodesAndCallback(t){var e;const{nodes:o,callback:i,recursionType:r,includeFooterNodes:s}=t;let{index:n}=t;for(let d=0;d<o.length;d++){const p=o[d];if(i(p,n++),p.hasChildren()&&!p.footer){let h=null;switch(r){case 0:h=p.childrenAfterGroup;break;case 1:h=p.childrenAfterAggFilter;break;case 2:h=p.childrenAfterSort;break;case 3:h=p.leafGroup?null:p.childrenAfterSort;break}h&&(n=this.recursivelyWalkNodesAndCallback({nodes:[...h],callback:i,recursionType:r,index:n,includeFooterNodes:s}))}}const l=(e=o[0])==null?void 0:e.parent;if(!s||!l)return n;if(l===this.rootNode){if(!this.gridOptionsService.get("groupIncludeTotalFooter"))return n}else if(!this.gridOptionsService.getGroupIncludeFooter()({node:l}))return n;return l.createFooter(),i(l.sibling,n++),n}doAggregate(t){this.aggregationStage&&this.aggregationStage.execute({rowNode:this.rootNode,changedPath:t})}doFilterAggregates(t){this.filterAggregatesStage?this.filterAggregatesStage.execute({rowNode:this.rootNode,changedPath:t}):this.rootNode.childrenAfterAggFilter=this.rootNode.childrenAfterFilter}expandOrCollapseAll(t){const e=this.gridOptionsService.get("treeData"),o=this.columnModel.isPivotActive(),i=n=>{n&&n.forEach(l=>{const c=()=>{l.expanded=t,i(l.childrenAfterGroup)};if(e){import_core2._.exists(l.childrenAfterGroup)&&c();return}if(o){!l.leafGroup&&c();return}l.group&&c()})};this.rootNode&&i(this.rootNode.childrenAfterGroup),this.refreshModel({step:import_core2.ClientSideRowModelSteps.MAP});const r=t?"expandAll":"collapseAll",s={type:import_core2.Events.EVENT_EXPAND_COLLAPSE_ALL,source:r};this.eventService.dispatchEvent(s)}doSort(t,e){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:t,changedPath:e})}doRowGrouping(t,e,o,i){if(this.groupStage){if(t?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:t,rowNodeOrder:e,changedPath:o}):this.groupStage.execute({rowNode:this.rootNode,changedPath:o,afterColumnsChanged:i}),this.gridOptionsService.get("groupSelectsChildren")&&this.selectionService.updateGroupsFromChildrenSelections("rowGroupChanged",o)){const s={type:import_core2.Events.EVENT_SELECTION_CHANGED,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:import_core2.Events.EVENT_ROW_COUNT_READY}))}doFilter(t){this.filterStage.execute({rowNode:this.rootNode,changedPath:t})}doPivot(t){this.pivotStage&&this.pivotStage.execute({rowNode:this.rootNode,changedPath:t})}getCopyOfNodesMap(){return this.nodeManager.getCopyOfNodesMap()}getRowNode(t){if(typeof t=="string"&&t.indexOf(import_core2.RowNode.ID_PREFIX_ROW_GROUP)==0){let o;return this.forEachNode(i=>{i.id===t&&(o=i)}),o}return this.nodeManager.getRowNode(t)}setRowData(t){this.selectionService.reset("rowDataChanged"),this.nodeManager.setRowData(t),this.hasStarted&&this.dispatchUpdateEventsAndRefresh()}dispatchUpdateEventsAndRefresh(){const t={type:import_core2.Events.EVENT_ROW_DATA_UPDATED};this.eventService.dispatchEvent(t),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,newData:!0})}batchUpdateRowData(t,e){if(this.applyAsyncTransactionsTimeout==null){this.rowDataTransactionBatch=[];const o=this.gridOptionsService.getAsyncTransactionWaitMillis();this.applyAsyncTransactionsTimeout=window.setTimeout(()=>{this.executeBatchUpdateRowData()},o)}this.rowDataTransactionBatch.push({rowDataTransaction:t,callback:e})}flushAsyncTransactions(){this.applyAsyncTransactionsTimeout!=null&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())}executeBatchUpdateRowData(){this.valueCache.onDataChanged();const t=[],e=[];let o=!1;if(this.rowDataTransactionBatch&&this.rowDataTransactionBatch.forEach(i=>{const r=this.nodeManager.updateRowData(i.rowDataTransaction,void 0);e.push(r),i.callback&&t.push(i.callback.bind(null,r)),typeof i.rowDataTransaction.addIndex=="number"&&(o=!0)}),this.commonUpdateRowData(e,void 0,o),t.length>0&&window.setTimeout(()=>{t.forEach(i=>i())},0),e.length>0){const i={type:import_core2.Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,results:e};this.eventService.dispatchEvent(i)}this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0}updateRowData(t,e){this.valueCache.onDataChanged();const o=this.nodeManager.updateRowData(t,e),i=typeof t.addIndex=="number";return this.commonUpdateRowData([o],e,i),o}createRowNodeOrder(){if(this.gridOptionsService.get("suppressMaintainUnsortedOrder"))return;const e={};if(this.rootNode&&this.rootNode.allLeafChildren)for(let o=0;o<this.rootNode.allLeafChildren.length;o++){const i=this.rootNode.allLeafChildren[o];e[i.id]=o}return e}commonUpdateRowData(t,e,o){if(!this.hasStarted)return;const i=!this.gridOptionsService.get("suppressAnimationFrame");o&&(e=this.createRowNodeOrder());const r={type:import_core2.Events.EVENT_ROW_DATA_UPDATED};this.eventService.dispatchEvent(r),this.refreshModel({step:import_core2.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:t,rowNodeOrder:e,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 t=this.resetRowHeightsForAllRowNodes();this.rootNode.setRowHeight(this.rootNode.rowHeight,!0),this.rootNode.sibling&&this.rootNode.sibling.setRowHeight(this.rootNode.sibling.rowHeight,!0),t&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let t=!1;return this.forEachNode(e=>{e.setRowHeight(e.rowHeight,!0);const o=e.detailNode;o&&o.setRowHeight(o.rowHeight,!0),e.sibling&&e.sibling.setRowHeight(e.sibling.rowHeight,!0),t=!0}),t}onGridStylesChanges(){this.columnModel.isAutoRowHeightActive()||this.resetRowHeights()}onGridReady(){this.hasStarted||this.setInitialData()}isRowDataLoaded(){return this.rowCountReady}};__decorateClass([(0,import_core2.Autowired)("columnModel")],ClientSideRowModel.prototype,"columnModel",2),__decorateClass([(0,import_core2.Autowired)("selectionService")],ClientSideRowModel.prototype,"selectionService",2),__decorateClass([(0,import_core2.Autowired)("filterManager")],ClientSideRowModel.prototype,"filterManager",2),__decorateClass([(0,import_core2.Autowired)("valueCache")],ClientSideRowModel.prototype,"valueCache",2),__decorateClass([(0,import_core2.Autowired)("beans")],ClientSideRowModel.prototype,"beans",2),__decorateClass([(0,import_core2.Autowired)("filterStage")],ClientSideRowModel.prototype,"filterStage",2),__decorateClass([(0,import_core2.Autowired)("sortStage")],ClientSideRowModel.prototype,"sortStage",2),__decorateClass([(0,import_core2.Autowired)("flattenStage")],ClientSideRowModel.prototype,"flattenStage",2),__decorateClass([(0,import_core2.Optional)("groupStage")],ClientSideRowModel.prototype,"groupStage",2),__decorateClass([(0,import_core2.Optional)("aggregationStage")],ClientSideRowModel.prototype,"aggregationStage",2),__decorateClass([(0,import_core2.Optional)("pivotStage")],ClientSideRowModel.prototype,"pivotStage",2),__decorateClass([(0,import_core2.Optional)("filterAggregatesStage")],ClientSideRowModel.prototype,"filterAggregatesStage",2),__decorateClass([import_core2.PostConstruct],ClientSideRowModel.prototype,"init",1),ClientSideRowModel=__decorateClass([(0,import_core2.Bean)("rowModel")],ClientSideRowModel);var import_core3=require("@ag-grid-community/core"),FilterStage=class extends import_core3.BeanStub{execute(t){const{changedPath:e}=t;this.filterService.filter(e)}};__decorateClass([(0,import_core3.Autowired)("filterService")],FilterStage.prototype,"filterService",2),FilterStage=__decorateClass([(0,import_core3.Bean)("filterStage")],FilterStage);var import_core4=require("@ag-grid-community/core"),SortStage=class extends import_core4.BeanStub{execute(t){const e=this.sortController.getSortOptions(),o=import_core4._.exists(e)&&e.length>0,i=o&&import_core4._.exists(t.rowNodeTransactions)&&this.gridOptionsService.get("deltaSort"),r=e.some(s=>this.gridOptionsService.isColumnsSortingCoupledToGroup()?s.column.isPrimary()&&s.column.isRowGroupActive():!!s.column.getColDef().showRowGroup);this.sortService.sort(e,o,i,t.rowNodeTransactions,t.changedPath,r)}};__decorateClass([(0,import_core4.Autowired)("sortService")],SortStage.prototype,"sortService",2),__decorateClass([(0,import_core4.Autowired)("sortController")],SortStage.prototype,"sortController",2),SortStage=__decorateClass([(0,import_core4.Bean)("sortStage")],SortStage);var import_core5=require("@ag-grid-community/core"),FlattenStage=class extends import_core5.BeanStub{execute(t){const e=t.rowNode,o=[],i=this.columnModel.isPivotMode(),r=i&&e.leafGroup,s=r?[e]:e.childrenAfterSort,n=this.getFlattenDetails();this.recursivelyAddToRowsToDisplay(n,s,o,i,0);const l=o.length>0;return!r&&l&&n.groupIncludeTotalFooter&&(e.createFooter(),this.addRowNodeToRowsToDisplay(n,e.sibling,o,0)),o}getFlattenDetails(){const t=this.gridOptionsService.get("groupRemoveSingleChildren");return{groupRemoveLowestSingleChildren:!t&&this.gridOptionsService.get("groupRemoveLowestSingleChildren"),groupRemoveSingleChildren:t,isGroupMultiAutoColumn:this.gridOptionsService.isGroupMultiAutoColumn(),hideOpenParents:this.gridOptionsService.get("groupHideOpenParents"),groupIncludeTotalFooter:this.gridOptionsService.get("groupIncludeTotalFooter"),getGroupIncludeFooter:this.gridOptionsService.getGroupIncludeFooter()}}recursivelyAddToRowsToDisplay(t,e,o,i,r){if(!import_core5._.missingOrEmpty(e))for(let s=0;s<e.length;s++){const n=e[s],l=n.hasChildren(),c=i&&!l,d=t.groupRemoveSingleChildren&&l&&n.childrenAfterGroup.length===1,p=t.groupRemoveLowestSingleChildren&&l&&n.leafGroup&&n.childrenAfterGroup.length===1,h=i&&n.leafGroup,a=t.hideOpenParents&&n.expanded&&!n.master&&!h;if(!c&&!a&&!d&&!p&&this.addRowNodeToRowsToDisplay(t,n,o,r),!(i&&n.leafGroup)){if(l){const g=d||p;if(n.expanded||g){const S=g?r:r+1;this.recursivelyAddToRowsToDisplay(t,n.childrenAfterSort,o,i,S),t.getGroupIncludeFooter({node:n})?(n.createFooter(),this.addRowNodeToRowsToDisplay(t,n.sibling,o,S)):n.destroyFooter()}}else if(n.master&&n.expanded){const g=this.createDetailNode(n);this.addRowNodeToRowsToDisplay(t,g,o,r)}}}}addRowNodeToRowsToDisplay(t,e,o,i){o.push(e),e.setUiLevel(t.isGroupMultiAutoColumn?0:i)}createDetailNode(t){if(import_core5._.exists(t.detailNode))return t.detailNode;const e=new import_core5.RowNode(this.beans);return e.detail=!0,e.selectable=!1,e.parent=t,import_core5._.exists(t.id)&&(e.id="detail_"+t.id),e.data=t.data,e.level=t.level+1,t.detailNode=e,e}};__decorateClass([(0,import_core5.Autowired)("columnModel")],FlattenStage.prototype,"columnModel",2),__decorateClass([(0,import_core5.Autowired)("beans")],FlattenStage.prototype,"beans",2),FlattenStage=__decorateClass([(0,import_core5.Bean)("flattenStage")],FlattenStage);var import_core6=require("@ag-grid-community/core"),SortService=class extends import_core6.BeanStub{sort(t,e,o,i,r,s){const n=this.gridOptionsService.get("groupMaintainOrder"),l=this.columnModel.getAllGridColumns().some(a=>a.isRowGroupActive());let c={};o&&i&&(c=this.calculateDirtyNodes(i));const d=this.columnModel.isPivotMode(),p=this.gridOptionsService.getCallback("postSortRows"),h=a=>{var u;this.pullDownGroupDataForHideOpenParents(a.childrenAfterAggFilter,!0);const g=d&&a.leafGroup;if(n&&l&&!a.leafGroup&&!s){const f=(u=this.columnModel.getRowGroupColumns())==null?void 0:u[a.level+1],T=f?.getSort()===null,C=a.childrenAfterAggFilter.slice(0);if(a.childrenAfterSort&&!T){const R={};a.childrenAfterSort.forEach((v,A)=>{R[v.id]=A}),C.sort((v,A)=>{var m,E;return((m=R[v.id])!=null?m:0)-((E=R[A.id])!=null?E:0)})}a.childrenAfterSort=C}else!e||g?a.childrenAfterSort=a.childrenAfterAggFilter.slice(0):o?a.childrenAfterSort=this.doDeltaSort(a,c,r,t):a.childrenAfterSort=this.rowNodeSorter.doFullSort(a.childrenAfterAggFilter,t);if(a.sibling&&(a.sibling.childrenAfterSort=a.childrenAfterSort),this.updateChildIndexes(a),p){const f={nodes:a.childrenAfterSort};p(f)}};r&&r.forEachChangedNodeDepthFirst(h),this.updateGroupDataForHideOpenParents(r)}calculateDirtyNodes(t){const e={},o=i=>{i&&i.forEach(r=>e[r.id]=!0)};return t&&t.forEach(i=>{o(i.add),o(i.update),o(i.remove)}),e}doDeltaSort(t,e,o,i){const r=t.childrenAfterAggFilter,s=t.childrenAfterSort;if(!s)return this.rowNodeSorter.doFullSort(r,i);const n={},l=[];r.forEach(h=>{e[h.id]||!o.canSkip(h)?l.push(h):n[h.id]=!0});const c=s.filter(h=>n[h.id]),d=(h,a)=>({currentPos:a,rowNode:h}),p=l.map(d).sort((h,a)=>this.rowNodeSorter.compareRowNodes(i,h,a));return this.mergeSortedArrays(i,p,c.map(d)).map(({rowNode:h})=>h)}mergeSortedArrays(t,e,o){const i=[];let r=0,s=0;for(;r<e.length&&s<o.length;)this.rowNodeSorter.compareRowNodes(t,e[r],o[s])<0?i.push(e[r++]):i.push(o[s++]);for(;r<e.length;)i.push(e[r++]);for(;s<o.length;)i.push(o[s++]);return i}updateChildIndexes(t){if(import_core6._.missing(t.childrenAfterSort))return;const e=t.childrenAfterSort;for(let o=0;o<e.length;o++){const i=e[o],r=o===0,s=o===t.childrenAfterSort.length-1;i.setFirstChild(r),i.setLastChild(s),i.setChildIndex(o)}}updateGroupDataForHideOpenParents(t){if(!this.gridOptionsService.get("groupHideOpenParents"))return;if(this.gridOptionsService.get("treeData"))return import_core6._.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 e=o=>{this.pullDownGroupDataForHideOpenParents(o.childrenAfterSort,!1),o.childrenAfterSort.forEach(i=>{i.hasChildren()&&e(i)})};t&&t.executeFromRootNode(o=>e(o))}pullDownGroupDataForHideOpenParents(t,e){!this.gridOptionsService.get("groupHideOpenParents")||import_core6._.missing(t)||t.forEach(o=>{this.columnModel.getGroupDisplayColumns().forEach(r=>{const s=r.getColDef().showRowGroup;if(typeof s!="string"){console.error("AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup");return}const n=s,l=this.columnModel.getPrimaryColumn(n);if(l!==o.rowGroupColumn)if(e)o.setGroupValue(r.getId(),void 0);else{const d=o.getFirstChildOfFirstChild(l);d&&o.setGroupValue(r.getId(),d.key)}})})}};__decorateClass([(0,import_core6.Autowired)("columnModel")],SortService.prototype,"columnModel",2),__decorateClass([(0,import_core6.Autowired)("rowNodeSorter")],SortService.prototype,"rowNodeSorter",2),SortService=__decorateClass([(0,import_core6.Bean)("sortService")],SortService);var import_core7=require("@ag-grid-community/core"),FilterService=class extends import_core7.BeanStub{filter(t){const e=this.filterManager.isChildFilterPresent();this.filterNodes(e,t)}filterNodes(t,e){const o=(i,r)=>{i.hasChildren()&&t&&!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 c=s.childrenAfterGroup[l],d=n||this.filterManager.doesRowPassFilter({rowNode:c});c.childrenAfterGroup?i(s.childrenAfterGroup[l],d):o(c,d)}o(s,n)},r=s=>i(s,!1);e.executeFromRootNode(r)}else{const i=r=>o(r,!1);e.forEachChangedNodeDepthFirst(i,!0)}}doingTreeDataFiltering(){return this.gridOptionsService.get("treeData")&&!this.gridOptionsService.get("excludeChildrenWhenTreeDataFiltering")}};__decorateClass([(0,import_core7.Autowired)("filterManager")],FilterService.prototype,"filterManager",2),FilterService=__decorateClass([(0,import_core7.Bean)("filterService")],FilterService);var import_core8=require("@ag-grid-community/core"),ImmutableService=class extends import_core8.BeanStub{postConstruct(){this.rowModel.getType()==="clientSide"&&(this.clientSideRowModel=this.rowModel,this.addManagedPropertyListener("rowData",()=>this.onRowDataUpdated()))}isActive(){const t=this.gridOptionsService.exists("getRowId");return this.gridOptionsService.get("resetRowDataOnUpdate")?!1:t}setRowData(t){const e=this.createTransactionForRowData(t);if(!e)return;const[o,i]=e;this.clientSideRowModel.updateRowData(o,i)}createTransactionForRowData(t){if(import_core8._.missing(this.clientSideRowModel)){console.error("AG Grid: ImmutableService only works with ClientSideRowModel");return}const e=this.gridOptionsService.getCallback("getRowId");if(e==null){console.error("AG Grid: ImmutableService requires getRowId() callback to be implemented, your row data needs IDs!");return}const o={remove:[],update:[],add:[]},i=this.clientSideRowModel.getCopyOfNodesMap(),s=this.gridOptionsService.get("suppressMaintainUnsortedOrder")?void 0:{};return import_core8._.exists(t)&&t.forEach((n,l)=>{const c=e({data:n,level:0}),d=i[c];s&&(s[c]=l),d?(d.data!==n&&o.update.push(n),i[c]=void 0):o.add.push(n)}),import_core8._.iterateObject(i,(n,l)=>{l&&o.remove.push(l.data)}),[o,s]}onRowDataUpdated(){const t=this.gridOptionsService.get("rowData");t&&(this.isActive()?this.setRowData(t):(this.selectionService.reset("rowDataChanged"),this.clientSideRowModel.setRowData(t)))}};__decorateClass([(0,import_core8.Autowired)("rowModel")],ImmutableService.prototype,"rowModel",2),__decorateClass([(0,import_core8.Autowired)("rowRenderer")],ImmutableService.prototype,"rowRenderer",2),__decorateClass([(0,import_core8.Autowired)("selectionService")],ImmutableService.prototype,"selectionService",2),__decorateClass([import_core8.PostConstruct],ImmutableService.prototype,"postConstruct",1),ImmutableService=__decorateClass([(0,import_core8.Bean)("immutableService")],ImmutableService);var VERSION="31.2.1",ClientSideRowModelModule={version:VERSION,moduleName:import_core9.ModuleNames.ClientSideRowModelModule,rowModel:"clientSide",beans:[ClientSideRowModel,FilterStage,SortStage,FlattenStage,SortService,FilterService,ImmutableService]}; |
{ | ||
"name": "@ag-grid-community/client-side-row-model", | ||
"version": "31.2.0", | ||
"version": "31.2.1", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "31.2.0" | ||
"@ag-grid-community/core": "31.2.1" | ||
}, | ||
@@ -9,0 +9,0 @@ "main": "./dist/package/main.cjs.js", |
{ | ||
"name": "@ag-grid-community/client-side-row-model", | ||
"version": "31.2.0", | ||
"version": "31.2.1", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "31.2.0" | ||
"@ag-grid-community/core": "31.2.1" | ||
}, | ||
@@ -9,0 +9,0 @@ "main": "./src/main.js", |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "31.2.0"; | ||
export declare const VERSION = "31.2.1"; |
{ | ||
"name": "@ag-grid-community/client-side-row-model", | ||
"version": "31.2.0", | ||
"version": "31.2.1", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "31.2.0" | ||
"@ag-grid-community/core": "31.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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
+ Added@ag-grid-community/core@31.2.1(transitive)
- Removed@ag-grid-community/core@31.2.0(transitive)