@ag-grid-enterprise/server-side-row-model
Advanced tools
Comparing version 30.2.1 to 31.0.0
@@ -8,5 +8,3 @@ import { RowBounds, BeanStub, Column, RowNode, NumberSequence, IRowNode } from "@ag-grid-community/core"; | ||
private beans; | ||
private rowHeight; | ||
private usingMasterDetail; | ||
private postConstruct; | ||
private readonly expansionService; | ||
createRowNode(params: { | ||
@@ -13,0 +11,0 @@ group: boolean; |
@@ -32,9 +32,5 @@ "use strict"; | ||
} | ||
BlockUtils.prototype.postConstruct = function () { | ||
this.rowHeight = this.gridOptionsService.getRowHeightAsNumber(); | ||
this.usingMasterDetail = this.gridOptionsService.is('masterDetail'); | ||
}; | ||
BlockUtils.prototype.createRowNode = function (params) { | ||
var rowNode = new core_1.RowNode(this.beans); | ||
var rowHeight = params.rowHeight != null ? params.rowHeight : this.rowHeight; | ||
var rowHeight = params.rowHeight != null ? params.rowHeight : this.gridOptionsService.getRowHeightAsNumber(); | ||
rowNode.setRowHeight(rowHeight); | ||
@@ -98,3 +94,3 @@ rowNode.group = params.group; | ||
if (rowNode.rowGroupColumn) { | ||
console.warn("column = " + rowNode.rowGroupColumn.getId()); | ||
console.warn("column = ".concat(rowNode.rowGroupColumn.getId())); | ||
} | ||
@@ -124,3 +120,3 @@ console.warn("data is ", rowNode.data); | ||
rowNode.updateData(data); | ||
if (this.gridOptionsService.is('treeData')) { | ||
if (this.gridOptionsService.get('treeData')) { | ||
this.setTreeGroupInfo(rowNode); | ||
@@ -150,3 +146,3 @@ this.setChildCountIntoRowNode(rowNode); | ||
} | ||
else if (this.usingMasterDetail) { | ||
else if (this.gridOptionsService.get('masterDetail')) { | ||
// this should be implemented, however it's not the use case i'm currently | ||
@@ -160,3 +156,3 @@ // programming, so leaving for another day. to test this, create an example | ||
rowNode.stub = false; | ||
var treeData = this.gridOptionsService.is('treeData'); | ||
var treeData = this.gridOptionsService.get('treeData'); | ||
if (core_1._.exists(data)) { | ||
@@ -170,3 +166,3 @@ rowNode.setDataAndId(data, defaultId); | ||
} | ||
else if (this.usingMasterDetail) { | ||
else if (this.gridOptionsService.get('masterDetail')) { | ||
this.setMasterDetailInfo(rowNode); | ||
@@ -199,3 +195,3 @@ } | ||
var groupDisplayCols = this.columnModel.getGroupDisplayColumns(); | ||
var usingTreeData = this.gridOptionsService.is('treeData'); | ||
var usingTreeData = this.gridOptionsService.get('treeData'); | ||
groupDisplayCols.forEach(function (col) { | ||
@@ -264,3 +260,3 @@ if (rowNode.groupData == null) { | ||
if (core_1._.missing(topPointer) || core_1._.missing(bottomPointer)) { | ||
console.warn("AG Grid: error: topPointer = " + topPointer + ", bottomPointer = " + bottomPointer); | ||
console.warn("AG Grid: error: topPointer = ".concat(topPointer, ", bottomPointer = ").concat(bottomPointer)); | ||
return undefined; | ||
@@ -294,3 +290,3 @@ } | ||
else { | ||
console.warn("AG Grid: error: unable to locate rowIndex = " + displayRowIndex + " in cache"); | ||
console.warn("AG Grid: error: unable to locate rowIndex = ".concat(displayRowIndex, " in cache")); | ||
return undefined; | ||
@@ -361,41 +357,21 @@ } | ||
BlockUtils.prototype.checkOpenByDefault = function (rowNode) { | ||
if (!rowNode.isExpandable()) { | ||
return; | ||
} | ||
var userFunc = this.gridOptionsService.getCallback('isServerSideGroupOpenByDefault'); | ||
if (!userFunc) { | ||
return; | ||
} | ||
var params = { | ||
data: rowNode.data, | ||
rowNode: rowNode | ||
}; | ||
var userFuncRes = userFunc(params); | ||
if (userFuncRes) { | ||
// we do this in a timeout, so that we don't expand a row node while in the middle | ||
// of setting up rows, setting up rows is complex enough without another chunk of work | ||
// getting added to the call stack. this is also helpful as openByDefault may or may | ||
// not happen (so makes setting up rows more deterministic by expands never happening) | ||
// and also checkOpenByDefault is shard with both store types, so easier control how it | ||
// impacts things by keeping it in new VM turn. | ||
window.setTimeout(function () { return rowNode.setExpanded(true); }, 0); | ||
} | ||
return this.expansionService.checkOpenByDefault(rowNode); | ||
}; | ||
__decorate([ | ||
core_1.Autowired('valueService') | ||
(0, core_1.Autowired)('valueService') | ||
], BlockUtils.prototype, "valueService", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], BlockUtils.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmNodeManager') | ||
(0, core_1.Autowired)('ssrmNodeManager') | ||
], BlockUtils.prototype, "nodeManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('beans') | ||
(0, core_1.Autowired)('beans') | ||
], BlockUtils.prototype, "beans", void 0); | ||
__decorate([ | ||
core_1.PostConstruct | ||
], BlockUtils.prototype, "postConstruct", null); | ||
(0, core_1.Autowired)('expansionService') | ||
], BlockUtils.prototype, "expansionService", void 0); | ||
BlockUtils = __decorate([ | ||
core_1.Bean('ssrmBlockUtils') | ||
(0, core_1.Bean)('ssrmBlockUtils') | ||
], BlockUtils); | ||
@@ -402,0 +378,0 @@ return BlockUtils; |
@@ -49,3 +49,3 @@ "use strict"; | ||
} | ||
else if (this.gridOptionsService.is('purgeClosedRowNodes') && core_1._.exists(rowNode.childStore)) { | ||
else if (this.gridOptionsService.get('purgeClosedRowNodes') && core_1._.exists(rowNode.childStore)) { | ||
rowNode.childStore = this.destroyBean(rowNode.childStore); | ||
@@ -76,9 +76,9 @@ } | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], ExpandListener.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreFactory') | ||
(0, core_1.Autowired)('ssrmStoreFactory') | ||
], ExpandListener.prototype, "storeFactory", void 0); | ||
__decorate([ | ||
core_1.Autowired('beans') | ||
(0, core_1.Autowired)('beans') | ||
], ExpandListener.prototype, "beans", void 0); | ||
@@ -89,3 +89,3 @@ __decorate([ | ||
ExpandListener = __decorate([ | ||
core_1.Bean('ssrmExpandListener') | ||
(0, core_1.Bean)('ssrmExpandListener') | ||
], ExpandListener); | ||
@@ -92,0 +92,0 @@ return ExpandListener; |
@@ -9,2 +9,3 @@ import { BeanStub } from "@ag-grid-community/core"; | ||
private findChangedColumns; | ||
private getAdvancedFilterColumns; | ||
} |
@@ -32,2 +32,3 @@ "use strict"; | ||
FilterListener.prototype.postConstruct = function () { | ||
var _this = this; | ||
// only want to be active if SSRM active, otherwise would be interfering with other row models | ||
@@ -37,5 +38,6 @@ if (!this.gridOptionsService.isRowModelType('serverSide')) { | ||
} | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)); | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_ADVANCED_FILTER_ENABLED_CHANGED, function () { return _this.onFilterChanged(true); }); | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_FILTER_CHANGED, function () { return _this.onFilterChanged(); }); | ||
}; | ||
FilterListener.prototype.onFilterChanged = function () { | ||
FilterListener.prototype.onFilterChanged = function (advancedFilterEnabledChanged) { | ||
var storeParams = this.serverSideRowModel.getParams(); | ||
@@ -45,5 +47,25 @@ if (!storeParams) { | ||
} // params is undefined if no datasource set | ||
var newModel = this.filterManager.getFilterModel(); | ||
var oldModel = storeParams ? storeParams.filterModel : {}; | ||
var changedColumns = this.findChangedColumns(newModel, oldModel); | ||
var oldModel = storeParams.filterModel; | ||
var newModel; | ||
var changedColumns; | ||
if (this.filterManager.isAdvancedFilterEnabled()) { | ||
newModel = this.filterManager.getAdvancedFilterModel(); | ||
// if advancedFilterEnabledChanged, old model is of type `FilterModel` | ||
var oldColumns = advancedFilterEnabledChanged ? Object.keys(oldModel !== null && oldModel !== void 0 ? oldModel : {}) : this.getAdvancedFilterColumns(oldModel); | ||
var newColumns_1 = this.getAdvancedFilterColumns(newModel); | ||
oldColumns.forEach(function (column) { return newColumns_1.add(column); }); | ||
changedColumns = Array.from(newColumns_1); | ||
} | ||
else { | ||
newModel = this.filterManager.getFilterModel(); | ||
if (advancedFilterEnabledChanged) { | ||
// old model is of type `AdvancedFilterModel | null` | ||
var oldColumns_1 = this.getAdvancedFilterColumns(oldModel); | ||
Object.keys(newModel).forEach(function (column) { return oldColumns_1.add(column); }); | ||
changedColumns = Array.from(oldColumns_1); | ||
} | ||
else { | ||
changedColumns = this.findChangedColumns(oldModel, newModel); | ||
} | ||
} | ||
var valueColChanged = this.listenerUtils.isSortingWithValueColumn(changedColumns); | ||
@@ -73,10 +95,26 @@ var secondaryColChanged = this.listenerUtils.isSortingWithSecondaryColumn(changedColumns); | ||
}; | ||
FilterListener.prototype.getAdvancedFilterColumns = function (model) { | ||
var columns = new Set(); | ||
if (!model) { | ||
return columns; | ||
} | ||
var processAdvancedFilterModel = function (filterModel) { | ||
if (filterModel.filterType === 'join') { | ||
filterModel.conditions.forEach(function (condition) { return processAdvancedFilterModel(condition); }); | ||
} | ||
else { | ||
columns.add(filterModel.colId); | ||
} | ||
}; | ||
processAdvancedFilterModel(model); | ||
return columns; | ||
}; | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], FilterListener.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
(0, core_1.Autowired)('filterManager') | ||
], FilterListener.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmListenerUtils') | ||
(0, core_1.Autowired)('ssrmListenerUtils') | ||
], FilterListener.prototype, "listenerUtils", void 0); | ||
@@ -87,3 +125,3 @@ __decorate([ | ||
FilterListener = __decorate([ | ||
core_1.Bean('ssrmFilterListener') | ||
(0, core_1.Bean)('ssrmFilterListener') | ||
], FilterListener); | ||
@@ -90,0 +128,0 @@ return FilterListener; |
@@ -36,6 +36,6 @@ "use strict"; | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], ListenerUtils.prototype, "columnModel", void 0); | ||
ListenerUtils = __decorate([ | ||
core_1.Bean('ssrmListenerUtils') | ||
(0, core_1.Bean)('ssrmListenerUtils') | ||
], ListenerUtils); | ||
@@ -42,0 +42,0 @@ return ListenerUtils; |
@@ -1,13 +0,9 @@ | ||
import { BeanStub, SortModelItem } from "@ag-grid-community/core"; | ||
import { BeanStub } from "@ag-grid-community/core"; | ||
export declare class SortListener extends BeanStub { | ||
private sortController; | ||
private columnModel; | ||
private serverSideRowModel; | ||
private listenerUtils; | ||
private postConstruct; | ||
extractSortModel(): SortModelItem[]; | ||
private removeMultiColumnPrefixOnColumnIds; | ||
private replaceAutoGroupColumnWithActualRowGroupColumns; | ||
private onSortChanged; | ||
private findChangedColumnsInSort; | ||
} |
@@ -38,41 +38,2 @@ "use strict"; | ||
}; | ||
SortListener.prototype.extractSortModel = function () { | ||
var sortModel = this.sortController.getSortModel(); | ||
// when using tree data we just return the sort model with the 'ag-Grid-AutoColumn' as is, i.e not broken out | ||
// into it's constitute group columns as they are not defined up front and can vary per node. | ||
if (this.gridOptionsService.is('treeData')) { | ||
return sortModel; | ||
} | ||
// it autoCol is active, we don't want to send this to the server. instead we want to | ||
// send the | ||
this.replaceAutoGroupColumnWithActualRowGroupColumns(sortModel); | ||
this.removeMultiColumnPrefixOnColumnIds(sortModel); | ||
return sortModel; | ||
}; | ||
SortListener.prototype.removeMultiColumnPrefixOnColumnIds = function (sortModel) { | ||
if (this.gridOptionsService.isGroupMultiAutoColumn()) { | ||
var multiColumnPrefix = core_1.GROUP_AUTO_COLUMN_ID + "-"; | ||
for (var i = 0; i < sortModel.length; ++i) { | ||
if (sortModel[i].colId.indexOf(multiColumnPrefix) > -1) { | ||
sortModel[i].colId = sortModel[i].colId.substr(multiColumnPrefix.length); | ||
} | ||
} | ||
} | ||
}; | ||
SortListener.prototype.replaceAutoGroupColumnWithActualRowGroupColumns = function (sortModel) { | ||
// find index of auto group column in sort model | ||
var autoGroupSortModel = sortModel.find(function (sm) { return sm.colId == core_1.GROUP_AUTO_COLUMN_ID; }); | ||
// replace auto column with individual group columns | ||
if (autoGroupSortModel) { | ||
// remove auto group column | ||
var autoGroupIndex = sortModel.indexOf(autoGroupSortModel); | ||
core_1._.removeFromArray(sortModel, autoGroupSortModel); | ||
var isNotInSortModel = function (col) { return sortModel.filter(function (sm) { return sm.colId === col.getColId(); }).length == 0; }; | ||
var mapColumnToSortModel = function (col) { return ({ colId: col.getId(), sort: autoGroupSortModel.sort }); }; | ||
var newModels = this.columnModel.getRowGroupColumns() | ||
.filter(isNotInSortModel) | ||
.map(mapColumnToSortModel); | ||
core_1._.insertArrayIntoArray(sortModel, newModels, autoGroupIndex); | ||
} | ||
}; | ||
SortListener.prototype.onSortChanged = function () { | ||
@@ -83,3 +44,3 @@ var storeParams = this.serverSideRowModel.getParams(); | ||
} // params is undefined if no datasource set | ||
var newSortModel = this.extractSortModel(); | ||
var newSortModel = this.sortController.getSortModel(); | ||
var oldSortModel = storeParams.sortModel; | ||
@@ -125,12 +86,9 @@ var changedColumns = this.findChangedColumnsInSort(newSortModel, oldSortModel); | ||
__decorate([ | ||
core_1.Autowired('sortController') | ||
(0, core_1.Autowired)('sortController') | ||
], SortListener.prototype, "sortController", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
], SortListener.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], SortListener.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmListenerUtils') | ||
(0, core_1.Autowired)('ssrmListenerUtils') | ||
], SortListener.prototype, "listenerUtils", void 0); | ||
@@ -141,3 +99,3 @@ __decorate([ | ||
SortListener = __decorate([ | ||
core_1.Bean('ssrmSortService') | ||
(0, core_1.Bean)('ssrmSortService') | ||
], SortListener); | ||
@@ -144,0 +102,0 @@ return SortListener; |
@@ -18,3 +18,3 @@ "use strict"; | ||
if (this.rowNodes[id]) { | ||
console.warn("AG Grid: Duplicate node id " + rowNode.id + ". Row ID's are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values."); | ||
console.warn("AG Grid: Duplicate node id ".concat(rowNode.id, ". Row ID's are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.")); | ||
console.warn('first instance', this.rowNodes[id].data); | ||
@@ -38,3 +38,3 @@ console.warn('second instance', rowNode.data); | ||
NodeManager = __decorate([ | ||
core_1.Bean('ssrmNodeManager') | ||
(0, core_1.Bean)('ssrmNodeManager') | ||
], NodeManager); | ||
@@ -41,0 +41,0 @@ return NodeManager; |
@@ -1,5 +0,5 @@ | ||
import { BeanStub, Column, ColumnVO, IServerSideDatasource, IServerSideRowModel, IServerSideStore, NumberSequence, RowBounds, RowNode, StoreRefreshAfterParams, RefreshServerSideParams, ServerSideGroupLevelState, SortModelItem, RowModelType, LoadSuccessParams } from "@ag-grid-community/core"; | ||
import { BeanStub, Column, ColumnVO, IServerSideDatasource, IServerSideRowModel, IServerSideStore, NumberSequence, RowBounds, RowNode, StoreRefreshAfterParams, RefreshServerSideParams, ServerSideGroupLevelState, SortModelItem, RowModelType, LoadSuccessParams, FilterModel, AdvancedFilterModel } from "@ag-grid-community/core"; | ||
export interface SSRMParams { | ||
sortModel: SortModelItem[]; | ||
filterModel: any; | ||
filterModel: FilterModel | AdvancedFilterModel | null; | ||
lastAccessedSequence: NumberSequence; | ||
@@ -16,2 +16,3 @@ dynamicRowHeight: boolean; | ||
private filterManager; | ||
private sortController; | ||
private rowRenderer; | ||
@@ -34,2 +35,3 @@ private sortListener; | ||
private addEventListeners; | ||
private updateDatasource; | ||
private verifyProps; | ||
@@ -43,2 +45,4 @@ setDatasource(datasource: IServerSideDatasource): void; | ||
generateSecondaryColumns(pivotFields: string[]): void; | ||
resetRowHeights(): void; | ||
private resetRowHeightsForAllRowNodes; | ||
resetRootStore(): void; | ||
@@ -62,3 +66,3 @@ columnsToValueObjects(columns: Column[]): ColumnVO[]; | ||
expandAll(value: boolean): void; | ||
refreshAfterFilter(newFilterModel: any, params: StoreRefreshAfterParams): void; | ||
refreshAfterFilter(newFilterModel: FilterModel | AdvancedFilterModel | null, params: StoreRefreshAfterParams): void; | ||
getRootStore(): IServerSideStore | undefined; | ||
@@ -76,3 +80,4 @@ getRowCount(): number; | ||
forEachNodeAfterFilterAndSort(callback: (node: RowNode, index: number) => void, includeFooterNodes?: boolean): void; | ||
executeOnStore(route: string[], callback: (cache: IServerSideStore) => void): void; | ||
/** @return false if store hasn't started */ | ||
executeOnStore(route: string[], callback: (cache: IServerSideStore) => void): boolean; | ||
refreshStore(params?: RefreshServerSideParams): void; | ||
@@ -79,0 +84,0 @@ getStoreState(): ServerSideGroupLevelState[]; |
@@ -58,6 +58,3 @@ "use strict"; | ||
this.started = true; | ||
var datasource = this.gridOptionsService.get('serverSideDatasource'); | ||
if (datasource) { | ||
this.setDatasource(datasource); | ||
} | ||
this.updateDatasource(); | ||
}; | ||
@@ -75,2 +72,3 @@ ServerSideRowModel.prototype.destroyDatasource = function () { | ||
ServerSideRowModel.prototype.addEventListeners = function () { | ||
var _this = this; | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverything.bind(this)); | ||
@@ -83,13 +81,26 @@ this.addManagedListener(this.eventService, core_1.Events.EVENT_STORE_UPDATED, this.onStoreUpdated.bind(this)); | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, resetListener); | ||
this.addManagedPropertyListener('treeData', resetListener); | ||
this.addManagedPropertyListeners([ | ||
/** | ||
* Following properties omitted as they are likely to come with undesired side effects. | ||
* 'getRowId', 'isRowMaster', 'getRowHeight', 'isServerSideGroup', 'getServerSideGroupKey', | ||
* */ | ||
'masterDetail', 'treeData', 'removePivotHeaderRowWhenSingleValueColumn', | ||
'suppressServerSideInfiniteScroll', 'cacheBlockSize', | ||
], resetListener); | ||
this.addManagedPropertyListener('rowHeight', function () { return _this.resetRowHeights(); }); | ||
this.verifyProps(); | ||
this.addManagedPropertyListener('serverSideDatasource', function () { return _this.updateDatasource(); }); | ||
}; | ||
ServerSideRowModel.prototype.updateDatasource = function () { | ||
var datasource = this.gridOptionsService.get('serverSideDatasource'); | ||
if (datasource) { | ||
this.setDatasource(datasource); | ||
} | ||
}; | ||
ServerSideRowModel.prototype.verifyProps = function () { | ||
if (this.gridOptionsService.exists('initialGroupOrderComparator')) { | ||
var message_1 = "AG Grid: initialGroupOrderComparator cannot be used with Server Side Row Model. If using Full Store, then provide the rows to the grid in the desired sort order. If using Infinite Scroll, then sorting is done on the server side, nothing to do with the client."; | ||
core_1._.doOnce(function () { return console.warn(message_1); }, 'SSRM.InitialGroupOrderComparator'); | ||
core_1._.warnOnce("initialGroupOrderComparator cannot be used with Server Side Row Model."); | ||
} | ||
if (this.gridOptionsService.isRowSelection() && !this.gridOptionsService.exists('getRowId')) { | ||
var message_2 = "AG Grid: getRowId callback must be provided for Server Side Row Model selection to work correctly."; | ||
core_1._.doOnce(function () { return console.warn(message_2); }, 'SSRM.SelectionNeedsRowNodeIdFunc'); | ||
core_1._.warnOnce("getRowId callback must be provided for Server Side Row Model selection to work correctly."); | ||
} | ||
@@ -160,3 +171,3 @@ }; | ||
}; | ||
var sortModelDifferent = !core_1._.jsonEquals(this.storeParams.sortModel, this.sortListener.extractSortModel()); | ||
var sortModelDifferent = !core_1._.jsonEquals(this.storeParams.sortModel, this.sortController.getSortModel()); | ||
var rowGroupDifferent = !areColsSame({ | ||
@@ -212,2 +223,38 @@ oldCols: this.storeParams.rowGroupCols, | ||
; | ||
ServerSideRowModel.prototype.resetRowHeights = function () { | ||
var atLeastOne = this.resetRowHeightsForAllRowNodes(); | ||
var rootNodeHeight = this.gridOptionsService.getRowHeightForNode(this.rootNode); | ||
this.rootNode.setRowHeight(rootNodeHeight.height, rootNodeHeight.estimated); | ||
if (this.rootNode.sibling) { | ||
var rootNodeSibling = this.gridOptionsService.getRowHeightForNode(this.rootNode.sibling); | ||
this.rootNode.sibling.setRowHeight(rootNodeSibling.height, rootNodeSibling.estimated); | ||
} | ||
// when pivotMode but pivot not active, root node is displayed on its own | ||
// because it's only ever displayed alone, refreshing the model (onRowHeightChanged) is not required | ||
if (atLeastOne) { | ||
this.onRowHeightChanged(); | ||
} | ||
}; | ||
ServerSideRowModel.prototype.resetRowHeightsForAllRowNodes = function () { | ||
var _this = this; | ||
var atLeastOne = false; | ||
this.forEachNode(function (rowNode) { | ||
var rowHeightForNode = _this.gridOptionsService.getRowHeightForNode(rowNode); | ||
rowNode.setRowHeight(rowHeightForNode.height, rowHeightForNode.estimated); | ||
// we keep the height each row is at, however we set estimated=true rather than clear the height. | ||
// this means the grid will not reset the row heights back to defaults, rather it will re-calc | ||
// the height for each row as the row is displayed. otherwise the scroll will jump when heights are reset. | ||
var detailNode = rowNode.detailNode; | ||
if (detailNode) { | ||
var detailRowHeight = _this.gridOptionsService.getRowHeightForNode(detailNode); | ||
detailNode.setRowHeight(detailRowHeight.height, detailRowHeight.estimated); | ||
} | ||
if (rowNode.sibling) { | ||
var siblingRowHeight = _this.gridOptionsService.getRowHeightForNode(rowNode.sibling); | ||
detailNode.setRowHeight(siblingRowHeight.height, siblingRowHeight.estimated); | ||
} | ||
atLeastOne = true; | ||
}); | ||
return atLeastOne; | ||
}; | ||
ServerSideRowModel.prototype.resetRootStore = function () { | ||
@@ -228,7 +275,2 @@ this.destroyRootStore(); | ||
} | ||
// this event shows/hides 'no rows' overlay | ||
var rowDataChangedEvent = { | ||
type: core_1.Events.EVENT_ROW_DATA_UPDATED | ||
}; | ||
this.eventService.dispatchEvent(rowDataChangedEvent); | ||
// this gets the row to render rows (or remove the previously rendered rows, as it's blank to start). | ||
@@ -260,4 +302,6 @@ // important to NOT pass in an event with keepRenderedRows or animate, as we want the renderer | ||
// sort and filter model | ||
filterModel: this.filterManager.getFilterModel(), | ||
sortModel: this.sortListener.extractSortModel(), | ||
filterModel: this.filterManager.isAdvancedFilterEnabled() | ||
? this.filterManager.getAdvancedFilterModel() | ||
: this.filterManager.getFilterModel(), | ||
sortModel: this.sortController.getSortModel(), | ||
datasource: this.datasource, | ||
@@ -446,6 +490,10 @@ lastAccessedSequence: new core_1.NumberSequence(), | ||
}; | ||
/** @return false if store hasn't started */ | ||
ServerSideRowModel.prototype.executeOnStore = function (route, callback) { | ||
if (!this.started) { | ||
return false; | ||
} | ||
var rootStore = this.getRootStore(); | ||
if (!rootStore) { | ||
return; | ||
return true; | ||
} | ||
@@ -456,2 +504,3 @@ var storeToExecuteOn = rootStore.getChildStore(route); | ||
} | ||
return true; | ||
}; | ||
@@ -527,24 +576,27 @@ ServerSideRowModel.prototype.refreshStore = function (params) { | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], ServerSideRowModel.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
(0, core_1.Autowired)('filterManager') | ||
], ServerSideRowModel.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowRenderer') | ||
(0, core_1.Autowired)('sortController') | ||
], ServerSideRowModel.prototype, "sortController", void 0); | ||
__decorate([ | ||
(0, core_1.Autowired)('rowRenderer') | ||
], ServerSideRowModel.prototype, "rowRenderer", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmSortService') | ||
(0, core_1.Autowired)('ssrmSortService') | ||
], ServerSideRowModel.prototype, "sortListener", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmNodeManager') | ||
(0, core_1.Autowired)('ssrmNodeManager') | ||
], ServerSideRowModel.prototype, "nodeManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreFactory') | ||
(0, core_1.Autowired)('ssrmStoreFactory') | ||
], ServerSideRowModel.prototype, "storeFactory", void 0); | ||
__decorate([ | ||
core_1.Autowired('beans') | ||
(0, core_1.Autowired)('beans') | ||
], ServerSideRowModel.prototype, "beans", void 0); | ||
__decorate([ | ||
core_1.Optional('pivotColDefService') | ||
(0, core_1.Optional)('pivotColDefService') | ||
], ServerSideRowModel.prototype, "pivotColDefService", void 0); | ||
@@ -561,3 +613,3 @@ __decorate([ | ||
ServerSideRowModel = __decorate([ | ||
core_1.Bean('rowModel') | ||
(0, core_1.Bean)('rowModel') | ||
], ServerSideRowModel); | ||
@@ -564,0 +616,0 @@ return ServerSideRowModel; |
@@ -39,6 +39,10 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -69,3 +73,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
selectAll: this.selectedState.selectAll, | ||
toggledNodes: __spreadArray([], __read(this.selectedState.toggledNodes)), | ||
toggledNodes: __spreadArray([], __read(this.selectedState.toggledNodes), false), | ||
}; | ||
@@ -96,3 +100,3 @@ }; | ||
else { | ||
console.warn("AG Grid: Provided ids must be of string type. Invalid id provided: " + key); | ||
console.warn("AG Grid: Provided ids must be of string type. Invalid id provided: ".concat(key)); | ||
} | ||
@@ -245,3 +249,3 @@ }); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], DefaultStrategy.prototype, "rowModel", void 0); | ||
@@ -248,0 +252,0 @@ __decorate([ |
@@ -61,6 +61,10 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -83,3 +87,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
// when the grouping changes, the state no longer makes sense, so reset the state. | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, function () { return _this.selectionService.reset(); }); | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, function () { return _this.selectionService.reset('rowGroupChanged'); }); | ||
}; | ||
@@ -149,3 +153,3 @@ GroupSelectsChildrenStrategy.prototype.getSelectedState = function () { | ||
var parentState = this.selectedState; | ||
var remainingRoute = __spreadArray([], __read(parentRoute)); | ||
var remainingRoute = __spreadArray([], __read(parentRoute), false); | ||
while (parentState && remainingRoute.length) { | ||
@@ -367,15 +371,15 @@ parentState = parentState.toggledNodes.get(remainingRoute.pop()); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], GroupSelectsChildrenStrategy.prototype, "rowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], GroupSelectsChildrenStrategy.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
(0, core_1.Autowired)('filterManager') | ||
], GroupSelectsChildrenStrategy.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], GroupSelectsChildrenStrategy.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('selectionService') | ||
(0, core_1.Autowired)('selectionService') | ||
], GroupSelectsChildrenStrategy.prototype, "selectionService", void 0); | ||
@@ -382,0 +386,0 @@ __decorate([ |
@@ -1,9 +0,8 @@ | ||
import { BeanStub, ChangedPath, ISelectionService, IServerSideSelectionState, IServerSideGroupSelectionState, RowNode, SelectionEventSourceType, ISetNodesSelectedParams } from "@ag-grid-community/core"; | ||
import { BeanStub, ChangedPath, ISelectionService, RowNode, SelectionEventSourceType, ISetNodesSelectedParams, ServerSideRowSelectionState, ServerSideRowGroupSelectionState } from "@ag-grid-community/core"; | ||
export declare class ServerSideSelectionService extends BeanStub implements ISelectionService { | ||
private rowModel; | ||
private selectionStrategy; | ||
private rowSelection; | ||
private init; | ||
getServerSideSelectionState(): any; | ||
setServerSideSelectionState(state: IServerSideSelectionState | IServerSideGroupSelectionState): void; | ||
getSelectionState(): string[] | ServerSideRowSelectionState | ServerSideRowGroupSelectionState | null; | ||
setSelectionState(state: string[] | ServerSideRowSelectionState | ServerSideRowGroupSelectionState, source: SelectionEventSourceType): void; | ||
setNodesSelected(params: ISetNodesSelectedParams): number; | ||
@@ -10,0 +9,0 @@ /** |
@@ -57,3 +57,3 @@ "use strict"; | ||
var _this = this; | ||
var groupSelectsChildren = this.gridOptionsService.is('groupSelectsChildren'); | ||
var groupSelectsChildren = this.gridOptionsService.get('groupSelectsChildren'); | ||
this.addManagedPropertyListener('groupSelectsChildren', function (propChange) { | ||
@@ -70,11 +70,13 @@ _this.destroyBean(_this.selectionStrategy); | ||
}); | ||
this.rowSelection = this.gridOptionsService.get('rowSelection'); | ||
this.addManagedPropertyListener('rowSelection', function (propChange) { return _this.rowSelection = propChange.currentValue; }); | ||
this.addManagedPropertyListener('rowSelection', function () { return _this.deselectAllRowNodes({ source: 'api' }); }); | ||
var StrategyClazz = !groupSelectsChildren ? defaultStrategy_1.DefaultStrategy : groupSelectsChildrenStrategy_1.GroupSelectsChildrenStrategy; | ||
this.selectionStrategy = this.createManagedBean(new StrategyClazz()); | ||
}; | ||
ServerSideSelectionService.prototype.getServerSideSelectionState = function () { | ||
ServerSideSelectionService.prototype.getSelectionState = function () { | ||
return this.selectionStrategy.getSelectedState(); | ||
}; | ||
ServerSideSelectionService.prototype.setServerSideSelectionState = function (state) { | ||
ServerSideSelectionService.prototype.setSelectionState = function (state, source) { | ||
if (Array.isArray(state)) { | ||
return; | ||
} | ||
this.selectionStrategy.setSelectedState(state); | ||
@@ -84,3 +86,3 @@ this.shotgunResetNodeSelectionState(); | ||
type: core_1.Events.EVENT_SELECTION_CHANGED, | ||
source: 'api', | ||
source: source, | ||
}; | ||
@@ -91,3 +93,4 @@ this.eventService.dispatchEvent(event); | ||
var nodes = params.nodes, otherParams = __rest(params, ["nodes"]); | ||
if (nodes.length > 1 && this.rowSelection !== 'multiple') { | ||
var rowSelection = this.gridOptionsService.get('rowSelection'); | ||
if (nodes.length > 1 && rowSelection !== 'multiple') { | ||
console.warn("AG Grid: cannot multi select while rowSelection='single'"); | ||
@@ -232,3 +235,3 @@ return 0; | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], ServerSideSelectionService.prototype, "rowModel", void 0); | ||
@@ -239,3 +242,3 @@ __decorate([ | ||
ServerSideSelectionService = __decorate([ | ||
core_1.Bean('selectionService') | ||
(0, core_1.Bean)('selectionService') | ||
], ServerSideSelectionService); | ||
@@ -242,0 +245,0 @@ return ServerSideSelectionService; |
@@ -43,3 +43,3 @@ "use strict"; | ||
var _this = this; | ||
this.usingTreeData = this.gridOptionsService.is('treeData'); | ||
this.usingTreeData = this.gridOptionsService.get('treeData'); | ||
this.nodeIdPrefix = this.blockUtils.createNodeIdPrefix(this.parentRowNode); | ||
@@ -54,3 +54,3 @@ if (!this.usingTreeData && this.groupLevel) { | ||
var userInitialRowCount = this.storeUtils.getServerSideInitialRowCount(); | ||
if (isRootStore && userInitialRowCount !== undefined) { | ||
if (isRootStore && userInitialRowCount != null) { | ||
initialRowCount = userInitialRowCount; | ||
@@ -62,2 +62,7 @@ } | ||
this.postSortFunc = this.gridOptionsService.getCallback('postSortRows'); | ||
if (userInitialRowCount != null) { | ||
this.eventService.dispatchEventOnce({ | ||
type: core_1.Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
}; | ||
@@ -100,5 +105,3 @@ FullStore.prototype.destroyRowNodes = function () { | ||
storeParams: this.ssrmParams, | ||
successCallback: this.pageLoaded.bind(this, this.getVersion()), | ||
success: this.success.bind(this, this.getVersion()), | ||
failCallback: this.pageLoadFailed.bind(this, this.getVersion()), | ||
fail: this.pageLoadFailed.bind(this, this.getVersion()) | ||
@@ -148,3 +151,3 @@ }); | ||
} | ||
var info = params.storeInfo || params.groupLevelInfo; | ||
var info = params.groupLevelInfo; | ||
if (info) { | ||
@@ -162,4 +165,3 @@ Object.assign(this.info, info); | ||
if (!params.rowData) { | ||
var message_1 = 'AG Grid: "params.data" is missing from Server-Side Row Model success() callback. Please use the "data" attribute. If no data is returned, set an empty list.'; | ||
core_1._.doOnce(function () { return console.warn(message_1, params); }, 'FullStore.noData'); | ||
core_1._.warnOnce('"params.data" is missing from Server-Side Row Model success() callback. Please use the "data" attribute. If no data is returned, set an empty list.'); | ||
} | ||
@@ -170,2 +172,7 @@ this.createOrRecycleNodes(nodesToRecycle, params.rowData); | ||
} | ||
if (this.level === 0) { | ||
this.eventService.dispatchEventOnce({ | ||
type: core_1.Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
this.filterAndSortNodes(); | ||
@@ -442,3 +449,2 @@ this.fireStoreUpdatedEvent(); | ||
parentNode: this.parentRowNode, | ||
storeInfo: this.info, | ||
groupLevelInfo: this.info | ||
@@ -564,3 +570,3 @@ }; | ||
if (!rowNode) { | ||
console.error("AG Grid: could not find row id=" + id + ", data item was not found for this id"); | ||
console.error("AG Grid: could not find row id=".concat(id, ", data item was not found for this id")); | ||
return null; | ||
@@ -653,33 +659,33 @@ } | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreUtils') | ||
(0, core_1.Autowired)('ssrmStoreUtils') | ||
], FullStore.prototype, "storeUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmBlockUtils') | ||
(0, core_1.Autowired)('ssrmBlockUtils') | ||
], FullStore.prototype, "blockUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], FullStore.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowNodeBlockLoader') | ||
(0, core_1.Autowired)('rowNodeBlockLoader') | ||
], FullStore.prototype, "rowNodeBlockLoader", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowNodeSorter') | ||
(0, core_1.Autowired)('rowNodeSorter') | ||
], FullStore.prototype, "rowNodeSorter", void 0); | ||
__decorate([ | ||
core_1.Autowired('sortController') | ||
(0, core_1.Autowired)('sortController') | ||
], FullStore.prototype, "sortController", void 0); | ||
__decorate([ | ||
core_1.Autowired('selectionService') | ||
(0, core_1.Autowired)('selectionService') | ||
], FullStore.prototype, "selectionService", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmNodeManager') | ||
(0, core_1.Autowired)('ssrmNodeManager') | ||
], FullStore.prototype, "nodeManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
(0, core_1.Autowired)('filterManager') | ||
], FullStore.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmTransactionManager') | ||
(0, core_1.Autowired)('ssrmTransactionManager') | ||
], FullStore.prototype, "transactionManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], FullStore.prototype, "serverSideRowModel", void 0); | ||
@@ -686,0 +692,0 @@ __decorate([ |
@@ -5,3 +5,2 @@ import { BeanStub, RowNode, ServerSideGroupLevelParams } from "@ag-grid-community/core"; | ||
private api; | ||
private columnApi; | ||
private rowNodeBlockLoader; | ||
@@ -8,0 +7,0 @@ static DEFAULT_BLOCK_SIZE: number; |
@@ -155,9 +155,7 @@ "use strict"; | ||
request: request, | ||
successCallback: function (rowData, rowCount) { return success({ rowData: rowData, rowCount: rowCount }); }, | ||
success: success, | ||
failCallback: fail, | ||
fail: fail, | ||
parentNode: this.parentNode, | ||
api: this.api, | ||
columnApi: this.columnApi, | ||
columnApi: this.gridOptionsService.columnApi, | ||
context: this.gridOptionsService.context | ||
@@ -189,3 +187,2 @@ }; | ||
var _this = this; | ||
var _a; | ||
var nextBlockToLoad = this.getNextBlockToLoad(); | ||
@@ -203,3 +200,3 @@ if (!nextBlockToLoad) { | ||
window.clearTimeout(this.loaderTimeout); | ||
var _b = __read(this.nextBlockToLoad, 2), startRowString = _b[0], endRow_1 = _b[1]; | ||
var _a = __read(this.nextBlockToLoad, 2), startRowString = _a[0], endRow_1 = _a[1]; | ||
var startRow_1 = Number(startRowString); | ||
@@ -213,3 +210,3 @@ this.loaderTimeout = window.setTimeout(function () { | ||
_this.nextBlockToLoad = undefined; | ||
}, (_a = this.gridOptionsService.getNum('blockLoadDebounceMillis')) !== null && _a !== void 0 ? _a : 0); | ||
}, this.gridOptionsService.get('blockLoadDebounceMillis')); | ||
} | ||
@@ -241,9 +238,6 @@ }; | ||
__decorate([ | ||
core_1.Autowired('gridApi') | ||
(0, core_1.Autowired)('gridApi') | ||
], LazyBlockLoader.prototype, "api", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnApi') | ||
], LazyBlockLoader.prototype, "columnApi", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowNodeBlockLoader') | ||
(0, core_1.Autowired)('rowNodeBlockLoader') | ||
], LazyBlockLoader.prototype, "rowNodeBlockLoader", void 0); | ||
@@ -250,0 +244,0 @@ __decorate([ |
@@ -39,6 +39,10 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -81,3 +85,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
this.getRowIdFunc = this.gridOptionsService.getCallback('getRowId'); | ||
this.isMasterDetail = this.gridOptionsService.is('masterDetail'); | ||
this.isMasterDetail = this.gridOptionsService.get('masterDetail'); | ||
}; | ||
@@ -441,6 +445,6 @@ LazyCache.prototype.destroyRowNodes = function () { | ||
var _c = __read(_a, 2), blockStart = _c[0], uniqueStates = _c[1]; | ||
var sortedStates = __spreadArray([], __read(uniqueStates)).sort(function (a, b) { var _a, _b; return ((_a = statePriorityMap[a]) !== null && _a !== void 0 ? _a : 0) - ((_b = statePriorityMap[b]) !== null && _b !== void 0 ? _b : 0); }); | ||
var sortedStates = __spreadArray([], __read(uniqueStates), false).sort(function (a, b) { var _a, _b; return ((_a = statePriorityMap[a]) !== null && _a !== void 0 ? _a : 0) - ((_b = statePriorityMap[b]) !== null && _b !== void 0 ? _b : 0); }); | ||
var priorityState = sortedStates[0]; | ||
var blockNumber = Number(blockStart) / _this.rowLoader.getBlockSize(); | ||
var blockId = blockPrefix ? blockPrefix + "-" + blockNumber : String(blockNumber); | ||
var blockId = blockPrefix ? "".concat(blockPrefix, "-").concat(blockNumber) : String(blockNumber); | ||
results[blockId] = { | ||
@@ -644,10 +648,9 @@ blockNumber: blockNumber, | ||
}); | ||
return __spreadArray([], __read(duplicates)); | ||
return __spreadArray([], __read(duplicates), false); | ||
}; | ||
LazyCache.prototype.onLoadSuccess = function (firstRowIndex, numberOfRowsExpected, response) { | ||
var _this = this; | ||
var _a; | ||
if (!this.live) | ||
return; | ||
var info = (_a = response.groupLevelInfo) !== null && _a !== void 0 ? _a : response.storeInfo; | ||
var info = response.groupLevelInfo; | ||
this.store.setStoreInfo(info); | ||
@@ -658,3 +661,3 @@ if (this.getRowIdFunc != null) { | ||
var duplicateIdText = duplicates.join(', '); | ||
console.warn("AG Grid: Unable to display rows as duplicate row ids (" + duplicateIdText + ") were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids."); | ||
console.warn("AG Grid: Unable to display rows as duplicate row ids (".concat(duplicateIdText, ") were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids.")); | ||
this.onLoadFailed(firstRowIndex, numberOfRowsExpected); | ||
@@ -876,3 +879,3 @@ return; | ||
var deletedNodeCount = 0; | ||
var remainingIdsToRemove = __spreadArray([], __read(idsToRemove)); | ||
var remainingIdsToRemove = __spreadArray([], __read(idsToRemove), false); | ||
var allNodes = this.getOrderedNodeMap(); | ||
@@ -921,15 +924,15 @@ var contiguousIndex = -1; | ||
__decorate([ | ||
core_1.Autowired('gridApi') | ||
(0, core_1.Autowired)('gridApi') | ||
], LazyCache.prototype, "api", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmBlockUtils') | ||
(0, core_1.Autowired)('ssrmBlockUtils') | ||
], LazyCache.prototype, "blockUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('focusService') | ||
(0, core_1.Autowired)('focusService') | ||
], LazyCache.prototype, "focusService", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmNodeManager') | ||
(0, core_1.Autowired)('ssrmNodeManager') | ||
], LazyCache.prototype, "nodeManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], LazyCache.prototype, "serverSideRowModel", void 0); | ||
@@ -936,0 +939,0 @@ __decorate([ |
@@ -39,6 +39,10 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -64,8 +68,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
LazyStore.prototype.init = function () { | ||
var _a; | ||
var numberOfRows = 1; | ||
if (this.level === 0) { | ||
numberOfRows = this.storeUtils.getServerSideInitialRowCount(); | ||
numberOfRows = (_a = this.storeUtils.getServerSideInitialRowCount()) !== null && _a !== void 0 ? _a : 1; | ||
this.eventService.dispatchEventOnce({ | ||
type: core_1.Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
this.cache = this.createManagedBean(new lazyCache_1.LazyCache(this, numberOfRows, this.storeParams)); | ||
var usingTreeData = this.gridOptionsService.is('treeData'); | ||
var usingTreeData = this.gridOptionsService.get('treeData'); | ||
if (!usingTreeData && this.group) { | ||
@@ -113,3 +121,2 @@ var groupColVo = this.ssrmParams.rowGroupCols[this.level]; | ||
parentNode: this.parentRowNode, | ||
storeInfo: this.info, | ||
groupLevelInfo: this.info | ||
@@ -137,3 +144,3 @@ }; | ||
var allIdsToRemove = transaction.remove.map(function (data) { return (idFunc({ level: _this.level, parentKeys: _this.parentRowNode.getGroupKeys(), data: data })); }); | ||
var allUniqueIdsToRemove = __spreadArray([], __read(new Set(allIdsToRemove))); | ||
var allUniqueIdsToRemove = __spreadArray([], __read(new Set(allIdsToRemove)), false); | ||
removedNodes = this.cache.removeRowNodes(allUniqueIdsToRemove); | ||
@@ -614,12 +621,12 @@ } | ||
__decorate([ | ||
core_1.Autowired('ssrmBlockUtils') | ||
(0, core_1.Autowired)('ssrmBlockUtils') | ||
], LazyStore.prototype, "blockUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreUtils') | ||
(0, core_1.Autowired)('ssrmStoreUtils') | ||
], LazyStore.prototype, "storeUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], LazyStore.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('selectionService') | ||
(0, core_1.Autowired)('selectionService') | ||
], LazyStore.prototype, "selectionService", void 0); | ||
@@ -626,0 +633,0 @@ __decorate([ |
@@ -19,3 +19,3 @@ "use strict"; | ||
if (!map) { | ||
throw new Error("AG Grid: " + String(index) + " not found"); | ||
throw new Error("AG Grid: ".concat(String(index), " not found")); | ||
} | ||
@@ -29,3 +29,3 @@ return map.get(key); | ||
if (!map) { | ||
throw new Error("AG Grid: " + String(index) + " not found"); | ||
throw new Error("AG Grid: ".concat(String(index), " not found")); | ||
} | ||
@@ -40,3 +40,3 @@ map.set(item[index], item); | ||
if (!map) { | ||
throw new Error("AG Grid: " + String(index) + " not found"); | ||
throw new Error("AG Grid: ".concat(String(index), " not found")); | ||
} | ||
@@ -52,3 +52,3 @@ map.delete(item[index]); | ||
if (!map) { | ||
throw new Error("AG Grid: " + String(index) + " not found"); | ||
throw new Error("AG Grid: ".concat(String(index), " not found")); | ||
} | ||
@@ -55,0 +55,0 @@ return map.values(); |
@@ -40,3 +40,3 @@ "use strict"; | ||
? userStoreParams.maxBlocksInCache | ||
: this.gridOptionsService.getNum('maxBlocksInCache'); | ||
: this.gridOptionsService.get('maxBlocksInCache'); | ||
var maxBlocksActive = maxBlocksInCache != null && maxBlocksInCache >= 0; | ||
@@ -47,11 +47,11 @@ if (!maxBlocksActive) { | ||
if (ssrmParams.dynamicRowHeight) { | ||
var message_1 = 'AG Grid: Server Side Row Model does not support Dynamic Row Height and Cache Purging. ' + | ||
var message = 'Server Side Row Model does not support Dynamic Row Height and Cache Purging. ' + | ||
'Either a) remove getRowHeight() callback or b) remove maxBlocksInCache property. Purging has been disabled.'; | ||
core_1._.doOnce(function () { return console.warn(message_1); }, 'storeFactory.maxBlocksInCache.dynamicRowHeight'); | ||
core_1._.warnOnce(message); | ||
return undefined; | ||
} | ||
if (this.columnModel.isAutoRowHeightActive()) { | ||
var message_2 = 'AG Grid: Server Side Row Model does not support Auto Row Height and Cache Purging. ' + | ||
var message = 'Server Side Row Model does not support Auto Row Height and Cache Purging. ' + | ||
'Either a) remove colDef.autoHeight or b) remove maxBlocksInCache property. Purging has been disabled.'; | ||
core_1._.doOnce(function () { return console.warn(message_2); }, 'storeFactory.maxBlocksInCache.autoRowHeightActive'); | ||
core_1._.warnOnce(message); | ||
return undefined; | ||
@@ -67,3 +67,3 @@ } | ||
? userStoreParams.cacheBlockSize | ||
: this.gridOptionsService.getNum('cacheBlockSize'); | ||
: this.gridOptionsService.get('cacheBlockSize'); | ||
if (blockSize != null && blockSize > 0) { | ||
@@ -89,5 +89,2 @@ return blockSize; | ||
var res = callback(params); | ||
if (res.storeType != null) { | ||
res.suppressInfiniteScroll = res.storeType !== "partial"; | ||
} | ||
return res; | ||
@@ -102,12 +99,12 @@ }; | ||
StoreFactory.prototype.isSuppressServerSideInfiniteScroll = function () { | ||
return this.gridOptionsService.is('suppressServerSideInfiniteScroll'); | ||
return this.gridOptionsService.get('suppressServerSideInfiniteScroll'); | ||
}; | ||
__decorate([ | ||
core_1.Autowired('gridOptionsService') | ||
(0, core_1.Autowired)('gridOptionsService') | ||
], StoreFactory.prototype, "gridOptionsService", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], StoreFactory.prototype, "columnModel", void 0); | ||
StoreFactory = __decorate([ | ||
core_1.Bean('ssrmStoreFactory') | ||
(0, core_1.Bean)('ssrmStoreFactory') | ||
], StoreFactory); | ||
@@ -114,0 +111,0 @@ return StoreFactory; |
import { IServerSideStore, BeanStub, StoreRefreshAfterParams, RowNode, ColumnVO, RowNodeBlock } from "@ag-grid-community/core"; | ||
import { SSRMParams } from "../serverSideRowModel"; | ||
export declare class StoreUtils extends BeanStub { | ||
private columnApi; | ||
private columnModel; | ||
private gridApi; | ||
private serverSideRowModel; | ||
@@ -13,4 +11,2 @@ private storeFactory; | ||
parentBlock: RowNodeBlock; | ||
successCallback: () => void; | ||
failCallback: () => void; | ||
success: () => void; | ||
@@ -23,3 +19,3 @@ fail: () => void; | ||
isServerRefreshNeeded(parentRowNode: RowNode, rowGroupCols: ColumnVO[], params: StoreRefreshAfterParams): boolean; | ||
getServerSideInitialRowCount(): number; | ||
getServerSideInitialRowCount(): number | null; | ||
private assertRowModelIsServerSide; | ||
@@ -26,0 +22,0 @@ private assertNotTreeData; |
@@ -49,10 +49,8 @@ "use strict"; | ||
var getRowsParams = { | ||
successCallback: p.successCallback, | ||
success: p.success, | ||
failCallback: p.failCallback, | ||
fail: p.fail, | ||
request: request, | ||
parentNode: p.parentNode, | ||
api: this.gridApi, | ||
columnApi: this.columnApi, | ||
api: this.gridOptionsService.api, | ||
columnApi: this.gridOptionsService.columnApi, | ||
context: this.gridOptionsService.context | ||
@@ -63,3 +61,3 @@ }; | ||
// failCallback() is important, to reduce the 'RowNodeBlockLoader.activeBlockLoadsCount' count | ||
p.failCallback(); | ||
p.fail(); | ||
return; | ||
@@ -114,11 +112,7 @@ } | ||
StoreUtils.prototype.getServerSideInitialRowCount = function () { | ||
var rowCount = this.gridOptionsService.getNum('serverSideInitialRowCount'); | ||
if (typeof rowCount === 'number' && rowCount > 0) { | ||
return rowCount; | ||
} | ||
return 1; | ||
return this.gridOptionsService.get('serverSideInitialRowCount'); | ||
}; | ||
StoreUtils.prototype.assertRowModelIsServerSide = function (key) { | ||
if (!this.gridOptionsService.isRowModelType('serverSide')) { | ||
core_1._.doOnce(function () { return console.warn("AG Grid: The '" + key + "' property can only be used with the Server Side Row Model."); }, key); | ||
core_1._.warnOnce("The '".concat(key, "' property can only be used with the Server Side Row Model.")); | ||
return false; | ||
@@ -129,4 +123,4 @@ } | ||
StoreUtils.prototype.assertNotTreeData = function (key) { | ||
if (this.gridOptionsService.is('treeData')) { | ||
core_1._.doOnce(function () { return console.warn("AG Grid: The '" + key + "' property cannot be used while using tree data."); }, key + '_TreeData'); | ||
if (this.gridOptionsService.get('treeData')) { | ||
core_1._.warnOnce("The '".concat(key, "' property cannot be used while using tree data.")); | ||
return false; | ||
@@ -137,30 +131,24 @@ } | ||
StoreUtils.prototype.isServerSideSortAllLevels = function () { | ||
return this.gridOptionsService.is('serverSideSortAllLevels') && this.assertRowModelIsServerSide('serverSideSortAllLevels'); | ||
return this.gridOptionsService.get('serverSideSortAllLevels') && this.assertRowModelIsServerSide('serverSideSortAllLevels'); | ||
}; | ||
StoreUtils.prototype.isServerSideOnlyRefreshFilteredGroups = function () { | ||
return this.gridOptionsService.is('serverSideOnlyRefreshFilteredGroups') && this.assertRowModelIsServerSide('serverSideOnlyRefreshFilteredGroups'); | ||
return this.gridOptionsService.get('serverSideOnlyRefreshFilteredGroups') && this.assertRowModelIsServerSide('serverSideOnlyRefreshFilteredGroups'); | ||
}; | ||
StoreUtils.prototype.isServerSideSortOnServer = function () { | ||
return this.gridOptionsService.is('serverSideSortOnServer') && this.assertRowModelIsServerSide('serverSideSortOnServer') && this.assertNotTreeData('serverSideSortOnServer'); | ||
return this.gridOptionsService.get('serverSideSortOnServer') && this.assertRowModelIsServerSide('serverSideSortOnServer') && this.assertNotTreeData('serverSideSortOnServer'); | ||
}; | ||
StoreUtils.prototype.isServerSideFilterOnServer = function () { | ||
return this.gridOptionsService.is('serverSideFilterOnServer') && this.assertRowModelIsServerSide('serverSideFilterOnServer') && this.assertNotTreeData('serverSideFilterOnServer'); | ||
return this.gridOptionsService.get('serverSideFilterOnServer') && this.assertRowModelIsServerSide('serverSideFilterOnServer') && this.assertNotTreeData('serverSideFilterOnServer'); | ||
}; | ||
__decorate([ | ||
core_1.Autowired('columnApi') | ||
], StoreUtils.prototype, "columnApi", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], StoreUtils.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('gridApi') | ||
], StoreUtils.prototype, "gridApi", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], StoreUtils.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreFactory') | ||
(0, core_1.Autowired)('ssrmStoreFactory') | ||
], StoreUtils.prototype, "storeFactory", void 0); | ||
StoreUtils = __decorate([ | ||
core_1.Bean('ssrmStoreUtils') | ||
(0, core_1.Bean)('ssrmStoreUtils') | ||
], StoreUtils); | ||
@@ -167,0 +155,0 @@ return StoreUtils; |
@@ -63,6 +63,9 @@ "use strict"; | ||
var result; | ||
_this.serverSideRowModel.executeOnStore(txWrapper.transaction.route, function (cache) { | ||
var hasStarted = _this.serverSideRowModel.executeOnStore(txWrapper.transaction.route, function (cache) { | ||
result = cache.applyTransaction(txWrapper.transaction); | ||
}); | ||
if (result == undefined) { | ||
if (!hasStarted) { | ||
result = { status: core_1.ServerSideTransactionResultStatus.StoreNotStarted }; | ||
} | ||
else if (result == undefined) { | ||
result = { status: core_1.ServerSideTransactionResultStatus.StoreNotFound }; | ||
@@ -113,6 +116,9 @@ } | ||
var res; | ||
this.serverSideRowModel.executeOnStore(transaction.route, function (store) { | ||
var hasStarted = this.serverSideRowModel.executeOnStore(transaction.route, function (store) { | ||
res = store.applyTransaction(transaction); | ||
}); | ||
if (res) { | ||
if (!hasStarted) { | ||
return { status: core_1.ServerSideTransactionResultStatus.StoreNotStarted }; | ||
} | ||
else if (res) { | ||
this.valueCache.onDataChanged(); | ||
@@ -131,15 +137,15 @@ if (res.remove) { | ||
__decorate([ | ||
core_1.Autowired('rowNodeBlockLoader') | ||
(0, core_1.Autowired)('rowNodeBlockLoader') | ||
], TransactionManager.prototype, "rowNodeBlockLoader", void 0); | ||
__decorate([ | ||
core_1.Autowired('valueCache') | ||
(0, core_1.Autowired)('valueCache') | ||
], TransactionManager.prototype, "valueCache", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], TransactionManager.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowRenderer') | ||
(0, core_1.Autowired)('rowRenderer') | ||
], TransactionManager.prototype, "rowRenderer", void 0); | ||
__decorate([ | ||
core_1.Autowired('selectionService') | ||
(0, core_1.Autowired)('selectionService') | ||
], TransactionManager.prototype, "selectionService", void 0); | ||
@@ -150,3 +156,3 @@ __decorate([ | ||
TransactionManager = __decorate([ | ||
core_1.Bean('ssrmTransactionManager') | ||
(0, core_1.Bean)('ssrmTransactionManager') | ||
], TransactionManager); | ||
@@ -153,0 +159,0 @@ return TransactionManager; |
@@ -18,2 +18,3 @@ "use strict"; | ||
var version_1 = require("./version"); | ||
var serverSideExpansionService_1 = require("./serverSideRowModel/services/serverSideExpansionService"); | ||
exports.ServerSideRowModelModule = { | ||
@@ -24,3 +25,3 @@ version: version_1.VERSION, | ||
beans: [serverSideRowModel_1.ServerSideRowModel, expandListener_1.ExpandListener, sortListener_1.SortListener, storeUtils_1.StoreUtils, blockUtils_1.BlockUtils, nodeManager_1.NodeManager, transactionManager_1.TransactionManager, | ||
filterListener_1.FilterListener, storeFactory_1.StoreFactory, listenerUtils_1.ListenerUtils, serverSideSelectionService_1.ServerSideSelectionService], | ||
filterListener_1.FilterListener, storeFactory_1.StoreFactory, listenerUtils_1.ListenerUtils, serverSideSelectionService_1.ServerSideSelectionService, serverSideExpansionService_1.ServerSideExpansionService], | ||
dependantModules: [ | ||
@@ -27,0 +28,0 @@ core_2.EnterpriseCoreModule |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "30.2.1"; | ||
export declare const VERSION = "31.0.0"; |
@@ -5,2 +5,2 @@ "use strict"; | ||
// DO NOT UPDATE MANUALLY: Generated from script during build time | ||
exports.VERSION = '30.2.1'; | ||
exports.VERSION = '31.0.0'; |
@@ -8,5 +8,3 @@ import { RowBounds, BeanStub, Column, RowNode, NumberSequence, IRowNode } from "@ag-grid-community/core"; | ||
private beans; | ||
private rowHeight; | ||
private usingMasterDetail; | ||
private postConstruct; | ||
private readonly expansionService; | ||
createRowNode(params: { | ||
@@ -13,0 +11,0 @@ group: boolean; |
@@ -13,9 +13,5 @@ "use strict"; | ||
let BlockUtils = class BlockUtils extends core_1.BeanStub { | ||
postConstruct() { | ||
this.rowHeight = this.gridOptionsService.getRowHeightAsNumber(); | ||
this.usingMasterDetail = this.gridOptionsService.is('masterDetail'); | ||
} | ||
createRowNode(params) { | ||
const rowNode = new core_1.RowNode(this.beans); | ||
const rowHeight = params.rowHeight != null ? params.rowHeight : this.rowHeight; | ||
const rowHeight = params.rowHeight != null ? params.rowHeight : this.gridOptionsService.getRowHeightAsNumber(); | ||
rowNode.setRowHeight(rowHeight); | ||
@@ -102,3 +98,3 @@ rowNode.group = params.group; | ||
rowNode.updateData(data); | ||
if (this.gridOptionsService.is('treeData')) { | ||
if (this.gridOptionsService.get('treeData')) { | ||
this.setTreeGroupInfo(rowNode); | ||
@@ -128,3 +124,3 @@ this.setChildCountIntoRowNode(rowNode); | ||
} | ||
else if (this.usingMasterDetail) { | ||
else if (this.gridOptionsService.get('masterDetail')) { | ||
// this should be implemented, however it's not the use case i'm currently | ||
@@ -138,3 +134,3 @@ // programming, so leaving for another day. to test this, create an example | ||
rowNode.stub = false; | ||
const treeData = this.gridOptionsService.is('treeData'); | ||
const treeData = this.gridOptionsService.get('treeData'); | ||
if (core_1._.exists(data)) { | ||
@@ -148,3 +144,3 @@ rowNode.setDataAndId(data, defaultId); | ||
} | ||
else if (this.usingMasterDetail) { | ||
else if (this.gridOptionsService.get('masterDetail')) { | ||
this.setMasterDetailInfo(rowNode); | ||
@@ -176,3 +172,3 @@ } | ||
const groupDisplayCols = this.columnModel.getGroupDisplayColumns(); | ||
const usingTreeData = this.gridOptionsService.is('treeData'); | ||
const usingTreeData = this.gridOptionsService.get('treeData'); | ||
groupDisplayCols.forEach(col => { | ||
@@ -336,43 +332,23 @@ if (rowNode.groupData == null) { | ||
checkOpenByDefault(rowNode) { | ||
if (!rowNode.isExpandable()) { | ||
return; | ||
} | ||
const userFunc = this.gridOptionsService.getCallback('isServerSideGroupOpenByDefault'); | ||
if (!userFunc) { | ||
return; | ||
} | ||
const params = { | ||
data: rowNode.data, | ||
rowNode | ||
}; | ||
const userFuncRes = userFunc(params); | ||
if (userFuncRes) { | ||
// we do this in a timeout, so that we don't expand a row node while in the middle | ||
// of setting up rows, setting up rows is complex enough without another chunk of work | ||
// getting added to the call stack. this is also helpful as openByDefault may or may | ||
// not happen (so makes setting up rows more deterministic by expands never happening) | ||
// and also checkOpenByDefault is shard with both store types, so easier control how it | ||
// impacts things by keeping it in new VM turn. | ||
window.setTimeout(() => rowNode.setExpanded(true), 0); | ||
} | ||
return this.expansionService.checkOpenByDefault(rowNode); | ||
} | ||
}; | ||
__decorate([ | ||
core_1.Autowired('valueService') | ||
(0, core_1.Autowired)('valueService') | ||
], BlockUtils.prototype, "valueService", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], BlockUtils.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmNodeManager') | ||
(0, core_1.Autowired)('ssrmNodeManager') | ||
], BlockUtils.prototype, "nodeManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('beans') | ||
(0, core_1.Autowired)('beans') | ||
], BlockUtils.prototype, "beans", void 0); | ||
__decorate([ | ||
core_1.PostConstruct | ||
], BlockUtils.prototype, "postConstruct", null); | ||
(0, core_1.Autowired)('expansionService') | ||
], BlockUtils.prototype, "expansionService", void 0); | ||
BlockUtils = __decorate([ | ||
core_1.Bean('ssrmBlockUtils') | ||
(0, core_1.Bean)('ssrmBlockUtils') | ||
], BlockUtils); | ||
exports.BlockUtils = BlockUtils; |
@@ -30,3 +30,3 @@ "use strict"; | ||
} | ||
else if (this.gridOptionsService.is('purgeClosedRowNodes') && core_1._.exists(rowNode.childStore)) { | ||
else if (this.gridOptionsService.get('purgeClosedRowNodes') && core_1._.exists(rowNode.childStore)) { | ||
rowNode.childStore = this.destroyBean(rowNode.childStore); | ||
@@ -58,9 +58,9 @@ } | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], ExpandListener.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreFactory') | ||
(0, core_1.Autowired)('ssrmStoreFactory') | ||
], ExpandListener.prototype, "storeFactory", void 0); | ||
__decorate([ | ||
core_1.Autowired('beans') | ||
(0, core_1.Autowired)('beans') | ||
], ExpandListener.prototype, "beans", void 0); | ||
@@ -71,4 +71,4 @@ __decorate([ | ||
ExpandListener = __decorate([ | ||
core_1.Bean('ssrmExpandListener') | ||
(0, core_1.Bean)('ssrmExpandListener') | ||
], ExpandListener); | ||
exports.ExpandListener = ExpandListener; |
@@ -9,2 +9,3 @@ import { BeanStub } from "@ag-grid-community/core"; | ||
private findChangedColumns; | ||
private getAdvancedFilterColumns; | ||
} |
@@ -17,5 +17,6 @@ "use strict"; | ||
} | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)); | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_ADVANCED_FILTER_ENABLED_CHANGED, () => this.onFilterChanged(true)); | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_FILTER_CHANGED, () => this.onFilterChanged()); | ||
} | ||
onFilterChanged() { | ||
onFilterChanged(advancedFilterEnabledChanged) { | ||
const storeParams = this.serverSideRowModel.getParams(); | ||
@@ -25,5 +26,25 @@ if (!storeParams) { | ||
} // params is undefined if no datasource set | ||
const newModel = this.filterManager.getFilterModel(); | ||
const oldModel = storeParams ? storeParams.filterModel : {}; | ||
const changedColumns = this.findChangedColumns(newModel, oldModel); | ||
const oldModel = storeParams.filterModel; | ||
let newModel; | ||
let changedColumns; | ||
if (this.filterManager.isAdvancedFilterEnabled()) { | ||
newModel = this.filterManager.getAdvancedFilterModel(); | ||
// if advancedFilterEnabledChanged, old model is of type `FilterModel` | ||
const oldColumns = advancedFilterEnabledChanged ? Object.keys(oldModel !== null && oldModel !== void 0 ? oldModel : {}) : this.getAdvancedFilterColumns(oldModel); | ||
const newColumns = this.getAdvancedFilterColumns(newModel); | ||
oldColumns.forEach(column => newColumns.add(column)); | ||
changedColumns = Array.from(newColumns); | ||
} | ||
else { | ||
newModel = this.filterManager.getFilterModel(); | ||
if (advancedFilterEnabledChanged) { | ||
// old model is of type `AdvancedFilterModel | null` | ||
const oldColumns = this.getAdvancedFilterColumns(oldModel); | ||
Object.keys(newModel).forEach(column => oldColumns.add(column)); | ||
changedColumns = Array.from(oldColumns); | ||
} | ||
else { | ||
changedColumns = this.findChangedColumns(oldModel, newModel); | ||
} | ||
} | ||
const valueColChanged = this.listenerUtils.isSortingWithValueColumn(changedColumns); | ||
@@ -53,11 +74,27 @@ const secondaryColChanged = this.listenerUtils.isSortingWithSecondaryColumn(changedColumns); | ||
} | ||
getAdvancedFilterColumns(model) { | ||
const columns = new Set(); | ||
if (!model) { | ||
return columns; | ||
} | ||
const processAdvancedFilterModel = (filterModel) => { | ||
if (filterModel.filterType === 'join') { | ||
filterModel.conditions.forEach(condition => processAdvancedFilterModel(condition)); | ||
} | ||
else { | ||
columns.add(filterModel.colId); | ||
} | ||
}; | ||
processAdvancedFilterModel(model); | ||
return columns; | ||
} | ||
}; | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], FilterListener.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
(0, core_1.Autowired)('filterManager') | ||
], FilterListener.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmListenerUtils') | ||
(0, core_1.Autowired)('ssrmListenerUtils') | ||
], FilterListener.prototype, "listenerUtils", void 0); | ||
@@ -68,4 +105,4 @@ __decorate([ | ||
FilterListener = __decorate([ | ||
core_1.Bean('ssrmFilterListener') | ||
(0, core_1.Bean)('ssrmFilterListener') | ||
], FilterListener); | ||
exports.FilterListener = FilterListener; |
@@ -35,7 +35,7 @@ "use strict"; | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], ListenerUtils.prototype, "columnModel", void 0); | ||
ListenerUtils = __decorate([ | ||
core_1.Bean('ssrmListenerUtils') | ||
(0, core_1.Bean)('ssrmListenerUtils') | ||
], ListenerUtils); | ||
exports.ListenerUtils = ListenerUtils; |
@@ -1,13 +0,9 @@ | ||
import { BeanStub, SortModelItem } from "@ag-grid-community/core"; | ||
import { BeanStub } from "@ag-grid-community/core"; | ||
export declare class SortListener extends BeanStub { | ||
private sortController; | ||
private columnModel; | ||
private serverSideRowModel; | ||
private listenerUtils; | ||
private postConstruct; | ||
extractSortModel(): SortModelItem[]; | ||
private removeMultiColumnPrefixOnColumnIds; | ||
private replaceAutoGroupColumnWithActualRowGroupColumns; | ||
private onSortChanged; | ||
private findChangedColumnsInSort; | ||
} |
@@ -19,41 +19,2 @@ "use strict"; | ||
} | ||
extractSortModel() { | ||
const sortModel = this.sortController.getSortModel(); | ||
// when using tree data we just return the sort model with the 'ag-Grid-AutoColumn' as is, i.e not broken out | ||
// into it's constitute group columns as they are not defined up front and can vary per node. | ||
if (this.gridOptionsService.is('treeData')) { | ||
return sortModel; | ||
} | ||
// it autoCol is active, we don't want to send this to the server. instead we want to | ||
// send the | ||
this.replaceAutoGroupColumnWithActualRowGroupColumns(sortModel); | ||
this.removeMultiColumnPrefixOnColumnIds(sortModel); | ||
return sortModel; | ||
} | ||
removeMultiColumnPrefixOnColumnIds(sortModel) { | ||
if (this.gridOptionsService.isGroupMultiAutoColumn()) { | ||
const multiColumnPrefix = core_1.GROUP_AUTO_COLUMN_ID + "-"; | ||
for (let i = 0; i < sortModel.length; ++i) { | ||
if (sortModel[i].colId.indexOf(multiColumnPrefix) > -1) { | ||
sortModel[i].colId = sortModel[i].colId.substr(multiColumnPrefix.length); | ||
} | ||
} | ||
} | ||
} | ||
replaceAutoGroupColumnWithActualRowGroupColumns(sortModel) { | ||
// find index of auto group column in sort model | ||
const autoGroupSortModel = sortModel.find(sm => sm.colId == core_1.GROUP_AUTO_COLUMN_ID); | ||
// replace auto column with individual group columns | ||
if (autoGroupSortModel) { | ||
// remove auto group column | ||
const autoGroupIndex = sortModel.indexOf(autoGroupSortModel); | ||
core_1._.removeFromArray(sortModel, autoGroupSortModel); | ||
const isNotInSortModel = (col) => sortModel.filter(sm => sm.colId === col.getColId()).length == 0; | ||
const mapColumnToSortModel = (col) => ({ colId: col.getId(), sort: autoGroupSortModel.sort }); | ||
const newModels = this.columnModel.getRowGroupColumns() | ||
.filter(isNotInSortModel) | ||
.map(mapColumnToSortModel); | ||
core_1._.insertArrayIntoArray(sortModel, newModels, autoGroupIndex); | ||
} | ||
} | ||
onSortChanged() { | ||
@@ -64,3 +25,3 @@ const storeParams = this.serverSideRowModel.getParams(); | ||
} // params is undefined if no datasource set | ||
const newSortModel = this.extractSortModel(); | ||
const newSortModel = this.sortController.getSortModel(); | ||
const oldSortModel = storeParams.sortModel; | ||
@@ -107,12 +68,9 @@ const changedColumns = this.findChangedColumnsInSort(newSortModel, oldSortModel); | ||
__decorate([ | ||
core_1.Autowired('sortController') | ||
(0, core_1.Autowired)('sortController') | ||
], SortListener.prototype, "sortController", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
], SortListener.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], SortListener.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmListenerUtils') | ||
(0, core_1.Autowired)('ssrmListenerUtils') | ||
], SortListener.prototype, "listenerUtils", void 0); | ||
@@ -123,4 +81,4 @@ __decorate([ | ||
SortListener = __decorate([ | ||
core_1.Bean('ssrmSortService') | ||
(0, core_1.Bean)('ssrmSortService') | ||
], SortListener); | ||
exports.SortListener = SortListener; |
@@ -38,4 +38,4 @@ "use strict"; | ||
NodeManager = __decorate([ | ||
core_1.Bean('ssrmNodeManager') | ||
(0, core_1.Bean)('ssrmNodeManager') | ||
], NodeManager); | ||
exports.NodeManager = NodeManager; |
@@ -1,5 +0,5 @@ | ||
import { BeanStub, Column, ColumnVO, IServerSideDatasource, IServerSideRowModel, IServerSideStore, NumberSequence, RowBounds, RowNode, StoreRefreshAfterParams, RefreshServerSideParams, ServerSideGroupLevelState, SortModelItem, RowModelType, LoadSuccessParams } from "@ag-grid-community/core"; | ||
import { BeanStub, Column, ColumnVO, IServerSideDatasource, IServerSideRowModel, IServerSideStore, NumberSequence, RowBounds, RowNode, StoreRefreshAfterParams, RefreshServerSideParams, ServerSideGroupLevelState, SortModelItem, RowModelType, LoadSuccessParams, FilterModel, AdvancedFilterModel } from "@ag-grid-community/core"; | ||
export interface SSRMParams { | ||
sortModel: SortModelItem[]; | ||
filterModel: any; | ||
filterModel: FilterModel | AdvancedFilterModel | null; | ||
lastAccessedSequence: NumberSequence; | ||
@@ -16,2 +16,3 @@ dynamicRowHeight: boolean; | ||
private filterManager; | ||
private sortController; | ||
private rowRenderer; | ||
@@ -34,2 +35,3 @@ private sortListener; | ||
private addEventListeners; | ||
private updateDatasource; | ||
private verifyProps; | ||
@@ -43,2 +45,4 @@ setDatasource(datasource: IServerSideDatasource): void; | ||
generateSecondaryColumns(pivotFields: string[]): void; | ||
resetRowHeights(): void; | ||
private resetRowHeightsForAllRowNodes; | ||
resetRootStore(): void; | ||
@@ -62,3 +66,3 @@ columnsToValueObjects(columns: Column[]): ColumnVO[]; | ||
expandAll(value: boolean): void; | ||
refreshAfterFilter(newFilterModel: any, params: StoreRefreshAfterParams): void; | ||
refreshAfterFilter(newFilterModel: FilterModel | AdvancedFilterModel | null, params: StoreRefreshAfterParams): void; | ||
getRootStore(): IServerSideStore | undefined; | ||
@@ -76,3 +80,4 @@ getRowCount(): number; | ||
forEachNodeAfterFilterAndSort(callback: (node: RowNode, index: number) => void, includeFooterNodes?: boolean): void; | ||
executeOnStore(route: string[], callback: (cache: IServerSideStore) => void): void; | ||
/** @return false if store hasn't started */ | ||
executeOnStore(route: string[], callback: (cache: IServerSideStore) => void): boolean; | ||
refreshStore(params?: RefreshServerSideParams): void; | ||
@@ -79,0 +84,0 @@ getStoreState(): ServerSideGroupLevelState[]; |
@@ -25,6 +25,3 @@ "use strict"; | ||
this.started = true; | ||
const datasource = this.gridOptionsService.get('serverSideDatasource'); | ||
if (datasource) { | ||
this.setDatasource(datasource); | ||
} | ||
this.updateDatasource(); | ||
} | ||
@@ -49,13 +46,26 @@ destroyDatasource() { | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, resetListener); | ||
this.addManagedPropertyListener('treeData', resetListener); | ||
this.addManagedPropertyListeners([ | ||
/** | ||
* Following properties omitted as they are likely to come with undesired side effects. | ||
* 'getRowId', 'isRowMaster', 'getRowHeight', 'isServerSideGroup', 'getServerSideGroupKey', | ||
* */ | ||
'masterDetail', 'treeData', 'removePivotHeaderRowWhenSingleValueColumn', | ||
'suppressServerSideInfiniteScroll', 'cacheBlockSize', | ||
], resetListener); | ||
this.addManagedPropertyListener('rowHeight', () => this.resetRowHeights()); | ||
this.verifyProps(); | ||
this.addManagedPropertyListener('serverSideDatasource', () => this.updateDatasource()); | ||
} | ||
updateDatasource() { | ||
const datasource = this.gridOptionsService.get('serverSideDatasource'); | ||
if (datasource) { | ||
this.setDatasource(datasource); | ||
} | ||
} | ||
verifyProps() { | ||
if (this.gridOptionsService.exists('initialGroupOrderComparator')) { | ||
const message = `AG Grid: initialGroupOrderComparator cannot be used with Server Side Row Model. If using Full Store, then provide the rows to the grid in the desired sort order. If using Infinite Scroll, then sorting is done on the server side, nothing to do with the client.`; | ||
core_1._.doOnce(() => console.warn(message), 'SSRM.InitialGroupOrderComparator'); | ||
core_1._.warnOnce(`initialGroupOrderComparator cannot be used with Server Side Row Model.`); | ||
} | ||
if (this.gridOptionsService.isRowSelection() && !this.gridOptionsService.exists('getRowId')) { | ||
const message = `AG Grid: getRowId callback must be provided for Server Side Row Model selection to work correctly.`; | ||
core_1._.doOnce(() => console.warn(message), 'SSRM.SelectionNeedsRowNodeIdFunc'); | ||
core_1._.warnOnce(`getRowId callback must be provided for Server Side Row Model selection to work correctly.`); | ||
} | ||
@@ -126,3 +136,3 @@ } | ||
}; | ||
const sortModelDifferent = !core_1._.jsonEquals(this.storeParams.sortModel, this.sortListener.extractSortModel()); | ||
const sortModelDifferent = !core_1._.jsonEquals(this.storeParams.sortModel, this.sortController.getSortModel()); | ||
const rowGroupDifferent = !areColsSame({ | ||
@@ -178,2 +188,37 @@ oldCols: this.storeParams.rowGroupCols, | ||
; | ||
resetRowHeights() { | ||
const atLeastOne = this.resetRowHeightsForAllRowNodes(); | ||
const rootNodeHeight = this.gridOptionsService.getRowHeightForNode(this.rootNode); | ||
this.rootNode.setRowHeight(rootNodeHeight.height, rootNodeHeight.estimated); | ||
if (this.rootNode.sibling) { | ||
const rootNodeSibling = this.gridOptionsService.getRowHeightForNode(this.rootNode.sibling); | ||
this.rootNode.sibling.setRowHeight(rootNodeSibling.height, rootNodeSibling.estimated); | ||
} | ||
// when pivotMode but pivot not active, root node is displayed on its own | ||
// because it's only ever displayed alone, refreshing the model (onRowHeightChanged) is not required | ||
if (atLeastOne) { | ||
this.onRowHeightChanged(); | ||
} | ||
} | ||
resetRowHeightsForAllRowNodes() { | ||
let atLeastOne = false; | ||
this.forEachNode(rowNode => { | ||
const rowHeightForNode = this.gridOptionsService.getRowHeightForNode(rowNode); | ||
rowNode.setRowHeight(rowHeightForNode.height, rowHeightForNode.estimated); | ||
// we keep the height each row is at, however we set estimated=true rather than clear the height. | ||
// this means the grid will not reset the row heights back to defaults, rather it will re-calc | ||
// the height for each row as the row is displayed. otherwise the scroll will jump when heights are reset. | ||
const detailNode = rowNode.detailNode; | ||
if (detailNode) { | ||
const detailRowHeight = this.gridOptionsService.getRowHeightForNode(detailNode); | ||
detailNode.setRowHeight(detailRowHeight.height, detailRowHeight.estimated); | ||
} | ||
if (rowNode.sibling) { | ||
const siblingRowHeight = this.gridOptionsService.getRowHeightForNode(rowNode.sibling); | ||
detailNode.setRowHeight(siblingRowHeight.height, siblingRowHeight.estimated); | ||
} | ||
atLeastOne = true; | ||
}); | ||
return atLeastOne; | ||
} | ||
resetRootStore() { | ||
@@ -194,7 +239,2 @@ this.destroyRootStore(); | ||
} | ||
// this event shows/hides 'no rows' overlay | ||
const rowDataChangedEvent = { | ||
type: core_1.Events.EVENT_ROW_DATA_UPDATED | ||
}; | ||
this.eventService.dispatchEvent(rowDataChangedEvent); | ||
// this gets the row to render rows (or remove the previously rendered rows, as it's blank to start). | ||
@@ -225,4 +265,6 @@ // important to NOT pass in an event with keepRenderedRows or animate, as we want the renderer | ||
// sort and filter model | ||
filterModel: this.filterManager.getFilterModel(), | ||
sortModel: this.sortListener.extractSortModel(), | ||
filterModel: this.filterManager.isAdvancedFilterEnabled() | ||
? this.filterManager.getAdvancedFilterModel() | ||
: this.filterManager.getFilterModel(), | ||
sortModel: this.sortController.getSortModel(), | ||
datasource: this.datasource, | ||
@@ -408,6 +450,10 @@ lastAccessedSequence: new core_1.NumberSequence(), | ||
} | ||
/** @return false if store hasn't started */ | ||
executeOnStore(route, callback) { | ||
if (!this.started) { | ||
return false; | ||
} | ||
const rootStore = this.getRootStore(); | ||
if (!rootStore) { | ||
return; | ||
return true; | ||
} | ||
@@ -418,2 +464,3 @@ const storeToExecuteOn = rootStore.getChildStore(route); | ||
} | ||
return true; | ||
} | ||
@@ -489,24 +536,27 @@ refreshStore(params = {}) { | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], ServerSideRowModel.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
(0, core_1.Autowired)('filterManager') | ||
], ServerSideRowModel.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowRenderer') | ||
(0, core_1.Autowired)('sortController') | ||
], ServerSideRowModel.prototype, "sortController", void 0); | ||
__decorate([ | ||
(0, core_1.Autowired)('rowRenderer') | ||
], ServerSideRowModel.prototype, "rowRenderer", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmSortService') | ||
(0, core_1.Autowired)('ssrmSortService') | ||
], ServerSideRowModel.prototype, "sortListener", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmNodeManager') | ||
(0, core_1.Autowired)('ssrmNodeManager') | ||
], ServerSideRowModel.prototype, "nodeManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreFactory') | ||
(0, core_1.Autowired)('ssrmStoreFactory') | ||
], ServerSideRowModel.prototype, "storeFactory", void 0); | ||
__decorate([ | ||
core_1.Autowired('beans') | ||
(0, core_1.Autowired)('beans') | ||
], ServerSideRowModel.prototype, "beans", void 0); | ||
__decorate([ | ||
core_1.Optional('pivotColDefService') | ||
(0, core_1.Optional)('pivotColDefService') | ||
], ServerSideRowModel.prototype, "pivotColDefService", void 0); | ||
@@ -523,4 +573,4 @@ __decorate([ | ||
ServerSideRowModel = __decorate([ | ||
core_1.Bean('rowModel') | ||
(0, core_1.Bean)('rowModel') | ||
], ServerSideRowModel); | ||
exports.ServerSideRowModel = ServerSideRowModel; |
@@ -202,3 +202,3 @@ "use strict"; | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], DefaultStrategy.prototype, "rowModel", void 0); | ||
@@ -205,0 +205,0 @@ __decorate([ |
@@ -32,3 +32,3 @@ "use strict"; | ||
// when the grouping changes, the state no longer makes sense, so reset the state. | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, () => this.selectionService.reset()); | ||
this.addManagedListener(this.eventService, core_1.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, () => this.selectionService.reset('rowGroupChanged')); | ||
} | ||
@@ -310,15 +310,15 @@ getSelectedState() { | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], GroupSelectsChildrenStrategy.prototype, "rowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], GroupSelectsChildrenStrategy.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
(0, core_1.Autowired)('filterManager') | ||
], GroupSelectsChildrenStrategy.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], GroupSelectsChildrenStrategy.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('selectionService') | ||
(0, core_1.Autowired)('selectionService') | ||
], GroupSelectsChildrenStrategy.prototype, "selectionService", void 0); | ||
@@ -325,0 +325,0 @@ __decorate([ |
@@ -1,9 +0,8 @@ | ||
import { BeanStub, ChangedPath, ISelectionService, IServerSideSelectionState, IServerSideGroupSelectionState, RowNode, SelectionEventSourceType, ISetNodesSelectedParams } from "@ag-grid-community/core"; | ||
import { BeanStub, ChangedPath, ISelectionService, RowNode, SelectionEventSourceType, ISetNodesSelectedParams, ServerSideRowSelectionState, ServerSideRowGroupSelectionState } from "@ag-grid-community/core"; | ||
export declare class ServerSideSelectionService extends BeanStub implements ISelectionService { | ||
private rowModel; | ||
private selectionStrategy; | ||
private rowSelection; | ||
private init; | ||
getServerSideSelectionState(): any; | ||
setServerSideSelectionState(state: IServerSideSelectionState | IServerSideGroupSelectionState): void; | ||
getSelectionState(): string[] | ServerSideRowSelectionState | ServerSideRowGroupSelectionState | null; | ||
setSelectionState(state: string[] | ServerSideRowSelectionState | ServerSideRowGroupSelectionState, source: SelectionEventSourceType): void; | ||
setNodesSelected(params: ISetNodesSelectedParams): number; | ||
@@ -10,0 +9,0 @@ /** |
@@ -26,3 +26,3 @@ "use strict"; | ||
init() { | ||
const groupSelectsChildren = this.gridOptionsService.is('groupSelectsChildren'); | ||
const groupSelectsChildren = this.gridOptionsService.get('groupSelectsChildren'); | ||
this.addManagedPropertyListener('groupSelectsChildren', (propChange) => { | ||
@@ -39,11 +39,13 @@ this.destroyBean(this.selectionStrategy); | ||
}); | ||
this.rowSelection = this.gridOptionsService.get('rowSelection'); | ||
this.addManagedPropertyListener('rowSelection', (propChange) => this.rowSelection = propChange.currentValue); | ||
this.addManagedPropertyListener('rowSelection', () => this.deselectAllRowNodes({ source: 'api' })); | ||
const StrategyClazz = !groupSelectsChildren ? defaultStrategy_1.DefaultStrategy : groupSelectsChildrenStrategy_1.GroupSelectsChildrenStrategy; | ||
this.selectionStrategy = this.createManagedBean(new StrategyClazz()); | ||
} | ||
getServerSideSelectionState() { | ||
getSelectionState() { | ||
return this.selectionStrategy.getSelectedState(); | ||
} | ||
setServerSideSelectionState(state) { | ||
setSelectionState(state, source) { | ||
if (Array.isArray(state)) { | ||
return; | ||
} | ||
this.selectionStrategy.setSelectedState(state); | ||
@@ -53,3 +55,3 @@ this.shotgunResetNodeSelectionState(); | ||
type: core_1.Events.EVENT_SELECTION_CHANGED, | ||
source: 'api', | ||
source, | ||
}; | ||
@@ -60,3 +62,4 @@ this.eventService.dispatchEvent(event); | ||
const { nodes } = params, otherParams = __rest(params, ["nodes"]); | ||
if (nodes.length > 1 && this.rowSelection !== 'multiple') { | ||
const rowSelection = this.gridOptionsService.get('rowSelection'); | ||
if (nodes.length > 1 && rowSelection !== 'multiple') { | ||
console.warn(`AG Grid: cannot multi select while rowSelection='single'`); | ||
@@ -201,3 +204,3 @@ return 0; | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], ServerSideSelectionService.prototype, "rowModel", void 0); | ||
@@ -208,4 +211,4 @@ __decorate([ | ||
ServerSideSelectionService = __decorate([ | ||
core_1.Bean('selectionService') | ||
(0, core_1.Bean)('selectionService') | ||
], ServerSideSelectionService); | ||
exports.ServerSideSelectionService = ServerSideSelectionService; |
@@ -24,3 +24,3 @@ "use strict"; | ||
postConstruct() { | ||
this.usingTreeData = this.gridOptionsService.is('treeData'); | ||
this.usingTreeData = this.gridOptionsService.get('treeData'); | ||
this.nodeIdPrefix = this.blockUtils.createNodeIdPrefix(this.parentRowNode); | ||
@@ -35,3 +35,3 @@ if (!this.usingTreeData && this.groupLevel) { | ||
const userInitialRowCount = this.storeUtils.getServerSideInitialRowCount(); | ||
if (isRootStore && userInitialRowCount !== undefined) { | ||
if (isRootStore && userInitialRowCount != null) { | ||
initialRowCount = userInitialRowCount; | ||
@@ -43,2 +43,7 @@ } | ||
this.postSortFunc = this.gridOptionsService.getCallback('postSortRows'); | ||
if (userInitialRowCount != null) { | ||
this.eventService.dispatchEventOnce({ | ||
type: core_1.Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
} | ||
@@ -80,5 +85,3 @@ destroyRowNodes() { | ||
storeParams: this.ssrmParams, | ||
successCallback: this.pageLoaded.bind(this, this.getVersion()), | ||
success: this.success.bind(this, this.getVersion()), | ||
failCallback: this.pageLoadFailed.bind(this, this.getVersion()), | ||
fail: this.pageLoadFailed.bind(this, this.getVersion()) | ||
@@ -128,3 +131,3 @@ }); | ||
} | ||
const info = params.storeInfo || params.groupLevelInfo; | ||
const info = params.groupLevelInfo; | ||
if (info) { | ||
@@ -142,4 +145,3 @@ Object.assign(this.info, info); | ||
if (!params.rowData) { | ||
const message = 'AG Grid: "params.data" is missing from Server-Side Row Model success() callback. Please use the "data" attribute. If no data is returned, set an empty list.'; | ||
core_1._.doOnce(() => console.warn(message, params), 'FullStore.noData'); | ||
core_1._.warnOnce('"params.data" is missing from Server-Side Row Model success() callback. Please use the "data" attribute. If no data is returned, set an empty list.'); | ||
} | ||
@@ -150,2 +152,7 @@ this.createOrRecycleNodes(nodesToRecycle, params.rowData); | ||
} | ||
if (this.level === 0) { | ||
this.eventService.dispatchEventOnce({ | ||
type: core_1.Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
this.filterAndSortNodes(); | ||
@@ -411,3 +418,2 @@ this.fireStoreUpdatedEvent(); | ||
parentNode: this.parentRowNode, | ||
storeInfo: this.info, | ||
groupLevelInfo: this.info | ||
@@ -619,33 +625,33 @@ }; | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreUtils') | ||
(0, core_1.Autowired)('ssrmStoreUtils') | ||
], FullStore.prototype, "storeUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmBlockUtils') | ||
(0, core_1.Autowired)('ssrmBlockUtils') | ||
], FullStore.prototype, "blockUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], FullStore.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowNodeBlockLoader') | ||
(0, core_1.Autowired)('rowNodeBlockLoader') | ||
], FullStore.prototype, "rowNodeBlockLoader", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowNodeSorter') | ||
(0, core_1.Autowired)('rowNodeSorter') | ||
], FullStore.prototype, "rowNodeSorter", void 0); | ||
__decorate([ | ||
core_1.Autowired('sortController') | ||
(0, core_1.Autowired)('sortController') | ||
], FullStore.prototype, "sortController", void 0); | ||
__decorate([ | ||
core_1.Autowired('selectionService') | ||
(0, core_1.Autowired)('selectionService') | ||
], FullStore.prototype, "selectionService", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmNodeManager') | ||
(0, core_1.Autowired)('ssrmNodeManager') | ||
], FullStore.prototype, "nodeManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('filterManager') | ||
(0, core_1.Autowired)('filterManager') | ||
], FullStore.prototype, "filterManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmTransactionManager') | ||
(0, core_1.Autowired)('ssrmTransactionManager') | ||
], FullStore.prototype, "transactionManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], FullStore.prototype, "serverSideRowModel", void 0); | ||
@@ -652,0 +658,0 @@ __decorate([ |
@@ -5,3 +5,2 @@ import { BeanStub, RowNode, ServerSideGroupLevelParams } from "@ag-grid-community/core"; | ||
private api; | ||
private columnApi; | ||
private rowNodeBlockLoader; | ||
@@ -8,0 +7,0 @@ static DEFAULT_BLOCK_SIZE: number; |
@@ -119,9 +119,7 @@ "use strict"; | ||
request, | ||
successCallback: (rowData, rowCount) => success({ rowData, rowCount }), | ||
success, | ||
failCallback: fail, | ||
fail, | ||
parentNode: this.parentNode, | ||
api: this.api, | ||
columnApi: this.columnApi, | ||
columnApi: this.gridOptionsService.columnApi, | ||
context: this.gridOptionsService.context | ||
@@ -151,3 +149,2 @@ }; | ||
queueLoadAction() { | ||
var _a; | ||
const nextBlockToLoad = this.getNextBlockToLoad(); | ||
@@ -174,3 +171,3 @@ if (!nextBlockToLoad) { | ||
this.nextBlockToLoad = undefined; | ||
}, (_a = this.gridOptionsService.getNum('blockLoadDebounceMillis')) !== null && _a !== void 0 ? _a : 0); | ||
}, this.gridOptionsService.get('blockLoadDebounceMillis')); | ||
} | ||
@@ -203,9 +200,6 @@ } | ||
__decorate([ | ||
core_1.Autowired('gridApi') | ||
(0, core_1.Autowired)('gridApi') | ||
], LazyBlockLoader.prototype, "api", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnApi') | ||
], LazyBlockLoader.prototype, "columnApi", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowNodeBlockLoader') | ||
(0, core_1.Autowired)('rowNodeBlockLoader') | ||
], LazyBlockLoader.prototype, "rowNodeBlockLoader", void 0); | ||
@@ -212,0 +206,0 @@ __decorate([ |
@@ -42,3 +42,3 @@ "use strict"; | ||
this.getRowIdFunc = this.gridOptionsService.getCallback('getRowId'); | ||
this.isMasterDetail = this.gridOptionsService.is('masterDetail'); | ||
this.isMasterDetail = this.gridOptionsService.get('masterDetail'); | ||
} | ||
@@ -594,6 +594,5 @@ destroyRowNodes() { | ||
onLoadSuccess(firstRowIndex, numberOfRowsExpected, response) { | ||
var _a; | ||
if (!this.live) | ||
return; | ||
const info = (_a = response.groupLevelInfo) !== null && _a !== void 0 ? _a : response.storeInfo; | ||
const info = response.groupLevelInfo; | ||
this.store.setStoreInfo(info); | ||
@@ -858,15 +857,15 @@ if (this.getRowIdFunc != null) { | ||
__decorate([ | ||
core_1.Autowired('gridApi') | ||
(0, core_1.Autowired)('gridApi') | ||
], LazyCache.prototype, "api", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmBlockUtils') | ||
(0, core_1.Autowired)('ssrmBlockUtils') | ||
], LazyCache.prototype, "blockUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('focusService') | ||
(0, core_1.Autowired)('focusService') | ||
], LazyCache.prototype, "focusService", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmNodeManager') | ||
(0, core_1.Autowired)('ssrmNodeManager') | ||
], LazyCache.prototype, "nodeManager", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], LazyCache.prototype, "serverSideRowModel", void 0); | ||
@@ -873,0 +872,0 @@ __decorate([ |
@@ -25,8 +25,12 @@ "use strict"; | ||
init() { | ||
var _a; | ||
let numberOfRows = 1; | ||
if (this.level === 0) { | ||
numberOfRows = this.storeUtils.getServerSideInitialRowCount(); | ||
numberOfRows = (_a = this.storeUtils.getServerSideInitialRowCount()) !== null && _a !== void 0 ? _a : 1; | ||
this.eventService.dispatchEventOnce({ | ||
type: core_1.Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
this.cache = this.createManagedBean(new lazyCache_1.LazyCache(this, numberOfRows, this.storeParams)); | ||
const usingTreeData = this.gridOptionsService.is('treeData'); | ||
const usingTreeData = this.gridOptionsService.get('treeData'); | ||
if (!usingTreeData && this.group) { | ||
@@ -73,3 +77,2 @@ const groupColVo = this.ssrmParams.rowGroupCols[this.level]; | ||
parentNode: this.parentRowNode, | ||
storeInfo: this.info, | ||
groupLevelInfo: this.info | ||
@@ -561,12 +564,12 @@ }; | ||
__decorate([ | ||
core_1.Autowired('ssrmBlockUtils') | ||
(0, core_1.Autowired)('ssrmBlockUtils') | ||
], LazyStore.prototype, "blockUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreUtils') | ||
(0, core_1.Autowired)('ssrmStoreUtils') | ||
], LazyStore.prototype, "storeUtils", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], LazyStore.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('selectionService') | ||
(0, core_1.Autowired)('selectionService') | ||
], LazyStore.prototype, "selectionService", void 0); | ||
@@ -573,0 +576,0 @@ __decorate([ |
@@ -38,3 +38,3 @@ "use strict"; | ||
? userStoreParams.maxBlocksInCache | ||
: this.gridOptionsService.getNum('maxBlocksInCache'); | ||
: this.gridOptionsService.get('maxBlocksInCache'); | ||
const maxBlocksActive = maxBlocksInCache != null && maxBlocksInCache >= 0; | ||
@@ -45,11 +45,11 @@ if (!maxBlocksActive) { | ||
if (ssrmParams.dynamicRowHeight) { | ||
const message = 'AG Grid: Server Side Row Model does not support Dynamic Row Height and Cache Purging. ' + | ||
const message = 'Server Side Row Model does not support Dynamic Row Height and Cache Purging. ' + | ||
'Either a) remove getRowHeight() callback or b) remove maxBlocksInCache property. Purging has been disabled.'; | ||
core_1._.doOnce(() => console.warn(message), 'storeFactory.maxBlocksInCache.dynamicRowHeight'); | ||
core_1._.warnOnce(message); | ||
return undefined; | ||
} | ||
if (this.columnModel.isAutoRowHeightActive()) { | ||
const message = 'AG Grid: Server Side Row Model does not support Auto Row Height and Cache Purging. ' + | ||
const message = 'Server Side Row Model does not support Auto Row Height and Cache Purging. ' + | ||
'Either a) remove colDef.autoHeight or b) remove maxBlocksInCache property. Purging has been disabled.'; | ||
core_1._.doOnce(() => console.warn(message), 'storeFactory.maxBlocksInCache.autoRowHeightActive'); | ||
core_1._.warnOnce(message); | ||
return undefined; | ||
@@ -65,3 +65,3 @@ } | ||
? userStoreParams.cacheBlockSize | ||
: this.gridOptionsService.getNum('cacheBlockSize'); | ||
: this.gridOptionsService.get('cacheBlockSize'); | ||
if (blockSize != null && blockSize > 0) { | ||
@@ -87,5 +87,2 @@ return blockSize; | ||
const res = callback(params); | ||
if (res.storeType != null) { | ||
res.suppressInfiniteScroll = res.storeType !== "partial"; | ||
} | ||
return res; | ||
@@ -100,14 +97,14 @@ } | ||
isSuppressServerSideInfiniteScroll() { | ||
return this.gridOptionsService.is('suppressServerSideInfiniteScroll'); | ||
return this.gridOptionsService.get('suppressServerSideInfiniteScroll'); | ||
} | ||
}; | ||
__decorate([ | ||
core_1.Autowired('gridOptionsService') | ||
(0, core_1.Autowired)('gridOptionsService') | ||
], StoreFactory.prototype, "gridOptionsService", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], StoreFactory.prototype, "columnModel", void 0); | ||
StoreFactory = __decorate([ | ||
core_1.Bean('ssrmStoreFactory') | ||
(0, core_1.Bean)('ssrmStoreFactory') | ||
], StoreFactory); | ||
exports.StoreFactory = StoreFactory; |
import { IServerSideStore, BeanStub, StoreRefreshAfterParams, RowNode, ColumnVO, RowNodeBlock } from "@ag-grid-community/core"; | ||
import { SSRMParams } from "../serverSideRowModel"; | ||
export declare class StoreUtils extends BeanStub { | ||
private columnApi; | ||
private columnModel; | ||
private gridApi; | ||
private serverSideRowModel; | ||
@@ -13,4 +11,2 @@ private storeFactory; | ||
parentBlock: RowNodeBlock; | ||
successCallback: () => void; | ||
failCallback: () => void; | ||
success: () => void; | ||
@@ -23,3 +19,3 @@ fail: () => void; | ||
isServerRefreshNeeded(parentRowNode: RowNode, rowGroupCols: ColumnVO[], params: StoreRefreshAfterParams): boolean; | ||
getServerSideInitialRowCount(): number; | ||
getServerSideInitialRowCount(): number | null; | ||
private assertRowModelIsServerSide; | ||
@@ -26,0 +22,0 @@ private assertNotTreeData; |
@@ -30,10 +30,8 @@ "use strict"; | ||
const getRowsParams = { | ||
successCallback: p.successCallback, | ||
success: p.success, | ||
failCallback: p.failCallback, | ||
fail: p.fail, | ||
request: request, | ||
parentNode: p.parentNode, | ||
api: this.gridApi, | ||
columnApi: this.columnApi, | ||
api: this.gridOptionsService.api, | ||
columnApi: this.gridOptionsService.columnApi, | ||
context: this.gridOptionsService.context | ||
@@ -44,3 +42,3 @@ }; | ||
// failCallback() is important, to reduce the 'RowNodeBlockLoader.activeBlockLoadsCount' count | ||
p.failCallback(); | ||
p.fail(); | ||
return; | ||
@@ -95,11 +93,7 @@ } | ||
getServerSideInitialRowCount() { | ||
const rowCount = this.gridOptionsService.getNum('serverSideInitialRowCount'); | ||
if (typeof rowCount === 'number' && rowCount > 0) { | ||
return rowCount; | ||
} | ||
return 1; | ||
return this.gridOptionsService.get('serverSideInitialRowCount'); | ||
} | ||
assertRowModelIsServerSide(key) { | ||
if (!this.gridOptionsService.isRowModelType('serverSide')) { | ||
core_1._.doOnce(() => console.warn(`AG Grid: The '${key}' property can only be used with the Server Side Row Model.`), key); | ||
core_1._.warnOnce(`The '${key}' property can only be used with the Server Side Row Model.`); | ||
return false; | ||
@@ -110,4 +104,4 @@ } | ||
assertNotTreeData(key) { | ||
if (this.gridOptionsService.is('treeData')) { | ||
core_1._.doOnce(() => console.warn(`AG Grid: The '${key}' property cannot be used while using tree data.`), key + '_TreeData'); | ||
if (this.gridOptionsService.get('treeData')) { | ||
core_1._.warnOnce(`The '${key}' property cannot be used while using tree data.`); | ||
return false; | ||
@@ -118,32 +112,26 @@ } | ||
isServerSideSortAllLevels() { | ||
return this.gridOptionsService.is('serverSideSortAllLevels') && this.assertRowModelIsServerSide('serverSideSortAllLevels'); | ||
return this.gridOptionsService.get('serverSideSortAllLevels') && this.assertRowModelIsServerSide('serverSideSortAllLevels'); | ||
} | ||
isServerSideOnlyRefreshFilteredGroups() { | ||
return this.gridOptionsService.is('serverSideOnlyRefreshFilteredGroups') && this.assertRowModelIsServerSide('serverSideOnlyRefreshFilteredGroups'); | ||
return this.gridOptionsService.get('serverSideOnlyRefreshFilteredGroups') && this.assertRowModelIsServerSide('serverSideOnlyRefreshFilteredGroups'); | ||
} | ||
isServerSideSortOnServer() { | ||
return this.gridOptionsService.is('serverSideSortOnServer') && this.assertRowModelIsServerSide('serverSideSortOnServer') && this.assertNotTreeData('serverSideSortOnServer'); | ||
return this.gridOptionsService.get('serverSideSortOnServer') && this.assertRowModelIsServerSide('serverSideSortOnServer') && this.assertNotTreeData('serverSideSortOnServer'); | ||
} | ||
isServerSideFilterOnServer() { | ||
return this.gridOptionsService.is('serverSideFilterOnServer') && this.assertRowModelIsServerSide('serverSideFilterOnServer') && this.assertNotTreeData('serverSideFilterOnServer'); | ||
return this.gridOptionsService.get('serverSideFilterOnServer') && this.assertRowModelIsServerSide('serverSideFilterOnServer') && this.assertNotTreeData('serverSideFilterOnServer'); | ||
} | ||
}; | ||
__decorate([ | ||
core_1.Autowired('columnApi') | ||
], StoreUtils.prototype, "columnApi", void 0); | ||
__decorate([ | ||
core_1.Autowired('columnModel') | ||
(0, core_1.Autowired)('columnModel') | ||
], StoreUtils.prototype, "columnModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('gridApi') | ||
], StoreUtils.prototype, "gridApi", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], StoreUtils.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('ssrmStoreFactory') | ||
(0, core_1.Autowired)('ssrmStoreFactory') | ||
], StoreUtils.prototype, "storeFactory", void 0); | ||
StoreUtils = __decorate([ | ||
core_1.Bean('ssrmStoreUtils') | ||
(0, core_1.Bean)('ssrmStoreUtils') | ||
], StoreUtils); | ||
exports.StoreUtils = StoreUtils; |
@@ -44,6 +44,9 @@ "use strict"; | ||
let result; | ||
this.serverSideRowModel.executeOnStore(txWrapper.transaction.route, cache => { | ||
const hasStarted = this.serverSideRowModel.executeOnStore(txWrapper.transaction.route, cache => { | ||
result = cache.applyTransaction(txWrapper.transaction); | ||
}); | ||
if (result == undefined) { | ||
if (!hasStarted) { | ||
result = { status: core_1.ServerSideTransactionResultStatus.StoreNotStarted }; | ||
} | ||
else if (result == undefined) { | ||
result = { status: core_1.ServerSideTransactionResultStatus.StoreNotFound }; | ||
@@ -94,6 +97,9 @@ } | ||
let res; | ||
this.serverSideRowModel.executeOnStore(transaction.route, store => { | ||
const hasStarted = this.serverSideRowModel.executeOnStore(transaction.route, store => { | ||
res = store.applyTransaction(transaction); | ||
}); | ||
if (res) { | ||
if (!hasStarted) { | ||
return { status: core_1.ServerSideTransactionResultStatus.StoreNotStarted }; | ||
} | ||
else if (res) { | ||
this.valueCache.onDataChanged(); | ||
@@ -113,15 +119,15 @@ if (res.remove) { | ||
__decorate([ | ||
core_1.Autowired('rowNodeBlockLoader') | ||
(0, core_1.Autowired)('rowNodeBlockLoader') | ||
], TransactionManager.prototype, "rowNodeBlockLoader", void 0); | ||
__decorate([ | ||
core_1.Autowired('valueCache') | ||
(0, core_1.Autowired)('valueCache') | ||
], TransactionManager.prototype, "valueCache", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowModel') | ||
(0, core_1.Autowired)('rowModel') | ||
], TransactionManager.prototype, "serverSideRowModel", void 0); | ||
__decorate([ | ||
core_1.Autowired('rowRenderer') | ||
(0, core_1.Autowired)('rowRenderer') | ||
], TransactionManager.prototype, "rowRenderer", void 0); | ||
__decorate([ | ||
core_1.Autowired('selectionService') | ||
(0, core_1.Autowired)('selectionService') | ||
], TransactionManager.prototype, "selectionService", void 0); | ||
@@ -132,4 +138,4 @@ __decorate([ | ||
TransactionManager = __decorate([ | ||
core_1.Bean('ssrmTransactionManager') | ||
(0, core_1.Bean)('ssrmTransactionManager') | ||
], TransactionManager); | ||
exports.TransactionManager = TransactionManager; |
@@ -18,2 +18,3 @@ "use strict"; | ||
const version_1 = require("./version"); | ||
const serverSideExpansionService_1 = require("./serverSideRowModel/services/serverSideExpansionService"); | ||
exports.ServerSideRowModelModule = { | ||
@@ -24,3 +25,3 @@ version: version_1.VERSION, | ||
beans: [serverSideRowModel_1.ServerSideRowModel, expandListener_1.ExpandListener, sortListener_1.SortListener, storeUtils_1.StoreUtils, blockUtils_1.BlockUtils, nodeManager_1.NodeManager, transactionManager_1.TransactionManager, | ||
filterListener_1.FilterListener, storeFactory_1.StoreFactory, listenerUtils_1.ListenerUtils, serverSideSelectionService_1.ServerSideSelectionService], | ||
filterListener_1.FilterListener, storeFactory_1.StoreFactory, listenerUtils_1.ListenerUtils, serverSideSelectionService_1.ServerSideSelectionService, serverSideExpansionService_1.ServerSideExpansionService], | ||
dependantModules: [ | ||
@@ -27,0 +28,0 @@ core_2.EnterpriseCoreModule |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "30.2.1"; | ||
export declare const VERSION = "31.0.0"; |
@@ -5,2 +5,2 @@ "use strict"; | ||
// DO NOT UPDATE MANUALLY: Generated from script during build time | ||
exports.VERSION = '30.2.1'; | ||
exports.VERSION = '31.0.0'; |
@@ -8,5 +8,3 @@ import { RowBounds, BeanStub, Column, RowNode, NumberSequence, IRowNode } from "@ag-grid-community/core"; | ||
private beans; | ||
private rowHeight; | ||
private usingMasterDetail; | ||
private postConstruct; | ||
private readonly expansionService; | ||
createRowNode(params: { | ||
@@ -13,0 +11,0 @@ group: boolean; |
@@ -22,3 +22,3 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
import { _, Autowired, Bean, BeanStub, PostConstruct, RowNode } from "@ag-grid-community/core"; | ||
import { _, Autowired, Bean, BeanStub, RowNode } from "@ag-grid-community/core"; | ||
export var GROUP_MISSING_KEY_ID = 'ag-Grid-MissingKey'; | ||
@@ -30,9 +30,5 @@ var BlockUtils = /** @class */ (function (_super) { | ||
} | ||
BlockUtils.prototype.postConstruct = function () { | ||
this.rowHeight = this.gridOptionsService.getRowHeightAsNumber(); | ||
this.usingMasterDetail = this.gridOptionsService.is('masterDetail'); | ||
}; | ||
BlockUtils.prototype.createRowNode = function (params) { | ||
var rowNode = new RowNode(this.beans); | ||
var rowHeight = params.rowHeight != null ? params.rowHeight : this.rowHeight; | ||
var rowHeight = params.rowHeight != null ? params.rowHeight : this.gridOptionsService.getRowHeightAsNumber(); | ||
rowNode.setRowHeight(rowHeight); | ||
@@ -96,3 +92,3 @@ rowNode.group = params.group; | ||
if (rowNode.rowGroupColumn) { | ||
console.warn("column = " + rowNode.rowGroupColumn.getId()); | ||
console.warn("column = ".concat(rowNode.rowGroupColumn.getId())); | ||
} | ||
@@ -122,3 +118,3 @@ console.warn("data is ", rowNode.data); | ||
rowNode.updateData(data); | ||
if (this.gridOptionsService.is('treeData')) { | ||
if (this.gridOptionsService.get('treeData')) { | ||
this.setTreeGroupInfo(rowNode); | ||
@@ -148,3 +144,3 @@ this.setChildCountIntoRowNode(rowNode); | ||
} | ||
else if (this.usingMasterDetail) { | ||
else if (this.gridOptionsService.get('masterDetail')) { | ||
// this should be implemented, however it's not the use case i'm currently | ||
@@ -158,3 +154,3 @@ // programming, so leaving for another day. to test this, create an example | ||
rowNode.stub = false; | ||
var treeData = this.gridOptionsService.is('treeData'); | ||
var treeData = this.gridOptionsService.get('treeData'); | ||
if (_.exists(data)) { | ||
@@ -168,3 +164,3 @@ rowNode.setDataAndId(data, defaultId); | ||
} | ||
else if (this.usingMasterDetail) { | ||
else if (this.gridOptionsService.get('masterDetail')) { | ||
this.setMasterDetailInfo(rowNode); | ||
@@ -197,3 +193,3 @@ } | ||
var groupDisplayCols = this.columnModel.getGroupDisplayColumns(); | ||
var usingTreeData = this.gridOptionsService.is('treeData'); | ||
var usingTreeData = this.gridOptionsService.get('treeData'); | ||
groupDisplayCols.forEach(function (col) { | ||
@@ -262,3 +258,3 @@ if (rowNode.groupData == null) { | ||
if (_.missing(topPointer) || _.missing(bottomPointer)) { | ||
console.warn("AG Grid: error: topPointer = " + topPointer + ", bottomPointer = " + bottomPointer); | ||
console.warn("AG Grid: error: topPointer = ".concat(topPointer, ", bottomPointer = ").concat(bottomPointer)); | ||
return undefined; | ||
@@ -292,3 +288,3 @@ } | ||
else { | ||
console.warn("AG Grid: error: unable to locate rowIndex = " + displayRowIndex + " in cache"); | ||
console.warn("AG Grid: error: unable to locate rowIndex = ".concat(displayRowIndex, " in cache")); | ||
return undefined; | ||
@@ -359,23 +355,3 @@ } | ||
BlockUtils.prototype.checkOpenByDefault = function (rowNode) { | ||
if (!rowNode.isExpandable()) { | ||
return; | ||
} | ||
var userFunc = this.gridOptionsService.getCallback('isServerSideGroupOpenByDefault'); | ||
if (!userFunc) { | ||
return; | ||
} | ||
var params = { | ||
data: rowNode.data, | ||
rowNode: rowNode | ||
}; | ||
var userFuncRes = userFunc(params); | ||
if (userFuncRes) { | ||
// we do this in a timeout, so that we don't expand a row node while in the middle | ||
// of setting up rows, setting up rows is complex enough without another chunk of work | ||
// getting added to the call stack. this is also helpful as openByDefault may or may | ||
// not happen (so makes setting up rows more deterministic by expands never happening) | ||
// and also checkOpenByDefault is shard with both store types, so easier control how it | ||
// impacts things by keeping it in new VM turn. | ||
window.setTimeout(function () { return rowNode.setExpanded(true); }, 0); | ||
} | ||
return this.expansionService.checkOpenByDefault(rowNode); | ||
}; | ||
@@ -395,4 +371,4 @@ __decorate([ | ||
__decorate([ | ||
PostConstruct | ||
], BlockUtils.prototype, "postConstruct", null); | ||
Autowired('expansionService') | ||
], BlockUtils.prototype, "expansionService", void 0); | ||
BlockUtils = __decorate([ | ||
@@ -399,0 +375,0 @@ Bean('ssrmBlockUtils') |
@@ -46,3 +46,3 @@ var __extends = (this && this.__extends) || (function () { | ||
} | ||
else if (this.gridOptionsService.is('purgeClosedRowNodes') && _.exists(rowNode.childStore)) { | ||
else if (this.gridOptionsService.get('purgeClosedRowNodes') && _.exists(rowNode.childStore)) { | ||
rowNode.childStore = this.destroyBean(rowNode.childStore); | ||
@@ -49,0 +49,0 @@ } |
@@ -9,2 +9,3 @@ import { BeanStub } from "@ag-grid-community/core"; | ||
private findChangedColumns; | ||
private getAdvancedFilterColumns; | ||
} |
@@ -29,2 +29,3 @@ var __extends = (this && this.__extends) || (function () { | ||
FilterListener.prototype.postConstruct = function () { | ||
var _this = this; | ||
// only want to be active if SSRM active, otherwise would be interfering with other row models | ||
@@ -34,5 +35,6 @@ if (!this.gridOptionsService.isRowModelType('serverSide')) { | ||
} | ||
this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this)); | ||
this.addManagedListener(this.eventService, Events.EVENT_ADVANCED_FILTER_ENABLED_CHANGED, function () { return _this.onFilterChanged(true); }); | ||
this.addManagedListener(this.eventService, Events.EVENT_FILTER_CHANGED, function () { return _this.onFilterChanged(); }); | ||
}; | ||
FilterListener.prototype.onFilterChanged = function () { | ||
FilterListener.prototype.onFilterChanged = function (advancedFilterEnabledChanged) { | ||
var storeParams = this.serverSideRowModel.getParams(); | ||
@@ -42,5 +44,25 @@ if (!storeParams) { | ||
} // params is undefined if no datasource set | ||
var newModel = this.filterManager.getFilterModel(); | ||
var oldModel = storeParams ? storeParams.filterModel : {}; | ||
var changedColumns = this.findChangedColumns(newModel, oldModel); | ||
var oldModel = storeParams.filterModel; | ||
var newModel; | ||
var changedColumns; | ||
if (this.filterManager.isAdvancedFilterEnabled()) { | ||
newModel = this.filterManager.getAdvancedFilterModel(); | ||
// if advancedFilterEnabledChanged, old model is of type `FilterModel` | ||
var oldColumns = advancedFilterEnabledChanged ? Object.keys(oldModel !== null && oldModel !== void 0 ? oldModel : {}) : this.getAdvancedFilterColumns(oldModel); | ||
var newColumns_1 = this.getAdvancedFilterColumns(newModel); | ||
oldColumns.forEach(function (column) { return newColumns_1.add(column); }); | ||
changedColumns = Array.from(newColumns_1); | ||
} | ||
else { | ||
newModel = this.filterManager.getFilterModel(); | ||
if (advancedFilterEnabledChanged) { | ||
// old model is of type `AdvancedFilterModel | null` | ||
var oldColumns_1 = this.getAdvancedFilterColumns(oldModel); | ||
Object.keys(newModel).forEach(function (column) { return oldColumns_1.add(column); }); | ||
changedColumns = Array.from(oldColumns_1); | ||
} | ||
else { | ||
changedColumns = this.findChangedColumns(oldModel, newModel); | ||
} | ||
} | ||
var valueColChanged = this.listenerUtils.isSortingWithValueColumn(changedColumns); | ||
@@ -70,2 +92,18 @@ var secondaryColChanged = this.listenerUtils.isSortingWithSecondaryColumn(changedColumns); | ||
}; | ||
FilterListener.prototype.getAdvancedFilterColumns = function (model) { | ||
var columns = new Set(); | ||
if (!model) { | ||
return columns; | ||
} | ||
var processAdvancedFilterModel = function (filterModel) { | ||
if (filterModel.filterType === 'join') { | ||
filterModel.conditions.forEach(function (condition) { return processAdvancedFilterModel(condition); }); | ||
} | ||
else { | ||
columns.add(filterModel.colId); | ||
} | ||
}; | ||
processAdvancedFilterModel(model); | ||
return columns; | ||
}; | ||
__decorate([ | ||
@@ -72,0 +110,0 @@ Autowired('rowModel') |
@@ -1,13 +0,9 @@ | ||
import { BeanStub, SortModelItem } from "@ag-grid-community/core"; | ||
import { BeanStub } from "@ag-grid-community/core"; | ||
export declare class SortListener extends BeanStub { | ||
private sortController; | ||
private columnModel; | ||
private serverSideRowModel; | ||
private listenerUtils; | ||
private postConstruct; | ||
extractSortModel(): SortModelItem[]; | ||
private removeMultiColumnPrefixOnColumnIds; | ||
private replaceAutoGroupColumnWithActualRowGroupColumns; | ||
private onSortChanged; | ||
private findChangedColumnsInSort; | ||
} |
@@ -22,3 +22,3 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
import { _, Autowired, Bean, BeanStub, GROUP_AUTO_COLUMN_ID, Events, PostConstruct } from "@ag-grid-community/core"; | ||
import { Autowired, Bean, BeanStub, Events, PostConstruct } from "@ag-grid-community/core"; | ||
var SortListener = /** @class */ (function (_super) { | ||
@@ -36,41 +36,2 @@ __extends(SortListener, _super); | ||
}; | ||
SortListener.prototype.extractSortModel = function () { | ||
var sortModel = this.sortController.getSortModel(); | ||
// when using tree data we just return the sort model with the 'ag-Grid-AutoColumn' as is, i.e not broken out | ||
// into it's constitute group columns as they are not defined up front and can vary per node. | ||
if (this.gridOptionsService.is('treeData')) { | ||
return sortModel; | ||
} | ||
// it autoCol is active, we don't want to send this to the server. instead we want to | ||
// send the | ||
this.replaceAutoGroupColumnWithActualRowGroupColumns(sortModel); | ||
this.removeMultiColumnPrefixOnColumnIds(sortModel); | ||
return sortModel; | ||
}; | ||
SortListener.prototype.removeMultiColumnPrefixOnColumnIds = function (sortModel) { | ||
if (this.gridOptionsService.isGroupMultiAutoColumn()) { | ||
var multiColumnPrefix = GROUP_AUTO_COLUMN_ID + "-"; | ||
for (var i = 0; i < sortModel.length; ++i) { | ||
if (sortModel[i].colId.indexOf(multiColumnPrefix) > -1) { | ||
sortModel[i].colId = sortModel[i].colId.substr(multiColumnPrefix.length); | ||
} | ||
} | ||
} | ||
}; | ||
SortListener.prototype.replaceAutoGroupColumnWithActualRowGroupColumns = function (sortModel) { | ||
// find index of auto group column in sort model | ||
var autoGroupSortModel = sortModel.find(function (sm) { return sm.colId == GROUP_AUTO_COLUMN_ID; }); | ||
// replace auto column with individual group columns | ||
if (autoGroupSortModel) { | ||
// remove auto group column | ||
var autoGroupIndex = sortModel.indexOf(autoGroupSortModel); | ||
_.removeFromArray(sortModel, autoGroupSortModel); | ||
var isNotInSortModel = function (col) { return sortModel.filter(function (sm) { return sm.colId === col.getColId(); }).length == 0; }; | ||
var mapColumnToSortModel = function (col) { return ({ colId: col.getId(), sort: autoGroupSortModel.sort }); }; | ||
var newModels = this.columnModel.getRowGroupColumns() | ||
.filter(isNotInSortModel) | ||
.map(mapColumnToSortModel); | ||
_.insertArrayIntoArray(sortModel, newModels, autoGroupIndex); | ||
} | ||
}; | ||
SortListener.prototype.onSortChanged = function () { | ||
@@ -81,3 +42,3 @@ var storeParams = this.serverSideRowModel.getParams(); | ||
} // params is undefined if no datasource set | ||
var newSortModel = this.extractSortModel(); | ||
var newSortModel = this.sortController.getSortModel(); | ||
var oldSortModel = storeParams.sortModel; | ||
@@ -126,5 +87,2 @@ var changedColumns = this.findChangedColumnsInSort(newSortModel, oldSortModel); | ||
__decorate([ | ||
Autowired('columnModel') | ||
], SortListener.prototype, "columnModel", void 0); | ||
__decorate([ | ||
Autowired('rowModel') | ||
@@ -131,0 +89,0 @@ ], SortListener.prototype, "serverSideRowModel", void 0); |
@@ -15,3 +15,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
if (this.rowNodes[id]) { | ||
console.warn("AG Grid: Duplicate node id " + rowNode.id + ". Row ID's are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values."); | ||
console.warn("AG Grid: Duplicate node id ".concat(rowNode.id, ". Row ID's are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.")); | ||
console.warn('first instance', this.rowNodes[id].data); | ||
@@ -18,0 +18,0 @@ console.warn('second instance', rowNode.data); |
@@ -1,5 +0,5 @@ | ||
import { BeanStub, Column, ColumnVO, IServerSideDatasource, IServerSideRowModel, IServerSideStore, NumberSequence, RowBounds, RowNode, StoreRefreshAfterParams, RefreshServerSideParams, ServerSideGroupLevelState, SortModelItem, RowModelType, LoadSuccessParams } from "@ag-grid-community/core"; | ||
import { BeanStub, Column, ColumnVO, IServerSideDatasource, IServerSideRowModel, IServerSideStore, NumberSequence, RowBounds, RowNode, StoreRefreshAfterParams, RefreshServerSideParams, ServerSideGroupLevelState, SortModelItem, RowModelType, LoadSuccessParams, FilterModel, AdvancedFilterModel } from "@ag-grid-community/core"; | ||
export interface SSRMParams { | ||
sortModel: SortModelItem[]; | ||
filterModel: any; | ||
filterModel: FilterModel | AdvancedFilterModel | null; | ||
lastAccessedSequence: NumberSequence; | ||
@@ -16,2 +16,3 @@ dynamicRowHeight: boolean; | ||
private filterManager; | ||
private sortController; | ||
private rowRenderer; | ||
@@ -34,2 +35,3 @@ private sortListener; | ||
private addEventListeners; | ||
private updateDatasource; | ||
private verifyProps; | ||
@@ -43,2 +45,4 @@ setDatasource(datasource: IServerSideDatasource): void; | ||
generateSecondaryColumns(pivotFields: string[]): void; | ||
resetRowHeights(): void; | ||
private resetRowHeightsForAllRowNodes; | ||
resetRootStore(): void; | ||
@@ -62,3 +66,3 @@ columnsToValueObjects(columns: Column[]): ColumnVO[]; | ||
expandAll(value: boolean): void; | ||
refreshAfterFilter(newFilterModel: any, params: StoreRefreshAfterParams): void; | ||
refreshAfterFilter(newFilterModel: FilterModel | AdvancedFilterModel | null, params: StoreRefreshAfterParams): void; | ||
getRootStore(): IServerSideStore | undefined; | ||
@@ -76,3 +80,4 @@ getRowCount(): number; | ||
forEachNodeAfterFilterAndSort(callback: (node: RowNode, index: number) => void, includeFooterNodes?: boolean): void; | ||
executeOnStore(route: string[], callback: (cache: IServerSideStore) => void): void; | ||
/** @return false if store hasn't started */ | ||
executeOnStore(route: string[], callback: (cache: IServerSideStore) => void): boolean; | ||
refreshStore(params?: RefreshServerSideParams): void; | ||
@@ -79,0 +84,0 @@ getStoreState(): ServerSideGroupLevelState[]; |
@@ -55,6 +55,3 @@ var __extends = (this && this.__extends) || (function () { | ||
this.started = true; | ||
var datasource = this.gridOptionsService.get('serverSideDatasource'); | ||
if (datasource) { | ||
this.setDatasource(datasource); | ||
} | ||
this.updateDatasource(); | ||
}; | ||
@@ -72,2 +69,3 @@ ServerSideRowModel.prototype.destroyDatasource = function () { | ||
ServerSideRowModel.prototype.addEventListeners = function () { | ||
var _this = this; | ||
this.addManagedListener(this.eventService, Events.EVENT_NEW_COLUMNS_LOADED, this.onColumnEverything.bind(this)); | ||
@@ -80,13 +78,26 @@ this.addManagedListener(this.eventService, Events.EVENT_STORE_UPDATED, this.onStoreUpdated.bind(this)); | ||
this.addManagedListener(this.eventService, Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, resetListener); | ||
this.addManagedPropertyListener('treeData', resetListener); | ||
this.addManagedPropertyListeners([ | ||
/** | ||
* Following properties omitted as they are likely to come with undesired side effects. | ||
* 'getRowId', 'isRowMaster', 'getRowHeight', 'isServerSideGroup', 'getServerSideGroupKey', | ||
* */ | ||
'masterDetail', 'treeData', 'removePivotHeaderRowWhenSingleValueColumn', | ||
'suppressServerSideInfiniteScroll', 'cacheBlockSize', | ||
], resetListener); | ||
this.addManagedPropertyListener('rowHeight', function () { return _this.resetRowHeights(); }); | ||
this.verifyProps(); | ||
this.addManagedPropertyListener('serverSideDatasource', function () { return _this.updateDatasource(); }); | ||
}; | ||
ServerSideRowModel.prototype.updateDatasource = function () { | ||
var datasource = this.gridOptionsService.get('serverSideDatasource'); | ||
if (datasource) { | ||
this.setDatasource(datasource); | ||
} | ||
}; | ||
ServerSideRowModel.prototype.verifyProps = function () { | ||
if (this.gridOptionsService.exists('initialGroupOrderComparator')) { | ||
var message_1 = "AG Grid: initialGroupOrderComparator cannot be used with Server Side Row Model. If using Full Store, then provide the rows to the grid in the desired sort order. If using Infinite Scroll, then sorting is done on the server side, nothing to do with the client."; | ||
_.doOnce(function () { return console.warn(message_1); }, 'SSRM.InitialGroupOrderComparator'); | ||
_.warnOnce("initialGroupOrderComparator cannot be used with Server Side Row Model."); | ||
} | ||
if (this.gridOptionsService.isRowSelection() && !this.gridOptionsService.exists('getRowId')) { | ||
var message_2 = "AG Grid: getRowId callback must be provided for Server Side Row Model selection to work correctly."; | ||
_.doOnce(function () { return console.warn(message_2); }, 'SSRM.SelectionNeedsRowNodeIdFunc'); | ||
_.warnOnce("getRowId callback must be provided for Server Side Row Model selection to work correctly."); | ||
} | ||
@@ -157,3 +168,3 @@ }; | ||
}; | ||
var sortModelDifferent = !_.jsonEquals(this.storeParams.sortModel, this.sortListener.extractSortModel()); | ||
var sortModelDifferent = !_.jsonEquals(this.storeParams.sortModel, this.sortController.getSortModel()); | ||
var rowGroupDifferent = !areColsSame({ | ||
@@ -209,2 +220,38 @@ oldCols: this.storeParams.rowGroupCols, | ||
; | ||
ServerSideRowModel.prototype.resetRowHeights = function () { | ||
var atLeastOne = this.resetRowHeightsForAllRowNodes(); | ||
var rootNodeHeight = this.gridOptionsService.getRowHeightForNode(this.rootNode); | ||
this.rootNode.setRowHeight(rootNodeHeight.height, rootNodeHeight.estimated); | ||
if (this.rootNode.sibling) { | ||
var rootNodeSibling = this.gridOptionsService.getRowHeightForNode(this.rootNode.sibling); | ||
this.rootNode.sibling.setRowHeight(rootNodeSibling.height, rootNodeSibling.estimated); | ||
} | ||
// when pivotMode but pivot not active, root node is displayed on its own | ||
// because it's only ever displayed alone, refreshing the model (onRowHeightChanged) is not required | ||
if (atLeastOne) { | ||
this.onRowHeightChanged(); | ||
} | ||
}; | ||
ServerSideRowModel.prototype.resetRowHeightsForAllRowNodes = function () { | ||
var _this = this; | ||
var atLeastOne = false; | ||
this.forEachNode(function (rowNode) { | ||
var rowHeightForNode = _this.gridOptionsService.getRowHeightForNode(rowNode); | ||
rowNode.setRowHeight(rowHeightForNode.height, rowHeightForNode.estimated); | ||
// we keep the height each row is at, however we set estimated=true rather than clear the height. | ||
// this means the grid will not reset the row heights back to defaults, rather it will re-calc | ||
// the height for each row as the row is displayed. otherwise the scroll will jump when heights are reset. | ||
var detailNode = rowNode.detailNode; | ||
if (detailNode) { | ||
var detailRowHeight = _this.gridOptionsService.getRowHeightForNode(detailNode); | ||
detailNode.setRowHeight(detailRowHeight.height, detailRowHeight.estimated); | ||
} | ||
if (rowNode.sibling) { | ||
var siblingRowHeight = _this.gridOptionsService.getRowHeightForNode(rowNode.sibling); | ||
detailNode.setRowHeight(siblingRowHeight.height, siblingRowHeight.estimated); | ||
} | ||
atLeastOne = true; | ||
}); | ||
return atLeastOne; | ||
}; | ||
ServerSideRowModel.prototype.resetRootStore = function () { | ||
@@ -225,7 +272,2 @@ this.destroyRootStore(); | ||
} | ||
// this event shows/hides 'no rows' overlay | ||
var rowDataChangedEvent = { | ||
type: Events.EVENT_ROW_DATA_UPDATED | ||
}; | ||
this.eventService.dispatchEvent(rowDataChangedEvent); | ||
// this gets the row to render rows (or remove the previously rendered rows, as it's blank to start). | ||
@@ -257,4 +299,6 @@ // important to NOT pass in an event with keepRenderedRows or animate, as we want the renderer | ||
// sort and filter model | ||
filterModel: this.filterManager.getFilterModel(), | ||
sortModel: this.sortListener.extractSortModel(), | ||
filterModel: this.filterManager.isAdvancedFilterEnabled() | ||
? this.filterManager.getAdvancedFilterModel() | ||
: this.filterManager.getFilterModel(), | ||
sortModel: this.sortController.getSortModel(), | ||
datasource: this.datasource, | ||
@@ -443,6 +487,10 @@ lastAccessedSequence: new NumberSequence(), | ||
}; | ||
/** @return false if store hasn't started */ | ||
ServerSideRowModel.prototype.executeOnStore = function (route, callback) { | ||
if (!this.started) { | ||
return false; | ||
} | ||
var rootStore = this.getRootStore(); | ||
if (!rootStore) { | ||
return; | ||
return true; | ||
} | ||
@@ -453,2 +501,3 @@ var storeToExecuteOn = rootStore.getChildStore(route); | ||
} | ||
return true; | ||
}; | ||
@@ -530,2 +579,5 @@ ServerSideRowModel.prototype.refreshStore = function (params) { | ||
__decorate([ | ||
Autowired('sortController') | ||
], ServerSideRowModel.prototype, "sortController", void 0); | ||
__decorate([ | ||
Autowired('rowRenderer') | ||
@@ -532,0 +584,0 @@ ], ServerSideRowModel.prototype, "rowRenderer", void 0); |
@@ -38,6 +38,10 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -66,3 +70,3 @@ import { Autowired, BeanStub, Events, PostConstruct } from "@ag-grid-community/core"; | ||
selectAll: this.selectedState.selectAll, | ||
toggledNodes: __spreadArray([], __read(this.selectedState.toggledNodes)), | ||
toggledNodes: __spreadArray([], __read(this.selectedState.toggledNodes), false), | ||
}; | ||
@@ -93,3 +97,3 @@ }; | ||
else { | ||
console.warn("AG Grid: Provided ids must be of string type. Invalid id provided: " + key); | ||
console.warn("AG Grid: Provided ids must be of string type. Invalid id provided: ".concat(key)); | ||
} | ||
@@ -96,0 +100,0 @@ }); |
@@ -60,6 +60,10 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -80,3 +84,3 @@ import { Autowired, BeanStub, PostConstruct, Events } from "@ag-grid-community/core"; | ||
// when the grouping changes, the state no longer makes sense, so reset the state. | ||
this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, function () { return _this.selectionService.reset(); }); | ||
this.addManagedListener(this.eventService, Events.EVENT_COLUMN_ROW_GROUP_CHANGED, function () { return _this.selectionService.reset('rowGroupChanged'); }); | ||
}; | ||
@@ -146,3 +150,3 @@ GroupSelectsChildrenStrategy.prototype.getSelectedState = function () { | ||
var parentState = this.selectedState; | ||
var remainingRoute = __spreadArray([], __read(parentRoute)); | ||
var remainingRoute = __spreadArray([], __read(parentRoute), false); | ||
while (parentState && remainingRoute.length) { | ||
@@ -149,0 +153,0 @@ parentState = parentState.toggledNodes.get(remainingRoute.pop()); |
@@ -1,9 +0,8 @@ | ||
import { BeanStub, ChangedPath, ISelectionService, IServerSideSelectionState, IServerSideGroupSelectionState, RowNode, SelectionEventSourceType, ISetNodesSelectedParams } from "@ag-grid-community/core"; | ||
import { BeanStub, ChangedPath, ISelectionService, RowNode, SelectionEventSourceType, ISetNodesSelectedParams, ServerSideRowSelectionState, ServerSideRowGroupSelectionState } from "@ag-grid-community/core"; | ||
export declare class ServerSideSelectionService extends BeanStub implements ISelectionService { | ||
private rowModel; | ||
private selectionStrategy; | ||
private rowSelection; | ||
private init; | ||
getServerSideSelectionState(): any; | ||
setServerSideSelectionState(state: IServerSideSelectionState | IServerSideGroupSelectionState): void; | ||
getSelectionState(): string[] | ServerSideRowSelectionState | ServerSideRowGroupSelectionState | null; | ||
setSelectionState(state: string[] | ServerSideRowSelectionState | ServerSideRowGroupSelectionState, source: SelectionEventSourceType): void; | ||
setNodesSelected(params: ISetNodesSelectedParams): number; | ||
@@ -10,0 +9,0 @@ /** |
@@ -54,3 +54,3 @@ var __extends = (this && this.__extends) || (function () { | ||
var _this = this; | ||
var groupSelectsChildren = this.gridOptionsService.is('groupSelectsChildren'); | ||
var groupSelectsChildren = this.gridOptionsService.get('groupSelectsChildren'); | ||
this.addManagedPropertyListener('groupSelectsChildren', function (propChange) { | ||
@@ -67,11 +67,13 @@ _this.destroyBean(_this.selectionStrategy); | ||
}); | ||
this.rowSelection = this.gridOptionsService.get('rowSelection'); | ||
this.addManagedPropertyListener('rowSelection', function (propChange) { return _this.rowSelection = propChange.currentValue; }); | ||
this.addManagedPropertyListener('rowSelection', function () { return _this.deselectAllRowNodes({ source: 'api' }); }); | ||
var StrategyClazz = !groupSelectsChildren ? DefaultStrategy : GroupSelectsChildrenStrategy; | ||
this.selectionStrategy = this.createManagedBean(new StrategyClazz()); | ||
}; | ||
ServerSideSelectionService.prototype.getServerSideSelectionState = function () { | ||
ServerSideSelectionService.prototype.getSelectionState = function () { | ||
return this.selectionStrategy.getSelectedState(); | ||
}; | ||
ServerSideSelectionService.prototype.setServerSideSelectionState = function (state) { | ||
ServerSideSelectionService.prototype.setSelectionState = function (state, source) { | ||
if (Array.isArray(state)) { | ||
return; | ||
} | ||
this.selectionStrategy.setSelectedState(state); | ||
@@ -81,3 +83,3 @@ this.shotgunResetNodeSelectionState(); | ||
type: Events.EVENT_SELECTION_CHANGED, | ||
source: 'api', | ||
source: source, | ||
}; | ||
@@ -88,3 +90,4 @@ this.eventService.dispatchEvent(event); | ||
var nodes = params.nodes, otherParams = __rest(params, ["nodes"]); | ||
if (nodes.length > 1 && this.rowSelection !== 'multiple') { | ||
var rowSelection = this.gridOptionsService.get('rowSelection'); | ||
if (nodes.length > 1 && rowSelection !== 'multiple') { | ||
console.warn("AG Grid: cannot multi select while rowSelection='single'"); | ||
@@ -91,0 +94,0 @@ return 0; |
@@ -40,3 +40,3 @@ var __extends = (this && this.__extends) || (function () { | ||
var _this = this; | ||
this.usingTreeData = this.gridOptionsService.is('treeData'); | ||
this.usingTreeData = this.gridOptionsService.get('treeData'); | ||
this.nodeIdPrefix = this.blockUtils.createNodeIdPrefix(this.parentRowNode); | ||
@@ -51,3 +51,3 @@ if (!this.usingTreeData && this.groupLevel) { | ||
var userInitialRowCount = this.storeUtils.getServerSideInitialRowCount(); | ||
if (isRootStore && userInitialRowCount !== undefined) { | ||
if (isRootStore && userInitialRowCount != null) { | ||
initialRowCount = userInitialRowCount; | ||
@@ -59,2 +59,7 @@ } | ||
this.postSortFunc = this.gridOptionsService.getCallback('postSortRows'); | ||
if (userInitialRowCount != null) { | ||
this.eventService.dispatchEventOnce({ | ||
type: Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
}; | ||
@@ -97,5 +102,3 @@ FullStore.prototype.destroyRowNodes = function () { | ||
storeParams: this.ssrmParams, | ||
successCallback: this.pageLoaded.bind(this, this.getVersion()), | ||
success: this.success.bind(this, this.getVersion()), | ||
failCallback: this.pageLoadFailed.bind(this, this.getVersion()), | ||
fail: this.pageLoadFailed.bind(this, this.getVersion()) | ||
@@ -145,3 +148,3 @@ }); | ||
} | ||
var info = params.storeInfo || params.groupLevelInfo; | ||
var info = params.groupLevelInfo; | ||
if (info) { | ||
@@ -159,4 +162,3 @@ Object.assign(this.info, info); | ||
if (!params.rowData) { | ||
var message_1 = 'AG Grid: "params.data" is missing from Server-Side Row Model success() callback. Please use the "data" attribute. If no data is returned, set an empty list.'; | ||
_.doOnce(function () { return console.warn(message_1, params); }, 'FullStore.noData'); | ||
_.warnOnce('"params.data" is missing from Server-Side Row Model success() callback. Please use the "data" attribute. If no data is returned, set an empty list.'); | ||
} | ||
@@ -167,2 +169,7 @@ this.createOrRecycleNodes(nodesToRecycle, params.rowData); | ||
} | ||
if (this.level === 0) { | ||
this.eventService.dispatchEventOnce({ | ||
type: Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
this.filterAndSortNodes(); | ||
@@ -439,3 +446,2 @@ this.fireStoreUpdatedEvent(); | ||
parentNode: this.parentRowNode, | ||
storeInfo: this.info, | ||
groupLevelInfo: this.info | ||
@@ -561,3 +567,3 @@ }; | ||
if (!rowNode) { | ||
console.error("AG Grid: could not find row id=" + id + ", data item was not found for this id"); | ||
console.error("AG Grid: could not find row id=".concat(id, ", data item was not found for this id")); | ||
return null; | ||
@@ -564,0 +570,0 @@ } |
@@ -5,3 +5,2 @@ import { BeanStub, RowNode, ServerSideGroupLevelParams } from "@ag-grid-community/core"; | ||
private api; | ||
private columnApi; | ||
private rowNodeBlockLoader; | ||
@@ -8,0 +7,0 @@ static DEFAULT_BLOCK_SIZE: number; |
@@ -152,9 +152,7 @@ var __extends = (this && this.__extends) || (function () { | ||
request: request, | ||
successCallback: function (rowData, rowCount) { return success({ rowData: rowData, rowCount: rowCount }); }, | ||
success: success, | ||
failCallback: fail, | ||
fail: fail, | ||
parentNode: this.parentNode, | ||
api: this.api, | ||
columnApi: this.columnApi, | ||
columnApi: this.gridOptionsService.columnApi, | ||
context: this.gridOptionsService.context | ||
@@ -186,3 +184,2 @@ }; | ||
var _this = this; | ||
var _a; | ||
var nextBlockToLoad = this.getNextBlockToLoad(); | ||
@@ -200,3 +197,3 @@ if (!nextBlockToLoad) { | ||
window.clearTimeout(this.loaderTimeout); | ||
var _b = __read(this.nextBlockToLoad, 2), startRowString = _b[0], endRow_1 = _b[1]; | ||
var _a = __read(this.nextBlockToLoad, 2), startRowString = _a[0], endRow_1 = _a[1]; | ||
var startRow_1 = Number(startRowString); | ||
@@ -210,3 +207,3 @@ this.loaderTimeout = window.setTimeout(function () { | ||
_this.nextBlockToLoad = undefined; | ||
}, (_a = this.gridOptionsService.getNum('blockLoadDebounceMillis')) !== null && _a !== void 0 ? _a : 0); | ||
}, this.gridOptionsService.get('blockLoadDebounceMillis')); | ||
} | ||
@@ -241,5 +238,2 @@ }; | ||
__decorate([ | ||
Autowired('columnApi') | ||
], LazyBlockLoader.prototype, "columnApi", void 0); | ||
__decorate([ | ||
Autowired('rowNodeBlockLoader') | ||
@@ -246,0 +240,0 @@ ], LazyBlockLoader.prototype, "rowNodeBlockLoader", void 0); |
@@ -38,6 +38,10 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -78,3 +82,3 @@ import { Autowired, BeanStub, PostConstruct, PreDestroy } from "@ag-grid-community/core"; | ||
this.getRowIdFunc = this.gridOptionsService.getCallback('getRowId'); | ||
this.isMasterDetail = this.gridOptionsService.is('masterDetail'); | ||
this.isMasterDetail = this.gridOptionsService.get('masterDetail'); | ||
}; | ||
@@ -438,6 +442,6 @@ LazyCache.prototype.destroyRowNodes = function () { | ||
var _c = __read(_a, 2), blockStart = _c[0], uniqueStates = _c[1]; | ||
var sortedStates = __spreadArray([], __read(uniqueStates)).sort(function (a, b) { var _a, _b; return ((_a = statePriorityMap[a]) !== null && _a !== void 0 ? _a : 0) - ((_b = statePriorityMap[b]) !== null && _b !== void 0 ? _b : 0); }); | ||
var sortedStates = __spreadArray([], __read(uniqueStates), false).sort(function (a, b) { var _a, _b; return ((_a = statePriorityMap[a]) !== null && _a !== void 0 ? _a : 0) - ((_b = statePriorityMap[b]) !== null && _b !== void 0 ? _b : 0); }); | ||
var priorityState = sortedStates[0]; | ||
var blockNumber = Number(blockStart) / _this.rowLoader.getBlockSize(); | ||
var blockId = blockPrefix ? blockPrefix + "-" + blockNumber : String(blockNumber); | ||
var blockId = blockPrefix ? "".concat(blockPrefix, "-").concat(blockNumber) : String(blockNumber); | ||
results[blockId] = { | ||
@@ -641,10 +645,9 @@ blockNumber: blockNumber, | ||
}); | ||
return __spreadArray([], __read(duplicates)); | ||
return __spreadArray([], __read(duplicates), false); | ||
}; | ||
LazyCache.prototype.onLoadSuccess = function (firstRowIndex, numberOfRowsExpected, response) { | ||
var _this = this; | ||
var _a; | ||
if (!this.live) | ||
return; | ||
var info = (_a = response.groupLevelInfo) !== null && _a !== void 0 ? _a : response.storeInfo; | ||
var info = response.groupLevelInfo; | ||
this.store.setStoreInfo(info); | ||
@@ -655,3 +658,3 @@ if (this.getRowIdFunc != null) { | ||
var duplicateIdText = duplicates.join(', '); | ||
console.warn("AG Grid: Unable to display rows as duplicate row ids (" + duplicateIdText + ") were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids."); | ||
console.warn("AG Grid: Unable to display rows as duplicate row ids (".concat(duplicateIdText, ") were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids.")); | ||
this.onLoadFailed(firstRowIndex, numberOfRowsExpected); | ||
@@ -873,3 +876,3 @@ return; | ||
var deletedNodeCount = 0; | ||
var remainingIdsToRemove = __spreadArray([], __read(idsToRemove)); | ||
var remainingIdsToRemove = __spreadArray([], __read(idsToRemove), false); | ||
var allNodes = this.getOrderedNodeMap(); | ||
@@ -876,0 +879,0 @@ var contiguousIndex = -1; |
@@ -38,6 +38,10 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -61,8 +65,12 @@ import { _, Autowired, BeanStub, Events, NumberSequence, PostConstruct, PreDestroy, ServerSideTransactionResultStatus } from "@ag-grid-community/core"; | ||
LazyStore.prototype.init = function () { | ||
var _a; | ||
var numberOfRows = 1; | ||
if (this.level === 0) { | ||
numberOfRows = this.storeUtils.getServerSideInitialRowCount(); | ||
numberOfRows = (_a = this.storeUtils.getServerSideInitialRowCount()) !== null && _a !== void 0 ? _a : 1; | ||
this.eventService.dispatchEventOnce({ | ||
type: Events.EVENT_ROW_COUNT_READY | ||
}); | ||
} | ||
this.cache = this.createManagedBean(new LazyCache(this, numberOfRows, this.storeParams)); | ||
var usingTreeData = this.gridOptionsService.is('treeData'); | ||
var usingTreeData = this.gridOptionsService.get('treeData'); | ||
if (!usingTreeData && this.group) { | ||
@@ -110,3 +118,2 @@ var groupColVo = this.ssrmParams.rowGroupCols[this.level]; | ||
parentNode: this.parentRowNode, | ||
storeInfo: this.info, | ||
groupLevelInfo: this.info | ||
@@ -134,3 +141,3 @@ }; | ||
var allIdsToRemove = transaction.remove.map(function (data) { return (idFunc({ level: _this.level, parentKeys: _this.parentRowNode.getGroupKeys(), data: data })); }); | ||
var allUniqueIdsToRemove = __spreadArray([], __read(new Set(allIdsToRemove))); | ||
var allUniqueIdsToRemove = __spreadArray([], __read(new Set(allIdsToRemove)), false); | ||
removedNodes = this.cache.removeRowNodes(allUniqueIdsToRemove); | ||
@@ -137,0 +144,0 @@ } |
@@ -16,3 +16,3 @@ var MultiIndexMap = /** @class */ (function () { | ||
if (!map) { | ||
throw new Error("AG Grid: " + String(index) + " not found"); | ||
throw new Error("AG Grid: ".concat(String(index), " not found")); | ||
} | ||
@@ -26,3 +26,3 @@ return map.get(key); | ||
if (!map) { | ||
throw new Error("AG Grid: " + String(index) + " not found"); | ||
throw new Error("AG Grid: ".concat(String(index), " not found")); | ||
} | ||
@@ -37,3 +37,3 @@ map.set(item[index], item); | ||
if (!map) { | ||
throw new Error("AG Grid: " + String(index) + " not found"); | ||
throw new Error("AG Grid: ".concat(String(index), " not found")); | ||
} | ||
@@ -49,3 +49,3 @@ map.delete(item[index]); | ||
if (!map) { | ||
throw new Error("AG Grid: " + String(index) + " not found"); | ||
throw new Error("AG Grid: ".concat(String(index), " not found")); | ||
} | ||
@@ -52,0 +52,0 @@ return map.values(); |
@@ -37,3 +37,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
? userStoreParams.maxBlocksInCache | ||
: this.gridOptionsService.getNum('maxBlocksInCache'); | ||
: this.gridOptionsService.get('maxBlocksInCache'); | ||
var maxBlocksActive = maxBlocksInCache != null && maxBlocksInCache >= 0; | ||
@@ -44,11 +44,11 @@ if (!maxBlocksActive) { | ||
if (ssrmParams.dynamicRowHeight) { | ||
var message_1 = 'AG Grid: Server Side Row Model does not support Dynamic Row Height and Cache Purging. ' + | ||
var message = 'Server Side Row Model does not support Dynamic Row Height and Cache Purging. ' + | ||
'Either a) remove getRowHeight() callback or b) remove maxBlocksInCache property. Purging has been disabled.'; | ||
_.doOnce(function () { return console.warn(message_1); }, 'storeFactory.maxBlocksInCache.dynamicRowHeight'); | ||
_.warnOnce(message); | ||
return undefined; | ||
} | ||
if (this.columnModel.isAutoRowHeightActive()) { | ||
var message_2 = 'AG Grid: Server Side Row Model does not support Auto Row Height and Cache Purging. ' + | ||
var message = 'Server Side Row Model does not support Auto Row Height and Cache Purging. ' + | ||
'Either a) remove colDef.autoHeight or b) remove maxBlocksInCache property. Purging has been disabled.'; | ||
_.doOnce(function () { return console.warn(message_2); }, 'storeFactory.maxBlocksInCache.autoRowHeightActive'); | ||
_.warnOnce(message); | ||
return undefined; | ||
@@ -64,3 +64,3 @@ } | ||
? userStoreParams.cacheBlockSize | ||
: this.gridOptionsService.getNum('cacheBlockSize'); | ||
: this.gridOptionsService.get('cacheBlockSize'); | ||
if (blockSize != null && blockSize > 0) { | ||
@@ -86,5 +86,2 @@ return blockSize; | ||
var res = callback(params); | ||
if (res.storeType != null) { | ||
res.suppressInfiniteScroll = res.storeType !== "partial"; | ||
} | ||
return res; | ||
@@ -99,3 +96,3 @@ }; | ||
StoreFactory.prototype.isSuppressServerSideInfiniteScroll = function () { | ||
return this.gridOptionsService.is('suppressServerSideInfiniteScroll'); | ||
return this.gridOptionsService.get('suppressServerSideInfiniteScroll'); | ||
}; | ||
@@ -102,0 +99,0 @@ __decorate([ |
import { IServerSideStore, BeanStub, StoreRefreshAfterParams, RowNode, ColumnVO, RowNodeBlock } from "@ag-grid-community/core"; | ||
import { SSRMParams } from "../serverSideRowModel"; | ||
export declare class StoreUtils extends BeanStub { | ||
private columnApi; | ||
private columnModel; | ||
private gridApi; | ||
private serverSideRowModel; | ||
@@ -13,4 +11,2 @@ private storeFactory; | ||
parentBlock: RowNodeBlock; | ||
successCallback: () => void; | ||
failCallback: () => void; | ||
success: () => void; | ||
@@ -23,3 +19,3 @@ fail: () => void; | ||
isServerRefreshNeeded(parentRowNode: RowNode, rowGroupCols: ColumnVO[], params: StoreRefreshAfterParams): boolean; | ||
getServerSideInitialRowCount(): number; | ||
getServerSideInitialRowCount(): number | null; | ||
private assertRowModelIsServerSide; | ||
@@ -26,0 +22,0 @@ private assertNotTreeData; |
@@ -46,10 +46,8 @@ var __extends = (this && this.__extends) || (function () { | ||
var getRowsParams = { | ||
successCallback: p.successCallback, | ||
success: p.success, | ||
failCallback: p.failCallback, | ||
fail: p.fail, | ||
request: request, | ||
parentNode: p.parentNode, | ||
api: this.gridApi, | ||
columnApi: this.columnApi, | ||
api: this.gridOptionsService.api, | ||
columnApi: this.gridOptionsService.columnApi, | ||
context: this.gridOptionsService.context | ||
@@ -60,3 +58,3 @@ }; | ||
// failCallback() is important, to reduce the 'RowNodeBlockLoader.activeBlockLoadsCount' count | ||
p.failCallback(); | ||
p.fail(); | ||
return; | ||
@@ -111,11 +109,7 @@ } | ||
StoreUtils.prototype.getServerSideInitialRowCount = function () { | ||
var rowCount = this.gridOptionsService.getNum('serverSideInitialRowCount'); | ||
if (typeof rowCount === 'number' && rowCount > 0) { | ||
return rowCount; | ||
} | ||
return 1; | ||
return this.gridOptionsService.get('serverSideInitialRowCount'); | ||
}; | ||
StoreUtils.prototype.assertRowModelIsServerSide = function (key) { | ||
if (!this.gridOptionsService.isRowModelType('serverSide')) { | ||
_.doOnce(function () { return console.warn("AG Grid: The '" + key + "' property can only be used with the Server Side Row Model."); }, key); | ||
_.warnOnce("The '".concat(key, "' property can only be used with the Server Side Row Model.")); | ||
return false; | ||
@@ -126,4 +120,4 @@ } | ||
StoreUtils.prototype.assertNotTreeData = function (key) { | ||
if (this.gridOptionsService.is('treeData')) { | ||
_.doOnce(function () { return console.warn("AG Grid: The '" + key + "' property cannot be used while using tree data."); }, key + '_TreeData'); | ||
if (this.gridOptionsService.get('treeData')) { | ||
_.warnOnce("The '".concat(key, "' property cannot be used while using tree data.")); | ||
return false; | ||
@@ -134,23 +128,17 @@ } | ||
StoreUtils.prototype.isServerSideSortAllLevels = function () { | ||
return this.gridOptionsService.is('serverSideSortAllLevels') && this.assertRowModelIsServerSide('serverSideSortAllLevels'); | ||
return this.gridOptionsService.get('serverSideSortAllLevels') && this.assertRowModelIsServerSide('serverSideSortAllLevels'); | ||
}; | ||
StoreUtils.prototype.isServerSideOnlyRefreshFilteredGroups = function () { | ||
return this.gridOptionsService.is('serverSideOnlyRefreshFilteredGroups') && this.assertRowModelIsServerSide('serverSideOnlyRefreshFilteredGroups'); | ||
return this.gridOptionsService.get('serverSideOnlyRefreshFilteredGroups') && this.assertRowModelIsServerSide('serverSideOnlyRefreshFilteredGroups'); | ||
}; | ||
StoreUtils.prototype.isServerSideSortOnServer = function () { | ||
return this.gridOptionsService.is('serverSideSortOnServer') && this.assertRowModelIsServerSide('serverSideSortOnServer') && this.assertNotTreeData('serverSideSortOnServer'); | ||
return this.gridOptionsService.get('serverSideSortOnServer') && this.assertRowModelIsServerSide('serverSideSortOnServer') && this.assertNotTreeData('serverSideSortOnServer'); | ||
}; | ||
StoreUtils.prototype.isServerSideFilterOnServer = function () { | ||
return this.gridOptionsService.is('serverSideFilterOnServer') && this.assertRowModelIsServerSide('serverSideFilterOnServer') && this.assertNotTreeData('serverSideFilterOnServer'); | ||
return this.gridOptionsService.get('serverSideFilterOnServer') && this.assertRowModelIsServerSide('serverSideFilterOnServer') && this.assertNotTreeData('serverSideFilterOnServer'); | ||
}; | ||
__decorate([ | ||
Autowired('columnApi') | ||
], StoreUtils.prototype, "columnApi", void 0); | ||
__decorate([ | ||
Autowired('columnModel') | ||
], StoreUtils.prototype, "columnModel", void 0); | ||
__decorate([ | ||
Autowired('gridApi') | ||
], StoreUtils.prototype, "gridApi", void 0); | ||
__decorate([ | ||
Autowired('rowModel') | ||
@@ -157,0 +145,0 @@ ], StoreUtils.prototype, "serverSideRowModel", void 0); |
@@ -60,6 +60,9 @@ var __extends = (this && this.__extends) || (function () { | ||
var result; | ||
_this.serverSideRowModel.executeOnStore(txWrapper.transaction.route, function (cache) { | ||
var hasStarted = _this.serverSideRowModel.executeOnStore(txWrapper.transaction.route, function (cache) { | ||
result = cache.applyTransaction(txWrapper.transaction); | ||
}); | ||
if (result == undefined) { | ||
if (!hasStarted) { | ||
result = { status: ServerSideTransactionResultStatus.StoreNotStarted }; | ||
} | ||
else if (result == undefined) { | ||
result = { status: ServerSideTransactionResultStatus.StoreNotFound }; | ||
@@ -110,6 +113,9 @@ } | ||
var res; | ||
this.serverSideRowModel.executeOnStore(transaction.route, function (store) { | ||
var hasStarted = this.serverSideRowModel.executeOnStore(transaction.route, function (store) { | ||
res = store.applyTransaction(transaction); | ||
}); | ||
if (res) { | ||
if (!hasStarted) { | ||
return { status: ServerSideTransactionResultStatus.StoreNotStarted }; | ||
} | ||
else if (res) { | ||
this.valueCache.onDataChanged(); | ||
@@ -116,0 +122,0 @@ if (res.remove) { |
@@ -15,2 +15,3 @@ import { ModuleNames } from "@ag-grid-community/core"; | ||
import { VERSION } from "./version"; | ||
import { ServerSideExpansionService } from "./serverSideRowModel/services/serverSideExpansionService"; | ||
export var ServerSideRowModelModule = { | ||
@@ -21,3 +22,3 @@ version: VERSION, | ||
beans: [ServerSideRowModel, ExpandListener, SortListener, StoreUtils, BlockUtils, NodeManager, TransactionManager, | ||
FilterListener, StoreFactory, ListenerUtils, ServerSideSelectionService], | ||
FilterListener, StoreFactory, ListenerUtils, ServerSideSelectionService, ServerSideExpansionService], | ||
dependantModules: [ | ||
@@ -24,0 +25,0 @@ EnterpriseCoreModule |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "30.2.1"; | ||
export declare const VERSION = "31.0.0"; |
// DO NOT UPDATE MANUALLY: Generated from script during build time | ||
export var VERSION = '30.2.1'; | ||
export var VERSION = '31.0.0'; |
@@ -8,5 +8,3 @@ import { RowBounds, BeanStub, Column, RowNode, NumberSequence, IRowNode } from "@ag-grid-community/core"; | ||
private beans; | ||
private rowHeight; | ||
private usingMasterDetail; | ||
private postConstruct; | ||
private readonly expansionService; | ||
createRowNode(params: { | ||
@@ -13,0 +11,0 @@ group: boolean; |
@@ -9,2 +9,3 @@ import { BeanStub } from "@ag-grid-community/core"; | ||
private findChangedColumns; | ||
private getAdvancedFilterColumns; | ||
} |
@@ -1,13 +0,9 @@ | ||
import { BeanStub, SortModelItem } from "@ag-grid-community/core"; | ||
import { BeanStub } from "@ag-grid-community/core"; | ||
export declare class SortListener extends BeanStub { | ||
private sortController; | ||
private columnModel; | ||
private serverSideRowModel; | ||
private listenerUtils; | ||
private postConstruct; | ||
extractSortModel(): SortModelItem[]; | ||
private removeMultiColumnPrefixOnColumnIds; | ||
private replaceAutoGroupColumnWithActualRowGroupColumns; | ||
private onSortChanged; | ||
private findChangedColumnsInSort; | ||
} |
@@ -1,5 +0,5 @@ | ||
import { BeanStub, Column, ColumnVO, IServerSideDatasource, IServerSideRowModel, IServerSideStore, NumberSequence, RowBounds, RowNode, StoreRefreshAfterParams, RefreshServerSideParams, ServerSideGroupLevelState, SortModelItem, RowModelType, LoadSuccessParams } from "@ag-grid-community/core"; | ||
import { BeanStub, Column, ColumnVO, IServerSideDatasource, IServerSideRowModel, IServerSideStore, NumberSequence, RowBounds, RowNode, StoreRefreshAfterParams, RefreshServerSideParams, ServerSideGroupLevelState, SortModelItem, RowModelType, LoadSuccessParams, FilterModel, AdvancedFilterModel } from "@ag-grid-community/core"; | ||
export interface SSRMParams { | ||
sortModel: SortModelItem[]; | ||
filterModel: any; | ||
filterModel: FilterModel | AdvancedFilterModel | null; | ||
lastAccessedSequence: NumberSequence; | ||
@@ -16,2 +16,3 @@ dynamicRowHeight: boolean; | ||
private filterManager; | ||
private sortController; | ||
private rowRenderer; | ||
@@ -34,2 +35,3 @@ private sortListener; | ||
private addEventListeners; | ||
private updateDatasource; | ||
private verifyProps; | ||
@@ -43,2 +45,4 @@ setDatasource(datasource: IServerSideDatasource): void; | ||
generateSecondaryColumns(pivotFields: string[]): void; | ||
resetRowHeights(): void; | ||
private resetRowHeightsForAllRowNodes; | ||
resetRootStore(): void; | ||
@@ -62,3 +66,3 @@ columnsToValueObjects(columns: Column[]): ColumnVO[]; | ||
expandAll(value: boolean): void; | ||
refreshAfterFilter(newFilterModel: any, params: StoreRefreshAfterParams): void; | ||
refreshAfterFilter(newFilterModel: FilterModel | AdvancedFilterModel | null, params: StoreRefreshAfterParams): void; | ||
getRootStore(): IServerSideStore | undefined; | ||
@@ -76,3 +80,4 @@ getRowCount(): number; | ||
forEachNodeAfterFilterAndSort(callback: (node: RowNode, index: number) => void, includeFooterNodes?: boolean): void; | ||
executeOnStore(route: string[], callback: (cache: IServerSideStore) => void): void; | ||
/** @return false if store hasn't started */ | ||
executeOnStore(route: string[], callback: (cache: IServerSideStore) => void): boolean; | ||
refreshStore(params?: RefreshServerSideParams): void; | ||
@@ -79,0 +84,0 @@ getStoreState(): ServerSideGroupLevelState[]; |
@@ -1,9 +0,8 @@ | ||
import { BeanStub, ChangedPath, ISelectionService, IServerSideSelectionState, IServerSideGroupSelectionState, RowNode, SelectionEventSourceType, ISetNodesSelectedParams } from "@ag-grid-community/core"; | ||
import { BeanStub, ChangedPath, ISelectionService, RowNode, SelectionEventSourceType, ISetNodesSelectedParams, ServerSideRowSelectionState, ServerSideRowGroupSelectionState } from "@ag-grid-community/core"; | ||
export declare class ServerSideSelectionService extends BeanStub implements ISelectionService { | ||
private rowModel; | ||
private selectionStrategy; | ||
private rowSelection; | ||
private init; | ||
getServerSideSelectionState(): any; | ||
setServerSideSelectionState(state: IServerSideSelectionState | IServerSideGroupSelectionState): void; | ||
getSelectionState(): string[] | ServerSideRowSelectionState | ServerSideRowGroupSelectionState | null; | ||
setSelectionState(state: string[] | ServerSideRowSelectionState | ServerSideRowGroupSelectionState, source: SelectionEventSourceType): void; | ||
setNodesSelected(params: ISetNodesSelectedParams): number; | ||
@@ -10,0 +9,0 @@ /** |
@@ -5,3 +5,2 @@ import { BeanStub, RowNode, ServerSideGroupLevelParams } from "@ag-grid-community/core"; | ||
private api; | ||
private columnApi; | ||
private rowNodeBlockLoader; | ||
@@ -8,0 +7,0 @@ static DEFAULT_BLOCK_SIZE: number; |
import { IServerSideStore, BeanStub, StoreRefreshAfterParams, RowNode, ColumnVO, RowNodeBlock } from "@ag-grid-community/core"; | ||
import { SSRMParams } from "../serverSideRowModel"; | ||
export declare class StoreUtils extends BeanStub { | ||
private columnApi; | ||
private columnModel; | ||
private gridApi; | ||
private serverSideRowModel; | ||
@@ -13,4 +11,2 @@ private storeFactory; | ||
parentBlock: RowNodeBlock; | ||
successCallback: () => void; | ||
failCallback: () => void; | ||
success: () => void; | ||
@@ -23,3 +19,3 @@ fail: () => void; | ||
isServerRefreshNeeded(parentRowNode: RowNode, rowGroupCols: ColumnVO[], params: StoreRefreshAfterParams): boolean; | ||
getServerSideInitialRowCount(): number; | ||
getServerSideInitialRowCount(): number | null; | ||
private assertRowModelIsServerSide; | ||
@@ -26,0 +22,0 @@ private assertNotTreeData; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "30.2.1"; | ||
export declare const VERSION = "31.0.0"; |
{ | ||
"name": "@ag-grid-enterprise/server-side-row-model", | ||
"version": "30.2.1", | ||
"version": "31.0.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -9,3 +9,3 @@ "main": "./dist/esm/es6/main.mjs", | ||
"scripts": { | ||
"clean": "rimraf dist .hash", | ||
"clean": "rimraf dist", | ||
"build-cjs": "rimraf dist/tsconfig.cjs.es5.docs.tsbuildinfo && npx tsc -p tsconfig.cjs.es5.json && npx tsc -p tsconfig.cjs.es6.json", | ||
@@ -50,7 +50,7 @@ "build-esm": "npx tsc -p tsconfig.esm.es5.json && npx tsc -p tsconfig.esm.es6.json", | ||
"dependencies": { | ||
"@ag-grid-community/core": "~30.2.1", | ||
"@ag-grid-enterprise/core": "~30.2.1" | ||
"@ag-grid-community/core": "~31.0.0", | ||
"@ag-grid-enterprise/core": "~31.0.0" | ||
}, | ||
"devDependencies": { | ||
"typescript": "~4.3.5", | ||
"typescript": "~4.7.4", | ||
"rimraf": "3.0.2", | ||
@@ -57,0 +57,0 @@ "gulp": "^4.0.2", |
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 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4927296
199
86665
+ Added@ag-grid-community/core@31.0.3(transitive)
+ Added@ag-grid-enterprise/core@31.0.3(transitive)
- Removed@ag-grid-community/core@30.2.1(transitive)
- Removed@ag-grid-enterprise/core@30.2.1(transitive)