@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
@@ -8,8 +8,8 @@ const vutils_1 = require("@visactor/vutils"), ts_types_1 = require("../ts-types"
8
8
 
9
9
  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 @@ 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
  }
@@ -76,8 +70,7 @@ class Dataset {
76
70
  this.registerAggregator(ts_types_1.AggregationType.MAX, statistics_helper_1.MaxAggregator),
77
71
  this.registerAggregator(ts_types_1.AggregationType.MIN, statistics_helper_1.MinAggregator),
78
72
  this.registerAggregator(ts_types_1.AggregationType.AVG, statistics_helper_1.AvgAggregator),
79
- this.registerAggregator(ts_types_1.AggregationType.NONE, statistics_helper_1.NoneAggregator),
80
- this.registerAggregator(ts_types_1.AggregationType.RECALCULATE, statistics_helper_1.RecalculateAggregator);
73
+ this.registerAggregator(ts_types_1.AggregationType.NONE, statistics_helper_1.NoneAggregator);
81
74
  }
82
75
  processCollectedValuesWithSumBy() {
83
76
  var _a, _b, _c, _d, _e, _f;
@@ -143,7 +136,7 @@ class Dataset {
143
136
  return isReserved;
144
137
  }
145
138
  processRecord(record, assignedIndicatorKey) {
146
- 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;
139
+ 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;
147
140
  null === (_a = this.derivedFieldRules) || void 0 === _a || _a.forEach(((derivedFieldRule, i) => {
148
141
  derivedFieldRule.fieldName && derivedFieldRule.derivedFunc && (record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record));
149
142
  }));
@@ -155,12 +148,8 @@ class Dataset {
155
148
  max: Number.MIN_SAFE_INTEGER
156
149
  } : this.collectedValues[field][collectKeys] = []), this.collectValuesBy[field].sumBy) {
157
150
  const sumByKeys = this.collectValuesBy[field].sumBy.map((byField => record[byField])).join(this.stringJoinChar);
158
- this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[ts_types_1.AggregationType.SUM]({
159
- key: field,
160
- dimension: field,
161
- isRecord: void 0,
162
- needSplitPositiveAndNegative: this.needSplitPositiveAndNegative
163
- })), this.collectedValues[field][collectKeys][sumByKeys].push(record);
151
+ this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[ts_types_1.AggregationType.SUM](field, void 0, void 0, this.needSplitPositiveAndNegative)),
152
+ this.collectedValues[field][collectKeys][sumByKeys].push(record);
164
153
  } else if (this.collectValuesBy[field].range) {
165
154
  const fieldRange = this.collectedValues[field][collectKeys], max = Math.max(record[field], fieldRange.max), min = Math.min(record[field], fieldRange.min);
166
155
  isNaN(max) || (fieldRange.max = max, fieldRange.min = min);
@@ -202,64 +191,36 @@ class Dataset {
202
191
  this.totalRecordsTree[flatRowKey] || (this.totalRecordsTree[flatRowKey] = {}), this.totalRecordsTree[flatRowKey][flatColKey] || (this.totalRecordsTree[flatRowKey][flatColKey] = []);
203
192
  for (let i = 0; i < this.indicatorKeys.length; i++) {
204
193
  const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
205
- (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 : ts_types_1.AggregationType.SUM]({
206
- key: this.indicatorKeys[i],
207
- dimension: null !== (_y = null == aggRule ? void 0 : aggRule.field) && void 0 !== _y ? _y : this.indicatorKeys[i],
208
- 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
209
- })), 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));
194
+ (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 : ts_types_1.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)),
195
+ 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));
210
196
  }
