@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.
Files changed (93) hide show
  1. package/cjs/components/axis/axis.d.ts +3 -1
  2. package/cjs/components/axis/axis.js +10 -8
  3. package/cjs/components/axis/axis.js.map +1 -1
  4. package/cjs/core/BaseTable.js +17 -6
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/index.d.ts +1 -1
  7. package/cjs/index.js +1 -1
  8. package/cjs/index.js.map +1 -1
  9. package/cjs/layout/chart-helper/get-axis-config.d.ts +2 -0
  10. package/cjs/layout/chart-helper/get-axis-config.js +23 -2
  11. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  12. package/cjs/layout/pivot-header-layout.d.ts +15 -9
  13. package/cjs/layout/pivot-header-layout.js +71 -154
  14. package/cjs/layout/pivot-header-layout.js.map +1 -1
  15. package/cjs/layout/pivot-layout-helper.d.ts +10 -2
  16. package/cjs/layout/pivot-layout-helper.js +108 -6
  17. package/cjs/layout/pivot-layout-helper.js.map +1 -1
  18. package/cjs/layout/simple-header-layout.d.ts +1 -0
  19. package/cjs/layout/simple-header-layout.js +5 -7
  20. package/cjs/layout/simple-header-layout.js.map +1 -1
  21. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
  22. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  23. package/cjs/scenegraph/graphic/group.js +5 -3
  24. package/cjs/scenegraph/graphic/group.js.map +1 -1
  25. package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
  26. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  27. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -0
  28. package/cjs/scenegraph/group-creater/progress/proxy.js +12 -0
  29. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  30. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +3 -3
  31. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  32. package/cjs/scenegraph/layout/compute-col-width.js +28 -17
  33. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  34. package/cjs/scenegraph/layout/compute-row-height.js +21 -7
  35. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  36. package/cjs/scenegraph/layout/update-row.js +8 -3
  37. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  38. package/cjs/scenegraph/layout/update-width.js +3 -2
  39. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  40. package/cjs/scenegraph/refresh-node/update-chart.js +3 -2
  41. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  42. package/cjs/scenegraph/scenegraph.js +2 -2
  43. package/cjs/scenegraph/scenegraph.js.map +1 -1
  44. package/cjs/scenegraph/style/frame-border.js +26 -12
  45. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  46. package/dist/vtable.js +490 -286
  47. package/dist/vtable.min.js +2 -2
  48. package/es/components/axis/axis.d.ts +3 -1
  49. package/es/components/axis/axis.js +7 -5
  50. package/es/components/axis/axis.js.map +1 -1
  51. package/es/core/BaseTable.js +18 -5
  52. package/es/core/BaseTable.js.map +1 -1
  53. package/es/index.d.ts +1 -1
  54. package/es/index.js +1 -1
  55. package/es/index.js.map +1 -1
  56. package/es/layout/chart-helper/get-axis-config.d.ts +2 -0
  57. package/es/layout/chart-helper/get-axis-config.js +20 -0
  58. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  59. package/es/layout/pivot-header-layout.d.ts +15 -9
  60. package/es/layout/pivot-header-layout.js +71 -151
  61. package/es/layout/pivot-header-layout.js.map +1 -1
  62. package/es/layout/pivot-layout-helper.d.ts +10 -2
  63. package/es/layout/pivot-layout-helper.js +107 -5
  64. package/es/layout/pivot-layout-helper.js.map +1 -1
  65. package/es/layout/simple-header-layout.d.ts +1 -0
  66. package/es/layout/simple-header-layout.js +5 -7
  67. package/es/layout/simple-header-layout.js.map +1 -1
  68. package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
  69. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  70. package/es/scenegraph/graphic/group.js +5 -3
  71. package/es/scenegraph/graphic/group.js.map +1 -1
  72. package/es/scenegraph/group-creater/cell-helper.js +1 -1
  73. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  74. package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -0
  75. package/es/scenegraph/group-creater/progress/proxy.js +12 -0
  76. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  77. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +3 -3
  78. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  79. package/es/scenegraph/layout/compute-col-width.js +28 -17
  80. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  81. package/es/scenegraph/layout/compute-row-height.js +21 -7
  82. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  83. package/es/scenegraph/layout/update-row.js +8 -3
  84. package/es/scenegraph/layout/update-row.js.map +1 -1
  85. package/es/scenegraph/layout/update-width.js +2 -2
  86. package/es/scenegraph/layout/update-width.js.map +1 -1
  87. package/es/scenegraph/refresh-node/update-chart.js +5 -1
  88. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  89. package/es/scenegraph/scenegraph.js +2 -2
  90. package/es/scenegraph/scenegraph.js.map +1 -1
  91. package/es/scenegraph/style/frame-border.js +25 -11
  92. package/es/scenegraph/style/frame-border.js.map +1 -1
  93. package/package.json +5 -5
