@visactor/vtable 1.3.3-alpha.2 → 1.3.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.
Files changed (71) hide show
  1. package/cjs/core/BaseTable.d.ts +5 -25
  2. package/cjs/core/BaseTable.js +1 -1
  3. package/cjs/core/BaseTable.js.map +1 -1
  4. package/cjs/data/DataSource.d.ts +1 -6
  5. package/cjs/data/DataSource.js +2 -12
  6. package/cjs/data/DataSource.js.map +1 -1
  7. package/cjs/dataset/dataset.d.ts +2 -15
  8. package/cjs/dataset/dataset.js +67 -170
  9. package/cjs/dataset/dataset.js.map +1 -1
  10. package/cjs/dataset/statistics-helper.d.ts +3 -43
  11. package/cjs/dataset/statistics-helper.js +26 -61
  12. package/cjs/dataset/statistics-helper.js.map +1 -1
  13. package/cjs/index.d.ts +1 -1
  14. package/cjs/index.js +2 -2
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +3 -2
  17. package/cjs/scenegraph/group-creater/progress/proxy.js +10 -10
  18. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  19. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -1
  20. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
  21. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  22. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +3 -2
  23. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +15 -14
  24. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  25. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +7 -5
  26. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  27. package/cjs/ts-types/base-table.d.ts +5 -25
  28. package/cjs/ts-types/base-table.js.map +1 -1
  29. package/cjs/ts-types/new-data-set.d.ts +1 -9
  30. package/cjs/ts-types/new-data-set.js +1 -1
  31. package/cjs/ts-types/new-data-set.js.map +1 -1
  32. package/cjs/ts-types/table-engine.d.ts +12 -0
  33. package/cjs/ts-types/table-engine.js.map +1 -1
  34. package/cjs/vrender.js.map +1 -1
  35. package/dist/vtable.js +211 -445
  36. package/dist/vtable.min.js +2 -2
  37. package/es/core/BaseTable.d.ts +5 -25
  38. package/es/core/BaseTable.js +1 -1
  39. package/es/core/BaseTable.js.map +1 -1
  40. package/es/data/DataSource.d.ts +1 -6
  41. package/es/data/DataSource.js +2 -12
  42. package/es/data/DataSource.js.map +1 -1
  43. package/es/dataset/dataset.d.ts +2 -15
  44. package/es/dataset/dataset.js +68 -170
  45. package/es/dataset/dataset.js.map +1 -1
  46. package/es/dataset/statistics-helper.d.ts +3 -43
  47. package/es/dataset/statistics-helper.js +23 -55
  48. package/es/dataset/statistics-helper.js.map +1 -1
  49. package/es/index.d.ts +1 -1
  50. package/es/index.js +1 -1
  51. package/es/index.js.map +1 -1
  52. package/es/scenegraph/group-creater/progress/proxy.d.ts +3 -2
  53. package/es/scenegraph/group-creater/progress/proxy.js +10 -10
  54. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  55. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -1
  56. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
  57. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  58. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +3 -2
  59. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +15 -13
  60. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  61. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +7 -5
  62. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  63. package/es/ts-types/base-table.d.ts +5 -25
  64. package/es/ts-types/base-table.js.map +1 -1
  65. package/es/ts-types/new-data-set.d.ts +1 -9
  66. package/es/ts-types/new-data-set.js +1 -1
  67. package/es/ts-types/new-data-set.js.map +1 -1
  68. package/es/ts-types/table-engine.d.ts +12 -0
  69. package/es/ts-types/table-engine.js.map +1 -1
  70. package/es/vrender.js.map +1 -1
  71. package/package.json +5 -5
@@ -2,14 +2,14 @@ import { isValid } from "@visactor/vutils";
2
2
 
3
3
  import { AggregationType, SortType } from "../ts-types";
4
4
 
5
- import { AvgAggregator, CountAggregator, MaxAggregator, MinAggregator, NoneAggregator, RecalculateAggregator, RecordAggregator, SumAggregator, naturalSort, sortBy, typeSort } from "./statistics-helper";
5
+ import { AvgAggregator, CountAggregator, MaxAggregator, MinAggregator, NoneAggregator, RecordAggregator, SumAggregator, naturalSort, sortBy, typeSort } from "./statistics-helper";
6
6
 
7
7
  import { IndicatorDimensionKeyPlaceholder } from "../tools/global";
8
8
 