211
- return;
212
- }
213
- 0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
214
- this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
215
- this.colFlatKeys[flatColKey] = 1)), this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
216
- (null === (_4 = this.tree[flatRowKey]) || void 0 === _4 ? void 0 : _4[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
217
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
218
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
219
- const calculatedFieldRule = null === (_5 = this.calculatedFieldRules) || void 0 === _5 ? void 0 : _5.find((rule => rule.key === toComputeIndicatorKeys[i]));
220
- (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[ts_types_1.AggregationType.RECALCULATE]({
221
- key: toComputeIndicatorKeys[i],
222
- dimension: toComputeIndicatorKeys[i],
223
- isRecord: !0,
224
- 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,
225
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
226
- dependAggregators: this.tree[flatRowKey][flatColKey],
227
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
228
- })), null === (_11 = null === (_10 = this.tree[flatRowKey]) || void 0 === _10 ? void 0 : _10[flatColKey]) || void 0 === _11 || _11[i].push(record);
229
197
  } else {
230
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
231
- let needAddToAggregator = !1;
232
- 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 {
233
- (null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (needAddToAggregator = !0);
234
- } else toComputeIndicatorKeys[i] in record && (needAddToAggregator = !0);
235
- !(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 : ts_types_1.AggregationType.SUM]({
236
- key: toComputeIndicatorKeys[i],
237
- dimension: null !== (_15 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _15 ? _15 : toComputeIndicatorKeys[i],
238
- 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
239
- })), needAddToAggregator && (null === (_20 = null === (_19 = this.tree[flatRowKey]) || void 0 === _19 ? void 0 : _19[flatColKey]) || void 0 === _20 || _20[i].push(record));
240
- }
241
- if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
242
- if (!this.indicatorStatistics[i]) {
198
+ 0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
199
+ this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
200
+ this.colFlatKeys[flatColKey] = 1)), this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
201
+ (null === (_4 = this.tree[flatRowKey]) || void 0 === _4 ? void 0 : _4[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
202
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
243
203
  const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
244
- this.indicatorStatistics[i] = {
245
- max: new this.aggregators[ts_types_1.AggregationType.MAX]({
246
- key: this.indicatorKeys[i],
247
- dimension: this.indicatorKeys[i]
248
- }),
249
- min: new this.aggregators[ts_types_1.AggregationType.MIN]({
250
- key: this.indicatorKeys[i],
251
- dimension: this.indicatorKeys[i]
252
- }),
253
- total: new this.aggregators[null !== (_21 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _21 ? _21 : ts_types_1.AggregationType.SUM]({
254
- key: this.indicatorKeys[i],
255
- dimension: null !== (_22 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _22 ? _22 : this.indicatorKeys[i],
256
- 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
257
- })
258
- };
204
+ let needAddToAggregator = !1;
205
+ 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 {
206
+ (null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (needAddToAggregator = !0);
207
+ } else this.indicatorKeys[i] in record && (needAddToAggregator = !0);
208
+ !(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 : ts_types_1.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)),
209
+ needAddToAggregator && (null === (_13 = null === (_12 = this.tree[flatRowKey]) || void 0 === _12 ? void 0 : _12[flatColKey]) || void 0 === _13 || _13[i].push(record));
210
+ }
211
+ if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
212
+ if (!this.indicatorStatistics[i]) {
213
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
214
+ this.indicatorStatistics[i] = {
215
+ max: new this.aggregators[ts_types_1.AggregationType.MAX](this.indicatorKeys[i]),
216
+ min: new this.aggregators[ts_types_1.AggregationType.MIN](this.indicatorKeys[i]),
217
+ total: new this.aggregators[null !== (_14 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _14 ? _14 : ts_types_1.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)
218
+ };
219
+ }
220
+ 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()),
221
+ 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()),
222
+ this.indicatorStatistics[i].total.push(record);
259
223
  }
260
- 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()),
261
- 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()),
262
- this.indicatorStatistics[i].total.push(record);
263
224
  }
264
225
  }
265
226
  updateSortRules(sortRules) {
@@ -409,7 +370,7 @@ class Dataset {
409
370
  const that = this;
410
371
  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)) {
411
372
  const rowTotalKeys = [], colCompute = (flatRowKey, flatColKey) => {
412
- 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;
373
+ 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;
413
374
  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]);
414
375
  const colKey = flatColKey.split(this.stringJoinChar);
415
376
  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++) {
@@ -420,64 +381,32 @@ class Dataset {
420
381
  const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
421
382
  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]);
422
383
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
423
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
424
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
425
- const calculatedFieldRule = null === (_p = this.calculatedFieldRules) || void 0 === _p ? void 0 : _p.find((rule => rule.key === toComputeIndicatorKeys[i]));
426
- (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[ts_types_1.AggregationType.RECALCULATE]({
427
- key: toComputeIndicatorKeys[i],
428
- dimension: toComputeIndicatorKeys[i],
429
- isRecord: !0,
430
- 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,
431
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
432
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
433
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
434
- })), 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]);
435
- } else {
384
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
436
385
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
437
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
438
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_w = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _w ? _w : ts_types_1.AggregationType.SUM]({
439
- key: toComputeIndicatorKeys[i],
440
- dimension: null !== (_x = null == aggRule ? void 0 : aggRule.field) && void 0 !== _x ? _x : toComputeIndicatorKeys[i],
441
- 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
442
- });
386
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
387
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_p = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _p ? _p : ts_types_1.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);
443
388
  }
