@datorama/core 22.12.5-beta.1 → 22.12.5

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.
@@ -14414,14 +14414,14 @@
14414
14414
  if (params.gridOptions.usePivotGridStyle) {
14415
14415
  var rowHeight_1 = 30;
14416
14416
  params.gridOptions.rowHeight = rowHeight_1;
14417
- params.gridOptions.defaultColDef = __assign(__assign({}, params.gridOptions.defaultColDef), { cellClass: this.getPivotCellClass.bind(this), headerClass: this.getPivotHeaderClass.bind(this), cellStyle: function (params) {
14417
+ params.gridOptions.defaultColDef = __assign(__assign({}, params.gridOptions.defaultColDef), { cellClassRules: this.getPivotModeCellClassRules(), headerClass: this.getPivotHeaderClass.bind(this), cellStyle: function (params) {
14418
14418
  var style = { lineHeight: rowHeight_1 + "px" };
14419
14419
  if (params.colDef.type === exports.DatoGridColumnTypes.Number) {
14420
14420
  style.textAlign = 'end';
14421
14421
  }
14422
14422
  return style;
14423
14423
  } });
14424
- params.gridOptions.autoGroupColumnDef = __assign(__assign({}, params.gridOptions.autoGroupColumnDef), { cellClass: this.getPivotCellClass.bind(this), headerClass: this.getPivotHeaderClass.bind(this) });
14424
+ params.gridOptions.autoGroupColumnDef = __assign(__assign({}, params.gridOptions.autoGroupColumnDef), { cellClassRules: this.getPivotModeCellClassRules(), headerClass: this.getPivotHeaderClass.bind(this) });
14425
14425
  }
14426
14426
  return params.gridOptions;
14427
14427
  };
@@ -14438,40 +14438,6 @@
14438
14438
  }
14439
14439
  return cellClass;
14440
14440
  };
14441
- GridService.prototype.getPivotCellClass = function (params) {
14442
- var _a = params.node, leafGroup = _a.leafGroup, childIndex = _a.childIndex, rowGroupIndex = _a.rowGroupIndex;
14443
- var gridQuery = params.colDef.headerComponentParams.gridQuery;
14444
- var cellClass = "";
14445
- if (gridQuery && gridQuery.api) {
14446
- var columns = gridQuery.api.columns;
14447
- var originalColumns = columns.getAllColumns();
14448
- var originalColumn = originalColumns.find(function (col) {
14449
- var _a = params.colDef, cellColumnGroupId = _a.showRowGroup, pivotValueColumn = _a.pivotValueColumn, colId = _a.colId;
14450
- var cellPivotColumnId = pivotValueColumn && pivotValueColumn.getColId();
14451
- var cellColumnId = cellColumnGroupId || cellPivotColumnId || colId;
14452
- return col.getColId() === cellColumnId;
14453
- });
14454
- var allDisplayedColumns = columns.getAllDisplayedColumns();
14455
- var displayedColumn = allDisplayedColumns.find(function (col) { return col.getColId() === params.colDef.colId; });
14456
- var colIndex = allDisplayedColumns.indexOf(displayedColumn);
14457
- var originalCellClass = originalColumn.getColDef().cellClass;
14458
- if (originalCellClass && typeof originalCellClass === 'string') {
14459
- cellClass += originalCellClass + " ";
14460
- }
14461
- if (rowGroupIndex <= colIndex) {
14462
- if (leafGroup) {
14463
- if (childIndex % 2 === 0) {
14464
- /** If row is even */
14465
- cellClass += 'primary-0-background-color';
14466
- }
14467
- }
14468
- else {
14469
- cellClass += 'primary-100-background-color pointer dato-simple-bold';
14470
- }
14471
- }
14472
- }
14473
- return cellClass;
14474
- };
14475
14441
  GridService.prototype.normalizeColumns = function (colDefs, gridOptions) {
14476
14442
  var _this = this;
14477
14443
  if (gridOptions === void 0) { gridOptions = null; }
@@ -15322,6 +15288,34 @@
15322
15288
  });
15323
15289
  this.api.grid.setRowData(convertedData);
15324
15290
  };
15291
+ /** No declared interface in current grid version yet.
15292
+ * Refer docs - https://www.ag-grid.com/angular-data-grid/cell-styles/#cell-class-rules */
15293
+ GridService.prototype.getPivotModeCellClassRules = function () {
15294
+ return {
15295
+ 'primary-0-background-color': this.isLeafGroupEvenCell.bind(this),
15296
+ 'primary-100-background-color pointer dato-simple-bold': this.isRowGroupValuedCell.bind(this)
15297
+ };
15298
+ };
15299
+ GridService.prototype.isLeafGroupEvenCell = function (params) {
15300
+ var _a = params.node, leafGroup = _a.leafGroup, childIndex = _a.childIndex, rowGroupIndex = _a.rowGroupIndex;
15301
+ var colIndex = this.getCellClassRuleColIndex(params);
15302
+ return rowGroupIndex <= colIndex && leafGroup && childIndex % 2 === 0;
15303
+ };
15304
+ GridService.prototype.isRowGroupValuedCell = function (params) {
15305
+ var _a = params.node, leafGroup = _a.leafGroup, rowGroupIndex = _a.rowGroupIndex;
15306
+ var colIndex = this.getCellClassRuleColIndex(params);
15307
+ return rowGroupIndex <= colIndex && !leafGroup;
15308
+ };
15309
+ GridService.prototype.getCellClassRuleColIndex = function (params) {
15310
+ var gridQuery = params.colDef.headerComponentParams.gridQuery;
15311
+ if (gridQuery && gridQuery.api) {
15312
+ var columns = gridQuery.api.columns;
15313
+ var allDisplayedColumns = columns.getAllDisplayedColumns();
15314
+ var displayedColumn = allDisplayedColumns.find(function (col) { return col.getColId() === params.colDef.colId; });
15315
+ return allDisplayedColumns.indexOf(displayedColumn);
15316
+ }
15317
+ return -1;
15318
+ };
15325
15319
  GridService.ctorParameters = function () { return [
15326
15320
  { type: GridStore },
15327
15321
  { type: GridQuery },
@@ -25693,7 +25687,7 @@
25693
25687
  };
25694
25688
  }
25695
25689
 
25696
- window.coreVersion = '22.12.4';
25690
+ window.coreVersion = '22.12.5';
25697
25691
 
25698
25692
  exports.APP_TRANSLATE = APP_TRANSLATE;
25699
25693
  exports.AceService = AceService;