@visactor/vtable 1.15.2 → 1.16.0-alpha.0
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/PivotChart.d.ts +0 -1
- package/cjs/PivotChart.js +2 -5
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +2 -2
- package/cjs/PivotTable.js +41 -33
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.d.ts +1 -2
- package/cjs/core/BaseTable.js +2 -2
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/data/DataSource.d.ts +2 -2
- package/cjs/data/DataSource.js +4 -4
- package/cjs/data/DataSource.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +3 -2
- package/cjs/dataset/dataset.js +12 -9
- package/cjs/dataset/dataset.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/layout-helper.js +8 -8
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +33 -5
- package/cjs/layout/pivot-header-layout.js +137 -31
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/tree-helper.d.ts +5 -4
- package/cjs/layout/tree-helper.js +105 -23
- package/cjs/layout/tree-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.js +5 -2
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +8 -4
- package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/frozen.d.ts +1 -0
- package/cjs/scenegraph/layout/frozen.js +91 -2
- package/cjs/scenegraph/layout/frozen.js.map +1 -1
- package/cjs/scenegraph/layout/update-col.js +4 -1
- package/cjs/scenegraph/layout/update-col.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +3 -2
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +5 -0
- package/cjs/scenegraph/scenegraph.js +18 -0
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/get-hierarchy-offset.js +1 -1
- package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/cjs/state/state.d.ts +2 -0
- package/cjs/state/state.js +7 -2
- package/cjs/state/state.js.map +1 -1
- package/cjs/tools/NumberMap.js +4 -2
- package/cjs/tools/NumberMap.js.map +1 -1
- package/cjs/tools/diff-cell.d.ts +58 -3
- package/cjs/tools/diff-cell.js +90 -11
- package/cjs/tools/diff-cell.js.map +1 -1
- package/cjs/tools/get-data-path/create-dataset.js +1 -1
- package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +2 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/list-table/define/basic-define.d.ts +1 -1
- package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +4 -4
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/cjs/ts-types/pivot-table/dimension/basic-dimension.d.ts +2 -2
- package/cjs/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
- package/cjs/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -1
- package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +6 -3
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +759 -116
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.d.ts +0 -1
- package/es/PivotChart.js +2 -5
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +2 -2
- package/es/PivotTable.js +41 -33
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.d.ts +1 -2
- package/es/core/BaseTable.js +2 -2
- package/es/core/BaseTable.js.map +1 -1
- package/es/data/DataSource.d.ts +2 -2
- package/es/data/DataSource.js +4 -4
- package/es/data/DataSource.js.map +1 -1
- package/es/dataset/dataset.d.ts +3 -2
- package/es/dataset/dataset.js +12 -9
- package/es/dataset/dataset.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/layout-helper.js +8 -8
- package/es/layout/layout-helper.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +33 -5
- package/es/layout/pivot-header-layout.js +138 -33
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/tree-helper.d.ts +5 -4
- package/es/layout/tree-helper.js +102 -19
- package/es/layout/tree-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -1
- package/es/scenegraph/group-creater/progress/proxy.js +5 -2
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +8 -4
- package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +1 -1
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/frozen.d.ts +1 -0
- package/es/scenegraph/layout/frozen.js +89 -0
- package/es/scenegraph/layout/frozen.js.map +1 -1
- package/es/scenegraph/layout/update-col.js +4 -1
- package/es/scenegraph/layout/update-col.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +3 -2
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +5 -0
- package/es/scenegraph/scenegraph.js +16 -1
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/get-hierarchy-offset.js +1 -1
- package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
- package/es/state/state.d.ts +2 -0
- package/es/state/state.js +7 -2
- package/es/state/state.js.map +1 -1
- package/es/tools/NumberMap.js +4 -2
- package/es/tools/NumberMap.js.map +1 -1
- package/es/tools/diff-cell.d.ts +58 -3
- package/es/tools/diff-cell.js +85 -9
- package/es/tools/diff-cell.js.map +1 -1
- package/es/tools/get-data-path/create-dataset.js +1 -1
- package/es/tools/get-data-path/create-dataset.js.map +1 -1
- package/es/ts-types/base-table.d.ts +2 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/list-table/define/basic-define.d.ts +1 -1
- package/es/ts-types/list-table/define/basic-define.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +4 -4
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/es/ts-types/pivot-table/dimension/basic-dimension.d.ts +2 -2
- package/es/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
- package/es/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -1
- package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +6 -3
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/cjs/dataset/dataset.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
const vutils_1 = require("@visactor/vutils"), ts_types_1 = require("../ts-types"), aggregation_1 = require("../ts-types/dataset/aggregation"), global_1 = require("../tools/global"), join_1 = require("../tools/join");
|
|
8
8
|
|
|
9
9
|
class Dataset {
|
|
10
|
-
constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative, hasExtensionRowTree, parseCustomTreeToMatchRecords) {
|
|
10
|
+
constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, columnHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative, hasExtensionRowTree, parseCustomTreeToMatchRecords) {
|
|
11
11
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
|
|
12
12
|
this.tree = {}, this.changedTree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
|
|
13
13
|
this.colKeys = [], this.rowKeys = [], this.colKeys_normal = [], this.rowKeys_normal = [],
|
|
@@ -15,7 +15,8 @@ class Dataset {
|
|
|
15
15
|
this.stringJoinChar = String.fromCharCode(0), this.rowsIsTotal = [], this.colsIsTotal = [],
|
|
16
16
|
this.collectedValues = {}, this.cacheCollectedValues = {}, this.totalRecordsTree = {},
|
|
17
17
|
this.registerAggregators(), this.dataConfig = dataConfig, this.filterRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules,
|
|
18
|
-
this.rowHierarchyType = null != rowHierarchyType ? rowHierarchyType : "grid", this.
|
|
18
|
+
this.rowHierarchyType = null != rowHierarchyType ? rowHierarchyType : "grid", this.columnHierarchyType = null != columnHierarchyType ? columnHierarchyType : "grid",
|
|
19
|
+
this.sortRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.sortRules,
|
|
19
20
|
this.aggregationRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.aggregationRules,
|
|
20
21
|
this.derivedFieldRules = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.derivedFieldRules,
|
|
21
22
|
this.mappingRules = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.mappingRules,
|
|
@@ -200,7 +201,7 @@ class Dataset {
|
|
|
200
201
|
break;
|
|
201
202
|
}
|
|
202
203
|
if ((null === (_k = null === (_j = null === (_h = this.dataConfig) || void 0 === _h ? void 0 : _h.totals) || void 0 === _j ? void 0 : _j.row) || void 0 === _k ? void 0 : _k.subTotalsDimensions) && (null === (_o = null === (_m = null === (_l = this.dataConfig) || void 0 === _l ? void 0 : _l.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.subTotalsDimensions.indexOf(this.rows[l - 1])) >= 0) {
|
|
203
|
-
"
|
|
204
|
+
"tree" !== this.rowHierarchyType && rowKey.push(this.rowSubTotalLabel), isToTalRecord = !0;
|
|
204
205
|
break;
|
|
205
206
|
}
|
|
206
207
|
}
|
|
@@ -353,16 +354,18 @@ class Dataset {
|
|
|
353
354
|
return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
|
|
354
355
|
}
|
|
355
356
|
getAggregator(rowKey = [], colKey = [], indicator, considerChangedValue = !0, indicatorPosition) {
|
|
356
|
-
var _a, _b, _c, _d;
|
|
357
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
357
358
|
const indicatorIndex = this.indicatorKeys.indexOf(indicator);
|
|
358
359
|
let flatRowKey, flatColKey;
|
|
359
360
|
"string" == typeof rowKey ? flatRowKey = rowKey : (indicatorPosition && "row" !== indicatorPosition.position || rowKey.map(((key, i) => {
|
|
360
361
|
key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || rowKey.splice(i, 1);
|
|
361
|
-
})),
|
|
362
|
+
})), 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 && rowKey[rowKey.length - 1] !== this.rowSubTotalLabel && rowKey.push(this.rowSubTotalLabel)),
|
|
363
|
+
flatRowKey = (0, join_1.join)(rowKey, this.stringJoinChar)), "string" == typeof colKey ? flatColKey = colKey : (indicatorPosition && "col" !== indicatorPosition.position || colKey.map(((key, i) => {
|
|
362
364
|
key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || colKey.splice(i, 1);
|
|
363
|
-
})),
|
|
364
|
-
|
|
365
|
-
|
|
365
|
+
})), colKey.length < this.columns.length && "grid-tree" === this.columnHierarchyType && (colKey[0] === this.colGrandTotalLabel || (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.column) || void 0 === _g ? void 0 : _g.subTotalsDimensions) && (null === (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.column) || void 0 === _j ? void 0 : _j.subTotalsDimensions) || void 0 === _k ? void 0 : _k.length) >= 1 && colKey[colKey.length - 1] !== this.colSubTotalLabel && colKey.push(this.colSubTotalLabel)),
|
|
366
|
+
flatColKey = (0, join_1.join)(colKey, this.stringJoinChar));
|
|
367
|
+
const agg = null === (_m = null === (_l = this.tree[flatRowKey]) || void 0 === _l ? void 0 : _l[flatColKey]) || void 0 === _m ? void 0 : _m[indicatorIndex];
|
|
368
|
+
if (considerChangedValue && (0, vutils_1.isValid)(null === (_p = null === (_o = this.changedTree[flatRowKey]) || void 0 === _o ? void 0 : _o[flatColKey]) || void 0 === _p ? void 0 : _p[indicatorIndex])) {
|
|
366
369
|
const changeValue = this.changedTree[flatRowKey][flatColKey][indicatorIndex];
|
|
367
370
|
return agg ? {
|
|
368
371
|
value: () => changeValue,
|
|
@@ -531,7 +534,7 @@ class Dataset {
|
|
|
531
534
|
const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
|
|
532
535
|
if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
|
|
533
536
|
const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
|
|
534
|
-
"
|
|
537
|
+
"tree" !== this.rowHierarchyType && rowTotalKey.push(that.rowSubTotalLabel);
|
|
535
538
|
const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
|
|
536
539
|
this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
|
|
537
540
|
this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
|