@visactor/vtable 0.25.5 → 0.26.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/PivotChart.d.ts +9 -0
- package/cjs/PivotChart.js +90 -28
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +5 -2
- package/cjs/PivotTable.js +186 -152
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/core/BaseTable.js +4 -5
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +20 -15
- package/cjs/dataset/dataset.js +88 -62
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/dataset/statistics-helper.d.ts +13 -2
- package/cjs/dataset/statistics-helper.js +22 -27
- package/cjs/dataset/statistics-helper.js.map +1 -1
- package/cjs/event/listener/table-group.js +3 -10
- package/cjs/event/listener/table-group.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-chart-spec.d.ts +2 -1
- package/cjs/layout/chart-helper/get-chart-spec.js +3 -3
- package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/cjs/layout/layout-helper.d.ts +12 -0
- package/cjs/layout/layout-helper.js +52 -4
- package/cjs/layout/layout-helper.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +4 -3
- package/cjs/layout/pivot-header-layout.js +43 -47
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/tree-helper.d.ts +2 -0
- package/cjs/layout/tree-helper.js +19 -11
- package/cjs/layout/tree-helper.js.map +1 -1
- package/cjs/state/cell-move/adjust-header.js +1 -1
- package/cjs/state/cell-move/adjust-header.js.map +1 -1
- package/cjs/state/resize/update-resize-column.js +1 -1
- package/cjs/state/resize/update-resize-column.js.map +1 -1
- package/cjs/state/resize/update-resize-row.js +5 -4
- package/cjs/state/resize/update-resize-row.js.map +1 -1
- package/cjs/tools/get-data-path/create-dataset.d.ts +9 -1
- package/cjs/tools/get-data-path/create-dataset.js +19 -8
- package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
- package/cjs/tools/get-data-path/index.js +12 -3
- package/cjs/tools/get-data-path/index.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +6 -4
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/common.d.ts +2 -0
- package/cjs/ts-types/common.js.map +1 -1
- package/cjs/ts-types/menu.d.ts +1 -1
- package/cjs/ts-types/menu.js.map +1 -1
- package/cjs/ts-types/table-engine.d.ts +1 -0
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +902 -566
- package/dist/vtable.min.js +2 -2
- package/es/PivotChart.d.ts +9 -0
- package/es/PivotChart.js +97 -29
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +5 -2
- package/es/PivotTable.js +188 -148
- package/es/PivotTable.js.map +1 -1
- package/es/core/BaseTable.js +4 -5
- package/es/core/BaseTable.js.map +1 -1
- package/es/dataset/dataset.d.ts +20 -15
- package/es/dataset/dataset.js +89 -61
- package/es/dataset/dataset.js.map +1 -1
- package/es/dataset/statistics-helper.d.ts +13 -2
- package/es/dataset/statistics-helper.js +22 -27
- package/es/dataset/statistics-helper.js.map +1 -1
- package/es/event/listener/table-group.js +2 -11
- package/es/event/listener/table-group.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-chart-spec.d.ts +2 -1
- package/es/layout/chart-helper/get-chart-spec.js +3 -3
- package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
- package/es/layout/layout-helper.d.ts +12 -0
- package/es/layout/layout-helper.js +50 -0
- package/es/layout/layout-helper.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +4 -3
- package/es/layout/pivot-header-layout.js +41 -46
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/tree-helper.d.ts +2 -0
- package/es/layout/tree-helper.js +19 -11
- package/es/layout/tree-helper.js.map +1 -1
- package/es/state/cell-move/adjust-header.js +1 -1
- package/es/state/cell-move/adjust-header.js.map +1 -1
- package/es/state/resize/update-resize-column.js +1 -1
- package/es/state/resize/update-resize-column.js.map +1 -1
- package/es/state/resize/update-resize-row.js +5 -4
- package/es/state/resize/update-resize-row.js.map +1 -1
- package/es/tools/get-data-path/create-dataset.d.ts +9 -1
- package/es/tools/get-data-path/create-dataset.js +20 -7
- package/es/tools/get-data-path/create-dataset.js.map +1 -1
- package/es/tools/get-data-path/index.js +15 -2
- package/es/tools/get-data-path/index.js.map +1 -1
- package/es/ts-types/base-table.d.ts +6 -4
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/common.d.ts +2 -0
- package/es/ts-types/common.js.map +1 -1
- package/es/ts-types/menu.d.ts +1 -1
- package/es/ts-types/menu.js.map +1 -1
- package/es/ts-types/table-engine.d.ts +1 -0
- package/es/ts-types/table-engine.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/cjs/PivotChart.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ import { Dataset } from './dataset/dataset';
|
|
|
5
5
|
import { BaseTable } from './core/BaseTable';
|
|
6
6
|
import type { PivotChartProtected } from './ts-types/base-table';
|
|
7
7
|
import type { ITableAxisOption } from './ts-types/component/axis';
|
|
8
|
+
import { type LayouTreeNode } from './layout/tree-helper';
|
|
8
9
|
export declare class PivotChart extends BaseTable implements PivotChartAPI {
|
|
10
|
+
layoutNodeId: {
|
|
11
|
+
seqId: number;
|
|
12
|
+
};
|
|
9
13
|
internalProps: PivotChartProtected;
|
|
10
14
|
options: PivotChartConstructorOptions;
|
|
11
15
|
pivotSortState: PivotSortState[];
|
|
@@ -91,4 +95,9 @@ export declare class PivotChart extends BaseTable implements PivotChartAPI {
|
|
|
91
95
|
setRecords(records: Array<any>): void;
|
|
92
96
|
_hasCustomRenderOrLayout(): boolean;
|
|
93
97
|
changeRecordOrder(source: number, target: number): void;
|
|
98
|
+
getLayoutColumnTree(): LayouTreeNode[];
|
|
99
|
+
getLayoutColumnTreeCount(): number;
|
|
100
|
+
getLayoutRowTree(): LayouTreeNode[];
|
|
101
|
+
getLayoutRowTreeCount(): number;
|
|
102
|
+
getCellHeaderTreeNodes(col: number, row: number): ICellHeaderPaths;
|
|
94
103
|
}
|
package/cjs/PivotChart.js
CHANGED
|
@@ -4,14 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: !0
|
|
5
5
|
}), exports.PivotChart = void 0;
|
|
6
6
|
|
|
7
|
-
const ts_types_1 = require("./ts-types"), ts_types_2 = require("./ts-types"), pivot_header_layout_1 = require("./layout/pivot-header-layout"), PIVOT_TABLE_EVENT_TYPE_1 = require("./ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE"), helper_1 = require("./tools/helper"), dataset_1 = require("./dataset/dataset"), tableHelper_1 = require("./core/tableHelper"), BaseTable_1 = require("./core/BaseTable"), update_chart_1 = require("./scenegraph/refresh-node/update-chart"), vutils_1 = require("@visactor/vutils"), title_1 = require("./components/title/title"), env_1 = require("./tools/env"), TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE"), vutil_extension_temp_1 = require("./vutil-extension-temp");
|
|
7
|
+
const ts_types_1 = require("./ts-types"), ts_types_2 = require("./ts-types"), pivot_header_layout_1 = require("./layout/pivot-header-layout"), PIVOT_TABLE_EVENT_TYPE_1 = require("./ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE"), helper_1 = require("./tools/helper"), dataset_1 = require("./dataset/dataset"), tableHelper_1 = require("./core/tableHelper"), BaseTable_1 = require("./core/BaseTable"), update_chart_1 = require("./scenegraph/refresh-node/update-chart"), vutils_1 = require("@visactor/vutils"), title_1 = require("./components/title/title"), env_1 = require("./tools/env"), TABLE_EVENT_TYPE_1 = require("./core/TABLE_EVENT_TYPE"), vutil_extension_temp_1 = require("./vutil-extension-temp"), tree_helper_1 = require("./layout/tree-helper"), global_1 = require("./tools/global"), get_chart_spec_1 = require("./layout/chart-helper/get-chart-spec");
|
|
8
8
|
|
|
9
9
|
class PivotChart extends BaseTable_1.BaseTable {
|
|
10
10
|
constructor(container, options) {
|
|
11
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
11
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
12
|
+
let columnDimensionTree, rowDimensionTree;
|
|
12
13
|
"node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
|
|
13
14
|
container = container.container ? container.container : null), super(container, options),
|
|
14
|
-
this.
|
|
15
|
+
this.layoutNodeId = {
|
|
16
|
+
seqId: 0
|
|
17
|
+
}, this._selectedDataItemsInChart = [], this._selectedDimensionInChart = [], this._chartEventMap = {},
|
|
15
18
|
options.layout && Object.assign(options, options.layout), this.internalProps.columns = (0,
|
|
16
19
|
vutils_1.cloneDeep)(options.columns), this.internalProps.rows = (0, vutils_1.cloneDeep)(options.rows),
|
|
17
20
|
this.internalProps.indicators = (0, vutil_extension_temp_1.cloneDeepSpec)(options.indicators),
|
|
@@ -22,16 +25,34 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
22
25
|
this.internalProps.rowResizeType = null !== (_d = options.rowResizeType) && void 0 !== _d ? _d : "row",
|
|
23
26
|
this.internalProps.dataConfig = {
|
|
24
27
|
isPivotChart: !0
|
|
25
|
-
}, this._axes = (0, vutils_1.isArray)(options.axes) ? options.axes : []
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
keys)), [])) && void 0 !==
|
|
29
|
-
keys)), [])) && void 0 !==
|
|
30
|
-
|
|
28
|
+
}, this._axes = (0, vutils_1.isArray)(options.axes) ? options.axes : [], options.columnTree && (columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_e = this.internalProps.columnTree) && void 0 !== _e ? _e : [], this.layoutNodeId)),
|
|
29
|
+
options.rowTree && (rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_f = this.internalProps.rowTree) && void 0 !== _f ? _f : [], this.layoutNodeId));
|
|
30
|
+
const rowKeys = (null === (_g = null == rowDimensionTree ? void 0 : rowDimensionTree.dimensionKeys) || void 0 === _g ? void 0 : _g.count) ? rowDimensionTree.dimensionKeys.valueArr() : null !== (_j = null === (_h = options.rows) || void 0 === _h ? void 0 : _h.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
|
|
31
|
+
keys)), [])) && void 0 !== _j ? _j : [], columnKeys = (null === (_k = null == columnDimensionTree ? void 0 : columnDimensionTree.dimensionKeys) || void 0 === _k ? void 0 : _k.count) ? columnDimensionTree.dimensionKeys.valueArr() : null !== (_m = null === (_l = options.columns) || void 0 === _l ? void 0 : _l.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
|
|
32
|
+
keys)), [])) && void 0 !== _m ? _m : [], indicatorKeys = null !== (_p = null === (_o = options.indicators) || void 0 === _o ? void 0 : _o.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
|
|
33
|
+
keys)), [])) && void 0 !== _p ? _p : [];
|
|
34
|
+
if (this.internalProps.dataConfig.collectValuesBy = this._generateCollectValuesConfig(columnKeys, rowKeys),
|
|
31
35
|
this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules(),
|
|
32
36
|
this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray(),
|
|
33
|
-
this.dataset = new dataset_1.Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (
|
|
34
|
-
this.
|
|
37
|
+
this.dataset = new dataset_1.Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_q = options.indicatorsAsCol) || void 0 === _q || _q, options.records, void 0, this.internalProps.columnTree, this.internalProps.rowTree, !0),
|
|
38
|
+
this.options.indicatorsAsCol && (0, get_chart_spec_1.checkHasCartesianChart)(this.internalProps.indicators)) {
|
|
39
|
+
const supplyAxisNode = nodes => {
|
|
40
|
+
nodes.forEach((node => {
|
|
41
|
+
var _a;
|
|
42
|
+
(null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? supplyAxisNode(node.children) : node.children = [ {
|
|
43
|
+
dimensionKey: "axis",
|
|
44
|
+
value: ""
|
|
45
|
+
} ];
|
|
46
|
+
}));
|
|
47
|
+
};
|
|
48
|
+
(null === (_r = this.dataset.rowHeaderTree) || void 0 === _r ? void 0 : _r.length) ? supplyAxisNode(this.dataset.rowHeaderTree) : this.dataset.rowHeaderTree = [ {
|
|
49
|
+
dimensionKey: "axis",
|
|
50
|
+
value: ""
|
|
51
|
+
} ];
|
|
52
|
+
}
|
|
53
|
+
columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_s = this.dataset.colHeaderTree) && void 0 !== _s ? _s : [], this.layoutNodeId),
|
|
54
|
+
rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_t = this.dataset.rowHeaderTree) && void 0 !== _t ? _t : [], this.layoutNodeId),
|
|
55
|
+
this.internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree),
|
|
35
56
|
this.refreshHeader(), this.scenegraph.createSceneGraph(), options.title && (this.internalProps.title = new title_1.Title(options.title, this),
|
|
36
57
|
this.scenegraph.resize()), setTimeout((() => {
|
|
37
58
|
this.fireListeners(TABLE_EVENT_TYPE_1.TABLE_EVENT_TYPE.INITIALIZED, null);
|
|
@@ -65,10 +86,13 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
65
86
|
return ifCan;
|
|
66
87
|
}
|
|
67
88
|
updateOption(options) {
|
|
68
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
89
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
69
90
|
const internalProps = this.internalProps;
|
|
70
|
-
|
|
71
|
-
|
|
91
|
+
let columnDimensionTree, rowDimensionTree;
|
|
92
|
+
super.updateOption(options), this.layoutNodeId = {
|
|
93
|
+
seqId: 0
|
|
94
|
+
}, this.internalProps.columns = (0, vutils_1.cloneDeep)(options.columns), this.internalProps.rows = (0,
|
|
95
|
+
vutils_1.cloneDeep)(options.rows), this.internalProps.indicators = (null === (_a = options.indicators) || void 0 === _a ? void 0 : _a.length) ? (0,
|
|
72
96
|
vutil_extension_temp_1.cloneDeepSpec)(options.indicators) : [], this.internalProps.columnTree = !options.indicatorsAsCol || (null === (_b = options.columns) || void 0 === _b ? void 0 : _b.length) || options.columnTree ? (0,
|
|
73
97
|
vutils_1.cloneDeep)(options.columnTree) : [], this.internalProps.rowTree = options.indicatorsAsCol || (null === (_c = options.rows) || void 0 === _c ? void 0 : _c.length) || options.rowTree ? (0,
|
|
74
98
|
vutils_1.cloneDeep)(options.rowTree) : [], options.records && (this.internalProps.records = options.records),
|
|
@@ -76,16 +100,34 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
76
100
|
internalProps.rowResizeType = null !== (_e = options.rowResizeType) && void 0 !== _e ? _e : "row",
|
|
77
101
|
internalProps.dataConfig = {
|
|
78
102
|
isPivotChart: !0
|
|
79
|
-
}, this._axes = (0, vutils_1.isArray)(options.axes) ? options.axes : []
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
keys)), [])) && void 0 !==
|
|
83
|
-
keys)), [])) && void 0 !==
|
|
84
|
-
|
|
103
|
+
}, this._axes = (0, vutils_1.isArray)(options.axes) ? options.axes : [], options.columnTree && (columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_f = this.internalProps.columnTree) && void 0 !== _f ? _f : [], this.layoutNodeId)),
|
|
104
|
+
options.rowTree && (rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_g = this.internalProps.rowTree) && void 0 !== _g ? _g : [], this.layoutNodeId));
|
|
105
|
+
const rowKeys = (null === (_h = null == rowDimensionTree ? void 0 : rowDimensionTree.dimensionKeys) || void 0 === _h ? void 0 : _h.count) ? rowDimensionTree.dimensionKeys.valueArr() : null !== (_k = null === (_j = options.rows) || void 0 === _j ? void 0 : _j.reduce(((keys, rowObj) => ("string" == typeof rowObj ? keys.push(rowObj) : keys.push(rowObj.dimensionKey),
|
|
106
|
+
keys)), [])) && void 0 !== _k ? _k : [], columnKeys = (null === (_l = null == columnDimensionTree ? void 0 : columnDimensionTree.dimensionKeys) || void 0 === _l ? void 0 : _l.count) ? columnDimensionTree.dimensionKeys.valueArr() : null !== (_o = null === (_m = options.columns) || void 0 === _m ? void 0 : _m.reduce(((keys, columnObj) => ("string" == typeof columnObj ? keys.push(columnObj) : keys.push(columnObj.dimensionKey),
|
|
107
|
+
keys)), [])) && void 0 !== _o ? _o : [], indicatorKeys = null !== (_q = null === (_p = options.indicators) || void 0 === _p ? void 0 : _p.reduce(((keys, indicatorObj) => ("string" == typeof indicatorObj ? keys.push(indicatorObj) : keys.push(indicatorObj.indicatorKey),
|
|
108
|
+
keys)), [])) && void 0 !== _q ? _q : [];
|
|
109
|
+
if (this.internalProps.dataConfig.collectValuesBy = this._generateCollectValuesConfig(columnKeys, rowKeys),
|
|
85
110
|
this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules(),
|
|
86
111
|
this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray(),
|
|
87
|
-
this.dataset = new dataset_1.Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (
|
|
88
|
-
|
|
112
|
+
this.dataset = new dataset_1.Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, this.internalProps.indicators, null === (_r = options.indicatorsAsCol) || void 0 === _r || _r, null !== (_s = options.records) && void 0 !== _s ? _s : this.internalProps.records, void 0, this.internalProps.columnTree, this.internalProps.rowTree, !0),
|
|
113
|
+
this.options.indicatorsAsCol && (0, get_chart_spec_1.checkHasCartesianChart)(this.internalProps.indicators)) {
|
|
114
|
+
const supplyAxisNode = nodes => {
|
|
115
|
+
nodes.forEach((node => {
|
|
116
|
+
var _a;
|
|
117
|
+
(null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? supplyAxisNode(node.children) : node.children = [ {
|
|
118
|
+
dimensionKey: "axis",
|
|
119
|
+
value: ""
|
|
120
|
+
} ];
|
|
121
|
+
}));
|
|
122
|
+
};
|
|
123
|
+
(null === (_t = this.dataset.rowHeaderTree) || void 0 === _t ? void 0 : _t.length) ? supplyAxisNode(this.dataset.rowHeaderTree) : this.dataset.rowHeaderTree = [ {
|
|
124
|
+
dimensionKey: "axis",
|
|
125
|
+
value: ""
|
|
126
|
+
} ];
|
|
127
|
+
}
|
|
128
|
+
return columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_u = this.dataset.colHeaderTree) && void 0 !== _u ? _u : [], this.layoutNodeId),
|
|
129
|
+
rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_v = this.dataset.rowHeaderTree) && void 0 !== _v ? _v : [], this.layoutNodeId),
|
|
130
|
+
internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree),
|
|
89
131
|
this.refreshHeader(), internalProps.releaseList && (internalProps.releaseList.forEach((releaseObj => {
|
|
90
132
|
var _a;
|
|
91
133
|
return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
|
|
@@ -154,7 +196,7 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
154
196
|
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
155
197
|
var _a;
|
|
156
198
|
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
157
|
-
})), aggregator = this.dataset.getAggregator(
|
|
199
|
+
})), aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
158
200
|
return aggregator.value ? aggregator.value() : void 0;
|
|
159
201
|
}
|
|
160
202
|
const {fieldFormat: fieldFormat} = this.internalProps.layoutMap.getBody(col, row), rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col), dataValue = null === (_c = this.records[rowIndex]) || void 0 === _c ? void 0 : _c[colIndex];
|
|
@@ -185,7 +227,7 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
185
227
|
})), rowKeys = cellDimensionPath.rowHeaderPaths.map((rowPath => {
|
|
186
228
|
var _a;
|
|
187
229
|
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
188
|
-
})), aggregator = this.dataset.getAggregator(
|
|
230
|
+
})), aggregator = this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row));
|
|
189
231
|
return aggregator.value ? aggregator.value() : void 0;
|
|
190
232
|
}
|
|
191
233
|
const rowIndex = this.getBodyIndexByRow(row), colIndex = this.getBodyIndexByCol(col);
|
|
@@ -203,7 +245,7 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
203
245
|
var _a;
|
|
204
246
|
return null !== (_a = rowPath.indicatorKey) && void 0 !== _a ? _a : rowPath.value;
|
|
205
247
|
}));
|
|
206
|
-
return this.dataset.getAggregator(
|
|
248
|
+
return this.dataset.getAggregator(rowKeys, colKeys, this.internalProps.layoutMap.getIndicatorKey(col, row)).records;
|
|
207
249
|
}
|
|
208
250
|
}
|
|
209
251
|
getCellRawRecord(col, row) {
|
|
@@ -300,6 +342,8 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
300
342
|
}
|
|
301
343
|
_generateCollectValuesConfig(columnKeys, rowKeys) {
|
|
302
344
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
345
|
+
columnKeys = columnKeys.filter((key => key !== global_1.IndicatorDimensionKeyPlaceholder)),
|
|
346
|
+
rowKeys = rowKeys.filter((key => key !== global_1.IndicatorDimensionKeyPlaceholder));
|
|
303
347
|
const indicators = this.internalProps.indicators, collectValuesBy = {};
|
|
304
348
|
for (let i = 0, len = null == indicators ? void 0 : indicators.length; i < len; i++) if ("string" != typeof indicators[i] && indicators[i].chartSpec) {
|
|
305
349
|
if ("pie" === (null === (_a = indicators[i].chartSpec) || void 0 === _a ? void 0 : _a.type) || "rose" === (null === (_b = indicators[i].chartSpec) || void 0 === _b ? void 0 : _b.type) || "radar" === (null === (_c = indicators[i].chartSpec) || void 0 === _c ? void 0 : _c.type) || "gauge" === (null === (_d = indicators[i].chartSpec) || void 0 === _d ? void 0 : _d.type) || "wordCloud" === (null === (_e = indicators[i].chartSpec) || void 0 === _e ? void 0 : _e.type)) continue;
|
|
@@ -548,14 +592,17 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
548
592
|
}
|
|
549
593
|
}
|
|
550
594
|
setRecords(records) {
|
|
595
|
+
var _a, _b;
|
|
551
596
|
const oldHoverState = {
|
|
552
597
|
col: this.stateManager.hover.cellPos.col,
|
|
553
598
|
row: this.stateManager.hover.cellPos.row
|
|
554
599
|
};
|
|
555
600
|
this.options.records = this.internalProps.records = records;
|
|
556
|
-
this.options;
|
|
557
|
-
|
|
558
|
-
this.dataset.setRecords(records), internalProps.layoutMap
|
|
601
|
+
const options = this.options, internalProps = this.internalProps;
|
|
602
|
+
let columnDimensionTree, rowDimensionTree;
|
|
603
|
+
this.dataset.setRecords(records), columnDimensionTree = options.columnTree ? internalProps.layoutMap.columnDimensionTree : new tree_helper_1.DimensionTree(null !== (_a = this.dataset.colHeaderTree) && void 0 !== _a ? _a : [], this.layoutNodeId),
|
|
604
|
+
rowDimensionTree = options.rowTree ? internalProps.layoutMap.rowDimensionTree : new tree_helper_1.DimensionTree(null !== (_b = this.dataset.rowHeaderTree) && void 0 !== _b ? _b : [], this.layoutNodeId),
|
|
605
|
+
internalProps.layoutMap = new pivot_header_layout_1.PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree),
|
|
559
606
|
this.refreshHeader(), this.scenegraph.clearCells(), this.clearCellStyleCache(),
|
|
560
607
|
this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row),
|
|
561
608
|
this.internalProps.title && !this.internalProps.title.isReleased && (this._updateSize(),
|
|
@@ -579,6 +626,21 @@ class PivotChart extends BaseTable_1.BaseTable {
|
|
|
579
626
|
return !1;
|
|
580
627
|
}
|
|
581
628
|
changeRecordOrder(source, target) {}
|
|
629
|
+
getLayoutColumnTree() {
|
|
630
|
+
return this.internalProps.layoutMap.getLayoutColumnTree();
|
|
631
|
+
}
|
|
632
|
+
getLayoutColumnTreeCount() {
|
|
633
|
+
return this.internalProps.layoutMap.getLayoutColumnTreeCount();
|
|
634
|
+
}
|
|
635
|
+
getLayoutRowTree() {
|
|
636
|
+
return this.internalProps.layoutMap.getLayoutRowTree();
|
|
637
|
+
}
|
|
638
|
+
getLayoutRowTreeCount() {
|
|
639
|
+
return this.internalProps.layoutMap.getLayoutRowTreeCount();
|
|
640
|
+
}
|
|
641
|
+
getCellHeaderTreeNodes(col, row) {
|
|
642
|
+
return this.internalProps.layoutMap.getCellHeaderPathsWithTreeNode(col, row);
|
|
643
|
+
}
|
|
582
644
|
}
|
|
583
645
|
|
|
584
646
|
exports.PivotChart = PivotChart;
|