@visactor/vtable 0.11.1-alpha.8 → 0.12.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/ListTable.d.ts +0 -2
- package/cjs/ListTable.js +10 -16
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +2 -2
- package/cjs/PivotChart.js +53 -28
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +1 -1
- package/cjs/PivotTable.js +63 -31
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +6 -6
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset-pivot-table.js +5 -12
- package/cjs/dataset/dataset.d.ts +9 -8
- package/cjs/dataset/dataset.js +105 -61
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/flatDataToObject.js +2 -3
- package/cjs/event/event.js +2 -1
- package/cjs/event/event.js.map +1 -1
- package/cjs/event/listener/container-dom.js +1 -1
- package/cjs/event/listener/scroll-bar.js +6 -6
- package/cjs/event/listener/scroll-bar.js.map +1 -1
- package/cjs/event/pivot-chart/axis-click.js.map +1 -1
- package/cjs/event/pivot-chart/axis-hover.js.map +1 -1
- package/cjs/event/sparkline-event.js.map +1 -1
- package/cjs/index.d.ts +1 -2
- package/cjs/index.js +2 -3
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-config.d.ts +4 -4
- package/cjs/layout/chart-helper/get-axis-config.js +25 -23
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-domain.d.ts +1 -1
- package/cjs/layout/chart-helper/get-axis-domain.js +2 -2
- package/cjs/layout/chart-helper/get-axis-domain.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.d.ts +4 -5
- package/cjs/layout/chart-helper/get-chart-spec.js +14 -13
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +58 -44
- package/cjs/layout/pivot-header-layout.js +425 -200
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout-helper.d.ts +40 -0
- package/cjs/layout/pivot-layout-helper.js +96 -0
- package/cjs/layout/pivot-layout-helper.js.map +1 -0
- package/cjs/layout/pivot-layout.d.ts +1 -143
- package/cjs/layout/pivot-layout.js +1 -807
- package/cjs/layout/pivot-layout.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +1 -1
- package/cjs/layout/simple-header-layout.js +2 -2
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/component/menu.d.ts +41 -0
- package/cjs/scenegraph/context/module.js +2 -4
- package/cjs/scenegraph/debug-tool/debug-tool.js +1 -1
- package/cjs/scenegraph/graphic/chart.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/chart-render.js +2 -2
- package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +9 -9
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.js +3 -3
- package/cjs/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/index.d.ts +1 -1
- package/cjs/scenegraph/graphic/contributions/index.js +2 -2
- package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +3 -3
- package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/group.d.ts +3 -0
- package/cjs/scenegraph/graphic/group.js +20 -0
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +1 -1
- package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +3 -0
- package/cjs/scenegraph/group-creater/progress/proxy.js +15 -13
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.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/compute-row-height.js +2 -2
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.d.ts +1 -1
- package/cjs/scenegraph/layout/update-row.js +5 -1
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.d.ts +1 -1
- package/cjs/scenegraph/scenegraph.js +9 -6
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/utils/break-string.js +3 -4
- package/cjs/scenegraph/utils/deal-promise-data.js +1 -3
- package/cjs/scenegraph/utils/render-service.d.ts +7 -0
- package/cjs/scenegraph/utils/render-service.js +27 -0
- package/cjs/scenegraph/utils/render-service.js.map +1 -0
- package/{es/scenegraph/utils/measure-text.d.ts → cjs/scenegraph/utils/text-measure.d.ts} +10 -3
- package/cjs/scenegraph/utils/{measure-text.js → text-measure.js} +30 -15
- package/cjs/scenegraph/utils/text-measure.js.map +1 -0
- package/cjs/state/state.d.ts +1 -0
- package/cjs/state/state.js +4 -2
- package/cjs/state/state.js.map +1 -1
- package/cjs/themes/BRIGHT.js +1 -2
- package/cjs/themes/DARK.js +2 -1
- package/cjs/tools/LimitPromiseQueue.js +1 -1
- package/cjs/tools/calc.js +1 -1
- package/cjs/tools/diff-cell.d.ts +9 -2
- package/cjs/tools/diff-cell.js +16 -4
- package/cjs/tools/diff-cell.js.map +1 -1
- package/cjs/tools/get-data-path/create-dataset.js +2 -2
- package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
- package/cjs/tools/get-data-path/index.js +9 -4
- package/cjs/tools/get-data-path/index.js.map +1 -1
- package/cjs/tools/isx.d.ts +1 -1
- package/cjs/tools/util.d.ts +1 -3
- package/cjs/tools/util.js +2 -33
- package/cjs/tools/util.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +14 -6
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -2
- package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
- package/cjs/ts-types/new-data-set.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +9 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/dist/vtable.js +58066 -69774
- package/dist/vtable.min.js +12 -14
- package/es/ListTable.d.ts +0 -2
- package/es/ListTable.js +8 -12
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +2 -2
- package/es/PivotChart.js +53 -29
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +1 -1
- package/es/PivotTable.js +61 -32
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +5 -5
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset-pivot-table.js +5 -12
- package/es/dataset/dataset.d.ts +9 -8
- package/es/dataset/dataset.js +104 -61
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/flatDataToObject.js +2 -3
- package/es/event/event.js +2 -1
- package/es/event/event.js.map +1 -1
- package/es/event/listener/container-dom.js +1 -1
- package/es/event/listener/scroll-bar.js +6 -6
- package/es/event/listener/scroll-bar.js.map +1 -1
- package/es/event/pivot-chart/axis-click.js.map +1 -1
- package/es/event/pivot-chart/axis-hover.js.map +1 -1
- package/es/event/sparkline-event.js.map +1 -1
- package/es/index.d.ts +1 -2
- package/es/index.js +1 -3
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-axis-config.d.ts +4 -4
- package/es/layout/chart-helper/get-axis-config.js +21 -19
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/chart-helper/get-axis-domain.d.ts +1 -1
- package/es/layout/chart-helper/get-axis-domain.js +2 -2
- package/es/layout/chart-helper/get-axis-domain.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.d.ts +4 -5
- package/es/layout/chart-helper/get-chart-spec.js +13 -12
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +58 -44
- package/es/layout/pivot-header-layout.js +425 -197
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout-helper.d.ts +40 -0
- package/es/layout/pivot-layout-helper.js +94 -0
- package/es/layout/pivot-layout-helper.js.map +1 -0
- package/es/layout/pivot-layout.d.ts +1 -143
- package/es/layout/pivot-layout.js +1 -808
- package/es/layout/pivot-layout.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +1 -1
- package/es/layout/simple-header-layout.js +2 -2
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/component/menu.d.ts +41 -0
- package/es/scenegraph/context/module.js +2 -4
- package/es/scenegraph/debug-tool/debug-tool.js +1 -1
- package/es/scenegraph/graphic/chart.js.map +1 -1
- package/es/scenegraph/graphic/contributions/chart-render.js +1 -3
- package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +1 -3
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/image-contribution-render.js +1 -3
- package/es/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/contributions/index.d.ts +1 -1
- package/es/scenegraph/graphic/contributions/index.js +1 -3
- package/es/scenegraph/graphic/contributions/index.js.map +1 -1
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js +1 -3
- package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/group.d.ts +3 -0
- package/es/scenegraph/graphic/group.js +20 -0
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js +1 -1
- package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +3 -0
- package/es/scenegraph/group-creater/progress/proxy.js +15 -13
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.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/compute-row-height.js +2 -2
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/update-row.d.ts +1 -1
- package/es/scenegraph/layout/update-row.js +5 -1
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.d.ts +1 -1
- package/es/scenegraph/scenegraph.js +10 -7
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/utils/break-string.js +3 -4
- package/es/scenegraph/utils/deal-promise-data.js +1 -3
- package/es/scenegraph/utils/render-service.d.ts +7 -0
- package/es/scenegraph/utils/render-service.js +19 -0
- package/es/scenegraph/utils/render-service.js.map +1 -0
- package/{cjs/scenegraph/utils/measure-text.d.ts → es/scenegraph/utils/text-measure.d.ts} +10 -3
- package/es/scenegraph/utils/{measure-text.js → text-measure.js} +31 -19
- package/es/scenegraph/utils/text-measure.js.map +1 -0
- package/es/state/state.d.ts +1 -0
- package/es/state/state.js +4 -2
- package/es/state/state.js.map +1 -1
- package/es/themes/BRIGHT.js +1 -2
- package/es/themes/DARK.js +2 -1
- package/es/tools/LimitPromiseQueue.js +1 -1
- package/es/tools/calc.js +1 -1
- package/es/tools/diff-cell.d.ts +9 -2
- package/es/tools/diff-cell.js +16 -4
- package/es/tools/diff-cell.js.map +1 -1
- package/es/tools/get-data-path/create-dataset.js +2 -2
- package/es/tools/get-data-path/create-dataset.js.map +1 -1
- package/es/tools/get-data-path/index.js +10 -5
- package/es/tools/get-data-path/index.js.map +1 -1
- package/es/tools/isx.d.ts +1 -1
- package/es/tools/util.d.ts +1 -3
- package/es/tools/util.js +1 -31
- package/es/tools/util.js.map +1 -1
- package/es/ts-types/base-table.d.ts +14 -6
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/list-table/layout-map/api.d.ts +2 -2
- package/es/ts-types/list-table/layout-map/api.js.map +1 -1
- package/es/ts-types/new-data-set.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +9 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/package.json +6 -7
- package/cjs/components/axis/get-axis-attributes.d.ts +0 -151
- package/cjs/scenegraph/utils/measure-text.js.map +0 -1
- package/es/components/axis/get-axis-attributes.d.ts +0 -151
- package/es/scenegraph/utils/measure-text.js.map +0 -1
|
@@ -2,123 +2,74 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.PivotHeaderLayoutMap = void 0;
|
|
5
|
+
}), exports.PivotHeaderLayoutMap = exports.sharedVar = void 0;
|
|
6
6
|
|
|
7
|
-
const util_1 = require("../tools/util"), ts_types_1 = require("../ts-types"),
|
|
7
|
+
const util_1 = require("../tools/util"), ts_types_1 = require("../ts-types"), global_1 = require("../tools/global"), diff_cell_1 = require("../tools/diff-cell"), get_chart_spec_1 = require("./chart-helper/get-chart-spec"), pivot_layout_helper_1 = require("./pivot-layout-helper"), vutils_1 = require("@visactor/vutils"), padding_1 = require("../scenegraph/utils/padding"), get_axis_config_1 = require("./chart-helper/get-axis-config");
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
id: 0,
|
|
13
|
-
dimensionKey: "",
|
|
14
|
-
value: "",
|
|
15
|
-
children: [],
|
|
16
|
-
level: -1,
|
|
17
|
-
startIndex: 0,
|
|
18
|
-
size: 0,
|
|
19
|
-
startInTotal: 0,
|
|
20
|
-
hierarchyState: void 0
|
|
21
|
-
}, this.totalLevel = 0, this.dimensionKeys = new NumberMap_1.NumberMap, this.sizeIncludeParent = null != rowExpandLevel,
|
|
22
|
-
this.rowExpandLevel = rowExpandLevel, this.hierarchyType = hierarchyType, this.reset(tree);
|
|
23
|
-
}
|
|
24
|
-
reset(tree, updateTreeNode = !1) {
|
|
25
|
-
this.dimensionKeys = new NumberMap_1.NumberMap, this.tree.children = tree, this.setTreeNode(this.tree, 0, this.tree),
|
|
26
|
-
this.totalLevel = this.dimensionKeys.count();
|
|
27
|
-
}
|
|
28
|
-
setTreeNode(node, startIndex, parent) {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
node.startIndex = startIndex, node.startInTotal = (null !== (_a = parent.startInTotal) && void 0 !== _a ? _a : 0) + node.startIndex,
|
|
31
|
-
(null !== (_b = node.dimensionKey) && void 0 !== _b ? _b : node.indicatorKey) && (!this.dimensionKeys.contain(node.indicatorKey ? global_1.IndicatorDimensionKeyPlaceholder : node.dimensionKey) && this.dimensionKeys.put(node.level, node.indicatorKey ? global_1.IndicatorDimensionKeyPlaceholder : node.dimensionKey),
|
|
32
|
-
node.id || (node.id = ++seqId));
|
|
33
|
-
let size = node.dimensionKey && this.sizeIncludeParent ? 1 : 0;
|
|
34
|
-
return "grid" === this.hierarchyType ? node.children ? node.children.forEach((n => {
|
|
35
|
-
var _a;
|
|
36
|
-
n.level = (null !== (_a = node.level) && void 0 !== _a ? _a : 0) + 1, size += this.setTreeNode(n, size, node);
|
|
37
|
-
})) : size = 1 : node.hierarchyState === ts_types_1.HierarchyState.expand && node.children ? node.children.forEach((n => {
|
|
38
|
-
var _a;
|
|
39
|
-
n.level = (null !== (_a = node.level) && void 0 !== _a ? _a : 0) + 1, size += this.setTreeNode(n, size, node);
|
|
40
|
-
})) : node.hierarchyState === ts_types_1.HierarchyState.collapse && node.children ? node.children.forEach((n => {
|
|
41
|
-
var _a;
|
|
42
|
-
n.level = (null !== (_a = node.level) && void 0 !== _a ? _a : 0) + 1, this.setTreeNode(n, size, node);
|
|
43
|
-
})) : !node.hierarchyState && node.level + 1 < this.rowExpandLevel && node.children ? (node.hierarchyState = ts_types_1.HierarchyState.expand,
|
|
44
|
-
node.children.forEach((n => {
|
|
45
|
-
var _a;
|
|
46
|
-
n.level = (null !== (_a = node.level) && void 0 !== _a ? _a : 0) + 1, size += this.setTreeNode(n, size, node);
|
|
47
|
-
}))) : node.children ? (node.hierarchyState = ts_types_1.HierarchyState.collapse,
|
|
48
|
-
node.children.forEach((n => {
|
|
49
|
-
var _a;
|
|
50
|
-
n.level = (null !== (_a = node.level) && void 0 !== _a ? _a : 0) + 1, this.setTreeNode(n, size, node);
|
|
51
|
-
}))) : (node.hierarchyState = ts_types_1.HierarchyState.none, size = 1), node.size = size,
|
|
52
|
-
size;
|
|
53
|
-
}
|
|
54
|
-
getTreePath(index, maxDeep = 30) {
|
|
55
|
-
const path = [];
|
|
56
|
-
return this.searchPath(index, this.tree, path, maxDeep), path.shift(), path;
|
|
57
|
-
}
|
|
58
|
-
searchPath(index, node, path, maxDeep) {
|
|
59
|
-
if (!node) return !1;
|
|
60
|
-
if (index < node.startIndex || index >= node.startIndex + node.size) return !1;
|
|
61
|
-
if (path.push(node), !node.children || 0 === node.children.length) return !0;
|
|
62
|
-
if (node.level >= maxDeep) return !0;
|
|
63
|
-
const cIndex = index - node.startIndex;
|
|
64
|
-
return node.children.some((n => this.searchPath(cIndex, n, path, maxDeep))), !0;
|
|
65
|
-
}
|
|
66
|
-
movePosition(level, sourceIndex, targetIndex) {
|
|
67
|
-
let parNode, sourceSubIndex, targetSubIndex;
|
|
68
|
-
const findTargetNode = (node, subIndex) => {
|
|
69
|
-
if ((void 0 === sourceSubIndex || void 0 === targetSubIndex) && (node.level === level && (node.startInTotal === sourceIndex && (sourceSubIndex = subIndex),
|
|
70
|
-
node.startInTotal <= targetIndex && targetIndex <= node.startInTotal + node.size - 1 && (targetSubIndex = subIndex)),
|
|
71
|
-
node.children && node.level < level)) {
|
|
72
|
-
parNode = node;
|
|
73
|
-
for (let i = 0; i < node.children.length; i++) (sourceIndex >= node.children[i].startInTotal && sourceIndex <= node.children[i].startInTotal + node.children[i].size || targetIndex >= node.children[i].startInTotal && targetIndex <= node.children[i].startInTotal + node.children[i].size) && findTargetNode(node.children[i], i);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
findTargetNode(this.tree, 0);
|
|
77
|
-
const sourceColumns = parNode.children.splice(sourceSubIndex, 1);
|
|
78
|
-
sourceColumns.unshift(targetSubIndex, 0), Array.prototype.splice.apply(parNode.children, sourceColumns);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
9
|
+
exports.sharedVar = {
|
|
10
|
+
seqId: 0
|
|
11
|
+
};
|
|
81
12
|
|
|
82
|
-
let
|
|
13
|
+
let colIndex = 0;
|
|
83
14
|
|
|
84
15
|
class PivotHeaderLayoutMap {
|
|
85
|
-
constructor(table) {
|
|
86
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
16
|
+
constructor(table, dataset) {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
87
18
|
if (this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
|
|
88
19
|
this._cornerHeaderCellIds = [], this._columnHeaderCellIds = [], this._rowHeaderCellIds = [],
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
97
|
-
this.
|
|
98
|
-
this.
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
20
|
+
this._rowHeaderCellIds_FULL = [], this._columnWidths = [], this.columnPaths = [],
|
|
21
|
+
this._headerObjects = [], this._headerObjectMap = {}, this._indicators = [], this.indicatorsAsCol = !0,
|
|
22
|
+
this.hideIndicatorName = !1, this._showRowHeader = !0, this._showColumnHeader = !0,
|
|
23
|
+
this._indicatorShowType = "column", this.rowDimensionKeys = [], this.colDimensionKeys = [],
|
|
24
|
+
this.indicatorKeys = [], this.indicatorDimensionKey = global_1.IndicatorDimensionKeyPlaceholder,
|
|
25
|
+
this._rowHeaderExtensionTree = {}, this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [],
|
|
26
|
+
this._table = table, "tree" === table.options.rowHierarchyType && (this.extensionRows = table.options.extensionRows),
|
|
27
|
+
this.dataset = dataset, this._cellRangeMap = new Map, this._CellHeaderPathMap = new Map,
|
|
28
|
+
this.rowTree = table.internalProps.rowTree, this.columnTree = table.internalProps.columnTree,
|
|
29
|
+
this.rowsDefine = null !== (_a = table.internalProps.rows) && void 0 !== _a ? _a : [],
|
|
30
|
+
this.columnsDefine = null !== (_b = table.internalProps.columns) && void 0 !== _b ? _b : [],
|
|
31
|
+
this.indicatorsDefine = null !== (_c = table.internalProps.indicators) && void 0 !== _c ? _c : [],
|
|
32
|
+
this.indicatorTitle = table.options.indicatorTitle, this.indicatorsAsCol = null === (_d = table.options.indicatorsAsCol) || void 0 === _d || _d,
|
|
33
|
+
this.hideIndicatorName = null !== (_e = table.options.hideIndicatorName) && void 0 !== _e && _e,
|
|
34
|
+
this.showRowHeader = null === (_f = table.options.showRowHeader) || void 0 === _f || _f,
|
|
35
|
+
this.showColumnHeader = null === (_g = table.options.showColumnHeader) || void 0 === _g || _g,
|
|
101
36
|
this.rowHeaderTitle = table.options.rowHeaderTitle, this.columnHeaderTitle = table.options.columnHeaderTitle,
|
|
102
|
-
this.rowHierarchyType = null !== (
|
|
103
|
-
this.rowExpandLevel = null !== (
|
|
104
|
-
this.rowHierarchyIndent = null !== (
|
|
105
|
-
this.cornerSetting = null !== (
|
|
37
|
+
this.rowHierarchyType = null !== (_h = table.options.rowHierarchyType) && void 0 !== _h ? _h : "grid",
|
|
38
|
+
this.rowExpandLevel = null !== (_j = table.options.rowExpandLevel) && void 0 !== _j ? _j : 1,
|
|
39
|
+
this.rowHierarchyIndent = null !== (_k = table.options.rowHierarchyIndent) && void 0 !== _k ? _k : 20,
|
|
40
|
+
this.cornerSetting = null !== (_l = table.options.corner) && void 0 !== _l ? _l : {
|
|
106
41
|
titleOnDimension: "column"
|
|
107
|
-
},
|
|
42
|
+
}, dataset && (this.rowTree = dataset.rowHeaderTree, this.columnTree = dataset.colHeaderTree,
|
|
43
|
+
this.indicatorsAsCol)) {
|
|
44
|
+
const supplyAxisNode = nodes => {
|
|
45
|
+
nodes.forEach((node => {
|
|
46
|
+
var _a;
|
|
47
|
+
(null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? supplyAxisNode(node.children) : node.children = [ {
|
|
48
|
+
dimensionKey: "axis",
|
|
49
|
+
value: ""
|
|
50
|
+
} ];
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
(null === (_m = this.rowTree) || void 0 === _m ? void 0 : _m.length) ? supplyAxisNode(this.rowTree) : this.rowTree = [ {
|
|
54
|
+
dimensionKey: "axis",
|
|
55
|
+
value: ""
|
|
56
|
+
} ];
|
|
57
|
+
}
|
|
58
|
+
if (null === (_o = this.indicatorsDefine) || void 0 === _o || _o.forEach((indicator => {
|
|
108
59
|
"string" == typeof indicator ? this.indicatorKeys.push(indicator) : this.indicatorKeys.push(indicator.indicatorKey);
|
|
109
|
-
})), this.columnDimensionTree = new DimensionTree(null !== (
|
|
110
|
-
this.rowDimensionTree = new DimensionTree(null !== (
|
|
60
|
+
})), this.columnDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : []),
|
|
61
|
+
this.rowDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_q = this.rowTree) && void 0 !== _q ? _q : [], this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
|
|
111
62
|
this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr(), this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr(),
|
|
112
|
-
this.
|
|
113
|
-
this.columnDimensionTree.tree.children && (this.columnHeaderObjs = this._addHeaders(this._columnHeaderCellIds, 0, this.columnDimensionTree.tree.children, []),
|
|
63
|
+
this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys),
|
|
64
|
+
(null === (_r = this.columnDimensionTree.tree.children) || void 0 === _r ? void 0 : _r.length) >= 1 && (this.columnHeaderObjs = this._addHeaders(this._columnHeaderCellIds, 0, this.columnDimensionTree.tree.children, []),
|
|
114
65
|
this.columnHeaderTitle)) {
|
|
115
|
-
const id = ++seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
|
|
66
|
+
const id = ++exports.sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
|
|
116
67
|
this._columnHeaderCellIds.unshift(firstRowIds);
|
|
117
68
|
const cell = {
|
|
118
69
|
id: id,
|
|
119
70
|
title: "string" == typeof this.columnHeaderTitle.title ? this.columnHeaderTitle.title : this.columnsDefine.reduce(((title, value) => "string" == typeof value ? title : title + (title ? `/${value.title}` : `${value.title}`)), ""),
|
|
120
71
|
field: void 0,
|
|
121
|
-
headerType: null !== (
|
|
72
|
+
headerType: null !== (_s = this.columnHeaderTitle.headerType) && void 0 !== _s ? _s : "text",
|
|
122
73
|
style: this.columnHeaderTitle.headerStyle,
|
|
123
74
|
define: {
|
|
124
75
|
id: id
|
|
@@ -126,15 +77,15 @@ class PivotHeaderLayoutMap {
|
|
|
126
77
|
};
|
|
127
78
|
this.columnHeaderObjs.push(cell), this._headerObjects[id] = cell;
|
|
128
79
|
}
|
|
129
|
-
if (colIndex = 0, this.rowDimensionTree.tree.children && (this.rowHeaderObjs = "tree" === this.rowHierarchyType ? this._addHeadersForTreeMode(this.
|
|
80
|
+
if (colIndex = 0, (null === (_t = this.rowDimensionTree.tree.children) || void 0 === _t ? void 0 : _t.length) >= 1 && (this.rowHeaderObjs = "tree" === this.rowHierarchyType ? this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine) : this._addHeaders(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [])),
|
|
130
81
|
this.rowHeaderTitle) {
|
|
131
|
-
const id = ++seqId, firstColIds = Array(this.
|
|
132
|
-
this.
|
|
82
|
+
const id = ++exports.sharedVar.seqId, firstColIds = Array(null !== (_v = null === (_u = this._rowHeaderCellIds_FULL[0]) || void 0 === _u ? void 0 : _u.length) && void 0 !== _v ? _v : this.rowDimensionTree.tree.size).fill(id);
|
|
83
|
+
this._rowHeaderCellIds_FULL.unshift(firstColIds);
|
|
133
84
|
const cell = {
|
|
134
85
|
id: id,
|
|
135
86
|
title: "string" == typeof this.rowHeaderTitle.title ? this.rowHeaderTitle.title : this.rowsDefine.reduce(((title, value) => "string" == typeof value ? title : title + (title ? `/${value.title}` : `${value.title}`)), ""),
|
|
136
87
|
field: void 0,
|
|
137
|
-
headerType: null !== (
|
|
88
|
+
headerType: null !== (_w = this.rowHeaderTitle.headerType) && void 0 !== _w ? _w : "text",
|
|
138
89
|
style: this.rowHeaderTitle.headerStyle,
|
|
139
90
|
define: {
|
|
140
91
|
id: id
|
|
@@ -142,10 +93,35 @@ class PivotHeaderLayoutMap {
|
|
|
142
93
|
};
|
|
143
94
|
this.rowHeaderObjs.push(cell), this._headerObjects[id] = cell;
|
|
144
95
|
}
|
|
145
|
-
|
|
146
|
-
|
|
96
|
+
if (this._rowHeaderCellIds_FULL = (0, util_1.transpose)(this._rowHeaderCellIds_FULL),
|
|
97
|
+
"tree" === table.options.rowHierarchyType && (null === (_x = this.extensionRows) || void 0 === _x ? void 0 : _x.length) >= 1 && (this.generateExtensionRowTree(),
|
|
98
|
+
this.extensionRows.forEach((extensionRow => {
|
|
99
|
+
const rowKeys = [];
|
|
100
|
+
extensionRow.rows.forEach((row => {
|
|
101
|
+
"string" == typeof row ? rowKeys.push(row) : rowKeys.push(row.dimensionKey);
|
|
102
|
+
})), this._extensionRowDimensionKeys.push(rowKeys), this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(rowKeys);
|
|
103
|
+
}))), "column" === this.cornerSetting.titleOnDimension) this.cornerHeaderObjs = this._addCornerHeaders(this.columnHeaderTitle ? [ "" ].concat(this.colDimensionKeys) : this.colDimensionKeys, this.columnsDefine); else if ("row" === this.cornerSetting.titleOnDimension) if ("tree" === this.rowHierarchyType && (null === (_y = this.extensionRows) || void 0 === _y ? void 0 : _y.length) >= 1) {
|
|
104
|
+
const rowTreeFirstKey = [];
|
|
105
|
+
rowTreeFirstKey.push(this.rowDimensionKeys[0]), this._extensionRowDimensionKeys.forEach((extensionRowKeys => {
|
|
106
|
+
rowTreeFirstKey.push(extensionRowKeys[0]);
|
|
107
|
+
}));
|
|
108
|
+
const extensionRowDimensions = this.extensionRows.reduce(((dimensions, cur) => dimensions.concat(cur.rows)), []);
|
|
109
|
+
this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(rowTreeFirstKey) : rowTreeFirstKey, this.rowsDefine.concat(extensionRowDimensions));
|
|
110
|
+
} else this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(this.rowDimensionKeys) : this.rowDimensionKeys, this.rowsDefine); else this.cornerHeaderObjs = this._addCornerHeaders(null, void 0);
|
|
111
|
+
colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
|
|
147
112
|
o)), {}), this.indicatorsAsCol && !this.hideIndicatorName ? this._indicatorShowType = "column" : this.indicatorsAsCol || this.hideIndicatorName ? this._indicatorShowType = "none" : this._indicatorShowType = "row",
|
|
148
|
-
this.
|
|
113
|
+
this.setPagination(table.options.pagination), this._table.isPivotChart() && (this.hasTwoIndicatorAxes = this._indicators.some((indicatorObject => !!(indicatorObject.chartSpec && indicatorObject.chartSpec.series && indicatorObject.chartSpec.series.length > 1))),
|
|
114
|
+
this._chartItemSpanSize = 0, this._chartItemBandSize = 0, this._indicators.find((indicatorObject => {
|
|
115
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
116
|
+
(null === (_a = null == indicatorObject ? void 0 : indicatorObject.style) || void 0 === _a ? void 0 : _a.padding) && (this._chartPadding = indicatorObject.style.padding),
|
|
117
|
+
(null === (_b = indicatorObject.chartSpec) || void 0 === _b ? void 0 : _b.barWidth) && (this._chartItemSpanSize = null === (_c = indicatorObject.chartSpec) || void 0 === _c ? void 0 : _c.barWidth);
|
|
118
|
+
const bandAxisConfig = null === (_e = null === (_d = indicatorObject.chartSpec) || void 0 === _d ? void 0 : _d.axes) || void 0 === _e ? void 0 : _e.find((axis => "band" === axis.type));
|
|
119
|
+
return (null == bandAxisConfig ? void 0 : bandAxisConfig.bandSize) && (this._chartItemBandSize = null == bandAxisConfig ? void 0 : bandAxisConfig.bandSize,
|
|
120
|
+
this._chartPaddingInner = null !== (_f = (0, vutils_1.isArray)(bandAxisConfig.paddingInner) ? bandAxisConfig.paddingInner[0] : bandAxisConfig.paddingInner) && void 0 !== _f ? _f : 0,
|
|
121
|
+
this._chartPaddingOuter = null !== (_g = (0, vutils_1.isArray)(bandAxisConfig.paddingOuter) ? bandAxisConfig.paddingOuter[0] : bandAxisConfig.paddingOuter) && void 0 !== _g ? _g : 0),
|
|
122
|
+
this._chartItemSpanSize > 0 || (null === (_h = indicatorObject.chartSpec.series) || void 0 === _h || _h.find((seriesObject => (seriesObject.barWidth && (this._chartItemSpanSize = seriesObject.barWidth),
|
|
123
|
+
this._chartItemSpanSize > 0))), !1);
|
|
124
|
+
}))), this.setColumnWidths();
|
|
149
125
|
}
|
|
150
126
|
_addHeaders(_headerCellIds, row, header, roots) {
|
|
151
127
|
const results = [];
|
|
@@ -155,7 +131,7 @@ class PivotHeaderLayoutMap {
|
|
|
155
131
|
const prev = _headerCellIds[row - 1];
|
|
156
132
|
for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
|
|
157
133
|
}(row), header.forEach((hd => {
|
|
158
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
134
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
159
135
|
const id = hd.id, dimensionInfo = null !== (_b = null === (_a = this.rowsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey))) && void 0 !== _b ? _b : null === (_c = this.columnsDefine) || void 0 === _c ? void 0 : _c.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey)), indicatorInfo = null === (_d = this.indicatorsDefine) || void 0 === _d ? void 0 : _d.find((indicator => "string" != typeof indicator && (hd.indicatorKey ? indicator.indicatorKey === hd.indicatorKey : indicator.title === hd.value))), cell = {
|
|
160
136
|
id: id,
|
|
161
137
|
title: null !== (_e = hd.value) && void 0 !== _e ? _e : indicatorInfo.title,
|
|
@@ -179,7 +155,7 @@ class PivotHeaderLayoutMap {
|
|
|
179
155
|
};
|
|
180
156
|
indicatorInfo ? (indicatorInfo.customRender && (hd.customRender = indicatorInfo.customRender),
|
|
181
157
|
(0, util_1.isValid)(null === (_q = this._indicators) || void 0 === _q ? void 0 : _q.find((indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) || null === (_r = this._indicators) || void 0 === _r || _r.push({
|
|
182
|
-
id: ++seqId,
|
|
158
|
+
id: ++exports.sharedVar.seqId,
|
|
183
159
|
indicatorKey: indicatorInfo.indicatorKey,
|
|
184
160
|
field: indicatorInfo.indicatorKey,
|
|
185
161
|
fieldFormat: null == indicatorInfo ? void 0 : indicatorInfo.format,
|
|
@@ -197,20 +173,20 @@ class PivotHeaderLayoutMap {
|
|
|
197
173
|
maxWidth: null == indicatorInfo ? void 0 : indicatorInfo.maxWidth,
|
|
198
174
|
disableColumnResize: null == indicatorInfo ? void 0 : indicatorInfo.disableColumnResize
|
|
199
175
|
})) : hd.indicatorKey && ((0, util_1.isValid)(null === (_u = this._indicators) || void 0 === _u ? void 0 : _u.find((indicator => indicator.indicatorKey === hd.indicatorKey))) || null === (_v = this._indicators) || void 0 === _v || _v.push({
|
|
200
|
-
id: ++seqId,
|
|
176
|
+
id: ++exports.sharedVar.seqId,
|
|
201
177
|
indicatorKey: hd.indicatorKey,
|
|
202
178
|
field: hd.indicatorKey,
|
|
203
179
|
cellType: "text",
|
|
204
180
|
define: Object.assign({}, hd)
|
|
205
181
|
})), results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
|
|
206
182
|
for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
|
|
207
|
-
if (hd.children) this._addHeaders(_headerCellIds, row + 1, null !== (
|
|
183
|
+
if ((null === (_w = hd.children) || void 0 === _w ? void 0 : _w.length) >= 1) this._addHeaders(_headerCellIds, row + 1, null !== (_x = hd.children) && void 0 !== _x ? _x : [], [ ...roots, id ]).forEach((c => results.push(c))); else {
|
|
208
184
|
for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
|
|
209
185
|
colIndex++;
|
|
210
186
|
}
|
|
211
187
|
})), results;
|
|
212
188
|
}
|
|
213
|
-
_addHeadersForTreeMode(_headerCellIds, row, header, roots, totalLevel, show) {
|
|
189
|
+
_addHeadersForTreeMode(_headerCellIds, row, header, roots, totalLevel, show, dimensions) {
|
|
214
190
|
const results = [];
|
|
215
191
|
return _headerCellIds[row] || function(row) {
|
|
216
192
|
const newRow = _headerCellIds[row] = [];
|
|
@@ -218,21 +194,21 @@ class PivotHeaderLayoutMap {
|
|
|
218
194
|
const prev = _headerCellIds[row - 1];
|
|
219
195
|
for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
|
|
220
196
|
}(row), header.forEach((hd => {
|
|
221
|
-
var _a, _b, _c, _d
|
|
222
|
-
const id = hd.id, dimensionInfo =
|
|
197
|
+
var _a, _b, _c, _d;
|
|
198
|
+
const id = hd.id, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey)), cell = {
|
|
223
199
|
id: id,
|
|
224
200
|
title: hd.value,
|
|
225
201
|
field: hd.dimensionKey,
|
|
226
202
|
style: hd.level + 1 === totalLevel || "function" == typeof (null == dimensionInfo ? void 0 : dimensionInfo.headerStyle) ? null == dimensionInfo ? void 0 : dimensionInfo.headerStyle : Object.assign({}, null == dimensionInfo ? void 0 : dimensionInfo.headerStyle, {
|
|
227
203
|
textAlign: "left"
|
|
228
204
|
}),
|
|
229
|
-
headerType: null !== (
|
|
205
|
+
headerType: null !== (_a = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _a ? _a : "text",
|
|
230
206
|
headerIcon: null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
|
|
231
207
|
define: Object.assign(hd, {
|
|
232
208
|
linkJump: null == dimensionInfo ? void 0 : dimensionInfo.linkJump,
|
|
233
209
|
linkDetect: null == dimensionInfo ? void 0 : dimensionInfo.linkDetect,
|
|
234
210
|
templateLink: null == dimensionInfo ? void 0 : dimensionInfo.templateLink,
|
|
235
|
-
keepAspectRatio: null !== (
|
|
211
|
+
keepAspectRatio: null !== (_b = null == dimensionInfo ? void 0 : dimensionInfo.keepAspectRatio) && void 0 !== _b && _b,
|
|
236
212
|
imageAutoSizing: null == dimensionInfo ? void 0 : dimensionInfo.imageAutoSizing,
|
|
237
213
|
headerCustomRender: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomRender,
|
|
238
214
|
headerCustomLayout: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomLayout,
|
|
@@ -250,28 +226,29 @@ class PivotHeaderLayoutMap {
|
|
|
250
226
|
hierarchyState: hd.level + 1 === totalLevel ? void 0 : hd.hierarchyState,
|
|
251
227
|
width: null == dimensionInfo ? void 0 : dimensionInfo.width,
|
|
252
228
|
minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
|
|
253
|
-
maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth
|
|
229
|
+
maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
|
|
230
|
+
parentCellId: roots[roots.length - 1]
|
|
254
231
|
};
|
|
255
232
|
results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
|
|
256
233
|
for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
|
|
257
|
-
if (hd.hierarchyState === ts_types_1.HierarchyState.expand && hd.children) show && colIndex++,
|
|
258
|
-
this._addHeadersForTreeMode(_headerCellIds, row, null !== (
|
|
234
|
+
if (hd.hierarchyState === ts_types_1.HierarchyState.expand && (null === (_c = hd.children) || void 0 === _c ? void 0 : _c.length) >= 1) show && colIndex++,
|
|
235
|
+
this._addHeadersForTreeMode(_headerCellIds, row, null !== (_d = hd.children) && void 0 !== _d ? _d : [], [ ...roots, id ], totalLevel, show && hd.hierarchyState === ts_types_1.HierarchyState.expand, dimensions).forEach((c => results.push(c))); else {
|
|
259
236
|
show && colIndex++;
|
|
260
237
|
for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
|
|
261
238
|
}
|
|
262
239
|
})), results;
|
|
263
240
|
}
|
|
264
|
-
_addCornerHeaders(dimensionKeys) {
|
|
241
|
+
_addCornerHeaders(dimensionKeys, dimensions) {
|
|
265
242
|
var _a;
|
|
266
243
|
const results = [];
|
|
267
244
|
if (dimensionKeys) dimensionKeys.forEach(((dimensionKey, key) => {
|
|
268
|
-
var _a, _b
|
|
269
|
-
const id = ++seqId, dimensionInfo =
|
|
245
|
+
var _a, _b;
|
|
246
|
+
const id = ++exports.sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
|
|
270
247
|
id: id,
|
|
271
|
-
title: dimensionKey === this.indicatorDimensionKey ? this.indicatorTitle :
|
|
248
|
+
title: dimensionKey === this.indicatorDimensionKey ? this.indicatorTitle : dimensionInfo ? dimensionInfo.title : "axis" === dimensionKey ? "" : dimensionKey,
|
|
272
249
|
field: "维度名称",
|
|
273
250
|
style: this.cornerSetting.headerStyle,
|
|
274
|
-
headerType: null !== (
|
|
251
|
+
headerType: null !== (_a = this.cornerSetting.headerType) && void 0 !== _a ? _a : "text",
|
|
275
252
|
define: {
|
|
276
253
|
dimensionKey: "维度名称",
|
|
277
254
|
id: id,
|
|
@@ -279,7 +256,7 @@ class PivotHeaderLayoutMap {
|
|
|
279
256
|
},
|
|
280
257
|
dropDownMenu: null == dimensionInfo ? void 0 : dimensionInfo.cornerDropDownMenu,
|
|
281
258
|
pivotInfo: {
|
|
282
|
-
value: null !== (
|
|
259
|
+
value: null !== (_b = null == dimensionInfo ? void 0 : dimensionInfo.title) && void 0 !== _b ? _b : "",
|
|
283
260
|
dimensionKey: dimensionKey,
|
|
284
261
|
isPivotCorner: !0
|
|
285
262
|
},
|
|
@@ -291,7 +268,7 @@ class PivotHeaderLayoutMap {
|
|
|
291
268
|
} else if ("row" === this.cornerSetting.titleOnDimension) for (let r = 0; r < this.columnHeaderLevelCount; r++) this._cornerHeaderCellIds[r] || (this._cornerHeaderCellIds[r] = []),
|
|
292
269
|
this._cornerHeaderCellIds[r][key] = id;
|
|
293
270
|
})); else {
|
|
294
|
-
const id = ++seqId, cell = {
|
|
271
|
+
const id = ++exports.sharedVar.seqId, cell = {
|
|
295
272
|
id: id,
|
|
296
273
|
title: "",
|
|
297
274
|
field: "维度名称",
|
|
@@ -309,11 +286,55 @@ class PivotHeaderLayoutMap {
|
|
|
309
286
|
}
|
|
310
287
|
return results;
|
|
311
288
|
}
|
|
289
|
+
generateExtensionRowTree() {
|
|
290
|
+
this.extensionRows.forEach(((extensionRow, indexP) => {
|
|
291
|
+
const old_rowHeaderCellIds = this._rowHeaderCellIds_FULL;
|
|
292
|
+
this._rowHeaderCellIds_FULL = [], old_rowHeaderCellIds.forEach(((row_ids, index) => {
|
|
293
|
+
const key = row_ids[row_ids.length - 1];
|
|
294
|
+
let tree, rowExtensionDimensionTree;
|
|
295
|
+
if (colIndex = 0, "function" == typeof extensionRow.rowTree) {
|
|
296
|
+
const fullCellIds = this.findFullCellIds(row_ids);
|
|
297
|
+
tree = extensionRow.rowTree(fullCellIds.map((id => ({
|
|
298
|
+
dimensionKey: this._headerObjects[id].field,
|
|
299
|
+
value: this._headerObjects[id].title
|
|
300
|
+
}))));
|
|
301
|
+
} else tree = (0, vutils_1.cloneDeep)(extensionRow.rowTree);
|
|
302
|
+
this._rowHeaderExtensionTree[key] ? (this._rowHeaderExtensionTree[key].reset(this._rowHeaderExtensionTree[key].tree.children, !0),
|
|
303
|
+
rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new pivot_layout_helper_1.DimensionTree(null != tree ? tree : [], this.rowHierarchyType, void 0),
|
|
304
|
+
this._rowHeaderExtensionTree[key] = rowExtensionDimensionTree);
|
|
305
|
+
const extensionRowTreeHeaderIds = [];
|
|
306
|
+
this._addHeadersForTreeMode(extensionRowTreeHeaderIds, 0, rowExtensionDimensionTree.tree.children, [], rowExtensionDimensionTree.totalLevel, !0, extensionRow.rows);
|
|
307
|
+
for (let i = 0; i < extensionRowTreeHeaderIds[0].length; i++) this._rowHeaderCellIds_FULL.push(row_ids.concat(extensionRowTreeHeaderIds[0][i]));
|
|
308
|
+
}));
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
312
311
|
setColumnWidths() {
|
|
313
|
-
var _a;
|
|
312
|
+
var _a, _b, _c;
|
|
314
313
|
const returnWidths = new Array(this.colCount).fill(void 0);
|
|
315
|
-
if (this.showHeader && this.showRowHeader
|
|
316
|
-
this.
|
|
314
|
+
if (this.showHeader && this.showRowHeader) if (this.rowHeaderTitle && (returnWidths[0] = {}),
|
|
315
|
+
"tree" === this.rowHierarchyType) {
|
|
316
|
+
const mainDimensionFirstRowKey = this.rowDimensionKeys[0];
|
|
317
|
+
if (mainDimensionFirstRowKey) {
|
|
318
|
+
const dimension = null === (_a = this.rowsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === mainDimensionFirstRowKey));
|
|
319
|
+
dimension && (returnWidths[0 + (this.rowHeaderTitle ? 1 : 0)] = {
|
|
320
|
+
width: dimension.width,
|
|
321
|
+
minWidth: dimension.minWidth,
|
|
322
|
+
maxWidth: dimension.maxWidth
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
null === (_b = this._extensionRowDimensionKeys) || void 0 === _b || _b.forEach(((extensionRowDimensionKeys, index) => {
|
|
326
|
+
var _a;
|
|
327
|
+
const curDimensionFirstRowKey = extensionRowDimensionKeys[0];
|
|
328
|
+
if (curDimensionFirstRowKey) {
|
|
329
|
+
const dimension = null === (_a = this.extensionRows[index].rows) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === curDimensionFirstRowKey));
|
|
330
|
+
dimension && (returnWidths[index + 1 + (this.rowHeaderTitle ? 1 : 0)] = {
|
|
331
|
+
width: dimension.width,
|
|
332
|
+
minWidth: dimension.minWidth,
|
|
333
|
+
maxWidth: dimension.maxWidth
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}));
|
|
337
|
+
} else this.rowDimensionKeys.forEach(((objKey, index) => {
|
|
317
338
|
var _a;
|
|
318
339
|
const dimension = null === (_a = this.rowsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === objKey));
|
|
319
340
|
dimension && (returnWidths[index + (this.rowHeaderTitle ? 1 : 0)] = {
|
|
@@ -321,7 +342,8 @@ class PivotHeaderLayoutMap {
|
|
|
321
342
|
minWidth: dimension.minWidth,
|
|
322
343
|
maxWidth: dimension.maxWidth
|
|
323
344
|
});
|
|
324
|
-
}))
|
|
345
|
+
}));
|
|
346
|
+
if (this.indicatorsAsCol) for (let i = this.rowHeaderLevelCount; i < this.colCount; i++) {
|
|
325
347
|
const cellDefine = this.getBody(i, this.columnHeaderLevelCount);
|
|
326
348
|
returnWidths[i] = {
|
|
327
349
|
width: null == cellDefine ? void 0 : cellDefine.width,
|
|
@@ -330,7 +352,7 @@ class PivotHeaderLayoutMap {
|
|
|
330
352
|
};
|
|
331
353
|
} else {
|
|
332
354
|
let maxWidth, minWidth, isAuto, width = 0;
|
|
333
|
-
null === (
|
|
355
|
+
null === (_c = this._indicators) || void 0 === _c || _c.forEach(((obj, index) => {
|
|
334
356
|
"number" == typeof obj.width ? width = Math.max(obj.width, width) : "auto" === obj.width && (isAuto = !0),
|
|
335
357
|
"number" == typeof obj.minWidth && (minWidth = Math.max(obj.minWidth, minWidth)),
|
|
336
358
|
"number" == typeof obj.maxWidth && (maxWidth = Math.max(obj.maxWidth, maxWidth));
|
|
@@ -338,7 +360,7 @@ class PivotHeaderLayoutMap {
|
|
|
338
360
|
width: width,
|
|
339
361
|
minWidth: minWidth,
|
|
340
362
|
maxWidth: maxWidth
|
|
341
|
-
}, this.rowHeaderLevelCount, this.colCount);
|
|
363
|
+
}, this.rowHeaderLevelCount, this.colCount - this.rightFrozenColCount);
|
|
342
364
|
}
|
|
343
365
|
this._columnWidths = returnWidths;
|
|
344
366
|
}
|
|
@@ -462,34 +484,46 @@ class PivotHeaderLayoutMap {
|
|
|
462
484
|
return this.columnHeaderLevelCount;
|
|
463
485
|
}
|
|
464
486
|
get columnHeaderLevelCount() {
|
|
487
|
+
var _a, _b;
|
|
465
488
|
if (this.showHeader && this.showColumnHeader) {
|
|
489
|
+
if (this._table.isPivotChart() && this.indicatorsAsCol && !(null === (_b = null === (_a = this.dataset) || void 0 === _a ? void 0 : _a.colKeys) || void 0 === _b ? void 0 : _b.length) && !this.hasTwoIndicatorAxes) return 0;
|
|
466
490
|
let count = this.indicatorsAsCol && this.hideIndicatorName && this.colDimensionKeys[this.colDimensionKeys.length - 1] === this.indicatorDimensionKey ? this.columnDimensionTree.totalLevel - 1 : this.columnDimensionTree.totalLevel;
|
|
467
491
|
return this.columnHeaderTitle && (count += 1), count;
|
|
468
492
|
}
|
|
469
493
|
return 0;
|
|
470
494
|
}
|
|
471
495
|
get rowHeaderLevelCount() {
|
|
496
|
+
var _a, _b;
|
|
472
497
|
if (this.showHeader && this.showRowHeader) {
|
|
473
|
-
if ("tree" === this.rowHierarchyType)
|
|
474
|
-
|
|
498
|
+
if ("tree" === this.rowHierarchyType) {
|
|
499
|
+
const extensionRowCount = null !== (_b = null === (_a = this.extensionRows) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
500
|
+
return this.rowHeaderTitle ? 2 + extensionRowCount : 1 + extensionRowCount;
|
|
501
|
+
}
|
|
502
|
+
const rowLevelCount = this.rowDimensionKeys.length;
|
|
503
|
+
let count = this.indicatorsAsCol ? rowLevelCount : this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey ? rowLevelCount - 1 : rowLevelCount;
|
|
475
504
|
return this.rowHeaderTitle && (count += 1), count;
|
|
476
505
|
}
|
|
477
|
-
return 0;
|
|
506
|
+
return this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
|
|
478
507
|
}
|
|
479
508
|
get colCount() {
|
|
480
509
|
return this.columnDimensionTree.tree.size + this.rowHeaderLevelCount + this.rightFrozenColCount;
|
|
481
510
|
}
|
|
482
511
|
get rowCount() {
|
|
483
|
-
return this.
|
|
512
|
+
return Math.max(this._rowHeaderCellIds.length, 1) + this.columnHeaderLevelCount + this.bottomFrozenRowCount;
|
|
484
513
|
}
|
|
485
514
|
get bodyRowCount() {
|
|
486
515
|
return this.rowDimensionTree.tree.size;
|
|
487
516
|
}
|
|
488
517
|
get bottomFrozenRowCount() {
|
|
489
|
-
|
|
518
|
+
if (!this._table.isPivotChart()) return 0;
|
|
519
|
+
const axisOption = this._table.pivotChartAxes.find((axisOption => "bottom" === axisOption.orient));
|
|
520
|
+
return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : (this.indicatorsAsCol,
|
|
521
|
+
1);
|
|
490
522
|
}
|
|
491
523
|
get rightFrozenColCount() {
|
|
492
|
-
|
|
524
|
+
if (!this._table.isPivotChart()) return 0;
|
|
525
|
+
const axisOption = this._table.pivotChartAxes.find((axisOption => "right" === axisOption.orient));
|
|
526
|
+
return !1 === (null == axisOption ? void 0 : axisOption.visible) || this.indicatorsAsCol ? 0 : this.hasTwoIndicatorAxes ? 1 : 0;
|
|
493
527
|
}
|
|
494
528
|
get headerObjects() {
|
|
495
529
|
return this._headerObjects;
|
|
@@ -508,15 +542,21 @@ class PivotHeaderLayoutMap {
|
|
|
508
542
|
}
|
|
509
543
|
}
|
|
510
544
|
getHeader(col, row) {
|
|
545
|
+
var _a;
|
|
511
546
|
const id = this.getCellId(col, row);
|
|
512
|
-
return this._headerObjectMap[id]
|
|
547
|
+
return null !== (_a = this._headerObjectMap[id]) && void 0 !== _a ? _a : {
|
|
548
|
+
id: void 0,
|
|
549
|
+
field: "",
|
|
550
|
+
headerType: "text",
|
|
551
|
+
define: void 0
|
|
552
|
+
};
|
|
513
553
|
}
|
|
514
554
|
getHeaderField(col, row) {
|
|
515
555
|
var _a, _b;
|
|
516
556
|
const id = this.getCellId(col, row);
|
|
517
557
|
return (null === (_a = this._headerObjectMap[id]) || void 0 === _a ? void 0 : _a.field) || (null === (_b = this.getBody(col, row)) || void 0 === _b ? void 0 : _b.field);
|
|
518
558
|
}
|
|
519
|
-
|
|
559
|
+
getHeaderCellAdressById(id) {
|
|
520
560
|
for (let i = 0; i < this._columnHeaderCellIds.length; i++) {
|
|
521
561
|
const row = this._columnHeaderCellIds[i];
|
|
522
562
|
for (let j = 0; j < row.length; j++) if (row[j] === id) return {
|
|
@@ -541,7 +581,7 @@ class PivotHeaderLayoutMap {
|
|
|
541
581
|
}
|
|
542
582
|
getHeaderCellAddressByField(field) {
|
|
543
583
|
const hd = this.headerObjects.find((col => col && col.field === field));
|
|
544
|
-
return this.
|
|
584
|
+
return this.getHeaderCellAdressById(hd.id);
|
|
545
585
|
}
|
|
546
586
|
getBody(_col, _row) {
|
|
547
587
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -565,33 +605,8 @@ class PivotHeaderLayoutMap {
|
|
|
565
605
|
define: void 0
|
|
566
606
|
};
|
|
567
607
|
}
|
|
568
|
-
getBodyLayoutRangeById(id) {
|
|
569
|
-
var _a;
|
|
570
|
-
for (let col = 0; col < (null !== (_a = this.colCount) && void 0 !== _a ? _a : 0); col++) if (id === this.columnObjects[col].id) return {
|
|
571
|
-
start: {
|
|
572
|
-
col: col,
|
|
573
|
-
row: 0
|
|
574
|
-
},
|
|
575
|
-
end: {
|
|
576
|
-
col: col,
|
|
577
|
-
row: 0
|
|
578
|
-
}
|
|
579
|
-
};
|
|
580
|
-
throw new Error(`can not found body layout @id=${id}`);
|
|
581
|
-
}
|
|
582
608
|
getCellRange(col, row) {
|
|
583
609
|
var _a, _b;
|
|
584
|
-
if (-1 === col || -1 === row) return {
|
|
585
|
-
start: {
|
|
586
|
-
col: col,
|
|
587
|
-
row: row
|
|
588
|
-
},
|
|
589
|
-
end: {
|
|
590
|
-
col: col,
|
|
591
|
-
row: row
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
if (this._cellRangeMap.has(`${col}-${row}`)) return this._cellRangeMap.get(`${col}-${row}`);
|
|
595
610
|
const result = {
|
|
596
611
|
start: {
|
|
597
612
|
col: col,
|
|
@@ -602,6 +617,9 @@ class PivotHeaderLayoutMap {
|
|
|
602
617
|
row: row
|
|
603
618
|
}
|
|
604
619
|
};
|
|
620
|
+
if (!this.isHeader(col, row) || -1 === col || -1 === row || this.isIndicatorHeader(col, row)) return result;
|
|
621
|
+
if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) return result;
|
|
622
|
+
if (this._cellRangeMap.has(`${col}-${row}`)) return this._cellRangeMap.get(`${col}-${row}`);
|
|
605
623
|
if (this.isHeader(col, row) && -1 !== col && -1 !== row) {
|
|
606
624
|
const id = this.getCellId(col, row);
|
|
607
625
|
for (let c = col - 1; c >= 0 && id === this.getCellId(c, row); c--) result.start.col = c;
|
|
@@ -626,12 +644,25 @@ class PivotHeaderLayoutMap {
|
|
|
626
644
|
}
|
|
627
645
|
getCellHeaderPathsWidthTreeNode(col, row) {
|
|
628
646
|
if (this._CellHeaderPathMap.has(`${col}-${row}`)) return this._CellHeaderPathMap.get(`${col}-${row}`);
|
|
629
|
-
const recordCol = this.getRecordIndexByCol(col), recordRow = this.getRecordIndexByRow(row);
|
|
647
|
+
const recordCol = this.getRecordIndexByCol(col), recordRow = this.getRecordIndexByRow(row) + this.currentPageStartIndex;
|
|
630
648
|
let colPath, rowPath;
|
|
631
|
-
if (
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
649
|
+
if (row >= 0 && recordCol >= 0 && (colPath = this.columnDimensionTree.getTreePath(recordCol, this.showHeader && this.showColumnHeader ? row - (this.columnHeaderTitle ? 1 : 0) : this.columnDimensionTree.totalLevel)),
|
|
650
|
+
col >= 0 && recordRow >= 0) if ("tree" === this.rowHierarchyType) {
|
|
651
|
+
rowPath = [];
|
|
652
|
+
const row_pathIds = this._rowHeaderCellIds[recordRow];
|
|
653
|
+
let findTree = this.rowDimensionTree, level = 0;
|
|
654
|
+
for (;findTree; ) {
|
|
655
|
+
const pathIds = [];
|
|
656
|
+
let cellId = row_pathIds[level];
|
|
657
|
+
for (pathIds.push(cellId); ;) {
|
|
658
|
+
const hd = this._headerObjectMap[cellId];
|
|
659
|
+
if (!(null == hd ? void 0 : hd.parentCellId)) break;
|
|
660
|
+
pathIds.unshift(hd.parentCellId), cellId = hd.parentCellId;
|
|
661
|
+
}
|
|
662
|
+
const findedRowPath = findTree.getTreePathByCellIds(pathIds);
|
|
663
|
+
rowPath = rowPath.concat(findedRowPath), findTree = this._rowHeaderExtensionTree[row_pathIds[level]],
|
|
664
|
+
level++;
|
|
665
|
+
}
|
|
635
666
|
} else rowPath = this.rowDimensionTree.getTreePath(recordRow, this.showHeader && this.showRowHeader ? col - (this.rowHeaderTitle ? 1 : 0) : this.rowDimensionTree.totalLevel);
|
|
636
667
|
const p = {
|
|
637
668
|
colHeaderPaths: colPath,
|
|
@@ -640,28 +671,43 @@ class PivotHeaderLayoutMap {
|
|
|
640
671
|
return this._CellHeaderPathMap.set(`${col}-${row}`, p), p;
|
|
641
672
|
}
|
|
642
673
|
getCellHeaderPaths(col, row) {
|
|
674
|
+
var _a, _b;
|
|
643
675
|
const headerPathsWidthNode = this.getCellHeaderPathsWidthTreeNode(col, row), headerPaths = {
|
|
644
676
|
colHeaderPaths: [],
|
|
645
677
|
rowHeaderPaths: []
|
|
646
678
|
};
|
|
647
|
-
return headerPathsWidthNode.colHeaderPaths.forEach((colHeader => {
|
|
679
|
+
return null === (_a = headerPathsWidthNode.colHeaderPaths) || void 0 === _a || _a.forEach((colHeader => {
|
|
648
680
|
var _a, _b, _c;
|
|
649
681
|
const colHeaderPath = {};
|
|
650
682
|
colHeaderPath.dimensionKey = colHeader.dimensionKey, colHeaderPath.indicatorKey = colHeader.indicatorKey,
|
|
651
683
|
colHeaderPath.value = null !== (_c = null !== (_a = colHeader.value) && void 0 !== _a ? _a : null === (_b = this.getIndicatorInfoByIndicatorKey(colHeader.indicatorKey)) || void 0 === _b ? void 0 : _b.title) && void 0 !== _c ? _c : "",
|
|
652
684
|
headerPaths.colHeaderPaths.push(colHeaderPath);
|
|
653
|
-
})), headerPathsWidthNode.rowHeaderPaths.forEach((rowHeader => {
|
|
685
|
+
})), null === (_b = headerPathsWidthNode.rowHeaderPaths) || void 0 === _b || _b.forEach((rowHeader => {
|
|
654
686
|
var _a, _b, _c;
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
687
|
+
if ("axis" !== rowHeader.dimensionKey) {
|
|
688
|
+
const rowHeaderPath = {};
|
|
689
|
+
rowHeaderPath.dimensionKey = rowHeader.dimensionKey, rowHeaderPath.indicatorKey = rowHeader.indicatorKey,
|
|
690
|
+
rowHeaderPath.value = null !== (_c = null !== (_a = rowHeader.value) && void 0 !== _a ? _a : null === (_b = this.getIndicatorInfoByIndicatorKey(rowHeader.indicatorKey)) || void 0 === _b ? void 0 : _b.title) && void 0 !== _c ? _c : "",
|
|
691
|
+
headerPaths.rowHeaderPaths.push(rowHeaderPath);
|
|
692
|
+
}
|
|
659
693
|
})), headerPaths;
|
|
660
694
|
}
|
|
661
695
|
getIndicatorInfoByIndicatorKey(indicatorKey) {
|
|
662
696
|
var _a;
|
|
663
697
|
return null === (_a = this.indicatorsDefine) || void 0 === _a ? void 0 : _a.find((indicator => "string" != typeof indicator && (!!indicatorKey && indicator.indicatorKey === indicatorKey)));
|
|
664
698
|
}
|
|
699
|
+
findFullCellIds(row_pathIds) {
|
|
700
|
+
const pathIds = [];
|
|
701
|
+
for (let level = 0; level < row_pathIds.length; level++) {
|
|
702
|
+
let cellId = row_pathIds[level];
|
|
703
|
+
for (pathIds.push(cellId); ;) {
|
|
704
|
+
const hd = this._headerObjectMap[cellId];
|
|
705
|
+
if (!(null == hd ? void 0 : hd.parentCellId)) break;
|
|
706
|
+
pathIds.unshift(hd.parentCellId), cellId = hd.parentCellId;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
return pathIds;
|
|
710
|
+
}
|
|
665
711
|
getHeaderDimension(col, row) {
|
|
666
712
|
var _a, _b, _c;
|
|
667
713
|
if (this.isHeader(col, row)) {
|
|
@@ -679,14 +725,17 @@ class PivotHeaderLayoutMap {
|
|
|
679
725
|
return this.isColumnIndicatorHeader(col, row) || this.isRowIndicatorHeader(col, row);
|
|
680
726
|
}
|
|
681
727
|
toggleHierarchyState(col, row) {
|
|
682
|
-
var _a;
|
|
683
|
-
const oldRowHeaderCellIds = this.
|
|
728
|
+
var _a, _b;
|
|
729
|
+
const oldRowHeaderCellIds = this._rowHeaderCellIds_FULL.slice(0), oldRowHeaderCellPositons = oldRowHeaderCellIds.map(((id, row) => ({
|
|
730
|
+
col: col,
|
|
731
|
+
row: row + this.columnHeaderLevelCount
|
|
732
|
+
}))), hd = this.getHeader(col, row);
|
|
684
733
|
if (hd.define.hierarchyState = hd.define.hierarchyState === ts_types_1.HierarchyState.collapse ? ts_types_1.HierarchyState.expand : ts_types_1.HierarchyState.collapse,
|
|
685
|
-
this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this.
|
|
686
|
-
this.rowHeaderObjs = this._addHeadersForTreeMode(this.
|
|
734
|
+
this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this._rowHeaderCellIds_FULL = [],
|
|
735
|
+
this.rowHeaderObjs = this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine),
|
|
687
736
|
this.rowHeaderTitle) {
|
|
688
|
-
const id = ++seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
|
|
689
|
-
this.
|
|
737
|
+
const id = ++exports.sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
|
|
738
|
+
this._rowHeaderCellIds_FULL.unshift(firstColIds);
|
|
690
739
|
const cell = {
|
|
691
740
|
id: id,
|
|
692
741
|
title: "string" == typeof this.rowHeaderTitle.title ? this.rowHeaderTitle.title : this.rowsDefine.reduce(((title, value) => "string" == typeof value ? title : title + (title ? `/${value.title}` : `${value.title}`)), ""),
|
|
@@ -701,9 +750,12 @@ class PivotHeaderLayoutMap {
|
|
|
701
750
|
};
|
|
702
751
|
this.rowHeaderObjs.push(cell), this._headerObjects[id] = cell;
|
|
703
752
|
}
|
|
704
|
-
|
|
705
|
-
this.
|
|
706
|
-
|
|
753
|
+
this._rowHeaderCellIds_FULL = (0, util_1.transpose)(this._rowHeaderCellIds_FULL),
|
|
754
|
+
"tree" === this.rowHierarchyType && (null === (_b = this.extensionRows) || void 0 === _b ? void 0 : _b.length) >= 1 && this.generateExtensionRowTree(),
|
|
755
|
+
colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
|
|
756
|
+
o)), {}), this._CellHeaderPathMap = new Map, this._cellRangeMap = new Map;
|
|
757
|
+
const diffCell = (0, diff_cell_1.diffCellAddress)(col, row, oldRowHeaderCellIds.map((oldCellId => oldCellId[col])), this._rowHeaderCellIds_FULL.map((newCellId => newCellId[col])), oldRowHeaderCellPositons, this);
|
|
758
|
+
return this._rowHeaderCellIds = this._rowHeaderCellIds_FULL, diffCell;
|
|
707
759
|
}
|
|
708
760
|
isHeaderForColWidth(col, row) {
|
|
709
761
|
return this.isHeader(col, row);
|
|
@@ -801,6 +853,17 @@ class PivotHeaderLayoutMap {
|
|
|
801
853
|
getParentCellId(col, row) {
|
|
802
854
|
if (0 !== row) return this.isColumnHeader(col, row) ? this.getCellId(col, row - 1) : this.isRowHeader(col, row) ? this.getCellId(col - 1, row) : void 0;
|
|
803
855
|
}
|
|
856
|
+
getRowHeaderCellAddressByCellId(cellId) {
|
|
857
|
+
let col, row;
|
|
858
|
+
if (this._rowHeaderCellIds.find(((cellIds, rowIndex) => {
|
|
859
|
+
const finded = cellIds.find(((id, colIndex) => id === cellId && (col = colIndex,
|
|
860
|
+
!0)));
|
|
861
|
+
return !!finded && (row = rowIndex, !0);
|
|
862
|
+
})), (0, util_1.isValid)(col) && (0, util_1.isValid)(row)) return {
|
|
863
|
+
col: col,
|
|
864
|
+
row: row + this.columnHeaderLevelCount
|
|
865
|
+
};
|
|
866
|
+
}
|
|
804
867
|
canMoveHeaderPosition(source, target) {
|
|
805
868
|
const sourceCellRange = this.getCellRange(source.col, source.row);
|
|
806
869
|
if (this.isColumnHeader(source.col, source.row)) {
|
|
@@ -811,8 +874,8 @@ class PivotHeaderLayoutMap {
|
|
|
811
874
|
return this.getParentCellId(sourceCellRange.start.col, source.row) === this.getParentCellId(sourceCellRange.start.col, target.row);
|
|
812
875
|
}
|
|
813
876
|
{
|
|
814
|
-
const sourceRowHeaderPaths = (0,
|
|
815
|
-
|
|
877
|
+
const sourceRowHeaderPaths = (0, vutils_1.cloneDeep)(this.getCellHeaderPathsWidthTreeNode(source.col, source.row).rowHeaderPaths), targetRowHeaderPaths = (0,
|
|
878
|
+
vutils_1.cloneDeep)(this.getCellHeaderPathsWidthTreeNode(target.col, target.row).rowHeaderPaths);
|
|
816
879
|
if (sourceRowHeaderPaths.pop(), targetRowHeaderPaths.pop(), sourceRowHeaderPaths.length <= targetRowHeaderPaths.length) return sourceRowHeaderPaths.length !== targetRowHeaderPaths.length || !sourceRowHeaderPaths.find(((item, i) => item.dimensionKey !== targetRowHeaderPaths[i].dimensionKey || item.value !== targetRowHeaderPaths[i].value));
|
|
817
880
|
}
|
|
818
881
|
}
|
|
@@ -826,7 +889,7 @@ class PivotHeaderLayoutMap {
|
|
|
826
889
|
let targetIndex;
|
|
827
890
|
const targetCellRange = this.getCellRange(target.col, sourceCellRange.start.row);
|
|
828
891
|
if (targetIndex = target.col >= source.col ? targetCellRange.end.col - moveSize + 1 : targetCellRange.start.col,
|
|
829
|
-
targetIndex === sourceCellRange.end.col) return null;
|
|
892
|
+
targetIndex === sourceCellRange.end.col - this.rowHeaderLevelCount) return null;
|
|
830
893
|
for (let row = 0; row < this._columnHeaderCellIds.length; row++) {
|
|
831
894
|
const sourceIds = this._columnHeaderCellIds[row].splice(sourceCellRange.start.col - this.rowHeaderLevelCount, moveSize);
|
|
832
895
|
sourceIds.unshift(targetIndex - this.rowHeaderLevelCount, 0), Array.prototype.splice.apply(this._columnHeaderCellIds[row], sourceIds);
|
|
@@ -846,9 +909,11 @@ class PivotHeaderLayoutMap {
|
|
|
846
909
|
let targetIndex;
|
|
847
910
|
const sourceRowHeaderPaths = this.getCellHeaderPathsWidthTreeNode(source.col, source.row).rowHeaderPaths, targetRowHeaderPaths = this.getCellHeaderPathsWidthTreeNode(target.col, target.row).rowHeaderPaths, sourceRowHeaderNode = sourceRowHeaderPaths[sourceRowHeaderPaths.length - 1], targetRowHeaderNode = targetRowHeaderPaths[sourceRowHeaderPaths.length - 1], moveSize = sourceRowHeaderNode.size;
|
|
848
911
|
if (targetIndex = target.row >= source.row ? targetRowHeaderNode.startInTotal + targetRowHeaderNode.size - moveSize : targetRowHeaderNode.startInTotal,
|
|
849
|
-
targetIndex === source.row || targetIndex === sourceCellRange.end.row) return null;
|
|
912
|
+
targetIndex === source.row - this.columnHeaderLevelCount || targetIndex === sourceCellRange.end.row - this.columnHeaderLevelCount) return null;
|
|
850
913
|
const sourceIds = this._rowHeaderCellIds.splice(sourceCellRange.start.row - this.columnHeaderLevelCount, moveSize);
|
|
851
|
-
|
|
914
|
+
sourceIds.unshift(targetIndex - this.currentPageStartIndex, 0), Array.prototype.splice.apply(this._rowHeaderCellIds, sourceIds);
|
|
915
|
+
const sourceIds_FULL = this._rowHeaderCellIds_FULL.splice(sourceCellRange.start.row + this.currentPageStartIndex, moveSize);
|
|
916
|
+
return sourceIds_FULL.unshift(targetIndex, 0), Array.prototype.splice.apply(this._rowHeaderCellIds_FULL, sourceIds_FULL),
|
|
852
917
|
this.rowDimensionTree.movePosition(this.getCellHeaderPathsWidthTreeNode(source.col, source.row).rowHeaderPaths.length - 1, sourceCellRange.start.row - this.columnHeaderLevelCount, targetIndex + (target.row > source.row ? sourceRowHeaderNode.size - 1 : 0)),
|
|
853
918
|
this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this._CellHeaderPathMap = new Map,
|
|
854
919
|
this._cellRangeMap = new Map, {
|
|
@@ -874,7 +939,7 @@ class PivotHeaderLayoutMap {
|
|
|
874
939
|
return this.colDimensionKeys.indexOf(null !== (_a = a.dimensionKey) && void 0 !== _a ? _a : this.indicatorDimensionKey) - this.colDimensionKeys.indexOf(null !== (_b = b.dimensionKey) && void 0 !== _b ? _b : this.indicatorDimensionKey);
|
|
875
940
|
})), null == rowHeaderPaths || rowHeaderPaths.sort(((a, b) => {
|
|
876
941
|
var _a, _b;
|
|
877
|
-
return this.
|
|
942
|
+
return this.fullRowDimensionKeys.indexOf(null !== (_a = a.dimensionKey) && void 0 !== _a ? _a : this.indicatorDimensionKey) - this.fullRowDimensionKeys.indexOf(null !== (_b = b.dimensionKey) && void 0 !== _b ? _b : this.indicatorDimensionKey);
|
|
878
943
|
}));
|
|
879
944
|
let col, row, defaultCol, defaultRow, needLowestLevel = !1;
|
|
880
945
|
(null == colHeaderPaths ? void 0 : colHeaderPaths.length) >= 1 && (null == rowHeaderPaths ? void 0 : rowHeaderPaths.length) >= 1 && (needLowestLevel = !0);
|
|
@@ -890,7 +955,16 @@ class PivotHeaderLayoutMap {
|
|
|
890
955
|
}
|
|
891
956
|
}
|
|
892
957
|
}
|
|
893
|
-
if (
|
|
958
|
+
if ((null == rowHeaderPaths ? void 0 : rowHeaderPaths.length) >= 1) if ("tree" === this.rowHierarchyType) {
|
|
959
|
+
const rowDimension = rowHeaderPaths[rowHeaderPaths.length - 1], cellIDs = this.headerObjects.filter((hd => ((null == hd ? void 0 : hd.field) === rowDimension.dimensionKey || (null == hd ? void 0 : hd.field) === rowDimension.indicatorKey) && (null == hd ? void 0 : hd.title) === rowDimension.value)).map((hd => hd.id)), findedCellIdPath = this._rowHeaderCellIds.filter((rowHdCellIDs => cellIDs.indexOf(rowHdCellIDs[rowHdCellIDs.length - 1]) >= 0)).find((pathIds => {
|
|
960
|
+
const fullCellIds = this.findFullCellIds(pathIds);
|
|
961
|
+
return fullCellIds.length === rowHeaderPaths.length && fullCellIds.every((id => {
|
|
962
|
+
const curHd = this._headerObjectMap[id];
|
|
963
|
+
return rowHeaderPaths.find((rowDimensionPath => rowDimensionPath.dimensionKey === curHd.field && rowDimensionPath.value === curHd.title));
|
|
964
|
+
}));
|
|
965
|
+
}));
|
|
966
|
+
row = this._rowHeaderCellIds.indexOf(findedCellIdPath) + this.columnHeaderLevelCount;
|
|
967
|
+
} else for (let i = 0; i < rowHeaderPaths.length; i++) {
|
|
894
968
|
const rowDimension = rowHeaderPaths[i];
|
|
895
969
|
for (let j = 0; j < rowArr.length; j++) {
|
|
896
970
|
const dimension = rowArr[j];
|
|
@@ -901,7 +975,7 @@ class PivotHeaderLayoutMap {
|
|
|
901
975
|
}
|
|
902
976
|
}
|
|
903
977
|
}
|
|
904
|
-
if (!needLowestLevel || rowDimensionFinded && colDimensionFinded) {
|
|
978
|
+
if (!needLowestLevel || (rowDimensionFinded || (0, util_1.isValid)(row)) && colDimensionFinded) {
|
|
905
979
|
if (rowDimensionFinded) {
|
|
906
980
|
row = this.columnHeaderLevelCount;
|
|
907
981
|
const {startInTotal: startInTotal, level: level} = rowDimensionFinded;
|
|
@@ -948,12 +1022,14 @@ class PivotHeaderLayoutMap {
|
|
|
948
1022
|
var _a, _b;
|
|
949
1023
|
return "column" === type ? null === (_a = this.columnsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)) : "row" === type ? null === (_b = this.rowsDefine) || void 0 === _b ? void 0 : _b.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)) : void 0;
|
|
950
1024
|
}
|
|
951
|
-
getAxisConfigInPivotChart(col, row) {
|
|
1025
|
+
getAxisConfigInPivotChart(col, row) {
|
|
1026
|
+
return (0, get_axis_config_1.getAxisConfigInPivotChart)(col, row, this);
|
|
1027
|
+
}
|
|
952
1028
|
isEmpty(col, row) {
|
|
953
|
-
return !1;
|
|
1029
|
+
return !!this._table.isPivotChart() && (col > this.colCount - this.rightFrozenColCount - 1 || row > this.rowCount - this.bottomFrozenRowCount - 1 || !(!this.hasTwoIndicatorAxes || !this.indicatorsAsCol || row !== this.columnHeaderLevelCount - 1));
|
|
954
1030
|
}
|
|
955
1031
|
getChartAxes(col, row) {
|
|
956
|
-
return
|
|
1032
|
+
return (0, get_chart_spec_1.getChartAxes)(col, row, this);
|
|
957
1033
|
}
|
|
958
1034
|
getRawChartSpec(col, row) {
|
|
959
1035
|
return (0, get_chart_spec_1.getRawChartSpec)(col, row, this);
|
|
@@ -961,6 +1037,19 @@ class PivotHeaderLayoutMap {
|
|
|
961
1037
|
getChartDataId(col, row) {
|
|
962
1038
|
return (0, get_chart_spec_1.getChartDataId)(col, row, this);
|
|
963
1039
|
}
|
|
1040
|
+
setPagination(pagination) {
|
|
1041
|
+
var _a, _b, _c, _d, _e;
|
|
1042
|
+
if (this.clearCellRangeMap(), this.pagination = pagination, "grid" === this.rowHierarchyType && (0,
|
|
1043
|
+
util_1.isValid)(null === (_a = this.pagination) || void 0 === _a ? void 0 : _a.perPageCount) && (0,
|
|
1044
|
+
util_1.isValid)(null === (_b = this.pagination) || void 0 === _b ? void 0 : _b.currentPage)) {
|
|
1045
|
+
this.pagination.perPageCount = Math.ceil(this.pagination.perPageCount / this.indicatorKeys.length) * this.indicatorKeys.length;
|
|
1046
|
+
const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination;
|
|
1047
|
+
this.currentPageStartIndex = perPageCount * (currentPage || 0), this.currentPageEndIndex = this.currentPageStartIndex + perPageCount,
|
|
1048
|
+
this._rowHeaderCellIds = null === (_c = this._rowHeaderCellIds_FULL) || void 0 === _c ? void 0 : _c.slice(this.currentPageStartIndex, this.currentPageEndIndex);
|
|
1049
|
+
} else this.currentPageStartIndex = 0, this.currentPageEndIndex = this._rowHeaderCellIds_FULL.length,
|
|
1050
|
+
this._rowHeaderCellIds = null === (_d = this._rowHeaderCellIds_FULL) || void 0 === _d ? void 0 : _d.slice(this.currentPageStartIndex, this.currentPageEndIndex);
|
|
1051
|
+
this.pagination && (this.pagination.totalCount = null === (_e = this._rowHeaderCellIds_FULL) || void 0 === _e ? void 0 : _e.length);
|
|
1052
|
+
}
|
|
964
1053
|
release() {
|
|
965
1054
|
var _a;
|
|
966
1055
|
const activeChartInstance = this._table._getActiveChartInstance();
|
|
@@ -996,9 +1085,145 @@ class PivotHeaderLayoutMap {
|
|
|
996
1085
|
return rowDimension || (colDimension || void 0);
|
|
997
1086
|
}
|
|
998
1087
|
clearCellRangeMap() {
|
|
999
|
-
this._cellRangeMap.clear();
|
|
1088
|
+
this._cellRangeMap.clear(), this._CellHeaderPathMap = new Map;
|
|
1089
|
+
}
|
|
1090
|
+
getDimensionKeyInChartSpec(_col, _row) {
|
|
1091
|
+
var _a, _b, _c, _d;
|
|
1092
|
+
const chartSpec = this.getRawChartSpec(_col, _row), dimensionKeys = [];
|
|
1093
|
+
return chartSpec ? (!1 === this.indicatorsAsCol ? dimensionKeys.push(null !== (_a = chartSpec.xField) && void 0 !== _a ? _a : null === (_b = null == chartSpec ? void 0 : chartSpec.series[0]) || void 0 === _b ? void 0 : _b.xField) : dimensionKeys.push(null !== (_c = chartSpec.yField) && void 0 !== _c ? _c : null === (_d = null == chartSpec ? void 0 : chartSpec.series[0]) || void 0 === _d ? void 0 : _d.yField),
|
|
1094
|
+
dimensionKeys) : null;
|
|
1095
|
+
}
|
|
1096
|
+
getChartSpec(col, row) {
|
|
1097
|
+
return (0, get_chart_spec_1.getChartSpec)(col, row, this);
|
|
1000
1098
|
}
|
|
1099
|
+
_generateChartState() {
|
|
1100
|
+
return {
|
|
1101
|
+
vtable_selected: {
|
|
1102
|
+
filter: datum => {
|
|
1103
|
+
var _a;
|
|
1104
|
+
if (this._table._selectedDataItemsInChart.length >= 1) {
|
|
1105
|
+
return !!this._table._selectedDataItemsInChart.find((item => {
|
|
1106
|
+
for (const itemKey in item) if (item[itemKey] !== datum[itemKey]) return !1;
|
|
1107
|
+
return !0;
|
|
1108
|
+
}));
|
|
1109
|
+
}
|
|
1110
|
+
if (null === (_a = this._table._selectedDimensionInChart) || void 0 === _a ? void 0 : _a.length) {
|
|
1111
|
+
return !!this._table._selectedDimensionInChart.every((item => datum[item.key] === item.value));
|
|
1112
|
+
}
|
|
1113
|
+
return !1;
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1116
|
+
vtable_selected_reverse: {
|
|
1117
|
+
filter: datum => {
|
|
1118
|
+
var _a;
|
|
1119
|
+
if (this._table._selectedDataItemsInChart.length >= 1) {
|
|
1120
|
+
return !this._table._selectedDataItemsInChart.find((item => {
|
|
1121
|
+
for (const itemKey in item) if (item[itemKey] !== datum[itemKey]) return !1;
|
|
1122
|
+
return !0;
|
|
1123
|
+
}));
|
|
1124
|
+
}
|
|
1125
|
+
if (null === (_a = this._table._selectedDimensionInChart) || void 0 === _a ? void 0 : _a.length) {
|
|
1126
|
+
return !this._table._selectedDimensionInChart.every((item => datum[item.key] === item.value));
|
|
1127
|
+
}
|
|
1128
|
+
return !1;
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
updateDataStateToChartInstance(activeChartInstance) {
|
|
1134
|
+
activeChartInstance || (activeChartInstance = this._table._getActiveChartInstance());
|
|
1135
|
+
const state = this._generateChartState();
|
|
1136
|
+
this._indicators.forEach((_indicatorObject => {
|
|
1137
|
+
_indicatorObject.chartInstance.updateState(state);
|
|
1138
|
+
})), null == activeChartInstance || activeChartInstance.updateState(state);
|
|
1139
|
+
}
|
|
1140
|
+
updateDataStateToActiveChartInstance(activeChartInstance) {
|
|
1141
|
+
activeChartInstance || (activeChartInstance = this._table._getActiveChartInstance());
|
|
1142
|
+
const state = this._generateChartState();
|
|
1143
|
+
null == activeChartInstance || activeChartInstance.updateState(state);
|
|
1144
|
+
}
|
|
1145
|
+
getIndicatorKeyInChartSpec(_col, _row) {
|
|
1146
|
+
const chartSpec = this.getRawChartSpec(_col, _row), indicatorKeys = [];
|
|
1147
|
+
return chartSpec ? (!1 === this.indicatorsAsCol ? chartSpec.series ? chartSpec.series.forEach((chartSeries => {
|
|
1148
|
+
const yField = chartSeries.yField;
|
|
1149
|
+
indicatorKeys.push(yField);
|
|
1150
|
+
})) : indicatorKeys.push(chartSpec.yField) : chartSpec.series ? chartSpec.series.forEach((chartSeries => {
|
|
1151
|
+
const xField = chartSeries.xField;
|
|
1152
|
+
indicatorKeys.push(xField);
|
|
1153
|
+
})) : indicatorKeys.push(chartSpec.xField), indicatorKeys) : null;
|
|
1154
|
+
}
|
|
1155
|
+
getOptimunHeightForChart(row) {
|
|
1156
|
+
var _a, _b, _c, _d;
|
|
1157
|
+
const path = this.getCellHeaderPaths(this.rowHeaderLevelCount, row).rowHeaderPaths;
|
|
1158
|
+
let collectedValues, height;
|
|
1159
|
+
for (const key in this.dataset.collectValuesBy) if ("yField" === this.dataset.collectValuesBy[key].type && !this.dataset.collectValuesBy[key].range) {
|
|
1160
|
+
collectedValues = this.dataset.collectedValues[key][path.map((pathObj => pathObj.value)).join(this.dataset.stringJoinChar)];
|
|
1161
|
+
break;
|
|
1162
|
+
}
|
|
1163
|
+
if (this._chartItemBandSize) height = scaleWholeRangeSize(null !== (_a = null == collectedValues ? void 0 : collectedValues.length) && void 0 !== _a ? _a : 0, this._chartItemBandSize, this._chartPaddingInner, this._chartPaddingOuter); else {
|
|
1164
|
+
const barWidth = this._chartItemSpanSize || 25;
|
|
1165
|
+
height = (null !== (_b = null == collectedValues ? void 0 : collectedValues.length) && void 0 !== _b ? _b : 0) * (barWidth + barWidth / 3);
|
|
1166
|
+
}
|
|
1167
|
+
const padding = (0, padding_1.getQuadProps)(null !== (_d = null !== (_c = this._chartPadding) && void 0 !== _c ? _c : this._table.theme.bodyStyle.padding) && void 0 !== _d ? _d : 0);
|
|
1168
|
+
return height + padding[0] + padding[2];
|
|
1169
|
+
}
|
|
1170
|
+
getOptimunWidthForChart(col) {
|
|
1171
|
+
var _a, _b, _c, _d;
|
|
1172
|
+
const path = this.getCellHeaderPaths(col, this.columnHeaderLevelCount).colHeaderPaths;
|
|
1173
|
+
let collectedValues, width;
|
|
1174
|
+
for (const key in this.dataset.collectValuesBy) if ("xField" === this.dataset.collectValuesBy[key].type && !this.dataset.collectValuesBy[key].range) {
|
|
1175
|
+
collectedValues = this.dataset.collectedValues[key][path.map((pathObj => pathObj.value)).join(this.dataset.stringJoinChar)];
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
if (this._chartItemBandSize) width = scaleWholeRangeSize(null !== (_a = null == collectedValues ? void 0 : collectedValues.length) && void 0 !== _a ? _a : 0, this._chartItemBandSize, this._chartPaddingInner, this._chartPaddingOuter); else {
|
|
1179
|
+
const barWidth = this._chartItemSpanSize || 25;
|
|
1180
|
+
width = (null !== (_b = null == collectedValues ? void 0 : collectedValues.length) && void 0 !== _b ? _b : 0) * (barWidth + barWidth / 3);
|
|
1181
|
+
}
|
|
1182
|
+
const padding = (0, padding_1.getQuadProps)(null !== (_d = null !== (_c = this._chartPadding) && void 0 !== _c ? _c : this._table.theme.bodyStyle.padding) && void 0 !== _d ? _d : 0);
|
|
1183
|
+
return width + padding[1] + padding[3];
|
|
1184
|
+
}
|
|
1185
|
+
get leftAxesCount() {
|
|
1186
|
+
if (!this._table.isPivotChart()) return 0;
|
|
1187
|
+
const axisOption = this._table.pivotChartAxes.find((axisOption => "left" === axisOption.orient));
|
|
1188
|
+
return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : (this.indicatorsAsCol,
|
|
1189
|
+
1);
|
|
1190
|
+
}
|
|
1191
|
+
get topAxesCount() {
|
|
1192
|
+
if (!this._table.isPivotChart()) return 0;
|
|
1193
|
+
const axisOption = this._table.pivotChartAxes.find((axisOption => "top" === axisOption.orient));
|
|
1194
|
+
return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : this.indicatorsAsCol && this.hasTwoIndicatorAxes ? 1 : 0;
|
|
1195
|
+
}
|
|
1196
|
+
get rightAxesCount() {
|
|
1197
|
+
return this.rightFrozenColCount;
|
|
1198
|
+
}
|
|
1199
|
+
get bottomAxesCount() {
|
|
1200
|
+
return this.bottomFrozenRowCount;
|
|
1201
|
+
}
|
|
1202
|
+
getColKeysPath(col) {
|
|
1203
|
+
const index = this.indicatorsAsCol ? Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length) : col - this.rowHeaderLevelCount, colKey = this.dataset.colKeys[index];
|
|
1204
|
+
return null == colKey ? void 0 : colKey.join(this.dataset.stringJoinChar);
|
|
1205
|
+
}
|
|
1206
|
+
getRowKeysPath(row) {
|
|
1207
|
+
const index = this.indicatorsAsCol ? row - this.columnHeaderLevelCount : Math.floor((row - this.columnHeaderLevelCount) / this.indicatorKeys.length), rowKey = this.dataset.rowKeys[index];
|
|
1208
|
+
return null == rowKey ? void 0 : rowKey.join(this.dataset.stringJoinChar);
|
|
1209
|
+
}
|
|
1210
|
+
getIndicatorInfo(indicatorKey, indicatorValue = "") {
|
|
1211
|
+
var _a;
|
|
1212
|
+
return null === (_a = this.indicatorsDefine) || void 0 === _a ? void 0 : _a.find((indicator => "string" != typeof indicator && (indicatorKey ? indicator.indicatorKey === indicatorKey : !!indicatorValue && indicator.title === indicatorValue)));
|
|
1213
|
+
}
|
|
1214
|
+
updateDataset(dataset) {}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
function scaleWholeRangeSize(count, bandwidth, paddingInner, paddingOuter) {
|
|
1218
|
+
1 === paddingInner && (paddingInner = 0);
|
|
1219
|
+
return bandSpace(count, paddingInner, paddingOuter) * (bandwidth / (1 - paddingInner));
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
function bandSpace(count, paddingInner, paddingOuter) {
|
|
1223
|
+
let space;
|
|
1224
|
+
return space = 1 === count ? count + 2 * paddingOuter : count - paddingInner + 2 * paddingOuter,
|
|
1225
|
+
count ? space > 0 ? space : 1 : 0;
|
|
1001
1226
|
}
|
|
1002
1227
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1228
|
+
//# sourceMappingURL=pivot-header-layout.js.map
|
|
1229
|
+
exports.PivotHeaderLayoutMap = PivotHeaderLayoutMap;
|