@@ -2,17 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.PivotHeaderLayoutMap = exports.sharedVar = void 0;
5
+ }), exports.PivotHeaderLayoutMap = void 0;
6
6
 
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
-
9
- exports.sharedVar = {
10
- seqId: 0
11
- };
12
-
13
- let colIndex = 0;
14
-
15
- const defaultDimension = {
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"), defaultDimension = {
16
8
  startInTotal: 0,
17
9
  level: 0
18
10
  };
@@ -20,7 +12,7 @@ const defaultDimension = {
20
12
  class PivotHeaderLayoutMap {
21
13
  constructor(table, dataset) {
22
14
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
23
- if (this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
15
+ if (this.colIndex = 0, this._showHeader = !0, this.columnHeaderObjs = [], this.rowHeaderObjs = [],
24
16
  this._cornerHeaderCellIds = [], this._columnHeaderCellIds = [], this._rowHeaderCellIds = [],
25
17
  this._rowHeaderCellIds_FULL = [], this._columnWidths = [], this.columnPaths = [],
26
18
  this._headerObjects = [], this._headerObjectMap = {}, this._indicators = [], this.indicatorsAsCol = !0,
@@ -28,10 +20,11 @@ class PivotHeaderLayoutMap {
28
20
  this._indicatorShowType = "column", this.rowDimensionKeys = [], this.colDimensionKeys = [],
29
21
  this.indicatorKeys = [], this.indicatorDimensionKey = global_1.IndicatorDimensionKeyPlaceholder,
30
22
  this._rowHeaderExtensionTree = {}, this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [],
31
- this._table = table, "tree" === table.options.rowHierarchyType && (this.extensionRows = table.options.extensionRows),
32
- this.dataset = dataset, this._cellRangeMap = new Map, this._CellHeaderPathMap = new Map,
33
- this.rowTree = table.internalProps.rowTree, this.columnTree = table.internalProps.columnTree,
34
- this.rowsDefine = null !== (_a = table.internalProps.rows) && void 0 !== _a ? _a : [],
23
+ this.sharedVar = {
24
+ seqId: 0
25
+ }, this._table = table, "tree" === table.options.rowHierarchyType && (this.extensionRows = table.options.extensionRows),
26
+ this.dataset = dataset, this._CellHeaderPathMap = new Map, this.rowTree = table.internalProps.rowTree,
27
+ this.columnTree = table.internalProps.columnTree, this.rowsDefine = null !== (_a = table.internalProps.rows) && void 0 !== _a ? _a : [],
35
28
  this.columnsDefine = null !== (_b = table.internalProps.columns) && void 0 !== _b ? _b : [],
36
29
  this.indicatorsDefine = null !== (_c = table.internalProps.indicators) && void 0 !== _c ? _c : [],
37
30
  this.indicatorTitle = table.options.indicatorTitle, this.indicatorsAsCol = null === (_d = table.options.indicatorsAsCol) || void 0 === _d || _d,
@@ -62,13 +55,13 @@ class PivotHeaderLayoutMap {
62
55
  }
63
56
  if (null === (_o = this.indicatorsDefine) || void 0 === _o || _o.forEach((indicator => {
64
57
  "string" == typeof indicator ? this.indicatorKeys.push(indicator) : this.indicatorKeys.push(indicator.indicatorKey);
65
- })), this.columnDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : []),
66
- 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),
58
+ })), this.columnDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_p = this.columnTree) && void 0 !== _p ? _p : [], this.sharedVar),
59
+ this.rowDimensionTree = new pivot_layout_helper_1.DimensionTree(null !== (_q = this.rowTree) && void 0 !== _q ? _q : [], this.sharedVar, this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
67
60
  this.colDimensionKeys = this.columnDimensionTree.dimensionKeys.valueArr(), this.rowDimensionKeys = this.rowDimensionTree.dimensionKeys.valueArr(),
68
61
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys),
69
- (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, [])),
62
+ 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, [])),
70
63
  this.columnHeaderTitle) {
71
- const id = ++exports.sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
64
+ const id = ++this.sharedVar.seqId, firstRowIds = Array(this.colCount - this.rowHeaderLevelCount).fill(id);
72
65
  this._columnHeaderCellIds.unshift(firstRowIds);
73
66
  const cell = {
74
67
  id: id,
@@ -82,9 +75,9 @@ class PivotHeaderLayoutMap {
82
75
  };
83
76
  this.columnHeaderObjs.push(cell), this._headerObjects[id] = cell;
84
77
  }
85
- 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, [])),
78
+ 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, [])),
86
79
  this.rowHeaderTitle) {
87
- 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);
80
+ 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);
88
81
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
89
82
  const cell = {
90
83
  id: id,
@@ -98,15 +91,15 @@ class PivotHeaderLayoutMap {
98
91
  };
99
92
  this.rowHeaderObjs.push(cell), this._headerObjects[id] = cell;
100
93
  }
