@ag-grid-community/client-side-row-model
Advanced tools
Comparing version 23.0.2 to 23.1.0
@@ -32,3 +32,6 @@ import { ChangedPath, RefreshModelParams, RowBounds, RowDataTransaction, RowNode, RowNodeTransaction, IClientSideRowModel } from "@ag-grid-community/core"; | ||
private lastHighlightedRow; | ||
private events; | ||
private refreshMapFunc; | ||
init(): void; | ||
destroy(): void; | ||
start(): void; | ||
@@ -40,2 +43,3 @@ ensureRowHeightsValid(startPixel: number, endPixel: number, startLimitIndex: number, endLimitIndex: number): boolean; | ||
highlightRowAtPixel(rowNode: RowNode | null, pixel?: number): void; | ||
getHighlightPosition(pixel: number, rowNode?: RowNode): 'above' | 'below'; | ||
getLastHighlightedRowNode(): RowNode | null; | ||
@@ -65,7 +69,7 @@ isLastRowFound(): boolean; | ||
getCurrentPageHeight(): number; | ||
forEachLeafNode(callback: Function): void; | ||
forEachNode(callback: Function): void; | ||
forEachNodeAfterFilter(callback: Function): void; | ||
forEachNodeAfterFilterAndSort(callback: Function): void; | ||
forEachPivotNode(callback: Function): void; | ||
forEachLeafNode(callback: (node: RowNode, index: number) => void): void; | ||
forEachNode(callback: (node: RowNode, index: number) => void): void; | ||
forEachNodeAfterFilter(callback: (node: RowNode, index: number) => void): void; | ||
forEachNodeAfterFilterAndSort(callback: (node: RowNode, index: number) => void): void; | ||
forEachPivotNode(callback: (node: RowNode, index: number) => void): void; | ||
private recursivelyWalkNodesAndCallback; | ||
@@ -72,0 +76,0 @@ doAggregate(changedPath?: ChangedPath): void; |
@@ -20,2 +20,3 @@ "use strict"; | ||
function ClientSideRowModel() { | ||
this.events = []; | ||
} | ||
@@ -25,11 +26,13 @@ ClientSideRowModel.prototype.init = function () { | ||
var refreshEverythingAfterColsChangedFunc = this.refreshModel.bind(this, { step: core_1.Constants.STEP_EVERYTHING, afterColumnsChanged: true }); | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_EVERYTHING_CHANGED, refreshEverythingAfterColsChangedFunc); | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc); | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this)); | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_PIVOT_CHANGED, this.refreshModel.bind(this, { step: core_1.Constants.STEP_PIVOT })); | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_ROW_GROUP_OPENED, this.onRowGroupOpened.bind(this)); | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)); | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this)); | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, refreshEverythingFunc); | ||
var refreshMapFunc = this.refreshModel.bind(this, { | ||
this.events = [ | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_EVERYTHING_CHANGED, refreshEverythingAfterColsChangedFunc), | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc), | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this)), | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_PIVOT_CHANGED, this.refreshModel.bind(this, { step: core_1.Constants.STEP_PIVOT })), | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_ROW_GROUP_OPENED, this.onRowGroupOpened.bind(this)), | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)), | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this)), | ||
this.eventService.addModalPriorityEventListener(core_1.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, refreshEverythingFunc) | ||
]; | ||
this.refreshMapFunc = this.refreshModel.bind(this, { | ||
step: core_1.Constants.STEP_MAP, | ||
@@ -39,4 +42,4 @@ keepRenderedRows: true, | ||
}); | ||
this.gridOptionsWrapper.addEventListener(core_1.GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, refreshMapFunc); | ||
this.gridOptionsWrapper.addEventListener(core_1.GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, refreshMapFunc); | ||
this.gridOptionsWrapper.addEventListener(core_1.GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, this.refreshMapFunc); | ||
this.gridOptionsWrapper.addEventListener(core_1.GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, this.refreshMapFunc); | ||
this.rootNode = new core_1.RowNode(); | ||
@@ -46,2 +49,10 @@ this.nodeManager = new clientSideNodeManager_1.ClientSideNodeManager(this.rootNode, this.gridOptionsWrapper, this.context, this.eventService, this.columnController, this.gridApi, this.columnApi, this.selectionController); | ||
}; | ||
ClientSideRowModel.prototype.destroy = function () { | ||
if (this.events.length) { | ||
this.events.forEach(function (func) { return func(); }); | ||
this.events = []; | ||
} | ||
this.gridOptionsWrapper.removeEventListener(core_1.GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, this.refreshMapFunc); | ||
this.gridOptionsWrapper.removeEventListener(core_1.GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, this.refreshMapFunc); | ||
}; | ||
ClientSideRowModel.prototype.start = function () { | ||
@@ -147,3 +158,3 @@ var rowData = this.gridOptionsWrapper.getRowData(); | ||
var rowNodeAtPixelNow = indexAtPixelNow != null ? this.getRow(indexAtPixelNow) : null; | ||
if (rowNodeAtPixelNow === rowNode || !rowNode || pixel == null) { | ||
if (!rowNodeAtPixelNow || !rowNode || rowNodeAtPixelNow === rowNode || pixel == null) { | ||
if (this.lastHighlightedRow) { | ||
@@ -155,4 +166,3 @@ this.lastHighlightedRow.setHighlighted(null); | ||
} | ||
var rowTop = rowNodeAtPixelNow.rowTop, rowHeight = rowNodeAtPixelNow.rowHeight; | ||
var highlight = pixel - rowTop < rowHeight / 2 ? 'above' : 'below'; | ||
var highlight = this.getHighlightPosition(pixel, rowNodeAtPixelNow); | ||
if (this.lastHighlightedRow && this.lastHighlightedRow !== rowNodeAtPixelNow) { | ||
@@ -165,2 +175,13 @@ this.lastHighlightedRow.setHighlighted(null); | ||
}; | ||
ClientSideRowModel.prototype.getHighlightPosition = function (pixel, rowNode) { | ||
if (!rowNode) { | ||
var index = this.getRowIndexAtPixel(pixel); | ||
rowNode = this.getRow(index || 0); | ||
if (!rowNode) { | ||
return 'below'; | ||
} | ||
} | ||
var rowTop = rowNode.rowTop, rowHeight = rowNode.rowHeight; | ||
return pixel - rowTop < rowHeight / 2 ? 'above' : 'below'; | ||
}; | ||
ClientSideRowModel.prototype.getLastHighlightedRowNode = function () { | ||
@@ -401,3 +422,3 @@ return this.lastHighlightedRow; | ||
} | ||
else if (currentRowNode.rowTop < pixelToMatch) { | ||
if (currentRowNode.rowTop < pixelToMatch) { | ||
bottomPointer = midPointer + 1; | ||
@@ -628,3 +649,3 @@ } | ||
this.rowDataTransactionBatch = []; | ||
var waitMillis = this.gridOptionsWrapper.getBatchUpdateWaitMillis(); | ||
var waitMillis = this.gridOptionsWrapper.getAsyncTransactionWaitMillis(); | ||
window.setTimeout(function () { | ||
@@ -746,2 +767,5 @@ _this.executeBatchUpdateRowData(); | ||
], ClientSideRowModel.prototype, "init", null); | ||
__decorate([ | ||
core_1.PreDestroy | ||
], ClientSideRowModel.prototype, "destroy", null); | ||
ClientSideRowModel = __decorate([ | ||
@@ -748,0 +772,0 @@ core_1.Bean('rowModel') |
@@ -32,3 +32,6 @@ import { ChangedPath, RefreshModelParams, RowBounds, RowDataTransaction, RowNode, RowNodeTransaction, IClientSideRowModel } from "@ag-grid-community/core"; | ||
private lastHighlightedRow; | ||
private events; | ||
private refreshMapFunc; | ||
init(): void; | ||
destroy(): void; | ||
start(): void; | ||
@@ -40,2 +43,3 @@ ensureRowHeightsValid(startPixel: number, endPixel: number, startLimitIndex: number, endLimitIndex: number): boolean; | ||
highlightRowAtPixel(rowNode: RowNode | null, pixel?: number): void; | ||
getHighlightPosition(pixel: number, rowNode?: RowNode): 'above' | 'below'; | ||
getLastHighlightedRowNode(): RowNode | null; | ||
@@ -65,7 +69,7 @@ isLastRowFound(): boolean; | ||
getCurrentPageHeight(): number; | ||
forEachLeafNode(callback: Function): void; | ||
forEachNode(callback: Function): void; | ||
forEachNodeAfterFilter(callback: Function): void; | ||
forEachNodeAfterFilterAndSort(callback: Function): void; | ||
forEachPivotNode(callback: Function): void; | ||
forEachLeafNode(callback: (node: RowNode, index: number) => void): void; | ||
forEachNode(callback: (node: RowNode, index: number) => void): void; | ||
forEachNodeAfterFilter(callback: (node: RowNode, index: number) => void): void; | ||
forEachNodeAfterFilterAndSort(callback: (node: RowNode, index: number) => void): void; | ||
forEachPivotNode(callback: (node: RowNode, index: number) => void): void; | ||
private recursivelyWalkNodesAndCallback; | ||
@@ -72,0 +76,0 @@ doAggregate(changedPath?: ChangedPath): void; |
@@ -7,3 +7,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
}; | ||
import { _, Autowired, Bean, ChangedPath, Constants as constants, Constants, Events, GridOptionsWrapper, Optional, PostConstruct, RowNode } from "@ag-grid-community/core"; | ||
import { _, Autowired, Bean, ChangedPath, Constants as constants, Constants, Events, GridOptionsWrapper, Optional, PostConstruct, RowNode, PreDestroy } from "@ag-grid-community/core"; | ||
import { ClientSideNodeManager } from "./clientSideNodeManager"; | ||
@@ -19,2 +19,3 @@ var RecursionType; | ||
function ClientSideRowModel() { | ||
this.events = []; | ||
} | ||
@@ -24,11 +25,13 @@ ClientSideRowModel.prototype.init = function () { | ||
var refreshEverythingAfterColsChangedFunc = this.refreshModel.bind(this, { step: Constants.STEP_EVERYTHING, afterColumnsChanged: true }); | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_EVERYTHING_CHANGED, refreshEverythingAfterColsChangedFunc); | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc); | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this)); | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_PIVOT_CHANGED, this.refreshModel.bind(this, { step: Constants.STEP_PIVOT })); | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_ROW_GROUP_OPENED, this.onRowGroupOpened.bind(this)); | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)); | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this)); | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, refreshEverythingFunc); | ||
var refreshMapFunc = this.refreshModel.bind(this, { | ||
this.events = [ | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_EVERYTHING_CHANGED, refreshEverythingAfterColsChangedFunc), | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc), | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this)), | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_PIVOT_CHANGED, this.refreshModel.bind(this, { step: Constants.STEP_PIVOT })), | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_ROW_GROUP_OPENED, this.onRowGroupOpened.bind(this)), | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)), | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this)), | ||
this.eventService.addModalPriorityEventListener(Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, refreshEverythingFunc) | ||
]; | ||
this.refreshMapFunc = this.refreshModel.bind(this, { | ||
step: Constants.STEP_MAP, | ||
@@ -38,4 +41,4 @@ keepRenderedRows: true, | ||
}); | ||
this.gridOptionsWrapper.addEventListener(GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, refreshMapFunc); | ||
this.gridOptionsWrapper.addEventListener(GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, refreshMapFunc); | ||
this.gridOptionsWrapper.addEventListener(GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, this.refreshMapFunc); | ||
this.gridOptionsWrapper.addEventListener(GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, this.refreshMapFunc); | ||
this.rootNode = new RowNode(); | ||
@@ -45,2 +48,10 @@ this.nodeManager = new ClientSideNodeManager(this.rootNode, this.gridOptionsWrapper, this.context, this.eventService, this.columnController, this.gridApi, this.columnApi, this.selectionController); | ||
}; | ||
ClientSideRowModel.prototype.destroy = function () { | ||
if (this.events.length) { | ||
this.events.forEach(function (func) { return func(); }); | ||
this.events = []; | ||
} | ||
this.gridOptionsWrapper.removeEventListener(GridOptionsWrapper.PROP_GROUP_REMOVE_SINGLE_CHILDREN, this.refreshMapFunc); | ||
this.gridOptionsWrapper.removeEventListener(GridOptionsWrapper.PROP_GROUP_REMOVE_LOWEST_SINGLE_CHILDREN, this.refreshMapFunc); | ||
}; | ||
ClientSideRowModel.prototype.start = function () { | ||
@@ -146,3 +157,3 @@ var rowData = this.gridOptionsWrapper.getRowData(); | ||
var rowNodeAtPixelNow = indexAtPixelNow != null ? this.getRow(indexAtPixelNow) : null; | ||
if (rowNodeAtPixelNow === rowNode || !rowNode || pixel == null) { | ||
if (!rowNodeAtPixelNow || !rowNode || rowNodeAtPixelNow === rowNode || pixel == null) { | ||
if (this.lastHighlightedRow) { | ||
@@ -154,4 +165,3 @@ this.lastHighlightedRow.setHighlighted(null); | ||
} | ||
var rowTop = rowNodeAtPixelNow.rowTop, rowHeight = rowNodeAtPixelNow.rowHeight; | ||
var highlight = pixel - rowTop < rowHeight / 2 ? 'above' : 'below'; | ||
var highlight = this.getHighlightPosition(pixel, rowNodeAtPixelNow); | ||
if (this.lastHighlightedRow && this.lastHighlightedRow !== rowNodeAtPixelNow) { | ||
@@ -164,2 +174,13 @@ this.lastHighlightedRow.setHighlighted(null); | ||
}; | ||
ClientSideRowModel.prototype.getHighlightPosition = function (pixel, rowNode) { | ||
if (!rowNode) { | ||
var index = this.getRowIndexAtPixel(pixel); | ||
rowNode = this.getRow(index || 0); | ||
if (!rowNode) { | ||
return 'below'; | ||
} | ||
} | ||
var rowTop = rowNode.rowTop, rowHeight = rowNode.rowHeight; | ||
return pixel - rowTop < rowHeight / 2 ? 'above' : 'below'; | ||
}; | ||
ClientSideRowModel.prototype.getLastHighlightedRowNode = function () { | ||
@@ -400,3 +421,3 @@ return this.lastHighlightedRow; | ||
} | ||
else if (currentRowNode.rowTop < pixelToMatch) { | ||
if (currentRowNode.rowTop < pixelToMatch) { | ||
bottomPointer = midPointer + 1; | ||
@@ -627,3 +648,3 @@ } | ||
this.rowDataTransactionBatch = []; | ||
var waitMillis = this.gridOptionsWrapper.getBatchUpdateWaitMillis(); | ||
var waitMillis = this.gridOptionsWrapper.getAsyncTransactionWaitMillis(); | ||
window.setTimeout(function () { | ||
@@ -745,2 +766,5 @@ _this.executeBatchUpdateRowData(); | ||
], ClientSideRowModel.prototype, "init", null); | ||
__decorate([ | ||
PreDestroy | ||
], ClientSideRowModel.prototype, "destroy", null); | ||
ClientSideRowModel = __decorate([ | ||
@@ -747,0 +771,0 @@ Bean('rowModel') |
{ | ||
"name": "@ag-grid-community/client-side-row-model", | ||
"version": "23.0.2", | ||
"version": "23.1.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components", | ||
@@ -12,3 +12,4 @@ "main": "./dist/cjs/main.js", | ||
"package": "node ../../module-build/rollup/build.js", | ||
"build": "npm run build-cjs && npm run build-es6" | ||
"build": "npm run build-cjs && npm run build-es6 && npm run hash", | ||
"hash": "sh ../../scripts/hashDirectory.sh > .hash" | ||
}, | ||
@@ -45,6 +46,6 @@ "repository": { | ||
"dependencies": { | ||
"@ag-grid-community/core": "~23.0.0" | ||
"@ag-grid-community/core": "~23.1.0" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^3.6.3" | ||
"typescript": "~3.6.5" | ||
}, | ||
@@ -51,0 +52,0 @@ "publishConfig": { |
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
5686967
61
88568
+ Added@ag-grid-community/core@23.1.1(transitive)
- Removed@ag-grid-community/core@23.0.2(transitive)