@visactor/vtable 1.3.3-alpha.2 → 1.3.3-alpha.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.
@@ -139,7 +139,7 @@ export class Dataset {
139
139
  return isReserved;
140
140
  }
141
141
  processRecord(record, assignedIndicatorKey) {
142
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29;
142
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36;
143
143
  null === (_a = this.derivedFieldRules) || void 0 === _a || _a.forEach(((derivedFieldRule, i) => {
144
144
  derivedFieldRule.fieldName && derivedFieldRule.derivedFunc && (record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record));
145
145
  }));
@@ -196,43 +196,55 @@ export class Dataset {
196
196
  const flatRowKey = rowKey.join(this.stringJoinChar), flatColKey = colKey.join(this.stringJoinChar);
197
197
  if (isToTalRecord) {
198
198
  this.totalRecordsTree[flatRowKey] || (this.totalRecordsTree[flatRowKey] = {}), this.totalRecordsTree[flatRowKey][flatColKey] || (this.totalRecordsTree[flatRowKey][flatColKey] = []);
199
- for (let i = 0; i < this.indicatorKeys.length; i++) {
200
- const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
201
- (null === (_w = null === (_v = this.totalRecordsTree[flatRowKey]) || void 0 === _v ? void 0 : _v[flatColKey]) || void 0 === _w ? void 0 : _w[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_x = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _x ? _x : AggregationType.SUM]({
202
- key: this.indicatorKeys[i],
203
- dimension: null !== (_y = null == aggRule ? void 0 : aggRule.field) && void 0 !== _y ? _y : this.indicatorKeys[i],
204
- formatFun: null !== (_z = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _z ? _z : null === (_1 = null === (_0 = this.indicators) || void 0 === _0 ? void 0 : _0.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _1 ? void 0 : _1.format
205
- })), this.indicatorKeys[i] in record && (null === (_3 = null === (_2 = this.totalRecordsTree[flatRowKey]) || void 0 === _2 ? void 0 : _2[flatColKey]) || void 0 === _3 || _3[i].push(record));
199
+ const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
200
+ for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
201
+ const calculatedFieldRule = null === (_v = this.calculatedFieldRules) || void 0 === _v ? void 0 : _v.find((rule => rule.key === toComputeIndicatorKeys[i]));
202
+ (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[AggregationType.RECALCULATE]({
203
+ key: toComputeIndicatorKeys[i],
204
+ dimension: toComputeIndicatorKeys[i],
205
+ isRecord: !0,
206
+ 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,
207
+ calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
208
+ dependAggregators: this.totalRecordsTree[flatRowKey][flatColKey],
209
+ dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
210
+ })), 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));
211
+ } else {
212
+ const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
213
+ (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 : AggregationType.SUM]({
214
+ key: toComputeIndicatorKeys[i],
215
+ dimension: null !== (_5 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _5 ? _5 : toComputeIndicatorKeys[i],
216
+ 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
217
+ })), 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));
206
218
  }
207
219
  return;
208
220
  }
209
221
  0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
210
222
  this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
211
223
  this.colFlatKeys[flatColKey] = 1)), this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
212
- (null === (_4 = this.tree[flatRowKey]) || void 0 === _4 ? void 0 : _4[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
224
+ (null === (_11 = this.tree[flatRowKey]) || void 0 === _11 ? void 0 : _11[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
213
225
  const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
214
226
  for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
215
- const calculatedFieldRule = null === (_5 = this.calculatedFieldRules) || void 0 === _5 ? void 0 : _5.find((rule => rule.key === toComputeIndicatorKeys[i]));
216
- (null === (_7 = null === (_6 = this.tree[flatRowKey]) || void 0 === _6 ? void 0 : _6[flatColKey]) || void 0 === _7 ? void 0 : _7[i]) || (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
227
+ const calculatedFieldRule = null === (_12 = this.calculatedFieldRules) || void 0 === _12 ? void 0 : _12.find((rule => rule.key === toComputeIndicatorKeys[i]));
228
+ (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[AggregationType.RECALCULATE]({
217
229
  key: toComputeIndicatorKeys[i],
218
230
  dimension: toComputeIndicatorKeys[i],
219
231
  isRecord: !0,
220
- formatFun: null === (_9 = null === (_8 = this.indicators) || void 0 === _8 ? void 0 : _8.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _9 ? void 0 : _9.format,
232
+ 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,
221
233
  calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
222
234
  dependAggregators: this.tree[flatRowKey][flatColKey],
223
235
  dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
224
- })), null === (_11 = null === (_10 = this.tree[flatRowKey]) || void 0 === _10 ? void 0 : _10[flatColKey]) || void 0 === _11 || _11[i].push(record);
236
+ })), null === (_18 = null === (_17 = this.tree[flatRowKey]) || void 0 === _17 ? void 0 : _17[flatColKey]) || void 0 === _18 || _18[i].push(record);
225
237
  } else {
226
238
  const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
227
239
  let needAddToAggregator = !1;
228
240
  if (assignedIndicatorKey) toComputeIndicatorKeys[i] === assignedIndicatorKey && (needAddToAggregator = !0); else if (null == aggRule ? void 0 : aggRule.field) if ("string" == typeof (null == aggRule ? void 0 : aggRule.field)) (null == aggRule ? void 0 : aggRule.field) in record && (needAddToAggregator = !0); else {
229
241
  (null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (needAddToAggregator = !0);
230
242
  } else toComputeIndicatorKeys[i] in record && (needAddToAggregator = !0);
231
- !(null === (_13 = null === (_12 = this.tree[flatRowKey]) || void 0 === _12 ? void 0 : _12[flatColKey]) || void 0 === _13 ? void 0 : _13[i]) && needAddToAggregator && (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_14 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _14 ? _14 : AggregationType.SUM]({
243
+ !(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 : AggregationType.SUM]({
232
244
  key: toComputeIndicatorKeys[i],
233
- dimension: null !== (_15 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _15 ? _15 : toComputeIndicatorKeys[i],
234
- formatFun: null !== (_16 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _16 ? _16 : null === (_18 = null === (_17 = this.indicators) || void 0 === _17 ? void 0 : _17.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _18 ? void 0 : _18.format
235
- })), needAddToAggregator && (null === (_20 = null === (_19 = this.tree[flatRowKey]) || void 0 === _19 ? void 0 : _19[flatColKey]) || void 0 === _20 || _20[i].push(record));
245
+ dimension: null !== (_22 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _22 ? _22 : toComputeIndicatorKeys[i],
246
+ 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
247
+ })), needAddToAggregator && (null === (_27 = null === (_26 = this.tree[flatRowKey]) || void 0 === _26 ? void 0 : _26[flatColKey]) || void 0 === _27 || _27[i].push(record));
236
248
  }
237
249
  if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
238
250
  if (!this.indicatorStatistics[i]) {
@@ -246,15 +258,15 @@ export class Dataset {
246
258
  key: this.indicatorKeys[i],
247
259
  dimension: this.indicatorKeys[i]
248
260
  }),
249
- total: new this.aggregators[null !== (_21 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _21 ? _21 : AggregationType.SUM]({
261
+ total: new this.aggregators[null !== (_28 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _28 ? _28 : AggregationType.SUM]({
250
262
  key: this.indicatorKeys[i],
251
- dimension: null !== (_22 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _22 ? _22 : this.indicatorKeys[i],
252
- formatFun: null !== (_23 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _23 ? _23 : null === (_25 = null === (_24 = this.indicators) || void 0 === _24 ? void 0 : _24.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _25 ? void 0 : _25.format
263
+ dimension: null !== (_29 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _29 ? _29 : this.indicatorKeys[i],
264
+ 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
253
265
  })
254
266
  };
255
267
  }
256
- this.indicatorStatistics[i].max.push(null === (_27 = null === (_26 = this.tree[flatRowKey]) || void 0 === _26 ? void 0 : _26[flatColKey]) || void 0 === _27 ? void 0 : _27[i].value()),
257
- this.indicatorStatistics[i].min.push(null === (_29 = null === (_28 = this.tree[flatRowKey]) || void 0 === _28 ? void 0 : _28[flatColKey]) || void 0 === _29 ? void 0 : _29[i].value()),
268
+ 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()),
269
+ 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()),
258
270
  this.indicatorStatistics[i].total.push(record);
259
271
  }
260
272
  }
@@ -404,76 +416,76 @@ export class Dataset {
404
416
  const that = this;
405
417
  if ((null === (_b = null === (_a = null == that ? void 0 : that.totals) || void 0 === _a ? void 0 : _a.column) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = null == that ? void 0 : that.totals) || void 0 === _c ? void 0 : _c.column) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 || (null === (_g = null === (_f = null == that ? void 0 : that.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.subTotalsDimensions) && (null === (_k = null === (_j = null === (_h = null == that ? void 0 : that.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.subTotalsDimensions) || void 0 === _k ? void 0 : _k.length) >= 1 || (null === (_m = null === (_l = null == that ? void 0 : that.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || (null === (_p = null === (_o = null == that ? void 0 : that.totals) || void 0 === _o ? void 0 : _o.row) || void 0 === _p ? void 0 : _p.showGrandTotals)) {
406
418
  const rowTotalKeys = [], colCompute = (flatRowKey, flatColKey) => {
407
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
419
+ 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;
408
420
  if (null === (_b = null === (_a = this.totalRecordsTree) || void 0 === _a ? void 0 : _a[flatRowKey]) || void 0 === _b ? void 0 : _b[flatColKey]) return void (this.tree[flatRowKey][flatColKey] = null === (_d = null === (_c = this.totalRecordsTree) || void 0 === _c ? void 0 : _c[flatRowKey]) || void 0 === _d ? void 0 : _d[flatColKey]);
409
421
  const colKey = flatColKey.split(this.stringJoinChar);
410
- 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++) {
422
+ 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++) {
411
423
  const dimension = that.totals.column.subTotalsDimensions[i], dimensionIndex = that.columns.indexOf(dimension);
412
424
  if (dimensionIndex >= 0) {
413
425
  const colTotalKey = colKey.slice(0, dimensionIndex + 1);
414
426
  colTotalKey.push(that.colSubTotalLabel);
415
427
  const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
416
- 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]);
428
+ 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]);
417
429
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
418
430
  const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
419
431
  for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
420
- const calculatedFieldRule = null === (_p = this.calculatedFieldRules) || void 0 === _p ? void 0 : _p.find((rule => rule.key === toComputeIndicatorKeys[i]));
421
- (null === (_r = null === (_q = this.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColTotalKey]) || void 0 === _r ? void 0 : _r[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
432
+ const calculatedFieldRule = null === (_s = this.calculatedFieldRules) || void 0 === _s ? void 0 : _s.find((rule => rule.key === toComputeIndicatorKeys[i]));
433
+ (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[AggregationType.RECALCULATE]({
422
434
  key: toComputeIndicatorKeys[i],
423
435
  dimension: toComputeIndicatorKeys[i],
424
436
  isRecord: !0,
425
- formatFun: null === (_t = null === (_s = this.indicators) || void 0 === _s ? void 0 : _s.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _t ? void 0 : _t.format,
437
+ 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,
426
438
  calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
427
439
  dependAggregators: this.tree[flatRowKey][flatColTotalKey],
428
440
  dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
429
- })), this.tree[flatRowKey][flatColTotalKey][i].push(null === (_v = null === (_u = that.tree[flatRowKey]) || void 0 === _u ? void 0 : _u[flatColKey]) || void 0 === _v ? void 0 : _v[i]);
441
+ })), 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]);
430
442
  } else {
431
443
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
432
444
  const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
433
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_w = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _w ? _w : AggregationType.SUM]({
445
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_z = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _z ? _z : AggregationType.SUM]({
434
446
  key: toComputeIndicatorKeys[i],
435
- dimension: null !== (_x = null == aggRule ? void 0 : aggRule.field) && void 0 !== _x ? _x : toComputeIndicatorKeys[i],
436
- formatFun: null !== (_y = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _y ? _y : null === (_0 = null === (_z = this.indicators) || void 0 === _z ? void 0 : _z.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _0 ? void 0 : _0.format
447
+ dimension: null !== (_0 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _0 ? _0 : toComputeIndicatorKeys[i],
448
+ 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
437
449
  });
438
450
  }
439
- this.tree[flatRowKey][flatColTotalKey][i].push(null === (_2 = null === (_1 = that.tree[flatRowKey]) || void 0 === _1 ? void 0 : _1[flatColKey]) || void 0 === _2 ? void 0 : _2[i]);
451
+ 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]);
440
452
  }
441
453
  }
442
454
  }
443
- if ((null === (_4 = null === (_3 = that.totals) || void 0 === _3 ? void 0 : _3.column) || void 0 === _4 ? void 0 : _4.showGrandTotals) || 0 === this.rows.length) {
455
+ 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) {
444
456
  const flatColTotalKey = that.colGrandTotalLabel;
445
- if (null === (_6 = null === (_5 = this.totalRecordsTree) || void 0 === _5 ? void 0 : _5[flatRowKey]) || void 0 === _6 ? void 0 : _6[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_8 = null === (_7 = this.totalRecordsTree) || void 0 === _7 ? void 0 : _7[flatRowKey]) || void 0 === _8 ? void 0 : _8[flatColTotalKey]);
457
+ 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]);
446
458
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
447
459
  const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
448
460
  for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
449
- const calculatedFieldRule = null === (_9 = this.calculatedFieldRules) || void 0 === _9 ? void 0 : _9.find((rule => rule.key === toComputeIndicatorKeys[i]));
450
- (null === (_11 = null === (_10 = this.tree[flatRowKey]) || void 0 === _10 ? void 0 : _10[flatColTotalKey]) || void 0 === _11 ? void 0 : _11[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
461
+ const calculatedFieldRule = null === (_12 = this.calculatedFieldRules) || void 0 === _12 ? void 0 : _12.find((rule => rule.key === toComputeIndicatorKeys[i]));
462
+ (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[AggregationType.RECALCULATE]({
451
463
  key: toComputeIndicatorKeys[i],
452
464
  dimension: toComputeIndicatorKeys[i],
453
465
  isRecord: !0,
454
- formatFun: null === (_13 = null === (_12 = this.indicators) || void 0 === _12 ? void 0 : _12.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _13 ? void 0 : _13.format,
466
+ 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,
455
467
  calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
456
468
  dependAggregators: this.tree[flatRowKey][flatColTotalKey],
457
469
  dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
458
- })), this.tree[flatRowKey][flatColTotalKey][i].push(null === (_15 = null === (_14 = that.tree[flatRowKey]) || void 0 === _14 ? void 0 : _14[flatColKey]) || void 0 === _15 ? void 0 : _15[i]);
470
+ })), 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]);
459
471
  } else {
460
472
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
461
473
  const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
462
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_16 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _16 ? _16 : AggregationType.SUM]({
474
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_19 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _19 ? _19 : AggregationType.SUM]({
463
475
  key: toComputeIndicatorKeys[i],
464
- dimension: null !== (_17 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _17 ? _17 : toComputeIndicatorKeys[i],
465
- formatFun: null !== (_18 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _18 ? _18 : null === (_20 = null === (_19 = this.indicators) || void 0 === _19 ? void 0 : _19.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _20 ? void 0 : _20.format
476
+ dimension: null !== (_20 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _20 ? _20 : toComputeIndicatorKeys[i],
477
+ 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
466
478
  });
467
479
  }
468
- this.tree[flatRowKey][flatColTotalKey][i].push(null === (_22 = null === (_21 = that.tree[flatRowKey]) || void 0 === _21 ? void 0 : _21[flatColKey]) || void 0 === _22 ? void 0 : _22[i]);
480
+ 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]);
469
481
  }
470
482
  }
471
483
  };
472
484
  Object.keys(that.tree).forEach((flatRowKey => {
473
485
  const rowKey = flatRowKey.split(this.stringJoinChar);
474
486
  Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
475
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
476
- 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++) {
487
+ 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;
488
+ 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++) {
477
489
  const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
478
490
  if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
479
491
  const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
@@ -484,54 +496,54 @@ export class Dataset {
484
496
  const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
485
497
  for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
486
498
  if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
487
- const calculatedFieldRule = null === (_f = this.calculatedFieldRules) || void 0 === _f ? void 0 : _f.find((rule => rule.key === toComputeIndicatorKeys[i]));
499
+ const calculatedFieldRule = null === (_j = this.calculatedFieldRules) || void 0 === _j ? void 0 : _j.find((rule => rule.key === toComputeIndicatorKeys[i]));
488
500
  this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
489
501
  key: toComputeIndicatorKeys[i],
490
502
  dimension: toComputeIndicatorKeys[i],
491
503
  isRecord: !0,
492
- formatFun: null === (_h = null === (_g = this.indicators) || void 0 === _g ? void 0 : _g.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _h ? void 0 : _h.format,
504
+ 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,
493
505
  calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
494
506
  dependAggregators: this.tree[flatRowTotalKey][flatColKey],
495
507
  dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
496
508
  });
497
509
  } else {
498
510
  const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
499
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_j = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _j ? _j : AggregationType.SUM]({
511
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_m = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _m ? _m : AggregationType.SUM]({
500
512
  key: toComputeIndicatorKeys[i],
501
- dimension: null !== (_k = null == aggRule ? void 0 : aggRule.field) && void 0 !== _k ? _k : toComputeIndicatorKeys[i],
502
- formatFun: null !== (_l = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _l ? _l : null === (_o = null === (_m = this.indicators) || void 0 === _m ? void 0 : _m.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _o ? void 0 : _o.format
513
+ dimension: null !== (_o = null == aggRule ? void 0 : aggRule.field) && void 0 !== _o ? _o : toComputeIndicatorKeys[i],
514
+ 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
503
515
  });
504
516
  }
505
- this.tree[flatRowTotalKey][flatColKey][i].push(null === (_q = null === (_p = that.tree[flatRowKey]) || void 0 === _p ? void 0 : _p[flatColKey]) || void 0 === _q ? void 0 : _q[i]);
517
+ 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]);
506
518
  }
507
519
  }
508
520
  }
509
- if ((null === (_s = null === (_r = that.totals) || void 0 === _r ? void 0 : _r.row) || void 0 === _s ? void 0 : _s.showGrandTotals) || 0 === this.columns.length) {
521
+ 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) {
510
522
  const flatRowTotalKey = that.rowGrandTotalLabel;
511
523
  this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
512
524
  this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
513
525
  const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
514
526
  for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
515
527
  if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
516
- const calculatedFieldRule = null === (_t = this.calculatedFieldRules) || void 0 === _t ? void 0 : _t.find((rule => rule.key === toComputeIndicatorKeys[i]));
528
+ const calculatedFieldRule = null === (_w = this.calculatedFieldRules) || void 0 === _w ? void 0 : _w.find((rule => rule.key === toComputeIndicatorKeys[i]));
517
529
  this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[AggregationType.RECALCULATE]({
518
530
  key: toComputeIndicatorKeys[i],
519
531
  dimension: toComputeIndicatorKeys[i],
520
532
  isRecord: !0,
521
- formatFun: null === (_v = null === (_u = this.indicators) || void 0 === _u ? void 0 : _u.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _v ? void 0 : _v.format,
533
+ 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,
522
534
  calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
523
535
  dependAggregators: this.tree[flatRowTotalKey][flatColKey],
524
536
  dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
525
537
  });
526
538
  } else {
527
539
  const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
528
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_w = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _w ? _w : AggregationType.SUM]({
540
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_z = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _z ? _z : AggregationType.SUM]({
529
541
  key: toComputeIndicatorKeys[i],
530
- dimension: null !== (_x = null == aggRule ? void 0 : aggRule.field) && void 0 !== _x ? _x : toComputeIndicatorKeys[i],
531
- formatFun: null !== (_y = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _y ? _y : null === (_0 = null === (_z = this.indicators) || void 0 === _z ? void 0 : _z.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _0 ? void 0 : _0.format
542
+ dimension: null !== (_0 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _0 ? _0 : toComputeIndicatorKeys[i],
543
+ 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
532
544
  });
533
545
  }
534
- this.tree[flatRowTotalKey][flatColKey][i].push(null === (_2 = null === (_1 = that.tree[flatRowKey]) || void 0 === _1 ? void 0 : _1[flatColKey]) || void 0 === _2 ? void 0 : _2[i]);
546
+ 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]);
535
547
  }
536
548
  }
537
549
  colCompute(flatRowKey, flatColKey);