444
- 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]);
389
+ 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]);
445
390
  }
446
391
  }
447
392
  }
448
- 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) {
393
+ 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) {
449
394
  const flatColTotalKey = that.colGrandTotalLabel;
450
- 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]);
395
+ 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]);
451
396
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
452
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
453
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
454
- const calculatedFieldRule = null === (_9 = this.calculatedFieldRules) || void 0 === _9 ? void 0 : _9.find((rule => rule.key === toComputeIndicatorKeys[i]));
455
- (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[ts_types_1.AggregationType.RECALCULATE]({
456
- key: toComputeIndicatorKeys[i],
457
- dimension: toComputeIndicatorKeys[i],
458
- isRecord: !0,
459
- 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,
460
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
461
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
462
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
463
- })), 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]);
464
- } else {
397
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
465
398
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
466
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
467
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_16 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _16 ? _16 : ts_types_1.AggregationType.SUM]({
468
- key: toComputeIndicatorKeys[i],
469
- dimension: null !== (_17 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _17 ? _17 : toComputeIndicatorKeys[i],
470
- 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
471
- });
399
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
400
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_2 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _2 ? _2 : ts_types_1.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);
472
401
  }
473
- 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]);
402
+ 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]);
474
403
  }
475
404
  }
476
405
  };
477
406
  Object.keys(that.tree).forEach((flatRowKey => {
478
407
  const rowKey = flatRowKey.split(this.stringJoinChar);
479
408
  Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
480
- 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;
409
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
481
410
  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++) {
482
411
  const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
483
412
  if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
@@ -486,57 +415,25 @@ class Dataset {
486
415
  const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
487
416
  this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
488
417
  this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
489
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
490
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
491
- if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
492
- const calculatedFieldRule = null === (_f = this.calculatedFieldRules) || void 0 === _f ? void 0 : _f.find((rule => rule.key === toComputeIndicatorKeys[i]));
493
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[ts_types_1.AggregationType.RECALCULATE]({
494
- key: toComputeIndicatorKeys[i],
495
- dimension: toComputeIndicatorKeys[i],
496
- isRecord: !0,
497
- 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,
498
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
499
- dependAggregators: this.tree[flatRowTotalKey][flatColKey],
500
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
501
- });
502
- } else {
503
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
504
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_j = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _j ? _j : ts_types_1.AggregationType.SUM]({
505
- key: toComputeIndicatorKeys[i],
506
- dimension: null !== (_k = null == aggRule ? void 0 : aggRule.field) && void 0 !== _k ? _k : toComputeIndicatorKeys[i],
507
- 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
508
- });
418
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
419
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) {
420
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
421
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_f = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _f ? _f : ts_types_1.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);
509
422
  }
510
- 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]);
423
+ 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]);
511
424
  }
512
425
  }
513
426
  }
514
- 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) {
427
+ 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) {
515
428
  const flatRowTotalKey = that.rowGrandTotalLabel;
516
429
  this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
517
430
  this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
518
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
519
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
520
- if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
521
- const calculatedFieldRule = null === (_t = this.calculatedFieldRules) || void 0 === _t ? void 0 : _t.find((rule => rule.key === toComputeIndicatorKeys[i]));
522
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[ts_types_1.AggregationType.RECALCULATE]({
523
- key: toComputeIndicatorKeys[i],
524
- dimension: toComputeIndicatorKeys[i],
525
- isRecord: !0,
526
- 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,
527
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
528
- dependAggregators: this.tree[flatRowTotalKey][flatColKey],
529
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
530
- });
531
- } else {
532
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
533
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_w = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _w ? _w : ts_types_1.AggregationType.SUM]({
534
- key: toComputeIndicatorKeys[i],
535
- dimension: null !== (_x = null == aggRule ? void 0 : aggRule.field) && void 0 !== _x ? _x : toComputeIndicatorKeys[i],
536
- 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
537
- });
431
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
432
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) {
433
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
434
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_q = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _q ? _q : ts_types_1.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);
538
435
  }
539
- 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]);
436
+ 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]);
540
437
  }
541
438
  }
542
439
  colCompute(flatRowKey, flatColKey);