@visactor/vtable 1.22.8-alpha.13 → 1.22.9-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/cjs/core/BaseTable.js +1 -1
  2. package/cjs/core/BaseTable.js.map +1 -1
  3. package/cjs/dataset/dataset.js.map +1 -1
  4. package/cjs/event/self-event-listener/pivot-chart/axis-hover.js +1 -1
  5. package/cjs/event/self-event-listener/pivot-chart/axis-hover.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.js +5 -5
  10. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  11. package/cjs/layout/index.js +2 -1
  12. package/cjs/layout/pivot-header-layout.d.ts +4 -1
  13. package/cjs/layout/pivot-header-layout.js +50 -37
  14. package/cjs/layout/pivot-header-layout.js.map +1 -1
  15. package/cjs/scenegraph/graphic/chart.js +4 -4
  16. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  17. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  18. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  19. package/cjs/vrender.js.map +1 -1
  20. package/dist/vtable.js +83 -81
  21. package/dist/vtable.min.js +2 -2
  22. package/es/core/BaseTable.js +1 -1
  23. package/es/core/BaseTable.js.map +1 -1
  24. package/es/dataset/dataset.js.map +1 -1
  25. package/es/event/self-event-listener/pivot-chart/axis-hover.js +1 -1
  26. package/es/event/self-event-listener/pivot-chart/axis-hover.js.map +1 -1
  27. package/es/index.d.ts +1 -1
  28. package/es/index.js +1 -1
  29. package/es/index.js.map +1 -1
  30. package/es/layout/chart-helper/get-axis-config.js +5 -5
  31. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  32. package/es/layout/index.js +2 -1
  33. package/es/layout/pivot-header-layout.d.ts +4 -1
  34. package/es/layout/pivot-header-layout.js +50 -37
  35. package/es/layout/pivot-header-layout.js.map +1 -1
  36. package/es/scenegraph/graphic/chart.js +4 -4
  37. package/es/scenegraph/graphic/chart.js.map +1 -1
  38. package/es/scenegraph/layout/compute-col-width.js +1 -1
  39. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  40. package/es/vrender.js.map +1 -1
  41. package/package.json +3 -3
