ag-grid-community
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
1,347 lines (1,337 loc) • 2.89 MB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["agGrid"] = factory();
else
root["agGrid"] = factory();
})(self, function() {
return /******/ (function() { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ 7886:
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result)
__defProp(target, key, result);
return result;
};
// community-modules/client-side-row-model/src/main.ts
var main_exports = {};
__export(main_exports, {
ClientSideRowModelModule: () => ClientSideRowModelModule
});
module.exports = __toCommonJS(main_exports);
// community-modules/client-side-row-model/src/clientSideRowModelModule.ts
var import_core9 = __webpack_require__(3423);
// community-modules/client-side-row-model/src/clientSideRowModel/clientSideRowModel.ts
var import_core2 = __webpack_require__(3423);
// community-modules/client-side-row-model/src/clientSideRowModel/clientSideNodeManager.ts
var import_core = __webpack_require__(3423);
var _ClientSideNodeManager = class _ClientSideNodeManager {
constructor(rootNode, gridOptionsService, eventService, columnModel, selectionService, beans) {
this.nextId = 0;
// has row data actually been set
this.rowCountReady = false;
// when user is provide the id's, we also keep a map of ids to row nodes for convenience
this.allNodesMap = {};
this.rootNode = rootNode;
this.gridOptionsService = gridOptionsService;
this.eventService = eventService;
this.columnModel = columnModel;
this.beans = beans;
this.selectionService = selectionService;
this.rootNode.group = true;
this.rootNode.level = -1;
this.rootNode.id = _ClientSideNodeManager.ROOT_NODE_ID;
this.rootNode.allLeafChildren = [];
this.rootNode.childrenAfterGroup = [];
this.rootNode.childrenAfterSort = [];
this.rootNode.childrenAfterAggFilter = [];
this.rootNode.childrenAfterFilter = [];
}
getCopyOfNodesMap() {
return import_core._.cloneObject(this.allNodesMap);
}
getRowNode(id) {
return this.allNodesMap[id];
}
setRowData(rowData) {
if (typeof rowData === "string") {
console.warn("AG Grid: rowData must be an array, however you passed in a string. If you are loading JSON, make sure you convert the JSON string to JavaScript objects first");
return;
}
this.rowCountReady = true;
this.dispatchRowDataUpdateStartedEvent(rowData);
const rootNode = this.rootNode;
const sibling = this.rootNode.sibling;
rootNode.childrenAfterFilter = null;
rootNode.childrenAfterGroup = null;
rootNode.childrenAfterAggFilter = null;
rootNode.childrenAfterSort = null;
rootNode.childrenMapped = null;
rootNode.updateHasChildren();
this.nextId = 0;
this.allNodesMap = {};
if (rowData) {
rootNode.allLeafChildren = rowData.map((dataItem) => this.createNode(dataItem, this.rootNode, _ClientSideNodeManager.TOP_LEVEL));
} else {
rootNode.allLeafChildren = [];
rootNode.childrenAfterGroup = [];
}
if (sibling) {
sibling.childrenAfterFilter = rootNode.childrenAfterFilter;
sibling.childrenAfterGroup = rootNode.childrenAfterGroup;
sibling.childrenAfterAggFilter = rootNode.childrenAfterAggFilter;
sibling.childrenAfterSort = rootNode.childrenAfterSort;
sibling.childrenMapped = rootNode.childrenMapped;
sibling.allLeafChildren = rootNode.allLeafChildren;
}
}
updateRowData(rowDataTran, rowNodeOrder) {
this.rowCountReady = true;
this.dispatchRowDataUpdateStartedEvent(rowDataTran.add);
const rowNodeTransaction = {
remove: [],
update: [],
add: []
};
const nodesToUnselect = [];
this.executeRemove(rowDataTran, rowNodeTransaction, nodesToUnselect);
this.executeUpdate(rowDataTran, rowNodeTransaction, nodesToUnselect);
this.executeAdd(rowDataTran, rowNodeTransaction);
this.updateSelection(nodesToUnselect, "rowDataChanged");
if (rowNodeOrder) {
import_core._.sortRowNodesByOrder(this.rootNode.allLeafChildren, rowNodeOrder);
}
return rowNodeTransaction;
}
isRowCountReady() {
return this.rowCountReady;
}
dispatchRowDataUpdateStartedEvent(rowData) {
const event = {
type: import_core.Events.EVENT_ROW_DATA_UPDATE_STARTED,
firstRowData: (rowData == null ? void 0 : rowData.length) ? rowData[0] : null
};
this.eventService.dispatchEvent(event);
}
updateSelection(nodesToUnselect, source) {
const selectionChanged = nodesToUnselect.length > 0;
if (selectionChanged) {
this.selectionService.setNodesSelected({
newValue: false,
nodes: nodesToUnselect,
suppressFinishActions: true,
source
});
}
this.selectionService.updateGroupsFromChildrenSelections(source);
if (selectionChanged) {
const event = {
type: import_core.Events.EVENT_SELECTION_CHANGED,
source
};
this.eventService.dispatchEvent(event);
}
}
executeAdd(rowDataTran, rowNodeTransaction) {
var _a;
const { add, addIndex } = rowDataTran;
if (import_core._.missingOrEmpty(add)) {
return;
}
const newNodes = add.map((item) => this.createNode(item, this.rootNode, _ClientSideNodeManager.TOP_LEVEL));
if (typeof addIndex === "number" && addIndex >= 0) {
const { allLeafChildren } = this.rootNode;
const len = allLeafChildren.length;
let normalisedAddIndex = addIndex;
const isTreeData = this.gridOptionsService.get("treeData");
if (isTreeData && addIndex > 0 && len > 0) {
for (let i = 0; i < len; i++) {
if (((_a = allLeafChildren[i]) == null ? void 0 : _a.rowIndex) == addIndex - 1) {
normalisedAddIndex = i + 1;
break;
}
}
}
const nodesBeforeIndex = allLeafChildren.slice(0, normalisedAddIndex);
const nodesAfterIndex = allLeafChildren.slice(normalisedAddIndex, allLeafChildren.length);
this.rootNode.allLeafChildren = [...nodesBeforeIndex, ...newNodes, ...nodesAfterIndex];
} else {
this.rootNode.allLeafChildren = [...this.rootNode.allLeafChildren, ...newNodes];
}
if (this.rootNode.sibling) {
this.rootNode.sibling.allLeafChildren = this.rootNode.allLeafChildren;
}
rowNodeTransaction.add = newNodes;
}
executeRemove(rowDataTran, rowNodeTransaction, nodesToUnselect) {
const { remove } = rowDataTran;
if (import_core._.missingOrEmpty(remove)) {
return;
}
const rowIdsRemoved = {};
remove.forEach((item) => {
const rowNode = this.lookupRowNode(item);
if (!rowNode) {
return;
}
if (rowNode.isSelected()) {
nodesToUnselect.push(rowNode);
}
rowNode.clearRowTopAndRowIndex();
rowIdsRemoved[rowNode.id] = true;
delete this.allNodesMap[rowNode.id];
rowNodeTransaction.remove.push(rowNode);
});
this.rootNode.allLeafChildren = this.rootNode.allLeafChildren.filter((rowNode) => !rowIdsRemoved[rowNode.id]);
if (this.rootNode.sibling) {
this.rootNode.sibling.allLeafChildren = this.rootNode.allLeafChildren;
}
}
executeUpdate(rowDataTran, rowNodeTransaction, nodesToUnselect) {
const { update } = rowDataTran;
if (import_core._.missingOrEmpty(update)) {
return;
}
update.forEach((item) => {
const rowNode = this.lookupRowNode(item);
if (!rowNode) {
return;
}
rowNode.updateData(item);
if (!rowNode.selectable && rowNode.isSelected()) {
nodesToUnselect.push(rowNode);
}
this.setMasterForRow(rowNode, item, _ClientSideNodeManager.TOP_LEVEL, false);
rowNodeTransaction.update.push(rowNode);
});
}
lookupRowNode(data) {
const getRowIdFunc = this.gridOptionsService.getCallback("getRowId");
let rowNode;
if (getRowIdFunc) {
const id = getRowIdFunc({ data, level: 0 });
rowNode = this.allNodesMap[id];
if (!rowNode) {
console.error(`AG Grid: could not find row id=${id}, data item was not found for this id`);
return null;
}
} else {
rowNode = this.rootNode.allLeafChildren.find((node) => node.data === data);
if (!rowNode) {
console.error(`AG Grid: could not find data item as object was not found`, data);
console.error(`Consider using getRowId to help the Grid find matching row data`);
return null;
}
}
return rowNode || null;
}
createNode(dataItem, parent, level) {
const node = new import_core.RowNode(this.beans);
node.group = false;
this.setMasterForRow(node, dataItem, level, true);
const suppressParentsInRowNodes = this.gridOptionsService.get("suppressParentsInRowNodes");
if (parent && !suppressParentsInRowNodes) {
node.parent = parent;
}
node.level = level;
node.setDataAndId(dataItem, this.nextId.toString());
if (this.allNodesMap[node.id]) {
console.warn(`AG Grid: duplicate node id '${node.id}' detected from getRowId callback, this could cause issues in your grid.`);
}
this.allNodesMap[node.id] = node;
this.nextId++;
return node;
}
setMasterForRow(rowNode, data, level, setExpanded) {
const isTreeData = this.gridOptionsService.get("treeData");
if (isTreeData) {
rowNode.setMaster(false);
if (setExpanded) {
rowNode.expanded = false;
}
} else {
const masterDetail = this.gridOptionsService.get("masterDetail");
if (masterDetail) {
const isRowMasterFunc = this.gridOptionsService.get("isRowMaster");
if (isRowMasterFunc) {
rowNode.setMaster(isRowMasterFunc(data));
} else {
rowNode.setMaster(true);
}
} else {
rowNode.setMaster(false);
}
if (setExpanded) {
const rowGroupColumns = this.columnModel.getRowGroupColumns();
const numRowGroupColumns = rowGroupColumns ? rowGroupColumns.length : 0;
const masterRowLevel = level + numRowGroupColumns;
rowNode.expanded = rowNode.master ? this.isExpanded(masterRowLevel) : false;
}
}
}
isExpanded(level) {
const expandByDefault = this.gridOptionsService.get("groupDefaultExpanded");
if (expandByDefault === -1) {
return true;
}
return level < expandByDefault;
}
};
_ClientSideNodeManager.TOP_LEVEL = 0;
_ClientSideNodeManager.ROOT_NODE_ID = "ROOT_NODE_ID";
var ClientSideNodeManager = _ClientSideNodeManager;
// community-modules/client-side-row-model/src/clientSideRowModel/clientSideRowModel.ts
var ClientSideRowModel = class extends import_core2.BeanStub {
constructor() {
super(...arguments);
this.onRowHeightChanged_debounced = import_core2._.debounce(this.onRowHeightChanged.bind(this), 100);
this.rowsToDisplay = [];
/** Has the start method been called */
this.hasStarted = false;
/** E.g. data has been set into the node manager already */
this.shouldSkipSettingDataOnStart = false;
/**
* This is to prevent refresh model being called when it's already being called.
* E.g. the group stage can trigger initial state filter model to be applied. This fires onFilterChanged,
* which then triggers the listener here that calls refresh model again but at the filter stage
* (which is about to be run by the original call).
*/
this.isRefreshingModel = false;
this.rowCountReady = false;
}
init() {
const refreshEverythingFunc = this.refreshModel.bind(this, { step: import_core2.ClientSideRowModelSteps.EVERYTHING });
const animate = !this.gridOptionsService.get("suppressAnimationFrame");
const refreshEverythingAfterColsChangedFunc = this.refreshModel.bind(this, {
step: import_core2.ClientSideRowModelSteps.EVERYTHING,
// after cols change, row grouping (the first stage) could of changed
afterColumnsChanged: true,
keepRenderedRows: true,
// we want animations cos sorting or filtering could be applied
animate
});
this.addManagedListener(this.eventService, import_core2.Events.EVENT_NEW_COLUMNS_LOADED, refreshEverythingAfterColsChangedFunc);
this.addManagedListener(this.eventService, import_core2.Events.EVENT_COLUMN_ROW_GROUP_CHANGED, refreshEverythingFunc);
this.addManagedListener(this.eventService, import_core2.Events.EVENT_COLUMN_VALUE_CHANGED, this.onValueChanged.bind(this));
this.addManagedListener(this.eventService, import_core2.Events.EVENT_COLUMN_PIVOT_CHANGED, this.refreshModel.bind(this, { step: import_core2.ClientSideRowModelSteps.PIVOT }));
this.addManagedListener(this.eventService, import_core2.Events.EVENT_FILTER_CHANGED, this.onFilterChanged.bind(this));
this.addManagedListener(this.eventService, import_core2.Events.EVENT_SORT_CHANGED, this.onSortChanged.bind(this));
this.addManagedListener(this.eventService, import_core2.Events.EVENT_COLUMN_PIVOT_MODE_CHANGED, refreshEverythingFunc);
this.addManagedListener(this.eventService, import_core2.Events.EVENT_GRID_STYLES_CHANGED, this.onGridStylesChanges.bind(this));
this.addManagedListener(this.eventService, import_core2.Events.EVENT_GRID_READY, () => this.onGridReady());
this.addPropertyListeners();
this.rootNode = new import_core2.RowNode(this.beans);
this.nodeManager = new ClientSideNodeManager(
this.rootNode,
this.gridOptionsService,
this.eventService,
this.columnModel,
this.selectionService,
this.beans
);
}
addPropertyListeners() {
const resetProps = /* @__PURE__ */ new Set([
"treeData",
"masterDetail"
]);
const groupStageRefreshProps = /* @__PURE__ */ new Set([
"suppressParentsInRowNodes",
"groupDefaultExpanded",
"groupAllowUnbalanced",
"initialGroupOrderComparator",
"groupHideOpenParents",
"groupDisplayType"
]);
const filterStageRefreshProps = /* @__PURE__ */ new Set([
"excludeChildrenWhenTreeDataFiltering"
]);
const pivotStageRefreshProps = /* @__PURE__ */ new Set([
"removePivotHeaderRowWhenSingleValueColumn",
"pivotRowTotals",
"pivotColumnGroupTotals",
"suppressExpandablePivotGroups"
]);
const aggregateStageRefreshProps = /* @__PURE__ */ new Set([
"getGroupRowAgg",
"alwaysAggregateAtRootLevel",
"groupIncludeTotalFooter",
"suppressAggFilteredOnly"
]);
const sortStageRefreshProps = /* @__PURE__ */ new Set([
"postSortRows",
"groupDisplayType",
"accentedSort"
]);
const filterAggStageRefreshProps = /* @__PURE__ */ new Set([]);
const flattenStageRefreshProps = /* @__PURE__ */ new Set([
"groupRemoveSingleChildren",
"groupRemoveLowestSingleChildren",
"groupIncludeFooter"
]);
const allProps = [
...resetProps,
...groupStageRefreshProps,
...filterStageRefreshProps,
...pivotStageRefreshProps,
...pivotStageRefreshProps,
...aggregateStageRefreshProps,
...sortStageRefreshProps,
...filterAggStageRefreshProps,
...flattenStageRefreshProps
];
this.addManagedPropertyListeners(allProps, (params) => {
var _a;
const properties = (_a = params.changeSet) == null ? void 0 : _a.properties;
if (!properties) {
return;
}
;
const arePropertiesImpacted = (propSet) => properties.some((prop) => propSet.has(prop));
if (arePropertiesImpacted(resetProps)) {
this.setRowData(this.rootNode.allLeafChildren.map((child) => child.data));
return;
}
if (arePropertiesImpacted(groupStageRefreshProps)) {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.EVERYTHING });
return;
}
if (arePropertiesImpacted(filterStageRefreshProps)) {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.FILTER });
return;
}
if (arePropertiesImpacted(pivotStageRefreshProps)) {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.PIVOT });
return;
}
if (arePropertiesImpacted(aggregateStageRefreshProps)) {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.AGGREGATE });
return;
}
if (arePropertiesImpacted(sortStageRefreshProps)) {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.SORT });
return;
}
if (arePropertiesImpacted(filterAggStageRefreshProps)) {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES });
return;
}
if (arePropertiesImpacted(flattenStageRefreshProps)) {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.MAP });
}
});
this.addManagedPropertyListener("rowHeight", () => this.resetRowHeights());
}
start() {
this.hasStarted = true;
if (this.shouldSkipSettingDataOnStart) {
this.dispatchUpdateEventsAndRefresh();
} else {
this.setInitialData();
}
}
setInitialData() {
const rowData = this.gridOptionsService.get("rowData");
if (rowData) {
this.shouldSkipSettingDataOnStart = true;
this.setRowData(rowData);
}
}
ensureRowHeightsValid(startPixel, endPixel, startLimitIndex, endLimitIndex) {
let atLeastOneChange;
let res = false;
do {
atLeastOneChange = false;
const rowAtStartPixel = this.getRowIndexAtPixel(startPixel);
const rowAtEndPixel = this.getRowIndexAtPixel(endPixel);
const firstRow = Math.max(rowAtStartPixel, startLimitIndex);
const lastRow = Math.min(rowAtEndPixel, endLimitIndex);
for (let rowIndex = firstRow; rowIndex <= lastRow; rowIndex++) {
const rowNode = this.getRow(rowIndex);
if (rowNode.rowHeightEstimated) {
const rowHeight = this.gridOptionsService.getRowHeightForNode(rowNode);
rowNode.setRowHeight(rowHeight.height);
atLeastOneChange = true;
res = true;
}
}
if (atLeastOneChange) {
this.setRowTopAndRowIndex();
}
} while (atLeastOneChange);
return res;
}
setRowTopAndRowIndex() {
const defaultRowHeight = this.environment.getDefaultRowHeight();
let nextRowTop = 0;
const displayedRowsMapped = /* @__PURE__ */ new Set();
const allowEstimate = this.gridOptionsService.isDomLayout("normal");
for (let i = 0; i < this.rowsToDisplay.length; i++) {
const rowNode = this.rowsToDisplay[i];
if (rowNode.id != null) {
displayedRowsMapped.add(rowNode.id);
}
if (rowNode.rowHeight == null) {
const rowHeight = this.gridOptionsService.getRowHeightForNode(rowNode, allowEstimate, defaultRowHeight);
rowNode.setRowHeight(rowHeight.height, rowHeight.estimated);
}
rowNode.setRowTop(nextRowTop);
rowNode.setRowIndex(i);
nextRowTop += rowNode.rowHeight;
}
return displayedRowsMapped;
}
clearRowTopAndRowIndex(changedPath, displayedRowsMapped) {
const changedPathActive = changedPath.isActive();
const clearIfNotDisplayed = (rowNode) => {
if (rowNode && rowNode.id != null && !displayedRowsMapped.has(rowNode.id)) {
rowNode.clearRowTopAndRowIndex();
}
};
const recurse = (rowNode) => {
clearIfNotDisplayed(rowNode);
clearIfNotDisplayed(rowNode.detailNode);
clearIfNotDisplayed(rowNode.sibling);
if (rowNode.hasChildren()) {
if (rowNode.childrenAfterGroup) {
const isRootNode = rowNode.level == -1;
const skipChildren = changedPathActive && !isRootNode && !rowNode.expanded;
if (!skipChildren) {
rowNode.childrenAfterGroup.forEach(recurse);
}
}
}
};
recurse(this.rootNode);
}
// returns false if row was moved, otherwise true
ensureRowsAtPixel(rowNodes, pixel, increment = 0) {
const indexAtPixelNow = this.getRowIndexAtPixel(pixel);
const rowNodeAtPixelNow = this.getRow(indexAtPixelNow);
const animate = !this.gridOptionsService.get("suppressAnimationFrame");
if (rowNodeAtPixelNow === rowNodes[0]) {
return false;
}
rowNodes.forEach((rowNode) => {
import_core2._.removeFromArray(this.rootNode.allLeafChildren, rowNode);
});
rowNodes.forEach((rowNode, idx) => {
import_core2._.insertIntoArray(this.rootNode.allLeafChildren, rowNode, Math.max(indexAtPixelNow + increment, 0) + idx);
});
this.refreshModel({
step: import_core2.ClientSideRowModelSteps.EVERYTHING,
keepRenderedRows: true,
keepEditingRows: true,
animate
});
return true;
}
highlightRowAtPixel(rowNode, pixel) {
const indexAtPixelNow = pixel != null ? this.getRowIndexAtPixel(pixel) : null;
const rowNodeAtPixelNow = indexAtPixelNow != null ? this.getRow(indexAtPixelNow) : null;
if (!rowNodeAtPixelNow || !rowNode || rowNodeAtPixelNow === rowNode || pixel == null) {
if (this.lastHighlightedRow) {
this.lastHighlightedRow.setHighlighted(null);
this.lastHighlightedRow = null;
}
return;
}
const highlight = this.getHighlightPosition(pixel, rowNodeAtPixelNow);
if (this.lastHighlightedRow && this.lastHighlightedRow !== rowNodeAtPixelNow) {
this.lastHighlightedRow.setHighlighted(null);
this.lastHighlightedRow = null;
}
rowNodeAtPixelNow.setHighlighted(highlight);
this.lastHighlightedRow = rowNodeAtPixelNow;
}
getHighlightPosition(pixel, rowNode) {
if (!rowNode) {
const index = this.getRowIndexAtPixel(pixel);
rowNode = this.getRow(index || 0);
if (!rowNode) {
return import_core2.RowHighlightPosition.Below;
}
}
const { rowTop, rowHeight } = rowNode;
return pixel - rowTop < rowHeight / 2 ? import_core2.RowHighlightPosition.Above : import_core2.RowHighlightPosition.Below;
}
getLastHighlightedRowNode() {
return this.lastHighlightedRow;
}
isLastRowIndexKnown() {
return true;
}
getRowCount() {
if (this.rowsToDisplay) {
return this.rowsToDisplay.length;
}
return 0;
}
getTopLevelRowCount() {
const showingRootNode = this.rowsToDisplay && this.rowsToDisplay[0] === this.rootNode;
if (showingRootNode) {
return 1;
}
const filteredChildren = this.rootNode.childrenAfterAggFilter;
return filteredChildren ? filteredChildren.length : 0;
}
getTopLevelRowDisplayedIndex(topLevelIndex) {
const showingRootNode = this.rowsToDisplay && this.rowsToDisplay[0] === this.rootNode;
if (showingRootNode) {
return topLevelIndex;
}
let rowNode = this.rootNode.childrenAfterSort[topLevelIndex];
if (this.gridOptionsService.get("groupHideOpenParents")) {
while (rowNode.expanded && rowNode.childrenAfterSort && rowNode.childrenAfterSort.length > 0) {
rowNode = rowNode.childrenAfterSort[0];
}
}
return rowNode.rowIndex;
}
getRowBounds(index) {
if (import_core2._.missing(this.rowsToDisplay)) {
return null;
}
const rowNode = this.rowsToDisplay[index];
if (rowNode) {
return {
rowTop: rowNode.rowTop,
rowHeight: rowNode.rowHeight
};
}
return null;
}
onRowGroupOpened() {
const animate = this.gridOptionsService.isAnimateRows();
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.MAP, keepRenderedRows: true, animate });
}
onFilterChanged(event) {
if (event.afterDataChange) {
return;
}
const animate = this.gridOptionsService.isAnimateRows();
const primaryOrQuickFilterChanged = event.columns.length === 0 || event.columns.some((col) => col.isPrimary());
const step = primaryOrQuickFilterChanged ? import_core2.ClientSideRowModelSteps.FILTER : import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES;
this.refreshModel({ step, keepRenderedRows: true, animate });
}
onSortChanged() {
const animate = this.gridOptionsService.isAnimateRows();
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.SORT, keepRenderedRows: true, animate, keepEditingRows: true });
}
getType() {
return "clientSide";
}
onValueChanged() {
if (this.columnModel.isPivotActive()) {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.PIVOT });
} else {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.AGGREGATE });
}
}
createChangePath(rowNodeTransactions) {
const noTransactions = import_core2._.missingOrEmpty(rowNodeTransactions);
const changedPath = new import_core2.ChangedPath(false, this.rootNode);
if (noTransactions || this.gridOptionsService.get("treeData")) {
changedPath.setInactive();
}
return changedPath;
}
isSuppressModelUpdateAfterUpdateTransaction(params) {
if (!this.gridOptionsService.get("suppressModelUpdateAfterUpdateTransaction")) {
return false;
}
if (params.rowNodeTransactions == null) {
return false;
}
const transWithAddsOrDeletes = params.rowNodeTransactions.filter(
(tx) => tx.add != null && tx.add.length > 0 || tx.remove != null && tx.remove.length > 0
);
const transactionsContainUpdatesOnly = transWithAddsOrDeletes == null || transWithAddsOrDeletes.length == 0;
return transactionsContainUpdatesOnly;
}
buildRefreshModelParams(step) {
let paramsStep = import_core2.ClientSideRowModelSteps.EVERYTHING;
const stepsMapped = {
everything: import_core2.ClientSideRowModelSteps.EVERYTHING,
group: import_core2.ClientSideRowModelSteps.EVERYTHING,
filter: import_core2.ClientSideRowModelSteps.FILTER,
map: import_core2.ClientSideRowModelSteps.MAP,
aggregate: import_core2.ClientSideRowModelSteps.AGGREGATE,
sort: import_core2.ClientSideRowModelSteps.SORT,
pivot: import_core2.ClientSideRowModelSteps.PIVOT
};
if (import_core2._.exists(step)) {
paramsStep = stepsMapped[step];
}
if (import_core2._.missing(paramsStep)) {
console.error(`AG Grid: invalid step ${step}, available steps are ${Object.keys(stepsMapped).join(", ")}`);
return void 0;
}
const animate = !this.gridOptionsService.get("suppressAnimationFrame");
const modelParams = {
step: paramsStep,
keepRenderedRows: true,
keepEditingRows: true,
animate
};
return modelParams;
}
refreshModel(paramsOrStep) {
if (!this.hasStarted || this.isRefreshingModel || this.columnModel.shouldRowModelIgnoreRefresh()) {
return;
}
let params = typeof paramsOrStep === "object" && "step" in paramsOrStep ? paramsOrStep : this.buildRefreshModelParams(paramsOrStep);
if (!params) {
return;
}
if (this.isSuppressModelUpdateAfterUpdateTransaction(params)) {
return;
}
const changedPath = this.createChangePath(params.rowNodeTransactions);
this.isRefreshingModel = true;
switch (params.step) {
case import_core2.ClientSideRowModelSteps.EVERYTHING:
this.doRowGrouping(
params.rowNodeTransactions,
params.rowNodeOrder,
changedPath,
!!params.afterColumnsChanged
);
case import_core2.ClientSideRowModelSteps.FILTER:
this.doFilter(changedPath);
case import_core2.ClientSideRowModelSteps.PIVOT:
this.doPivot(changedPath);
case import_core2.ClientSideRowModelSteps.AGGREGATE:
this.doAggregate(changedPath);
case import_core2.ClientSideRowModelSteps.FILTER_AGGREGATES:
this.doFilterAggregates(changedPath);
case import_core2.ClientSideRowModelSteps.SORT:
this.doSort(params.rowNodeTransactions, changedPath);
case import_core2.ClientSideRowModelSteps.MAP:
this.doRowsToDisplay();
}
const displayedNodesMapped = this.setRowTopAndRowIndex();
this.clearRowTopAndRowIndex(changedPath, displayedNodesMapped);
this.isRefreshingModel = false;
const event = {
type: import_core2.Events.EVENT_MODEL_UPDATED,
animate: params.animate,
keepRenderedRows: params.keepRenderedRows,
newData: params.newData,
newPage: false,
keepUndoRedoStack: params.keepUndoRedoStack
};
this.eventService.dispatchEvent(event);
}
isEmpty() {
const rowsMissing = import_core2._.missing(this.rootNode.allLeafChildren) || this.rootNode.allLeafChildren.length === 0;
return import_core2._.missing(this.rootNode) || rowsMissing || !this.columnModel.isReady();
}
isRowsToRender() {
return import_core2._.exists(this.rowsToDisplay) && this.rowsToDisplay.length > 0;
}
getNodesInRangeForSelection(firstInRange, lastInRange) {
let started = !lastInRange;
let finished = false;
const result = [];
const groupsSelectChildren = this.gridOptionsService.get("groupSelectsChildren");
this.forEachNodeAfterFilterAndSort((rowNode) => {
if (finished) {
return;
}
if (started) {
if (rowNode === lastInRange || rowNode === firstInRange) {
finished = true;
if (rowNode.group && groupsSelectChildren) {
result.push(...rowNode.allLeafChildren);
return;
}
}
}
if (!started) {
if (rowNode !== lastInRange && rowNode !== firstInRange) {
return;
}
started = true;
}
const includeThisNode = !rowNode.group || !groupsSelectChildren;
if (includeThisNode) {
result.push(rowNode);
return;
}
});
return result;
}
setDatasource(datasource) {
console.error("AG Grid: should never call setDatasource on clientSideRowController");
}
getTopLevelNodes() {
return this.rootNode ? this.rootNode.childrenAfterGroup : null;
}
getRootNode() {
return this.rootNode;
}
getRow(index) {
return this.rowsToDisplay[index];
}
isRowPresent(rowNode) {
return this.rowsToDisplay.indexOf(rowNode) >= 0;
}
getRowIndexAtPixel(pixelToMatch) {
if (this.isEmpty() || this.rowsToDisplay.length === 0) {
return -1;
}
let bottomPointer = 0;
let topPointer = this.rowsToDisplay.length - 1;
if (pixelToMatch <= 0) {
return 0;
}
const lastNode = import_core2._.last(this.rowsToDisplay);
if (lastNode.rowTop <= pixelToMatch) {
return this.rowsToDisplay.length - 1;
}
let oldBottomPointer = -1;
let oldTopPointer = -1;
while (true) {
const midPointer = Math.floor((bottomPointer + topPointer) / 2);
const currentRowNode = this.rowsToDisplay[midPointer];
if (this.isRowInPixel(currentRowNode, pixelToMatch)) {
return midPointer;
}
if (currentRowNode.rowTop < pixelToMatch) {
bottomPointer = midPointer + 1;
} else if (currentRowNode.rowTop > pixelToMatch) {
topPointer = midPointer - 1;
}
const caughtInInfiniteLoop = oldBottomPointer === bottomPointer && oldTopPointer === topPointer;
if (caughtInInfiniteLoop) {
return midPointer;
}
oldBottomPointer = bottomPointer;
oldTopPointer = topPointer;
}
}
isRowInPixel(rowNode, pixelToMatch) {
const topPixel = rowNode.rowTop;
const bottomPixel = rowNode.rowTop + rowNode.rowHeight;
const pixelInRow = topPixel <= pixelToMatch && bottomPixel > pixelToMatch;
return pixelInRow;
}
forEachLeafNode(callback) {
if (this.rootNode.allLeafChildren) {
this.rootNode.allLeafChildren.forEach((rowNode, index) => callback(rowNode, index));
}
}
forEachNode(callback, includeFooterNodes = false) {
this.recursivelyWalkNodesAndCallback({
nodes: [...this.rootNode.childrenAfterGroup || []],
callback,
recursionType: 0 /* Normal */,
index: 0,
includeFooterNodes
});
}
forEachNodeAfterFilter(callback, includeFooterNodes = false) {
this.recursivelyWalkNodesAndCallback({
nodes: [...this.rootNode.childrenAfterAggFilter || []],
callback,
recursionType: 1 /* AfterFilter */,
index: 0,
includeFooterNodes
});
}
forEachNodeAfterFilterAndSort(callback, includeFooterNodes = false) {
this.recursivelyWalkNodesAndCallback({
nodes: [...this.rootNode.childrenAfterSort || []],
callback,
recursionType: 2 /* AfterFilterAndSort */,
index: 0,
includeFooterNodes
});
}
forEachPivotNode(callback, includeFooterNodes = false) {
this.recursivelyWalkNodesAndCallback({
nodes: [this.rootNode],
callback,
recursionType: 3 /* PivotNodes */,
index: 0,
includeFooterNodes
});
}
// iterates through each item in memory, and calls the callback function
// nodes - the rowNodes to traverse
// callback - the user provided callback
// recursion type - need this to know what child nodes to recurse, eg if looking at all nodes, or filtered notes etc
// index - works similar to the index in forEach in javascript's array function
recursivelyWalkNodesAndCallback(params) {
var _a;
const { nodes, callback, recursionType, includeFooterNodes } = params;
let { index } = params;
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
callback(node, index++);
if (node.hasChildren() && !node.footer) {
let nodeChildren = null;
switch (recursionType) {
case 0 /* Normal */:
nodeChildren = node.childrenAfterGroup;
break;
case 1 /* AfterFilter */:
nodeChildren = node.childrenAfterAggFilter;
break;
case 2 /* AfterFilterAndSort */:
nodeChildren = node.childrenAfterSort;
break;
case 3 /* PivotNodes */:
nodeChildren = !node.leafGroup ? node.childrenAfterSort : null;
break;
}
if (nodeChildren) {
index = this.recursivelyWalkNodesAndCallback({
nodes: [...nodeChildren],
callback,
recursionType,
index,
includeFooterNodes
});
}
}
}
const parentNode = (_a = nodes[0]) == null ? void 0 : _a.parent;
if (!includeFooterNodes || !parentNode)
return index;
const isRootNode = parentNode === this.rootNode;
if (isRootNode) {
const totalFooters = this.gridOptionsService.get("groupIncludeTotalFooter");
if (!totalFooters)
return index;
} else {
const isGroupIncludeFooter = this.gridOptionsService.getGroupIncludeFooter();
if (!isGroupIncludeFooter({ node: parentNode }))
return index;
}
parentNode.createFooter();
callback(parentNode.sibling, index++);
return index;
}
// it's possible to recompute the aggregate without doing the other parts
// + api.refreshClientSideRowModel('aggregate')
doAggregate(changedPath) {
if (this.aggregationStage) {
this.aggregationStage.execute({ rowNode: this.rootNode, changedPath });
}
}
doFilterAggregates(changedPath) {
if (this.filterAggregatesStage) {
this.filterAggregatesStage.execute({ rowNode: this.rootNode, changedPath });
} else {
this.rootNode.childrenAfterAggFilter = this.rootNode.childrenAfterFilter;
}
}
// + gridApi.expandAll()
// + gridApi.collapseAll()
expandOrCollapseAll(expand) {
const usingTreeData = this.gridOptionsService.get("treeData");
const usingPivotMode = this.columnModel.isPivotActive();
const recursiveExpandOrCollapse = (rowNodes) => {
if (!rowNodes) {
return;
}
rowNodes.forEach((rowNode) => {
const actionRow = () => {
rowNode.expanded = expand;
recursiveExpandOrCollapse(rowNode.childrenAfterGroup);
};
if (usingTreeData) {
const hasChildren = import_core2._.exists(rowNode.childrenAfterGroup);
if (hasChildren) {
actionRow();
}
return;
}
if (usingPivotMode) {
const notLeafGroup = !rowNode.leafGroup;
if (notLeafGroup) {
actionRow();
}
return;
}
const isRowGroup = rowNode.group;
if (isRowGroup) {
actionRow();
}
});
};
if (this.rootNode) {
recursiveExpandOrCollapse(this.rootNode.childrenAfterGroup);
}
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.MAP });
const eventSource = expand ? "expandAll" : "collapseAll";
const event = {
type: import_core2.Events.EVENT_EXPAND_COLLAPSE_ALL,
source: eventSource
};
this.eventService.dispatchEvent(event);
}
doSort(rowNodeTransactions, changedPath) {
this.sortStage.execute({
rowNode: this.rootNode,
rowNodeTransactions,
changedPath
});
}
doRowGrouping(rowNodeTransactions, rowNodeOrder, changedPath, afterColumnsChanged) {
if (this.groupStage) {
if (rowNodeTransactions) {
this.groupStage.execute({
rowNode: this.rootNode,
rowNodeTransactions,
rowNodeOrder,
changedPath
});
} else {
this.groupStage.execute({
rowNode: this.rootNode,
changedPath,
afterColumnsChanged
});
}
if (this.gridOptionsService.get("groupSelectsChildren")) {
const selectionChanged = this.selectionService.updateGroupsFromChildrenSelections("rowGroupChanged", changedPath);
if (selectionChanged) {
const event = {
type: import_core2.Events.EVENT_SELECTION_CHANGED,
source: "rowGroupChanged"
};
this.eventService.dispatchEvent(event);
}
}
} else {
this.rootNode.childrenAfterGroup = this.rootNode.allLeafChildren;
if (this.rootNode.sibling) {
this.rootNode.sibling.childrenAfterGroup = this.rootNode.childrenAfterGroup;
}
this.rootNode.updateHasChildren();
}
if (this.nodeManager.isRowCountReady()) {
this.rowCountReady = true;
this.eventService.dispatchEventOnce({
type: import_core2.Events.EVENT_ROW_COUNT_READY
});
}
}
doFilter(changedPath) {
this.filterStage.execute({ rowNode: this.rootNode, changedPath });
}
doPivot(changedPath) {
if (this.pivotStage) {
this.pivotStage.execute({ rowNode: this.rootNode, changedPath });
}
}
getCopyOfNodesMap() {
return this.nodeManager.getCopyOfNodesMap();
}
getRowNode(id) {
const idIsGroup = typeof id == "string" && id.indexOf(import_core2.RowNode.ID_PREFIX_ROW_GROUP) == 0;
if (idIsGroup) {
let res = void 0;
this.forEachNode((node) => {
if (node.id === id) {
res = node;
}
});
return res;
}
return this.nodeManager.getRowNode(id);
}
// rows: the rows to put into the model
setRowData(rowData) {
this.selectionService.reset("rowDataChanged");
this.nodeManager.setRowData(rowData);
if (this.hasStarted) {
this.dispatchUpdateEventsAndRefresh();
}
}
dispatchUpdateEventsAndRefresh() {
const rowDataUpdatedEvent = {
type: import_core2.Events.EVENT_ROW_DATA_UPDATED
};
this.eventService.dispatchEvent(rowDataUpdatedEvent);
this.refreshModel({
step: import_core2.ClientSideRowModelSteps.EVERYTHING,
newData: true
});
}
batchUpdateRowData(rowDataTransaction, callback) {
if (this.applyAsyncTransactionsTimeout == null) {
this.rowDataTransactionBatch = [];
const waitMillis = this.gridOptionsService.getAsyncTransactionWaitMillis();
this.applyAsyncTransactionsTimeout = window.setTimeout(() => {
this.executeBatchUpdateRowData();
}, waitMillis);
}
this.rowDataTransactionBatch.push({ rowDataTransaction, callback });
}
flushAsyncTransactions() {
if (this.applyAsyncTransactionsTimeout != null) {
clearTimeout(this.applyAsyncTransactionsTimeout);
this.executeBatchUpdateRowData();
}
}
executeBatchUpdateRowData() {
this.valueCache.onDataChanged();
const callbackFuncsBound = [];
const rowNodeTrans = [];
let forceRowNodeOrder = false;
if (this.rowDataTransactionBatch) {
this.rowDataTransactionBatch.forEach((tranItem) => {
const rowNodeTran = this.nodeManager.updateRowData(tranItem.rowDataTransaction, void 0);
rowNodeTrans.push(rowNodeTran);
if (tranItem.callback) {
callbackFuncsBound.push(tranItem.callback.bind(null, rowNodeTran));
}
if (typeof tranItem.rowDataTransaction.addIndex === "number") {
forceRowNodeOrder = true;
}
});
}
this.commonUpdateRowData(rowNodeTrans, void 0, forceRowNodeOrder);
if (callbackFuncsBound.length > 0) {
window.setTimeout(() => {
callbackFuncsBound.forEach((func) => func());
}, 0);
}
if (rowNodeTrans.length > 0) {
const event = {
type: import_core2.Events.EVENT_ASYNC_TRANSACTIONS_FLUSHED,
results: rowNodeTrans
};
this.eventService.dispatchEvent(event);
}
this.rowDataTransactionBatch = null;
this.applyAsyncTransactionsTimeout = void 0;
}
updateRowData(rowDataTran, rowNodeOrder) {
this.valueCache.onDataChanged();
const rowNodeTran = this.nodeManager.updateRowData(rowDataTran, rowNodeOrder);
const forceRowNodeOrder = typeof rowDataTran.addIndex === "number";
this.commonUpdateRowData([rowNodeTran], rowNodeOrder, forceRowNodeOrder);
return rowNodeTran;
}
createRowNodeOrder() {
const suppressSortOrder = this.gridOptionsService.get("suppressMaintainUnsortedOrder");
if (suppressSortOrder) {
return;
}
const orderMap = {};
if (this.rootNode && this.rootNode.allLeafChildren) {
for (let index = 0; index < this.rootNode.allLeafChildren.length; index++) {
const node = this.rootNode.allLeafChildren[index];
orderMap[node.id] = index;
}
}
return orderMap;
}
// common to updateRowData and batchUpdateRowData
commonUpdateRowData(rowNodeTrans, rowNodeOrder, forceRowNodeOrder) {
if (!this.hasStarted) {
return;
}
const animate = !this.gridOptionsService.get("suppressAnimationFrame");
if (forceRowNodeOrder) {
rowNodeOrder = this.createRowNodeOrder();
}
const event = {
type: import_core2.Events.EVENT_ROW_DATA_UPDATED
};
this.eventService.dispatchEvent(event);
this.refreshModel({
step: import_core2.ClientSideRowModelSteps.EVERYTHING,
rowNodeTransactions: rowNodeTrans,
rowNodeOrder,
keepRenderedRows: true,
keepEditingRows: true,
animate
});
}
doRowsToDisplay() {
this.rowsToDisplay = this.flattenStage.execute({ rowNode: this.rootNode });
}
onRowHeightChanged() {
this.refreshModel({ step: import_core2.ClientSideRowModelSteps.MAP, keepRenderedRows: true, keepEditingRows: true, keepUndoRedoStack: true });
}
/** This method is debounced. It is used for row auto-height. If we don't debounce,
* then the Row Models will end up recalculating each row position
* for each row height change and result in the Row Renderer laying out rows.
* This is particularly bad if using print layout, and showing eg 1,000 rows,
* each row will change it's height, causing Row Model to update 1,000 times.
*/
onRowHeightChangedDebounced() {
this.onRowHeightChanged_debounced();
}
resetRowHeights() {
const atLeastOne = this.resetRowHeightsForAllRowNodes();
this.rootNode.setRowHeight(this.rootNode.rowHeight, true);
if (this.rootNode.sibling) {
this.rootNode.sibling.setRowHeight(this.rootNode.sibling.rowHeight, true);
}
if (atLeastOne) {
this.onRowHeightChanged();
}
}
resetRowHeightsForAllRowNodes() {
let atLeastOne = false;
this.forEachNode((rowNode) => {
rowNode.setRowHeight(rowNode.rowHeight, true);
const detailNode = rowNode.detailNode;
if (detailNode) {
detailNode.setRowHeight(detailNode.rowHeight, true);
}
if (rowNode.sibling) {
rowNode.sibling.setRowHeight(rowNode.sibling.rowHeight, true);
}
atLeastOne = true;
});
return atLeastOne;
}
onGridStylesChanges() {
if (this.columnModel.isAutoRowHeightActive()) {
return;
}
this.resetRowHeights();
}
onGridReady() {
if (this.hasStarted) {
return;
}
this.setInitialData();
}
isRowDataLoaded() {
return this.rowCountReady;
}
};
__decorateClass([
(0, import_core2.Autowired)("columnModel")
], ClientSideRowModel.prototype, "columnModel", 2);
__decorateClass([
(0, import_core2.Autowired)("selectionService")
], ClientSideRowModel.prototype, "selectionService", 2);
__decorateClass([
(0, import_core2.Autowired)("filterManager")
], ClientSideRowModel.prototype, "filterManager", 2);
__decorateClass([
(0, import_core2.Autowired)("valueCache")
], ClientSideRowModel.prototype, "valueCache", 2);
__decorateClass([
(0, import_core2.Autowired)("beans")
], ClientSideRowModel.prototype, "beans", 2);
__decorateClass([
(0, import_core2.Autowired)("filterStage")
], ClientSideRowModel.prototype, "filterStage", 2);
__decorateClass([
(0, import_core2.Autowired)("sortStage")
], ClientSideRowModel.prototype, "sortStage", 2);
__decorateClass([
(0, import_core2.Autowired)("flattenStage")
], ClientSideRowModel.prototype, "flattenStage", 2);
__decorateClass([
(0, import_core2.Optional)("groupStage")
], ClientSideRowModel.prototype, "groupStage", 2);
__decorateClass([
(0, import_core2.Optional)("aggregationStage")
], ClientSideRowModel.prototype, "aggregationStage", 2);
__decorateClass([
(0, import_core2.Optional)("pivotStage")
], ClientSideRowModel.prototype, "pivotStage", 2);
__decorateClass([
(0, import_core2.Optional)("filterAggregatesStage")
], ClientSideRowModel.prototype, "filterAggregatesStage", 2);
__decorateClass([
import_core2.PostConstruct
], ClientSideRowModel.prototype, "init", 1);
ClientSideRowModel = __decorateClass([
(0, import_core2.Bean)("rowModel")
], ClientSideRowModel);
// community-modules/client-side-row-model/src/clientSideRowModel/filterStage.ts
var import_core3 = __webpack_require__(3423);
var FilterStage = class extends import_core3.BeanStub {
execute(params) {
const { changedPath } = params;
this.filterService.filter(changedPath);
}
};
__decorateClass([
(0, import_core3.Autowired)("filterService")
], FilterStage.prototype, "filterService", 2);
FilterStage = __decorateClass([
(0, import_core3.Bean)("filterStage")
], FilterStage);
// community-modules/client-side-row-model/src/clientSideRowModel/sortStage.ts
var import_core4 = __webpack_require__(3423);
var SortStage = class extends import_core4.BeanStub {
execute(params) {
const sortOptions = this.sortController.getSortOptions();
const sortActive = import_core4._.exists(sortOptions) && sortOptions.length > 0;
const deltaSort = sortActive && import_core4._.exists(params.rowNodeTransactions) && this.gridOptionsService.get("deltaSort");
const sortContainsGroupColumns = sortOptions.some((opt) => {
const isSortingCoupled = this.gridOptionsService.isColumnsSortingCoupledToGroup();
if (isSortingCoupled) {
return opt.column.isPrimary() && opt.column.isRowGroupActive();
}
return !!opt.column.getColDef().showRowGroup;
});
this.sortService.sort(sortOptions, sortActive, deltaSort, params.rowNodeTransactions, params.changedPath, sortContainsGroupColumns);
}
};
__decorateClass([
(0, import_core4.Autowired)("sortService")
], SortStage.prototype, "sortService", 2);
__decorateClass([
(0, import_core4.Autowired)("sortController")
], SortStage.prototype, "sortController", 2);
SortStage = __decorateClass([
(0, import_core4.Bean)("sortStage")
], SortStage);
// community-modules/client-side-row-model/src/clientSideRowModel/flattenStage.ts
var import_core5 = __webpack_require__(3423);
var FlattenStage = class extends import_core5.BeanStub {
execute(params) {
const rootNode = params.rowNode;
const result = [];
const skipLeafNodes = this.columnModel.isPivotMode();
const showRootNode = skipLeafNodes && rootNode.leafGroup;
const topList = showRootNode ? [rootNode] : rootNode.childrenAfterSort;
const details = this.getFlattenDetails();
this.recursivelyAddToRowsToDisplay(details, topList, result, skipLeafNodes, 0);
const atLeastOneRowPresent = result.length > 0;
const includeGroupTotalFooter = !showRootNode && atLeastOneRowPresent && details.groupIncludeTotalFooter;
if (includeGroupTotalFooter) {
rootNode.createFooter();
this.addRowNodeToRowsToDisplay(details, rootNode.sibling, result, 0);
}
re