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 24.1.0 to 25.0.0

6

dist/cjs/clientSideRowModel/clientSideNodeManager.d.ts

@@ -14,3 +14,3 @@ import { ColumnApi, ColumnController, Context, EventService, GridApi, GridOptionsWrapper, RowDataTransaction, RowNode, RowNodeTransaction, SelectionController } from "@ag-grid-community/core";

private static ROOT_NODE_ID;
private isRowMasterFunc;
private isRowMasterFunc?;
private suppressParentsInRowNodes;

@@ -26,6 +26,6 @@ private doingTreeData;

getRowNode(id: string): RowNode;
setRowData(rowData: any[]): RowNode[];
setRowData(rowData: any[]): RowNode[] | undefined;
updateRowData(rowDataTran: RowDataTransaction, rowNodeOrder: {
[id: string]: number;
} | null | undefined): RowNodeTransaction | null;
} | null | undefined): RowNodeTransaction;
private updateSelection;

@@ -32,0 +32,0 @@ private executeAdd;

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

// find rowNode using object references
rowNode = core_1._.find(this.rootNode.allLeafChildren, function (rowNode) { return rowNode.data === data; });
rowNode = core_1._.find(this.rootNode.allLeafChildren, function (node) { return node.data === data; });
if (!rowNode) {

@@ -265,5 +265,3 @@ console.error("ag-Grid: could not find data item as object was not found", data);

}
else {
return level < expandByDefault;
}
return level < expandByDefault;
};

@@ -270,0 +268,0 @@ // this is only used for doing legacy tree data

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

export declare class ClientSideRowModel extends BeanStub implements IClientSideRowModel {
private gridOptionsWrapper;
private columnController;

@@ -41,3 +40,3 @@ private filterManager;

getLastHighlightedRowNode(): RowNode | null;
isLastRowFound(): boolean;
isLastRowIndexKnown(): boolean;
getRowCount(): number;

@@ -64,3 +63,2 @@ getTopLevelRowCount(): number;

private isRowInPixel;
getCurrentPageHeight(): number;
forEachLeafNode(callback: (node: RowNode, index: number) => void): void;

@@ -67,0 +65,0 @@ forEachNode(callback: (node: RowNode, index: number) => void): void;

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

});
this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_EVERYTHING_CHANGED, refreshEverythingAfterColsChangedFunc);
this.addManagedListener(this.eventService, core_1.Events.EVENT_NEW_COLUMNS_LOADED, refreshEverythingAfterColsChangedFunc);
this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc);

