@lumeer/pivot 0.0.9 → 0.0.10

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.
@@ -1133,37 +1133,39 @@ class PivotTableConverter {
1133
1133
  const columnsCount = cells[0]?.length || 0;
1134
1134
  for (let i = 0; i < rowGroupsInfo.length; i++) {
1135
1135
  const rowGroupInfo = rowGroupsInfo[i];
1136
- if (rowGroupInfo) {
1137
- for (let j = 0; j < columnGroupsInfo.length; j++) {
1138
- if (columnGroupsInfo[j]) {
1139
- const columns = columnGroupsInfo[j].indexes;
1140
- let formattedValue;
1141
- let dataResources;
1142
- if (rowGroupInfo.expression) {
1143
- const result = this.evaluateExpression(rowGroupInfo.expression, columns);
1144
- const valueIndex = columns[0] % this.data.valueTitles.length;
1145
- formattedValue = this.formatValueByConstraint(result.value, valueIndex);
1146
- dataResources = result.dataResources;
1147
- }
1148
- else {
1149
- // it's enough to fill group values only from row side
1150
- const { rowsIndexes, columnsIndexes } = this.getValuesIndexesFromCellsIndexes(rowGroupInfo.indexes, columns);
1151
- const result = this.getGroupedValuesForRowsAndCols(rowsIndexes, columnsIndexes);
1152
- formattedValue = this.aggregateAndFormatDataValues(result.values, rowsIndexes, columnsIndexes);
1153
- dataResources = result.dataResources;
1154
- }
1155
- cells[i][j] = {
1156
- value: String(formattedValue),
1157
- dataResources,
1158
- colSpan: 1,
1159
- rowSpan: 1,
1160
- cssClass: PivotTableConverter.groupDataClass,
1161
- isValue: true,
1162
- };
1163
- }
1136
+ if (!rowGroupInfo) {
1137
+ continue;
1138
+ }
1139
+ for (let j = 0; j < columnGroupsInfo.length; j++) {
1140
+ if (!columnGroupsInfo[j]) {
1141
+ continue;
1142
+ }
1143
+ const columns = columnGroupsInfo[j].indexes;
1144
+ const { rowsIndexes, columnsIndexes } = this.getValuesIndexesFromCellsIndexes(rowGroupInfo.indexes, columns);
1145
+ let formattedValue;
1146
+ let dataResources;
1147
+ if (rowGroupInfo.expression) {
1148
+ const result = this.evaluateExpression(rowGroupInfo.expression, columnsIndexes);
1149
+ const valueIndex = columnsIndexes[0] % this.data.valueTitles.length;
1150
+ formattedValue = this.formatValueByConstraint(result.value, valueIndex);
1151
+ dataResources = result.dataResources;
1152
+ }
1153
+ else {
1154
+ // it's enough to fill group values only from row side
1155
+ const result = this.getGroupedValuesForRowsAndCols(rowsIndexes, columnsIndexes);
1156
+ formattedValue = this.aggregateAndFormatDataValues(result.values, rowsIndexes, columnsIndexes);
1157
+ dataResources = result.dataResources;
1164
1158
  }
1165
- this.fillRowWithColor(cells, i, rowGroupInfo, columnsCount);
1159
+ cells[i][j] = {
1160
+ value: String(formattedValue),
1161
+ dataResources,
1162
+ colSpan: 1,
1163
+ rowSpan: 1,
1164
+ cssClass: PivotTableConverter.groupDataClass,
1165
+ isValue: true,
1166
+ };
1166
1167
  }
1168
+ this.fillRowWithColor(cells, i, rowGroupInfo, columnsCount);
1167
1169
  }
1168
1170
  for (let j = 0; j < columnGroupsInfo.length; j++) {
1169
1171
  if (columnGroupsInfo[j]) {