101
- if (this._rowHeaderCellIds_FULL = (0, util_1.transpose)(this._rowHeaderCellIds_FULL),
94
+ if (this._table.isPivotChart() && (this.hasTwoIndicatorAxes = this._indicators.some((indicatorObject => !!(indicatorObject.chartSpec && indicatorObject.chartSpec.series && indicatorObject.chartSpec.series.length > 1)))),
95
+ this.resetColumnHeaderLevelCount(), this._rowHeaderCellIds_FULL = (0, util_1.transpose)(this._rowHeaderCellIds_FULL),
102
96
  "tree" === table.options.rowHierarchyType && (null === (_x = this.extensionRows) || void 0 === _x ? void 0 : _x.length) >= 1 && (this.generateExtensionRowTree(),
103
97
  this.extensionRows.forEach((extensionRow => {
104
98
  const rowKeys = [];
105
99
  extensionRow.rows.forEach((row => {
106
100
  "string" == typeof row ? rowKeys.push(row) : rowKeys.push(row.dimensionKey);
107
101
  })), this._extensionRowDimensionKeys.push(rowKeys), this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(rowKeys);
108
- }))), this._table.isPivotChart() && (this.hasTwoIndicatorAxes = this._indicators.some((indicatorObject => !!(indicatorObject.chartSpec && indicatorObject.chartSpec.series && indicatorObject.chartSpec.series.length > 1)))),
109
- "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) {
102
+ }))), "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) {
110
103
  const rowTreeFirstKey = [];
111
104
  rowTreeFirstKey.push(this.rowDimensionKeys[0]), this._extensionRowDimensionKeys.forEach((extensionRowKeys => {
112
105
  rowTreeFirstKey.push(extensionRowKeys[0]);
@@ -114,7 +107,7 @@ class PivotHeaderLayoutMap {
114
107
  const extensionRowDimensions = this.extensionRows.reduce(((dimensions, cur) => dimensions.concat(cur.rows)), []);
115
108
  this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(rowTreeFirstKey) : rowTreeFirstKey, this.rowsDefine.concat(extensionRowDimensions));
116
109
  } else this.cornerHeaderObjs = this._addCornerHeaders(this.rowHeaderTitle ? [ "" ].concat(this.rowDimensionKeys) : this.rowDimensionKeys, this.rowsDefine); else this.cornerHeaderObjs = this._addCornerHeaders(null, void 0);
117
- colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
110
+ this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
118
111
  o)), {}), this.indicatorsAsCol && !this.hideIndicatorName ? this._indicatorShowType = "column" : this.indicatorsAsCol || this.hideIndicatorName ? this._indicatorShowType = "none" : this._indicatorShowType = "row",