@@ -193,3 +193,3 @@ this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this));

};
ClientSideRowModel.prototype.isLastRowFound = function () {
ClientSideRowModel.prototype.isLastRowIndexKnown = function () {
return true;

@@ -294,3 +294,3 @@ };

// start = new Date().getTime();
this.doRowGrouping(params.groupState, params.rowNodeTransactions, params.rowNodeOrder, changedPath, params.afterColumnsChanged);
this.doRowGrouping(params.groupState, params.rowNodeTransactions, params.rowNodeOrder, changedPath, !!params.afterColumnsChanged);
// console.log('rowGrouping = ' + (new Date().getTime() - start));

@@ -433,10 +433,2 @@ case core_1.Constants.STEP_FILTER:

};
ClientSideRowModel.prototype.getCurrentPageHeight = function () {
if (this.rowsToDisplay && this.rowsToDisplay.length > 0) {
var lastRow = core_1._.last(this.rowsToDisplay);
var lastPixel = lastRow.rowTop + lastRow.rowHeight;
return lastPixel;
}
return 0;
};
ClientSideRowModel.prototype.forEachLeafNode = function (callback) {

@@ -650,5 +642,8 @@ if (this.rootNode.allLeafChildren) {

var rowNodeTrans = [];
// The rowGroup stage uses rowNodeOrder if order was provided. if we didn't pass 'true' to
// commonUpdateRowData, using addIndex would have no effect when grouping.
var forceRowNodeOrder = false;
if (this.rowDataTransactionBatch) {
this.rowDataTransactionBatch.forEach(function (tranItem) {
var rowNodeTran = _this.nodeManager.updateRowData(tranItem.rowDataTransaction, null);
var rowNodeTran = _this.nodeManager.updateRowData(tranItem.rowDataTransaction, undefined);
rowNodeTrans.push(rowNodeTran);

@@ -658,5 +653,8 @@ if (tranItem.callback) {

}
if (typeof tranItem.rowDataTransaction.addIndex === 'number') {
forceRowNodeOrder = true;
}
});
}
this.commonUpdateRowData(rowNodeTrans);
this.commonUpdateRowData(rowNodeTrans, undefined, forceRowNodeOrder);
// do callbacks in next VM turn so it's async

@@ -668,2 +666,11 @@ if (callbackFuncsBound.length > 0) {

}
if (rowNodeTrans.length > 0) {
var event_1 = {
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
type: core_1.Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,
results: rowNodeTrans
};
this.eventService.dispatchEvent(event_1);
}
this.rowDataTransactionBatch = null;

@@ -678,6 +685,4 @@ this.applyAsyncTransactionsTimeout = undefined;

// stage also uses the
if (typeof rowDataTran.addIndex === 'number') {
rowNodeOrder = this.createRowNodeOrder();
}
this.commonUpdateRowData([rowNodeTran], rowNodeOrder);
var forceRowNodeOrder = typeof rowDataTran.addIndex === 'number';
this.commonUpdateRowData([rowNodeTran], rowNodeOrder, forceRowNodeOrder);
return rowNodeTran;

@@ -690,3 +695,3 @@ };

}
var orderMap = suppressSortOrder ? null : {};
var orderMap = {};
if (this.rootNode && this.rootNode.allLeafChildren) {

@@ -701,3 +706,6 @@ for (var index = 0; index < this.rootNode.allLeafChildren.length; index++) {

// common to updateRowData and batchUpdateRowData
ClientSideRowModel.prototype.commonUpdateRowData = function (rowNodeTrans, rowNodeOrder) {
ClientSideRowModel.prototype.commonUpdateRowData = function (rowNodeTrans, rowNodeOrder, forceRowNodeOrder) {
if (forceRowNodeOrder) {
rowNodeOrder = this.createRowNodeOrder();
}
this.refreshModel({

@@ -742,5 +750,2 @@ step: core_1.Constants.STEP_EVERYTHING,

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

@@ -747,0 +752,0 @@ ], ClientSideRowModel.prototype, "columnController", void 0);

import { ChangedPath, BeanStub } from "@ag-grid-community/core";
export declare class FilterService extends BeanStub {
private filterManager;
private gridOptionsWrapper;
private doingTreeData;

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

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

// the data passes the filter
var passBecauseDataPasses = childNode.data && _this.filterManager.doesRowPassFilter(childNode);
var passBecauseDataPasses = childNode.data
&& _this.filterManager.doesRowPassFilter({ rowNode: childNode });
// note - tree data nodes pass either if a) they pass themselves or b) any children of that node pass

@@ -73,3 +74,4 @@ return passBecauseChildren || passBecauseDataPasses;

// first check if current node passes filter before invoking child nodes
var foundInParent = alreadyFoundInParent || _this.filterManager.doesRowPassFilter(childNode);
var foundInParent = alreadyFoundInParent
|| _this.filterManager.doesRowPassFilter({ rowNode: childNode });
if (childNode.childrenAfterGroup) {

@@ -132,5 +134,2 @@ treeDataDepthFirstFilter_1(rowNode.childrenAfterGroup[i], foundInParent);

__decorate([
core_1.Autowired('gridOptionsWrapper')
], FilterService.prototype, "gridOptionsWrapper", void 0);
__decorate([
core_1.PostConstruct

@@ -137,0 +136,0 @@ ], FilterService.prototype, "postConstruct", null);

import { IRowNodeStage, StageExecuteParams, BeanStub } from "@ag-grid-community/core";
export declare class FilterStage extends BeanStub implements IRowNodeStage {
private gridOptionsWrapper;
private selectableService;

@@ -5,0 +4,0 @@ private filterService;

@@ -34,5 +34,2 @@ "use strict";

__decorate([
core_1.Autowired('gridOptionsWrapper')
], FilterStage.prototype, "gridOptionsWrapper", void 0);
__decorate([
core_1.Autowired('selectableService')

@@ -39,0 +36,0 @@ ], FilterStage.prototype, "selectableService", void 0);

import { BeanStub, IRowNodeStage, RowNode, StageExecuteParams } from "@ag-grid-community/core";
export declare class FlattenStage extends BeanStub implements IRowNodeStage {
private gridOptionsWrapper;
private selectionController;

@@ -5,0 +4,0 @@ private columnController;

@@ -155,5 +155,2 @@ "use strict";

__decorate([
core_1.Autowired('gridOptionsWrapper')
], FlattenStage.prototype, "gridOptionsWrapper", void 0);
__decorate([
core_1.Autowired('selectionController')

@@ -160,0 +157,0 @@ ], FlattenStage.prototype, "selectionController", void 0);

import { IImmutableService, RowDataTransaction, BeanStub } from "@ag-grid-community/core";
export declare class ImmutableService extends BeanStub implements IImmutableService {
private rowModel;
private gridOptionsWrapper;
private clientSideRowModel;

@@ -9,3 +8,3 @@ private postConstruct;

[id: string]: number;
}]) | undefined;
} | null]) | undefined;
}

@@ -90,5 +90,2 @@ "use strict";

__decorate([
core_1.Autowired('gridOptionsWrapper')
], ImmutableService.prototype, "gridOptionsWrapper", void 0);
__decorate([
core_1.PostConstruct

@@ -95,0 +92,0 @@ ], ImmutableService.prototype, "postConstruct", null);

@@ -1,15 +0,5 @@

import { ChangedPath, Column, RowNode, BeanStub } from "@ag-grid-community/core";
export interface SortOption {
inverter: number;
column: Column;
}
export interface SortedRowNode {
currentPos: number;
rowNode: RowNode;
}
import { SortOption, ChangedPath, BeanStub } from "@ag-grid-community/core";
export declare class SortService extends BeanStub {
private sortController;
private columnController;
private valueService;
private gridOptionsWrapper;
private rowNodeSorter;
private postSortFunc;

@@ -19,9 +9,6 @@ init(): void;

[nodeId: string]: boolean;
}, changedPath: ChangedPath, noAggregations: boolean): void;
private doFullSort;
} | null, changedPath: ChangedPath | undefined, noAggregations: boolean): void;
private mapNodeToSortedNode;
private doDeltaSort;
private mergeSortedArrays;
private compareRowNodes;
private getValue;
private updateChildIndexes;

