@datorama/core 22.12.5-beta.1 → 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.
@@ -12681,14 +12681,18 @@ let GridService = class GridService {
12681
12681
  if (params.gridOptions.usePivotGridStyle) {
12682
12682
  const rowHeight = 30;
12683
12683
  params.gridOptions.rowHeight = rowHeight;
12684
- params.gridOptions.defaultColDef = Object.assign(Object.assign({}, params.gridOptions.defaultColDef), { cellClass: this.getPivotCellClass.bind(this), headerClass: this.getPivotHeaderClass.bind(this), cellStyle: params => {
12684
+ params.gridOptions.defaultColDef = Object.assign(Object.assign({}, params.gridOptions.defaultColDef), {
12685
+ // cellClass: this.getPivotCellClass.bind(this),
12686
+ cellClassRules: this.getCellClassRules(), headerClass: this.getPivotHeaderClass.bind(this), cellStyle: params => {
12685
12687
  const style = { lineHeight: `${rowHeight}px` };
12686
12688
  if (params.colDef.type === DatoGridColumnTypes.Number) {
12687
12689
  style.textAlign = 'end';
12688
12690
  }
12689
12691
  return style;
12690
12692
  } });
12691
- params.gridOptions.autoGroupColumnDef = Object.assign(Object.assign({}, params.gridOptions.autoGroupColumnDef), { cellClass: this.getPivotCellClass.bind(this), headerClass: this.getPivotHeaderClass.bind(this) });
12693
+ params.gridOptions.autoGroupColumnDef = Object.assign(Object.assign({}, params.gridOptions.autoGroupColumnDef), {
12694
+ // cellClass: this.getPivotCellClass.bind(this),
12695
+ cellClassRules: this.getCellClassRules(), headerClass: this.getPivotHeaderClass.bind(this) });
12692
12696
  }
12693
12697
  return params.gridOptions;
12694
12698
  }
@@ -13484,6 +13488,32 @@ let GridService = class GridService {
13484
13488
  });
13485
13489
  this.api.grid.setRowData(convertedData);
13486
13490
  }
13491
+ getCellClassRules() {
13492
+ return {
13493
+ 'primary-0-background-color': this.isLeafGroupEvenCell.bind(this),
13494
+ 'primary-100-background-color pointer dato-simple-bold': this.isRowGroupValuedCell.bind(this)
13495
+ };
13496
+ }
13497
+ isLeafGroupEvenCell(params) {
13498
+ const { leafGroup, childIndex, rowGroupIndex } = params.node;
13499
+ const colIndex = this.getCellClassRuleColIndex(params);
13500
+ return !isNil(colIndex) && rowGroupIndex <= colIndex && leafGroup && childIndex % 2 === 0;
13501
+ }
13502
+ isRowGroupValuedCell(params) {
13503
+ const { leafGroup, rowGroupIndex } = params.node;
13504
+ const colIndex = this.getCellClassRuleColIndex(params);
13505
+ return !isNil(colIndex) && rowGroupIndex <= colIndex && !leafGroup;
13506
+ }
13507
+ getCellClassRuleColIndex(params) {
13508
+ const gridQuery = params.colDef.headerComponentParams.gridQuery;
13509
+ if (gridQuery && gridQuery.api) {
13510
+ const { columns } = gridQuery.api;
13511
+ const allDisplayedColumns = columns.getAllDisplayedColumns();
13512
+ const displayedColumn = allDisplayedColumns.find(col => col.getColId() === params.colDef.colId);
13513
+ return allDisplayedColumns.indexOf(displayedColumn);
13514
+ }
13515
+ return null;
13516
+ }
13487
13517
  };
13488
13518
  GridService.ctorParameters = () => [
13489
13519
  { type: GridStore },