119
112
  this.setPagination(table.options.pagination), this._table.isPivotChart() && (this._chartItemSpanSize = 0,
120
113
  this._chartItemBandSize = 0, this._indicators.find((indicatorObject => {
@@ -130,126 +123,41 @@ class PivotHeaderLayoutMap {
130
123
  }))), this.setColumnWidths();
131
124
  }
132
125
  _addHeaders(_headerCellIds, row, header, roots) {
126
+ const _this = this;
133
127
  const results = [];
134
- return _headerCellIds[row] || function(row) {
128
+ _headerCellIds[row] || function(row) {
135
129
  const newRow = _headerCellIds[row] = [];
136
- if (0 === colIndex) return newRow;
130
+ if (0 === _this.colIndex) return newRow;
137
131
  const prev = _headerCellIds[row - 1];
138
132
  for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
139
- }(row), header.forEach((hd => {
140
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
141
- 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 = {
142
- id: id,
143
- title: null !== (_e = hd.value) && void 0 !== _e ? _e : null == indicatorInfo ? void 0 : indicatorInfo.title,
144
- field: hd.dimensionKey,
145
- 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),
146
- 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",
147
- headerIcon: null !== (_l = null == indicatorInfo ? void 0 : indicatorInfo.headerIcon) && void 0 !== _l ? _l : null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
148
- define: Object.assign({}, hd, null != indicatorInfo ? indicatorInfo : dimensionInfo),
149
- fieldFormat: null !== (_m = null == indicatorInfo ? void 0 : indicatorInfo.headerFormat) && void 0 !== _m ? _m : null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
150
- dropDownMenu: null !== (_o = null == indicatorInfo ? void 0 : indicatorInfo.dropDownMenu) && void 0 !== _o ? _o : null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
151
- pivotInfo: {
152
- value: hd.value,
153
- dimensionKey: hd.dimensionKey,
154
- isPivotCorner: !1
155
- },
156
- width: null == dimensionInfo ? void 0 : dimensionInfo.width,
157
- minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
158
- maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
159
- showSort: null !== (_p = null == indicatorInfo ? void 0 : indicatorInfo.showSort) && void 0 !== _p ? _p : null == dimensionInfo ? void 0 : dimensionInfo.showSort,
160
- description: null == dimensionInfo ? void 0 : dimensionInfo.description
161
- };
162
- indicatorInfo ? (indicatorInfo.customRender && (hd.customRender = indicatorInfo.customRender),
163
- (0, vutils_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({
164
- id: ++exports.sharedVar.seqId,
165
- indicatorKey: indicatorInfo.indicatorKey,
166
- field: indicatorInfo.indicatorKey,
167
- fieldFormat: null == indicatorInfo ? void 0 : indicatorInfo.format,
168
- 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",
169
- chartModule: "chartModule" in indicatorInfo ? indicatorInfo.chartModule : null,
170
- chartSpec: "chartSpec" in indicatorInfo ? indicatorInfo.chartSpec : null,
171
- sparklineSpec: "sparklineSpec" in indicatorInfo ? indicatorInfo.sparklineSpec : null,
172
- style: null == indicatorInfo ? void 0 : indicatorInfo.style,
173
- icon: null == indicatorInfo ? void 0 : indicatorInfo.icon,
174
- define: Object.assign({}, hd, indicatorInfo, {
175
- dragHeader: null == dimensionInfo ? void 0 : dimensionInfo.dragHeader
176
- }),
177
- width: null == indicatorInfo ? void 0 : indicatorInfo.width,
178
- minWidth: null == indicatorInfo ? void 0 : indicatorInfo.minWidth,
179
- maxWidth: null == indicatorInfo ? void 0 : indicatorInfo.maxWidth,
180
- disableColumnResize: null == indicatorInfo ? void 0 : indicatorInfo.disableColumnResize
181
- })) : hd.indicatorKey && ((0, vutils_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({
182
- id: ++exports.sharedVar.seqId,
183
- indicatorKey: hd.indicatorKey,
184
- field: hd.indicatorKey,
185
- cellType: "text",
186
- define: Object.assign({}, hd)
187
- })), results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
188
- for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
189
- 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 {
190
- for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
191
- colIndex++;
192
- }
193
- })), results;
133
+ }(row);
134
+ for (let i = 0; i < header.length; i++) {
135
+ const hd = header[i];
136
+ (0, pivot_layout_helper_1.dealHeader)(hd, _headerCellIds, results, roots, row, this);
137
+ }
138
+ return results;
194
139
  }
195
140
  _addHeadersForTreeMode(_headerCellIds, row, header, roots, totalLevel, show, dimensions) {
141
+ const _this = this;
196
142
  const results = [];
197
- return _headerCellIds[row] || function(row) {
143
+ _headerCellIds[row] || function(row) {
198
144
  const newRow = _headerCellIds[row] = [];
199
- if (0 === colIndex) return newRow;
145
+ if (0 === _this.colIndex) return newRow;
200
146
  const prev = _headerCellIds[row - 1];
201
147
  for (let col = 0; col < (null == prev ? void 0 : prev.length); col++) newRow[col] = prev[col];
202
- }(row), header.forEach((hd => {
203
- var _a, _b, _c, _d;
204
- const id = hd.id, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === hd.dimensionKey)), cell = {
205
- id: id,
206
- title: hd.value,
207
- field: hd.dimensionKey,
208
- 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, {
209
- textAlign: "left"
210
- }),
211
- headerType: null !== (_a = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _a ? _a : "text",
212
- headerIcon: null == dimensionInfo ? void 0 : dimensionInfo.headerIcon,
213
- define: Object.assign(hd, {
214
- linkJump: null == dimensionInfo ? void 0 : dimensionInfo.linkJump,
215
- linkDetect: null == dimensionInfo ? void 0 : dimensionInfo.linkDetect,
216
- templateLink: null == dimensionInfo ? void 0 : dimensionInfo.templateLink,
217
- keepAspectRatio: null !== (_b = null == dimensionInfo ? void 0 : dimensionInfo.keepAspectRatio) && void 0 !== _b && _b,
218
- imageAutoSizing: null == dimensionInfo ? void 0 : dimensionInfo.imageAutoSizing,
219
- headerCustomRender: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomRender,
220
- headerCustomLayout: null == dimensionInfo ? void 0 : dimensionInfo.headerCustomLayout,
221
- dragHeader: null == dimensionInfo ? void 0 : dimensionInfo.dragHeader
222
- }),
223
- fieldFormat: null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
224
- dropDownMenu: null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
225
- pivotInfo: {
226
- value: hd.value,
227
- dimensionKey: hd.dimensionKey,
228
- isPivotCorner: !1
229
- },
230
- hierarchyLevel: hd.level,
231
- dimensionTotalLevel: totalLevel,
232
- hierarchyState: hd.level + 1 === totalLevel ? void 0 : hd.hierarchyState,
233
- width: null == dimensionInfo ? void 0 : dimensionInfo.width,
234
- minWidth: null == dimensionInfo ? void 0 : dimensionInfo.minWidth,
235
- maxWidth: null == dimensionInfo ? void 0 : dimensionInfo.maxWidth,
236
- parentCellId: roots[roots.length - 1]
237
- };
238
- results[id] = cell, this._headerObjects[id] = cell, _headerCellIds[row][colIndex] = id;
239
- for (let r = row - 1; r >= 0; r--) _headerCellIds[r][colIndex] = roots[r];
240
- if (hd.hierarchyState === ts_types_1.HierarchyState.expand && (null === (_c = hd.children) || void 0 === _c ? void 0 : _c.length) >= 1) show && colIndex++,
241
- 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 {
242
- show && colIndex++;
243
- for (let r = row + 1; r < _headerCellIds.length; r++) _headerCellIds[r][colIndex] = id;
244
- }
245
- })), results;
148
+ }(row);
149
+ for (let i = 0; i < header.length; i++) {
150
+ const hd = header[i];
151
+ (0, pivot_layout_helper_1.dealHeaderForTreeMode)(hd, _headerCellIds, results, roots, row, totalLevel, show, dimensions, this);
152
+ }
153
+ return results;
246
154
  }