@@ -21,10 +21,11 @@ class PivotHeaderLayoutMap {
21
21
  this._showColumnHeader = !0, this._indicatorShowType = "column", this.rowHierarchyTextStartAlignment = !1,
22
22
  this.rowDimensionKeys = [], this.colDimensionKeys = [], this.indicatorKeys = [],
23
23
  this.indicatorDimensionKey = global_1.IndicatorDimensionKeyPlaceholder, this._rowHeaderExtensionTree = {},
24
- this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [], this.leftRowSeriesNumberColumnCount = 0,
25
- this.rightRowSeriesNumberColumnCount = 0, this._useGetBodyCache = !1, this._getBodyCache = new Map,
26
- this._useHeaderPathCache = !1, this._colHeaderPathCache = new Map, this._rowHeaderPathCache = new Map,
27
- this.matchDimensionPath = (paths, treeNodes, needLowestLevel, checkAxisNode = !1, pathIndex = 0) => {
24
+ this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [], this.hasLeftIndicatorAxis = !1,
25
+ this.hasRightIndicatorAxis = !1, this.hasTopIndicatorAxis = !1, this.hasBottomIndicatorAxis = !1,
26
+ this.leftRowSeriesNumberColumnCount = 0, this.rightRowSeriesNumberColumnCount = 0,
27
+ this._useGetBodyCache = !1, this._getBodyCache = new Map, this._useHeaderPathCache = !1,
28
+ this._colHeaderPathCache = new Map, this._rowHeaderPathCache = new Map, this.matchDimensionPath = (paths, treeNodes, needLowestLevel, checkAxisNode = !1, pathIndex = 0) => {
28
29
  if (pathIndex >= paths.length) return;
29
30
  const currentPath = paths[pathIndex];
30
31
  for (let j = 0; j < treeNodes.length; j++) {
@@ -84,34 +85,47 @@ class PivotHeaderLayoutMap {
84
85
  this.colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr(),
85
86
  this.rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),
86
87
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys),
87
- this.resetRowHeaderLevelCount(), this._table.isPivotChart() && (this.hasTwoIndicatorAxes = !1,
88
- this.indicatorsDefine.forEach((indicatorObject => {
89
- var _a, _b;
90
- if (indicatorObject.chartSpec && indicatorObject.chartSpec.series && indicatorObject.chartSpec.series.length > 1) {
91
- const axes = null !== (_b = null !== (_a = indicatorObject.chartSpec.axes) && void 0 !== _a ? _a : this._table.pivotChartAxes) && void 0 !== _b ? _b : [];
92
- if (!axes.length || axes.every((axis => axis.orient !== (this.indicatorsAsCol ? "top" : "right") || !1 !== axis.visible))) return indicatorObject.hasTwoIndicatorAxes = !0,
93
- this.hasTwoIndicatorAxes = !0, !0;
94
- }
95
- return indicatorObject.hasTwoIndicatorAxes = !1, !1;
96
- })), this.indicatorsDefine.forEach((indicatorObject => {
97
- var _a, _b;
98
- if (indicatorObject.hasTwoIndicatorAxes) return !1;
99
- if (indicatorObject.chartSpec) {
100
- const axes = null !== (_b = null !== (_a = indicatorObject.chartSpec.axes) && void 0 !== _a ? _a : this._table.pivotChartAxes) && void 0 !== _b ? _b : [];
101
- if (this.indicatorsAsCol) {
102
- const topAxis = axes.find((axis => "top" === axis.orient && !1 !== axis.visible)), bottomAxis = axes.find((axis => "bottom" === axis.orient && !1 !== axis.visible));
103
- if (topAxis && bottomAxis) return indicatorObject.hasTwoIndicatorAxes = !0, this.hasTwoIndicatorAxes = !0,
104
- !0;
105
- } else {
106
- const leftAxis = axes.find((axis => "left" === axis.orient && !1 !== axis.visible)), rightAxis = axes.find((axis => "right" === axis.orient && !1 !== axis.visible));
107
- if (leftAxis && rightAxis) return indicatorObject.hasTwoIndicatorAxes = !0, this.hasTwoIndicatorAxes = !0,
108
- !0;
88
+ this._table.isPivotChart() && (this.hasLeftIndicatorAxis = !1, this.hasRightIndicatorAxis = !1,
89
+ this.hasTopIndicatorAxis = !1, this.hasBottomIndicatorAxis = !1, this.indicatorsDefine.forEach((indicatorObject => {
90
+ var _a, _b, _c, _d;
91
+ if (indicatorObject.hasLeftIndicatorAxis = !1, indicatorObject.hasRightIndicatorAxis = !1,
92
+ indicatorObject.hasTopIndicatorAxis = !1, indicatorObject.hasBottomIndicatorAxis = !1,
93
+ !(null == indicatorObject ? void 0 : indicatorObject.chartSpec)) return;
94
+ const axes = null !== (_b = null !== (_a = indicatorObject.chartSpec.axes) && void 0 !== _a ? _a : this._table.pivotChartAxes) && void 0 !== _b ? _b : [], visibleOrients = new Set;
95
+ (null != axes ? axes : []).forEach((axis => {
96
+ (null == axis ? void 0 : axis.orient) && !1 !== axis.visible && visibleOrients.add(axis.orient);
97
+ }));
98
+ const isMultiSeries = (null === (_d = null === (_c = indicatorObject.chartSpec) || void 0 === _c ? void 0 : _c.series) || void 0 === _d ? void 0 : _d.length) > 1;
99
+ if (this.indicatorsAsCol) {
100
+ let hasTop = visibleOrients.has("top"), hasBottom = visibleOrients.has("bottom");
101
+ if (axes.length || (hasBottom = !0), isMultiSeries) {
102
+ const topHiddenExplicitly = axes.some((axis => "top" === (null == axis ? void 0 : axis.orient) && !1 === axis.visible));
103
+ if (!axes.length || !topHiddenExplicitly) {
104
+ hasTop = !0;
105
+ axes.some((axis => "bottom" === (null == axis ? void 0 : axis.orient) && !1 === axis.visible)) || (hasBottom = !0);
106
+ }
107
+ }
108
+ indicatorObject.hasTopIndicatorAxis = hasTop, indicatorObject.hasBottomIndicatorAxis = hasBottom,
109
+ indicatorObject.hasLeftIndicatorAxis = !1, indicatorObject.hasRightIndicatorAxis = !1;
110
+ } else {
111
+ let hasLeft = visibleOrients.has("left"), hasRight = visibleOrients.has("right");
112
+ if (axes.length || (hasLeft = !0), isMultiSeries) {
113
+ const rightHiddenExplicitly = axes.some((axis => "right" === (null == axis ? void 0 : axis.orient) && !1 === axis.visible));
114
+ if (!axes.length || !rightHiddenExplicitly) {
115
+ hasRight = !0;
116
+ axes.some((axis => "left" === (null == axis ? void 0 : axis.orient) && !1 === axis.visible)) || (hasLeft = !0);
117
+ }
109
118
  }
119
+ indicatorObject.hasLeftIndicatorAxis = hasLeft, indicatorObject.hasRightIndicatorAxis = hasRight,
120
+ indicatorObject.hasTopIndicatorAxis = !1, indicatorObject.hasBottomIndicatorAxis = !1;
110
121
  }
111
- return indicatorObject.hasTwoIndicatorAxes = !1, !1;
112
- }))), this.resetColumnHeaderLevelCount(), this._generateColHeaderIds(), this.colIndex = 0,
113
- this._generateRowHeaderIds(), this._rowHeaderCellFullPathIds_FULL = (0, util_1.transpose)(this._rowHeaderCellFullPathIds_FULL),
114
- "tree" === table.options.rowHierarchyType && (null === (_r = this.extensionRows) || void 0 === _r ? void 0 : _r.length) >= 1 && (this.generateExtensionRowTree(),
122
+ this.hasLeftIndicatorAxis || (this.hasLeftIndicatorAxis = !!indicatorObject.hasLeftIndicatorAxis),
123
+ this.hasRightIndicatorAxis || (this.hasRightIndicatorAxis = !!indicatorObject.hasRightIndicatorAxis),
124
+ this.hasTopIndicatorAxis || (this.hasTopIndicatorAxis = !!indicatorObject.hasTopIndicatorAxis),
125
+ this.hasBottomIndicatorAxis || (this.hasBottomIndicatorAxis = !!indicatorObject.hasBottomIndicatorAxis);
126
+ }))), this.resetRowHeaderLevelCount(), this.resetColumnHeaderLevelCount(), this._generateColHeaderIds(),
127
+ this.colIndex = 0, this._generateRowHeaderIds(), this._rowHeaderCellFullPathIds_FULL = (0,
128
+ util_1.transpose)(this._rowHeaderCellFullPathIds_FULL), "tree" === table.options.rowHierarchyType && (null === (_r = this.extensionRows) || void 0 === _r ? void 0 : _r.length) >= 1 && (this.generateExtensionRowTree(),
115
129
  this.extensionRows.forEach((extensionRow => {
116
130
  const rowKeys = [];
117
131
  extensionRow.rows.forEach((row => {
@@ -718,12 +732,12 @@ class PivotHeaderLayoutMap {
718
732
  resetColumnHeaderLevelCount() {
719
733
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
720
734
  if (this.showHeader && this.showColumnHeader) {
721
- 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) && 0 === (null === (_d = null === (_c = this.columnDimensionTree) || void 0 === _c ? void 0 : _c.tree) || void 0 === _d ? void 0 : _d.level) && !this.hasTwoIndicatorAxes) return void (this.columnHeaderLevelCount = 0);
735
+ 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) && 0 === (null === (_d = null === (_c = this.columnDimensionTree) || void 0 === _c ? void 0 : _c.tree) || void 0 === _d ? void 0 : _d.level) && !this.hasTopIndicatorAxis) return void (this.columnHeaderLevelCount = 0);
722
736
  let count = this._getColumnHeaderTreeExpandedMaxLevelCount();
723
737
  return this.indicatorsAsCol && this.hideIndicatorName && this.colDimensionKeys[this.colDimensionKeys.length - 1] === this.indicatorDimensionKey && count--,
724
738
  0 === count && this.dataset && !(null === (_e = this.dataset.customColTree) || void 0 === _e ? void 0 : _e.length) ? "row" !== this.cornerSetting.titleOnDimension && "all" !== this.cornerSetting.titleOnDimension || !this.cornerSetting.forceShowHeader ? this._table.isPivotChart() || 0 !== (null !== (_g = null === (_f = this.dataset.records) || void 0 === _f ? void 0 : _f.length) && void 0 !== _g ? _g : 0) || "column" !== this.cornerSetting.titleOnDimension && "all" !== this.cornerSetting.titleOnDimension || (count = null !== (_h = this.columnsDefine.length) && void 0 !== _h ? _h : 0) : count = 1 : !this.dataset || this._table.isPivotChart() || 0 !== (null !== (_k = null === (_j = this.dataset.records) || void 0 === _j ? void 0 : _j.length) && void 0 !== _k ? _k : 0) || this.dataset.customColTree || "column" !== this.cornerSetting.titleOnDimension && "all" !== this.cornerSetting.titleOnDimension || (count = null !== (_l = this.columnsDefine.length) && void 0 !== _l ? _l : 0,
725
739
  !this.hideIndicatorName && this.indicatorsAsCol && count++), this.columnHeaderTitle && (count += 1),
726
- this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && (0,
740
+ this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTopIndicatorAxis && (0,
727
741
  get_chart_spec_1.checkHasCartesianChart)(this.indicatorsDefine) && (count -= 1),
728
742
  void (this.columnHeaderLevelCount = count);
729
743
  }
@@ -739,7 +753,7 @@ class PivotHeaderLayoutMap {
739
753
  const rowLevelCount = this._getRowHeaderTreeExpandedMaxLevelCount();
740
754
  let count = rowLevelCount;
741
755
  return 0 === count && this.dataset && !(null === (_c = this.dataset.customRowTree) || void 0 === _c ? void 0 : _c.length) ? "column" !== this.cornerSetting.titleOnDimension && "all" !== this.cornerSetting.titleOnDimension || !this.cornerSetting.forceShowHeader ? this._table.isPivotChart() || 0 !== (null !== (_e = null === (_d = this.dataset.records) || void 0 === _d ? void 0 : _d.length) && void 0 !== _e ? _e : 0) || "row" !== this.cornerSetting.titleOnDimension && "all" !== this.cornerSetting.titleOnDimension || (count = null !== (_f = this.rowsDefine.length) && void 0 !== _f ? _f : 0) : count = 1 : !this.dataset || this._table.isPivotChart() || 0 !== (null !== (_h = null === (_g = this.dataset.records) || void 0 === _g ? void 0 : _g.length) && void 0 !== _h ? _h : 0) || this.dataset.customRowTree || "row" !== this.cornerSetting.titleOnDimension && "all" !== this.cornerSetting.titleOnDimension || (count = this.rowsDefine.length,
742
- this.hideIndicatorName || this.indicatorsAsCol || count++), !this.indicatorsAsCol && this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
756
+ this.hideIndicatorName || this.indicatorsAsCol || count++), !this.indicatorsAsCol && (this.hideIndicatorName || !this.hasLeftIndicatorAxis && this._table.isPivotChart()) && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
743
757
  this.rowHeaderTitle && (count += 1), void (this.rowHeaderLevelCount = count);
744
758
  }
745
759
  this.rowHeaderLevelCount = this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
@@ -781,7 +795,7 @@ class PivotHeaderLayoutMap {
781
795
  get rightFrozenColCount() {
782
796
  if (!this._table.isPivotChart()) return this._table.internalProps.rightFrozenColCount ? this.colCount - this.rowHeaderLevelCount >= this._table.internalProps.rightFrozenColCount ? this._table.internalProps.rightFrozenColCount : this.colCount - this.rowHeaderLevelCount : 0;
783
797
  const axisOption = this._table.pivotChartAxes.find((axisOption => "right" === axisOption.orient));
784
- return !1 === (null == axisOption ? void 0 : axisOption.visible) || this.indicatorsAsCol ? 0 : this.hasTwoIndicatorAxes ? 1 : 0;
798
+ return !1 === (null == axisOption ? void 0 : axisOption.visible) || this.indicatorsAsCol ? 0 : this.hasRightIndicatorAxis ? 1 : 0;
785
799
  }
786
800
  get bodyRowCount() {
787
801
  return this.rowCount - this.bottomFrozenRowCount - this.headerLevelCount;
@@ -1564,7 +1578,7 @@ class PivotHeaderLayoutMap {
1564
1578
  if (this.isBottomFrozenRow(col, row) && (0, get_chart_spec_1.isHasCartesianChartInline)(col, row, "col", this) || this.isRightFrozenColumn(col, row) && (0,
1565
1579
  get_chart_spec_1.isHasCartesianChartInline)(col, row, "row", this)) return !0;
1566
1580
  if (this.isRowHeader(col, row) && col === this.rowHeaderLevelCount - 1 && (0, get_chart_spec_1.isHasCartesianChartInline)(col, row, "row", this)) return !0;
1567
- if (this.hasTwoIndicatorAxes && this.indicatorsAsCol && row === this.columnHeaderLevelCount - 1 && (0,
1581
+ if (this.hasTopIndicatorAxis && this.indicatorsAsCol && row === this.columnHeaderLevelCount - 1 && (0,
1568
1582
  get_chart_spec_1.isHasCartesianChartInline)(col, row, "col", this)) return !0;
1569
1583
  }
1570
1584
  return !1;
@@ -1787,7 +1801,7 @@ class PivotHeaderLayoutMap {
1787
1801
  get topAxesCount() {
1788
1802
  if (!this._table.isPivotChart()) return 0;
1789
1803
  const axisOption = this._table.pivotChartAxes.find((axisOption => "top" === axisOption.orient));
1790
- return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : this.indicatorsAsCol && this.hasTwoIndicatorAxes ? 1 : 0;
1804
+ return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : this.indicatorsAsCol && this.hasTopIndicatorAxis ? 1 : 0;
1791
1805
  }
1792
1806
  get rightAxesCount() {
1793
1807
  return this.rightFrozenColCount;
@@ -2000,5 +2014,4 @@ function bandSpace(count, paddingInner, paddingOuter) {
2000
2014
  count ? space > 0 ? space : 1 : 0;
2001
2015
  }
2002
2016
 
2003
- //# sourceMappingURL=pivot-header-layout.js.map
2004
2017
  exports.PivotHeaderLayoutMap = PivotHeaderLayoutMap;