@@ -28,0 +15,0 @@ private updateGroupDataForHiddenOpenParents;

@@ -40,6 +40,5 @@ "use strict";

if (sortActive) {
var sortedRowNodes = deltaSort ?
rowNode.childrenAfterSort = deltaSort ?
_this.doDeltaSort(rowNode, sortOptions, dirtyLeafNodes, changedPath, noAggregations)
: _this.doFullSort(rowNode, sortOptions);
rowNode.childrenAfterSort = sortedRowNodes.map(function (sorted) { return sorted.rowNode; });
: _this.rowNodeSorter.doFullSort(rowNode.childrenAfterFilter, sortOptions);
}

@@ -54,11 +53,7 @@ else {

};
changedPath.forEachChangedNodeDepthFirst(callback);
if (changedPath) {
changedPath.forEachChangedNodeDepthFirst(callback);
}
this.updateGroupDataForHiddenOpenParents(changedPath);
};
SortService.prototype.doFullSort = function (rowNode, sortOptions) {
var sortedRowNodes = rowNode.childrenAfterFilter
.map(this.mapNodeToSortedNode.bind(this));
sortedRowNodes.sort(this.compareRowNodes.bind(this, sortOptions));
return sortedRowNodes;
};
SortService.prototype.mapNodeToSortedNode = function (rowNode, pos) {

@@ -73,3 +68,3 @@ return { currentPos: pos, rowNode: rowNode };

var cleanNodes = rowNode.childrenAfterSort
.filter(function (rowNode) {
.filter(function (node) {
// take out all nodes that were changed as part of the current transaction.

@@ -79,3 +74,3 @@ // a changed node could a) be in a different sort position or b) may

// or be in a different group.
var passesDirtyNodesCheck = !dirtyLeafNodes[rowNode.id];
var passesDirtyNodesCheck = !dirtyLeafNodes[node.id];
// also remove group nodes in the changed path, as they can have different aggregate

@@ -86,3 +81,3 @@ // values which could impact the sort order.

// there is no value in the group that could of changed (ie no aggregate values)
var passesChangedPathCheck = noAggregations || changedPath.canSkip(rowNode);
var passesChangedPathCheck = noAggregations || (changedPath && changedPath.canSkip(node));
return passesDirtyNodesCheck && passesChangedPathCheck;

@@ -97,16 +92,18 @@ })

// ignore nodes in the clean list
.filter(function (rowNode) { return !cleanNodesMapped[rowNode.id]; })
.filter(function (node) { return !cleanNodesMapped[node.id]; })
.map(this.mapNodeToSortedNode.bind(this));
// sort changed nodes. note that we don't need to sort cleanNodes as they are
// already sorted from last time.
changedNodes.sort(this.compareRowNodes.bind(this, sortOptions));
changedNodes.sort(this.rowNodeSorter.compareRowNodes.bind(this, sortOptions));
var result;
if (changedNodes.length === 0) {
return cleanNodes;
result = cleanNodes;
}
else if (cleanNodes.length === 0) {
return changedNodes;
result = changedNodes;
}
else {
return this.mergeSortedArrays(sortOptions, cleanNodes, changedNodes);
result = this.mergeSortedArrays(sortOptions, cleanNodes, changedNodes);
}
return result.map(function (item) { return item.rowNode; });
};

@@ -125,3 +122,3 @@ // Merge two sorted arrays into each other

// index. Otherwise do same with second array
var compareResult = this.compareRowNodes(sortOptions, arr1[i], arr2[j]);
var compareResult = this.rowNodeSorter.compareRowNodes(sortOptions, arr1[i], arr2[j]);
if (compareResult < 0) {

@@ -144,32 +141,2 @@ res.push(arr1[i++]);

};
SortService.prototype.compareRowNodes = function (sortOptions, sortedNodeA, sortedNodeB) {
var nodeA = sortedNodeA.rowNode;
var nodeB = sortedNodeB.rowNode;
// Iterate columns, return the first that doesn't match
for (var i = 0, len = sortOptions.length; i < len; i++) {
var sortOption = sortOptions[i];
// let compared = compare(nodeA, nodeB, sortOption.column, sortOption.inverter === -1);
var isInverted = sortOption.inverter === -1;
var valueA = this.getValue(nodeA, sortOption.column);
var valueB = this.getValue(nodeB, sortOption.column);
var comparatorResult = void 0;
var providedComparator = sortOption.column.getColDef().comparator;
if (providedComparator) {
//if comparator provided, use it
comparatorResult = providedComparator(valueA, valueB, nodeA, nodeB, isInverted);
}
else {
//otherwise do our own comparison
comparatorResult = core_1._.defaultComparator(valueA, valueB, this.gridOptionsWrapper.isAccentedSort());
}
if (comparatorResult !== 0) {
return comparatorResult * sortOption.inverter;
}
}
// All matched, we make is so that the original sort order is kept:
return sortedNodeA.currentPos - sortedNodeB.currentPos;
};
SortService.prototype.getValue = function (nodeA, column) {
return this.valueService.getValue(column, nodeA);
};
SortService.prototype.updateChildIndexes = function (rowNode) {

@@ -203,12 +170,11 @@ if (core_1._.missing(rowNode.childrenAfterSort)) {

};
changedPath.executeFromRootNode(function (rowNode) { return callback(rowNode); });
if (changedPath) {
changedPath.executeFromRootNode(function (rowNode) { return callback(rowNode); });
}
};
SortService.prototype.pullDownGroupDataForHideOpenParents = function (rowNodes, clearOperation) {
var _this = this;
if (core_1._.missing(rowNodes)) {
if (!this.gridOptionsWrapper.isGroupHideOpenParents() || core_1._.missing(rowNodes)) {
return;
}
if (!this.gridOptionsWrapper.isGroupHideOpenParents()) {
return;
}
rowNodes.forEach(function (childRowNode) {

@@ -243,14 +209,8 @@ var groupDisplayCols = _this.columnController.getGroupDisplayColumns();

__decorate([
core_1.Autowired('sortController')
], SortService.prototype, "sortController", void 0);
__decorate([
core_1.Autowired('columnController')
], SortService.prototype, "columnController", void 0);
__decorate([
core_1.Autowired('valueService')
], SortService.prototype, "valueService", void 0);
core_1.Autowired('rowNodeSorter')
], SortService.prototype, "rowNodeSorter", void 0);
__decorate([
core_1.Autowired('gridOptionsWrapper')
], SortService.prototype, "gridOptionsWrapper", void 0);
__decorate([
core_1.PostConstruct

@@ -257,0 +217,0 @@ ], SortService.prototype, "init", null);

import { StageExecuteParams, BeanStub } from "@ag-grid-community/core";
export declare class SortStage extends BeanStub {
private gridOptionsWrapper;
private sortService;

@@ -5,0 +4,0 @@ private sortController;

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

SortStage.prototype.execute = function (params) {
var sortOptions = this.sortController.getSortForRowController();
var sortOptions = this.sortController.getSortOptions();
var sortActive = core_1._.exists(sortOptions) && sortOptions.length > 0;

@@ -53,13 +53,12 @@ var deltaSort = sortActive

// all leaf level nodes in the transaction were impacted
rowNodeTransactions.forEach(function (tran) {
addNodesFunc(tran.add);
addNodesFunc(tran.update);
addNodesFunc(tran.remove);
});
if (rowNodeTransactions) {
rowNodeTransactions.forEach(function (tran) {
addNodesFunc(tran.add);
addNodesFunc(tran.update);
addNodesFunc(tran.remove);
});
}
return dirtyNodes;
};
__decorate([
core_1.Autowired('gridOptionsWrapper')
], SortStage.prototype, "gridOptionsWrapper", void 0);
__decorate([
core_1.Autowired('sortService')

@@ -66,0 +65,0 @@ ], SortStage.prototype, "sortService", void 0);

@@ -14,3 +14,3 @@ import { ColumnApi, ColumnController, Context, EventService, GridApi, GridOptionsWrapper, RowDataTransaction, RowNode, RowNodeTransaction, SelectionController } from "@ag-grid-community/core";

private static ROOT_NODE_ID;
private isRowMasterFunc;
private isRowMasterFunc?;
private suppressParentsInRowNodes;

@@ -26,6 +26,6 @@ private doingTreeData;

getRowNode(id: string): RowNode;
setRowData(rowData: any[]): RowNode[];
setRowData(rowData: any[]): RowNode[] | undefined;
updateRowData(rowDataTran: RowDataTransaction, rowNodeOrder: {
[id: string]: number;
} | null | undefined): RowNodeTransaction | null;
} | null | undefined): RowNodeTransaction;
private updateSelection;

@@ -32,0 +32,0 @@ private executeAdd;

@@ -187,3 +187,3 @@ import { _, Events, RowNode } from "@ag-grid-community/core";

// find rowNode using object references
rowNode = _.find(this.rootNode.allLeafChildren, function (rowNode) { return rowNode.data === data; });
rowNode = _.find(this.rootNode.allLeafChildren, function (node) { return node.data === data; });
if (!rowNode) {

@@ -263,5 +263,3 @@ console.error("ag-Grid: could not find data item as object was not found", data);

}
else {
return level < expandByDefault;
}
return level < expandByDefault;
};

@@ -268,0 +266,0 @@ // this is only used for doing legacy tree data

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

export declare class ClientSideRowModel extends BeanStub implements IClientSideRowModel {
private gridOptionsWrapper;
private columnController;

@@ -41,3 +40,3 @@ private filterManager;

getLastHighlightedRowNode(): RowNode | null;
isLastRowFound(): boolean;
isLastRowIndexKnown(): boolean;
getRowCount(): number;

@@ -64,3 +63,2 @@ getTopLevelRowCount(): number;

private isRowInPixel;
getCurrentPageHeight(): number;
forEachLeafNode(callback: (node: RowNode, index: number) => void): void;

@@ -67,0 +65,0 @@ forEachNode(callback: (node: RowNode, index: number) => void): void;

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

});
this.addManagedListener(this.eventService, Events.EVENT_COLUMN_EVERYTHING_CHANGED, refreshEverythingAfterColsChangedFunc);
this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, refreshEverythingAfterColsChangedFunc);
this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc);

@@ -191,3 +191,3 @@ this.addManagedListener(this.eventService, Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this));

};
ClientSideRowModel.prototype.isLastRowFound = function () {
ClientSideRowModel.prototype.isLastRowIndexKnown = function () {
return true;

@@ -292,3 +292,3 @@ };

// start = new Date().getTime();
this.doRowGrouping(params.groupState, params.rowNodeTransactions, params.rowNodeOrder, changedPath, params.afterColumnsChanged);
this.doRowGrouping(params.groupState, params.rowNodeTransactions, params.rowNodeOrder, changedPath, !!params.afterColumnsChanged);
// console.log('rowGrouping = ' + (new Date().getTime() - start));

@@ -431,10 +431,2 @@ case constants.STEP_FILTER:

};
ClientSideRowModel.prototype.getCurrentPageHeight = function () {
if (this.rowsToDisplay && this.rowsToDisplay.length > 0) {
var lastRow = _.last(this.rowsToDisplay);
var lastPixel = lastRow.rowTop + lastRow.rowHeight;
return lastPixel;
}
return 0;
};
ClientSideRowModel.prototype.forEachLeafNode = function (callback) {

@@ -648,5 +640,8 @@ if (this.rootNode.allLeafChildren) {

var rowNodeTrans = [];
// The rowGroup stage uses rowNodeOrder if order was provided. if we didn't pass 'true' to
// commonUpdateRowData, using addIndex would have no effect when grouping.
var forceRowNodeOrder = false;
if (this.rowDataTransactionBatch) {
this.rowDataTransactionBatch.forEach(function (tranItem) {
var rowNodeTran = _this.nodeManager.updateRowData(tranItem.rowDataTransaction, null);
var rowNodeTran = _this.nodeManager.updateRowData(tranItem.rowDataTransaction, undefined);
rowNodeTrans.push(rowNodeTran);

@@ -656,5 +651,8 @@ if (tranItem.callback) {

}
if (typeof tranItem.rowDataTransaction.addIndex === 'number') {
forceRowNodeOrder = true;
}
});
}
this.commonUpdateRowData(rowNodeTrans);
this.commonUpdateRowData(rowNodeTrans, undefined, forceRowNodeOrder);
// do callbacks in next VM turn so it's async

@@ -666,2 +664,11 @@ if (callbackFuncsBound.length > 0) {

}
if (rowNodeTrans.length > 0) {
var event_1 = {
api: this.gridOptionsWrapper.getApi(),
columnApi: this.gridOptionsWrapper.getColumnApi(),
type: Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,
results: rowNodeTrans
};
this.eventService.dispatchEvent(event_1);
}
this.rowDataTransactionBatch = null;

@@ -676,6 +683,4 @@ this.applyAsyncTransactionsTimeout = undefined;

// stage also uses the
if (typeof rowDataTran.addIndex === 'number') {
rowNodeOrder = this.createRowNodeOrder();
}
this.commonUpdateRowData([rowNodeTran], rowNodeOrder);
var forceRowNodeOrder = typeof rowDataTran.addIndex === 'number';
this.commonUpdateRowData([rowNodeTran], rowNodeOrder, forceRowNodeOrder);
return rowNodeTran;

@@ -688,3 +693,3 @@ };

}
var orderMap = suppressSortOrder ? null : {};
var orderMap = {};
if (this.rootNode && this.rootNode.allLeafChildren) {

@@ -699,3 +704,6 @@ for (var index = 0; index < this.rootNode.allLeafChildren.length; index++) {

// common to updateRowData and batchUpdateRowData
ClientSideRowModel.prototype.commonUpdateRowData = function (rowNodeTrans, rowNodeOrder) {
ClientSideRowModel.prototype.commonUpdateRowData = function (rowNodeTrans, rowNodeOrder, forceRowNodeOrder) {
if (forceRowNodeOrder) {
rowNodeOrder = this.createRowNodeOrder();
}
this.refreshModel({

@@ -740,5 +748,2 @@ step: Constants.STEP_EVERYTHING,

__decorate([
Autowired('gridOptionsWrapper')
], ClientSideRowModel.prototype, "gridOptionsWrapper", void 0);
__decorate([
Autowired('columnController')

@@ -745,0 +750,0 @@ ], ClientSideRowModel.prototype, "columnController", void 0);

import { ChangedPath, BeanStub } from "@ag-grid-community/core";
export declare class FilterService extends BeanStub {
private filterManager;
private gridOptionsWrapper;
private doingTreeData;

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

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

// the data passes the filter
var passBecauseDataPasses = childNode.data && _this.filterManager.doesRowPassFilter(childNode);
var passBecauseDataPasses = childNode.data
&& _this.filterManager.doesRowPassFilter({ rowNode: childNode });
// note - tree data nodes pass either if a) they pass themselves or b) any children of that node pass

@@ -71,3 +72,4 @@ return passBecauseChildren || passBecauseDataPasses;

// first check if current node passes filter before invoking child nodes
var foundInParent = alreadyFoundInParent || _this.filterManager.doesRowPassFilter(childNode);
var foundInParent = alreadyFoundInParent
|| _this.filterManager.doesRowPassFilter({ rowNode: childNode });
if (childNode.childrenAfterGroup) {

@@ -130,5 +132,2 @@ treeDataDepthFirstFilter_1(rowNode.childrenAfterGroup[i], foundInParent);

__decorate([
Autowired('gridOptionsWrapper')
], FilterService.prototype, "gridOptionsWrapper", void 0);
__decorate([
PostConstruct

@@ -135,0 +134,0 @@ ], FilterService.prototype, "postConstruct", null);

import { IRowNodeStage, StageExecuteParams, BeanStub } from "@ag-grid-community/core";
export declare class FilterStage extends BeanStub implements IRowNodeStage {
private gridOptionsWrapper;
private selectableService;

@@ -5,0 +4,0 @@ private filterService;

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

__decorate([
Autowired('gridOptionsWrapper')
], FilterStage.prototype, "gridOptionsWrapper", void 0);
__decorate([
Autowired('selectableService')

@@ -37,0 +34,0 @@ ], FilterStage.prototype, "selectableService", void 0);

import { BeanStub, IRowNodeStage, RowNode, StageExecuteParams } from "@ag-grid-community/core";
export declare class FlattenStage extends BeanStub implements IRowNodeStage {
private gridOptionsWrapper;
private selectionController;

@@ -5,0 +4,0 @@ private columnController;

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

__decorate([
Autowired('gridOptionsWrapper')
], FlattenStage.prototype, "gridOptionsWrapper", void 0);
__decorate([
Autowired('selectionController')

@@ -158,0 +155,0 @@ ], FlattenStage.prototype, "selectionController", void 0);

import { IImmutableService, RowDataTransaction, BeanStub } from "@ag-grid-community/core";
export declare class ImmutableService extends BeanStub implements IImmutableService {
private rowModel;
private gridOptionsWrapper;
private clientSideRowModel;

@@ -9,3 +8,3 @@ private postConstruct;

[id: string]: number;
}]) | undefined;
} | null]) | undefined;
}

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

__decorate([
Autowired('gridOptionsWrapper')
], ImmutableService.prototype, "gridOptionsWrapper", void 0);
__decorate([
PostConstruct

@@ -93,0 +90,0 @@ ], ImmutableService.prototype, "postConstruct", null);

@@ -1,15 +0,5 @@

import { ChangedPath, Column, RowNode, BeanStub } from "@ag-grid-community/core";
export interface SortOption {
inverter: number;
column: Column;
}
export interface SortedRowNode {
currentPos: number;
rowNode: RowNode;
}
import { SortOption, ChangedPath, BeanStub } from "@ag-grid-community/core";
export declare class SortService extends BeanStub {
private sortController;
private columnController;
private valueService;
private gridOptionsWrapper;
private rowNodeSorter;
private postSortFunc;

@@ -19,9 +9,6 @@ init(): void;

[nodeId: string]: boolean;
}, changedPath: ChangedPath, noAggregations: boolean): void;
private doFullSort;
} | null, changedPath: ChangedPath | undefined, noAggregations: boolean): void;
private mapNodeToSortedNode;
private doDeltaSort;
private mergeSortedArrays;
private compareRowNodes;
private getValue;
private updateChildIndexes;

@@ -28,0 +15,0 @@ private updateGroupDataForHiddenOpenParents;

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

if (sortActive) {
var sortedRowNodes = deltaSort ?
rowNode.childrenAfterSort = deltaSort ?
_this.doDeltaSort(rowNode, sortOptions, dirtyLeafNodes, changedPath, noAggregations)
: _this.doFullSort(rowNode, sortOptions);
rowNode.childrenAfterSort = sortedRowNodes.map(function (sorted) { return sorted.rowNode; });
: _this.rowNodeSorter.doFullSort(rowNode.childrenAfterFilter, sortOptions);
}

@@ -52,11 +51,7 @@ else {

};
changedPath.forEachChangedNodeDepthFirst(callback);
if (changedPath) {
changedPath.forEachChangedNodeDepthFirst(callback);
}
this.updateGroupDataForHiddenOpenParents(changedPath);
};
SortService.prototype.doFullSort = function (rowNode, sortOptions) {
var sortedRowNodes = rowNode.childrenAfterFilter
.map(this.mapNodeToSortedNode.bind(this));
sortedRowNodes.sort(this.compareRowNodes.bind(this, sortOptions));
return sortedRowNodes;
};
SortService.prototype.mapNodeToSortedNode = function (rowNode, pos) {

@@ -71,3 +66,3 @@ return { currentPos: pos, rowNode: rowNode };

var cleanNodes = rowNode.childrenAfterSort
.filter(function (rowNode) {
.filter(function (node) {
// take out all nodes that were changed as part of the current transaction.

@@ -77,3 +72,3 @@ // a changed node could a) be in a different sort position or b) may

// or be in a different group.
var passesDirtyNodesCheck = !dirtyLeafNodes[rowNode.id];
var passesDirtyNodesCheck = !dirtyLeafNodes[node.id];
// also remove group nodes in the changed path, as they can have different aggregate

@@ -84,3 +79,3 @@ // values which could impact the sort order.

// there is no value in the group that could of changed (ie no aggregate values)
var passesChangedPathCheck = noAggregations || changedPath.canSkip(rowNode);
var passesChangedPathCheck = noAggregations || (changedPath && changedPath.canSkip(node));
return passesDirtyNodesCheck && passesChangedPathCheck;

@@ -95,16 +90,18 @@ })

// ignore nodes in the clean list
.filter(function (rowNode) { return !cleanNodesMapped[rowNode.id]; })
.filter(function (node) { return !cleanNodesMapped[node.id]; })
.map(this.mapNodeToSortedNode.bind(this));
// sort changed nodes. note that we don't need to sort cleanNodes as they are
// already sorted from last time.
changedNodes.sort(this.compareRowNodes.bind(this, sortOptions));
changedNodes.sort(this.rowNodeSorter.compareRowNodes.bind(this, sortOptions));
var result;
if (changedNodes.length === 0) {
return cleanNodes;
result = cleanNodes;
}
else if (cleanNodes.length === 0) {
return changedNodes;
result = changedNodes;
}
else {
return this.mergeSortedArrays(sortOptions, cleanNodes, changedNodes);
result = this.mergeSortedArrays(sortOptions, cleanNodes, changedNodes);
}
return result.map(function (item) { return item.rowNode; });
};

@@ -123,3 +120,3 @@ // Merge two sorted arrays into each other

// index. Otherwise do same with second array
var compareResult = this.compareRowNodes(sortOptions, arr1[i], arr2[j]);
var compareResult = this.rowNodeSorter.compareRowNodes(sortOptions, arr1[i], arr2[j]);
if (compareResult < 0) {

@@ -142,32 +139,2 @@ res.push(arr1[i++]);

};
SortService.prototype.compareRowNodes = function (sortOptions, sortedNodeA, sortedNodeB) {
var nodeA = sortedNodeA.rowNode;
var nodeB = sortedNodeB.rowNode;
// Iterate columns, return the first that doesn't match
for (var i = 0, len = sortOptions.length; i < len; i++) {
var sortOption = sortOptions[i];
// let compared = compare(nodeA, nodeB, sortOption.column, sortOption.inverter === -1);
var isInverted = sortOption.inverter === -1;
var valueA = this.getValue(nodeA, sortOption.column);
var valueB = this.getValue(nodeB, sortOption.column);
var comparatorResult = void 0;
var providedComparator = sortOption.column.getColDef().comparator;
if (providedComparator) {
//if comparator provided, use it
comparatorResult = providedComparator(valueA, valueB, nodeA, nodeB, isInverted);
}
else {
//otherwise do our own comparison
comparatorResult = _.defaultComparator(valueA, valueB, this.gridOptionsWrapper.isAccentedSort());
}
if (comparatorResult !== 0) {
return comparatorResult * sortOption.inverter;
}
}
// All matched, we make is so that the original sort order is kept:
return sortedNodeA.currentPos - sortedNodeB.currentPos;
};
SortService.prototype.getValue = function (nodeA, column) {
return this.valueService.getValue(column, nodeA);
};
SortService.prototype.updateChildIndexes = function (rowNode) {

@@ -201,12 +168,11 @@ if (_.missing(rowNode.childrenAfterSort)) {

};
changedPath.executeFromRootNode(function (rowNode) { return callback(rowNode); });
if (changedPath) {
changedPath.executeFromRootNode(function (rowNode) { return callback(rowNode); });
}
};
SortService.prototype.pullDownGroupDataForHideOpenParents = function (rowNodes, clearOperation) {
var _this = this;
if (_.missing(rowNodes)) {
if (!this.gridOptionsWrapper.isGroupHideOpenParents() || _.missing(rowNodes)) {
return;
}
if (!this.gridOptionsWrapper.isGroupHideOpenParents()) {
return;
}
rowNodes.forEach(function (childRowNode) {

@@ -241,14 +207,8 @@ var groupDisplayCols = _this.columnController.getGroupDisplayColumns();

__decorate([
Autowired('sortController')
], SortService.prototype, "sortController", void 0);
__decorate([
Autowired('columnController')
], SortService.prototype, "columnController", void 0);
__decorate([
Autowired('valueService')
], SortService.prototype, "valueService", void 0);
Autowired('rowNodeSorter')
], SortService.prototype, "rowNodeSorter", void 0);
__decorate([
Autowired('gridOptionsWrapper')
], SortService.prototype, "gridOptionsWrapper", void 0);
__decorate([
PostConstruct

@@ -255,0 +215,0 @@ ], SortService.prototype, "init", null);

import { StageExecuteParams, BeanStub } from "@ag-grid-community/core";
export declare class SortStage extends BeanStub {
private gridOptionsWrapper;
private sortService;

@@ -5,0 +4,0 @@ private sortController;

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

SortStage.prototype.execute = function (params) {
var sortOptions = this.sortController.getSortForRowController();
var sortOptions = this.sortController.getSortOptions();
var sortActive = _.exists(sortOptions) && sortOptions.length > 0;

@@ -51,13 +51,12 @@ var deltaSort = sortActive

// all leaf level nodes in the transaction were impacted
rowNodeTransactions.forEach(function (tran) {
addNodesFunc(tran.add);
addNodesFunc(tran.update);
addNodesFunc(tran.remove);
});
if (rowNodeTransactions) {
rowNodeTransactions.forEach(function (tran) {
addNodesFunc(tran.add);
addNodesFunc(tran.update);
addNodesFunc(tran.remove);
});
}
return dirtyNodes;
};
__decorate([
Autowired('gridOptionsWrapper')
], SortStage.prototype, "gridOptionsWrapper", void 0);
__decorate([
Autowired('sortService')

@@ -64,0 +63,0 @@ ], SortStage.prototype, "sortService", void 0);

{
"name": "@ag-grid-community/client-side-row-model",
"version": "24.1.0",
"version": "25.0.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": "~24.1.0"
"@ag-grid-community/core": "~25.0.0"
},

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

@@ -10,3 +10,3 @@ ![alt text](./github-banner.png "ag-Grid")

ag-Grid is a fully-featured and highly customizable JavaScript data grid.
It delivers [outstanding performance](https://www.ag-grid.com/example.php?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github#/performance/1), has no third-party dependencies and [integrates smoothly with all major JavaScript frameworks](https://www.ag-grid.com/javascript-grid-getting-started/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github).
It delivers [outstanding performance](https://www.ag-grid.com/example.php?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github#/performance/1), has no third-party dependencies and [integrates smoothly with all major JavaScript frameworks](https://www.ag-grid.com/documentation/javascript/getting-started/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github).

@@ -50,11 +50,10 @@ Here's how our grid looks with multiple filters and grouping enabled:

Check out the [developer documentation](https://www.ag-grid.com/documentation-main/documentation.php?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github) for a complete list of features or visit [our official docs](https://www.ag-grid.com/features-overview?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github) for tutorials and feature demos.
Check out the [developer documentation](https://www.ag-grid.com/documentation/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github) for a complete list of features or visit [our official docs](https://www.ag-grid.com/features-overview/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github) for tutorials and feature demos.
## Looking for a framework specific solution?
* [Get Started with Angular](https://www.ag-grid.com/angular-grid/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)
* [Get Started with React](https://www.ag-grid.com/react-grid/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)
* [Get Started with Vue](https://www.ag-grid.com/vue-getting-started/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)
* [Get Started with WebComponents](https://www.ag-grid.com/best-web-component-data-grid/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)
* [Get Started with AngularJS](https://www.ag-grid.com/best-angularjs-grid/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)
* [Get Started with Angular](https://www.ag-grid.com/documentation/angular/getting-started/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)
* [Get Started with React](https://www.ag-grid.com/documentation/react/getting-started/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)
* [Get Started with Vue](https://www.ag-grid.com/documentation/vue/getting-started/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)
* [Get Started with AngularJS](https://www.ag-grid.com/documentation/angular/angularjs/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github)

@@ -108,3 +107,3 @@ ## Getting started

For more information on how to integrate the grid into your project see [TypeScript - Building with Webpack 2](https://www.ag-grid.com/ag-grid-building-typescript/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github).
For more information on how to integrate the grid into your project see [TypeScript - Building with Webpack 2](https://www.ag-grid.com/documentation/javascript/building-typescript/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github).

@@ -111,0 +110,0 @@ ## Issue Reporting

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 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 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

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