@datorama/core 22.15.2 → 22.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11377,6 +11377,32 @@ function tryParsePivotValue(str) {
11377
11377
  }
11378
11378
  return value;
11379
11379
  }
11380
+ /** ag-grid's colId prefix for pivotRowTotals columns (PivotColDefService.PIVOT_ROW_TOTAL_PREFIX, not exported) */
11381
+ var PIVOT_ROW_TOTAL_COL_ID_PREFIX = 'PivotRowTotal_';
11382
+ /**
11383
+ * ag-grid 22 nested each pivot row total column in one group per pivot level, and the innermost group gets the "Total" header,
11384
+ * but ag-grid 27 adds the column without groups.
11385
+ * Turn the column def into those groups in place, as processSecondaryColDef can't replace it in its parent's children.
11386
+ * This relies on ag-grid checking for children before it calls processSecondaryColDef, so re-check it when moving to processPivotResultColDef.
11387
+ */
11388
+ function wrapPivotRowTotalColDef(colDef, headerName, pivotLevels) {
11389
+ if (!colDef.colId || !colDef.colId.startsWith(PIVOT_ROW_TOTAL_COL_ID_PREFIX)) {
11390
+ return;
11391
+ }
11392
+ var totalColDef = __assign({}, colDef);
11393
+ // A 'group_' prefix can't match a pivot column id, which starts with 'pivot_' or 'PivotRowTotal_'
11394
+ var groupDef = {
11395
+ groupId: "group_" + totalColDef.colId,
11396
+ headerName: headerName,
11397
+ headerClass: ['total-pivot-cell'],
11398
+ children: [totalColDef]
11399
+ };
11400
+ for (var level = 1; level < pivotLevels; level++) {
11401
+ groupDef = { groupId: "group_" + totalColDef.colId + "_" + level, children: [groupDef] };
11402
+ }
11403
+ Object.keys(colDef).forEach(function (key) { return delete colDef[key]; });
11404
+ Object.assign(colDef, groupDef);
11405
+ }
11380
11406
  function isHtmlAllowedForCol(gridOptions, colDef) {
11381
11407
  return (!gridOptions.disabledHTMLRenderingFields || !gridOptions.disabledHTMLRenderingFields.includes(getColField(colDef)));
11382
11408
  }
@@ -15122,6 +15148,7 @@ var GridService = /** @class */ (function () {
15122
15148
  return (parsedKey && parsedKey.value) || '';
15123
15149
  });
15124
15150
  }
15151
+ wrapPivotRowTotalColDef(colDef, _this.translate.transform('core.total'), _this.api ? _this.api.columns.getPivotColumns().length : 1);
15125
15152
  };
15126
15153
  /** Use processPivotResultColGroupDe from ver 28 */
15127
15154
  gridOptions.processSecondaryColGroupDef = function (colGroupDef) {
@@ -25647,7 +25674,7 @@ function fixNgLeaks() {
25647
25674
  };
25648
25675
  }
25649
25676
 
25650
- window.coreVersion = '22.15.2';
25677
+ window.coreVersion = '22.15.3';
25651
25678
 
25652
25679
  /**
25653
25680
  * @license