@ag-grid-community/client-side-row-model
Advanced tools
Comparing version 25.1.0 to 25.2.0
@@ -33,3 +33,2 @@ import { ColumnApi, ColumnController, Context, EventService, GridApi, GridOptionsWrapper, RowDataTransaction, RowNode, RowNodeTransaction, SelectionController } from "@ag-grid-community/core"; | ||
private executeUpdate; | ||
private addRowNode; | ||
private lookupRowNode; | ||
@@ -40,3 +39,2 @@ private recursiveFunction; | ||
private isExpanded; | ||
private setLeafChildren; | ||
} |
"use strict"; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -103,16 +110,19 @@ var core_1 = require("@ag-grid-community/core"); | ||
} | ||
// create new row nodes for each data item | ||
var newNodes = add.map(function (item) { return _this.createNode(item, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); }); | ||
// add new row nodes to the root nodes 'allLeafChildren' | ||
var useIndex = typeof addIndex === 'number' && addIndex >= 0; | ||
if (useIndex) { | ||
// items get inserted in reverse order for index insertion | ||
add.reverse().forEach(function (item) { | ||
var newRowNode = _this.addRowNode(item, addIndex); | ||
rowNodeTransaction.add.push(newRowNode); | ||
}); | ||
// new rows are inserted in one go by concatenating them in between the existing rows at the desired index. | ||
// this is much faster than splicing them individually into 'allLeafChildren' when there are large inserts. | ||
var existingLeafChildren = this.rootNode.allLeafChildren; | ||
var nodesBeforeIndex = existingLeafChildren.slice(0, addIndex); | ||
var nodesAfterIndex = existingLeafChildren.slice(addIndex, existingLeafChildren.length); | ||
this.rootNode.allLeafChildren = __spreadArrays(nodesBeforeIndex, newNodes, nodesAfterIndex); | ||
} | ||
else { | ||
add.forEach(function (item) { | ||
var newRowNode = _this.addRowNode(item); | ||
rowNodeTransaction.add.push(newRowNode); | ||
}); | ||
this.rootNode.allLeafChildren = __spreadArrays(this.rootNode.allLeafChildren, newNodes); | ||
} | ||
// add new row nodes to the transaction add items | ||
rowNodeTransaction.add = newNodes; | ||
}; | ||
@@ -166,12 +176,2 @@ ClientSideNodeManager.prototype.executeRemove = function (rowDataTran, rowNodeTransaction, nodesToUnselect) { | ||
}; | ||
ClientSideNodeManager.prototype.addRowNode = function (data, index) { | ||
var newNode = this.createNode(data, this.rootNode, ClientSideNodeManager.TOP_LEVEL); | ||
if (core_1._.exists(index)) { | ||
core_1._.insertIntoArray(this.rootNode.allLeafChildren, newNode, index); | ||
} | ||
else { | ||
this.rootNode.allLeafChildren.push(newNode); | ||
} | ||
return newNode; | ||
}; | ||
ClientSideNodeManager.prototype.lookupRowNode = function (data) { | ||
@@ -268,18 +268,2 @@ var rowNodeIdFunc = this.gridOptionsWrapper.getRowNodeIdFunc(); | ||
}; | ||
// this is only used for doing legacy tree data | ||
ClientSideNodeManager.prototype.setLeafChildren = function (node) { | ||
node.allLeafChildren = []; | ||
if (node.childrenAfterGroup) { | ||
node.childrenAfterGroup.forEach(function (childAfterGroup) { | ||
if (childAfterGroup.group) { | ||
if (childAfterGroup.allLeafChildren) { | ||
childAfterGroup.allLeafChildren.forEach(function (leafChild) { return node.allLeafChildren.push(leafChild); }); | ||
} | ||
} | ||
else { | ||
node.allLeafChildren.push(childAfterGroup); | ||
} | ||
}); | ||
} | ||
}; | ||
ClientSideNodeManager.TOP_LEVEL = 0; | ||
@@ -286,0 +270,0 @@ ClientSideNodeManager.ROOT_NODE_ID = 'ROOT_NODE_ID'; |
@@ -11,6 +11,4 @@ import { BeanStub, ChangedPath, IClientSideRowModel, RefreshModelParams, RowBounds, RowDataTransaction, RowNode, RowNodeTransaction } from "@ag-grid-community/core"; | ||
private columnController; | ||
private filterManager; | ||
private $scope; | ||
private selectionController; | ||
private valueService; | ||
private valueCache; | ||
@@ -17,0 +15,0 @@ private columnApi; |
@@ -115,25 +115,35 @@ "use strict"; | ||
}; | ||
ClientSideRowModel.prototype.resetRowTops = function (rowNode, changedPath) { | ||
rowNode.clearRowTopAndRowIndex(); | ||
if (rowNode.hasChildren()) { | ||
if (rowNode.childrenAfterGroup) { | ||
// if a changedPath is active, it means we are here because of a transaction update or | ||
// a change detection. neither of these impacts the open/closed state of groups. so if | ||
// a group is not open this time, it was not open last time. so we know all closed groups | ||
// already have their top positions cleared. so there is no need to traverse all the way | ||
// when changedPath is active and the rowNode is not expanded. | ||
var skipChildren = changedPath.isActive() && !rowNode.expanded; | ||
if (!skipChildren) { | ||
for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) { | ||
this.resetRowTops(rowNode.childrenAfterGroup[i], changedPath); | ||
ClientSideRowModel.prototype.resetRowTops = function (changedPath) { | ||
var displayedRowsMapped = {}; | ||
this.rowsToDisplay.forEach(function (rowNode) { | ||
if (rowNode.id != null) { | ||
displayedRowsMapped[rowNode.id] = rowNode; | ||
} | ||
}); | ||
var clearIfNotDisplayed = function (rowNode) { | ||
if (rowNode && rowNode.id != null && displayedRowsMapped[rowNode.id] == null) { | ||
rowNode.clearRowTopAndRowIndex(); | ||
} | ||
}; | ||
var recurse = function (rowNode) { | ||
clearIfNotDisplayed(rowNode); | ||
clearIfNotDisplayed(rowNode.detailNode); | ||
clearIfNotDisplayed(rowNode.sibling); | ||
if (rowNode.hasChildren()) { | ||
if (rowNode.childrenAfterGroup) { | ||
// if a changedPath is active, it means we are here because of a transaction update or | ||
// a change detection. neither of these impacts the open/closed state of groups. so if | ||
// a group is not open this time, it was not open last time. so we know all closed groups | ||
// already have their top positions cleared. so there is no need to traverse all the way | ||
// when changedPath is active and the rowNode is not expanded. | ||
var skipChildren = changedPath.isActive() && !rowNode.expanded; | ||
if (!skipChildren) { | ||
for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) { | ||
recurse(rowNode.childrenAfterGroup[i]); | ||
} | ||
} | ||
} | ||
} | ||
if (rowNode.sibling) { | ||
rowNode.sibling.clearRowTopAndRowIndex(); | ||
} | ||
} | ||
if (rowNode.detailNode) { | ||
rowNode.detailNode.clearRowTopAndRowIndex(); | ||
} | ||
}; | ||
recurse(this.rootNode); | ||
}; | ||
@@ -354,4 +364,4 @@ // returns false if row was moved, otherwise true | ||
// will still lie around | ||
this.resetRowTops(this.rootNode, changedPath); | ||
this.setRowTops(); | ||
this.resetRowTops(changedPath); | ||
var event = { | ||
@@ -782,5 +792,2 @@ type: core_1.Events.EVENT_MODEL_UPDATED, | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
], ClientSideRowModel.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('$scope') | ||
@@ -792,5 +799,2 @@ ], ClientSideRowModel.prototype, "$scope", void 0); | ||
__decorate([ | ||
core_1.Autowired('valueService') | ||
], ClientSideRowModel.prototype, "valueService", void 0); | ||
__decorate([ | ||
core_1.Autowired('valueCache') | ||
@@ -797,0 +801,0 @@ ], ClientSideRowModel.prototype, "valueCache", void 0); |
import { BeanStub, IRowNodeStage, RowNode, StageExecuteParams } from "@ag-grid-community/core"; | ||
export declare class FlattenStage extends BeanStub implements IRowNodeStage { | ||
private selectionController; | ||
private columnController; | ||
@@ -5,0 +4,0 @@ execute(params: StageExecuteParams): RowNode[]; |
@@ -158,5 +158,2 @@ "use strict"; | ||
__decorate([ | ||
core_1.Autowired('selectionController') | ||
], FlattenStage.prototype, "selectionController", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnController') | ||
@@ -163,0 +160,0 @@ ], FlattenStage.prototype, "columnController", void 0); |
@@ -33,3 +33,2 @@ import { ColumnApi, ColumnController, Context, EventService, GridApi, GridOptionsWrapper, RowDataTransaction, RowNode, RowNodeTransaction, SelectionController } from "@ag-grid-community/core"; | ||
private executeUpdate; | ||
private addRowNode; | ||
private lookupRowNode; | ||
@@ -40,3 +39,2 @@ private recursiveFunction; | ||
private isExpanded; | ||
private setLeafChildren; | ||
} |
@@ -0,1 +1,8 @@ | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
import { _, Events, RowNode } from "@ag-grid-community/core"; | ||
@@ -101,16 +108,19 @@ var ClientSideNodeManager = /** @class */ (function () { | ||
} | ||
// create new row nodes for each data item | ||
var newNodes = add.map(function (item) { return _this.createNode(item, _this.rootNode, ClientSideNodeManager.TOP_LEVEL); }); | ||
// add new row nodes to the root nodes 'allLeafChildren' | ||
var useIndex = typeof addIndex === 'number' && addIndex >= 0; | ||
if (useIndex) { | ||
// items get inserted in reverse order for index insertion | ||
add.reverse().forEach(function (item) { | ||
var newRowNode = _this.addRowNode(item, addIndex); | ||
rowNodeTransaction.add.push(newRowNode); | ||
}); | ||
// new rows are inserted in one go by concatenating them in between the existing rows at the desired index. | ||
// this is much faster than splicing them individually into 'allLeafChildren' when there are large inserts. | ||
var existingLeafChildren = this.rootNode.allLeafChildren; | ||
var nodesBeforeIndex = existingLeafChildren.slice(0, addIndex); | ||
var nodesAfterIndex = existingLeafChildren.slice(addIndex, existingLeafChildren.length); | ||
this.rootNode.allLeafChildren = __spreadArrays(nodesBeforeIndex, newNodes, nodesAfterIndex); | ||
} | ||
else { | ||
add.forEach(function (item) { | ||
var newRowNode = _this.addRowNode(item); | ||
rowNodeTransaction.add.push(newRowNode); | ||
}); | ||
this.rootNode.allLeafChildren = __spreadArrays(this.rootNode.allLeafChildren, newNodes); | ||
} | ||
// add new row nodes to the transaction add items | ||
rowNodeTransaction.add = newNodes; | ||
}; | ||
@@ -164,12 +174,2 @@ ClientSideNodeManager.prototype.executeRemove = function (rowDataTran, rowNodeTransaction, nodesToUnselect) { | ||
}; | ||
ClientSideNodeManager.prototype.addRowNode = function (data, index) { | ||
var newNode = this.createNode(data, this.rootNode, ClientSideNodeManager.TOP_LEVEL); | ||
if (_.exists(index)) { | ||
_.insertIntoArray(this.rootNode.allLeafChildren, newNode, index); | ||
} | ||
else { | ||
this.rootNode.allLeafChildren.push(newNode); | ||
} | ||
return newNode; | ||
}; | ||
ClientSideNodeManager.prototype.lookupRowNode = function (data) { | ||
@@ -266,18 +266,2 @@ var rowNodeIdFunc = this.gridOptionsWrapper.getRowNodeIdFunc(); | ||
}; | ||
// this is only used for doing legacy tree data | ||
ClientSideNodeManager.prototype.setLeafChildren = function (node) { | ||
node.allLeafChildren = []; | ||
if (node.childrenAfterGroup) { | ||
node.childrenAfterGroup.forEach(function (childAfterGroup) { | ||
if (childAfterGroup.group) { | ||
if (childAfterGroup.allLeafChildren) { | ||
childAfterGroup.allLeafChildren.forEach(function (leafChild) { return node.allLeafChildren.push(leafChild); }); | ||
} | ||
} | ||
else { | ||
node.allLeafChildren.push(childAfterGroup); | ||
} | ||
}); | ||
} | ||
}; | ||
ClientSideNodeManager.TOP_LEVEL = 0; | ||
@@ -284,0 +268,0 @@ ClientSideNodeManager.ROOT_NODE_ID = 'ROOT_NODE_ID'; |
@@ -11,6 +11,4 @@ import { BeanStub, ChangedPath, IClientSideRowModel, RefreshModelParams, RowBounds, RowDataTransaction, RowNode, RowNodeTransaction } from "@ag-grid-community/core"; | ||
private columnController; | ||
private filterManager; | ||
private $scope; | ||
private selectionController; | ||
private valueService; | ||
private valueCache; | ||
@@ -17,0 +15,0 @@ private columnApi; |
@@ -113,25 +113,35 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
ClientSideRowModel.prototype.resetRowTops = function (rowNode, changedPath) { | ||
rowNode.clearRowTopAndRowIndex(); | ||
if (rowNode.hasChildren()) { | ||
if (rowNode.childrenAfterGroup) { | ||
// if a changedPath is active, it means we are here because of a transaction update or | ||
// a change detection. neither of these impacts the open/closed state of groups. so if | ||
// a group is not open this time, it was not open last time. so we know all closed groups | ||
// already have their top positions cleared. so there is no need to traverse all the way | ||
// when changedPath is active and the rowNode is not expanded. | ||
var skipChildren = changedPath.isActive() && !rowNode.expanded; | ||
if (!skipChildren) { | ||
for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) { | ||
this.resetRowTops(rowNode.childrenAfterGroup[i], changedPath); | ||
ClientSideRowModel.prototype.resetRowTops = function (changedPath) { | ||
var displayedRowsMapped = {}; | ||
this.rowsToDisplay.forEach(function (rowNode) { | ||
if (rowNode.id != null) { | ||
displayedRowsMapped[rowNode.id] = rowNode; | ||
} | ||
}); | ||
var clearIfNotDisplayed = function (rowNode) { | ||
if (rowNode && rowNode.id != null && displayedRowsMapped[rowNode.id] == null) { | ||
rowNode.clearRowTopAndRowIndex(); | ||
} | ||
}; | ||
var recurse = function (rowNode) { | ||
clearIfNotDisplayed(rowNode); | ||
clearIfNotDisplayed(rowNode.detailNode); | ||
clearIfNotDisplayed(rowNode.sibling); | ||
if (rowNode.hasChildren()) { | ||
if (rowNode.childrenAfterGroup) { | ||
// if a changedPath is active, it means we are here because of a transaction update or | ||
// a change detection. neither of these impacts the open/closed state of groups. so if | ||
// a group is not open this time, it was not open last time. so we know all closed groups | ||
// already have their top positions cleared. so there is no need to traverse all the way | ||
// when changedPath is active and the rowNode is not expanded. | ||
var skipChildren = changedPath.isActive() && !rowNode.expanded; | ||
if (!skipChildren) { | ||
for (var i = 0; i < rowNode.childrenAfterGroup.length; i++) { | ||
recurse(rowNode.childrenAfterGroup[i]); | ||
} | ||
} | ||
} | ||
} | ||
if (rowNode.sibling) { | ||
rowNode.sibling.clearRowTopAndRowIndex(); | ||
} | ||
} | ||
if (rowNode.detailNode) { | ||
rowNode.detailNode.clearRowTopAndRowIndex(); | ||
} | ||
}; | ||
recurse(this.rootNode); | ||
}; | ||
@@ -352,4 +362,4 @@ // returns false if row was moved, otherwise true | ||
// will still lie around | ||
this.resetRowTops(this.rootNode, changedPath); | ||
this.setRowTops(); | ||
this.resetRowTops(changedPath); | ||
var event = { | ||
@@ -780,5 +790,2 @@ type: Events.EVENT_MODEL_UPDATED, | ||
__decorate([ | ||
Autowired('filterManager') | ||
], ClientSideRowModel.prototype, "filterManager", void 0); | ||
__decorate([ | ||
Autowired('$scope') | ||
@@ -790,5 +797,2 @@ ], ClientSideRowModel.prototype, "$scope", void 0); | ||
__decorate([ | ||
Autowired('valueService') | ||
], ClientSideRowModel.prototype, "valueService", void 0); | ||
__decorate([ | ||
Autowired('valueCache') | ||
@@ -795,0 +799,0 @@ ], ClientSideRowModel.prototype, "valueCache", void 0); |
import { BeanStub, IRowNodeStage, RowNode, StageExecuteParams } from "@ag-grid-community/core"; | ||
export declare class FlattenStage extends BeanStub implements IRowNodeStage { | ||
private selectionController; | ||
private columnController; | ||
@@ -5,0 +4,0 @@ execute(params: StageExecuteParams): RowNode[]; |
@@ -156,5 +156,2 @@ var __extends = (this && this.__extends) || (function () { | ||
__decorate([ | ||
Autowired('selectionController') | ||
], FlattenStage.prototype, "selectionController", void 0); | ||
__decorate([ | ||
Autowired('columnController') | ||
@@ -161,0 +158,0 @@ ], FlattenStage.prototype, "columnController", void 0); |
{ | ||
"name": "@ag-grid-community/client-side-row-model", | ||
"version": "25.1.0", | ||
"version": "25.2.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": "~25.1.0" | ||
"@ag-grid-community/core": "~25.2.0" | ||
}, | ||
@@ -48,0 +48,0 @@ "devDependencies": { |
@@ -10,3 +10,3 @@  | ||
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), 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). | ||
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), 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). | ||
@@ -54,6 +54,6 @@ Here's how our grid looks with multiple filters and grouping enabled: | ||
* [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) | ||
* [Get Started with Angular](https://www.ag-grid.com/angular-grid/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/react-grid/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/vue-grid/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/angular-grid/angularjs/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github) | ||
@@ -107,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/documentation/javascript/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/javascript-grid/building-typescript/?utm_source=@ag-grid-community/client-side-row-model-readme&utm_medium=repository&utm_campaign=github). | ||
@@ -110,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 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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
6624376
100784
+ Added@ag-grid-community/core@25.2.0(transitive)
- Removed@ag-grid-community/core@25.1.0(transitive)