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

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

Package Overview
Dependencies
Maintainers
3
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 26.0.0 to 26.1.0

6

dist/cjs/clientSideRowModel/clientSideNodeManager.d.ts

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

import { ColumnApi, ColumnModel, Context, EventService, GridApi, GridOptionsWrapper, RowDataTransaction, RowNode, RowNodeTransaction, SelectionService } from "@ag-grid-community/core";
import { ColumnApi, ColumnModel, EventService, GridApi, GridOptionsWrapper, RowDataTransaction, RowNode, RowNodeTransaction, SelectionService, Beans } from "@ag-grid-community/core";
export declare class ClientSideNodeManager {

@@ -8,6 +8,6 @@ private static TOP_LEVEL;

private gridOptionsWrapper;
private context;
private eventService;
private columnModel;
private selectionService;
private beans;
private nextId;

@@ -20,3 +20,3 @@ private static ROOT_NODE_ID;

private allNodesMap;
constructor(rootNode: RowNode, gridOptionsWrapper: GridOptionsWrapper, context: Context, eventService: EventService, columnModel: ColumnModel, gridApi: GridApi, columnApi: ColumnApi, selectionService: SelectionService);
constructor(rootNode: RowNode, gridOptionsWrapper: GridOptionsWrapper, eventService: EventService, columnModel: ColumnModel, gridApi: GridApi, columnApi: ColumnApi, selectionService: SelectionService, beans: Beans);
postConstruct(): void;

@@ -23,0 +23,0 @@ getCopyOfNodesMap(): {

@@ -12,3 +12,3 @@ "use strict";

var ClientSideNodeManager = /** @class */ (function () {
function ClientSideNodeManager(rootNode, gridOptionsWrapper, context, eventService, columnModel, gridApi, columnApi, selectionService) {
function ClientSideNodeManager(rootNode, gridOptionsWrapper, eventService, columnModel, gridApi, columnApi, selectionService, beans) {
this.nextId = 0;

@@ -19,3 +19,2 @@ // when user is provide the id's, we also keep a map of ids to row nodes for convenience

this.gridOptionsWrapper = gridOptionsWrapper;
this.context = context;
this.eventService = eventService;

@@ -25,2 +24,3 @@ this.columnModel = columnModel;

this.columnApi = columnApi;
this.beans = beans;
this.selectionService = selectionService;

@@ -216,4 +216,3 @@ this.rootNode.group = true;

ClientSideNodeManager.prototype.createNode = function (dataItem, parent, level) {
var node = new core_1.RowNode();
this.context.createBean(node);
var node = new core_1.RowNode(this.beans);
node.group = false;

@@ -220,0 +219,0 @@ this.setMasterForRow(node, dataItem, level, true);

@@ -17,2 +17,3 @@ import { BeanStub, ChangedPath, IClientSideRowModel, RefreshModelParams, RowBounds, RowDataTransaction, RowNode, RowHighlightPosition, RowNodeTransaction } from "@ag-grid-community/core";

private animationFrameService;
private beans;
private filterStage;

@@ -19,0 +20,0 @@ private sortStage;

@@ -58,5 +58,4 @@ "use strict";

this.addManagedListener(this.gridOptionsWrapper, core_1.GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, refreshMapListener);
this.rootNode = new core_1.RowNode();
this.nodeManager = new clientSideNodeManager_1.ClientSideNodeManager(this.rootNode, this.gridOptionsWrapper, this.getContext(), this.eventService, this.columnModel, this.gridApi, this.columnApi, this.selectionService);
this.createBean(this.rootNode);
this.rootNode = new core_1.RowNode(this.beans);
this.nodeManager = new clientSideNodeManager_1.ClientSideNodeManager(this.rootNode, this.gridOptionsWrapper, this.eventService, this.columnModel, this.gridApi, this.columnApi, this.selectionService, this.beans);
};

@@ -98,10 +97,19 @@ ClientSideRowModel.prototype.start = function () {

ClientSideRowModel.prototype.setRowTopAndRowIndex = function () {
var defaultRowHeight = this.gridOptionsWrapper.getDefaultRowHeight();
var nextRowTop = 0;
// mapping displayed rows is not needed for this method, however it's used in
// clearRowTopAndRowIndex(), and given we are looping through this.rowsToDisplay here,
// we create the map here for performance reasons, so we don't loop a second time
// in clearRowTopAndRowIndex()
var displayedRowsMapped = new Set();
// we don't estimate if doing fullHeight or autoHeight, as all rows get rendered all the time
// with these two layouts.
var allowEstimate = this.gridOptionsWrapper.getDomLayout() === core_1.Constants.DOM_LAYOUT_NORMAL;
for (var i = 0; i < this.rowsToDisplay.length; i++) {
// we don't estimate if doing fullHeight or autoHeight, as all rows get rendered all the time
// with these two layouts.
var allowEstimate = this.gridOptionsWrapper.getDomLayout() === core_1.Constants.DOM_LAYOUT_NORMAL;
var rowNode = this.rowsToDisplay[i];
if (core_1._.missing(rowNode.rowHeight)) {
var rowHeight = this.gridOptionsWrapper.getRowHeightForNode(rowNode, allowEstimate);
if (rowNode.id != null) {
displayedRowsMapped.add(rowNode.id);
}
if (rowNode.rowHeight == null) {
var rowHeight = this.gridOptionsWrapper.getRowHeightForNode(rowNode, allowEstimate, defaultRowHeight);
rowNode.setRowHeight(rowHeight.height, rowHeight.estimated);

@@ -113,12 +121,8 @@ }

}
return displayedRowsMapped;
};
ClientSideRowModel.prototype.clearRowTopAndRowIndex = function (changedPath) {
var displayedRowsMapped = {};
this.rowsToDisplay.forEach(function (rowNode) {
if (rowNode.id != null) {
displayedRowsMapped[rowNode.id] = rowNode;
}
});
ClientSideRowModel.prototype.clearRowTopAndRowIndex = function (changedPath, displayedRowsMapped) {
var changedPathActive = changedPath.isActive();
var clearIfNotDisplayed = function (rowNode) {
if (rowNode && rowNode.id != null && displayedRowsMapped[rowNode.id] == null) {
if (rowNode && rowNode.id != null && !displayedRowsMapped.has(rowNode.id)) {
rowNode.clearRowTopAndRowIndex();

@@ -140,3 +144,3 @@ }

// as expanded=undefined for root node
var skipChildren = changedPath.isActive() && !isRootNode && !rowNode.expanded;
var skipChildren = changedPathActive && !isRootNode && !rowNode.expanded;
if (!skipChildren) {

@@ -336,4 +340,4 @@ rowNode.childrenAfterGroup.forEach(recurse);

// will still lie around
this.setRowTopAndRowIndex();
this.clearRowTopAndRowIndex(changedPath);
var displayedNodesMapped = this.setRowTopAndRowIndex();
this.clearRowTopAndRowIndex(changedPath, displayedNodesMapped);
var event = {

@@ -560,4 +564,2 @@ type: core_1.Events.EVENT_MODEL_UPDATED,

else {
// groups are about to get disposed, so need to deselect any that are selected
this.selectionService.removeGroupsFromSelection();
this.groupStage.execute({

@@ -800,2 +802,5 @@ rowNode: this.rootNode,

__decorate([
core_1.Autowired('beans')
], ClientSideRowModel.prototype, "beans", void 0);
__decorate([
core_1.Autowired('filterStage')

@@ -802,0 +807,0 @@ ], ClientSideRowModel.prototype, "filterStage", void 0);

import { BeanStub, IRowNodeStage, RowNode, StageExecuteParams } from "@ag-grid-community/core";
export declare class FlattenStage extends BeanStub implements IRowNodeStage {
private columnModel;
private beans;
execute(params: StageExecuteParams): RowNode[];

@@ -5,0 +6,0 @@ private recursivelyAddToRowsToDisplay;

@@ -120,4 +120,3 @@ "use strict";

}
var footerNode = new core_1.RowNode();
this.context.createBean(footerNode);
var footerNode = new core_1.RowNode(this.beans);
Object.keys(groupNode).forEach(function (key) {

@@ -145,4 +144,3 @@ footerNode[key] = groupNode[key];

}
var detailNode = new core_1.RowNode();
this.context.createBean(detailNode);
var detailNode = new core_1.RowNode(this.beans);
detailNode.detail = true;

@@ -162,2 +160,5 @@ detailNode.selectable = false;

], FlattenStage.prototype, "columnModel", void 0);
__decorate([
core_1.Autowired('beans')
], FlattenStage.prototype, "beans", void 0);
FlattenStage = __decorate([

@@ -164,0 +165,0 @@ core_1.Bean('flattenStage')

/**
* @ag-grid-community/client-side-row-model - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0
* @ag-grid-community/client-side-row-model - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0
* @link http://www.ag-grid.com/

@@ -8,6 +8,6 @@ ' * @license MIT

/**
* @ag-grid-community/client-side-row-model - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0
* @ag-grid-community/client-side-row-model - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0
* @link http://www.ag-grid.com/
' * @license MIT
*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,o=require("@ag-grid-community/core"),r=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<o;t++)for(var n=arguments[t],s=0,a=n.length;s<a;s++,i++)r[i]=n[s];return r},i=function(){function e(t,o,r,i,n,s,a,d){this.nextId=0,this.allNodesMap={},this.rootNode=t,this.gridOptionsWrapper=o,this.context=r,this.eventService=i,this.columnModel=n,this.gridApi=s,this.columnApi=a,this.selectionService=d,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id=e.ROOT_NODE_ID,this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterFilter=[],this.postConstruct()}return e.prototype.postConstruct=function(){this.suppressParentsInRowNodes=this.gridOptionsWrapper.isSuppressParentsInRowNodes(),this.isRowMasterFunc=this.gridOptionsWrapper.getIsRowMasterFunc(),this.doingTreeData=this.gridOptionsWrapper.isTreeData(),this.doingMasterDetail=this.gridOptionsWrapper.isMasterDetail()},e.prototype.getCopyOfNodesMap=function(){return o._.cloneObject(this.allNodesMap)},e.prototype.getRowNode=function(e){return this.allNodesMap[e]},e.prototype.setRowData=function(t){if(this.rootNode.childrenAfterFilter=null,this.rootNode.childrenAfterGroup=null,this.rootNode.childrenAfterSort=null,this.rootNode.childrenMapped=null,this.rootNode.updateHasChildren(),this.nextId=0,this.allNodesMap={},!t)return this.rootNode.allLeafChildren=[],void(this.rootNode.childrenAfterGroup=[]);this.rootNode.allLeafChildren=this.recursiveFunction(t,this.rootNode,e.TOP_LEVEL)},e.prototype.updateRowData=function(e,t){var r={remove:[],update:[],add:[]},i=[];return this.executeRemove(e,r,i),this.executeUpdate(e,r,i),this.executeAdd(e,r),this.updateSelection(i),t&&o._.sortRowNodesByOrder(this.rootNode.allLeafChildren,t),r},e.prototype.updateSelection=function(e){var t=e.length>0;if(t&&e.forEach((function(e){e.setSelected(!1,!1,!0)})),this.selectionService.updateGroupsFromChildrenSelections(),t){var r={type:o.Events.EVENT_SELECTION_CHANGED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(r)}},e.prototype.executeAdd=function(t,i){var n=this,s=t.add,a=t.addIndex;if(!o._.missingOrEmpty(s)){var d=s.map((function(t){return n.createNode(t,n.rootNode,e.TOP_LEVEL)}));if("number"==typeof a&&a>=0){var p=this.rootNode.allLeafChildren,l=p.slice(0,a),h=p.slice(a,p.length);this.rootNode.allLeafChildren=r(l,d,h)}else this.rootNode.allLeafChildren=r(this.rootNode.allLeafChildren,d);i.add=d}},e.prototype.executeRemove=function(e,t,r){var i=this,n=e.remove;if(!o._.missingOrEmpty(n)){var s={};n.forEach((function(e){var o=i.lookupRowNode(e);o&&(o.isSelected()&&r.push(o),o.clearRowTopAndRowIndex(),s[o.id]=!0,delete i.allNodesMap[o.id],t.remove.push(o))})),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren.filter((function(e){return!s[e.id]}))}},e.prototype.executeUpdate=function(t,r,i){var n=this,s=t.update;o._.missingOrEmpty(s)||s.forEach((function(t){var o=n.lookupRowNode(t);o&&(o.updateData(t),!o.selectable&&o.isSelected()&&i.push(o),n.setMasterForRow(o,t,e.TOP_LEVEL,!1),r.update.push(o))}))},e.prototype.lookupRowNode=function(e){var t,r=this.gridOptionsWrapper.getRowNodeIdFunc();if(o._.exists(r)){var i=r(e);if(!(t=this.allNodesMap[i]))return console.error("AG Grid: could not find row id="+i+", data item was not found for this id"),null}else if(!(t=o._.find(this.rootNode.allLeafChildren,(function(t){return t.data===e}))))return console.error("AG Grid: could not find data item as object was not found",e),console.error("Consider using getRowNodeId to help the Grid find matching row data"),null;return t},e.prototype.recursiveFunction=function(e,t,o){var r=this;if("string"!=typeof e){var i=[];return e.forEach((function(e){var n=r.createNode(e,t,o);i.push(n)})),i}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")},e.prototype.createNode=function(e,t,r){var i=new o.RowNode;return this.context.createBean(i),i.group=!1,this.setMasterForRow(i,e,r,!0),t&&!this.suppressParentsInRowNodes&&(i.parent=t),i.level=r,i.setDataAndId(e,this.nextId.toString()),this.allNodesMap[i.id]&&console.warn("ag-grid: duplicate node id '"+i.id+"' detected from getRowNodeId callback, this could cause issues in your grid."),this.allNodesMap[i.id]=i,this.nextId++,i},e.prototype.setMasterForRow=function(e,t,o,r){if(this.doingTreeData)e.setMaster(!1),r&&(e.expanded=!1);else if(this.doingMasterDetail?this.isRowMasterFunc?e.setMaster(this.isRowMasterFunc(t)):e.setMaster(!0):e.setMaster(!1),r){var i=this.columnModel.getRowGroupColumns(),n=o+(i?i.length:0);e.expanded=!!e.master&&this.isExpanded(n)}},e.prototype.isExpanded=function(e){var t=this.gridOptionsWrapper.getGroupDefaultExpanded();return-1===t||e<t},e.TOP_LEVEL=0,e.ROOT_NODE_ID="ROOT_NODE_ID",e}(),n=(e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)},function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}),s=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s};!function(e){e[e.Normal=0]="Normal",e[e.AfterFilter=1]="AfterFilter",e[e.AfterFilterAndSort=2]="AfterFilterAndSort",e[e.PivotNodes=3]="PivotNodes"}(t||(t={}));var a=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.init=function(){var e=this.refreshModel.bind(this,{step:o.ClientSideRowModelSteps.EVERYTHING}),t=this.refreshModel.bind(this,{step:o.ClientSideRowModelSteps.EVERYTHING,afterColumnsChanged:!0,keepRenderedRows:!0,animate:!0});this.addManagedListener(this.eventService,o.Events.EVENT_NEW_COLUMNS_LOADED,t),this.addManagedListener(this.eventService,o.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,e),this.addManagedListener(this.eventService,o.Events.EVENT_COLUMN_VALUE_CHANGED,this.onValueChanged.bind(this)),this.addManagedListener(this.eventService,o.Events.EVENT_COLUMN_PIVOT_CHANGED,this.refreshModel.bind(this,{step:o.ClientSideRowModelSteps.PIVOT})),this.addManagedListener(this.eventService,o.Events.EVENT_FILTER_CHANGED,this.onFilterChanged.bind(this)),this.addManagedListener(this.eventService,o.Events.EVENT_SORT_CHANGED,this.onSortChanged.bind(this)),this.addManagedListener(this.eventService,o.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,e);var r=this.refreshModel.bind(this,{step:o.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:!0});this.addManagedListener(this.gridOptionsWrapper,o.GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN,r),this.addManagedListener(this.gridOptionsWrapper,o.GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN,r),this.rootNode=new o.RowNode,this.nodeManager=new i(this.rootNode,this.gridOptionsWrapper,this.getContext(),this.eventService,this.columnModel,this.gridApi,this.columnApi,this.selectionService),this.createBean(this.rootNode)},r.prototype.start=function(){var e=this.gridOptionsWrapper.getRowData();e&&this.setRowData(e)},r.prototype.ensureRowHeightsValid=function(e,t,o,r){var i,n=!1;do{i=!1;for(var s=this.getRowIndexAtPixel(e),a=this.getRowIndexAtPixel(t),d=Math.max(s,o),p=Math.min(a,r),l=d;l<=p;l++){var h=this.getRow(l);if(h.rowHeightEstimated){var c=this.gridOptionsWrapper.getRowHeightForNode(h);h.setRowHeight(c.height),i=!0,n=!0}}i&&this.setRowTopAndRowIndex()}while(i);return n},r.prototype.setRowTopAndRowIndex=function(){for(var e=0,t=0;t<this.rowsToDisplay.length;t++){var r=this.gridOptionsWrapper.getDomLayout()===o.Constants.DOM_LAYOUT_NORMAL,i=this.rowsToDisplay[t];if(o._.missing(i.rowHeight)){var n=this.gridOptionsWrapper.getRowHeightForNode(i,r);i.setRowHeight(n.height,n.estimated)}i.setRowTop(e),i.setRowIndex(t),e+=i.rowHeight}},r.prototype.clearRowTopAndRowIndex=function(e){var t={};this.rowsToDisplay.forEach((function(e){null!=e.id&&(t[e.id]=e)}));var o=function(e){e&&null!=e.id&&null==t[e.id]&&e.clearRowTopAndRowIndex()},r=function(t){if(o(t),o(t.detailNode),o(t.sibling),t.hasChildren()&&t.childrenAfterGroup){var i=-1==t.level;e.isActive()&&!i&&!t.expanded||t.childrenAfterGroup.forEach(r)}};r(this.rootNode)},r.prototype.ensureRowsAtPixel=function(e,t,r){var i=this;void 0===r&&(r=0);var n=this.getRowIndexAtPixel(t);return this.getRow(n)!==e[0]&&(e.forEach((function(e){o._.removeFromArray(i.rootNode.allLeafChildren,e)})),e.forEach((function(e,t){o._.insertIntoArray(i.rootNode.allLeafChildren,e,Math.max(n+r,0)+t)})),this.refreshModel({step:o.ClientSideRowModelSteps.EVERYTHING,keepRenderedRows:!0,animate:!0,keepEditingRows:!0}),!0)},r.prototype.highlightRowAtPixel=function(e,t){var o=null!=t?this.getRowIndexAtPixel(t):null,r=null!=o?this.getRow(o):null;if(r&&e&&r!==e&&null!=t){var i=this.getHighlightPosition(t,r);this.lastHighlightedRow&&this.lastHighlightedRow!==r&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null),r.setHighlighted(i),this.lastHighlightedRow=r}else this.lastHighlightedRow&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null)},r.prototype.getHighlightPosition=function(e,t){if(!t){var r=this.getRowIndexAtPixel(e);if(!(t=this.getRow(r||0)))return o.RowHighlightPosition.Below}return e-t.rowTop<t.rowHeight/2?o.RowHighlightPosition.Above:o.RowHighlightPosition.Below},r.prototype.getLastHighlightedRowNode=function(){return this.lastHighlightedRow},r.prototype.isLastRowIndexKnown=function(){return!0},r.prototype.getRowCount=function(){return this.rowsToDisplay?this.rowsToDisplay.length:0},r.prototype.getTopLevelRowCount=function(){return this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode?1:this.rootNode.childrenAfterFilter?this.rootNode.childrenAfterFilter.length:0},r.prototype.getTopLevelRowDisplayedIndex=function(e){if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return e;var t=this.rootNode.childrenAfterSort[e];if(this.gridOptionsWrapper.isGroupHideOpenParents())for(;t.expanded&&t.childrenAfterSort&&t.childrenAfterSort.length>0;)t=t.childrenAfterSort[0];return t.rowIndex},r.prototype.getRowBounds=function(e){if(o._.missing(this.rowsToDisplay))return null;var t=this.rowsToDisplay[e];return t?{rowTop:t.rowTop,rowHeight:t.rowHeight}:null},r.prototype.onRowGroupOpened=function(){var e=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:o.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:e})},r.prototype.onFilterChanged=function(e){if(!e.afterDataChange){var t=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:o.ClientSideRowModelSteps.FILTER,keepRenderedRows:!0,animate:t})}},r.prototype.onSortChanged=function(){var e=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:o.ClientSideRowModelSteps.SORT,keepRenderedRows:!0,animate:e,keepEditingRows:!0})},r.prototype.getType=function(){return o.Constants.ROW_MODEL_TYPE_CLIENT_SIDE},r.prototype.onValueChanged=function(){this.columnModel.isPivotActive()?this.refreshModel({step:o.ClientSideRowModelSteps.PIVOT}):this.refreshModel({step:o.ClientSideRowModelSteps.AGGREGATE})},r.prototype.createChangePath=function(e){var t=o._.missingOrEmpty(e),r=new o.ChangedPath(!1,this.rootNode);return(t||this.gridOptionsWrapper.isTreeData())&&r.setInactive(),r},r.prototype.isSuppressModelUpdateAfterUpdateTransaction=function(e){if(!this.gridOptionsWrapper.isSuppressModelUpdateAfterUpdateTransaction())return!1;if(null==e.rowNodeTransactions)return!1;var t=o._.filter(e.rowNodeTransactions,(function(e){return null!=e.add&&e.add.length>0||null!=e.remove&&e.remove.length>0}));return null==t||0==t.length},r.prototype.refreshModel=function(e){var t=this;if(!this.isSuppressModelUpdateAfterUpdateTransaction(e)){var r=this.createChangePath(e.rowNodeTransactions);switch(e.step){case o.ClientSideRowModelSteps.EVERYTHING:this.doRowGrouping(e.groupState,e.rowNodeTransactions,e.rowNodeOrder,r,!!e.afterColumnsChanged);case o.ClientSideRowModelSteps.FILTER:this.doFilter(r);case o.ClientSideRowModelSteps.PIVOT:this.doPivot(r);case o.ClientSideRowModelSteps.AGGREGATE:this.doAggregate(r);case o.ClientSideRowModelSteps.SORT:this.doSort(e.rowNodeTransactions,r);case o.ClientSideRowModelSteps.MAP:this.doRowsToDisplay()}this.setRowTopAndRowIndex(),this.clearRowTopAndRowIndex(r);var i={type:o.Events.EVENT_MODEL_UPDATED,api:this.gridApi,columnApi:this.columnApi,animate:e.animate,keepRenderedRows:e.keepRenderedRows,newData:e.newData,newPage:!1};this.eventService.dispatchEvent(i),this.$scope&&window.setTimeout((function(){t.$scope.$apply()}),0)}},r.prototype.isEmpty=function(){var e=o._.missing(this.rootNode.allLeafChildren)||0===this.rootNode.allLeafChildren.length;return o._.missing(this.rootNode)||e||!this.columnModel.isReady()},r.prototype.isRowsToRender=function(){return o._.exists(this.rowsToDisplay)&&this.rowsToDisplay.length>0},r.prototype.getNodesInRangeForSelection=function(e,t){var o,r=!t,i=!1,n=[],s=this.gridOptionsWrapper.isGroupSelectsChildren();return this.forEachNodeAfterFilterAndSort((function(a){var d=r&&!i;if(r||a!==t&&a!==e||(r=!0),!(a.group&&s)){var p=r&&!i,l=a.isParentOfNode(o);(p||l)&&n.push(a)}d&&(a!==t&&a!==e||(i=!0,o=a===t?t:e))})),n},r.prototype.setDatasource=function(e){console.error("AG Grid: should never call setDatasource on clientSideRowController")},r.prototype.getTopLevelNodes=function(){return this.rootNode?this.rootNode.childrenAfterGroup:null},r.prototype.getRootNode=function(){return this.rootNode},r.prototype.getRow=function(e){return this.rowsToDisplay[e]},r.prototype.isRowPresent=function(e){return this.rowsToDisplay.indexOf(e)>=0},r.prototype.getRowIndexAtPixel=function(e){if(this.isEmpty())return-1;var t=0,r=this.rowsToDisplay.length-1;if(e<=0)return 0;if(o._.last(this.rowsToDisplay).rowTop<=e)return this.rowsToDisplay.length-1;for(;;){var i=Math.floor((t+r)/2),n=this.rowsToDisplay[i];if(this.isRowInPixel(n,e))return i;n.rowTop<e?t=i+1:n.rowTop>e&&(r=i-1)}},r.prototype.isRowInPixel=function(e,t){var o=e.rowTop,r=e.rowTop+e.rowHeight;return o<=t&&r>t},r.prototype.forEachLeafNode=function(e){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach((function(t,o){return e(t,o)}))},r.prototype.forEachNode=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterGroup,e,t.Normal,0)},r.prototype.forEachNodeAfterFilter=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterFilter,e,t.AfterFilter,0)},r.prototype.forEachNodeAfterFilterAndSort=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterSort,e,t.AfterFilterAndSort,0)},r.prototype.forEachPivotNode=function(e){this.recursivelyWalkNodesAndCallback([this.rootNode],e,t.PivotNodes,0)},r.prototype.recursivelyWalkNodesAndCallback=function(e,o,r,i){if(!e)return i;for(var n=0;n<e.length;n++){var s=e[n];if(o(s,i++),s.hasChildren()){var a=null;switch(r){case t.Normal:a=s.childrenAfterGroup;break;case t.AfterFilter:a=s.childrenAfterFilter;break;case t.AfterFilterAndSort:a=s.childrenAfterSort;break;case t.PivotNodes:a=s.leafGroup?null:s.childrenAfterSort}a&&(i=this.recursivelyWalkNodesAndCallback(a,o,r,i))}}return i},r.prototype.doAggregate=function(e){this.aggregationStage&&this.aggregationStage.execute({rowNode:this.rootNode,changedPath:e})},r.prototype.expandOrCollapseAll=function(e){var t=this.gridOptionsWrapper.isTreeData();this.rootNode&&function r(i){if(!i)return;i.forEach((function(i){(t?o._.exists(i.childrenAfterGroup):i.group)&&(i.expanded=e,r(i.childrenAfterGroup))}))}(this.rootNode.childrenAfterGroup),this.refreshModel({step:o.ClientSideRowModelSteps.MAP});var r=e?"expandAll":"collapseAll",i={api:this.gridApi,columnApi:this.columnApi,type:o.Events.EVENT_EXPAND_COLLAPSE_ALL,source:r};this.eventService.dispatchEvent(i)},r.prototype.doSort=function(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})},r.prototype.doRowGrouping=function(e,t,o,r,i){this.groupStage?(t?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:t,rowNodeOrder:o,changedPath:r}):(this.selectionService.removeGroupsFromSelection(),this.groupStage.execute({rowNode:this.rootNode,changedPath:r,afterColumnsChanged:i}),this.restoreGroupState(e)),this.gridOptionsWrapper.isGroupSelectsChildren()&&this.selectionService.updateGroupsFromChildrenSelections(r)):(this.rootNode.childrenAfterGroup=this.rootNode.allLeafChildren,this.rootNode.updateHasChildren())},r.prototype.restoreGroupState=function(e){e&&o._.traverseNodesWithKey(this.rootNode.childrenAfterGroup,(function(t,o){"boolean"==typeof e[o]&&(t.expanded=e[o])}))},r.prototype.doFilter=function(e){this.filterStage.execute({rowNode:this.rootNode,changedPath:e})},r.prototype.doPivot=function(e){this.pivotStage&&this.pivotStage.execute({rowNode:this.rootNode,changedPath:e})},r.prototype.getGroupState=function(){if(!this.rootNode.childrenAfterGroup||!this.gridOptionsWrapper.isRememberGroupStateWhenNewData())return null;var e={};return o._.traverseNodesWithKey(this.rootNode.childrenAfterGroup,(function(t,o){return e[o]=t.expanded})),e},r.prototype.getCopyOfNodesMap=function(){return this.nodeManager.getCopyOfNodesMap()},r.prototype.getRowNode=function(e){if("string"==typeof e&&0==e.indexOf(o.RowNode.ID_PREFIX_ROW_GROUP)){var t=void 0;return this.forEachNode((function(o){o.id===e&&(t=o)})),t}return this.nodeManager.getRowNode(e)},r.prototype.setRowData=function(e){var t=this.getGroupState();this.nodeManager.setRowData(e);var r={type:o.Events.EVENT_ROW_DATA_CHANGED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(r),this.refreshModel({step:o.ClientSideRowModelSteps.EVERYTHING,groupState:t,newData:!0})},r.prototype.batchUpdateRowData=function(e,t){var o=this;if(null==this.applyAsyncTransactionsTimeout){this.rowDataTransactionBatch=[];var r=this.gridOptionsWrapper.getAsyncTransactionWaitMillis();this.applyAsyncTransactionsTimeout=window.setTimeout((function(){o.executeBatchUpdateRowData()}),r)}this.rowDataTransactionBatch.push({rowDataTransaction:e,callback:t})},r.prototype.flushAsyncTransactions=function(){null!=this.applyAsyncTransactionsTimeout&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())},r.prototype.executeBatchUpdateRowData=function(){var e=this;this.valueCache.onDataChanged();var t=[],r=[],i=!1;if(this.rowDataTransactionBatch&&this.rowDataTransactionBatch.forEach((function(o){var n=e.nodeManager.updateRowData(o.rowDataTransaction,void 0);r.push(n),o.callback&&t.push(o.callback.bind(null,n)),"number"==typeof o.rowDataTransaction.addIndex&&(i=!0)})),this.commonUpdateRowData(r,void 0,i),t.length>0&&window.setTimeout((function(){t.forEach((function(e){return e()}))}),0),r.length>0){var n={api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),type:o.Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,results:r};this.eventService.dispatchEvent(n)}this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0},r.prototype.updateRowData=function(e,t){this.valueCache.onDataChanged();var o=this.nodeManager.updateRowData(e,t),r="number"==typeof e.addIndex;return this.commonUpdateRowData([o],t,r),o},r.prototype.createRowNodeOrder=function(){if(!this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder()){var e={};if(this.rootNode&&this.rootNode.allLeafChildren)for(var t=0;t<this.rootNode.allLeafChildren.length;t++){e[this.rootNode.allLeafChildren[t].id]=t}return e}},r.prototype.commonUpdateRowData=function(e,t,r){r&&(t=this.createRowNodeOrder()),this.refreshModel({step:o.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:e,rowNodeOrder:t,keepRenderedRows:!0,animate:!0,keepEditingRows:!0});var i={type:o.Events.EVENT_ROW_DATA_UPDATED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(i)},r.prototype.doRowsToDisplay=function(){this.rowsToDisplay=this.flattenStage.execute({rowNode:this.rootNode})},r.prototype.onRowHeightChanged=function(){this.refreshModel({step:o.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,keepEditingRows:!0})},r.prototype.resetRowHeights=function(){var e=!1;this.forEachNode((function(t){t.setRowHeight(t.rowHeight,!0);var o=t.detailNode;o&&o.setRowHeight(o.rowHeight,!0),e=!0})),e&&this.onRowHeightChanged()},s([o.Autowired("columnModel")],r.prototype,"columnModel",void 0),s([o.Autowired("$scope")],r.prototype,"$scope",void 0),s([o.Autowired("selectionService")],r.prototype,"selectionService",void 0),s([o.Autowired("valueCache")],r.prototype,"valueCache",void 0),s([o.Autowired("columnApi")],r.prototype,"columnApi",void 0),s([o.Autowired("gridApi")],r.prototype,"gridApi",void 0),s([o.Autowired("animationFrameService")],r.prototype,"animationFrameService",void 0),s([o.Autowired("filterStage")],r.prototype,"filterStage",void 0),s([o.Autowired("sortStage")],r.prototype,"sortStage",void 0),s([o.Autowired("flattenStage")],r.prototype,"flattenStage",void 0),s([o.Optional("groupStage")],r.prototype,"groupStage",void 0),s([o.Optional("aggregationStage")],r.prototype,"aggregationStage",void 0),s([o.Optional("pivotStage")],r.prototype,"pivotStage",void 0),s([o.PostConstruct],r.prototype,"init",null),r=s([o.Bean("rowModel")],r)}(o.BeanStub),d=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),p=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t.prototype.execute=function(e){var t=e.rowNode,o=e.changedPath;this.filterService.filter(o),this.selectableService.updateSelectableAfterFiltering(t)},p([o.Autowired("selectableService")],t.prototype,"selectableService",void 0),p([o.Autowired("filterService")],t.prototype,"filterService",void 0),t=p([o.Bean("filterStage")],t)}(o.BeanStub),h=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),c=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t.prototype.execute=function(e){var t=this.sortController.getSortOptions(),r=o._.exists(t)&&t.length>0,i=r&&o._.exists(e.rowNodeTransactions)&&this.gridOptionsWrapper.isDeltaSort(),n=i?this.calculateDirtyNodes(e.rowNodeTransactions):null,s=o._.missingOrEmpty(this.columnModel.getValueColumns()),a=o._.some(t,(function(e){return!!e.column.getColDef().showRowGroup}));this.sortService.sort(t,r,i,n,e.changedPath,s,a)},t.prototype.calculateDirtyNodes=function(e){var t={},o=function(e){e&&e.forEach((function(e){return t[e.id]=!0}))};return e&&e.forEach((function(e){o(e.add),o(e.update),o(e.remove)})),t},c([o.Autowired("sortService")],t.prototype,"sortService",void 0),c([o.Autowired("sortController")],t.prototype,"sortController",void 0),c([o.Autowired("columnModel")],t.prototype,"columnModel",void 0),t=c([o.Bean("sortStage")],t)}(o.BeanStub),f=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),g=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},w=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.prototype.execute=function(e){var t=e.rowNode,o=[],r={value:0},i=this.columnModel.isPivotMode(),n=i&&t.leafGroup,s=n?[t]:t.childrenAfterSort;return this.recursivelyAddToRowsToDisplay(s,o,r,i,0),!n&&o.length>0&&this.gridOptionsWrapper.isGroupIncludeTotalFooter()&&(this.ensureFooterNodeExists(t),this.addRowNodeToRowsToDisplay(t.sibling,o,r,0)),o},t.prototype.recursivelyAddToRowsToDisplay=function(e,t,r,i,n){if(!o._.missingOrEmpty(e))for(var s=this.gridOptionsWrapper.isGroupHideOpenParents(),a=this.gridOptionsWrapper.isGroupRemoveSingleChildren(),d=!a&&this.gridOptionsWrapper.isGroupRemoveLowestSingleChildren(),p=0;p<e.length;p++){var l=e[p],h=l.hasChildren(),c=i&&!h,u=a&&h&&1===l.childrenAfterGroup.length,f=d&&h&&l.leafGroup&&1===l.childrenAfterGroup.length,g=i&&l.leafGroup,w=s&&l.expanded&&!g;if(!(c||w||u||f)&&this.addRowNodeToRowsToDisplay(l,t,r,n),!i||!l.leafGroup)if(h){var v=u||f;if(l.expanded||v){var y=v?n:n+1;this.recursivelyAddToRowsToDisplay(l.childrenAfterSort,t,r,i,y),this.gridOptionsWrapper.isGroupIncludeFooter()&&(this.ensureFooterNodeExists(l),this.addRowNodeToRowsToDisplay(l.sibling,t,r,n))}}else if(l.master&&l.expanded){var R=this.createDetailNode(l);this.addRowNodeToRowsToDisplay(R,t,r,n)}}},t.prototype.addRowNodeToRowsToDisplay=function(e,t,o,r){var i=this.gridOptionsWrapper.isGroupMultiAutoColumn();t.push(e),e.setUiLevel(i?0:r)},t.prototype.ensureFooterNodeExists=function(e){if(!o._.exists(e.sibling)){var t=new o.RowNode;this.context.createBean(t),Object.keys(e).forEach((function(o){t[o]=e[o]})),t.footer=!0,t.setRowTop(null),t.setRowIndex(null),t.oldRowTop=null,o._.exists(t.id)&&(t.id="rowGroupFooter_"+t.id),t.sibling=e,e.sibling=t}},t.prototype.createDetailNode=function(e){if(o._.exists(e.detailNode))return e.detailNode;var t=new o.RowNode;return this.context.createBean(t),t.detail=!0,t.selectable=!1,t.parent=e,o._.exists(e.id)&&(t.id="detail_"+e.id),t.data=e.data,t.level=e.level+1,e.detailNode=t,t},g([o.Autowired("columnModel")],t.prototype,"columnModel",void 0),t=g([o.Bean("flattenStage")],t)}(o.BeanStub),v=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),y=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},R=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return v(t,e),t.prototype.init=function(){this.postSortFunc=this.gridOptionsWrapper.getPostSortFunc()},t.prototype.sort=function(e,t,o,r,i,n,s){var a=this,d=this.gridOptionsWrapper.isGroupMaintainOrder();i&&i.forEachChangedNodeDepthFirst((function(p){if(a.pullDownGroupDataForHideOpenParents(p.childrenAfterFilter,!0),t){var l=d&&!p.leafGroup&&!s;p.childrenAfterSort=l?p.childrenAfterSort.slice(0):o?a.doDeltaSort(p,e,r,i,n):a.rowNodeSorter.doFullSort(p.childrenAfterFilter,e)}else p.childrenAfterSort=d&&p.childrenAfterSort?p.childrenAfterSort.slice(0):p.childrenAfterFilter.slice(0);a.updateChildIndexes(p),a.postSortFunc&&a.postSortFunc(p.childrenAfterSort)})),this.updateGroupDataForHideOpenParents(i)},t.prototype.mapNodeToSortedNode=function(e,t){return{currentPos:t,rowNode:e}},t.prototype.doDeltaSort=function(e,t,o,r,i){var n=e.childrenAfterSort.filter((function(e){var t=!o[e.id],n=i||r&&r.canSkip(e);return t&&n})).map(this.mapNodeToSortedNode.bind(this)),s={};n.forEach((function(e){return s[e.rowNode.id]=e.rowNode}));var a=e.childrenAfterFilter.filter((function(e){return!s[e.id]})).map(this.mapNodeToSortedNode.bind(this));return a.sort(this.rowNodeSorter.compareRowNodes.bind(this,t)),(0===a.length?n:0===n.length?a:this.mergeSortedArrays(t,n,a)).map((function(e){return e.rowNode}))},t.prototype.mergeSortedArrays=function(e,t,o){for(var r=[],i=0,n=0;i<t.length&&n<o.length;){this.rowNodeSorter.compareRowNodes(e,t[i],o[n])<0?r.push(t[i++]):r.push(o[n++])}for(;i<t.length;)r.push(t[i++]);for(;n<o.length;)r.push(o[n++]);return r},t.prototype.updateChildIndexes=function(e){if(!o._.missing(e.childrenAfterSort))for(var t=e.childrenAfterSort,r=0;r<t.length;r++){var i=t[r],n=0===r,s=r===e.childrenAfterSort.length-1;i.setFirstChild(n),i.setLastChild(s),i.setChildIndex(r)}},t.prototype.updateGroupDataForHideOpenParents=function(e){var t=this;if(this.gridOptionsWrapper.isGroupHideOpenParents()){if(this.gridOptionsWrapper.isTreeData()){return o._.doOnce((function(){return console.warn("AG Grid: 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 (as opposed to Row Grouping, which only has Aggregated Values at the group level).")}),"sortService.hideOpenParentsWithTreeData"),!1}var r=function(e){t.pullDownGroupDataForHideOpenParents(e.childrenAfterSort,!1),e.childrenAfterSort.forEach((function(e){e.hasChildren()&&r(e)}))};e&&e.executeFromRootNode((function(e){return r(e)}))}},t.prototype.pullDownGroupDataForHideOpenParents=function(e,t){var r=this;this.gridOptionsWrapper.isGroupHideOpenParents()&&!o._.missing(e)&&e.forEach((function(e){r.columnModel.getGroupDisplayColumns().forEach((function(o){var i=o.getColDef().showRowGroup;if("string"==typeof i){var n=i,s=r.columnModel.getPrimaryColumn(n);if(!(s===e.rowGroupColumn))if(t)e.setGroupValue(o.getId(),void 0);else{var a=e.getFirstChildOfFirstChild(s);a&&e.setGroupValue(o.getId(),a.key)}}else console.error("AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup")}))}))},y([o.Autowired("columnModel")],t.prototype,"columnModel",void 0),y([o.Autowired("rowNodeSorter")],t.prototype,"rowNodeSorter",void 0),y([o.PostConstruct],t.prototype,"init",null),t=y([o.Bean("sortService")],t)}(o.BeanStub),N=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),A=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},S=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return N(t,e),t.prototype.postConstruct=function(){this.doingTreeData=this.gridOptionsWrapper.isTreeData()},t.prototype.filter=function(e){var t=this.filterManager.isAnyFilterPresent();this.filterNodes(t,e)},t.prototype.filterNodes=function(e,t){var o=this,r=function(t,r){t.hasChildren()?(t.childrenAfterFilter=e&&!r?t.childrenAfterGroup.filter((function(e){var t=e.childrenAfterFilter&&e.childrenAfterFilter.length>0,r=e.data&&o.filterManager.doesRowPassFilter({rowNode:e});return t||r})):t.childrenAfterGroup,o.setAllChildrenCount(t)):(t.childrenAfterFilter=t.childrenAfterGroup,t.setAllChildrenCount(null))};if(this.doingTreeDataFiltering()){var i=function(e,t){if(e.childrenAfterGroup)for(var n=0;n<e.childrenAfterGroup.length;n++){var s=e.childrenAfterGroup[n],a=t||o.filterManager.doesRowPassFilter({rowNode:s});s.childrenAfterGroup?i(e.childrenAfterGroup[n],a):r(s,a)}r(e,t)};t.executeFromRootNode((function(e){return i(e,!1)}))}else{t.forEachChangedNodeDepthFirst((function(e){return r(e,!1)}),!0)}},t.prototype.setAllChildrenCountTreeData=function(e){var t=0;e.childrenAfterFilter.forEach((function(e){t++,t+=e.allChildrenCount})),e.setAllChildrenCount(t)},t.prototype.setAllChildrenCountGridGrouping=function(e){var t=0;e.childrenAfterFilter.forEach((function(e){e.group?t+=e.allChildrenCount:t++})),e.setAllChildrenCount(t)},t.prototype.setAllChildrenCount=function(e){this.doingTreeData?this.setAllChildrenCountTreeData(e):this.setAllChildrenCountGridGrouping(e)},t.prototype.doingTreeDataFiltering=function(){return this.gridOptionsWrapper.isTreeData()&&!this.gridOptionsWrapper.isExcludeChildrenWhenTreeDataFiltering()},A([o.Autowired("filterManager")],t.prototype,"filterManager",void 0),A([o.PostConstruct],t.prototype,"postConstruct",null),t=A([o.Bean("filterService")],t)}(o.BeanStub),O=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),T=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},C=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return O(t,e),t.prototype.postConstruct=function(){this.rowModel.getType()===o.Constants.ROW_MODEL_TYPE_CLIENT_SIDE&&(this.clientSideRowModel=this.rowModel)},t.prototype.createTransactionForRowData=function(e){if(o._.missing(this.clientSideRowModel))console.error("AG Grid: ImmutableService only works with ClientSideRowModel");else{var t=this.gridOptionsWrapper.getRowNodeIdFunc();if(t&&!o._.missing(t)){var r={remove:[],update:[],add:[]},i=this.clientSideRowModel.getCopyOfNodesMap(),n=this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder()?null:{};return o._.exists(e)&&e.forEach((function(e,o){var s=t(e),a=i[s];(n&&(n[s]=o),a)?(a.data!==e&&r.update.push(e),i[s]=void 0):r.add.push(e)})),o._.iterateObject(i,(function(e,t){t&&r.remove.push(t.data)})),[r,n]}console.error("AG Grid: ImmutableService requires getRowNodeId() callback to be implemented, your row data need IDs!")}},T([o.Autowired("rowModel")],t.prototype,"rowModel",void 0),T([o.PostConstruct],t.prototype,"postConstruct",null),t=T([o.Bean("immutableService")],t)}(o.BeanStub),m={moduleName:o.ModuleNames.ClientSideRowModelModule,beans:[l,u,w,R,S,C],rowModels:{clientSide:a}};exports.ClientSideRowModelModule=m;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,o=require("@ag-grid-community/core"),r=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<o;t++)for(var n=arguments[t],s=0,a=n.length;s<a;s++,i++)r[i]=n[s];return r},i=function(){function e(t,o,r,i,n,s,a,d){this.nextId=0,this.allNodesMap={},this.rootNode=t,this.gridOptionsWrapper=o,this.eventService=r,this.columnModel=i,this.gridApi=n,this.columnApi=s,this.beans=d,this.selectionService=a,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id=e.ROOT_NODE_ID,this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterFilter=[],this.postConstruct()}return e.prototype.postConstruct=function(){this.suppressParentsInRowNodes=this.gridOptionsWrapper.isSuppressParentsInRowNodes(),this.isRowMasterFunc=this.gridOptionsWrapper.getIsRowMasterFunc(),this.doingTreeData=this.gridOptionsWrapper.isTreeData(),this.doingMasterDetail=this.gridOptionsWrapper.isMasterDetail()},e.prototype.getCopyOfNodesMap=function(){return o._.cloneObject(this.allNodesMap)},e.prototype.getRowNode=function(e){return this.allNodesMap[e]},e.prototype.setRowData=function(t){if(this.rootNode.childrenAfterFilter=null,this.rootNode.childrenAfterGroup=null,this.rootNode.childrenAfterSort=null,this.rootNode.childrenMapped=null,this.rootNode.updateHasChildren(),this.nextId=0,this.allNodesMap={},!t)return this.rootNode.allLeafChildren=[],void(this.rootNode.childrenAfterGroup=[]);this.rootNode.allLeafChildren=this.recursiveFunction(t,this.rootNode,e.TOP_LEVEL)},e.prototype.updateRowData=function(e,t){var r={remove:[],update:[],add:[]},i=[];return this.executeRemove(e,r,i),this.executeUpdate(e,r,i),this.executeAdd(e,r),this.updateSelection(i),t&&o._.sortRowNodesByOrder(this.rootNode.allLeafChildren,t),r},e.prototype.updateSelection=function(e){var t=e.length>0;if(t&&e.forEach((function(e){e.setSelected(!1,!1,!0)})),this.selectionService.updateGroupsFromChildrenSelections(),t){var r={type:o.Events.EVENT_SELECTION_CHANGED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(r)}},e.prototype.executeAdd=function(t,i){var n=this,s=t.add,a=t.addIndex;if(!o._.missingOrEmpty(s)){var d=s.map((function(t){return n.createNode(t,n.rootNode,e.TOP_LEVEL)}));if("number"==typeof a&&a>=0){var p=this.rootNode.allLeafChildren,l=p.slice(0,a),h=p.slice(a,p.length);this.rootNode.allLeafChildren=r(l,d,h)}else this.rootNode.allLeafChildren=r(this.rootNode.allLeafChildren,d);i.add=d}},e.prototype.executeRemove=function(e,t,r){var i=this,n=e.remove;if(!o._.missingOrEmpty(n)){var s={};n.forEach((function(e){var o=i.lookupRowNode(e);o&&(o.isSelected()&&r.push(o),o.clearRowTopAndRowIndex(),s[o.id]=!0,delete i.allNodesMap[o.id],t.remove.push(o))})),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren.filter((function(e){return!s[e.id]}))}},e.prototype.executeUpdate=function(t,r,i){var n=this,s=t.update;o._.missingOrEmpty(s)||s.forEach((function(t){var o=n.lookupRowNode(t);o&&(o.updateData(t),!o.selectable&&o.isSelected()&&i.push(o),n.setMasterForRow(o,t,e.TOP_LEVEL,!1),r.update.push(o))}))},e.prototype.lookupRowNode=function(e){var t,r=this.gridOptionsWrapper.getRowNodeIdFunc();if(o._.exists(r)){var i=r(e);if(!(t=this.allNodesMap[i]))return console.error("AG Grid: could not find row id="+i+", data item was not found for this id"),null}else if(!(t=o._.find(this.rootNode.allLeafChildren,(function(t){return t.data===e}))))return console.error("AG Grid: could not find data item as object was not found",e),console.error("Consider using getRowNodeId to help the Grid find matching row data"),null;return t},e.prototype.recursiveFunction=function(e,t,o){var r=this;if("string"!=typeof e){var i=[];return e.forEach((function(e){var n=r.createNode(e,t,o);i.push(n)})),i}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")},e.prototype.createNode=function(e,t,r){var i=new o.RowNode(this.beans);return i.group=!1,this.setMasterForRow(i,e,r,!0),t&&!this.suppressParentsInRowNodes&&(i.parent=t),i.level=r,i.setDataAndId(e,this.nextId.toString()),this.allNodesMap[i.id]&&console.warn("ag-grid: duplicate node id '"+i.id+"' detected from getRowNodeId callback, this could cause issues in your grid."),this.allNodesMap[i.id]=i,this.nextId++,i},e.prototype.setMasterForRow=function(e,t,o,r){if(this.doingTreeData)e.setMaster(!1),r&&(e.expanded=!1);else if(this.doingMasterDetail?this.isRowMasterFunc?e.setMaster(this.isRowMasterFunc(t)):e.setMaster(!0):e.setMaster(!1),r){var i=this.columnModel.getRowGroupColumns(),n=o+(i?i.length:0);e.expanded=!!e.master&&this.isExpanded(n)}},e.prototype.isExpanded=function(e){var t=this.gridOptionsWrapper.getGroupDefaultExpanded();return-1===t||e<t},e.TOP_LEVEL=0,e.ROOT_NODE_ID="ROOT_NODE_ID",e}(),n=(e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)},function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}),s=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s};!function(e){e[e.Normal=0]="Normal",e[e.AfterFilter=1]="AfterFilter",e[e.AfterFilterAndSort=2]="AfterFilterAndSort",e[e.PivotNodes=3]="PivotNodes"}(t||(t={}));var a=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return n(r,e),r.prototype.init=function(){var e=this.refreshModel.bind(this,{step:o.ClientSideRowModelSteps.EVERYTHING}),t=this.refreshModel.bind(this,{step:o.ClientSideRowModelSteps.EVERYTHING,afterColumnsChanged:!0,keepRenderedRows:!0,animate:!0});this.addManagedListener(this.eventService,o.Events.EVENT_NEW_COLUMNS_LOADED,t),this.addManagedListener(this.eventService,o.Events.EVENT_COLUMN_ROW_GROUP_CHANGED,e),this.addManagedListener(this.eventService,o.Events.EVENT_COLUMN_VALUE_CHANGED,this.onValueChanged.bind(this)),this.addManagedListener(this.eventService,o.Events.EVENT_COLUMN_PIVOT_CHANGED,this.refreshModel.bind(this,{step:o.ClientSideRowModelSteps.PIVOT})),this.addManagedListener(this.eventService,o.Events.EVENT_FILTER_CHANGED,this.onFilterChanged.bind(this)),this.addManagedListener(this.eventService,o.Events.EVENT_SORT_CHANGED,this.onSortChanged.bind(this)),this.addManagedListener(this.eventService,o.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED,e);var r=this.refreshModel.bind(this,{step:o.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:!0});this.addManagedListener(this.gridOptionsWrapper,o.GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN,r),this.addManagedListener(this.gridOptionsWrapper,o.GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN,r),this.rootNode=new o.RowNode(this.beans),this.nodeManager=new i(this.rootNode,this.gridOptionsWrapper,this.eventService,this.columnModel,this.gridApi,this.columnApi,this.selectionService,this.beans)},r.prototype.start=function(){var e=this.gridOptionsWrapper.getRowData();e&&this.setRowData(e)},r.prototype.ensureRowHeightsValid=function(e,t,o,r){var i,n=!1;do{i=!1;for(var s=this.getRowIndexAtPixel(e),a=this.getRowIndexAtPixel(t),d=Math.max(s,o),p=Math.min(a,r),l=d;l<=p;l++){var h=this.getRow(l);if(h.rowHeightEstimated){var u=this.gridOptionsWrapper.getRowHeightForNode(h);h.setRowHeight(u.height),i=!0,n=!0}}i&&this.setRowTopAndRowIndex()}while(i);return n},r.prototype.setRowTopAndRowIndex=function(){for(var e=this.gridOptionsWrapper.getDefaultRowHeight(),t=0,r=new Set,i=this.gridOptionsWrapper.getDomLayout()===o.Constants.DOM_LAYOUT_NORMAL,n=0;n<this.rowsToDisplay.length;n++){var s=this.rowsToDisplay[n];if(null!=s.id&&r.add(s.id),null==s.rowHeight){var a=this.gridOptionsWrapper.getRowHeightForNode(s,i,e);s.setRowHeight(a.height,a.estimated)}s.setRowTop(t),s.setRowIndex(n),t+=s.rowHeight}return r},r.prototype.clearRowTopAndRowIndex=function(e,t){var o=e.isActive(),r=function(e){e&&null!=e.id&&!t.has(e.id)&&e.clearRowTopAndRowIndex()},i=function(e){if(r(e),r(e.detailNode),r(e.sibling),e.hasChildren()&&e.childrenAfterGroup){var t=-1==e.level;o&&!t&&!e.expanded||e.childrenAfterGroup.forEach(i)}};i(this.rootNode)},r.prototype.ensureRowsAtPixel=function(e,t,r){var i=this;void 0===r&&(r=0);var n=this.getRowIndexAtPixel(t);return this.getRow(n)!==e[0]&&(e.forEach((function(e){o._.removeFromArray(i.rootNode.allLeafChildren,e)})),e.forEach((function(e,t){o._.insertIntoArray(i.rootNode.allLeafChildren,e,Math.max(n+r,0)+t)})),this.refreshModel({step:o.ClientSideRowModelSteps.EVERYTHING,keepRenderedRows:!0,animate:!0,keepEditingRows:!0}),!0)},r.prototype.highlightRowAtPixel=function(e,t){var o=null!=t?this.getRowIndexAtPixel(t):null,r=null!=o?this.getRow(o):null;if(r&&e&&r!==e&&null!=t){var i=this.getHighlightPosition(t,r);this.lastHighlightedRow&&this.lastHighlightedRow!==r&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null),r.setHighlighted(i),this.lastHighlightedRow=r}else this.lastHighlightedRow&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null)},r.prototype.getHighlightPosition=function(e,t){if(!t){var r=this.getRowIndexAtPixel(e);if(!(t=this.getRow(r||0)))return o.RowHighlightPosition.Below}return e-t.rowTop<t.rowHeight/2?o.RowHighlightPosition.Above:o.RowHighlightPosition.Below},r.prototype.getLastHighlightedRowNode=function(){return this.lastHighlightedRow},r.prototype.isLastRowIndexKnown=function(){return!0},r.prototype.getRowCount=function(){return this.rowsToDisplay?this.rowsToDisplay.length:0},r.prototype.getTopLevelRowCount=function(){return this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode?1:this.rootNode.childrenAfterFilter?this.rootNode.childrenAfterFilter.length:0},r.prototype.getTopLevelRowDisplayedIndex=function(e){if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return e;var t=this.rootNode.childrenAfterSort[e];if(this.gridOptionsWrapper.isGroupHideOpenParents())for(;t.expanded&&t.childrenAfterSort&&t.childrenAfterSort.length>0;)t=t.childrenAfterSort[0];return t.rowIndex},r.prototype.getRowBounds=function(e){if(o._.missing(this.rowsToDisplay))return null;var t=this.rowsToDisplay[e];return t?{rowTop:t.rowTop,rowHeight:t.rowHeight}:null},r.prototype.onRowGroupOpened=function(){var e=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:o.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,animate:e})},r.prototype.onFilterChanged=function(e){if(!e.afterDataChange){var t=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:o.ClientSideRowModelSteps.FILTER,keepRenderedRows:!0,animate:t})}},r.prototype.onSortChanged=function(){var e=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:o.ClientSideRowModelSteps.SORT,keepRenderedRows:!0,animate:e,keepEditingRows:!0})},r.prototype.getType=function(){return o.Constants.ROW_MODEL_TYPE_CLIENT_SIDE},r.prototype.onValueChanged=function(){this.columnModel.isPivotActive()?this.refreshModel({step:o.ClientSideRowModelSteps.PIVOT}):this.refreshModel({step:o.ClientSideRowModelSteps.AGGREGATE})},r.prototype.createChangePath=function(e){var t=o._.missingOrEmpty(e),r=new o.ChangedPath(!1,this.rootNode);return(t||this.gridOptionsWrapper.isTreeData())&&r.setInactive(),r},r.prototype.isSuppressModelUpdateAfterUpdateTransaction=function(e){if(!this.gridOptionsWrapper.isSuppressModelUpdateAfterUpdateTransaction())return!1;if(null==e.rowNodeTransactions)return!1;var t=o._.filter(e.rowNodeTransactions,(function(e){return null!=e.add&&e.add.length>0||null!=e.remove&&e.remove.length>0}));return null==t||0==t.length},r.prototype.refreshModel=function(e){var t=this;if(!this.isSuppressModelUpdateAfterUpdateTransaction(e)){var r=this.createChangePath(e.rowNodeTransactions);switch(e.step){case o.ClientSideRowModelSteps.EVERYTHING:this.doRowGrouping(e.groupState,e.rowNodeTransactions,e.rowNodeOrder,r,!!e.afterColumnsChanged);case o.ClientSideRowModelSteps.FILTER:this.doFilter(r);case o.ClientSideRowModelSteps.PIVOT:this.doPivot(r);case o.ClientSideRowModelSteps.AGGREGATE:this.doAggregate(r);case o.ClientSideRowModelSteps.SORT:this.doSort(e.rowNodeTransactions,r);case o.ClientSideRowModelSteps.MAP:this.doRowsToDisplay()}var i=this.setRowTopAndRowIndex();this.clearRowTopAndRowIndex(r,i);var n={type:o.Events.EVENT_MODEL_UPDATED,api:this.gridApi,columnApi:this.columnApi,animate:e.animate,keepRenderedRows:e.keepRenderedRows,newData:e.newData,newPage:!1};this.eventService.dispatchEvent(n),this.$scope&&window.setTimeout((function(){t.$scope.$apply()}),0)}},r.prototype.isEmpty=function(){var e=o._.missing(this.rootNode.allLeafChildren)||0===this.rootNode.allLeafChildren.length;return o._.missing(this.rootNode)||e||!this.columnModel.isReady()},r.prototype.isRowsToRender=function(){return o._.exists(this.rowsToDisplay)&&this.rowsToDisplay.length>0},r.prototype.getNodesInRangeForSelection=function(e,t){var o,r=!t,i=!1,n=[],s=this.gridOptionsWrapper.isGroupSelectsChildren();return this.forEachNodeAfterFilterAndSort((function(a){var d=r&&!i;if(r||a!==t&&a!==e||(r=!0),!(a.group&&s)){var p=r&&!i,l=a.isParentOfNode(o);(p||l)&&n.push(a)}d&&(a!==t&&a!==e||(i=!0,o=a===t?t:e))})),n},r.prototype.setDatasource=function(e){console.error("AG Grid: should never call setDatasource on clientSideRowController")},r.prototype.getTopLevelNodes=function(){return this.rootNode?this.rootNode.childrenAfterGroup:null},r.prototype.getRootNode=function(){return this.rootNode},r.prototype.getRow=function(e){return this.rowsToDisplay[e]},r.prototype.isRowPresent=function(e){return this.rowsToDisplay.indexOf(e)>=0},r.prototype.getRowIndexAtPixel=function(e){if(this.isEmpty())return-1;var t=0,r=this.rowsToDisplay.length-1;if(e<=0)return 0;if(o._.last(this.rowsToDisplay).rowTop<=e)return this.rowsToDisplay.length-1;for(;;){var i=Math.floor((t+r)/2),n=this.rowsToDisplay[i];if(this.isRowInPixel(n,e))return i;n.rowTop<e?t=i+1:n.rowTop>e&&(r=i-1)}},r.prototype.isRowInPixel=function(e,t){var o=e.rowTop,r=e.rowTop+e.rowHeight;return o<=t&&r>t},r.prototype.forEachLeafNode=function(e){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach((function(t,o){return e(t,o)}))},r.prototype.forEachNode=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterGroup,e,t.Normal,0)},r.prototype.forEachNodeAfterFilter=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterFilter,e,t.AfterFilter,0)},r.prototype.forEachNodeAfterFilterAndSort=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterSort,e,t.AfterFilterAndSort,0)},r.prototype.forEachPivotNode=function(e){this.recursivelyWalkNodesAndCallback([this.rootNode],e,t.PivotNodes,0)},r.prototype.recursivelyWalkNodesAndCallback=function(e,o,r,i){if(!e)return i;for(var n=0;n<e.length;n++){var s=e[n];if(o(s,i++),s.hasChildren()){var a=null;switch(r){case t.Normal:a=s.childrenAfterGroup;break;case t.AfterFilter:a=s.childrenAfterFilter;break;case t.AfterFilterAndSort:a=s.childrenAfterSort;break;case t.PivotNodes:a=s.leafGroup?null:s.childrenAfterSort}a&&(i=this.recursivelyWalkNodesAndCallback(a,o,r,i))}}return i},r.prototype.doAggregate=function(e){this.aggregationStage&&this.aggregationStage.execute({rowNode:this.rootNode,changedPath:e})},r.prototype.expandOrCollapseAll=function(e){var t=this.gridOptionsWrapper.isTreeData();this.rootNode&&function r(i){if(!i)return;i.forEach((function(i){(t?o._.exists(i.childrenAfterGroup):i.group)&&(i.expanded=e,r(i.childrenAfterGroup))}))}(this.rootNode.childrenAfterGroup),this.refreshModel({step:o.ClientSideRowModelSteps.MAP});var r=e?"expandAll":"collapseAll",i={api:this.gridApi,columnApi:this.columnApi,type:o.Events.EVENT_EXPAND_COLLAPSE_ALL,source:r};this.eventService.dispatchEvent(i)},r.prototype.doSort=function(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})},r.prototype.doRowGrouping=function(e,t,o,r,i){this.groupStage?(t?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:t,rowNodeOrder:o,changedPath:r}):(this.groupStage.execute({rowNode:this.rootNode,changedPath:r,afterColumnsChanged:i}),this.restoreGroupState(e)),this.gridOptionsWrapper.isGroupSelectsChildren()&&this.selectionService.updateGroupsFromChildrenSelections(r)):(this.rootNode.childrenAfterGroup=this.rootNode.allLeafChildren,this.rootNode.updateHasChildren())},r.prototype.restoreGroupState=function(e){e&&o._.traverseNodesWithKey(this.rootNode.childrenAfterGroup,(function(t,o){"boolean"==typeof e[o]&&(t.expanded=e[o])}))},r.prototype.doFilter=function(e){this.filterStage.execute({rowNode:this.rootNode,changedPath:e})},r.prototype.doPivot=function(e){this.pivotStage&&this.pivotStage.execute({rowNode:this.rootNode,changedPath:e})},r.prototype.getGroupState=function(){if(!this.rootNode.childrenAfterGroup||!this.gridOptionsWrapper.isRememberGroupStateWhenNewData())return null;var e={};return o._.traverseNodesWithKey(this.rootNode.childrenAfterGroup,(function(t,o){return e[o]=t.expanded})),e},r.prototype.getCopyOfNodesMap=function(){return this.nodeManager.getCopyOfNodesMap()},r.prototype.getRowNode=function(e){if("string"==typeof e&&0==e.indexOf(o.RowNode.ID_PREFIX_ROW_GROUP)){var t=void 0;return this.forEachNode((function(o){o.id===e&&(t=o)})),t}return this.nodeManager.getRowNode(e)},r.prototype.setRowData=function(e){var t=this.getGroupState();this.nodeManager.setRowData(e);var r={type:o.Events.EVENT_ROW_DATA_CHANGED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(r),this.refreshModel({step:o.ClientSideRowModelSteps.EVERYTHING,groupState:t,newData:!0})},r.prototype.batchUpdateRowData=function(e,t){var o=this;if(null==this.applyAsyncTransactionsTimeout){this.rowDataTransactionBatch=[];var r=this.gridOptionsWrapper.getAsyncTransactionWaitMillis();this.applyAsyncTransactionsTimeout=window.setTimeout((function(){o.executeBatchUpdateRowData()}),r)}this.rowDataTransactionBatch.push({rowDataTransaction:e,callback:t})},r.prototype.flushAsyncTransactions=function(){null!=this.applyAsyncTransactionsTimeout&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())},r.prototype.executeBatchUpdateRowData=function(){var e=this;this.valueCache.onDataChanged();var t=[],r=[],i=!1;if(this.rowDataTransactionBatch&&this.rowDataTransactionBatch.forEach((function(o){var n=e.nodeManager.updateRowData(o.rowDataTransaction,void 0);r.push(n),o.callback&&t.push(o.callback.bind(null,n)),"number"==typeof o.rowDataTransaction.addIndex&&(i=!0)})),this.commonUpdateRowData(r,void 0,i),t.length>0&&window.setTimeout((function(){t.forEach((function(e){return e()}))}),0),r.length>0){var n={api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),type:o.Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,results:r};this.eventService.dispatchEvent(n)}this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0},r.prototype.updateRowData=function(e,t){this.valueCache.onDataChanged();var o=this.nodeManager.updateRowData(e,t),r="number"==typeof e.addIndex;return this.commonUpdateRowData([o],t,r),o},r.prototype.createRowNodeOrder=function(){if(!this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder()){var e={};if(this.rootNode&&this.rootNode.allLeafChildren)for(var t=0;t<this.rootNode.allLeafChildren.length;t++){e[this.rootNode.allLeafChildren[t].id]=t}return e}},r.prototype.commonUpdateRowData=function(e,t,r){r&&(t=this.createRowNodeOrder()),this.refreshModel({step:o.ClientSideRowModelSteps.EVERYTHING,rowNodeTransactions:e,rowNodeOrder:t,keepRenderedRows:!0,animate:!0,keepEditingRows:!0});var i={type:o.Events.EVENT_ROW_DATA_UPDATED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(i)},r.prototype.doRowsToDisplay=function(){this.rowsToDisplay=this.flattenStage.execute({rowNode:this.rootNode})},r.prototype.onRowHeightChanged=function(){this.refreshModel({step:o.ClientSideRowModelSteps.MAP,keepRenderedRows:!0,keepEditingRows:!0})},r.prototype.resetRowHeights=function(){var e=!1;this.forEachNode((function(t){t.setRowHeight(t.rowHeight,!0);var o=t.detailNode;o&&o.setRowHeight(o.rowHeight,!0),e=!0})),e&&this.onRowHeightChanged()},s([o.Autowired("columnModel")],r.prototype,"columnModel",void 0),s([o.Autowired("$scope")],r.prototype,"$scope",void 0),s([o.Autowired("selectionService")],r.prototype,"selectionService",void 0),s([o.Autowired("valueCache")],r.prototype,"valueCache",void 0),s([o.Autowired("columnApi")],r.prototype,"columnApi",void 0),s([o.Autowired("gridApi")],r.prototype,"gridApi",void 0),s([o.Autowired("animationFrameService")],r.prototype,"animationFrameService",void 0),s([o.Autowired("beans")],r.prototype,"beans",void 0),s([o.Autowired("filterStage")],r.prototype,"filterStage",void 0),s([o.Autowired("sortStage")],r.prototype,"sortStage",void 0),s([o.Autowired("flattenStage")],r.prototype,"flattenStage",void 0),s([o.Optional("groupStage")],r.prototype,"groupStage",void 0),s([o.Optional("aggregationStage")],r.prototype,"aggregationStage",void 0),s([o.Optional("pivotStage")],r.prototype,"pivotStage",void 0),s([o.PostConstruct],r.prototype,"init",null),r=s([o.Bean("rowModel")],r)}(o.BeanStub),d=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),p=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t.prototype.execute=function(e){var t=e.rowNode,o=e.changedPath;this.filterService.filter(o),this.selectableService.updateSelectableAfterFiltering(t)},p([o.Autowired("selectableService")],t.prototype,"selectableService",void 0),p([o.Autowired("filterService")],t.prototype,"filterService",void 0),t=p([o.Bean("filterStage")],t)}(o.BeanStub),h=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),u=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return h(t,e),t.prototype.execute=function(e){var t=this.sortController.getSortOptions(),r=o._.exists(t)&&t.length>0,i=r&&o._.exists(e.rowNodeTransactions)&&this.gridOptionsWrapper.isDeltaSort(),n=i?this.calculateDirtyNodes(e.rowNodeTransactions):null,s=o._.missingOrEmpty(this.columnModel.getValueColumns()),a=o._.some(t,(function(e){return!!e.column.getColDef().showRowGroup}));this.sortService.sort(t,r,i,n,e.changedPath,s,a)},t.prototype.calculateDirtyNodes=function(e){var t={},o=function(e){e&&e.forEach((function(e){return t[e.id]=!0}))};return e&&e.forEach((function(e){o(e.add),o(e.update),o(e.remove)})),t},u([o.Autowired("sortService")],t.prototype,"sortService",void 0),u([o.Autowired("sortController")],t.prototype,"sortController",void 0),u([o.Autowired("columnModel")],t.prototype,"columnModel",void 0),t=u([o.Bean("sortStage")],t)}(o.BeanStub),f=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),g=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},w=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return f(t,e),t.prototype.execute=function(e){var t=e.rowNode,o=[],r={value:0},i=this.columnModel.isPivotMode(),n=i&&t.leafGroup,s=n?[t]:t.childrenAfterSort;return this.recursivelyAddToRowsToDisplay(s,o,r,i,0),!n&&o.length>0&&this.gridOptionsWrapper.isGroupIncludeTotalFooter()&&(this.ensureFooterNodeExists(t),this.addRowNodeToRowsToDisplay(t.sibling,o,r,0)),o},t.prototype.recursivelyAddToRowsToDisplay=function(e,t,r,i,n){if(!o._.missingOrEmpty(e))for(var s=this.gridOptionsWrapper.isGroupHideOpenParents(),a=this.gridOptionsWrapper.isGroupRemoveSingleChildren(),d=!a&&this.gridOptionsWrapper.isGroupRemoveLowestSingleChildren(),p=0;p<e.length;p++){var l=e[p],h=l.hasChildren(),u=i&&!h,c=a&&h&&1===l.childrenAfterGroup.length,f=d&&h&&l.leafGroup&&1===l.childrenAfterGroup.length,g=i&&l.leafGroup,w=s&&l.expanded&&!g;if(!(u||w||c||f)&&this.addRowNodeToRowsToDisplay(l,t,r,n),!i||!l.leafGroup)if(h){var v=c||f;if(l.expanded||v){var y=v?n:n+1;this.recursivelyAddToRowsToDisplay(l.childrenAfterSort,t,r,i,y),this.gridOptionsWrapper.isGroupIncludeFooter()&&(this.ensureFooterNodeExists(l),this.addRowNodeToRowsToDisplay(l.sibling,t,r,n))}}else if(l.master&&l.expanded){var R=this.createDetailNode(l);this.addRowNodeToRowsToDisplay(R,t,r,n)}}},t.prototype.addRowNodeToRowsToDisplay=function(e,t,o,r){var i=this.gridOptionsWrapper.isGroupMultiAutoColumn();t.push(e),e.setUiLevel(i?0:r)},t.prototype.ensureFooterNodeExists=function(e){if(!o._.exists(e.sibling)){var t=new o.RowNode(this.beans);Object.keys(e).forEach((function(o){t[o]=e[o]})),t.footer=!0,t.setRowTop(null),t.setRowIndex(null),t.oldRowTop=null,o._.exists(t.id)&&(t.id="rowGroupFooter_"+t.id),t.sibling=e,e.sibling=t}},t.prototype.createDetailNode=function(e){if(o._.exists(e.detailNode))return e.detailNode;var t=new o.RowNode(this.beans);return t.detail=!0,t.selectable=!1,t.parent=e,o._.exists(e.id)&&(t.id="detail_"+e.id),t.data=e.data,t.level=e.level+1,e.detailNode=t,t},g([o.Autowired("columnModel")],t.prototype,"columnModel",void 0),g([o.Autowired("beans")],t.prototype,"beans",void 0),t=g([o.Bean("flattenStage")],t)}(o.BeanStub),v=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),y=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},R=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return v(t,e),t.prototype.init=function(){this.postSortFunc=this.gridOptionsWrapper.getPostSortFunc()},t.prototype.sort=function(e,t,o,r,i,n,s){var a=this,d=this.gridOptionsWrapper.isGroupMaintainOrder();i&&i.forEachChangedNodeDepthFirst((function(p){if(a.pullDownGroupDataForHideOpenParents(p.childrenAfterFilter,!0),t){var l=d&&!p.leafGroup&&!s;p.childrenAfterSort=l?p.childrenAfterSort.slice(0):o?a.doDeltaSort(p,e,r,i,n):a.rowNodeSorter.doFullSort(p.childrenAfterFilter,e)}else p.childrenAfterSort=d&&p.childrenAfterSort?p.childrenAfterSort.slice(0):p.childrenAfterFilter.slice(0);a.updateChildIndexes(p),a.postSortFunc&&a.postSortFunc(p.childrenAfterSort)})),this.updateGroupDataForHideOpenParents(i)},t.prototype.mapNodeToSortedNode=function(e,t){return{currentPos:t,rowNode:e}},t.prototype.doDeltaSort=function(e,t,o,r,i){var n=e.childrenAfterSort.filter((function(e){var t=!o[e.id],n=i||r&&r.canSkip(e);return t&&n})).map(this.mapNodeToSortedNode.bind(this)),s={};n.forEach((function(e){return s[e.rowNode.id]=e.rowNode}));var a=e.childrenAfterFilter.filter((function(e){return!s[e.id]})).map(this.mapNodeToSortedNode.bind(this));return a.sort(this.rowNodeSorter.compareRowNodes.bind(this,t)),(0===a.length?n:0===n.length?a:this.mergeSortedArrays(t,n,a)).map((function(e){return e.rowNode}))},t.prototype.mergeSortedArrays=function(e,t,o){for(var r=[],i=0,n=0;i<t.length&&n<o.length;){this.rowNodeSorter.compareRowNodes(e,t[i],o[n])<0?r.push(t[i++]):r.push(o[n++])}for(;i<t.length;)r.push(t[i++]);for(;n<o.length;)r.push(o[n++]);return r},t.prototype.updateChildIndexes=function(e){if(!o._.missing(e.childrenAfterSort))for(var t=e.childrenAfterSort,r=0;r<t.length;r++){var i=t[r],n=0===r,s=r===e.childrenAfterSort.length-1;i.setFirstChild(n),i.setLastChild(s),i.setChildIndex(r)}},t.prototype.updateGroupDataForHideOpenParents=function(e){var t=this;if(this.gridOptionsWrapper.isGroupHideOpenParents()){if(this.gridOptionsWrapper.isTreeData()){return o._.doOnce((function(){return console.warn("AG Grid: 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 (as opposed to Row Grouping, which only has Aggregated Values at the group level).")}),"sortService.hideOpenParentsWithTreeData"),!1}var r=function(e){t.pullDownGroupDataForHideOpenParents(e.childrenAfterSort,!1),e.childrenAfterSort.forEach((function(e){e.hasChildren()&&r(e)}))};e&&e.executeFromRootNode((function(e){return r(e)}))}},t.prototype.pullDownGroupDataForHideOpenParents=function(e,t){var r=this;this.gridOptionsWrapper.isGroupHideOpenParents()&&!o._.missing(e)&&e.forEach((function(e){r.columnModel.getGroupDisplayColumns().forEach((function(o){var i=o.getColDef().showRowGroup;if("string"==typeof i){var n=i,s=r.columnModel.getPrimaryColumn(n);if(!(s===e.rowGroupColumn))if(t)e.setGroupValue(o.getId(),void 0);else{var a=e.getFirstChildOfFirstChild(s);a&&e.setGroupValue(o.getId(),a.key)}}else console.error("AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup")}))}))},y([o.Autowired("columnModel")],t.prototype,"columnModel",void 0),y([o.Autowired("rowNodeSorter")],t.prototype,"rowNodeSorter",void 0),y([o.PostConstruct],t.prototype,"init",null),t=y([o.Bean("sortService")],t)}(o.BeanStub),N=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),A=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},S=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return N(t,e),t.prototype.postConstruct=function(){this.doingTreeData=this.gridOptionsWrapper.isTreeData()},t.prototype.filter=function(e){var t=this.filterManager.isAnyFilterPresent();this.filterNodes(t,e)},t.prototype.filterNodes=function(e,t){var o=this,r=function(t,r){t.hasChildren()?(t.childrenAfterFilter=e&&!r?t.childrenAfterGroup.filter((function(e){var t=e.childrenAfterFilter&&e.childrenAfterFilter.length>0,r=e.data&&o.filterManager.doesRowPassFilter({rowNode:e});return t||r})):t.childrenAfterGroup,o.setAllChildrenCount(t)):(t.childrenAfterFilter=t.childrenAfterGroup,t.setAllChildrenCount(null))};if(this.doingTreeDataFiltering()){var i=function(e,t){if(e.childrenAfterGroup)for(var n=0;n<e.childrenAfterGroup.length;n++){var s=e.childrenAfterGroup[n],a=t||o.filterManager.doesRowPassFilter({rowNode:s});s.childrenAfterGroup?i(e.childrenAfterGroup[n],a):r(s,a)}r(e,t)};t.executeFromRootNode((function(e){return i(e,!1)}))}else{t.forEachChangedNodeDepthFirst((function(e){return r(e,!1)}),!0)}},t.prototype.setAllChildrenCountTreeData=function(e){var t=0;e.childrenAfterFilter.forEach((function(e){t++,t+=e.allChildrenCount})),e.setAllChildrenCount(t)},t.prototype.setAllChildrenCountGridGrouping=function(e){var t=0;e.childrenAfterFilter.forEach((function(e){e.group?t+=e.allChildrenCount:t++})),e.setAllChildrenCount(t)},t.prototype.setAllChildrenCount=function(e){this.doingTreeData?this.setAllChildrenCountTreeData(e):this.setAllChildrenCountGridGrouping(e)},t.prototype.doingTreeDataFiltering=function(){return this.gridOptionsWrapper.isTreeData()&&!this.gridOptionsWrapper.isExcludeChildrenWhenTreeDataFiltering()},A([o.Autowired("filterManager")],t.prototype,"filterManager",void 0),A([o.PostConstruct],t.prototype,"postConstruct",null),t=A([o.Bean("filterService")],t)}(o.BeanStub),O=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),T=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},C=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return O(t,e),t.prototype.postConstruct=function(){this.rowModel.getType()===o.Constants.ROW_MODEL_TYPE_CLIENT_SIDE&&(this.clientSideRowModel=this.rowModel)},t.prototype.createTransactionForRowData=function(e){if(o._.missing(this.clientSideRowModel))console.error("AG Grid: ImmutableService only works with ClientSideRowModel");else{var t=this.gridOptionsWrapper.getRowNodeIdFunc();if(t&&!o._.missing(t)){var r={remove:[],update:[],add:[]},i=this.clientSideRowModel.getCopyOfNodesMap(),n=this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder()?null:{};return o._.exists(e)&&e.forEach((function(e,o){var s=t(e),a=i[s];(n&&(n[s]=o),a)?(a.data!==e&&r.update.push(e),i[s]=void 0):r.add.push(e)})),o._.iterateObject(i,(function(e,t){t&&r.remove.push(t.data)})),[r,n]}console.error("AG Grid: ImmutableService requires getRowNodeId() callback to be implemented, your row data need IDs!")}},T([o.Autowired("rowModel")],t.prototype,"rowModel",void 0),T([o.PostConstruct],t.prototype,"postConstruct",null),t=T([o.Bean("immutableService")],t)}(o.BeanStub),m={moduleName:o.ModuleNames.ClientSideRowModelModule,beans:[l,c,w,R,S,C],rowModels:{clientSide:a}};exports.ClientSideRowModelModule=m;
/**
* @ag-grid-community/client-side-row-model - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0
* @ag-grid-community/client-side-row-model - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0
* @link http://www.ag-grid.com/

@@ -8,6 +8,6 @@ ' * @license MIT

/**
* @ag-grid-community/client-side-row-model - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.0.0
* @ag-grid-community/client-side-row-model - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v26.1.0
* @link http://www.ag-grid.com/
' * @license MIT
*/
import{_ as e,Events as t,RowNode as o,ClientSideRowModelSteps as r,GridOptionsWrapper as i,Constants as n,RowHighlightPosition as s,ChangedPath as a,Autowired as p,Optional as d,PostConstruct as l,Bean as h,BeanStub as c,ModuleNames as u}from"@ag-grid-community/core";var f,g,y=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<o;t++)for(var n=arguments[t],s=0,a=n.length;s<a;s++,i++)r[i]=n[s];return r},w=function(){function r(e,t,o,i,n,s,a,p){this.nextId=0,this.allNodesMap={},this.rootNode=e,this.gridOptionsWrapper=t,this.context=o,this.eventService=i,this.columnModel=n,this.gridApi=s,this.columnApi=a,this.selectionService=p,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id=r.ROOT_NODE_ID,this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterFilter=[],this.postConstruct()}return r.prototype.postConstruct=function(){this.suppressParentsInRowNodes=this.gridOptionsWrapper.isSuppressParentsInRowNodes(),this.isRowMasterFunc=this.gridOptionsWrapper.getIsRowMasterFunc(),this.doingTreeData=this.gridOptionsWrapper.isTreeData(),this.doingMasterDetail=this.gridOptionsWrapper.isMasterDetail()},r.prototype.getCopyOfNodesMap=function(){return e.cloneObject(this.allNodesMap)},r.prototype.getRowNode=function(e){return this.allNodesMap[e]},r.prototype.setRowData=function(e){if(this.rootNode.childrenAfterFilter=null,this.rootNode.childrenAfterGroup=null,this.rootNode.childrenAfterSort=null,this.rootNode.childrenMapped=null,this.rootNode.updateHasChildren(),this.nextId=0,this.allNodesMap={},!e)return this.rootNode.allLeafChildren=[],void(this.rootNode.childrenAfterGroup=[]);this.rootNode.allLeafChildren=this.recursiveFunction(e,this.rootNode,r.TOP_LEVEL)},r.prototype.updateRowData=function(t,o){var r={remove:[],update:[],add:[]},i=[];return this.executeRemove(t,r,i),this.executeUpdate(t,r,i),this.executeAdd(t,r),this.updateSelection(i),o&&e.sortRowNodesByOrder(this.rootNode.allLeafChildren,o),r},r.prototype.updateSelection=function(e){var o=e.length>0;if(o&&e.forEach((function(e){e.setSelected(!1,!1,!0)})),this.selectionService.updateGroupsFromChildrenSelections(),o){var r={type:t.EVENT_SELECTION_CHANGED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(r)}},r.prototype.executeAdd=function(t,o){var i=this,n=t.add,s=t.addIndex;if(!e.missingOrEmpty(n)){var a=n.map((function(e){return i.createNode(e,i.rootNode,r.TOP_LEVEL)}));if("number"==typeof s&&s>=0){var p=this.rootNode.allLeafChildren,d=p.slice(0,s),l=p.slice(s,p.length);this.rootNode.allLeafChildren=y(d,a,l)}else this.rootNode.allLeafChildren=y(this.rootNode.allLeafChildren,a);o.add=a}},r.prototype.executeRemove=function(t,o,r){var i=this,n=t.remove;if(!e.missingOrEmpty(n)){var s={};n.forEach((function(e){var t=i.lookupRowNode(e);t&&(t.isSelected()&&r.push(t),t.clearRowTopAndRowIndex(),s[t.id]=!0,delete i.allNodesMap[t.id],o.remove.push(t))})),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren.filter((function(e){return!s[e.id]}))}},r.prototype.executeUpdate=function(t,o,i){var n=this,s=t.update;e.missingOrEmpty(s)||s.forEach((function(e){var t=n.lookupRowNode(e);t&&(t.updateData(e),!t.selectable&&t.isSelected()&&i.push(t),n.setMasterForRow(t,e,r.TOP_LEVEL,!1),o.update.push(t))}))},r.prototype.lookupRowNode=function(t){var o,r=this.gridOptionsWrapper.getRowNodeIdFunc();if(e.exists(r)){var i=r(t);if(!(o=this.allNodesMap[i]))return console.error("AG Grid: could not find row id="+i+", data item was not found for this id"),null}else if(!(o=e.find(this.rootNode.allLeafChildren,(function(e){return e.data===t}))))return console.error("AG Grid: could not find data item as object was not found",t),console.error("Consider using getRowNodeId to help the Grid find matching row data"),null;return o},r.prototype.recursiveFunction=function(e,t,o){var r=this;if("string"!=typeof e){var i=[];return e.forEach((function(e){var n=r.createNode(e,t,o);i.push(n)})),i}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")},r.prototype.createNode=function(e,t,r){var i=new o;return this.context.createBean(i),i.group=!1,this.setMasterForRow(i,e,r,!0),t&&!this.suppressParentsInRowNodes&&(i.parent=t),i.level=r,i.setDataAndId(e,this.nextId.toString()),this.allNodesMap[i.id]&&console.warn("ag-grid: duplicate node id '"+i.id+"' detected from getRowNodeId callback, this could cause issues in your grid."),this.allNodesMap[i.id]=i,this.nextId++,i},r.prototype.setMasterForRow=function(e,t,o,r){if(this.doingTreeData)e.setMaster(!1),r&&(e.expanded=!1);else if(this.doingMasterDetail?this.isRowMasterFunc?e.setMaster(this.isRowMasterFunc(t)):e.setMaster(!0):e.setMaster(!1),r){var i=this.columnModel.getRowGroupColumns(),n=o+(i?i.length:0);e.expanded=!!e.master&&this.isExpanded(n)}},r.prototype.isExpanded=function(e){var t=this.gridOptionsWrapper.getGroupDefaultExpanded();return-1===t||e<t},r.TOP_LEVEL=0,r.ROOT_NODE_ID="ROOT_NODE_ID",r}(),v=(f=function(e,t){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)},function(e,t){function o(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),N=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s};!function(e){e[e.Normal=0]="Normal",e[e.AfterFilter=1]="AfterFilter",e[e.AfterFilterAndSort=2]="AfterFilterAndSort",e[e.PivotNodes=3]="PivotNodes"}(g||(g={}));var R=function(c){function u(){return null!==c&&c.apply(this,arguments)||this}return v(u,c),u.prototype.init=function(){var e=this.refreshModel.bind(this,{step:r.EVERYTHING}),n=this.refreshModel.bind(this,{step:r.EVERYTHING,afterColumnsChanged:!0,keepRenderedRows:!0,animate:!0});this.addManagedListener(this.eventService,t.EVENT_NEW_COLUMNS_LOADED,n),this.addManagedListener(this.eventService,t.EVENT_COLUMN_ROW_GROUP_CHANGED,e),this.addManagedListener(this.eventService,t.EVENT_COLUMN_VALUE_CHANGED,this.onValueChanged.bind(this)),this.addManagedListener(this.eventService,t.EVENT_COLUMN_PIVOT_CHANGED,this.refreshModel.bind(this,{step:r.PIVOT})),this.addManagedListener(this.eventService,t.EVENT_FILTER_CHANGED,this.onFilterChanged.bind(this)),this.addManagedListener(this.eventService,t.EVENT_SORT_CHANGED,this.onSortChanged.bind(this)),this.addManagedListener(this.eventService,t.EVENT_COLUMN_PIVOT_MODE_CHANGED,e);var s=this.refreshModel.bind(this,{step:r.MAP,keepRenderedRows:!0,animate:!0});this.addManagedListener(this.gridOptionsWrapper,i.PROP_GROUP_REMOVE_SINGLE_CHILDREN,s),this.addManagedListener(this.gridOptionsWrapper,i.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN,s),this.rootNode=new o,this.nodeManager=new w(this.rootNode,this.gridOptionsWrapper,this.getContext(),this.eventService,this.columnModel,this.gridApi,this.columnApi,this.selectionService),this.createBean(this.rootNode)},u.prototype.start=function(){var e=this.gridOptionsWrapper.getRowData();e&&this.setRowData(e)},u.prototype.ensureRowHeightsValid=function(e,t,o,r){var i,n=!1;do{i=!1;for(var s=this.getRowIndexAtPixel(e),a=this.getRowIndexAtPixel(t),p=Math.max(s,o),d=Math.min(a,r),l=p;l<=d;l++){var h=this.getRow(l);if(h.rowHeightEstimated){var c=this.gridOptionsWrapper.getRowHeightForNode(h);h.setRowHeight(c.height),i=!0,n=!0}}i&&this.setRowTopAndRowIndex()}while(i);return n},u.prototype.setRowTopAndRowIndex=function(){for(var t=0,o=0;o<this.rowsToDisplay.length;o++){var r=this.gridOptionsWrapper.getDomLayout()===n.DOM_LAYOUT_NORMAL,i=this.rowsToDisplay[o];if(e.missing(i.rowHeight)){var s=this.gridOptionsWrapper.getRowHeightForNode(i,r);i.setRowHeight(s.height,s.estimated)}i.setRowTop(t),i.setRowIndex(o),t+=i.rowHeight}},u.prototype.clearRowTopAndRowIndex=function(e){var t={};this.rowsToDisplay.forEach((function(e){null!=e.id&&(t[e.id]=e)}));var o=function(e){e&&null!=e.id&&null==t[e.id]&&e.clearRowTopAndRowIndex()},r=function(t){if(o(t),o(t.detailNode),o(t.sibling),t.hasChildren()&&t.childrenAfterGroup){var i=-1==t.level;e.isActive()&&!i&&!t.expanded||t.childrenAfterGroup.forEach(r)}};r(this.rootNode)},u.prototype.ensureRowsAtPixel=function(t,o,i){var n=this;void 0===i&&(i=0);var s=this.getRowIndexAtPixel(o);return this.getRow(s)!==t[0]&&(t.forEach((function(t){e.removeFromArray(n.rootNode.allLeafChildren,t)})),t.forEach((function(t,o){e.insertIntoArray(n.rootNode.allLeafChildren,t,Math.max(s+i,0)+o)})),this.refreshModel({step:r.EVERYTHING,keepRenderedRows:!0,animate:!0,keepEditingRows:!0}),!0)},u.prototype.highlightRowAtPixel=function(e,t){var o=null!=t?this.getRowIndexAtPixel(t):null,r=null!=o?this.getRow(o):null;if(r&&e&&r!==e&&null!=t){var i=this.getHighlightPosition(t,r);this.lastHighlightedRow&&this.lastHighlightedRow!==r&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null),r.setHighlighted(i),this.lastHighlightedRow=r}else this.lastHighlightedRow&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null)},u.prototype.getHighlightPosition=function(e,t){if(!t){var o=this.getRowIndexAtPixel(e);if(!(t=this.getRow(o||0)))return s.Below}return e-t.rowTop<t.rowHeight/2?s.Above:s.Below},u.prototype.getLastHighlightedRowNode=function(){return this.lastHighlightedRow},u.prototype.isLastRowIndexKnown=function(){return!0},u.prototype.getRowCount=function(){return this.rowsToDisplay?this.rowsToDisplay.length:0},u.prototype.getTopLevelRowCount=function(){return this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode?1:this.rootNode.childrenAfterFilter?this.rootNode.childrenAfterFilter.length:0},u.prototype.getTopLevelRowDisplayedIndex=function(e){if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return e;var t=this.rootNode.childrenAfterSort[e];if(this.gridOptionsWrapper.isGroupHideOpenParents())for(;t.expanded&&t.childrenAfterSort&&t.childrenAfterSort.length>0;)t=t.childrenAfterSort[0];return t.rowIndex},u.prototype.getRowBounds=function(t){if(e.missing(this.rowsToDisplay))return null;var o=this.rowsToDisplay[t];return o?{rowTop:o.rowTop,rowHeight:o.rowHeight}:null},u.prototype.onRowGroupOpened=function(){var e=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:r.MAP,keepRenderedRows:!0,animate:e})},u.prototype.onFilterChanged=function(e){if(!e.afterDataChange){var t=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:r.FILTER,keepRenderedRows:!0,animate:t})}},u.prototype.onSortChanged=function(){var e=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:r.SORT,keepRenderedRows:!0,animate:e,keepEditingRows:!0})},u.prototype.getType=function(){return n.ROW_MODEL_TYPE_CLIENT_SIDE},u.prototype.onValueChanged=function(){this.columnModel.isPivotActive()?this.refreshModel({step:r.PIVOT}):this.refreshModel({step:r.AGGREGATE})},u.prototype.createChangePath=function(t){var o=e.missingOrEmpty(t),r=new a(!1,this.rootNode);return(o||this.gridOptionsWrapper.isTreeData())&&r.setInactive(),r},u.prototype.isSuppressModelUpdateAfterUpdateTransaction=function(t){if(!this.gridOptionsWrapper.isSuppressModelUpdateAfterUpdateTransaction())return!1;if(null==t.rowNodeTransactions)return!1;var o=e.filter(t.rowNodeTransactions,(function(e){return null!=e.add&&e.add.length>0||null!=e.remove&&e.remove.length>0}));return null==o||0==o.length},u.prototype.refreshModel=function(e){var o=this;if(!this.isSuppressModelUpdateAfterUpdateTransaction(e)){var i=this.createChangePath(e.rowNodeTransactions);switch(e.step){case r.EVERYTHING:this.doRowGrouping(e.groupState,e.rowNodeTransactions,e.rowNodeOrder,i,!!e.afterColumnsChanged);case r.FILTER:this.doFilter(i);case r.PIVOT:this.doPivot(i);case r.AGGREGATE:this.doAggregate(i);case r.SORT:this.doSort(e.rowNodeTransactions,i);case r.MAP:this.doRowsToDisplay()}this.setRowTopAndRowIndex(),this.clearRowTopAndRowIndex(i);var n={type:t.EVENT_MODEL_UPDATED,api:this.gridApi,columnApi:this.columnApi,animate:e.animate,keepRenderedRows:e.keepRenderedRows,newData:e.newData,newPage:!1};this.eventService.dispatchEvent(n),this.$scope&&window.setTimeout((function(){o.$scope.$apply()}),0)}},u.prototype.isEmpty=function(){var t=e.missing(this.rootNode.allLeafChildren)||0===this.rootNode.allLeafChildren.length;return e.missing(this.rootNode)||t||!this.columnModel.isReady()},u.prototype.isRowsToRender=function(){return e.exists(this.rowsToDisplay)&&this.rowsToDisplay.length>0},u.prototype.getNodesInRangeForSelection=function(e,t){var o,r=!t,i=!1,n=[],s=this.gridOptionsWrapper.isGroupSelectsChildren();return this.forEachNodeAfterFilterAndSort((function(a){var p=r&&!i;if(r||a!==t&&a!==e||(r=!0),!(a.group&&s)){var d=r&&!i,l=a.isParentOfNode(o);(d||l)&&n.push(a)}p&&(a!==t&&a!==e||(i=!0,o=a===t?t:e))})),n},u.prototype.setDatasource=function(e){console.error("AG Grid: should never call setDatasource on clientSideRowController")},u.prototype.getTopLevelNodes=function(){return this.rootNode?this.rootNode.childrenAfterGroup:null},u.prototype.getRootNode=function(){return this.rootNode},u.prototype.getRow=function(e){return this.rowsToDisplay[e]},u.prototype.isRowPresent=function(e){return this.rowsToDisplay.indexOf(e)>=0},u.prototype.getRowIndexAtPixel=function(t){if(this.isEmpty())return-1;var o=0,r=this.rowsToDisplay.length-1;if(t<=0)return 0;if(e.last(this.rowsToDisplay).rowTop<=t)return this.rowsToDisplay.length-1;for(;;){var i=Math.floor((o+r)/2),n=this.rowsToDisplay[i];if(this.isRowInPixel(n,t))return i;n.rowTop<t?o=i+1:n.rowTop>t&&(r=i-1)}},u.prototype.isRowInPixel=function(e,t){var o=e.rowTop,r=e.rowTop+e.rowHeight;return o<=t&&r>t},u.prototype.forEachLeafNode=function(e){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach((function(t,o){return e(t,o)}))},u.prototype.forEachNode=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterGroup,e,g.Normal,0)},u.prototype.forEachNodeAfterFilter=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterFilter,e,g.AfterFilter,0)},u.prototype.forEachNodeAfterFilterAndSort=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterSort,e,g.AfterFilterAndSort,0)},u.prototype.forEachPivotNode=function(e){this.recursivelyWalkNodesAndCallback([this.rootNode],e,g.PivotNodes,0)},u.prototype.recursivelyWalkNodesAndCallback=function(e,t,o,r){if(!e)return r;for(var i=0;i<e.length;i++){var n=e[i];if(t(n,r++),n.hasChildren()){var s=null;switch(o){case g.Normal:s=n.childrenAfterGroup;break;case g.AfterFilter:s=n.childrenAfterFilter;break;case g.AfterFilterAndSort:s=n.childrenAfterSort;break;case g.PivotNodes:s=n.leafGroup?null:n.childrenAfterSort}s&&(r=this.recursivelyWalkNodesAndCallback(s,t,o,r))}}return r},u.prototype.doAggregate=function(e){this.aggregationStage&&this.aggregationStage.execute({rowNode:this.rootNode,changedPath:e})},u.prototype.expandOrCollapseAll=function(o){var i=this.gridOptionsWrapper.isTreeData();this.rootNode&&function t(r){if(!r)return;r.forEach((function(r){(i?e.exists(r.childrenAfterGroup):r.group)&&(r.expanded=o,t(r.childrenAfterGroup))}))}(this.rootNode.childrenAfterGroup),this.refreshModel({step:r.MAP});var n=o?"expandAll":"collapseAll",s={api:this.gridApi,columnApi:this.columnApi,type:t.EVENT_EXPAND_COLLAPSE_ALL,source:n};this.eventService.dispatchEvent(s)},u.prototype.doSort=function(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})},u.prototype.doRowGrouping=function(e,t,o,r,i){this.groupStage?(t?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:t,rowNodeOrder:o,changedPath:r}):(this.selectionService.removeGroupsFromSelection(),this.groupStage.execute({rowNode:this.rootNode,changedPath:r,afterColumnsChanged:i}),this.restoreGroupState(e)),this.gridOptionsWrapper.isGroupSelectsChildren()&&this.selectionService.updateGroupsFromChildrenSelections(r)):(this.rootNode.childrenAfterGroup=this.rootNode.allLeafChildren,this.rootNode.updateHasChildren())},u.prototype.restoreGroupState=function(t){t&&e.traverseNodesWithKey(this.rootNode.childrenAfterGroup,(function(e,o){"boolean"==typeof t[o]&&(e.expanded=t[o])}))},u.prototype.doFilter=function(e){this.filterStage.execute({rowNode:this.rootNode,changedPath:e})},u.prototype.doPivot=function(e){this.pivotStage&&this.pivotStage.execute({rowNode:this.rootNode,changedPath:e})},u.prototype.getGroupState=function(){if(!this.rootNode.childrenAfterGroup||!this.gridOptionsWrapper.isRememberGroupStateWhenNewData())return null;var t={};return e.traverseNodesWithKey(this.rootNode.childrenAfterGroup,(function(e,o){return t[o]=e.expanded})),t},u.prototype.getCopyOfNodesMap=function(){return this.nodeManager.getCopyOfNodesMap()},u.prototype.getRowNode=function(e){if("string"==typeof e&&0==e.indexOf(o.ID_PREFIX_ROW_GROUP)){var t=void 0;return this.forEachNode((function(o){o.id===e&&(t=o)})),t}return this.nodeManager.getRowNode(e)},u.prototype.setRowData=function(e){var o=this.getGroupState();this.nodeManager.setRowData(e);var i={type:t.EVENT_ROW_DATA_CHANGED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(i),this.refreshModel({step:r.EVERYTHING,groupState:o,newData:!0})},u.prototype.batchUpdateRowData=function(e,t){var o=this;if(null==this.applyAsyncTransactionsTimeout){this.rowDataTransactionBatch=[];var r=this.gridOptionsWrapper.getAsyncTransactionWaitMillis();this.applyAsyncTransactionsTimeout=window.setTimeout((function(){o.executeBatchUpdateRowData()}),r)}this.rowDataTransactionBatch.push({rowDataTransaction:e,callback:t})},u.prototype.flushAsyncTransactions=function(){null!=this.applyAsyncTransactionsTimeout&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())},u.prototype.executeBatchUpdateRowData=function(){var e=this;this.valueCache.onDataChanged();var o=[],r=[],i=!1;if(this.rowDataTransactionBatch&&this.rowDataTransactionBatch.forEach((function(t){var n=e.nodeManager.updateRowData(t.rowDataTransaction,void 0);r.push(n),t.callback&&o.push(t.callback.bind(null,n)),"number"==typeof t.rowDataTransaction.addIndex&&(i=!0)})),this.commonUpdateRowData(r,void 0,i),o.length>0&&window.setTimeout((function(){o.forEach((function(e){return e()}))}),0),r.length>0){var n={api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),type:t.EVENT_ASYNC_TRANSACTIONS_FLUSHED,results:r};this.eventService.dispatchEvent(n)}this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0},u.prototype.updateRowData=function(e,t){this.valueCache.onDataChanged();var o=this.nodeManager.updateRowData(e,t),r="number"==typeof e.addIndex;return this.commonUpdateRowData([o],t,r),o},u.prototype.createRowNodeOrder=function(){if(!this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder()){var e={};if(this.rootNode&&this.rootNode.allLeafChildren)for(var t=0;t<this.rootNode.allLeafChildren.length;t++){e[this.rootNode.allLeafChildren[t].id]=t}return e}},u.prototype.commonUpdateRowData=function(e,o,i){i&&(o=this.createRowNodeOrder()),this.refreshModel({step:r.EVERYTHING,rowNodeTransactions:e,rowNodeOrder:o,keepRenderedRows:!0,animate:!0,keepEditingRows:!0});var n={type:t.EVENT_ROW_DATA_UPDATED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(n)},u.prototype.doRowsToDisplay=function(){this.rowsToDisplay=this.flattenStage.execute({rowNode:this.rootNode})},u.prototype.onRowHeightChanged=function(){this.refreshModel({step:r.MAP,keepRenderedRows:!0,keepEditingRows:!0})},u.prototype.resetRowHeights=function(){var e=!1;this.forEachNode((function(t){t.setRowHeight(t.rowHeight,!0);var o=t.detailNode;o&&o.setRowHeight(o.rowHeight,!0),e=!0})),e&&this.onRowHeightChanged()},N([p("columnModel")],u.prototype,"columnModel",void 0),N([p("$scope")],u.prototype,"$scope",void 0),N([p("selectionService")],u.prototype,"selectionService",void 0),N([p("valueCache")],u.prototype,"valueCache",void 0),N([p("columnApi")],u.prototype,"columnApi",void 0),N([p("gridApi")],u.prototype,"gridApi",void 0),N([p("animationFrameService")],u.prototype,"animationFrameService",void 0),N([p("filterStage")],u.prototype,"filterStage",void 0),N([p("sortStage")],u.prototype,"sortStage",void 0),N([p("flattenStage")],u.prototype,"flattenStage",void 0),N([d("groupStage")],u.prototype,"groupStage",void 0),N([d("aggregationStage")],u.prototype,"aggregationStage",void 0),N([d("pivotStage")],u.prototype,"pivotStage",void 0),N([l],u.prototype,"init",null),u=N([h("rowModel")],u)}(c),A=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),O=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},T=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.execute=function(e){var t=e.rowNode,o=e.changedPath;this.filterService.filter(o),this.selectableService.updateSelectableAfterFiltering(t)},O([p("selectableService")],t.prototype,"selectableService",void 0),O([p("filterService")],t.prototype,"filterService",void 0),t=O([h("filterStage")],t)}(c),S=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),m=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},D=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return S(o,t),o.prototype.execute=function(t){var o=this.sortController.getSortOptions(),r=e.exists(o)&&o.length>0,i=r&&e.exists(t.rowNodeTransactions)&&this.gridOptionsWrapper.isDeltaSort(),n=i?this.calculateDirtyNodes(t.rowNodeTransactions):null,s=e.missingOrEmpty(this.columnModel.getValueColumns()),a=e.some(o,(function(e){return!!e.column.getColDef().showRowGroup}));this.sortService.sort(o,r,i,n,t.changedPath,s,a)},o.prototype.calculateDirtyNodes=function(e){var t={},o=function(e){e&&e.forEach((function(e){return t[e.id]=!0}))};return e&&e.forEach((function(e){o(e.add),o(e.update),o(e.remove)})),t},m([p("sortService")],o.prototype,"sortService",void 0),m([p("sortController")],o.prototype,"sortController",void 0),m([p("columnModel")],o.prototype,"columnModel",void 0),o=m([h("sortStage")],o)}(c),E=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),C=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},_=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return E(r,t),r.prototype.execute=function(e){var t=e.rowNode,o=[],r={value:0},i=this.columnModel.isPivotMode(),n=i&&t.leafGroup,s=n?[t]:t.childrenAfterSort;return this.recursivelyAddToRowsToDisplay(s,o,r,i,0),!n&&o.length>0&&this.gridOptionsWrapper.isGroupIncludeTotalFooter()&&(this.ensureFooterNodeExists(t),this.addRowNodeToRowsToDisplay(t.sibling,o,r,0)),o},r.prototype.recursivelyAddToRowsToDisplay=function(t,o,r,i,n){if(!e.missingOrEmpty(t))for(var s=this.gridOptionsWrapper.isGroupHideOpenParents(),a=this.gridOptionsWrapper.isGroupRemoveSingleChildren(),p=!a&&this.gridOptionsWrapper.isGroupRemoveLowestSingleChildren(),d=0;d<t.length;d++){var l=t[d],h=l.hasChildren(),c=i&&!h,u=a&&h&&1===l.childrenAfterGroup.length,f=p&&h&&l.leafGroup&&1===l.childrenAfterGroup.length,g=i&&l.leafGroup,y=s&&l.expanded&&!g;if(!(c||y||u||f)&&this.addRowNodeToRowsToDisplay(l,o,r,n),!i||!l.leafGroup)if(h){var w=u||f;if(l.expanded||w){var v=w?n:n+1;this.recursivelyAddToRowsToDisplay(l.childrenAfterSort,o,r,i,v),this.gridOptionsWrapper.isGroupIncludeFooter()&&(this.ensureFooterNodeExists(l),this.addRowNodeToRowsToDisplay(l.sibling,o,r,n))}}else if(l.master&&l.expanded){var N=this.createDetailNode(l);this.addRowNodeToRowsToDisplay(N,o,r,n)}}},r.prototype.addRowNodeToRowsToDisplay=function(e,t,o,r){var i=this.gridOptionsWrapper.isGroupMultiAutoColumn();t.push(e),e.setUiLevel(i?0:r)},r.prototype.ensureFooterNodeExists=function(t){if(!e.exists(t.sibling)){var r=new o;this.context.createBean(r),Object.keys(t).forEach((function(e){r[e]=t[e]})),r.footer=!0,r.setRowTop(null),r.setRowIndex(null),r.oldRowTop=null,e.exists(r.id)&&(r.id="rowGroupFooter_"+r.id),r.sibling=t,t.sibling=r}},r.prototype.createDetailNode=function(t){if(e.exists(t.detailNode))return t.detailNode;var r=new o;return this.context.createBean(r),r.detail=!0,r.selectable=!1,r.parent=t,e.exists(t.id)&&(r.id="detail_"+t.id),r.data=t.data,r.level=t.level+1,t.detailNode=r,r},C([p("columnModel")],r.prototype,"columnModel",void 0),r=C([h("flattenStage")],r)}(c),M=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),G=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},P=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return M(o,t),o.prototype.init=function(){this.postSortFunc=this.gridOptionsWrapper.getPostSortFunc()},o.prototype.sort=function(e,t,o,r,i,n,s){var a=this,p=this.gridOptionsWrapper.isGroupMaintainOrder();i&&i.forEachChangedNodeDepthFirst((function(d){if(a.pullDownGroupDataForHideOpenParents(d.childrenAfterFilter,!0),t){var l=p&&!d.leafGroup&&!s;d.childrenAfterSort=l?d.childrenAfterSort.slice(0):o?a.doDeltaSort(d,e,r,i,n):a.rowNodeSorter.doFullSort(d.childrenAfterFilter,e)}else d.childrenAfterSort=p&&d.childrenAfterSort?d.childrenAfterSort.slice(0):d.childrenAfterFilter.slice(0);a.updateChildIndexes(d),a.postSortFunc&&a.postSortFunc(d.childrenAfterSort)})),this.updateGroupDataForHideOpenParents(i)},o.prototype.mapNodeToSortedNode=function(e,t){return{currentPos:t,rowNode:e}},o.prototype.doDeltaSort=function(e,t,o,r,i){var n=e.childrenAfterSort.filter((function(e){var t=!o[e.id],n=i||r&&r.canSkip(e);return t&&n})).map(this.mapNodeToSortedNode.bind(this)),s={};n.forEach((function(e){return s[e.rowNode.id]=e.rowNode}));var a=e.childrenAfterFilter.filter((function(e){return!s[e.id]})).map(this.mapNodeToSortedNode.bind(this));return a.sort(this.rowNodeSorter.compareRowNodes.bind(this,t)),(0===a.length?n:0===n.length?a:this.mergeSortedArrays(t,n,a)).map((function(e){return e.rowNode}))},o.prototype.mergeSortedArrays=function(e,t,o){for(var r=[],i=0,n=0;i<t.length&&n<o.length;){this.rowNodeSorter.compareRowNodes(e,t[i],o[n])<0?r.push(t[i++]):r.push(o[n++])}for(;i<t.length;)r.push(t[i++]);for(;n<o.length;)r.push(o[n++]);return r},o.prototype.updateChildIndexes=function(t){if(!e.missing(t.childrenAfterSort))for(var o=t.childrenAfterSort,r=0;r<o.length;r++){var i=o[r],n=0===r,s=r===t.childrenAfterSort.length-1;i.setFirstChild(n),i.setLastChild(s),i.setChildIndex(r)}},o.prototype.updateGroupDataForHideOpenParents=function(t){var o=this;if(this.gridOptionsWrapper.isGroupHideOpenParents()){if(this.gridOptionsWrapper.isTreeData()){return e.doOnce((function(){return console.warn("AG Grid: 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 (as opposed to Row Grouping, which only has Aggregated Values at the group level).")}),"sortService.hideOpenParentsWithTreeData"),!1}var r=function(e){o.pullDownGroupDataForHideOpenParents(e.childrenAfterSort,!1),e.childrenAfterSort.forEach((function(e){e.hasChildren()&&r(e)}))};t&&t.executeFromRootNode((function(e){return r(e)}))}},o.prototype.pullDownGroupDataForHideOpenParents=function(t,o){var r=this;this.gridOptionsWrapper.isGroupHideOpenParents()&&!e.missing(t)&&t.forEach((function(e){r.columnModel.getGroupDisplayColumns().forEach((function(t){var i=t.getColDef().showRowGroup;if("string"==typeof i){var n=i,s=r.columnModel.getPrimaryColumn(n);if(!(s===e.rowGroupColumn))if(o)e.setGroupValue(t.getId(),void 0);else{var a=e.getFirstChildOfFirstChild(s);a&&e.setGroupValue(t.getId(),a.key)}}else console.error("AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup")}))}))},G([p("columnModel")],o.prototype,"columnModel",void 0),G([p("rowNodeSorter")],o.prototype,"rowNodeSorter",void 0),G([l],o.prototype,"init",null),o=G([h("sortService")],o)}(c),x=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),b=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},F=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return x(t,e),t.prototype.postConstruct=function(){this.doingTreeData=this.gridOptionsWrapper.isTreeData()},t.prototype.filter=function(e){var t=this.filterManager.isAnyFilterPresent();this.filterNodes(t,e)},t.prototype.filterNodes=function(e,t){var o=this,r=function(t,r){t.hasChildren()?(t.childrenAfterFilter=e&&!r?t.childrenAfterGroup.filter((function(e){var t=e.childrenAfterFilter&&e.childrenAfterFilter.length>0,r=e.data&&o.filterManager.doesRowPassFilter({rowNode:e});return t||r})):t.childrenAfterGroup,o.setAllChildrenCount(t)):(t.childrenAfterFilter=t.childrenAfterGroup,t.setAllChildrenCount(null))};if(this.doingTreeDataFiltering()){var i=function(e,t){if(e.childrenAfterGroup)for(var n=0;n<e.childrenAfterGroup.length;n++){var s=e.childrenAfterGroup[n],a=t||o.filterManager.doesRowPassFilter({rowNode:s});s.childrenAfterGroup?i(e.childrenAfterGroup[n],a):r(s,a)}r(e,t)};t.executeFromRootNode((function(e){return i(e,!1)}))}else{t.forEachChangedNodeDepthFirst((function(e){return r(e,!1)}),!0)}},t.prototype.setAllChildrenCountTreeData=function(e){var t=0;e.childrenAfterFilter.forEach((function(e){t++,t+=e.allChildrenCount})),e.setAllChildrenCount(t)},t.prototype.setAllChildrenCountGridGrouping=function(e){var t=0;e.childrenAfterFilter.forEach((function(e){e.group?t+=e.allChildrenCount:t++})),e.setAllChildrenCount(t)},t.prototype.setAllChildrenCount=function(e){this.doingTreeData?this.setAllChildrenCountTreeData(e):this.setAllChildrenCountGridGrouping(e)},t.prototype.doingTreeDataFiltering=function(){return this.gridOptionsWrapper.isTreeData()&&!this.gridOptionsWrapper.isExcludeChildrenWhenTreeDataFiltering()},b([p("filterManager")],t.prototype,"filterManager",void 0),b([l],t.prototype,"postConstruct",null),t=b([h("filterService")],t)}(c),I=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),L=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},W=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return I(o,t),o.prototype.postConstruct=function(){this.rowModel.getType()===n.ROW_MODEL_TYPE_CLIENT_SIDE&&(this.clientSideRowModel=this.rowModel)},o.prototype.createTransactionForRowData=function(t){if(e.missing(this.clientSideRowModel))console.error("AG Grid: ImmutableService only works with ClientSideRowModel");else{var o=this.gridOptionsWrapper.getRowNodeIdFunc();if(o&&!e.missing(o)){var r={remove:[],update:[],add:[]},i=this.clientSideRowModel.getCopyOfNodesMap(),n=this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder()?null:{};return e.exists(t)&&t.forEach((function(e,t){var s=o(e),a=i[s];(n&&(n[s]=t),a)?(a.data!==e&&r.update.push(e),i[s]=void 0):r.add.push(e)})),e.iterateObject(i,(function(e,t){t&&r.remove.push(t.data)})),[r,n]}console.error("AG Grid: ImmutableService requires getRowNodeId() callback to be implemented, your row data need IDs!")}},L([p("rowModel")],o.prototype,"rowModel",void 0),L([l],o.prototype,"postConstruct",null),o=L([h("immutableService")],o)}(c),H={moduleName:u.ClientSideRowModelModule,beans:[T,D,_,P,F,W],rowModels:{clientSide:R}};export{H as ClientSideRowModelModule};
import{_ as e,Events as t,RowNode as o,ClientSideRowModelSteps as r,GridOptionsWrapper as i,Constants as n,RowHighlightPosition as s,ChangedPath as a,Autowired as p,Optional as d,PostConstruct as l,Bean as h,BeanStub as c,ModuleNames as u}from"@ag-grid-community/core";var f,g,y=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<o;t++)for(var n=arguments[t],s=0,a=n.length;s<a;s++,i++)r[i]=n[s];return r},w=function(){function r(e,t,o,i,n,s,a,p){this.nextId=0,this.allNodesMap={},this.rootNode=e,this.gridOptionsWrapper=t,this.eventService=o,this.columnModel=i,this.gridApi=n,this.columnApi=s,this.beans=p,this.selectionService=a,this.rootNode.group=!0,this.rootNode.level=-1,this.rootNode.id=r.ROOT_NODE_ID,this.rootNode.allLeafChildren=[],this.rootNode.childrenAfterGroup=[],this.rootNode.childrenAfterSort=[],this.rootNode.childrenAfterFilter=[],this.postConstruct()}return r.prototype.postConstruct=function(){this.suppressParentsInRowNodes=this.gridOptionsWrapper.isSuppressParentsInRowNodes(),this.isRowMasterFunc=this.gridOptionsWrapper.getIsRowMasterFunc(),this.doingTreeData=this.gridOptionsWrapper.isTreeData(),this.doingMasterDetail=this.gridOptionsWrapper.isMasterDetail()},r.prototype.getCopyOfNodesMap=function(){return e.cloneObject(this.allNodesMap)},r.prototype.getRowNode=function(e){return this.allNodesMap[e]},r.prototype.setRowData=function(e){if(this.rootNode.childrenAfterFilter=null,this.rootNode.childrenAfterGroup=null,this.rootNode.childrenAfterSort=null,this.rootNode.childrenMapped=null,this.rootNode.updateHasChildren(),this.nextId=0,this.allNodesMap={},!e)return this.rootNode.allLeafChildren=[],void(this.rootNode.childrenAfterGroup=[]);this.rootNode.allLeafChildren=this.recursiveFunction(e,this.rootNode,r.TOP_LEVEL)},r.prototype.updateRowData=function(t,o){var r={remove:[],update:[],add:[]},i=[];return this.executeRemove(t,r,i),this.executeUpdate(t,r,i),this.executeAdd(t,r),this.updateSelection(i),o&&e.sortRowNodesByOrder(this.rootNode.allLeafChildren,o),r},r.prototype.updateSelection=function(e){var o=e.length>0;if(o&&e.forEach((function(e){e.setSelected(!1,!1,!0)})),this.selectionService.updateGroupsFromChildrenSelections(),o){var r={type:t.EVENT_SELECTION_CHANGED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(r)}},r.prototype.executeAdd=function(t,o){var i=this,n=t.add,s=t.addIndex;if(!e.missingOrEmpty(n)){var a=n.map((function(e){return i.createNode(e,i.rootNode,r.TOP_LEVEL)}));if("number"==typeof s&&s>=0){var p=this.rootNode.allLeafChildren,d=p.slice(0,s),l=p.slice(s,p.length);this.rootNode.allLeafChildren=y(d,a,l)}else this.rootNode.allLeafChildren=y(this.rootNode.allLeafChildren,a);o.add=a}},r.prototype.executeRemove=function(t,o,r){var i=this,n=t.remove;if(!e.missingOrEmpty(n)){var s={};n.forEach((function(e){var t=i.lookupRowNode(e);t&&(t.isSelected()&&r.push(t),t.clearRowTopAndRowIndex(),s[t.id]=!0,delete i.allNodesMap[t.id],o.remove.push(t))})),this.rootNode.allLeafChildren=this.rootNode.allLeafChildren.filter((function(e){return!s[e.id]}))}},r.prototype.executeUpdate=function(t,o,i){var n=this,s=t.update;e.missingOrEmpty(s)||s.forEach((function(e){var t=n.lookupRowNode(e);t&&(t.updateData(e),!t.selectable&&t.isSelected()&&i.push(t),n.setMasterForRow(t,e,r.TOP_LEVEL,!1),o.update.push(t))}))},r.prototype.lookupRowNode=function(t){var o,r=this.gridOptionsWrapper.getRowNodeIdFunc();if(e.exists(r)){var i=r(t);if(!(o=this.allNodesMap[i]))return console.error("AG Grid: could not find row id="+i+", data item was not found for this id"),null}else if(!(o=e.find(this.rootNode.allLeafChildren,(function(e){return e.data===t}))))return console.error("AG Grid: could not find data item as object was not found",t),console.error("Consider using getRowNodeId to help the Grid find matching row data"),null;return o},r.prototype.recursiveFunction=function(e,t,o){var r=this;if("string"!=typeof e){var i=[];return e.forEach((function(e){var n=r.createNode(e,t,o);i.push(n)})),i}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")},r.prototype.createNode=function(e,t,r){var i=new o(this.beans);return i.group=!1,this.setMasterForRow(i,e,r,!0),t&&!this.suppressParentsInRowNodes&&(i.parent=t),i.level=r,i.setDataAndId(e,this.nextId.toString()),this.allNodesMap[i.id]&&console.warn("ag-grid: duplicate node id '"+i.id+"' detected from getRowNodeId callback, this could cause issues in your grid."),this.allNodesMap[i.id]=i,this.nextId++,i},r.prototype.setMasterForRow=function(e,t,o,r){if(this.doingTreeData)e.setMaster(!1),r&&(e.expanded=!1);else if(this.doingMasterDetail?this.isRowMasterFunc?e.setMaster(this.isRowMasterFunc(t)):e.setMaster(!0):e.setMaster(!1),r){var i=this.columnModel.getRowGroupColumns(),n=o+(i?i.length:0);e.expanded=!!e.master&&this.isExpanded(n)}},r.prototype.isExpanded=function(e){var t=this.gridOptionsWrapper.getGroupDefaultExpanded();return-1===t||e<t},r.TOP_LEVEL=0,r.ROOT_NODE_ID="ROOT_NODE_ID",r}(),v=(f=function(e,t){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(e,t)},function(e,t){function o(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}),N=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s};!function(e){e[e.Normal=0]="Normal",e[e.AfterFilter=1]="AfterFilter",e[e.AfterFilterAndSort=2]="AfterFilterAndSort",e[e.PivotNodes=3]="PivotNodes"}(g||(g={}));var R=function(c){function u(){return null!==c&&c.apply(this,arguments)||this}return v(u,c),u.prototype.init=function(){var e=this.refreshModel.bind(this,{step:r.EVERYTHING}),n=this.refreshModel.bind(this,{step:r.EVERYTHING,afterColumnsChanged:!0,keepRenderedRows:!0,animate:!0});this.addManagedListener(this.eventService,t.EVENT_NEW_COLUMNS_LOADED,n),this.addManagedListener(this.eventService,t.EVENT_COLUMN_ROW_GROUP_CHANGED,e),this.addManagedListener(this.eventService,t.EVENT_COLUMN_VALUE_CHANGED,this.onValueChanged.bind(this)),this.addManagedListener(this.eventService,t.EVENT_COLUMN_PIVOT_CHANGED,this.refreshModel.bind(this,{step:r.PIVOT})),this.addManagedListener(this.eventService,t.EVENT_FILTER_CHANGED,this.onFilterChanged.bind(this)),this.addManagedListener(this.eventService,t.EVENT_SORT_CHANGED,this.onSortChanged.bind(this)),this.addManagedListener(this.eventService,t.EVENT_COLUMN_PIVOT_MODE_CHANGED,e);var s=this.refreshModel.bind(this,{step:r.MAP,keepRenderedRows:!0,animate:!0});this.addManagedListener(this.gridOptionsWrapper,i.PROP_GROUP_REMOVE_SINGLE_CHILDREN,s),this.addManagedListener(this.gridOptionsWrapper,i.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN,s),this.rootNode=new o(this.beans),this.nodeManager=new w(this.rootNode,this.gridOptionsWrapper,this.eventService,this.columnModel,this.gridApi,this.columnApi,this.selectionService,this.beans)},u.prototype.start=function(){var e=this.gridOptionsWrapper.getRowData();e&&this.setRowData(e)},u.prototype.ensureRowHeightsValid=function(e,t,o,r){var i,n=!1;do{i=!1;for(var s=this.getRowIndexAtPixel(e),a=this.getRowIndexAtPixel(t),p=Math.max(s,o),d=Math.min(a,r),l=p;l<=d;l++){var h=this.getRow(l);if(h.rowHeightEstimated){var c=this.gridOptionsWrapper.getRowHeightForNode(h);h.setRowHeight(c.height),i=!0,n=!0}}i&&this.setRowTopAndRowIndex()}while(i);return n},u.prototype.setRowTopAndRowIndex=function(){for(var e=this.gridOptionsWrapper.getDefaultRowHeight(),t=0,o=new Set,r=this.gridOptionsWrapper.getDomLayout()===n.DOM_LAYOUT_NORMAL,i=0;i<this.rowsToDisplay.length;i++){var s=this.rowsToDisplay[i];if(null!=s.id&&o.add(s.id),null==s.rowHeight){var a=this.gridOptionsWrapper.getRowHeightForNode(s,r,e);s.setRowHeight(a.height,a.estimated)}s.setRowTop(t),s.setRowIndex(i),t+=s.rowHeight}return o},u.prototype.clearRowTopAndRowIndex=function(e,t){var o=e.isActive(),r=function(e){e&&null!=e.id&&!t.has(e.id)&&e.clearRowTopAndRowIndex()},i=function(e){if(r(e),r(e.detailNode),r(e.sibling),e.hasChildren()&&e.childrenAfterGroup){var t=-1==e.level;o&&!t&&!e.expanded||e.childrenAfterGroup.forEach(i)}};i(this.rootNode)},u.prototype.ensureRowsAtPixel=function(t,o,i){var n=this;void 0===i&&(i=0);var s=this.getRowIndexAtPixel(o);return this.getRow(s)!==t[0]&&(t.forEach((function(t){e.removeFromArray(n.rootNode.allLeafChildren,t)})),t.forEach((function(t,o){e.insertIntoArray(n.rootNode.allLeafChildren,t,Math.max(s+i,0)+o)})),this.refreshModel({step:r.EVERYTHING,keepRenderedRows:!0,animate:!0,keepEditingRows:!0}),!0)},u.prototype.highlightRowAtPixel=function(e,t){var o=null!=t?this.getRowIndexAtPixel(t):null,r=null!=o?this.getRow(o):null;if(r&&e&&r!==e&&null!=t){var i=this.getHighlightPosition(t,r);this.lastHighlightedRow&&this.lastHighlightedRow!==r&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null),r.setHighlighted(i),this.lastHighlightedRow=r}else this.lastHighlightedRow&&(this.lastHighlightedRow.setHighlighted(null),this.lastHighlightedRow=null)},u.prototype.getHighlightPosition=function(e,t){if(!t){var o=this.getRowIndexAtPixel(e);if(!(t=this.getRow(o||0)))return s.Below}return e-t.rowTop<t.rowHeight/2?s.Above:s.Below},u.prototype.getLastHighlightedRowNode=function(){return this.lastHighlightedRow},u.prototype.isLastRowIndexKnown=function(){return!0},u.prototype.getRowCount=function(){return this.rowsToDisplay?this.rowsToDisplay.length:0},u.prototype.getTopLevelRowCount=function(){return this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode?1:this.rootNode.childrenAfterFilter?this.rootNode.childrenAfterFilter.length:0},u.prototype.getTopLevelRowDisplayedIndex=function(e){if(this.rowsToDisplay&&this.rowsToDisplay[0]===this.rootNode)return e;var t=this.rootNode.childrenAfterSort[e];if(this.gridOptionsWrapper.isGroupHideOpenParents())for(;t.expanded&&t.childrenAfterSort&&t.childrenAfterSort.length>0;)t=t.childrenAfterSort[0];return t.rowIndex},u.prototype.getRowBounds=function(t){if(e.missing(this.rowsToDisplay))return null;var o=this.rowsToDisplay[t];return o?{rowTop:o.rowTop,rowHeight:o.rowHeight}:null},u.prototype.onRowGroupOpened=function(){var e=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:r.MAP,keepRenderedRows:!0,animate:e})},u.prototype.onFilterChanged=function(e){if(!e.afterDataChange){var t=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:r.FILTER,keepRenderedRows:!0,animate:t})}},u.prototype.onSortChanged=function(){var e=this.gridOptionsWrapper.isAnimateRows();this.refreshModel({step:r.SORT,keepRenderedRows:!0,animate:e,keepEditingRows:!0})},u.prototype.getType=function(){return n.ROW_MODEL_TYPE_CLIENT_SIDE},u.prototype.onValueChanged=function(){this.columnModel.isPivotActive()?this.refreshModel({step:r.PIVOT}):this.refreshModel({step:r.AGGREGATE})},u.prototype.createChangePath=function(t){var o=e.missingOrEmpty(t),r=new a(!1,this.rootNode);return(o||this.gridOptionsWrapper.isTreeData())&&r.setInactive(),r},u.prototype.isSuppressModelUpdateAfterUpdateTransaction=function(t){if(!this.gridOptionsWrapper.isSuppressModelUpdateAfterUpdateTransaction())return!1;if(null==t.rowNodeTransactions)return!1;var o=e.filter(t.rowNodeTransactions,(function(e){return null!=e.add&&e.add.length>0||null!=e.remove&&e.remove.length>0}));return null==o||0==o.length},u.prototype.refreshModel=function(e){var o=this;if(!this.isSuppressModelUpdateAfterUpdateTransaction(e)){var i=this.createChangePath(e.rowNodeTransactions);switch(e.step){case r.EVERYTHING:this.doRowGrouping(e.groupState,e.rowNodeTransactions,e.rowNodeOrder,i,!!e.afterColumnsChanged);case r.FILTER:this.doFilter(i);case r.PIVOT:this.doPivot(i);case r.AGGREGATE:this.doAggregate(i);case r.SORT:this.doSort(e.rowNodeTransactions,i);case r.MAP:this.doRowsToDisplay()}var n=this.setRowTopAndRowIndex();this.clearRowTopAndRowIndex(i,n);var s={type:t.EVENT_MODEL_UPDATED,api:this.gridApi,columnApi:this.columnApi,animate:e.animate,keepRenderedRows:e.keepRenderedRows,newData:e.newData,newPage:!1};this.eventService.dispatchEvent(s),this.$scope&&window.setTimeout((function(){o.$scope.$apply()}),0)}},u.prototype.isEmpty=function(){var t=e.missing(this.rootNode.allLeafChildren)||0===this.rootNode.allLeafChildren.length;return e.missing(this.rootNode)||t||!this.columnModel.isReady()},u.prototype.isRowsToRender=function(){return e.exists(this.rowsToDisplay)&&this.rowsToDisplay.length>0},u.prototype.getNodesInRangeForSelection=function(e,t){var o,r=!t,i=!1,n=[],s=this.gridOptionsWrapper.isGroupSelectsChildren();return this.forEachNodeAfterFilterAndSort((function(a){var p=r&&!i;if(r||a!==t&&a!==e||(r=!0),!(a.group&&s)){var d=r&&!i,l=a.isParentOfNode(o);(d||l)&&n.push(a)}p&&(a!==t&&a!==e||(i=!0,o=a===t?t:e))})),n},u.prototype.setDatasource=function(e){console.error("AG Grid: should never call setDatasource on clientSideRowController")},u.prototype.getTopLevelNodes=function(){return this.rootNode?this.rootNode.childrenAfterGroup:null},u.prototype.getRootNode=function(){return this.rootNode},u.prototype.getRow=function(e){return this.rowsToDisplay[e]},u.prototype.isRowPresent=function(e){return this.rowsToDisplay.indexOf(e)>=0},u.prototype.getRowIndexAtPixel=function(t){if(this.isEmpty())return-1;var o=0,r=this.rowsToDisplay.length-1;if(t<=0)return 0;if(e.last(this.rowsToDisplay).rowTop<=t)return this.rowsToDisplay.length-1;for(;;){var i=Math.floor((o+r)/2),n=this.rowsToDisplay[i];if(this.isRowInPixel(n,t))return i;n.rowTop<t?o=i+1:n.rowTop>t&&(r=i-1)}},u.prototype.isRowInPixel=function(e,t){var o=e.rowTop,r=e.rowTop+e.rowHeight;return o<=t&&r>t},u.prototype.forEachLeafNode=function(e){this.rootNode.allLeafChildren&&this.rootNode.allLeafChildren.forEach((function(t,o){return e(t,o)}))},u.prototype.forEachNode=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterGroup,e,g.Normal,0)},u.prototype.forEachNodeAfterFilter=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterFilter,e,g.AfterFilter,0)},u.prototype.forEachNodeAfterFilterAndSort=function(e){this.recursivelyWalkNodesAndCallback(this.rootNode.childrenAfterSort,e,g.AfterFilterAndSort,0)},u.prototype.forEachPivotNode=function(e){this.recursivelyWalkNodesAndCallback([this.rootNode],e,g.PivotNodes,0)},u.prototype.recursivelyWalkNodesAndCallback=function(e,t,o,r){if(!e)return r;for(var i=0;i<e.length;i++){var n=e[i];if(t(n,r++),n.hasChildren()){var s=null;switch(o){case g.Normal:s=n.childrenAfterGroup;break;case g.AfterFilter:s=n.childrenAfterFilter;break;case g.AfterFilterAndSort:s=n.childrenAfterSort;break;case g.PivotNodes:s=n.leafGroup?null:n.childrenAfterSort}s&&(r=this.recursivelyWalkNodesAndCallback(s,t,o,r))}}return r},u.prototype.doAggregate=function(e){this.aggregationStage&&this.aggregationStage.execute({rowNode:this.rootNode,changedPath:e})},u.prototype.expandOrCollapseAll=function(o){var i=this.gridOptionsWrapper.isTreeData();this.rootNode&&function t(r){if(!r)return;r.forEach((function(r){(i?e.exists(r.childrenAfterGroup):r.group)&&(r.expanded=o,t(r.childrenAfterGroup))}))}(this.rootNode.childrenAfterGroup),this.refreshModel({step:r.MAP});var n=o?"expandAll":"collapseAll",s={api:this.gridApi,columnApi:this.columnApi,type:t.EVENT_EXPAND_COLLAPSE_ALL,source:n};this.eventService.dispatchEvent(s)},u.prototype.doSort=function(e,t){this.sortStage.execute({rowNode:this.rootNode,rowNodeTransactions:e,changedPath:t})},u.prototype.doRowGrouping=function(e,t,o,r,i){this.groupStage?(t?this.groupStage.execute({rowNode:this.rootNode,rowNodeTransactions:t,rowNodeOrder:o,changedPath:r}):(this.groupStage.execute({rowNode:this.rootNode,changedPath:r,afterColumnsChanged:i}),this.restoreGroupState(e)),this.gridOptionsWrapper.isGroupSelectsChildren()&&this.selectionService.updateGroupsFromChildrenSelections(r)):(this.rootNode.childrenAfterGroup=this.rootNode.allLeafChildren,this.rootNode.updateHasChildren())},u.prototype.restoreGroupState=function(t){t&&e.traverseNodesWithKey(this.rootNode.childrenAfterGroup,(function(e,o){"boolean"==typeof t[o]&&(e.expanded=t[o])}))},u.prototype.doFilter=function(e){this.filterStage.execute({rowNode:this.rootNode,changedPath:e})},u.prototype.doPivot=function(e){this.pivotStage&&this.pivotStage.execute({rowNode:this.rootNode,changedPath:e})},u.prototype.getGroupState=function(){if(!this.rootNode.childrenAfterGroup||!this.gridOptionsWrapper.isRememberGroupStateWhenNewData())return null;var t={};return e.traverseNodesWithKey(this.rootNode.childrenAfterGroup,(function(e,o){return t[o]=e.expanded})),t},u.prototype.getCopyOfNodesMap=function(){return this.nodeManager.getCopyOfNodesMap()},u.prototype.getRowNode=function(e){if("string"==typeof e&&0==e.indexOf(o.ID_PREFIX_ROW_GROUP)){var t=void 0;return this.forEachNode((function(o){o.id===e&&(t=o)})),t}return this.nodeManager.getRowNode(e)},u.prototype.setRowData=function(e){var o=this.getGroupState();this.nodeManager.setRowData(e);var i={type:t.EVENT_ROW_DATA_CHANGED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(i),this.refreshModel({step:r.EVERYTHING,groupState:o,newData:!0})},u.prototype.batchUpdateRowData=function(e,t){var o=this;if(null==this.applyAsyncTransactionsTimeout){this.rowDataTransactionBatch=[];var r=this.gridOptionsWrapper.getAsyncTransactionWaitMillis();this.applyAsyncTransactionsTimeout=window.setTimeout((function(){o.executeBatchUpdateRowData()}),r)}this.rowDataTransactionBatch.push({rowDataTransaction:e,callback:t})},u.prototype.flushAsyncTransactions=function(){null!=this.applyAsyncTransactionsTimeout&&(clearTimeout(this.applyAsyncTransactionsTimeout),this.executeBatchUpdateRowData())},u.prototype.executeBatchUpdateRowData=function(){var e=this;this.valueCache.onDataChanged();var o=[],r=[],i=!1;if(this.rowDataTransactionBatch&&this.rowDataTransactionBatch.forEach((function(t){var n=e.nodeManager.updateRowData(t.rowDataTransaction,void 0);r.push(n),t.callback&&o.push(t.callback.bind(null,n)),"number"==typeof t.rowDataTransaction.addIndex&&(i=!0)})),this.commonUpdateRowData(r,void 0,i),o.length>0&&window.setTimeout((function(){o.forEach((function(e){return e()}))}),0),r.length>0){var n={api:this.gridOptionsWrapper.getApi(),columnApi:this.gridOptionsWrapper.getColumnApi(),type:t.EVENT_ASYNC_TRANSACTIONS_FLUSHED,results:r};this.eventService.dispatchEvent(n)}this.rowDataTransactionBatch=null,this.applyAsyncTransactionsTimeout=void 0},u.prototype.updateRowData=function(e,t){this.valueCache.onDataChanged();var o=this.nodeManager.updateRowData(e,t),r="number"==typeof e.addIndex;return this.commonUpdateRowData([o],t,r),o},u.prototype.createRowNodeOrder=function(){if(!this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder()){var e={};if(this.rootNode&&this.rootNode.allLeafChildren)for(var t=0;t<this.rootNode.allLeafChildren.length;t++){e[this.rootNode.allLeafChildren[t].id]=t}return e}},u.prototype.commonUpdateRowData=function(e,o,i){i&&(o=this.createRowNodeOrder()),this.refreshModel({step:r.EVERYTHING,rowNodeTransactions:e,rowNodeOrder:o,keepRenderedRows:!0,animate:!0,keepEditingRows:!0});var n={type:t.EVENT_ROW_DATA_UPDATED,api:this.gridApi,columnApi:this.columnApi};this.eventService.dispatchEvent(n)},u.prototype.doRowsToDisplay=function(){this.rowsToDisplay=this.flattenStage.execute({rowNode:this.rootNode})},u.prototype.onRowHeightChanged=function(){this.refreshModel({step:r.MAP,keepRenderedRows:!0,keepEditingRows:!0})},u.prototype.resetRowHeights=function(){var e=!1;this.forEachNode((function(t){t.setRowHeight(t.rowHeight,!0);var o=t.detailNode;o&&o.setRowHeight(o.rowHeight,!0),e=!0})),e&&this.onRowHeightChanged()},N([p("columnModel")],u.prototype,"columnModel",void 0),N([p("$scope")],u.prototype,"$scope",void 0),N([p("selectionService")],u.prototype,"selectionService",void 0),N([p("valueCache")],u.prototype,"valueCache",void 0),N([p("columnApi")],u.prototype,"columnApi",void 0),N([p("gridApi")],u.prototype,"gridApi",void 0),N([p("animationFrameService")],u.prototype,"animationFrameService",void 0),N([p("beans")],u.prototype,"beans",void 0),N([p("filterStage")],u.prototype,"filterStage",void 0),N([p("sortStage")],u.prototype,"sortStage",void 0),N([p("flattenStage")],u.prototype,"flattenStage",void 0),N([d("groupStage")],u.prototype,"groupStage",void 0),N([d("aggregationStage")],u.prototype,"aggregationStage",void 0),N([d("pivotStage")],u.prototype,"pivotStage",void 0),N([l],u.prototype,"init",null),u=N([h("rowModel")],u)}(c),A=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),O=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},T=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A(t,e),t.prototype.execute=function(e){var t=e.rowNode,o=e.changedPath;this.filterService.filter(o),this.selectableService.updateSelectableAfterFiltering(t)},O([p("selectableService")],t.prototype,"selectableService",void 0),O([p("filterService")],t.prototype,"filterService",void 0),t=O([h("filterStage")],t)}(c),S=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),m=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},D=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return S(o,t),o.prototype.execute=function(t){var o=this.sortController.getSortOptions(),r=e.exists(o)&&o.length>0,i=r&&e.exists(t.rowNodeTransactions)&&this.gridOptionsWrapper.isDeltaSort(),n=i?this.calculateDirtyNodes(t.rowNodeTransactions):null,s=e.missingOrEmpty(this.columnModel.getValueColumns()),a=e.some(o,(function(e){return!!e.column.getColDef().showRowGroup}));this.sortService.sort(o,r,i,n,t.changedPath,s,a)},o.prototype.calculateDirtyNodes=function(e){var t={},o=function(e){e&&e.forEach((function(e){return t[e.id]=!0}))};return e&&e.forEach((function(e){o(e.add),o(e.update),o(e.remove)})),t},m([p("sortService")],o.prototype,"sortService",void 0),m([p("sortController")],o.prototype,"sortController",void 0),m([p("columnModel")],o.prototype,"columnModel",void 0),o=m([h("sortStage")],o)}(c),E=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),C=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},_=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return E(r,t),r.prototype.execute=function(e){var t=e.rowNode,o=[],r={value:0},i=this.columnModel.isPivotMode(),n=i&&t.leafGroup,s=n?[t]:t.childrenAfterSort;return this.recursivelyAddToRowsToDisplay(s,o,r,i,0),!n&&o.length>0&&this.gridOptionsWrapper.isGroupIncludeTotalFooter()&&(this.ensureFooterNodeExists(t),this.addRowNodeToRowsToDisplay(t.sibling,o,r,0)),o},r.prototype.recursivelyAddToRowsToDisplay=function(t,o,r,i,n){if(!e.missingOrEmpty(t))for(var s=this.gridOptionsWrapper.isGroupHideOpenParents(),a=this.gridOptionsWrapper.isGroupRemoveSingleChildren(),p=!a&&this.gridOptionsWrapper.isGroupRemoveLowestSingleChildren(),d=0;d<t.length;d++){var l=t[d],h=l.hasChildren(),c=i&&!h,u=a&&h&&1===l.childrenAfterGroup.length,f=p&&h&&l.leafGroup&&1===l.childrenAfterGroup.length,g=i&&l.leafGroup,y=s&&l.expanded&&!g;if(!(c||y||u||f)&&this.addRowNodeToRowsToDisplay(l,o,r,n),!i||!l.leafGroup)if(h){var w=u||f;if(l.expanded||w){var v=w?n:n+1;this.recursivelyAddToRowsToDisplay(l.childrenAfterSort,o,r,i,v),this.gridOptionsWrapper.isGroupIncludeFooter()&&(this.ensureFooterNodeExists(l),this.addRowNodeToRowsToDisplay(l.sibling,o,r,n))}}else if(l.master&&l.expanded){var N=this.createDetailNode(l);this.addRowNodeToRowsToDisplay(N,o,r,n)}}},r.prototype.addRowNodeToRowsToDisplay=function(e,t,o,r){var i=this.gridOptionsWrapper.isGroupMultiAutoColumn();t.push(e),e.setUiLevel(i?0:r)},r.prototype.ensureFooterNodeExists=function(t){if(!e.exists(t.sibling)){var r=new o(this.beans);Object.keys(t).forEach((function(e){r[e]=t[e]})),r.footer=!0,r.setRowTop(null),r.setRowIndex(null),r.oldRowTop=null,e.exists(r.id)&&(r.id="rowGroupFooter_"+r.id),r.sibling=t,t.sibling=r}},r.prototype.createDetailNode=function(t){if(e.exists(t.detailNode))return t.detailNode;var r=new o(this.beans);return r.detail=!0,r.selectable=!1,r.parent=t,e.exists(t.id)&&(r.id="detail_"+t.id),r.data=t.data,r.level=t.level+1,t.detailNode=r,r},C([p("columnModel")],r.prototype,"columnModel",void 0),C([p("beans")],r.prototype,"beans",void 0),r=C([h("flattenStage")],r)}(c),M=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),G=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},P=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return M(o,t),o.prototype.init=function(){this.postSortFunc=this.gridOptionsWrapper.getPostSortFunc()},o.prototype.sort=function(e,t,o,r,i,n,s){var a=this,p=this.gridOptionsWrapper.isGroupMaintainOrder();i&&i.forEachChangedNodeDepthFirst((function(d){if(a.pullDownGroupDataForHideOpenParents(d.childrenAfterFilter,!0),t){var l=p&&!d.leafGroup&&!s;d.childrenAfterSort=l?d.childrenAfterSort.slice(0):o?a.doDeltaSort(d,e,r,i,n):a.rowNodeSorter.doFullSort(d.childrenAfterFilter,e)}else d.childrenAfterSort=p&&d.childrenAfterSort?d.childrenAfterSort.slice(0):d.childrenAfterFilter.slice(0);a.updateChildIndexes(d),a.postSortFunc&&a.postSortFunc(d.childrenAfterSort)})),this.updateGroupDataForHideOpenParents(i)},o.prototype.mapNodeToSortedNode=function(e,t){return{currentPos:t,rowNode:e}},o.prototype.doDeltaSort=function(e,t,o,r,i){var n=e.childrenAfterSort.filter((function(e){var t=!o[e.id],n=i||r&&r.canSkip(e);return t&&n})).map(this.mapNodeToSortedNode.bind(this)),s={};n.forEach((function(e){return s[e.rowNode.id]=e.rowNode}));var a=e.childrenAfterFilter.filter((function(e){return!s[e.id]})).map(this.mapNodeToSortedNode.bind(this));return a.sort(this.rowNodeSorter.compareRowNodes.bind(this,t)),(0===a.length?n:0===n.length?a:this.mergeSortedArrays(t,n,a)).map((function(e){return e.rowNode}))},o.prototype.mergeSortedArrays=function(e,t,o){for(var r=[],i=0,n=0;i<t.length&&n<o.length;){this.rowNodeSorter.compareRowNodes(e,t[i],o[n])<0?r.push(t[i++]):r.push(o[n++])}for(;i<t.length;)r.push(t[i++]);for(;n<o.length;)r.push(o[n++]);return r},o.prototype.updateChildIndexes=function(t){if(!e.missing(t.childrenAfterSort))for(var o=t.childrenAfterSort,r=0;r<o.length;r++){var i=o[r],n=0===r,s=r===t.childrenAfterSort.length-1;i.setFirstChild(n),i.setLastChild(s),i.setChildIndex(r)}},o.prototype.updateGroupDataForHideOpenParents=function(t){var o=this;if(this.gridOptionsWrapper.isGroupHideOpenParents()){if(this.gridOptionsWrapper.isTreeData()){return e.doOnce((function(){return console.warn("AG Grid: 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 (as opposed to Row Grouping, which only has Aggregated Values at the group level).")}),"sortService.hideOpenParentsWithTreeData"),!1}var r=function(e){o.pullDownGroupDataForHideOpenParents(e.childrenAfterSort,!1),e.childrenAfterSort.forEach((function(e){e.hasChildren()&&r(e)}))};t&&t.executeFromRootNode((function(e){return r(e)}))}},o.prototype.pullDownGroupDataForHideOpenParents=function(t,o){var r=this;this.gridOptionsWrapper.isGroupHideOpenParents()&&!e.missing(t)&&t.forEach((function(e){r.columnModel.getGroupDisplayColumns().forEach((function(t){var i=t.getColDef().showRowGroup;if("string"==typeof i){var n=i,s=r.columnModel.getPrimaryColumn(n);if(!(s===e.rowGroupColumn))if(o)e.setGroupValue(t.getId(),void 0);else{var a=e.getFirstChildOfFirstChild(s);a&&e.setGroupValue(t.getId(),a.key)}}else console.error("AG Grid: groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup")}))}))},G([p("columnModel")],o.prototype,"columnModel",void 0),G([p("rowNodeSorter")],o.prototype,"rowNodeSorter",void 0),G([l],o.prototype,"init",null),o=G([h("sortService")],o)}(c),b=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),x=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},F=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return b(t,e),t.prototype.postConstruct=function(){this.doingTreeData=this.gridOptionsWrapper.isTreeData()},t.prototype.filter=function(e){var t=this.filterManager.isAnyFilterPresent();this.filterNodes(t,e)},t.prototype.filterNodes=function(e,t){var o=this,r=function(t,r){t.hasChildren()?(t.childrenAfterFilter=e&&!r?t.childrenAfterGroup.filter((function(e){var t=e.childrenAfterFilter&&e.childrenAfterFilter.length>0,r=e.data&&o.filterManager.doesRowPassFilter({rowNode:e});return t||r})):t.childrenAfterGroup,o.setAllChildrenCount(t)):(t.childrenAfterFilter=t.childrenAfterGroup,t.setAllChildrenCount(null))};if(this.doingTreeDataFiltering()){var i=function(e,t){if(e.childrenAfterGroup)for(var n=0;n<e.childrenAfterGroup.length;n++){var s=e.childrenAfterGroup[n],a=t||o.filterManager.doesRowPassFilter({rowNode:s});s.childrenAfterGroup?i(e.childrenAfterGroup[n],a):r(s,a)}r(e,t)};t.executeFromRootNode((function(e){return i(e,!1)}))}else{t.forEachChangedNodeDepthFirst((function(e){return r(e,!1)}),!0)}},t.prototype.setAllChildrenCountTreeData=function(e){var t=0;e.childrenAfterFilter.forEach((function(e){t++,t+=e.allChildrenCount})),e.setAllChildrenCount(t)},t.prototype.setAllChildrenCountGridGrouping=function(e){var t=0;e.childrenAfterFilter.forEach((function(e){e.group?t+=e.allChildrenCount:t++})),e.setAllChildrenCount(t)},t.prototype.setAllChildrenCount=function(e){this.doingTreeData?this.setAllChildrenCountTreeData(e):this.setAllChildrenCountGridGrouping(e)},t.prototype.doingTreeDataFiltering=function(){return this.gridOptionsWrapper.isTreeData()&&!this.gridOptionsWrapper.isExcludeChildrenWhenTreeDataFiltering()},x([p("filterManager")],t.prototype,"filterManager",void 0),x([l],t.prototype,"postConstruct",null),t=x([h("filterService")],t)}(c),I=function(){var e=function(t,o){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o])})(t,o)};return function(t,o){function r(){this.constructor=t}e(t,o),t.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),L=function(e,t,o,r){var i,n=arguments.length,s=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,o,s):i(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s},W=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return I(o,t),o.prototype.postConstruct=function(){this.rowModel.getType()===n.ROW_MODEL_TYPE_CLIENT_SIDE&&(this.clientSideRowModel=this.rowModel)},o.prototype.createTransactionForRowData=function(t){if(e.missing(this.clientSideRowModel))console.error("AG Grid: ImmutableService only works with ClientSideRowModel");else{var o=this.gridOptionsWrapper.getRowNodeIdFunc();if(o&&!e.missing(o)){var r={remove:[],update:[],add:[]},i=this.clientSideRowModel.getCopyOfNodesMap(),n=this.gridOptionsWrapper.isSuppressMaintainUnsortedOrder()?null:{};return e.exists(t)&&t.forEach((function(e,t){var s=o(e),a=i[s];(n&&(n[s]=t),a)?(a.data!==e&&r.update.push(e),i[s]=void 0):r.add.push(e)})),e.iterateObject(i,(function(e,t){t&&r.remove.push(t.data)})),[r,n]}console.error("AG Grid: ImmutableService requires getRowNodeId() callback to be implemented, your row data need IDs!")}},L([p("rowModel")],o.prototype,"rowModel",void 0),L([l],o.prototype,"postConstruct",null),o=L([h("immutableService")],o)}(c),H={moduleName:u.ClientSideRowModelModule,beans:[T,D,_,P,F,W],rowModels:{clientSide:R}};export{H as ClientSideRowModelModule};

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

import { ColumnApi, ColumnModel, Context, EventService, GridApi, GridOptionsWrapper, RowDataTransaction, RowNode, RowNodeTransaction, SelectionService } from "@ag-grid-community/core";
import { ColumnApi, ColumnModel, EventService, GridApi, GridOptionsWrapper, RowDataTransaction, RowNode, RowNodeTransaction, SelectionService, Beans } from "@ag-grid-community/core";
export declare class ClientSideNodeManager {

@@ -8,6 +8,6 @@ private static TOP_LEVEL;

private gridOptionsWrapper;
private context;
private eventService;
private columnModel;
private selectionService;
private beans;
private nextId;

@@ -20,3 +20,3 @@ private static ROOT_NODE_ID;

private allNodesMap;
constructor(rootNode: RowNode, gridOptionsWrapper: GridOptionsWrapper, context: Context, eventService: EventService, columnModel: ColumnModel, gridApi: GridApi, columnApi: ColumnApi, selectionService: SelectionService);
constructor(rootNode: RowNode, gridOptionsWrapper: GridOptionsWrapper, eventService: EventService, columnModel: ColumnModel, gridApi: GridApi, columnApi: ColumnApi, selectionService: SelectionService, beans: Beans);
postConstruct(): void;

@@ -23,0 +23,0 @@ getCopyOfNodesMap(): {

@@ -10,3 +10,3 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {

var ClientSideNodeManager = /** @class */ (function () {
function ClientSideNodeManager(rootNode, gridOptionsWrapper, context, eventService, columnModel, gridApi, columnApi, selectionService) {
function ClientSideNodeManager(rootNode, gridOptionsWrapper, eventService, columnModel, gridApi, columnApi, selectionService, beans) {
this.nextId = 0;

@@ -17,3 +17,2 @@ // when user is provide the id's, we also keep a map of ids to row nodes for convenience

this.gridOptionsWrapper = gridOptionsWrapper;
this.context = context;
this.eventService = eventService;

@@ -23,2 +22,3 @@ this.columnModel = columnModel;

this.columnApi = columnApi;
this.beans = beans;
this.selectionService = selectionService;

@@ -214,4 +214,3 @@ this.rootNode.group = true;

ClientSideNodeManager.prototype.createNode = function (dataItem, parent, level) {
var node = new RowNode();
this.context.createBean(node);
var node = new RowNode(this.beans);
node.group = false;

@@ -218,0 +217,0 @@ this.setMasterForRow(node, dataItem, level, true);

@@ -17,2 +17,3 @@ import { BeanStub, ChangedPath, IClientSideRowModel, RefreshModelParams, RowBounds, RowDataTransaction, RowNode, RowHighlightPosition, RowNodeTransaction } from "@ag-grid-community/core";

private animationFrameService;
private beans;
private filterStage;

@@ -19,0 +20,0 @@ private sortStage;

@@ -56,5 +56,4 @@ var __extends = (this && this.__extends) || (function () {

this.addManagedListener(this.gridOptionsWrapper, GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, refreshMapListener);
this.rootNode = new RowNode();
this.nodeManager = new ClientSideNodeManager(this.rootNode, this.gridOptionsWrapper, this.getContext(), this.eventService, this.columnModel, this.gridApi, this.columnApi, this.selectionService);
this.createBean(this.rootNode);
this.rootNode = new RowNode(this.beans);
this.nodeManager = new ClientSideNodeManager(this.rootNode, this.gridOptionsWrapper, this.eventService, this.columnModel, this.gridApi, this.columnApi, this.selectionService, this.beans);
};

@@ -96,10 +95,19 @@ ClientSideRowModel.prototype.start = function () {

ClientSideRowModel.prototype.setRowTopAndRowIndex = function () {
var defaultRowHeight = this.gridOptionsWrapper.getDefaultRowHeight();
var nextRowTop = 0;
// mapping displayed rows is not needed for this method, however it's used in
// clearRowTopAndRowIndex(), and given we are looping through this.rowsToDisplay here,
// we create the map here for performance reasons, so we don't loop a second time
// in clearRowTopAndRowIndex()
var displayedRowsMapped = new Set();
// we don't estimate if doing fullHeight or autoHeight, as all rows get rendered all the time
// with these two layouts.
var allowEstimate = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_NORMAL;
for (var i = 0; i < this.rowsToDisplay.length; i++) {
// we don't estimate if doing fullHeight or autoHeight, as all rows get rendered all the time
// with these two layouts.
var allowEstimate = this.gridOptionsWrapper.getDomLayout() === Constants.DOM_LAYOUT_NORMAL;
var rowNode = this.rowsToDisplay[i];
if (_.missing(rowNode.rowHeight)) {
var rowHeight = this.gridOptionsWrapper.getRowHeightForNode(rowNode, allowEstimate);
if (rowNode.id != null) {
displayedRowsMapped.add(rowNode.id);
}
if (rowNode.rowHeight == null) {
var rowHeight = this.gridOptionsWrapper.getRowHeightForNode(rowNode, allowEstimate, defaultRowHeight);
rowNode.setRowHeight(rowHeight.height, rowHeight.estimated);

@@ -111,12 +119,8 @@ }

}
return displayedRowsMapped;
};
ClientSideRowModel.prototype.clearRowTopAndRowIndex = function (changedPath) {
var displayedRowsMapped = {};
this.rowsToDisplay.forEach(function (rowNode) {
if (rowNode.id != null) {
displayedRowsMapped[rowNode.id] = rowNode;
}
});
ClientSideRowModel.prototype.clearRowTopAndRowIndex = function (changedPath, displayedRowsMapped) {
var changedPathActive = changedPath.isActive();
var clearIfNotDisplayed = function (rowNode) {
if (rowNode && rowNode.id != null && displayedRowsMapped[rowNode.id] == null) {
if (rowNode && rowNode.id != null && !displayedRowsMapped.has(rowNode.id)) {
rowNode.clearRowTopAndRowIndex();

@@ -138,3 +142,3 @@ }

// as expanded=undefined for root node
var skipChildren = changedPath.isActive() && !isRootNode && !rowNode.expanded;
var skipChildren = changedPathActive && !isRootNode && !rowNode.expanded;
if (!skipChildren) {

@@ -334,4 +338,4 @@ rowNode.childrenAfterGroup.forEach(recurse);

// will still lie around
this.setRowTopAndRowIndex();
this.clearRowTopAndRowIndex(changedPath);
var displayedNodesMapped = this.setRowTopAndRowIndex();
this.clearRowTopAndRowIndex(changedPath, displayedNodesMapped);
var event = {

@@ -558,4 +562,2 @@ type: Events.EVENT_MODEL_UPDATED,

else {
// groups are about to get disposed, so need to deselect any that are selected
this.selectionService.removeGroupsFromSelection();
this.groupStage.execute({

@@ -798,2 +800,5 @@ rowNode: this.rootNode,

__decorate([
Autowired('beans')
], ClientSideRowModel.prototype, "beans", void 0);
__decorate([
Autowired('filterStage')

@@ -800,0 +805,0 @@ ], ClientSideRowModel.prototype, "filterStage", void 0);

import { BeanStub, IRowNodeStage, RowNode, StageExecuteParams } from "@ag-grid-community/core";
export declare class FlattenStage extends BeanStub implements IRowNodeStage {
private columnModel;
private beans;
execute(params: StageExecuteParams): RowNode[];

@@ -5,0 +6,0 @@ private recursivelyAddToRowsToDisplay;

@@ -118,4 +118,3 @@ var __extends = (this && this.__extends) || (function () {

}
var footerNode = new RowNode();
this.context.createBean(footerNode);
var footerNode = new RowNode(this.beans);
Object.keys(groupNode).forEach(function (key) {

@@ -143,4 +142,3 @@ footerNode[key] = groupNode[key];

}
var detailNode = new RowNode();
this.context.createBean(detailNode);
var detailNode = new RowNode(this.beans);
detailNode.detail = true;

@@ -160,2 +158,5 @@ detailNode.selectable = false;

], FlattenStage.prototype, "columnModel", void 0);
__decorate([
Autowired('beans')
], FlattenStage.prototype, "beans", void 0);
FlattenStage = __decorate([

@@ -162,0 +163,0 @@ Bean('flattenStage')

{
"name": "@ag-grid-community/client-side-row-model",
"version": "26.0.0",
"version": "26.1.0",
"description": "Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components",

@@ -45,3 +45,3 @@ "main": "./dist/cjs/main.js",

"dependencies": {
"@ag-grid-community/core": "~26.0.0"
"@ag-grid-community/core": "~26.1.0"
},

@@ -48,0 +48,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc