@visactor/vtable 0.15.4 → 0.15.5-alpha.2
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/components/axis/axis.d.ts +3 -1
- package/cjs/components/axis/axis.js +10 -8
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/core/BaseTable.js +17 -6
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/layout/chart-helper/get-axis-config.d.ts +2 -0
- package/cjs/layout/chart-helper/get-axis-config.js +23 -2
- package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
- package/cjs/layout/pivot-header-layout.d.ts +15 -9
- package/cjs/layout/pivot-header-layout.js +71 -154
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/pivot-layout-helper.d.ts +10 -2
- package/cjs/layout/pivot-layout-helper.js +108 -6
- package/cjs/layout/pivot-layout-helper.js.map +1 -1
- package/cjs/layout/simple-header-layout.d.ts +1 -0
- package/cjs/layout/simple-header-layout.js +5 -7
- package/cjs/layout/simple-header-layout.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/group.js +5 -3
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -0
- package/cjs/scenegraph/group-creater/progress/proxy.js +12 -0
- package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +3 -3
- package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +28 -17
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +21 -7
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/scenegraph/layout/update-row.js +8 -3
- package/cjs/scenegraph/layout/update-row.js.map +1 -1
- package/cjs/scenegraph/layout/update-width.js +3 -2
- package/cjs/scenegraph/layout/update-width.js.map +1 -1
- package/cjs/scenegraph/refresh-node/update-chart.js +3 -2
- package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/cjs/scenegraph/scenegraph.js +2 -2
- package/cjs/scenegraph/scenegraph.js.map +1 -1
- package/cjs/scenegraph/style/frame-border.js +26 -12
- package/cjs/scenegraph/style/frame-border.js.map +1 -1
- package/dist/vtable.js +490 -286
- package/dist/vtable.min.js +2 -2
- package/es/components/axis/axis.d.ts +3 -1
- package/es/components/axis/axis.js +7 -5
- package/es/components/axis/axis.js.map +1 -1
- package/es/core/BaseTable.js +18 -5
- package/es/core/BaseTable.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/layout/chart-helper/get-axis-config.d.ts +2 -0
- package/es/layout/chart-helper/get-axis-config.js +20 -0
- package/es/layout/chart-helper/get-axis-config.js.map +1 -1
- package/es/layout/pivot-header-layout.d.ts +15 -9
- package/es/layout/pivot-header-layout.js +71 -151
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/pivot-layout-helper.d.ts +10 -2
- package/es/layout/pivot-layout-helper.js +107 -5
- package/es/layout/pivot-layout-helper.js.map +1 -1
- package/es/layout/simple-header-layout.d.ts +1 -0
- package/es/layout/simple-header-layout.js +5 -7
- package/es/layout/simple-header-layout.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/group.js +5 -3
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +1 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -0
- package/es/scenegraph/group-creater/progress/proxy.js +12 -0
- package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +3 -3
- package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +28 -17
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +21 -7
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/scenegraph/layout/update-row.js +8 -3
- package/es/scenegraph/layout/update-row.js.map +1 -1
- package/es/scenegraph/layout/update-width.js +2 -2
- package/es/scenegraph/layout/update-width.js.map +1 -1
- package/es/scenegraph/refresh-node/update-chart.js +5 -1
- package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
- package/es/scenegraph/scenegraph.js +2 -2
- package/es/scenegraph/scenegraph.js.map +1 -1
- package/es/scenegraph/style/frame-border.js +25 -11
- package/es/scenegraph/style/frame-border.js.map +1 -1
- package/package.json +5 -5
|
@@ -8,7 +8,7 @@ import { diffCellAddress } from "../tools/diff-cell";
|
|
|
8
8
|
|
|
9
9
|
import { getChartAxes, getChartDataId, getChartSpec, getRawChartSpec } from "./chart-helper/get-chart-spec";
|
|
10
10
|
|
|
11
|
-
import { DimensionTree, countLayoutTree, generateLayoutTree } from "./pivot-layout-helper";
|
|
11
|
+
import { DimensionTree, countLayoutTree, dealHeader, dealHeaderForTreeMode, generateLayoutTree } from "./pivot-layout-helper";
|
|
12
12
|
|
|
13
13
|
import { cloneDeep, isArray, isValid } from "@visactor/vutils";
|
|
14
14
|
|
|
@@ -16,12 +16,6 @@ import { getQuadProps } from "../scenegraph/utils/padding";
|
|
|
16
16
|
|
|
17
17
|
import { getAxisConfigInPivotChart } from "./chart-helper/get-axis-config";
|
|
18
18
|
|
|
19
|
-
export const sharedVar = {
|
|
20
|
-
seqId: 0
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
let colIndex = 0;
|
|
24
|
-
|
|
25
19
|
const defaultDimension = {
|
|
26
20
|
startInTotal: 0,
|
|
27
21
|
level: 0
|
|
@@ -30,7 +24,7 @@ const defaultDimension = {
|
|
|
30
24
|
export class PivotHeaderLayoutMap {
|
|
31
25
|
constructor(table, dataset) {
|
|
32
26
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
33
|
-
if (this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
|
|
27
|
+
if (this.colIndex = 0, this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
|
|
34
28
|
this._cornerHeaderCellIds = [], this._columnHeaderCellIds = [], this._rowHeaderCellIds = [],
|
|
35
29
|
this._rowHeaderCellIds_FULL = [], this._columnWidths = [], this.columnPaths = [],
|
|
36
30
|
this._headerObjects = [], this._headerObjectMap = {}, this._indicators = [], this.indicatorsAsCol = !0,
|
|
@@ -38,10 +32,11 @@ export class PivotHeaderLayoutMap {
|
|
|
38
32
|
this._indicatorShowType = "column", this.rowDimensionKeys = [], this.colDimensionKeys = [],
|
|
39
33
|
this.indicatorKeys = [], this.indicatorDimensionKey = IndicatorDimensionKeyPlaceholder,
|
|
40
34
|
this._rowHeaderExtensionTree = {}, this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [],
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
35
|
+
this.sharedVar = {
|
|
36
|
+
seqId: 0
|
|
37
|
+
}, this._table = table, "tree" === table.options.rowHierarchyType && (this.extensionRows = table.options.extensionRows),
|
|
38
|
+
this.dataset = dataset, this._CellHeaderPathMap = new Map, this.rowTree = table.internalProps.rowTree,
|
|
39
|
+
this.columnTree = table.internalProps.columnTree, this.rowsDefine = null !== (_a = table.internalProps.rows) && void 0 !== _a ? _a : [],
|
|
45
40
|
this.columnsDefine = null !== (_b = table.internalProps.columns) && void 0 !== _b ? _b : [],
|
|
46
41
|
this.indicatorsDefine = null !== (_c = table.internalProps.indicators) && void 0 !== _c ? _c : [],
|
|
47
42
|
this.indicatorTitle = table.options.indicatorTitle, this.indicatorsAsCol = null === (_d = table.options.indicatorsAsCol) || void 0 === _d || _d,
|
|
@@ -72,13 +67,13 @@ export class PivotHeaderLayoutMap {
|
|
|
72
67
|
}
|
|
73
68
|
if (null === (_o = this.indicatorsDefine) || void 0 === _o || _o.forEach((indicator => {
|
|
74
69
|
"string" == typeof indicator ? this.indicatorKeys.push(indicator) : this.indicatorKeys.push(indicator.indicatorKey);
|
|
75
|
-
})), this.columnDimensionTree = new DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : []),
|
|
76
|
-
this.rowDimensionTree = new DimensionTree(null !== (_q = this.rowTree) && void 0 !== _q ? _q : [], this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
|
|
70
|
+
})), this.columnDimensionTree = new DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : [], this.sharedVar),
|
|
71
|
+
this.rowDimensionTree = new DimensionTree(null !== (_q = this.rowTree) && void 0 !== _q ? _q : [], this.sharedVar, this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
|
|
77
72
|
this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr(), this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr(),
|
|
78
73
|
this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys),
|
|
79
|
-
(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, [])),
|
|
74
|
+
this.resetRowHeaderLevelCount(), (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, [])),
|
|
80
75
|
this.columnHeaderTitle) {
|
|
81
|
-
const id = ++sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
|
|
76
|
+
const id = ++this.sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
|
|
82
77
|
this._columnHeaderCellIds.unshift(firstRowIds);
|
|
83
78
|
const cell = {
|
|
84
79
|
id: id,
|
|
@@ -92,9 +87,9 @@ export class PivotHeaderLayoutMap {
|
|
|
92
87
|
};
|
|
93
88
|
this.columnHeaderObjs.push(cell), this._headerObjects[id] = cell;
|
|
94
89
|
}
|
|
95
|
-
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, [])),
|
|
90
|
+
if (this.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, [])),
|
|
96
91
|
this.rowHeaderTitle) {
|
|
97
|
-
const id = ++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);
|
|
92
|
+
const id = ++this.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);
|
|
98
93
|
this._rowHeaderCellIds_FULL.unshift(firstColIds);
|
|
99
94
|
const cell = {
|
|
100
95
|
id: id,
|
|
@@ -108,14 +103,15 @@ export class PivotHeaderLayoutMap {
|
|
|
108
103
|
};
|
|
109
104
|
this.rowHeaderObjs.push(cell), this._headerObjects[id] = cell;
|
|
110
105
|
}
|
|
111
|
-
if (this.
|
|
106
|
+
if (this._table.isPivotChart() && (this.hasTwoIndicatorAxes = this._indicators.some((indicatorObject => !!(indicatorObject.chartSpec && indicatorObject.chartSpec.series && indicatorObject.chartSpec.series.length > 1)))),
|
|
107
|
+
this.resetColumnHeaderLevelCount(), this._rowHeaderCellIds_FULL = transpose(this._rowHeaderCellIds_FULL),
|
|
108
|
+
"tree" === table.options.rowHierarchyType && (null === (_x = this.extensionRows) || void 0 === _x ? void 0 : _x.length) >= 1 && (this.generateExtensionRowTree(),
|
|
112
109
|
this.extensionRows.forEach((extensionRow => {
|
|
113
110
|
const rowKeys = [];
|
|
114
111
|
extensionRow.rows.forEach((row => {
|
|
115
112
|
"string" == typeof row ? rowKeys.push(row) : rowKeys.push(row.dimensionKey);
|
|
116
113
|
})), this._extensionRowDimensionKeys.push(rowKeys), this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(rowKeys);
|
|
117
|
-
}))), this.
|
|
118
|
-
"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) {
|
|
114
|
+
}))), "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) {
|
|
119
115
|
const rowTreeFirstKey = [];
|
|
120
116
|
rowTreeFirstKey.push(this.rowDimensionKeys[0]), this._extensionRowDimensionKeys.forEach((extensionRowKeys => {
|
|
121
117
|
rowTreeFirstKey.push(extensionRowKeys[0]);
|
|
@@ -123,7 +119,7 @@ export class PivotHeaderLayoutMap {
|
|
|
123
119
|
const extensionRowDimensions = this.extensionRows.reduce(((dimensions, cur) => dimensions.concat(cur.rows)), []);
|
|
124
120
|
this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(rowTreeFirstKey) : rowTreeFirstKey, this.rowsDefine.concat(extensionRowDimensions));
|
|
125
121
|
} else this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(this.rowDimensionKeys) : this.rowDimensionKeys, this.rowsDefine); else this.cornerHeaderObjs = this._addCornerHeaders(null, void 0);
|
|
126
|
-
colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
|
|
122
|
+
this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
|
|
127
123
|
o)), {}), this.indicatorsAsCol && !this.hideIndicatorName ? this._indicatorShowType = "column" : this.indicatorsAsCol || this.hideIndicatorName ? this._indicatorShowType = "none" : this._indicatorShowType = "row",
|
|
128
124
|
this.setPagination(table.options.pagination), this._table.isPivotChart() && (this._chartItemSpanSize = 0,
|
|
129
125
|
this._chartItemBandSize = 0, this._indicators.find((indicatorObject => {
|
|
@@ -139,126 +135,41 @@ export class PivotHeaderLayoutMap {
|
|
|
139
135
|
}))), this.setColumnWidths();
|
|
140
136
|
}
|
|
141
137
|
_addHeaders(_headerCellIds, row, header, roots) {
|
|
138
|
+
const _this = this;
|
|
142
139
|
const results = [];
|
|
143
|
-
|
|
140
|
+
_headerCellIds[row] || function(row) {
|
|
144
141
|
const newRow = _headerCellIds[row] = [];
|
|
145
|
-
if (0 === colIndex) return newRow;
|
|
142
|
+
if (0 === _this.colIndex) return newRow;
|
|
146
143
|
const prev = _headerCellIds[row - 1];
|
|
147
144
|
for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
|
|
148
|
-
}(row)
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
style: "function" == typeof (null === (_f = null != indicatorInfo ? indicatorInfo : dimensionInfo) || void 0 === _f ? void 0 : _f.headerStyle) ? null === (_g = null != indicatorInfo ? indicatorInfo : dimensionInfo) || void 0 === _g ? void 0 : _g.headerStyle : Object.assign({}, null === (_h = null != indicatorInfo ? indicatorInfo : dimensionInfo) || void 0 === _h ? void 0 : _h.headerStyle),
|
|
155
|
-
headerType: null !== (_k = null !== (_j = null == indicatorInfo ? void 0 : indicatorInfo.headerType) && void 0 !== _j ? _j : null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _k ? _k : "text",
|
|
156
|
-
headerIcon: null !== (_l = null == indicatorInfo ? void 0 : indicatorInfo.headerIcon) && void 0 !== _l ? _l : null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
|
|
157
|
-
define: Object.assign({}, hd, null != indicatorInfo ? indicatorInfo : dimensionInfo),
|
|
158
|
-
fieldFormat: null !== (_m = null == indicatorInfo ? void 0 : indicatorInfo.headerFormat) && void 0 !== _m ? _m : null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
|
|
159
|
-
dropDownMenu: null !== (_o = null == indicatorInfo ? void 0 : indicatorInfo.dropDownMenu) && void 0 !== _o ? _o : null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
|
|
160
|
-
pivotInfo: {
|
|
161
|
-
value: hd.value,
|
|
162
|
-
dimensionKey: hd.dimensionKey,
|
|
163
|
-
isPivotCorner: !1
|
|
164
|
-
},
|
|
165
|
-
width: null == dimensionInfo ? void 0 : dimensionInfo.width,
|
|
166
|
-
minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
|
|
167
|
-
maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
|
|
168
|
-
showSort: null !== (_p = null == indicatorInfo ? void 0 : indicatorInfo.showSort) && void 0 !== _p ? _p : null == dimensionInfo ? void 0 : dimensionInfo.showSort,
|
|
169
|
-
description: null == dimensionInfo ? void 0 : dimensionInfo.description
|
|
170
|
-
};
|
|
171
|
-
indicatorInfo ? (indicatorInfo.customRender && (hd.customRender = indicatorInfo.customRender),
|
|
172
|
-
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({
|
|
173
|
-
id: ++sharedVar.seqId,
|
|
174
|
-
indicatorKey: indicatorInfo.indicatorKey,
|
|
175
|
-
field: indicatorInfo.indicatorKey,
|
|
176
|
-
fieldFormat: null == indicatorInfo ? void 0 : indicatorInfo.format,
|
|
177
|
-
cellType: null !== (_t = null !== (_s = null == indicatorInfo ? void 0 : indicatorInfo.cellType) && void 0 !== _s ? _s : null == indicatorInfo ? void 0 : indicatorInfo.columnType) && void 0 !== _t ? _t : "text",
|
|
178
|
-
chartModule: "chartModule" in indicatorInfo ? indicatorInfo.chartModule : null,
|
|
179
|
-
chartSpec: "chartSpec" in indicatorInfo ? indicatorInfo.chartSpec : null,
|
|
180
|
-
sparklineSpec: "sparklineSpec" in indicatorInfo ? indicatorInfo.sparklineSpec : null,
|
|
181
|
-
style: null == indicatorInfo ? void 0 : indicatorInfo.style,
|
|
182
|
-
icon: null == indicatorInfo ? void 0 : indicatorInfo.icon,
|
|
183
|
-
define: Object.assign({}, hd, indicatorInfo, {
|
|
184
|
-
dragHeader: null == dimensionInfo ? void 0 : dimensionInfo.dragHeader
|
|
185
|
-
}),
|
|
186
|
-
width: null == indicatorInfo ? void 0 : indicatorInfo.width,
|
|
187
|
-
minWidth: null == indicatorInfo ? void 0 : indicatorInfo.minWidth,
|
|
188
|
-
maxWidth: null == indicatorInfo ? void 0 : indicatorInfo.maxWidth,
|
|
189
|
-
disableColumnResize: null == indicatorInfo ? void 0 : indicatorInfo.disableColumnResize
|
|
190
|
-
})) : hd.indicatorKey && (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({
|
|
191
|
-
id: ++sharedVar.seqId,
|
|
192
|
-
indicatorKey: hd.indicatorKey,
|
|
193
|
-
field: hd.indicatorKey,
|
|
194
|
-
cellType: "text",
|
|
195
|
-
define: Object.assign({}, hd)
|
|
196
|
-
})), results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
|
|
197
|
-
for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
|
|
198
|
-
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 {
|
|
199
|
-
for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
|
|
200
|
-
colIndex++;
|
|
201
|
-
}
|
|
202
|
-
})), results;
|
|
145
|
+
}(row);
|
|
146
|
+
for (let i = 0; i < header.length; i++) {
|
|
147
|
+
const hd = header[i];
|
|
148
|
+
dealHeader(hd, _headerCellIds, results, roots, row, this);
|
|
149
|
+
}
|
|
150
|
+
return results;
|
|
203
151
|
}
|
|
204
152
|
_addHeadersForTreeMode(_headerCellIds, row, header, roots, totalLevel, show, dimensions) {
|
|
153
|
+
const _this = this;
|
|
205
154
|
const results = [];
|
|
206
|
-
|
|
155
|
+
_headerCellIds[row] || function(row) {
|
|
207
156
|
const newRow = _headerCellIds[row] = [];
|
|
208
|
-
if (0 === colIndex) return newRow;
|
|
157
|
+
if (0 === _this.colIndex) return newRow;
|
|
209
158
|
const prev = _headerCellIds[row - 1];
|
|
210
159
|
for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
|
|
211
|
-
}(row)
|
|
212
|
-
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
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, {
|
|
218
|
-
textAlign: "left"
|
|
219
|
-
}),
|
|
220
|
-
headerType: null !== (_a = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _a ? _a : "text",
|
|
221
|
-
headerIcon: null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
|
|
222
|
-
define: Object.assign(hd, {
|
|
223
|
-
linkJump: null == dimensionInfo ? void 0 : dimensionInfo.linkJump,
|
|
224
|
-
linkDetect: null == dimensionInfo ? void 0 : dimensionInfo.linkDetect,
|
|
225
|
-
templateLink: null == dimensionInfo ? void 0 : dimensionInfo.templateLink,
|
|
226
|
-
keepAspectRatio: null !== (_b = null == dimensionInfo ? void 0 : dimensionInfo.keepAspectRatio) && void 0 !== _b && _b,
|
|
227
|
-
imageAutoSizing: null == dimensionInfo ? void 0 : dimensionInfo.imageAutoSizing,
|
|
228
|
-
headerCustomRender: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomRender,
|
|
229
|
-
headerCustomLayout: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomLayout,
|
|
230
|
-
dragHeader: null == dimensionInfo ? void 0 : dimensionInfo.dragHeader
|
|
231
|
-
}),
|
|
232
|
-
fieldFormat: null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
|
|
233
|
-
dropDownMenu: null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
|
|
234
|
-
pivotInfo: {
|
|
235
|
-
value: hd.value,
|
|
236
|
-
dimensionKey: hd.dimensionKey,
|
|
237
|
-
isPivotCorner: !1
|
|
238
|
-
},
|
|
239
|
-
hierarchyLevel: hd.level,
|
|
240
|
-
dimensionTotalLevel: totalLevel,
|
|
241
|
-
hierarchyState: hd.level + 1 === totalLevel ? void 0 : hd.hierarchyState,
|
|
242
|
-
width: null == dimensionInfo ? void 0 : dimensionInfo.width,
|
|
243
|
-
minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
|
|
244
|
-
maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
|
|
245
|
-
parentCellId: roots[roots.length - 1]
|
|
246
|
-
};
|
|
247
|
-
results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
|
|
248
|
-
for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
|
|
249
|
-
if (hd.hierarchyState === HierarchyState.expand && (null === (_c = hd.children) || void 0 === _c ? void 0 : _c.length) >= 1) show && colIndex++,
|
|
250
|
-
this._addHeadersForTreeMode(_headerCellIds, row, null !== (_d = hd.children) && void 0 !== _d ? _d : [], [ ...roots, id ], totalLevel, show && hd.hierarchyState === HierarchyState.expand, dimensions).forEach((c => results.push(c))); else {
|
|
251
|
-
show && colIndex++;
|
|
252
|
-
for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
|
|
253
|
-
}
|
|
254
|
-
})), results;
|
|
160
|
+
}(row);
|
|
161
|
+
for (let i = 0; i < header.length; i++) {
|
|
162
|
+
const hd = header[i];
|
|
163
|
+
dealHeaderForTreeMode(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, this);
|
|
164
|
+
}
|
|
165
|
+
return results;
|
|
255
166
|
}
|
|
256
167
|
_addCornerHeaders(dimensionKeys, dimensions) {
|
|
257
168
|
var _a;
|
|
258
169
|
const results = [];
|
|
259
170
|
if (dimensionKeys) dimensionKeys.forEach(((dimensionKey, key) => {
|
|
260
171
|
var _a, _b;
|
|
261
|
-
const id = ++sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
|
|
172
|
+
const id = ++this.sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
|
|
262
173
|
id: id,
|
|
263
174
|
title: dimensionKey === this.indicatorDimensionKey ? this.indicatorTitle : dimensionInfo ? dimensionInfo.title : "axis" === dimensionKey ? "" : dimensionKey,
|
|
264
175
|
field: "维度名称",
|
|
@@ -283,7 +194,7 @@ export class PivotHeaderLayoutMap {
|
|
|
283
194
|
} else if ("row" === this.cornerSetting.titleOnDimension) for (let r = 0; r < this.columnHeaderLevelCount; r++) this._cornerHeaderCellIds[r] || (this._cornerHeaderCellIds[r] = []),
|
|
284
195
|
this._cornerHeaderCellIds[r][key] = id;
|
|
285
196
|
})); else {
|
|
286
|
-
const id = ++sharedVar.seqId, cell = {
|
|
197
|
+
const id = ++this.sharedVar.seqId, cell = {
|
|
287
198
|
id: id,
|
|
288
199
|
title: "",
|
|
289
200
|
field: "维度名称",
|
|
@@ -307,7 +218,7 @@ export class PivotHeaderLayoutMap {
|
|
|
307
218
|
this._rowHeaderCellIds_FULL = [], old_rowHeaderCellIds.forEach(((row_ids, index) => {
|
|
308
219
|
const key = row_ids[row_ids.length - 1];
|
|
309
220
|
let tree, rowExtensionDimensionTree;
|
|
310
|
-
if (colIndex = 0, "function" == typeof extensionRow.rowTree) {
|
|
221
|
+
if (this.colIndex = 0, "function" == typeof extensionRow.rowTree) {
|
|
311
222
|
const fullCellIds = this.findFullCellIds(row_ids);
|
|
312
223
|
tree = extensionRow.rowTree(fullCellIds.map((id => ({
|
|
313
224
|
dimensionKey: this._headerObjects[id].field,
|
|
@@ -315,7 +226,7 @@ export class PivotHeaderLayoutMap {
|
|
|
315
226
|
}))));
|
|
316
227
|
} else tree = cloneDeep(extensionRow.rowTree);
|
|
317
228
|
this._rowHeaderExtensionTree[key] ? (this._rowHeaderExtensionTree[key].reset(this._rowHeaderExtensionTree[key].tree.children, !0),
|
|
318
|
-
rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new DimensionTree(null != tree ? tree : [], this.rowHierarchyType, void 0),
|
|
229
|
+
rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new DimensionTree(null != tree ? tree : [], this.sharedVar, this.rowHierarchyType, void 0),
|
|
319
230
|
this._rowHeaderExtensionTree[key] = rowExtensionDimensionTree);
|
|
320
231
|
const extensionRowTreeHeaderIds = [];
|
|
321
232
|
this._addHeadersForTreeMode(extensionRowTreeHeaderIds, 0, rowExtensionDimensionTree.tree.children, [], rowExtensionDimensionTree.totalLevel, !0, extensionRow.rows);
|
|
@@ -522,28 +433,41 @@ export class PivotHeaderLayoutMap {
|
|
|
522
433
|
get headerLevelCount() {
|
|
523
434
|
return this.columnHeaderLevelCount;
|
|
524
435
|
}
|
|
525
|
-
|
|
436
|
+
resetColumnHeaderLevelCount() {
|
|
526
437
|
var _a, _b;
|
|
527
438
|
if (this.showHeader && this.showColumnHeader) {
|
|
528
|
-
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;
|
|
439
|
+
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 void (this.columnHeaderLevelCount = 0);
|
|
529
440
|
let count = this.indicatorsAsCol && this.hideIndicatorName && this.colDimensionKeys[this.colDimensionKeys.length - 1] === this.indicatorDimensionKey ? this.columnDimensionTree.totalLevel - 1 : this.columnDimensionTree.totalLevel;
|
|
530
441
|
return this.columnHeaderTitle && (count += 1), this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && (count -= 1),
|
|
531
|
-
count;
|
|
442
|
+
void (this.columnHeaderLevelCount = count);
|
|
532
443
|
}
|
|
533
|
-
|
|
444
|
+
this.columnHeaderLevelCount = 0;
|
|
534
445
|
}
|
|
535
|
-
|
|
446
|
+
resetRowHeaderLevelCount() {
|
|
536
447
|
var _a, _b;
|
|
537
448
|
if (this.showHeader && this.showRowHeader) {
|
|
538
449
|
if ("tree" === this.rowHierarchyType) {
|
|
539
450
|
const extensionRowCount = null !== (_b = null === (_a = this.extensionRows) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
|
|
540
|
-
return this.rowHeaderTitle ? 2 + extensionRowCount : 1 + extensionRowCount;
|
|
451
|
+
return this.rowHeaderTitle ? void (this.rowHeaderLevelCount = 2 + extensionRowCount) : void (this.rowHeaderLevelCount = 1 + extensionRowCount);
|
|
541
452
|
}
|
|
542
453
|
const rowLevelCount = this.rowDimensionKeys.length;
|
|
543
|
-
let count =
|
|
544
|
-
return this.
|
|
454
|
+
let count = rowLevelCount;
|
|
455
|
+
return this.indicatorsAsCol || this.hideIndicatorName && this.rowDimensionKeys[0] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
|
|
456
|
+
this.rowHeaderTitle && (count += 1), void (this.rowHeaderLevelCount = count);
|
|
545
457
|
}
|
|
546
|
-
|
|
458
|
+
this.rowHeaderLevelCount = this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
|
|
459
|
+
}
|
|
460
|
+
get columnHeaderLevelCount() {
|
|
461
|
+
return this._columnHeaderLevelCount;
|
|
462
|
+
}
|
|
463
|
+
set columnHeaderLevelCount(count) {
|
|
464
|
+
this._columnHeaderLevelCount = count;
|
|
465
|
+
}
|
|
466
|
+
get rowHeaderLevelCount() {
|
|
467
|
+
return this._rowHeaderLevelCount;
|
|
468
|
+
}
|
|
469
|
+
set rowHeaderLevelCount(count) {
|
|
470
|
+
this._rowHeaderLevelCount = count;
|
|
547
471
|
}
|
|
548
472
|
get colCount() {
|
|
549
473
|
return this.columnDimensionTree.tree.size + this.rowHeaderLevelCount + this.rightHeaderColCount;
|
|
@@ -669,7 +593,6 @@ export class PivotHeaderLayoutMap {
|
|
|
669
593
|
};
|
|
670
594
|
if (!this.isHeader(col, row) || -1 === col || -1 === row) return result;
|
|
671
595
|
if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) return result;
|
|
672
|
-
if (this._cellRangeMap.has(`${col}-${row}`)) return this._cellRangeMap.get(`${col}-${row}`);
|
|
673
596
|
if (this.isHeader(col, row) && -1 !== col && -1 !== row) {
|
|
674
597
|
const id = this.getCellId(col, row);
|
|
675
598
|
for (let c = col - 1; c >= 0 && id === this.getCellId(c, row); c--) result.start.col = c;
|
|
@@ -677,7 +600,7 @@ export class PivotHeaderLayoutMap {
|
|
|
677
600
|
for (let r = row - 1; r >= 0 && id === this.getCellId(col, r); r--) result.start.row = r;
|
|
678
601
|
for (let r = row + 1; r < (null !== (_b = this.rowCount) && void 0 !== _b ? _b : 0) && id === this.getCellId(col, r); r++) result.end.row = r;
|
|
679
602
|
}
|
|
680
|
-
return
|
|
603
|
+
return result;
|
|
681
604
|
}
|
|
682
605
|
isCellRangeEqual(col, row, targetCol, targetRow) {
|
|
683
606
|
const range1 = this.getCellRange(col, row), range2 = this.getCellRange(targetCol, targetRow);
|
|
@@ -792,7 +715,7 @@ export class PivotHeaderLayoutMap {
|
|
|
792
715
|
this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this._rowHeaderCellIds_FULL = [],
|
|
793
716
|
this.rowHeaderObjs = this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine),
|
|
794
717
|
this.rowHeaderTitle) {
|
|
795
|
-
const id = ++sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
|
|
718
|
+
const id = ++this.sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
|
|
796
719
|
this._rowHeaderCellIds_FULL.unshift(firstColIds);
|
|
797
720
|
const cell = {
|
|
798
721
|
id: id,
|
|
@@ -809,8 +732,8 @@ export class PivotHeaderLayoutMap {
|
|
|
809
732
|
this.rowHeaderObjs.push(cell), this._headerObjects[id] = cell;
|
|
810
733
|
}
|
|
811
734
|
this._rowHeaderCellIds_FULL = transpose(this._rowHeaderCellIds_FULL), "tree" === this.rowHierarchyType && (null === (_b = this.extensionRows) || void 0 === _b ? void 0 : _b.length) >= 1 && this.generateExtensionRowTree(),
|
|
812
|
-
colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
|
|
813
|
-
o)), {}), this._CellHeaderPathMap = new Map
|
|
735
|
+
this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
|
|
736
|
+
o)), {}), this._CellHeaderPathMap = new Map;
|
|
814
737
|
const diffCell = diffCellAddress(col, row, oldRowHeaderCellIds.map((oldCellId => oldCellId[col])), this._rowHeaderCellIds_FULL.map((newCellId => newCellId[col])), oldRowHeaderCellPositons, this);
|
|
815
738
|
return this._rowHeaderCellIds = this._rowHeaderCellIds_FULL, diffCell;
|
|
816
739
|
}
|
|
@@ -910,11 +833,8 @@ export class PivotHeaderLayoutMap {
|
|
|
910
833
|
}
|
|
911
834
|
getRowHeaderCellAddressByCellId(cellId) {
|
|
912
835
|
let col, row;
|
|
913
|
-
if (this._rowHeaderCellIds.find(((cellIds, rowIndex) =>
|
|
914
|
-
|
|
915
|
-
!0)));
|
|
916
|
-
return !!finded && (row = rowIndex, !0);
|
|
917
|
-
})), isValid(col) && isValid(row)) return {
|
|
836
|
+
if (this._rowHeaderCellIds.find(((cellIds, rowIndex) => !!cellIds.find(((id, colIndex) => id === cellId && (col = colIndex,
|
|
837
|
+
!0))) && (row = rowIndex, !0))), isValid(col) && isValid(row)) return {
|
|
918
838
|
col: col,
|
|
919
839
|
row: row + this.columnHeaderLevelCount
|
|
920
840
|
};
|
|
@@ -953,7 +873,7 @@ export class PivotHeaderLayoutMap {
|
|
|
953
873
|
return sourceColumns.unshift(targetIndex, 0), Array.prototype.splice.apply(this._columnWidths, sourceColumns),
|
|
954
874
|
this.columnDimensionTree.movePosition(source.row, sourceCellRange.start.col - this.rowHeaderLevelCount, targetIndex - this.rowHeaderLevelCount),
|
|
955
875
|
this.columnDimensionTree.reset(this.columnDimensionTree.tree.children, !0), this._CellHeaderPathMap = new Map,
|
|
956
|
-
|
|
876
|
+
{
|
|
957
877
|
sourceIndex: sourceCellRange.start.col,
|
|
958
878
|
targetIndex: targetIndex,
|
|
959
879
|
moveSize: moveSize,
|
|
@@ -971,7 +891,7 @@ export class PivotHeaderLayoutMap {
|
|
|
971
891
|
return sourceIds_FULL.unshift(targetIndex, 0), Array.prototype.splice.apply(this._rowHeaderCellIds_FULL, sourceIds_FULL),
|
|
972
892
|
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)),
|
|
973
893
|
this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this._CellHeaderPathMap = new Map,
|
|
974
|
-
|
|
894
|
+
{
|
|
975
895
|
sourceIndex: sourceCellRange.start.row,
|
|
976
896
|
targetIndex: targetIndex + this.columnHeaderLevelCount,
|
|
977
897
|
moveSize: moveSize,
|
|
@@ -1145,7 +1065,7 @@ export class PivotHeaderLayoutMap {
|
|
|
1145
1065
|
return rowDimension || (colDimension || void 0);
|
|
1146
1066
|
}
|
|
1147
1067
|
clearCellRangeMap() {
|
|
1148
|
-
this.
|
|
1068
|
+
this._CellHeaderPathMap = new Map;
|
|
1149
1069
|
}
|
|
1150
1070
|
getDimensionKeyInChartSpec(_col, _row) {
|
|
1151
1071
|
var _a, _b, _c, _d;
|