@datorama/core 22.12.4 → 22.12.5-beta.2

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.
@@ -14215,14 +14215,18 @@ var GridService = /** @class */ (function () {
14215
14215
  if (params.gridOptions.usePivotGridStyle) {
14216
14216
  var rowHeight_1 = 30;
14217
14217
  params.gridOptions.rowHeight = rowHeight_1;
14218
- params.gridOptions.defaultColDef = __assign(__assign({}, params.gridOptions.defaultColDef), { cellClass: this.getPivotCellClass.bind(this), headerClass: this.getPivotHeaderClass.bind(this), cellStyle: function (params) {
14218
+ params.gridOptions.defaultColDef = __assign(__assign({}, params.gridOptions.defaultColDef), {
14219
+ // cellClass: this.getPivotCellClass.bind(this),
14220
+ cellClassRules: this.getCellClassRules(), headerClass: this.getPivotHeaderClass.bind(this), cellStyle: function (params) {
14219
14221
  var style = { lineHeight: rowHeight_1 + "px" };
14220
14222
  if (params.colDef.type === DatoGridColumnTypes.Number) {
14221
14223
  style.textAlign = 'end';
14222
14224
  }
14223
14225
  return style;
14224
14226
  } });
14225
- params.gridOptions.autoGroupColumnDef = __assign(__assign({}, params.gridOptions.autoGroupColumnDef), { cellClass: this.getPivotCellClass.bind(this), headerClass: this.getPivotHeaderClass.bind(this) });
14227
+ params.gridOptions.autoGroupColumnDef = __assign(__assign({}, params.gridOptions.autoGroupColumnDef), {
14228
+ // cellClass: this.getPivotCellClass.bind(this),
14229
+ cellClassRules: this.getCellClassRules(), headerClass: this.getPivotHeaderClass.bind(this) });
14226
14230
  }
14227
14231
  return params.gridOptions;
14228
14232
  };
@@ -14245,11 +14249,20 @@ var GridService = /** @class */ (function () {
14245
14249
  var cellClass = "";
14246
14250
  if (gridQuery && gridQuery.api) {
14247
14251
  var columns = gridQuery.api.columns;
14248
- var allDisplayedColumns = columns.getAllDisplayedColumns();
14249
- var col = allDisplayedColumns.find(function (column) {
14250
- return column.getColId() === params.colDef.colId;
14252
+ var originalColumns = columns.getAllColumns();
14253
+ var originalColumn = originalColumns.find(function (col) {
14254
+ var _a = params.colDef, cellColumnGroupId = _a.showRowGroup, pivotValueColumn = _a.pivotValueColumn, colId = _a.colId;
14255
+ var cellPivotColumnId = pivotValueColumn && pivotValueColumn.getColId();
14256
+ var cellColumnId = cellColumnGroupId || cellPivotColumnId || colId;
14257
+ return col.getColId() === cellColumnId;
14251
14258
  });
14252
- var colIndex = allDisplayedColumns.indexOf(col);
14259
+ var allDisplayedColumns = columns.getAllDisplayedColumns();
14260
+ var displayedColumn = allDisplayedColumns.find(function (col) { return col.getColId() === params.colDef.colId; });
14261
+ var colIndex = allDisplayedColumns.indexOf(displayedColumn);
14262
+ var originalCellClass = originalColumn.getColDef().cellClass;
14263
+ if (originalCellClass && typeof originalCellClass === 'string') {
14264
+ cellClass += originalCellClass + " ";
14265
+ }
14253
14266
  if (rowGroupIndex <= colIndex) {
14254
14267
  if (leafGroup) {
14255
14268
  if (childIndex % 2 === 0) {
@@ -15114,6 +15127,32 @@ var GridService = /** @class */ (function () {
15114
15127
  });
15115
15128
  this.api.grid.setRowData(convertedData);
15116
15129
  };
15130
+ GridService.prototype.getCellClassRules = function () {
15131
+ return {
15132
+ 'primary-0-background-color': this.isLeafGroupEvenCell.bind(this),
15133
+ 'primary-100-background-color pointer dato-simple-bold': this.isRowGroupValuedCell.bind(this)
15134
+ };
15135
+ };
15136
+ GridService.prototype.isLeafGroupEvenCell = function (params) {
15137
+ var _a = params.node, leafGroup = _a.leafGroup, childIndex = _a.childIndex, rowGroupIndex = _a.rowGroupIndex;
15138
+ var colIndex = this.getCellClassRuleColIndex(params);
15139
+ return !isNil(colIndex) && rowGroupIndex <= colIndex && leafGroup && childIndex % 2 === 0;
15140
+ };
15141
+ GridService.prototype.isRowGroupValuedCell = function (params) {
15142
+ var _a = params.node, leafGroup = _a.leafGroup, rowGroupIndex = _a.rowGroupIndex;
15143
+ var colIndex = this.getCellClassRuleColIndex(params);
15144
+ return !isNil(colIndex) && rowGroupIndex <= colIndex && !leafGroup;
15145
+ };
15146
+ GridService.prototype.getCellClassRuleColIndex = function (params) {
15147
+ var gridQuery = params.colDef.headerComponentParams.gridQuery;
15148
+ if (gridQuery && gridQuery.api) {
15149
+ var columns = gridQuery.api.columns;
15150
+ var allDisplayedColumns = columns.getAllDisplayedColumns();
15151
+ var displayedColumn = allDisplayedColumns.find(function (col) { return col.getColId() === params.colDef.colId; });
15152
+ return allDisplayedColumns.indexOf(displayedColumn);
15153
+ }
15154
+ return null;
15155
+ };
15117
15156
  GridService.ctorParameters = function () { return [
15118
15157
  { type: GridStore },
15119
15158
  { type: GridQuery },