@visactor/vtable 1.22.11-alpha.9 → 1.22.11
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.
- package/cjs/ListTable.d.ts +7 -34
- package/cjs/ListTable.js +18 -138
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotTable-all.js.map +1 -1
- package/cjs/components/index.js +1 -1
- package/cjs/core/BaseTable.d.ts +3 -0
- package/cjs/core/BaseTable.js +22 -6
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +0 -1
- package/cjs/core/TABLE_EVENT_TYPE.js +0 -1
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/core/record-helper.d.ts +2 -4
- package/cjs/core/record-helper.js +47 -120
- package/cjs/core/record-helper.js.map +1 -1
- package/cjs/data/DataSource.d.ts +4 -13
- package/cjs/data/DataSource.js +60 -174
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.js +92 -84
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/edit/edit-manager.js +10 -9
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/event.d.ts +1 -2
- package/cjs/event/event.js +9 -20
- package/cjs/event/event.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/pivot-header-layout.js +1 -1
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/plugins/custom-cell-style.d.ts +5 -5
- package/cjs/plugins/custom-cell-style.js +64 -25
- package/cjs/plugins/custom-cell-style.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +16 -1
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/select/update-select-border.js.map +1 -1
- package/cjs/state/select/update-position.js +3 -3
- package/cjs/state/select/update-position.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +5 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/events.d.ts +0 -15
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/new-data-set.d.ts +1 -0
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +6 -33
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +332 -735
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.d.ts +7 -34
- package/es/ListTable.js +18 -134
- package/es/ListTable.js.map +1 -1
- package/es/PivotTable-all.js.map +1 -1
- package/es/components/index.js +1 -1
- package/es/core/BaseTable.d.ts +3 -0
- package/es/core/BaseTable.js +22 -6
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +0 -1
- package/es/core/TABLE_EVENT_TYPE.js +0 -1
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/core/record-helper.d.ts +2 -4
- package/es/core/record-helper.js +43 -114
- package/es/core/record-helper.js.map +1 -1
- package/es/data/DataSource.d.ts +4 -13
- package/es/data/DataSource.js +60 -174
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.js +92 -84
- package/es/dataset/dataset.js.map +1 -1
- package/es/edit/edit-manager.js +10 -9
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/event.d.ts +1 -2
- package/es/event/event.js +9 -20
- package/es/event/event.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/pivot-header-layout.js +1 -1
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/plugins/custom-cell-style.d.ts +5 -5
- package/es/plugins/custom-cell-style.js +62 -25
- package/es/plugins/custom-cell-style.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +16 -1
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/select/update-select-border.js.map +1 -1
- package/es/state/select/update-position.js +4 -2
- package/es/state/select/update-position.js.map +1 -1
- package/es/ts-types/base-table.d.ts +5 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/events.d.ts +0 -15
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/new-data-set.d.ts +1 -0
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +6 -33
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +3 -3
- package/cjs/core/index.d.ts +0 -1
- package/cjs/core/index.js +0 -30
- package/cjs/core/index.js.map +0 -1
- package/es/core/index.d.ts +0 -1
- package/es/core/index.js +0 -2
- package/es/core/index.js.map +0 -1
package/cjs/dataset/dataset.js
CHANGED
|
@@ -360,7 +360,7 @@ class Dataset {
|
|
|
360
360
|
return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
|
|
361
361
|
}
|
|
362
362
|
getAggregator(rowKey = [], colKey = [], indicator, considerChangedValue = !0, indicatorPosition) {
|
|
363
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
363
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
364
364
|
const indicatorIndex = this.indicatorKeys.indexOf(indicator);
|
|
365
365
|
let rowDimensionKey, colDimensionKey, flatRowKey, flatColKey;
|
|
366
366
|
if ("row" === (null == indicatorPosition ? void 0 : indicatorPosition.position)) rowDimensionKey = rowKey.length >= 2 ? this.rows[rowKey.length - 2] : void 0; else {
|
|
@@ -373,13 +373,13 @@ class Dataset {
|
|
|
373
373
|
}
|
|
374
374
|
"string" == typeof rowKey ? flatRowKey = rowKey : (indicatorPosition && "row" !== indicatorPosition.position || rowKey.map(((key, i) => {
|
|
375
375
|
key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || rowKey.splice(i, 1);
|
|
376
|
-
})), rowKey.length < this.rows.length && "grid-tree" === this.rowHierarchyType && (rowKey[0] === this.rowGrandTotalLabel || (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 &&
|
|
376
|
+
})), rowKey.length < this.rows.length && "grid-tree" === this.rowHierarchyType && (rowKey[0] === this.rowGrandTotalLabel || ((null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 && this.totals.row.subTotalsDimensions.find((dimension => dimension === rowDimensionKey)) || (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showSubTotalsOnTreeNode)) && rowKey[rowKey.length - 1] !== this.rowSubTotalLabel && rowKey.push(this.rowSubTotalLabel)),
|
|
377
377
|
flatRowKey = (0, join_1.join)(rowKey, this.stringJoinChar)), "string" == typeof colKey ? flatColKey = colKey : (indicatorPosition && "col" !== indicatorPosition.position || colKey.map(((key, i) => {
|
|
378
378
|
key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || colKey.splice(i, 1);
|
|
379
|
-
})), colKey.length < this.columns.length && "grid-tree" === this.columnHierarchyType && (colKey[0] === this.colGrandTotalLabel || (null === (
|
|
379
|
+
})), colKey.length < this.columns.length && "grid-tree" === this.columnHierarchyType && (colKey[0] === this.colGrandTotalLabel || ((null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.column) || void 0 === _j ? void 0 : _j.subTotalsDimensions) && (null === (_m = null === (_l = null === (_k = this.totals) || void 0 === _k ? void 0 : _k.column) || void 0 === _l ? void 0 : _l.subTotalsDimensions) || void 0 === _m ? void 0 : _m.length) >= 1 && this.totals.column.subTotalsDimensions.find((dimension => dimension === colDimensionKey)) || (null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showSubTotalsOnTreeNode)) && colKey[colKey.length - 1] !== this.colSubTotalLabel && colKey.push(this.colSubTotalLabel)),
|
|
380
380
|
flatColKey = (0, join_1.join)(colKey, this.stringJoinChar));
|
|
381
|
-
const agg = null === (
|
|
382
|
-
if (considerChangedValue && (0, vutils_1.isValid)(null === (
|
|
381
|
+
const agg = null === (_r = null === (_q = this.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[indicatorIndex];
|
|
382
|
+
if (considerChangedValue && (0, vutils_1.isValid)(null === (_t = null === (_s = this.changedTree[flatRowKey]) || void 0 === _s ? void 0 : _s[flatColKey]) || void 0 === _t ? void 0 : _t[indicatorIndex])) {
|
|
383
383
|
const changeValue = this.changedTree[flatRowKey][flatColKey][indicatorIndex];
|
|
384
384
|
return agg ? {
|
|
385
385
|
value: () => changeValue,
|
|
@@ -470,140 +470,148 @@ class Dataset {
|
|
|
470
470
|
} : sortRule.sortBy ? (0, aggregation_1.sortBy)(sortRule.sortBy) : sortRule.sortFunc ? sortRule.sortFunc : sortRule.sortType ? aggregation_1.typeSort : aggregation_1.naturalSort;
|
|
471
471
|
}
|
|
472
472
|
totalStatistics() {
|
|
473
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
473
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
474
474
|
const that = this, colCompute = (flatRowKey, 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, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
|
|
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, _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;
|
|
476
476
|
if (null === (_b = null === (_a = this.totalRecordsTree) || void 0 === _a ? void 0 : _a[flatRowKey]) || void 0 === _b ? void 0 : _b[flatColKey]) return this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
|
|
477
477
|
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]);
|
|
478
478
|
const colKey = flatColKey.split(this.stringJoinChar);
|
|
479
|
-
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
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
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,
|
|
495
|
-
calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
|
|
496
|
-
dependAggregators: this.tree[flatRowKey][flatColTotalKey],
|
|
497
|
-
dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
|
|
498
|
-
})), flatColTotalKey !== flatColKey && 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]);
|
|
499
|
-
} else {
|
|
500
|
-
if (!this.tree[flatRowKey][flatColTotalKey][i]) {
|
|
501
|
-
const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
|
|
502
|
-
this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[null !== (_z = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _z ? _z : ts_types_1.AggregationType.SUM]({
|
|
479
|
+
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 !== (null === (_l = null === (_k = that.totals) || void 0 === _k ? void 0 : _k.column) || void 0 === _l ? void 0 : _l.showSubTotals) || (null === (_o = null === (_m = that.totals) || void 0 === _m ? void 0 : _m.column) || void 0 === _o ? void 0 : _o.showSubTotalsOnTreeNode)) || (null === (_q = null === (_p = that.totals) || void 0 === _p ? void 0 : _p.column) || void 0 === _q ? void 0 : _q.showSubTotalsOnTreeNode) && that.columns.length > 0) {
|
|
480
|
+
let colSubTotalDimensions = (null === (_s = null === (_r = that.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.subTotalsDimensions) || [];
|
|
481
|
+
(null === (_u = null === (_t = that.totals) || void 0 === _t ? void 0 : _t.column) || void 0 === _u ? void 0 : _u.showSubTotalsOnTreeNode) && 0 === colSubTotalDimensions.length && (colSubTotalDimensions = that.columns.map((col => col)));
|
|
482
|
+
for (let i = 0, len = colSubTotalDimensions.length; i < len; i++) {
|
|
483
|
+
const dimension = colSubTotalDimensions[i], dimensionIndex = that.columns.indexOf(dimension);
|
|
484
|
+
if (dimensionIndex >= 0) {
|
|
485
|
+
const colTotalKey = colKey.slice(0, dimensionIndex + 1);
|
|
486
|
+
colTotalKey.push(that.colSubTotalLabel);
|
|
487
|
+
const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
|
|
488
|
+
if (null === (_w = null === (_v = this.totalRecordsTree) || void 0 === _v ? void 0 : _v[flatRowKey]) || void 0 === _w ? void 0 : _w[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_y = null === (_x = this.totalRecordsTree) || void 0 === _x ? void 0 : _x[flatRowKey]) || void 0 === _y ? void 0 : _y[flatColTotalKey]);
|
|
489
|
+
this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
|
|
490
|
+
const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
|
|
491
|
+
for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
|
|
492
|
+
const calculatedFieldRule = null === (_z = this.calculatedFieldRules) || void 0 === _z ? void 0 : _z.find((rule => rule.key === toComputeIndicatorKeys[i]));
|
|
493
|
+
(null === (_1 = null === (_0 = this.tree[flatRowKey]) || void 0 === _0 ? void 0 : _0[flatColTotalKey]) || void 0 === _1 ? void 0 : _1[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
|
|
503
494
|
key: toComputeIndicatorKeys[i],
|
|
504
|
-
field:
|
|
505
|
-
|
|
506
|
-
formatFun: null
|
|
507
|
-
|
|
495
|
+
field: toComputeIndicatorKeys[i],
|
|
496
|
+
isRecord: !0,
|
|
497
|
+
formatFun: 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,
|
|
498
|
+
calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
|
|
499
|
+
dependAggregators: this.tree[flatRowKey][flatColTotalKey],
|
|
500
|
+
dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
|
|
501
|
+
})), flatColTotalKey !== flatColKey && 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]);
|
|
502
|
+
} else {
|
|
503
|
+
if (!this.tree[flatRowKey][flatColTotalKey][i]) {
|
|
504
|
+
const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
|
|
505
|
+
this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[null !== (_6 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _6 ? _6 : ts_types_1.AggregationType.SUM]({
|
|
506
|
+
key: toComputeIndicatorKeys[i],
|
|
507
|
+
field: null !== (_7 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _7 ? _7 : toComputeIndicatorKeys[i],
|
|
508
|
+
aggregationFun: null == aggRule ? void 0 : aggRule.aggregationFun,
|
|
509
|
+
formatFun: null !== (_8 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _8 ? _8 : null === (_10 = null === (_9 = this.indicators) || void 0 === _9 ? void 0 : _9.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _10 ? void 0 : _10.format
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
flatColTotalKey !== flatColKey && this.tree[flatRowKey][flatColTotalKey][i].push(null === (_12 = null === (_11 = that.tree[flatRowKey]) || void 0 === _11 ? void 0 : _11[flatColKey]) || void 0 === _12 ? void 0 : _12[i]);
|
|
508
513
|
}
|
|
509
|
-
flatColTotalKey !== flatColKey && 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]);
|
|
510
514
|
}
|
|
511
515
|
}
|
|
512
516
|
}
|
|
513
|
-
if ((null === (
|
|
517
|
+
if ((null === (_14 = null === (_13 = that.totals) || void 0 === _13 ? void 0 : _13.column) || void 0 === _14 ? void 0 : _14.showGrandTotals) || 0 === this.rows.length) {
|
|
514
518
|
const flatColTotalKey = that.colGrandTotalLabel;
|
|
515
|
-
if (null === (
|
|
519
|
+
if (null === (_16 = null === (_15 = this.totalRecordsTree) || void 0 === _15 ? void 0 : _15[flatRowKey]) || void 0 === _16 ? void 0 : _16[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_18 = null === (_17 = this.totalRecordsTree) || void 0 === _17 ? void 0 : _17[flatRowKey]) || void 0 === _18 ? void 0 : _18[flatColTotalKey]);
|
|
516
520
|
this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
|
|
517
521
|
const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
|
|
518
522
|
for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
|
|
519
|
-
const calculatedFieldRule = null === (
|
|
520
|
-
(null === (
|
|
523
|
+
const calculatedFieldRule = null === (_19 = this.calculatedFieldRules) || void 0 === _19 ? void 0 : _19.find((rule => rule.key === toComputeIndicatorKeys[i]));
|
|
524
|
+
(null === (_21 = null === (_20 = this.tree[flatRowKey]) || void 0 === _20 ? void 0 : _20[flatColTotalKey]) || void 0 === _21 ? void 0 : _21[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
|
|
521
525
|
key: toComputeIndicatorKeys[i],
|
|
522
526
|
field: toComputeIndicatorKeys[i],
|
|
523
527
|
isRecord: !0,
|
|
524
|
-
formatFun: null === (
|
|
528
|
+
formatFun: 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,
|
|
525
529
|
calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
|
|
526
530
|
dependAggregators: this.tree[flatRowKey][flatColTotalKey],
|
|
527
531
|
dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
|
|
528
|
-
})), flatColTotalKey !== flatColKey && this.tree[flatRowKey][flatColTotalKey][i].push(null === (
|
|
532
|
+
})), flatColTotalKey !== flatColKey && 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]);
|
|
529
533
|
} else {
|
|
530
534
|
if (!this.tree[flatRowKey][flatColTotalKey][i]) {
|
|
531
535
|
const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
|
|
532
|
-
this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[null !== (
|
|
536
|
+
this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[null !== (_26 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _26 ? _26 : ts_types_1.AggregationType.SUM]({
|
|
533
537
|
key: toComputeIndicatorKeys[i],
|
|
534
|
-
field: null !== (
|
|
535
|
-
formatFun: null !== (
|
|
538
|
+
field: null !== (_27 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _27 ? _27 : toComputeIndicatorKeys[i],
|
|
539
|
+
formatFun: null !== (_28 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _28 ? _28 : null === (_30 = null === (_29 = this.indicators) || void 0 === _29 ? void 0 : _29.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _30 ? void 0 : _30.format
|
|
536
540
|
});
|
|
537
541
|
}
|
|
538
|
-
flatColTotalKey !== flatColKey && this.tree[flatRowKey][flatColTotalKey][i].push(null === (
|
|
542
|
+
flatColTotalKey !== flatColKey && this.tree[flatRowKey][flatColTotalKey][i].push(null === (_32 = null === (_31 = that.tree[flatRowKey]) || void 0 === _31 ? void 0 : _31[flatColKey]) || void 0 === _32 ? void 0 : _32[i]);
|
|
539
543
|
}
|
|
540
544
|
}
|
|
541
545
|
};
|
|
542
|
-
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)) {
|
|
546
|
+
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) || (null === (_r = null === (_q = null == that ? void 0 : that.totals) || void 0 === _q ? void 0 : _q.row) || void 0 === _r ? void 0 : _r.showSubTotalsOnTreeNode) || (null === (_t = null === (_s = null == that ? void 0 : that.totals) || void 0 === _s ? void 0 : _s.column) || void 0 === _t ? void 0 : _t.showSubTotalsOnTreeNode)) {
|
|
543
547
|
const rowTotalKeys = [];
|
|
544
548
|
Object.keys(that.tree).forEach((flatRowKey => {
|
|
545
549
|
const rowKey = flatRowKey.split(this.stringJoinChar);
|
|
546
550
|
Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
|
|
547
|
-
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;
|
|
548
|
-
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
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
551
|
+
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;
|
|
552
|
+
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 !== (null === (_g = null === (_f = that.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showSubTotals) || (null === (_j = null === (_h = that.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTreeNode)) || (null === (_l = null === (_k = that.totals) || void 0 === _k ? void 0 : _k.row) || void 0 === _l ? void 0 : _l.showSubTotalsOnTreeNode) && that.rows.length > 0) {
|
|
553
|
+
let rowSubTotalDimensions = (null === (_o = null === (_m = that.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.subTotalsDimensions) || [];
|
|
554
|
+
(null === (_q = null === (_p = that.totals) || void 0 === _p ? void 0 : _p.row) || void 0 === _q ? void 0 : _q.showSubTotalsOnTreeNode) && 0 === rowSubTotalDimensions.length && (rowSubTotalDimensions = that.rows.map((row => row)));
|
|
555
|
+
for (let i = 0, len = rowSubTotalDimensions.length; i < len; i++) {
|
|
556
|
+
const dimension = rowSubTotalDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
|
|
557
|
+
if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
|
|
558
|
+
const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
|
|
559
|
+
"tree" !== this.rowHierarchyType && rowTotalKey.push(that.rowSubTotalLabel);
|
|
560
|
+
const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
|
|
561
|
+
this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
|
|
562
|
+
this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
|
|
563
|
+
const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
|
|
564
|
+
for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
|
|
565
|
+
if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
|
|
566
|
+
const calculatedFieldRule = null === (_r = this.calculatedFieldRules) || void 0 === _r ? void 0 : _r.find((rule => rule.key === toComputeIndicatorKeys[i]));
|
|
567
|
+
this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
|
|
568
|
+
key: toComputeIndicatorKeys[i],
|
|
569
|
+
field: toComputeIndicatorKeys[i],
|
|
570
|
+
isRecord: !0,
|
|
571
|
+
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,
|
|
572
|
+
calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
|
|
573
|
+
dependAggregators: this.tree[flatRowTotalKey][flatColKey],
|
|
574
|
+
dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
|
|
575
|
+
});
|
|
576
|
+
} else {
|
|
577
|
+
const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
|
|
578
|
+
this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (_u = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _u ? _u : ts_types_1.AggregationType.SUM]({
|
|
579
|
+
key: toComputeIndicatorKeys[i],
|
|
580
|
+
field: null !== (_v = null == aggRule ? void 0 : aggRule.field) && void 0 !== _v ? _v : toComputeIndicatorKeys[i],
|
|
581
|
+
formatFun: null !== (_w = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _w ? _w : 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
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
flatRowTotalKey !== flatRowKey && this.tree[flatRowTotalKey][flatColKey][i].push(null === (_0 = null === (_z = that.tree[flatRowKey]) || void 0 === _z ? void 0 : _z[flatColKey]) || void 0 === _0 ? void 0 : _0[i]);
|
|
576
585
|
}
|
|
577
|
-
flatRowTotalKey !== flatRowKey && 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]);
|
|
578
586
|
}
|
|
579
587
|
}
|
|
580
588
|
}
|
|
581
|
-
if ((null === (
|
|
589
|
+
if ((null === (_2 = null === (_1 = that.totals) || void 0 === _1 ? void 0 : _1.row) || void 0 === _2 ? void 0 : _2.showGrandTotals) || 0 === this.columns.length) {
|
|
582
590
|
const flatRowTotalKey = that.rowGrandTotalLabel;
|
|
583
591
|
this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
|
|
584
592
|
this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
|
|
585
593
|
const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
|
|
586
594
|
for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
|
|
587
595
|
if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
|
|
588
|
-
const calculatedFieldRule = null === (
|
|
596
|
+
const calculatedFieldRule = null === (_3 = this.calculatedFieldRules) || void 0 === _3 ? void 0 : _3.find((rule => rule.key === toComputeIndicatorKeys[i]));
|
|
589
597
|
this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
|
|
590
598
|
key: toComputeIndicatorKeys[i],
|
|
591
599
|
field: toComputeIndicatorKeys[i],
|
|
592
600
|
isRecord: !0,
|
|
593
|
-
formatFun: null === (
|
|
601
|
+
formatFun: null === (_5 = null === (_4 = this.indicators) || void 0 === _4 ? void 0 : _4.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _5 ? void 0 : _5.format,
|
|
594
602
|
calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
|
|
595
603
|
dependAggregators: this.tree[flatRowTotalKey][flatColKey],
|
|
596
604
|
dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
|
|
597
605
|
});
|
|
598
606
|
} else {
|
|
599
607
|
const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
|
|
600
|
-
this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (
|
|
608
|
+
this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (_6 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _6 ? _6 : ts_types_1.AggregationType.SUM]({
|
|
601
609
|
key: toComputeIndicatorKeys[i],
|
|
602
|
-
field: null !== (
|
|
603
|
-
formatFun: null !== (
|
|
610
|
+
field: null !== (_7 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _7 ? _7 : toComputeIndicatorKeys[i],
|
|
611
|
+
formatFun: null !== (_8 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _8 ? _8 : null === (_10 = null === (_9 = this.indicators) || void 0 === _9 ? void 0 : _9.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _10 ? void 0 : _10.format
|
|
604
612
|
});
|
|
605
613
|
}
|
|
606
|
-
flatRowTotalKey !== flatRowKey && this.tree[flatRowTotalKey][flatColKey][i].push(null === (
|
|
614
|
+
flatRowTotalKey !== flatRowKey && this.tree[flatRowTotalKey][flatColKey][i].push(null === (_12 = null === (_11 = that.tree[flatRowKey]) || void 0 === _11 ? void 0 : _11[flatColKey]) || void 0 === _12 ? void 0 : _12[i]);
|
|
607
615
|
}
|
|
608
616
|
}
|
|
609
617
|
colCompute(flatRowKey, flatColKey);
|