@visactor/vtable 0.19.0 → 0.19.1
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.js +4 -4
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -1
- package/cjs/PivotChart.js +2 -1
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.js +2 -2
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/axis/axis.js +12 -7
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +0 -1
- package/cjs/core/BaseTable.js +12 -12
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.js +43 -42
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/edit/edit-manager.js +8 -8
- package/cjs/edit/edit-manager.js.map +1 -1
- package/cjs/event/listener/container-dom.js +2 -2
- package/cjs/event/listener/container-dom.js.map +1 -1
- package/cjs/header-helper/header-helper.js +2 -2
- package/cjs/header-helper/header-helper.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/chart-helper/get-axis-config.d.ts +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +3 -1
- package/cjs/layout/pivot-header-layout.js +55 -38
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/row-height-map.d.ts +1 -0
- package/cjs/layout/row-height-map.js +3 -0
- package/cjs/layout/row-height-map.js.map +1 -1
- package/cjs/scenegraph/component/custom.js +7 -7
- package/cjs/scenegraph/component/custom.js.map +1 -1
- package/cjs/scenegraph/graphic/group.d.ts +1 -0
- package/cjs/scenegraph/graphic/group.js +10 -0
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +6 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +4 -3
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js +3 -2
- package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js +3 -2
- package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +3 -2
- package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +6 -5
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js +3 -2
- package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +7 -3
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/icon/icon-update.js +6 -2
- package/cjs/scenegraph/icon/icon-update.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +7 -9
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-height.js +4 -2
- package/cjs/scenegraph/layout/update-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +4 -2
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +2 -1
- package/cjs/scenegraph/stick-text/index.js +13 -5
- package/cjs/scenegraph/stick-text/index.js.map +1 -1
- package/cjs/scenegraph/utils/text-icon-layout.js +3 -2
- package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/cjs/state/hover/is-cell-hover.js +8 -4
- package/cjs/state/hover/is-cell-hover.js.map +1 -1
- package/cjs/state/hover/update-cell.js +8 -4
- package/cjs/state/hover/update-cell.js.map +1 -1
- package/cjs/state/state.js +1 -2
- package/cjs/themes/component.d.ts +5 -5
- package/cjs/tools/merge-range.d.ts +8 -0
- package/cjs/tools/merge-range.js +19 -0
- package/cjs/tools/merge-range.js.map +1 -0
- package/cjs/ts-types/component/axis.d.ts +2 -15
- package/cjs/ts-types/component/axis.js.map +1 -1
- package/cjs/ts-types/customElement.d.ts +1 -0
- package/cjs/ts-types/customElement.js.map +1 -1
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +265 -138
- package/dist/vtable.min.js +2 -2
- package/es/ListTable.js +4 -4
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -1
- package/es/PivotChart.js +2 -1
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.js +2 -2
- package/es/PivotTable.js.map +1 -1
- package/es/components/axis/axis.js +12 -7
- package/es/components/axis/axis.js.map +1 -1
- package/es/core/BaseTable.d.ts +0 -1
- package/es/core/BaseTable.js +12 -12
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.js +43 -42
- package/es/dataset/dataset.js.map +1 -1
- package/es/edit/edit-manager.js +8 -8
- package/es/edit/edit-manager.js.map +1 -1
- package/es/event/listener/container-dom.js +2 -2
- package/es/event/listener/container-dom.js.map +1 -1
- package/es/header-helper/header-helper.js +3 -1
- package/es/header-helper/header-helper.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/chart-helper/get-axis-config.d.ts +1 -1
- package/es/layout/pivot-header-layout.d.ts +3 -1
- package/es/layout/pivot-header-layout.js +54 -38
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/row-height-map.d.ts +1 -0
- package/es/layout/row-height-map.js +3 -0
- package/es/layout/row-height-map.js.map +1 -1
- package/es/scenegraph/component/custom.js +7 -7
- package/es/scenegraph/component/custom.js.map +1 -1
- package/es/scenegraph/graphic/group.d.ts +1 -0
- package/es/scenegraph/graphic/group.js +10 -0
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +6 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +4 -3
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.js +3 -2
- package/es/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/image-cell.js +3 -2
- package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +3 -2
- package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.js +6 -5
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/video-cell.js +3 -2
- package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +7 -3
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/icon/icon-update.js +6 -1
- package/es/scenegraph/icon/icon-update.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +7 -9
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/update-height.js +4 -1
- package/es/scenegraph/layout/update-height.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +4 -1
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/scenegraph.js +2 -1
- package/es/scenegraph/stick-text/index.js +12 -4
- package/es/scenegraph/stick-text/index.js.map +1 -1
- package/es/scenegraph/utils/text-icon-layout.js +3 -2
- package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
- package/es/state/hover/is-cell-hover.js +8 -3
- package/es/state/hover/is-cell-hover.js.map +1 -1
- package/es/state/hover/update-cell.js +8 -3
- package/es/state/hover/update-cell.js.map +1 -1
- package/es/state/state.js +1 -2
- package/es/themes/component.d.ts +5 -5
- package/es/tools/merge-range.d.ts +8 -0
- package/es/tools/merge-range.js +13 -0
- package/es/tools/merge-range.js.map +1 -0
- package/es/ts-types/component/axis.d.ts +2 -15
- package/es/ts-types/component/axis.js.map +1 -1
- package/es/ts-types/customElement.d.ts +1 -0
- package/es/ts-types/customElement.js.map +1 -1
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/es/dataset/dataset.js
CHANGED
|
@@ -6,7 +6,7 @@ import { AvgAggregator, CountAggregator, MaxAggregator, MinAggregator, NoneAggre
|
|
|
6
6
|
|
|
7
7
|
export class Dataset {
|
|
8
8
|
constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
|
|
9
|
-
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
|
|
9
|
+
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;
|
|
10
10
|
if (this.tree = {}, this.changedTree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
|
|
11
11
|
this.colKeys = [], this.rowKeys = [], this.rowOrder = "key_a_to_z", this.colOrder = "key_a_to_z",
|
|
12
12
|
this.sorted = !1, this.indicatorStatistics = [], this.aggregators = {}, this.stringJoinChar = String.fromCharCode(0),
|
|
@@ -27,11 +27,11 @@ export class Dataset {
|
|
|
27
27
|
this.needSplitPositiveAndNegative = null != needSplitPositiveAndNegative && needSplitPositiveAndNegative,
|
|
28
28
|
this.rowsIsTotal = new Array(null !== (_v = null === (_u = this.rows) || void 0 === _u ? void 0 : _u.length) && void 0 !== _v ? _v : 0).fill(!1),
|
|
29
29
|
this.colsIsTotal = new Array(null !== (_x = null === (_w = this.columns) || void 0 === _w ? void 0 : _w.length) && void 0 !== _x ? _x : 0).fill(!1),
|
|
30
|
-
|
|
30
|
+
(null === (_y = this.totals) || void 0 === _y ? void 0 : _y.row) && !1 !== this.totals.row.showSubTotals) for (let i = 0, len = 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; i < len; i++) {
|
|
31
31
|
const dimension = this.totals.row.subTotalsDimensions[i], dimensionIndex = this.rows.indexOf(dimension);
|
|
32
32
|
this.rowsIsTotal[dimensionIndex] = !0;
|
|
33
33
|
}
|
|
34
|
-
if (
|
|
34
|
+
if ((null === (_2 = this.totals) || void 0 === _2 ? void 0 : _2.column) && !1 !== this.totals.column.showSubTotals) for (let i = 0, len = null === (_5 = null === (_4 = null === (_3 = this.totals) || void 0 === _3 ? void 0 : _3.column) || void 0 === _4 ? void 0 : _4.subTotalsDimensions) || void 0 === _5 ? void 0 : _5.length; i < len; i++) {
|
|
35
35
|
const dimension = this.totals.column.subTotalsDimensions[i], dimensionIndex = this.columns.indexOf(dimension);
|
|
36
36
|
this.colsIsTotal[dimensionIndex] = !0;
|
|
37
37
|
}
|
|
@@ -127,7 +127,7 @@ export class Dataset {
|
|
|
127
127
|
return isReserved;
|
|
128
128
|
}
|
|
129
129
|
processRecord(record, assignedIndicatorKey) {
|
|
130
|
-
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
|
|
130
|
+
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;
|
|
131
131
|
null === (_a = this.derivedFieldRules) || void 0 === _a || _a.forEach(((derivedFieldRule, i) => {
|
|
132
132
|
record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
|
|
133
133
|
}));
|
|
@@ -158,7 +158,7 @@ export class Dataset {
|
|
|
158
158
|
rowKey.push(this.rowGrandTotalLabel), isToTalRecord = !0;
|
|
159
159
|
break;
|
|
160
160
|
}
|
|
161
|
-
if ((null === (_g = null === (_f = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.
|
|
161
|
+
if ((null === (_g = null === (_f = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.subTotalsDimensions.indexOf(this.rows[l - 1])) >= 0) {
|
|
162
162
|
"grid" === this.rowHierarchyType && rowKey.push(this.rowSubTotalLabel), isToTalRecord = !0;
|
|
163
163
|
break;
|
|
164
164
|
}
|
|
@@ -167,11 +167,11 @@ export class Dataset {
|
|
|
167
167
|
for (let n = 0, len2 = this.columns.length; n < len2; n++) {
|
|
168
168
|
const colAttr = this.columns[n];
|
|
169
169
|
if (colAttr in record) colKey.push(record[colAttr]); else {
|
|
170
|
-
if ((null === (
|
|
170
|
+
if ((null === (_k = null === (_j = null === (_h = this.dataConfig) || void 0 === _h ? void 0 : _h.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.showGrandTotals) && 0 === n && !this.columns.find((ck => ck in record))) {
|
|
171
171
|
colKey.push(this.colGrandTotalLabel), isToTalRecord = !0;
|
|
172
172
|
break;
|
|
173
173
|
}
|
|
174
|
-
if ((null === (
|
|
174
|
+
if ((null === (_o = null === (_m = null === (_l = this.dataConfig) || void 0 === _l ? void 0 : _l.totals) || void 0 === _m ? void 0 : _m.column) || void 0 === _o ? void 0 : _o.subTotalsDimensions.indexOf(this.columns[n - 1])) >= 0) {
|
|
175
175
|
colKey.push(this.colSubTotalLabel), isToTalRecord = !0;
|
|
176
176
|
break;
|
|
177
177
|
}
|
|
@@ -182,20 +182,20 @@ export class Dataset {
|
|
|
182
182
|
this.totalRecordsTree[flatRowKey] || (this.totalRecordsTree[flatRowKey] = {}), this.totalRecordsTree[flatRowKey][flatColKey] || (this.totalRecordsTree[flatRowKey][flatColKey] = []);
|
|
183
183
|
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
184
184
|
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
185
|
-
(null === (
|
|
186
|
-
this.indicatorKeys[i] in record && (null === (
|
|
185
|
+
(null === (_q = null === (_p = this.totalRecordsTree[flatRowKey]) || void 0 === _p ? void 0 : _p[flatColKey]) || void 0 === _q ? void 0 : _q[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_r = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _r ? _r : AggregationType.SUM](null !== (_s = null == aggRule ? void 0 : aggRule.field) && void 0 !== _s ? _s : this.indicatorKeys[i], null !== (_t = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _t ? _t : null === (_v = null === (_u = this.indicators) || void 0 === _u ? void 0 : _u.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _v ? void 0 : _v.format)),
|
|
186
|
+
this.indicatorKeys[i] in record && (null === (_x = null === (_w = this.totalRecordsTree[flatRowKey]) || void 0 === _w ? void 0 : _w[flatColKey]) || void 0 === _x || _x[i].push(record));
|
|
187
187
|
}
|
|
188
188
|
} else {
|
|
189
189
|
0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
|
|
190
190
|
this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
|
|
191
191
|
this.colFlatKeys[flatColKey] = 1)), this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
|
|
192
|
-
(null === (
|
|
192
|
+
(null === (_y = this.tree[flatRowKey]) || void 0 === _y ? void 0 : _y[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
|
|
193
193
|
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
194
194
|
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
195
|
-
if ((null === (
|
|
196
|
-
assignedIndicatorKey) this.indicatorKeys[i] === assignedIndicatorKey && (null === (
|
|
197
|
-
(null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (null === (
|
|
198
|
-
} else this.indicatorKeys[i] in record && (null === (
|
|
195
|
+
if ((null === (_0 = null === (_z = this.tree[flatRowKey]) || void 0 === _z ? void 0 : _z[flatColKey]) || void 0 === _0 ? void 0 : _0[i]) || (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_1 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _1 ? _1 : AggregationType.SUM](null !== (_2 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _2 ? _2 : this.indicatorKeys[i], null !== (_3 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _3 ? _3 : null === (_5 = null === (_4 = this.indicators) || void 0 === _4 ? void 0 : _4.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _5 ? void 0 : _5.format)),
|
|
196
|
+
assignedIndicatorKey) this.indicatorKeys[i] === assignedIndicatorKey && (null === (_7 = null === (_6 = this.tree[flatRowKey]) || void 0 === _6 ? void 0 : _6[flatColKey]) || void 0 === _7 || _7[i].push(record)); 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 && (null === (_9 = null === (_8 = this.tree[flatRowKey]) || void 0 === _8 ? void 0 : _8[flatColKey]) || void 0 === _9 || _9[i].push(record)); else {
|
|
197
|
+
(null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (null === (_11 = null === (_10 = this.tree[flatRowKey]) || void 0 === _10 ? void 0 : _10[flatColKey]) || void 0 === _11 || _11[i].push(record));
|
|
198
|
+
} else this.indicatorKeys[i] in record && (null === (_13 = null === (_12 = this.tree[flatRowKey]) || void 0 === _12 ? void 0 : _12[flatColKey]) || void 0 === _13 || _13[i].push(record));
|
|
199
199
|
}
|
|
200
200
|
if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
201
201
|
if (!this.indicatorStatistics[i]) {
|
|
@@ -203,17 +203,19 @@ export class Dataset {
|
|
|
203
203
|
this.indicatorStatistics[i] = {
|
|
204
204
|
max: new this.aggregators[AggregationType.MAX](this.indicatorKeys[i]),
|
|
205
205
|
min: new this.aggregators[AggregationType.MIN](this.indicatorKeys[i]),
|
|
206
|
-
total: new this.aggregators[null !== (
|
|
206
|
+
total: new this.aggregators[null !== (_14 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _14 ? _14 : AggregationType.SUM](null !== (_15 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _15 ? _15 : this.indicatorKeys[i], null !== (_16 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _16 ? _16 : null === (_18 = null === (_17 = this.indicators) || void 0 === _17 ? void 0 : _17.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _18 ? void 0 : _18.format)
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
this.indicatorStatistics[i].max.push(null === (
|
|
210
|
-
this.indicatorStatistics[i].min.push(null === (
|
|
209
|
+
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()),
|
|
210
|
+
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()),
|
|
211
211
|
this.indicatorStatistics[i].total.push(record);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
updateSortRules(sortRules) {
|
|
216
|
-
|
|
216
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
217
|
+
this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.customRowTree || ("tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_g = null === (_f = null === (_e = this.totals) || void 0 === _e ? void 0 : _e.row) || void 0 === _f ? void 0 : _f.showGrandTotalsOnTop) && void 0 !== _g && _g, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTop) && void 0 !== _k && _k)),
|
|
218
|
+
this.customColTree || (this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showGrandTotalsOnLeft) && void 0 !== _q && _q, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showSubTotalsOnLeft) && void 0 !== _t && _t));
|
|
217
219
|
}
|
|
218
220
|
updateFilterRules(filterRules, isResetTree = !1) {
|
|
219
221
|
var _a;
|
|
@@ -321,17 +323,16 @@ export class Dataset {
|
|
|
321
323
|
return results;
|
|
322
324
|
}.call(this);
|
|
323
325
|
return function(a, b) {
|
|
324
|
-
var _a, _b, _c
|
|
326
|
+
var _a, _b, _c;
|
|
325
327
|
let comparison, sorter;
|
|
326
328
|
for (let i = 0; i < sortersArr.length; i++) {
|
|
327
329
|
if (sorter = sortersArr[i], null === (_a = sorter.sortRule) || void 0 === _a ? void 0 : _a.sortByIndicator) {
|
|
328
330
|
let aChanged = a, bChanged = b;
|
|
329
331
|
sorter.fieldIndex < fieldArr.length - 1 && (aChanged = a.slice(0, sorter.fieldIndex + 1),
|
|
330
|
-
aChanged.push(isRow ?
|
|
331
|
-
bChanged
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
if (0 !== comparison) return comparison * ((null === (_l = sorter.sortRule) || void 0 === _l ? void 0 : _l.sortType) === SortType.DESC ? -1 : 1);
|
|
332
|
+
aChanged.push(isRow ? that.rowSubTotalLabel : that.colSubTotalLabel), bChanged = b.slice(0, sorter.fieldIndex + 1),
|
|
333
|
+
bChanged.push(isRow ? that.rowSubTotalLabel : that.colSubTotalLabel)), comparison = sorter.func(aChanged, bChanged);
|
|
334
|
+
} else comparison = null === (_b = sorter.func) || void 0 === _b ? void 0 : _b.call(sorter, a[sorter.fieldIndex], b[sorter.fieldIndex]);
|
|
335
|
+
if (0 !== comparison) return comparison * ((null === (_c = sorter.sortRule) || void 0 === _c ? void 0 : _c.sortType) === SortType.DESC ? -1 : 1);
|
|
335
336
|
}
|
|
336
337
|
return 0;
|
|
337
338
|
};
|
|
@@ -348,74 +349,74 @@ export class Dataset {
|
|
|
348
349
|
} : sortRule.sortBy ? sortBy(sortRule.sortBy) : sortRule.sortType ? typeSort : sortRule.sortFunc ? sortRule.sortFunc : naturalSort;
|
|
349
350
|
}
|
|
350
351
|
totalStatistics() {
|
|
351
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
352
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
352
353
|
const that = this;
|
|
353
|
-
if ((null === (
|
|
354
|
+
if ((null === (_c = null === (_b = null === (_a = null == that ? void 0 : that.totals) || void 0 === _a ? void 0 : _a.column) || void 0 === _b ? void 0 : _b.subTotalsDimensions) || void 0 === _c ? void 0 : _c.length) >= 1 || (null === (_f = null === (_e = null === (_d = null == that ? void 0 : that.totals) || void 0 === _d ? void 0 : _d.row) || void 0 === _e ? void 0 : _e.subTotalsDimensions) || void 0 === _f ? void 0 : _f.length) >= 1 || (null === (_h = null === (_g = null == that ? void 0 : that.totals) || void 0 === _g ? void 0 : _g.column) || void 0 === _h ? void 0 : _h.showGrandTotals) || (null === (_k = null === (_j = null == that ? void 0 : that.totals) || void 0 === _j ? void 0 : _j.row) || void 0 === _k ? void 0 : _k.showGrandTotals)) {
|
|
354
355
|
const rowTotalKeys = [], colCompute = (flatRowKey, flatColKey) => {
|
|
355
|
-
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
|
|
356
|
+
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;
|
|
356
357
|
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]);
|
|
357
358
|
const colKey = flatColKey.split(this.stringJoinChar);
|
|
358
359
|
for (let i = 0, len = null === (_g = null === (_f = null === (_e = that.totals) || void 0 === _e ? void 0 : _e.column) || void 0 === _f ? void 0 : _f.subTotalsDimensions) || void 0 === _g ? void 0 : _g.length; i < len; i++) {
|
|
359
360
|
const dimension = that.totals.column.subTotalsDimensions[i], dimensionIndex = that.columns.indexOf(dimension);
|
|
360
361
|
if (dimensionIndex >= 0) {
|
|
361
362
|
const colTotalKey = colKey.slice(0, dimensionIndex + 1);
|
|
362
|
-
colTotalKey.push(
|
|
363
|
+
colTotalKey.push(that.colSubTotalLabel);
|
|
363
364
|
const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
|
|
364
|
-
if (null === (
|
|
365
|
+
if (null === (_j = null === (_h = this.totalRecordsTree) || void 0 === _h ? void 0 : _h[flatRowKey]) || void 0 === _j ? void 0 : _j[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_l = null === (_k = this.totalRecordsTree) || void 0 === _k ? void 0 : _k[flatRowKey]) || void 0 === _l ? void 0 : _l[flatColTotalKey]);
|
|
365
366
|
this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
|
|
366
367
|
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
367
368
|
if (!this.tree[flatRowKey][flatColTotalKey][i]) {
|
|
368
369
|
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
369
|
-
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (
|
|
370
|
+
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_m = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _m ? _m : AggregationType.SUM](null !== (_o = null == aggRule ? void 0 : aggRule.field) && void 0 !== _o ? _o : this.indicatorKeys[i], 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 === this.indicatorKeys[i]))) || void 0 === _r ? void 0 : _r.format);
|
|
370
371
|
}
|
|
371
|
-
this.tree[flatRowKey][flatColTotalKey][i].push(null === (
|
|
372
|
+
this.tree[flatRowKey][flatColTotalKey][i].push(null === (_t = null === (_s = that.tree[flatRowKey]) || void 0 === _s ? void 0 : _s[flatColKey]) || void 0 === _t ? void 0 : _t[i]);
|
|
372
373
|
}
|
|
373
374
|
}
|
|
374
375
|
}
|
|
375
|
-
if ((null === (
|
|
376
|
+
if ((null === (_v = null === (_u = that.totals) || void 0 === _u ? void 0 : _u.column) || void 0 === _v ? void 0 : _v.showGrandTotals) || 0 === this.rows.length) {
|
|
376
377
|
const flatColTotalKey = that.colGrandTotalLabel;
|
|
377
|
-
if (null === (
|
|
378
|
+
if (null === (_x = null === (_w = this.totalRecordsTree) || void 0 === _w ? void 0 : _w[flatRowKey]) || void 0 === _x ? void 0 : _x[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_z = null === (_y = this.totalRecordsTree) || void 0 === _y ? void 0 : _y[flatRowKey]) || void 0 === _z ? void 0 : _z[flatColTotalKey]);
|
|
378
379
|
this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
|
|
379
380
|
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
380
381
|
if (!this.tree[flatRowKey][flatColTotalKey][i]) {
|
|
381
382
|
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
382
|
-
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (
|
|
383
|
+
this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_0 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _0 ? _0 : AggregationType.SUM](null !== (_1 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _1 ? _1 : this.indicatorKeys[i], null !== (_2 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _2 ? _2 : null === (_4 = null === (_3 = this.indicators) || void 0 === _3 ? void 0 : _3.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _4 ? void 0 : _4.format);
|
|
383
384
|
}
|
|
384
|
-
this.tree[flatRowKey][flatColTotalKey][i].push(null === (
|
|
385
|
+
this.tree[flatRowKey][flatColTotalKey][i].push(null === (_6 = null === (_5 = that.tree[flatRowKey]) || void 0 === _5 ? void 0 : _5[flatColKey]) || void 0 === _6 ? void 0 : _6[i]);
|
|
385
386
|
}
|
|
386
387
|
}
|
|
387
388
|
};
|
|
388
389
|
Object.keys(that.tree).forEach((flatRowKey => {
|
|
389
390
|
const rowKey = flatRowKey.split(this.stringJoinChar);
|
|
390
391
|
Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
|
|
391
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
392
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
392
393
|
for (let i = 0, len = null === (_c = null === (_b = null === (_a = that.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) || void 0 === _c ? void 0 : _c.length; i < len; i++) {
|
|
393
394
|
const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
|
|
394
395
|
if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
|
|
395
396
|
const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
|
|
396
|
-
"grid" === this.rowHierarchyType && rowTotalKey.push(
|
|
397
|
+
"grid" === this.rowHierarchyType && rowTotalKey.push(that.rowSubTotalLabel);
|
|
397
398
|
const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
|
|
398
399
|
this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
|
|
399
400
|
this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
|
|
400
401
|
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
401
402
|
if (!this.tree[flatRowTotalKey][flatColKey][i]) {
|
|
402
403
|
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
403
|
-
this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (
|
|
404
|
+
this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_d = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _d ? _d : AggregationType.SUM](null !== (_e = null == aggRule ? void 0 : aggRule.field) && void 0 !== _e ? _e : this.indicatorKeys[i], null !== (_f = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _f ? _f : null === (_h = null === (_g = this.indicators) || void 0 === _g ? void 0 : _g.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _h ? void 0 : _h.format);
|
|
404
405
|
}
|
|
405
|
-
this.tree[flatRowTotalKey][flatColKey][i].push(null === (
|
|
406
|
+
this.tree[flatRowTotalKey][flatColKey][i].push(null === (_k = null === (_j = that.tree[flatRowKey]) || void 0 === _j ? void 0 : _j[flatColKey]) || void 0 === _k ? void 0 : _k[i]);
|
|
406
407
|
}
|
|
407
408
|
}
|
|
408
409
|
}
|
|
409
|
-
if ((null === (
|
|
410
|
+
if ((null === (_m = null === (_l = that.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showGrandTotals) || 0 === this.columns.length) {
|
|
410
411
|
const flatRowTotalKey = that.rowGrandTotalLabel;
|
|
411
412
|
this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
|
|
412
413
|
this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
|
|
413
414
|
for (let i = 0; i < this.indicatorKeys.length; i++) {
|
|
414
415
|
if (!this.tree[flatRowTotalKey][flatColKey][i]) {
|
|
415
416
|
const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
|
|
416
|
-
this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (
|
|
417
|
+
this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null !== (_q = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _q ? _q : null === (_s = null === (_r = this.indicators) || void 0 === _r ? void 0 : _r.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _s ? void 0 : _s.format);
|
|
417
418
|
}
|
|
418
|
-
this.tree[flatRowTotalKey][flatColKey][i].push(null === (
|
|
419
|
+
this.tree[flatRowTotalKey][flatColKey][i].push(null === (_u = null === (_t = that.tree[flatRowKey]) || void 0 === _t ? void 0 : _t[flatColKey]) || void 0 === _u ? void 0 : _u[i]);
|
|
419
420
|
}
|
|
420
421
|
}
|
|
421
422
|
colCompute(flatRowKey, flatColKey);
|