@visactor/vtable 1.3.3-alpha.3 → 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 (75) 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 +72 -187
  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/layout/tree-helper.js +1 -0
  17. package/cjs/plugins/themes.js +1 -2
  18. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +3 -2
  19. package/cjs/scenegraph/group-creater/progress/proxy.js +10 -10
  20. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  21. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -1
  22. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
  23. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  24. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +3 -2
  25. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +15 -14
  26. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  27. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +7 -5
  28. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  29. package/cjs/ts-types/base-table.d.ts +5 -25
  30. package/cjs/ts-types/base-table.js.map +1 -1
  31. package/cjs/ts-types/new-data-set.d.ts +1 -9
  32. package/cjs/ts-types/new-data-set.js +1 -1
  33. package/cjs/ts-types/new-data-set.js.map +1 -1
  34. package/cjs/ts-types/table-engine.d.ts +12 -0
  35. package/cjs/ts-types/table-engine.js.map +1 -1
  36. package/cjs/vrender.js.map +1 -1
  37. package/dist/vtable.js +217 -478
  38. package/dist/vtable.min.js +2 -2
  39. package/es/core/BaseTable.d.ts +5 -25
  40. package/es/core/BaseTable.js +1 -1
  41. package/es/core/BaseTable.js.map +1 -1
  42. package/es/data/DataSource.d.ts +1 -6
  43. package/es/data/DataSource.js +2 -12
  44. package/es/data/DataSource.js.map +1 -1
  45. package/es/dataset/dataset.d.ts +2 -15
  46. package/es/dataset/dataset.js +73 -187
  47. package/es/dataset/dataset.js.map +1 -1
  48. package/es/dataset/statistics-helper.d.ts +3 -43
  49. package/es/dataset/statistics-helper.js +23 -55
  50. package/es/dataset/statistics-helper.js.map +1 -1
  51. package/es/index.d.ts +1 -1
  52. package/es/index.js +1 -1
  53. package/es/index.js.map +1 -1
  54. package/es/layout/tree-helper.js +2 -1
  55. package/es/plugins/themes.js +1 -2
  56. package/es/scenegraph/group-creater/progress/proxy.d.ts +3 -2
  57. package/es/scenegraph/group-creater/progress/proxy.js +10 -10
  58. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  59. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +2 -1
  60. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
  61. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  62. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +3 -2
  63. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +15 -13
  64. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  65. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +7 -5
  66. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  67. package/es/ts-types/base-table.d.ts +5 -25
  68. package/es/ts-types/base-table.js.map +1 -1
  69. package/es/ts-types/new-data-set.d.ts +1 -9
  70. package/es/ts-types/new-data-set.js +1 -1
  71. package/es/ts-types/new-data-set.js.map +1 -1
  72. package/es/ts-types/table-engine.d.ts +12 -0
  73. package/es/ts-types/table-engine.js.map +1 -1
  74. package/es/vrender.js.map +1 -1
  75. 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, _30, _31, _32, _33, _34, _35, _36;
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);
@@ -200,78 +189,38 @@ class Dataset {
200
189
  const flatRowKey = rowKey.join(this.stringJoinChar), flatColKey = colKey.join(this.stringJoinChar);
201
190
  if (isToTalRecord) {
202
191
  this.totalRecordsTree[flatRowKey] || (this.totalRecordsTree[flatRowKey] = {}), this.totalRecordsTree[flatRowKey][flatColKey] || (this.totalRecordsTree[flatRowKey][flatColKey] = []);
203
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
204
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
205
- const calculatedFieldRule = null === (_v = this.calculatedFieldRules) || void 0 === _v ? void 0 : _v.find((rule => rule.key === toComputeIndicatorKeys[i]));
206
- (null === (_x = null === (_w = this.totalRecordsTree[flatRowKey]) || void 0 === _w ? void 0 : _w[flatColKey]) || void 0 === _x ? void 0 : _x[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[ts_types_1.AggregationType.RECALCULATE]({
207
- key: toComputeIndicatorKeys[i],
208
- dimension: toComputeIndicatorKeys[i],
209
- isRecord: !0,
210
- formatFun: null === (_z = null === (_y = this.indicators) || void 0 === _y ? void 0 : _y.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _z ? void 0 : _z.format,
211
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
212
- dependAggregators: this.totalRecordsTree[flatRowKey][flatColKey],
213
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
214
- })), toComputeIndicatorKeys[i] in record && (null === (_1 = null === (_0 = this.totalRecordsTree[flatRowKey]) || void 0 === _0 ? void 0 : _0[flatColKey]) || void 0 === _1 || _1[i].push(record));
215
- } else {
216
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
217
- (null === (_3 = null === (_2 = this.totalRecordsTree[flatRowKey]) || void 0 === _2 ? void 0 : _2[flatColKey]) || void 0 === _3 ? void 0 : _3[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_4 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _4 ? _4 : ts_types_1.AggregationType.SUM]({
218
- key: toComputeIndicatorKeys[i],
219
- dimension: null !== (_5 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _5 ? _5 : toComputeIndicatorKeys[i],
220
- formatFun: null !== (_6 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _6 ? _6 : null === (_8 = null === (_7 = this.indicators) || void 0 === _7 ? void 0 : _7.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _8 ? void 0 : _8.format
221
- })), toComputeIndicatorKeys[i] in record && (null === (_10 = null === (_9 = this.totalRecordsTree[flatRowKey]) || void 0 === _9 ? void 0 : _9[flatColKey]) || void 0 === _10 || _10[i].push(record));
192
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
193
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
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));
222
196
  }
223
- return;
224
- }
225
- 0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
226
- this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
227
- this.colFlatKeys[flatColKey] = 1)), this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
228
- (null === (_11 = this.tree[flatRowKey]) || void 0 === _11 ? void 0 : _11[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
229
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
230
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
231
- const calculatedFieldRule = null === (_12 = this.calculatedFieldRules) || void 0 === _12 ? void 0 : _12.find((rule => rule.key === toComputeIndicatorKeys[i]));
232
- (null === (_14 = null === (_13 = this.tree[flatRowKey]) || void 0 === _13 ? void 0 : _13[flatColKey]) || void 0 === _14 ? void 0 : _14[i]) || (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[ts_types_1.AggregationType.RECALCULATE]({
233
- key: toComputeIndicatorKeys[i],
234
- dimension: toComputeIndicatorKeys[i],
235
- isRecord: !0,
236
- formatFun: null === (_16 = null === (_15 = this.indicators) || void 0 === _15 ? void 0 : _15.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _16 ? void 0 : _16.format,
237
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
238
- dependAggregators: this.tree[flatRowKey][flatColKey],
239
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
240
- })), null === (_18 = null === (_17 = this.tree[flatRowKey]) || void 0 === _17 ? void 0 : _17[flatColKey]) || void 0 === _18 || _18[i].push(record);
241
197
  } else {
242
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
243
- let needAddToAggregator = !1;
244
- 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 {
245
- (null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (needAddToAggregator = !0);
246
- } else toComputeIndicatorKeys[i] in record && (needAddToAggregator = !0);
247
- !(null === (_20 = null === (_19 = this.tree[flatRowKey]) || void 0 === _19 ? void 0 : _19[flatColKey]) || void 0 === _20 ? void 0 : _20[i]) && needAddToAggregator && (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_21 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _21 ? _21 : ts_types_1.AggregationType.SUM]({
248
- key: toComputeIndicatorKeys[i],
249
- dimension: null !== (_22 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _22 ? _22 : toComputeIndicatorKeys[i],
250
- 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 === toComputeIndicatorKeys[i]))) || void 0 === _25 ? void 0 : _25.format
251
- })), needAddToAggregator && (null === (_27 = null === (_26 = this.tree[flatRowKey]) || void 0 === _26 ? void 0 : _26[flatColKey]) || void 0 === _27 || _27[i].push(record));
252
- }
253
- if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
254
- 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++) {
255
203
  const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
256
- this.indicatorStatistics[i] = {
257
- max: new this.aggregators[ts_types_1.AggregationType.MAX]({
258
- key: this.indicatorKeys[i],
259
- dimension: this.indicatorKeys[i]
260
- }),
261
- min: new this.aggregators[ts_types_1.AggregationType.MIN]({
262
- key: this.indicatorKeys[i],
263
- dimension: this.indicatorKeys[i]
264
- }),
265
- total: new this.aggregators[null !== (_28 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _28 ? _28 : ts_types_1.AggregationType.SUM]({
266
- key: this.indicatorKeys[i],
267
- dimension: null !== (_29 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _29 ? _29 : this.indicatorKeys[i],
268
- formatFun: null !== (_30 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _30 ? _30 : null === (_32 = null === (_31 = this.indicators) || void 0 === _31 ? void 0 : _31.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _32 ? void 0 : _32.format
269
- })
270
- };
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);
271
223
  }
272
- this.indicatorStatistics[i].max.push(null === (_34 = null === (_33 = this.tree[flatRowKey]) || void 0 === _33 ? void 0 : _33[flatColKey]) || void 0 === _34 ? void 0 : _34[i].value()),
273
- this.indicatorStatistics[i].min.push(null === (_36 = null === (_35 = this.tree[flatRowKey]) || void 0 === _35 ? void 0 : _35[flatColKey]) || void 0 === _36 ? void 0 : _36[i].value()),
274
- this.indicatorStatistics[i].total.push(record);
275
224
  }
276
225
  }
277
226
  updateSortRules(sortRules) {
@@ -421,76 +370,44 @@ class Dataset {
421
370
  const that = this;
422
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)) {
423
372
  const rowTotalKeys = [], colCompute = (flatRowKey, flatColKey) => {
424
- 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;
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;
425
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]);
426
375
  const colKey = flatColKey.split(this.stringJoinChar);
427
- if ((null === (_f = null === (_e = that.totals) || void 0 === _e ? void 0 : _e.column) || void 0 === _f ? void 0 : _f.subTotalsDimensions) && (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) > 0 && !1 !== that.totals.column.showSubTotals) for (let i = 0, len = null === (_m = null === (_l = null === (_k = that.totals) || void 0 === _k ? void 0 : _k.column) || void 0 === _l ? void 0 : _l.subTotalsDimensions) || void 0 === _m ? void 0 : _m.length; i < len; i++) {
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++) {
428
377
  const dimension = that.totals.column.subTotalsDimensions[i], dimensionIndex = that.columns.indexOf(dimension);
429
378
  if (dimensionIndex >= 0) {
430
379
  const colTotalKey = colKey.slice(0, dimensionIndex + 1);
431
380
  colTotalKey.push(that.colSubTotalLabel);
432
381
  const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
433
- if (null === (_p = null === (_o = this.totalRecordsTree) || void 0 === _o ? void 0 : _o[flatRowKey]) || void 0 === _p ? void 0 : _p[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_r = null === (_q = this.totalRecordsTree) || void 0 === _q ? void 0 : _q[flatRowKey]) || void 0 === _r ? void 0 : _r[flatColTotalKey]);
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]);
434
383
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
435
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
436
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
437
- const calculatedFieldRule = null === (_s = this.calculatedFieldRules) || void 0 === _s ? void 0 : _s.find((rule => rule.key === toComputeIndicatorKeys[i]));
438
- (null === (_u = null === (_t = this.tree[flatRowKey]) || void 0 === _t ? void 0 : _t[flatColTotalKey]) || void 0 === _u ? void 0 : _u[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[ts_types_1.AggregationType.RECALCULATE]({
439
- key: toComputeIndicatorKeys[i],
440
- dimension: toComputeIndicatorKeys[i],
441
- isRecord: !0,
442
- formatFun: null === (_w = null === (_v = this.indicators) || void 0 === _v ? void 0 : _v.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _w ? void 0 : _w.format,
443
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
444
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
445
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
446
- })), this.tree[flatRowKey][flatColTotalKey][i].push(null === (_y = null === (_x = that.tree[flatRowKey]) || void 0 === _x ? void 0 : _x[flatColKey]) || void 0 === _y ? void 0 : _y[i]);
447
- } else {
384
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
448
385
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
449
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
450
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_z = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _z ? _z : ts_types_1.AggregationType.SUM]({
451
- key: toComputeIndicatorKeys[i],
452
- dimension: null !== (_0 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _0 ? _0 : toComputeIndicatorKeys[i],
453
- formatFun: null !== (_1 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _1 ? _1 : null === (_3 = null === (_2 = this.indicators) || void 0 === _2 ? void 0 : _2.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _3 ? void 0 : _3.format
454
- });
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);
455
388
  }
456
- this.tree[flatRowKey][flatColTotalKey][i].push(null === (_5 = null === (_4 = that.tree[flatRowKey]) || void 0 === _4 ? void 0 : _4[flatColKey]) || void 0 === _5 ? void 0 : _5[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]);
457
390
  }
458
391
  }
459
392
  }
460
- if ((null === (_7 = null === (_6 = that.totals) || void 0 === _6 ? void 0 : _6.column) || void 0 === _7 ? void 0 : _7.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) {
461
394
  const flatColTotalKey = that.colGrandTotalLabel;
462
- if (null === (_9 = null === (_8 = this.totalRecordsTree) || void 0 === _8 ? void 0 : _8[flatRowKey]) || void 0 === _9 ? void 0 : _9[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_11 = null === (_10 = this.totalRecordsTree) || void 0 === _10 ? void 0 : _10[flatRowKey]) || void 0 === _11 ? void 0 : _11[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]);
463
396
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
464
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
465
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
466
- const calculatedFieldRule = null === (_12 = this.calculatedFieldRules) || void 0 === _12 ? void 0 : _12.find((rule => rule.key === toComputeIndicatorKeys[i]));
467
- (null === (_14 = null === (_13 = this.tree[flatRowKey]) || void 0 === _13 ? void 0 : _13[flatColTotalKey]) || void 0 === _14 ? void 0 : _14[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[ts_types_1.AggregationType.RECALCULATE]({
468
- key: toComputeIndicatorKeys[i],
469
- dimension: toComputeIndicatorKeys[i],
470
- isRecord: !0,
471
- formatFun: null === (_16 = null === (_15 = this.indicators) || void 0 === _15 ? void 0 : _15.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _16 ? void 0 : _16.format,
472
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
473
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
474
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
475
- })), this.tree[flatRowKey][flatColTotalKey][i].push(null === (_18 = null === (_17 = that.tree[flatRowKey]) || void 0 === _17 ? void 0 : _17[flatColKey]) || void 0 === _18 ? void 0 : _18[i]);
476
- } else {
397
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
477
398
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
478
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
479
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_19 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _19 ? _19 : ts_types_1.AggregationType.SUM]({
480
- key: toComputeIndicatorKeys[i],
481
- dimension: null !== (_20 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _20 ? _20 : toComputeIndicatorKeys[i],
482
- formatFun: null !== (_21 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _21 ? _21 : null === (_23 = null === (_22 = this.indicators) || void 0 === _22 ? void 0 : _22.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _23 ? void 0 : _23.format
483
- });
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);
484
401
  }
485
- this.tree[flatRowKey][flatColTotalKey][i].push(null === (_25 = null === (_24 = that.tree[flatRowKey]) || void 0 === _24 ? void 0 : _24[flatColKey]) || void 0 === _25 ? void 0 : _25[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]);
486
403
  }
487
404
  }
488
405
  };
489
406
  Object.keys(that.tree).forEach((flatRowKey => {
490
407
  const rowKey = flatRowKey.split(this.stringJoinChar);
491
408
  Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
492
- 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;
493
- if ((null === (_b = null === (_a = that.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (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) > 0 && !1 !== that.totals.row.showSubTotals) for (let i = 0, len = null === (_h = null === (_g = null === (_f = that.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.subTotalsDimensions) || void 0 === _h ? void 0 : _h.length; i < len; i++) {
409
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
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++) {
494
411
  const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
495
412
  if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
496
413
  const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
@@ -498,57 +415,25 @@ class Dataset {
498
415
  const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
499
416
  this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
500
417
  this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
501
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
502
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
503
- if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
504
- const calculatedFieldRule = null === (_j = this.calculatedFieldRules) || void 0 === _j ? void 0 : _j.find((rule => rule.key === toComputeIndicatorKeys[i]));
505
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[ts_types_1.AggregationType.RECALCULATE]({
506
- key: toComputeIndicatorKeys[i],
507
- dimension: toComputeIndicatorKeys[i],
508
- isRecord: !0,
509
- formatFun: null === (_l = null === (_k = this.indicators) || void 0 === _k ? void 0 : _k.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _l ? void 0 : _l.format,
510
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
511
- dependAggregators: this.tree[flatRowTotalKey][flatColKey],
512
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
513
- });
514
- } else {
515
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
516
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_m = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _m ? _m : ts_types_1.AggregationType.SUM]({
517
- key: toComputeIndicatorKeys[i],
518
- dimension: null !== (_o = null == aggRule ? void 0 : aggRule.field) && void 0 !== _o ? _o : toComputeIndicatorKeys[i],
519
- formatFun: null !== (_p = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _p ? _p : null === (_r = null === (_q = this.indicators) || void 0 === _q ? void 0 : _q.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _r ? void 0 : _r.format
520
- });
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);
521
422
  }
522
- this.tree[flatRowTotalKey][flatColKey][i].push(null === (_t = null === (_s = that.tree[flatRowKey]) || void 0 === _s ? void 0 : _s[flatColKey]) || void 0 === _t ? void 0 : _t[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]);
523
424
  }
524
425
  }
525
426
  }
526
- if ((null === (_v = null === (_u = that.totals) || void 0 === _u ? void 0 : _u.row) || void 0 === _v ? void 0 : _v.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) {
527
428
  const flatRowTotalKey = that.rowGrandTotalLabel;
528
429
  this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
529
430
  this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
530
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
531
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
532
- if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
533
- const calculatedFieldRule = null === (_w = this.calculatedFieldRules) || void 0 === _w ? void 0 : _w.find((rule => rule.key === toComputeIndicatorKeys[i]));
534
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[ts_types_1.AggregationType.RECALCULATE]({
535
- key: toComputeIndicatorKeys[i],
536
- dimension: toComputeIndicatorKeys[i],
537
- isRecord: !0,
538
- formatFun: null === (_y = null === (_x = this.indicators) || void 0 === _x ? void 0 : _x.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _y ? void 0 : _y.format,
539
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
540
- dependAggregators: this.tree[flatRowTotalKey][flatColKey],
541
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
542
- });
543
- } else {
544
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
545
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_z = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _z ? _z : ts_types_1.AggregationType.SUM]({
546
- key: toComputeIndicatorKeys[i],
547
- dimension: null !== (_0 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _0 ? _0 : toComputeIndicatorKeys[i],
548
- formatFun: null !== (_1 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _1 ? _1 : null === (_3 = null === (_2 = this.indicators) || void 0 === _2 ? void 0 : _2.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _3 ? void 0 : _3.format
549
- });
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);
550
435
  }
551
- this.tree[flatRowTotalKey][flatColKey][i].push(null === (_5 = null === (_4 = that.tree[flatRowKey]) || void 0 === _4 ? void 0 : _4[flatColKey]) || void 0 === _5 ? void 0 : _5[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]);
552
437
  }
553
438
  }
554
439
  colCompute(flatRowKey, flatColKey);