247
155
  _addCornerHeaders(dimensionKeys, dimensions) {
248
156
  var _a;
249
157
  const results = [];
250
158
  if (dimensionKeys) dimensionKeys.forEach(((dimensionKey, key) => {
251
159
  var _a, _b;
252
- const id = ++exports.sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
160
+ const id = ++this.sharedVar.seqId, dimensionInfo = dimensions.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey)), cell = {
253
161
  id: id,
254
162
  title: dimensionKey === this.indicatorDimensionKey ? this.indicatorTitle : dimensionInfo ? dimensionInfo.title : "axis" === dimensionKey ? "" : dimensionKey,
255
163
  field: "维度名称",
@@ -274,7 +182,7 @@ class PivotHeaderLayoutMap {
274
182
  } else if ("row" === this.cornerSetting.titleOnDimension) for (let r = 0; r < this.columnHeaderLevelCount; r++) this._cornerHeaderCellIds[r] || (this._cornerHeaderCellIds[r] = []),
275
183
  this._cornerHeaderCellIds[r][key] = id;
276
184
  })); else {
277
- const id = ++exports.sharedVar.seqId, cell = {
185
+ const id = ++this.sharedVar.seqId, cell = {
278
186
  id: id,
279
187
  title: "",
280
188
  field: "维度名称",
@@ -298,7 +206,7 @@ class PivotHeaderLayoutMap {
298
206
  this._rowHeaderCellIds_FULL = [], old_rowHeaderCellIds.forEach(((row_ids, index) => {
299
207
  const key = row_ids[row_ids.length - 1];
300
208
  let tree, rowExtensionDimensionTree;
301
- if (colIndex = 0, "function" == typeof extensionRow.rowTree) {
209
+ if (this.colIndex = 0, "function" == typeof extensionRow.rowTree) {
302
210
  const fullCellIds = this.findFullCellIds(row_ids);
303
211
  tree = extensionRow.rowTree(fullCellIds.map((id => ({
304
212
  dimensionKey: this._headerObjects[id].field,
@@ -306,7 +214,7 @@ class PivotHeaderLayoutMap {
306
214
  }))));
307
215
  } else tree = (0, vutils_1.cloneDeep)(extensionRow.rowTree);
308
216
  this._rowHeaderExtensionTree[key] ? (this._rowHeaderExtensionTree[key].reset(this._rowHeaderExtensionTree[key].tree.children, !0),
309
- rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new pivot_layout_helper_1.DimensionTree(null != tree ? tree : [], this.rowHierarchyType, void 0),
217
+ rowExtensionDimensionTree = this._rowHeaderExtensionTree[key]) : (rowExtensionDimensionTree = new pivot_layout_helper_1.DimensionTree(null != tree ? tree : [], this.sharedVar, this.rowHierarchyType, void 0),
310
218
  this._rowHeaderExtensionTree[key] = rowExtensionDimensionTree);
311
219
  const extensionRowTreeHeaderIds = [];
312
220
  this._addHeadersForTreeMode(extensionRowTreeHeaderIds, 0, rowExtensionDimensionTree.tree.children, [], rowExtensionDimensionTree.totalLevel, !0, extensionRow.rows);
@@ -513,28 +421,41 @@ class PivotHeaderLayoutMap {
513
421
  get headerLevelCount() {
514
422
  return this.columnHeaderLevelCount;
515
423
  }
516
- get columnHeaderLevelCount() {
424
+ resetColumnHeaderLevelCount() {
517
425
  var _a, _b;
518
426
  if (this.showHeader && this.showColumnHeader) {
519
- 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;
427
+ 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);
520
428
  let count = this.indicatorsAsCol && this.hideIndicatorName && this.colDimensionKeys[this.colDimensionKeys.length - 1] === this.indicatorDimensionKey ? this.columnDimensionTree.totalLevel - 1 : this.columnDimensionTree.totalLevel;
521
429
  return this.columnHeaderTitle && (count += 1), this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && (count -= 1),
522
- count;
430
+ void (this.columnHeaderLevelCount = count);
523
431
  }
524
- return 0;
432
+ this.columnHeaderLevelCount = 0;
525
433
  }
526
- get rowHeaderLevelCount() {
434
+ resetRowHeaderLevelCount() {
527
435
  var _a, _b;
528
436
  if (this.showHeader && this.showRowHeader) {
529
437
  if ("tree" === this.rowHierarchyType) {
530
438
  const extensionRowCount = null !== (_b = null === (_a = this.extensionRows) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0;
531
- return this.rowHeaderTitle ? 2 + extensionRowCount : 1 + extensionRowCount;
439
+ return this.rowHeaderTitle ? void (this.rowHeaderLevelCount = 2 + extensionRowCount) : void (this.rowHeaderLevelCount = 1 + extensionRowCount);
532
440
  }
533
441
  const rowLevelCount = this.rowDimensionKeys.length;
534
- let count = this.indicatorsAsCol ? rowLevelCount : this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey ? rowLevelCount - 1 : rowLevelCount;
535
- return this.rowHeaderTitle && (count += 1), count;
442
+ let count = rowLevelCount;
443
+ return this.indicatorsAsCol || this.hideIndicatorName && this.rowDimensionKeys[0] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
444
+ this.rowHeaderTitle && (count += 1), void (this.rowHeaderLevelCount = count);
536
445
  }
537
- return this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
446
+ this.rowHeaderLevelCount = this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
447
+ }
448
+ get columnHeaderLevelCount() {
449
+ return this._columnHeaderLevelCount;
450
+ }
451
+ set columnHeaderLevelCount(count) {
452
+ this._columnHeaderLevelCount = count;
453
+ }
454
+ get rowHeaderLevelCount() {
455
+ return this._rowHeaderLevelCount;
456
+ }
457
+ set rowHeaderLevelCount(count) {
458
+ this._rowHeaderLevelCount = count;
538
459
  }
539
460
  get colCount() {
540
461
  return this.columnDimensionTree.tree.size + this.rowHeaderLevelCount + this.rightHeaderColCount;
@@ -660,7 +581,6 @@ class PivotHeaderLayoutMap {
660
581
  };
661
582
  if (!this.isHeader(col, row) || -1 === col || -1 === row) return result;
662
583
  if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) return result;
663
- if (this._cellRangeMap.has(`${col}-${row}`)) return this._cellRangeMap.get(`${col}-${row}`);
664
584
  if (this.isHeader(col, row) && -1 !== col && -1 !== row) {
665
585
  const id = this.getCellId(col, row);
666
586
  for (let c = col - 1; c >= 0 && id === this.getCellId(c, row); c--) result.start.col = c;
@@ -668,7 +588,7 @@ class PivotHeaderLayoutMap {
668
588
  for (let r = row - 1; r >= 0 && id === this.getCellId(col, r); r--) result.start.row = r;
669
589
  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;
670
590
  }
671
- return this._cellRangeMap.set(`${col}-${row}`, result), result;
591
+ return result;
672
592
  }
673
593
  isCellRangeEqual(col, row, targetCol, targetRow) {
674
594
  const range1 = this.getCellRange(col, row), range2 = this.getCellRange(targetCol, targetRow);
@@ -783,7 +703,7 @@ class PivotHeaderLayoutMap {
783
703
  this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this._rowHeaderCellIds_FULL = [],
784
704
  this.rowHeaderObjs = this._addHeadersForTreeMode(this._rowHeaderCellIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine),
785
705
  this.rowHeaderTitle) {
786
- const id = ++exports.sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
706
+ const id = ++this.sharedVar.seqId, firstColIds = Array(this.rowCount - this.columnHeaderLevelCount).fill(id);
787
707
  this._rowHeaderCellIds_FULL.unshift(firstColIds);
788
708
  const cell = {
789
709
  id: id,
@@ -801,8 +721,8 @@ class PivotHeaderLayoutMap {
801
721
  }
802
722
  this._rowHeaderCellIds_FULL = (0, util_1.transpose)(this._rowHeaderCellIds_FULL),
803
723
  "tree" === this.rowHierarchyType && (null === (_b = this.extensionRows) || void 0 === _b ? void 0 : _b.length) >= 1 && this.generateExtensionRowTree(),
804
- colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
805
- o)), {}), this._CellHeaderPathMap = new Map, this._cellRangeMap = new Map;
724
+ this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
725
+ o)), {}), this._CellHeaderPathMap = new Map;
806
726
  const diffCell = (0, diff_cell_1.diffCellAddress)(col, row, oldRowHeaderCellIds.map((oldCellId => oldCellId[col])), this._rowHeaderCellIds_FULL.map((newCellId => newCellId[col])), oldRowHeaderCellPositons, this);
807
727
  return this._rowHeaderCellIds = this._rowHeaderCellIds_FULL, diffCell;
808
728
  }
@@ -904,11 +824,8 @@ class PivotHeaderLayoutMap {
904
824
  }
905
825
  getRowHeaderCellAddressByCellId(cellId) {
906
826
  let col, row;
907
- if (this._rowHeaderCellIds.find(((cellIds, rowIndex) => {
908
- const finded = cellIds.find(((id, colIndex) => id === cellId && (col = colIndex,
909
- !0)));
910
- return !!finded && (row = rowIndex, !0);
911
- })), (0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row)) return {
827
+ if (this._rowHeaderCellIds.find(((cellIds, rowIndex) => !!cellIds.find(((id, colIndex) => id === cellId && (col = colIndex,
828
+ !0))) && (row = rowIndex, !0))), (0, vutils_1.isValid)(col) && (0, vutils_1.isValid)(row)) return {
912
829
  col: col,
913
830
  row: row + this.columnHeaderLevelCount
914
831
  };
@@ -948,7 +865,7 @@ class PivotHeaderLayoutMap {
948
865
  return sourceColumns.unshift(targetIndex, 0), Array.prototype.splice.apply(this._columnWidths, sourceColumns),
949
866
  this.columnDimensionTree.movePosition(source.row, sourceCellRange.start.col - this.rowHeaderLevelCount, targetIndex - this.rowHeaderLevelCount),
950
867
  this.columnDimensionTree.reset(this.columnDimensionTree.tree.children, !0), this._CellHeaderPathMap = new Map,
951
- this._cellRangeMap = new Map, {
868
+ {
952
869
  sourceIndex: sourceCellRange.start.col,
953
870
  targetIndex: targetIndex,
954
871
  moveSize: moveSize,
@@ -966,7 +883,7 @@ class PivotHeaderLayoutMap {
966
883
  return sourceIds_FULL.unshift(targetIndex, 0), Array.prototype.splice.apply(this._rowHeaderCellIds_FULL, sourceIds_FULL),
967
884
  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)),
968
885
  this.rowDimensionTree.reset(this.rowDimensionTree.tree.children, !0), this._CellHeaderPathMap = new Map,
969
- this._cellRangeMap = new Map, {
886
+ {
970
887
  sourceIndex: sourceCellRange.start.row,
971
888
  targetIndex: targetIndex + this.columnHeaderLevelCount,
972
889
  moveSize: moveSize,
@@ -1146,7 +1063,7 @@ class PivotHeaderLayoutMap {
1146
1063
  return rowDimension || (colDimension || void 0);
1147
1064
  }
1148
1065
  clearCellRangeMap() {
1149
- this._cellRangeMap.clear(), this._CellHeaderPathMap = new Map;
1066
+ this._CellHeaderPathMap = new Map;
1150
1067
  }
1151
1068
  getDimensionKeyInChartSpec(_col, _row) {
1152
1069
  var _a, _b, _c, _d;