9
9
  export class Dataset {
10
10
  constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
11
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12;
12
- this.tree = {}, this.changedTree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
11
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
12
+ if (this.tree = {}, this.changedTree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
13
13
  this.colKeys = [], this.rowKeys = [], this.rowOrder = "key_a_to_z", this.colOrder = "key_a_to_z",
14
14
  this.sorted = !1, this.indicatorStatistics = [], this.aggregators = {}, this.stringJoinChar = String.fromCharCode(0),
15
15
  this.rowsIsTotal = [], this.colsIsTotal = [], this.collectedValues = {}, this.cacheCollectedValues = {},
@@ -18,28 +18,22 @@ export class Dataset {
18
18
  this.aggregationRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.aggregationRules,
19
19
  this.derivedFieldRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.derivedFieldRules,
20
20
  this.mappingRules = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.mappingRules,
21
- this.calculatedFieldRules = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.calculatedFieldRules,
22
- this.calculatedFiledKeys = null !== (_g = null === (_f = this.calculatedFieldRules) || void 0 === _f ? void 0 : _f.map((rule => rule.key))) && void 0 !== _g ? _g : [],
23
- this.calculatedFieldDependIndicatorKeys = null !== (_j = null === (_h = this.calculatedFieldRules) || void 0 === _h ? void 0 : _h.reduce(((arr, rule) => {
24
- for (let i = 0; i < rule.dependIndicatorKeys.length; i++) -1 === arr.indexOf(rule.dependIndicatorKeys[i]) && arr.push(rule.dependIndicatorKeys[i]);
25
- return arr;
26
- }), [])) && void 0 !== _j ? _j : [], this.totals = null === (_k = this.dataConfig) || void 0 === _k ? void 0 : _k.totals,
27
- this.rows = rows, this.columns = columns, this.indicatorKeys = indicatorKeys, this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys = [ ...indicatorKeys ];
28
- for (let m = 0; m < this.calculatedFieldDependIndicatorKeys.length; m++) -1 === this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys.indexOf(this.calculatedFieldDependIndicatorKeys[m]) && this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys.push(this.calculatedFieldDependIndicatorKeys[m]);
29
- if (this.indicatorsAsCol = indicatorsAsCol, this.indicators = indicators, this.customColTree = customColTree,
30
- this.customRowTree = customRowTree, this.colGrandTotalLabel = null !== (_o = null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.grandTotalLabel) && void 0 !== _o ? _o : "总计",
31
- this.colSubTotalLabel = null !== (_r = null === (_q = null === (_p = this.totals) || void 0 === _p ? void 0 : _p.column) || void 0 === _q ? void 0 : _q.subTotalLabel) && void 0 !== _r ? _r : "小计",
32
- this.rowGrandTotalLabel = null !== (_u = null === (_t = null === (_s = this.totals) || void 0 === _s ? void 0 : _s.row) || void 0 === _t ? void 0 : _t.grandTotalLabel) && void 0 !== _u ? _u : "总计",
33
- this.rowSubTotalLabel = null !== (_x = null === (_w = null === (_v = this.totals) || void 0 === _v ? void 0 : _v.row) || void 0 === _w ? void 0 : _w.subTotalLabel) && void 0 !== _x ? _x : "小计",
34
- this.collectValuesBy = null === (_y = this.dataConfig) || void 0 === _y ? void 0 : _y.collectValuesBy,
21
+ this.totals = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals,
22
+ this.rows = rows, this.columns = columns, this.indicatorKeys = indicatorKeys, this.indicatorsAsCol = indicatorsAsCol,
23
+ this.indicators = indicators, this.customColTree = customColTree, this.customRowTree = customRowTree,
24
+ this.colGrandTotalLabel = null !== (_h = null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.column) || void 0 === _g ? void 0 : _g.grandTotalLabel) && void 0 !== _h ? _h : "总计",
25
+ this.colSubTotalLabel = null !== (_l = null === (_k = null === (_j = this.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.subTotalLabel) && void 0 !== _l ? _l : "小计",
26
+ this.rowGrandTotalLabel = null !== (_p = null === (_o = null === (_m = this.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.grandTotalLabel) && void 0 !== _p ? _p : "总计",
27
+ this.rowSubTotalLabel = null !== (_s = null === (_r = null === (_q = this.totals) || void 0 === _q ? void 0 : _q.row) || void 0 === _r ? void 0 : _r.subTotalLabel) && void 0 !== _s ? _s : "小计",
28
+ this.collectValuesBy = null === (_t = this.dataConfig) || void 0 === _t ? void 0 : _t.collectValuesBy,
35
29
  this.needSplitPositiveAndNegative = null != needSplitPositiveAndNegative && needSplitPositiveAndNegative,
36
- this.rowsIsTotal = new Array(null !== (_0 = null === (_z = this.rows) || void 0 === _z ? void 0 : _z.length) && void 0 !== _0 ? _0 : 0).fill(!1),
37
- this.colsIsTotal = new Array(null !== (_2 = null === (_1 = this.columns) || void 0 === _1 ? void 0 : _1.length) && void 0 !== _2 ? _2 : 0).fill(!1),
38
- (null === (_3 = this.totals) || void 0 === _3 ? void 0 : _3.row) && !1 !== this.totals.row.showSubTotals && this.totals.row.subTotalsDimensions) for (let i = 0, len = null !== (_7 = null === (_6 = null === (_5 = null === (_4 = this.totals) || void 0 === _4 ? void 0 : _4.row) || void 0 === _5 ? void 0 : _5.subTotalsDimensions) || void 0 === _6 ? void 0 : _6.length) && void 0 !== _7 ? _7 : 0; i < len; i++) {
30
+ this.rowsIsTotal = new Array(null !== (_v = null === (_u = this.rows) || void 0 === _u ? void 0 : _u.length) && void 0 !== _v ? _v : 0).fill(!1),
31
+ this.colsIsTotal = new Array(null !== (_x = null === (_w = this.columns) || void 0 === _w ? void 0 : _w.length) && void 0 !== _x ? _x : 0).fill(!1),
32
+ (null === (_y = this.totals) || void 0 === _y ? void 0 : _y.row) && !1 !== this.totals.row.showSubTotals && this.totals.row.subTotalsDimensions) for (let i = 0, len = null !== (_2 = null === (_1 = null === (_0 = null === (_z = this.totals) || void 0 === _z ? void 0 : _z.row) || void 0 === _0 ? void 0 : _0.subTotalsDimensions) || void 0 === _1 ? void 0 : _1.length) && void 0 !== _2 ? _2 : 0; i < len; i++) {
39
33
  const dimension = this.totals.row.subTotalsDimensions[i], dimensionIndex = this.rows.indexOf(dimension);
40
34
  this.rowsIsTotal[dimensionIndex] = !0;
41
35
  }
42
- if ((null === (_8 = this.totals) || void 0 === _8 ? void 0 : _8.column) && !1 !== this.totals.column.showSubTotals && this.totals.column.subTotalsDimensions) for (let i = 0, len = null !== (_12 = null === (_11 = null === (_10 = null === (_9 = this.totals) || void 0 === _9 ? void 0 : _9.column) || void 0 === _10 ? void 0 : _10.subTotalsDimensions) || void 0 === _11 ? void 0 : _11.length) && void 0 !== _12 ? _12 : 0; i < len; i++) {
36
+ if ((null === (_3 = this.totals) || void 0 === _3 ? void 0 : _3.column) && !1 !== this.totals.column.showSubTotals && this.totals.column.subTotalsDimensions) for (let i = 0, len = null !== (_7 = null === (_6 = null === (_5 = null === (_4 = this.totals) || void 0 === _4 ? void 0 : _4.column) || void 0 === _5 ? void 0 : _5.subTotalsDimensions) || void 0 === _6 ? void 0 : _6.length) && void 0 !== _7 ? _7 : 0; i < len; i++) {
43
37
  const dimension = this.totals.column.subTotalsDimensions[i], dimensionIndex = this.columns.indexOf(dimension);
44
38
  this.colsIsTotal[dimensionIndex] = !0;
45
39
  }
@@ -73,7 +67,7 @@ export class Dataset {
73
67
  this.registerAggregator(AggregationType.RECORD, RecordAggregator), this.registerAggregator(AggregationType.SUM, SumAggregator),
74
68
  this.registerAggregator(AggregationType.COUNT, CountAggregator), this.registerAggregator(AggregationType.MAX, MaxAggregator),
75
69
  this.registerAggregator(AggregationType.MIN, MinAggregator), this.registerAggregator(AggregationType.AVG, AvgAggregator),
76
- this.registerAggregator(AggregationType.NONE, NoneAggregator), this.registerAggregator(AggregationType.RECALCULATE, RecalculateAggregator);
70
+ this.registerAggregator(AggregationType.NONE, NoneAggregator);
77
71
  }
78
72
  processCollectedValuesWithSumBy() {
79
73
  var _a, _b, _c, _d, _e, _f;
@@ -139,7 +133,7 @@ export class Dataset {
139
133
  return isReserved;
140
134
  }
141
135
  processRecord(record, assignedIndicatorKey) {
142
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29;
136
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
143
137
  null === (_a = this.derivedFieldRules) || void 0 === _a || _a.forEach(((derivedFieldRule, i) => {
144
138
  derivedFieldRule.fieldName && derivedFieldRule.derivedFunc && (record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record));
145
139
  }));
@@ -151,12 +145,8 @@ export class Dataset {
151
145
  max: Number.MIN_SAFE_INTEGER
152
146
  } : this.collectedValues[field][collectKeys] = []), this.collectValuesBy[field].sumBy) {
153
147
  const sumByKeys = this.collectValuesBy[field].sumBy.map((byField => record[byField])).join(this.stringJoinChar);
154
- this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[AggregationType.SUM]({
155
- key: field,
156
- dimension: field,
157
- isRecord: void 0,
158
- needSplitPositiveAndNegative: this.needSplitPositiveAndNegative
159
- })), this.collectedValues[field][collectKeys][sumByKeys].push(record);
148
+ this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[AggregationType.SUM](field, void 0, void 0, this.needSplitPositiveAndNegative)),
149
+ this.collectedValues[field][collectKeys][sumByKeys].push(record);
160
150
  } else if (this.collectValuesBy[field].range) {
161
151
  const fieldRange = this.collectedValues[field][collectKeys], max = Math.max(record[field], fieldRange.max), min = Math.min(record[field], fieldRange.min);
162
152
  isNaN(max) || (fieldRange.max = max, fieldRange.min = min);
@@ -198,64 +188,36 @@ export class Dataset {
198
188
  this.totalRecordsTree[flatRowKey] || (this.totalRecordsTree[flatRowKey] = {}), this.totalRecordsTree[flatRowKey][flatColKey] || (this.totalRecordsTree[flatRowKey][flatColKey] = []);
199
189
  for (let i = 0; i < this.indicatorKeys.length; i++) {
200
190
  const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
201
- (null === (_w = null === (_v = this.totalRecordsTree[flatRowKey]) || void 0 === _v ? void 0 : _v[flatColKey]) || void 0 === _w ? void 0 : _w[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_x = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _x ? _x : AggregationType.SUM]({
202
- key: this.indicatorKeys[i],
203
- dimension: null !== (_y = null == aggRule ? void 0 : aggRule.field) && void 0 !== _y ? _y : this.indicatorKeys[i],
204
- formatFun: null !== (_z = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _z ? _z : null === (_1 = null === (_0 = this.indicators) || void 0 === _0 ? void 0 : _0.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _1 ? void 0 : _1.format
205
- })), this.indicatorKeys[i] in record && (null === (_3 = null === (_2 = this.totalRecordsTree[flatRowKey]) || void 0 === _2 ? void 0 : _2[flatColKey]) || void 0 === _3 || _3[i].push(record));
191
+ (null === (_w = null === (_v = this.totalRecordsTree[flatRowKey]) || void 0 === _v ? void 0 : _v[flatColKey]) || void 0 === _w ? void 0 : _w[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_x = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _x ? _x : AggregationType.SUM](null !== (_y = null == aggRule ? void 0 : aggRule.field) && void 0 !== _y ? _y : this.indicatorKeys[i], null !== (_z = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _z ? _z : null === (_1 = null === (_0 = this.indicators) || void 0 === _0 ? void 0 : _0.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _1 ? void 0 : _1.format)),
192
+ this.indicatorKeys[i] in record && (null === (_3 = null === (_2 = this.totalRecordsTree[flatRowKey]) || void 0 === _2 ? void 0 : _2[flatColKey]) || void 0 === _3 || _3[i].push(record));
206
193
  }
207
- return;
208
- }
209
- 0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
210
- this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
211
- this.colFlatKeys[flatColKey] = 1)), this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
212
- (null === (_4 = this.tree[flatRowKey]) || void 0 === _4 ? void 0 : _4[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
213
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
214
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
215
- const calculatedFieldRule = null === (_5 = this.calculatedFieldRules) || void 0 === _5 ? void 0 : _5.find((rule => rule.key === toComputeIndicatorKeys[i]));
216
- (null === (_7 = null === (_6 = this.tree[flatRowKey]) || void 0 === _6 ? void 0 : _6[flatColKey]) || void 0 === _7 ? void 0 : _7[i]) || (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
217
- key: toComputeIndicatorKeys[i],
218
- dimension: toComputeIndicatorKeys[i],
219
- isRecord: !0,
220
- formatFun: null === (_9 = null === (_8 = this.indicators) || void 0 === _8 ? void 0 : _8.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _9 ? void 0 : _9.format,
221
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
222
- dependAggregators: this.tree[flatRowKey][flatColKey],
223
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
224
- })), null === (_11 = null === (_10 = this.tree[flatRowKey]) || void 0 === _10 ? void 0 : _10[flatColKey]) || void 0 === _11 || _11[i].push(record);
225
194
  } else {
226
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
227
- let needAddToAggregator = !1;
228
- if (assignedIndicatorKey) toComputeIndicatorKeys[i] === assignedIndicatorKey && (needAddToAggregator = !0); else if (null == aggRule ? void 0 : aggRule.field) if ("string" == typeof (null == aggRule ? void 0 : aggRule.field)) (null == aggRule ? void 0 : aggRule.field) in record && (needAddToAggregator = !0); else {
229
- (null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (needAddToAggregator = !0);
230
- } else toComputeIndicatorKeys[i] in record && (needAddToAggregator = !0);
231
- !(null === (_13 = null === (_12 = this.tree[flatRowKey]) || void 0 === _12 ? void 0 : _12[flatColKey]) || void 0 === _13 ? void 0 : _13[i]) && needAddToAggregator && (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_14 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _14 ? _14 : AggregationType.SUM]({
232
- key: toComputeIndicatorKeys[i],
233
- dimension: null !== (_15 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _15 ? _15 : toComputeIndicatorKeys[i],
234
- formatFun: null !== (_16 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _16 ? _16 : null === (_18 = null === (_17 = this.indicators) || void 0 === _17 ? void 0 : _17.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _18 ? void 0 : _18.format
235
- })), needAddToAggregator && (null === (_20 = null === (_19 = this.tree[flatRowKey]) || void 0 === _19 ? void 0 : _19[flatColKey]) || void 0 === _20 || _20[i].push(record));
236
- }
237
- if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
238
- if (!this.indicatorStatistics[i]) {
195
+ 0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
196
+ this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
197
+ this.colFlatKeys[flatColKey] = 1)), this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
198
+ (null === (_4 = this.tree[flatRowKey]) || void 0 === _4 ? void 0 : _4[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
199
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
239
200
  const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
240
- this.indicatorStatistics[i] = {
241
- max: new this.aggregators[AggregationType.MAX]({
242
- key: this.indicatorKeys[i],
243
- dimension: this.indicatorKeys[i]
244
- }),
245
- min: new this.aggregators[AggregationType.MIN]({
246
- key: this.indicatorKeys[i],
247
- dimension: this.indicatorKeys[i]
248
- }),
249
- total: new this.aggregators[null !== (_21 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _21 ? _21 : AggregationType.SUM]({
250
- key: this.indicatorKeys[i],
251
- dimension: null !== (_22 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _22 ? _22 : this.indicatorKeys[i],
252
- formatFun: null !== (_23 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _23 ? _23 : null === (_25 = null === (_24 = this.indicators) || void 0 === _24 ? void 0 : _24.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _25 ? void 0 : _25.format
253
- })
254
- };
201
+ let needAddToAggregator = !1;
202
+ if (assignedIndicatorKey) this.indicatorKeys[i] === assignedIndicatorKey && (needAddToAggregator = !0); else if (null == aggRule ? void 0 : aggRule.field) if ("string" == typeof (null == aggRule ? void 0 : aggRule.field)) (null == aggRule ? void 0 : aggRule.field) in record && (needAddToAggregator = !0); else {
203
+ (null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (needAddToAggregator = !0);
204
+ } else this.indicatorKeys[i] in record && (needAddToAggregator = !0);
205
+ !(null === (_6 = null === (_5 = this.tree[flatRowKey]) || void 0 === _5 ? void 0 : _5[flatColKey]) || void 0 === _6 ? void 0 : _6[i]) && needAddToAggregator && (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_7 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _7 ? _7 : AggregationType.SUM](null !== (_8 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _8 ? _8 : this.indicatorKeys[i], null !== (_9 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _9 ? _9 : null === (_11 = null === (_10 = this.indicators) || void 0 === _10 ? void 0 : _10.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _11 ? void 0 : _11.format)),
206
+ needAddToAggregator && (null === (_13 = null === (_12 = this.tree[flatRowKey]) || void 0 === _12 ? void 0 : _12[flatColKey]) || void 0 === _13 || _13[i].push(record));
207
+ }
208
+ if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
209
+ if (!this.indicatorStatistics[i]) {
210
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
211
+ this.indicatorStatistics[i] = {
212
+ max: new this.aggregators[AggregationType.MAX](this.indicatorKeys[i]),
213
+ min: new this.aggregators[AggregationType.MIN](this.indicatorKeys[i]),
214
+ total: new this.aggregators[null !== (_14 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _14 ? _14 : AggregationType.SUM](null !== (_15 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _15 ? _15 : this.indicatorKeys[i], null !== (_16 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _16 ? _16 : null === (_18 = null === (_17 = this.indicators) || void 0 === _17 ? void 0 : _17.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _18 ? void 0 : _18.format)
215
+ };
216
+ }
217
+ this.indicatorStatistics[i].max.push(null === (_20 = null === (_19 = this.tree[flatRowKey]) || void 0 === _19 ? void 0 : _19[flatColKey]) || void 0 === _20 ? void 0 : _20[i].value()),
218
+ this.indicatorStatistics[i].min.push(null === (_22 = null === (_21 = this.tree[flatRowKey]) || void 0 === _21 ? void 0 : _21[flatColKey]) || void 0 === _22 ? void 0 : _22[i].value()),
219
+ this.indicatorStatistics[i].total.push(record);
255
220
  }
256
- this.indicatorStatistics[i].max.push(null === (_27 = null === (_26 = this.tree[flatRowKey]) || void 0 === _26 ? void 0 : _26[flatColKey]) || void 0 === _27 ? void 0 : _27[i].value()),
257
- this.indicatorStatistics[i].min.push(null === (_29 = null === (_28 = this.tree[flatRowKey]) || void 0 === _28 ? void 0 : _28[flatColKey]) || void 0 === _29 ? void 0 : _29[i].value()),
258
- this.indicatorStatistics[i].total.push(record);
259
221
  }
260
222
  }
261
223
  updateSortRules(sortRules) {
@@ -404,7 +366,7 @@ export class Dataset {
404
366
  const that = this;
405
367
  if ((null === (_b = null === (_a = null == that ? void 0 : that.totals) || void 0 === _a ? void 0 : _a.column) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = null == that ? void 0 : that.totals) || void 0 === _c ? void 0 : _c.column) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 || (null === (_g = null === (_f = null == that ? void 0 : that.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.subTotalsDimensions) && (null === (_k = null === (_j = null === (_h = null == that ? void 0 : that.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.subTotalsDimensions) || void 0 === _k ? void 0 : _k.length) >= 1 || (null === (_m = null === (_l = null == that ? void 0 : that.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || (null === (_p = null === (_o = null == that ? void 0 : that.totals) || void 0 === _o ? void 0 : _o.row) || void 0 === _p ? void 0 : _p.showGrandTotals)) {
406
368
  const rowTotalKeys = [], colCompute = (flatRowKey, flatColKey) => {
407
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
369
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
408
370
  if (null === (_b = null === (_a = this.totalRecordsTree) || void 0 === _a ? void 0 : _a[flatRowKey]) || void 0 === _b ? void 0 : _b[flatColKey]) return void (this.tree[flatRowKey][flatColKey] = null === (_d = null === (_c = this.totalRecordsTree) || void 0 === _c ? void 0 : _c[flatRowKey]) || void 0 === _d ? void 0 : _d[flatColKey]);
409
371
  const colKey = flatColKey.split(this.stringJoinChar);
410
372
  if (null === (_f = null === (_e = that.totals) || void 0 === _e ? void 0 : _e.column) || void 0 === _f ? void 0 : _f.subTotalsDimensions) for (let i = 0, len = null === (_j = null === (_h = null === (_g = that.totals) || void 0 === _g ? void 0 : _g.column) || void 0 === _h ? void 0 : _h.subTotalsDimensions) || void 0 === _j ? void 0 : _j.length; i < len; i++) {
@@ -415,64 +377,32 @@ export class Dataset {
415
377
  const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
416
378
  if (null === (_l = null === (_k = this.totalRecordsTree) || void 0 === _k ? void 0 : _k[flatRowKey]) || void 0 === _l ? void 0 : _l[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_o = null === (_m = this.totalRecordsTree) || void 0 === _m ? void 0 : _m[flatRowKey]) || void 0 === _o ? void 0 : _o[flatColTotalKey]);
417
379
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
418
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
419
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
420
- const calculatedFieldRule = null === (_p = this.calculatedFieldRules) || void 0 === _p ? void 0 : _p.find((rule => rule.key === toComputeIndicatorKeys[i]));
421
- (null === (_r = null === (_q = this.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColTotalKey]) || void 0 === _r ? void 0 : _r[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
422
- key: toComputeIndicatorKeys[i],
423
- dimension: toComputeIndicatorKeys[i],
424
- isRecord: !0,
425
- formatFun: null === (_t = null === (_s = this.indicators) || void 0 === _s ? void 0 : _s.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _t ? void 0 : _t.format,
426
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
427
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
428
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
429
- })), this.tree[flatRowKey][flatColTotalKey][i].push(null === (_v = null === (_u = that.tree[flatRowKey]) || void 0 === _u ? void 0 : _u[flatColKey]) || void 0 === _v ? void 0 : _v[i]);
430
- } else {
380
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
431
381
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
432
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
433
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_w = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _w ? _w : AggregationType.SUM]({
434
- key: toComputeIndicatorKeys[i],
435
- dimension: null !== (_x = null == aggRule ? void 0 : aggRule.field) && void 0 !== _x ? _x : toComputeIndicatorKeys[i],
436
- formatFun: null !== (_y = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _y ? _y : null === (_0 = null === (_z = this.indicators) || void 0 === _z ? void 0 : _z.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _0 ? void 0 : _0.format
437
- });
382
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
383
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_p = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _p ? _p : AggregationType.SUM](null !== (_q = null == aggRule ? void 0 : aggRule.field) && void 0 !== _q ? _q : this.indicatorKeys[i], null !== (_r = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _r ? _r : null === (_t = null === (_s = this.indicators) || void 0 === _s ? void 0 : _s.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _t ? void 0 : _t.format);
438
384
  }
439
- this.tree[flatRowKey][flatColTotalKey][i].push(null === (_2 = null === (_1 = that.tree[flatRowKey]) || void 0 === _1 ? void 0 : _1[flatColKey]) || void 0 === _2 ? void 0 : _2[i]);
385
+ this.tree[flatRowKey][flatColTotalKey][i].push(null === (_v = null === (_u = that.tree[flatRowKey]) || void 0 === _u ? void 0 : _u[flatColKey]) || void 0 === _v ? void 0 : _v[i]);
440
386
  }
441
387
  }
442
388
  }
443
- if ((null === (_4 = null === (_3 = that.totals) || void 0 === _3 ? void 0 : _3.column) || void 0 === _4 ? void 0 : _4.showGrandTotals) || 0 === this.rows.length) {
389
+ if ((null === (_x = null === (_w = that.totals) || void 0 === _w ? void 0 : _w.column) || void 0 === _x ? void 0 : _x.showGrandTotals) || 0 === this.rows.length) {
444
390
  const flatColTotalKey = that.colGrandTotalLabel;
445
- if (null === (_6 = null === (_5 = this.totalRecordsTree) || void 0 === _5 ? void 0 : _5[flatRowKey]) || void 0 === _6 ? void 0 : _6[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_8 = null === (_7 = this.totalRecordsTree) || void 0 === _7 ? void 0 : _7[flatRowKey]) || void 0 === _8 ? void 0 : _8[flatColTotalKey]);
391
+ if (null === (_z = null === (_y = this.totalRecordsTree) || void 0 === _y ? void 0 : _y[flatRowKey]) || void 0 === _z ? void 0 : _z[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_1 = null === (_0 = this.totalRecordsTree) || void 0 === _0 ? void 0 : _0[flatRowKey]) || void 0 === _1 ? void 0 : _1[flatColTotalKey]);
446
392
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
447
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
448
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
449
- const calculatedFieldRule = null === (_9 = this.calculatedFieldRules) || void 0 === _9 ? void 0 : _9.find((rule => rule.key === toComputeIndicatorKeys[i]));
450
- (null === (_11 = null === (_10 = this.tree[flatRowKey]) || void 0 === _10 ? void 0 : _10[flatColTotalKey]) || void 0 === _11 ? void 0 : _11[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
451
- key: toComputeIndicatorKeys[i],
452
- dimension: toComputeIndicatorKeys[i],
453
- isRecord: !0,
454
- formatFun: null === (_13 = null === (_12 = this.indicators) || void 0 === _12 ? void 0 : _12.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _13 ? void 0 : _13.format,
455
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
456
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
457
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
458
- })), this.tree[flatRowKey][flatColTotalKey][i].push(null === (_15 = null === (_14 = that.tree[flatRowKey]) || void 0 === _14 ? void 0 : _14[flatColKey]) || void 0 === _15 ? void 0 : _15[i]);
459
- } else {
393
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
460
394
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
461
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
462
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_16 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _16 ? _16 : AggregationType.SUM]({
463
- key: toComputeIndicatorKeys[i],
464
- dimension: null !== (_17 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _17 ? _17 : toComputeIndicatorKeys[i],
465
- formatFun: null !== (_18 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _18 ? _18 : null === (_20 = null === (_19 = this.indicators) || void 0 === _19 ? void 0 : _19.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _20 ? void 0 : _20.format
466
- });
395
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
396
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_2 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _2 ? _2 : AggregationType.SUM](null !== (_3 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _3 ? _3 : this.indicatorKeys[i], null !== (_4 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _4 ? _4 : null === (_6 = null === (_5 = this.indicators) || void 0 === _5 ? void 0 : _5.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _6 ? void 0 : _6.format);
467
397
  }
468
- this.tree[flatRowKey][flatColTotalKey][i].push(null === (_22 = null === (_21 = that.tree[flatRowKey]) || void 0 === _21 ? void 0 : _21[flatColKey]) || void 0 === _22 ? void 0 : _22[i]);
398
+ this.tree[flatRowKey][flatColTotalKey][i].push(null === (_8 = null === (_7 = that.tree[flatRowKey]) || void 0 === _7 ? void 0 : _7[flatColKey]) || void 0 === _8 ? void 0 : _8[i]);
469
399
  }
470
400
  }
471
401
  };
472
402
  Object.keys(that.tree).forEach((flatRowKey => {
473
403
  const rowKey = flatRowKey.split(this.stringJoinChar);
474
404
  Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
475
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
405
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
476
406
  if (null === (_b = null === (_a = that.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) for (let i = 0, len = null === (_e = null === (_d = null === (_c = that.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length; i < len; i++) {
477
407
  const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
478
408
  if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
@@ -481,57 +411,25 @@ export class Dataset {
481
411
  const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
482
412
  this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
483
413
  this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
484
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
485
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
486
- if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
487
- const calculatedFieldRule = null === (_f = this.calculatedFieldRules) || void 0 === _f ? void 0 : _f.find((rule => rule.key === toComputeIndicatorKeys[i]));
488
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
489
- key: toComputeIndicatorKeys[i],
490
- dimension: toComputeIndicatorKeys[i],
491
- isRecord: !0,
492
- formatFun: null === (_h = null === (_g = this.indicators) || void 0 === _g ? void 0 : _g.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _h ? void 0 : _h.format,
493
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
494
- dependAggregators: this.tree[flatRowTotalKey][flatColKey],
495
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
496
- });
497
- } else {
498
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
499
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_j = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _j ? _j : AggregationType.SUM]({
500
- key: toComputeIndicatorKeys[i],
501
- dimension: null !== (_k = null == aggRule ? void 0 : aggRule.field) && void 0 !== _k ? _k : toComputeIndicatorKeys[i],
502
- formatFun: null !== (_l = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _l ? _l : null === (_o = null === (_m = this.indicators) || void 0 === _m ? void 0 : _m.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _o ? void 0 : _o.format
503
- });
414
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
415
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) {
416
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
417
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_f = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _f ? _f : AggregationType.SUM](null !== (_g = null == aggRule ? void 0 : aggRule.field) && void 0 !== _g ? _g : this.indicatorKeys[i], null !== (_h = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _h ? _h : null === (_k = null === (_j = this.indicators) || void 0 === _j ? void 0 : _j.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _k ? void 0 : _k.format);
504
418
  }
505
- this.tree[flatRowTotalKey][flatColKey][i].push(null === (_q = null === (_p = that.tree[flatRowKey]) || void 0 === _p ? void 0 : _p[flatColKey]) || void 0 === _q ? void 0 : _q[i]);
419
+ this.tree[flatRowTotalKey][flatColKey][i].push(null === (_m = null === (_l = that.tree[flatRowKey]) || void 0 === _l ? void 0 : _l[flatColKey]) || void 0 === _m ? void 0 : _m[i]);
506
420
  }
507
421
  }
508
422
  }
509
- if ((null === (_s = null === (_r = that.totals) || void 0 === _r ? void 0 : _r.row) || void 0 === _s ? void 0 : _s.showGrandTotals) || 0 === this.columns.length) {
423
+ if ((null === (_p = null === (_o = that.totals) || void 0 === _o ? void 0 : _o.row) || void 0 === _p ? void 0 : _p.showGrandTotals) || 0 === this.columns.length) {
510
424
  const flatRowTotalKey = that.rowGrandTotalLabel;
511
425
  this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
512
426
  this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
513
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
514
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
515
- if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
516
- const calculatedFieldRule = null === (_t = this.calculatedFieldRules) || void 0 === _t ? void 0 : _t.find((rule => rule.key === toComputeIndicatorKeys[i]));
517
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
518
- key: toComputeIndicatorKeys[i],
519
- dimension: toComputeIndicatorKeys[i],
520
- isRecord: !0,
521
- formatFun: null === (_v = null === (_u = this.indicators) || void 0 === _u ? void 0 : _u.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _v ? void 0 : _v.format,
522
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
523
- dependAggregators: this.tree[flatRowTotalKey][flatColKey],
524
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
525
- });
526
- } else {
527
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
528
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_w = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _w ? _w : AggregationType.SUM]({
529
- key: toComputeIndicatorKeys[i],
530
- dimension: null !== (_x = null == aggRule ? void 0 : aggRule.field) && void 0 !== _x ? _x : toComputeIndicatorKeys[i],
531
- formatFun: null !== (_y = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _y ? _y : null === (_0 = null === (_z = this.indicators) || void 0 === _z ? void 0 : _z.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _0 ? void 0 : _0.format
532
- });
427
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
428
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) {
429
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
430
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_q = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _q ? _q : AggregationType.SUM](null !== (_r = null == aggRule ? void 0 : aggRule.field) && void 0 !== _r ? _r : this.indicatorKeys[i], null !== (_s = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _s ? _s : null === (_u = null === (_t = this.indicators) || void 0 === _t ? void 0 : _t.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _u ? void 0 : _u.format);
533
431
  }
534
- this.tree[flatRowTotalKey][flatColKey][i].push(null === (_2 = null === (_1 = that.tree[flatRowKey]) || void 0 === _1 ? void 0 : _1[flatColKey]) || void 0 === _2 ? void 0 : _2[i]);
432
+ this.tree[flatRowTotalKey][flatColKey][i].push(null === (_w = null === (_v = that.tree[flatRowKey]) || void 0 === _v ? void 0 : _v[flatColKey]) || void 0 === _w ? void 0 : _w[i]);
535
433
  }
536
434
  }
537
435
  colCompute(flatRowKey, flatColKey);