@visactor/vtable 1.22.8 → 1.22.9-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.
Files changed (39) 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/pivot-header-layout.d.ts +4 -1
  12. package/cjs/layout/pivot-header-layout.js +50 -36
  13. package/cjs/layout/pivot-header-layout.js.map +1 -1
  14. package/cjs/scenegraph/graphic/chart.js +1 -1
  15. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  16. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  17. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  18. package/cjs/vrender.js.map +1 -1
  19. package/dist/vtable.js +80 -78
  20. package/dist/vtable.min.js +2 -2
  21. package/es/core/BaseTable.js +1 -1
  22. package/es/core/BaseTable.js.map +1 -1
  23. package/es/dataset/dataset.js.map +1 -1
  24. package/es/event/self-event-listener/pivot-chart/axis-hover.js +1 -1
  25. package/es/event/self-event-listener/pivot-chart/axis-hover.js.map +1 -1
  26. package/es/index.d.ts +1 -1
  27. package/es/index.js +1 -1
  28. package/es/index.js.map +1 -1
  29. package/es/layout/chart-helper/get-axis-config.js +5 -5
  30. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  31. package/es/layout/pivot-header-layout.d.ts +4 -1
  32. package/es/layout/pivot-header-layout.js +49 -35
  33. package/es/layout/pivot-header-layout.js.map +1 -1
  34. package/es/scenegraph/graphic/chart.js +1 -1
  35. package/es/scenegraph/graphic/chart.js.map +1 -1
  36. package/es/scenegraph/layout/compute-col-width.js +1 -1
  37. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  38. package/es/vrender.js.map +1 -1
  39. package/package.json +5 -5
@@ -33,10 +33,11 @@ export class PivotHeaderLayoutMap {
33
33
  this._showColumnHeader = !0, this._indicatorShowType = "column", this.rowHierarchyTextStartAlignment = !1,
34
34
  this.rowDimensionKeys = [], this.colDimensionKeys = [], this.indicatorKeys = [],
35
35
  this.indicatorDimensionKey = IndicatorDimensionKeyPlaceholder, this._rowHeaderExtensionTree = {},
36
- this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [], this.leftRowSeriesNumberColumnCount = 0,
37
- this.rightRowSeriesNumberColumnCount = 0, this._useGetBodyCache = !1, this._getBodyCache = new Map,
38
- this._useHeaderPathCache = !1, this._colHeaderPathCache = new Map, this._rowHeaderPathCache = new Map,
39
- this.matchDimensionPath = (paths, treeNodes, needLowestLevel, checkAxisNode = !1, pathIndex = 0) => {
36
+ this._extensionRowDimensionKeys = [], this.fullRowDimensionKeys = [], this.hasLeftIndicatorAxis = !1,
37
+ this.hasRightIndicatorAxis = !1, this.hasTopIndicatorAxis = !1, this.hasBottomIndicatorAxis = !1,
38
+ this.leftRowSeriesNumberColumnCount = 0, this.rightRowSeriesNumberColumnCount = 0,
39
+ this._useGetBodyCache = !1, this._getBodyCache = new Map, this._useHeaderPathCache = !1,
40
+ this._colHeaderPathCache = new Map, this._rowHeaderPathCache = new Map, this.matchDimensionPath = (paths, treeNodes, needLowestLevel, checkAxisNode = !1, pathIndex = 0) => {
40
41
  if (pathIndex >= paths.length) return;
41
42
  const currentPath = paths[pathIndex];
42
43
  for (let j = 0; j < treeNodes.length; j++) {
@@ -93,33 +94,46 @@ export class PivotHeaderLayoutMap {
93
94
  this.colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr(),
94
95
  this.rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),
95
96
  this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(this.rowDimensionKeys),
96
- this.resetRowHeaderLevelCount(), this._table.isPivotChart() && (this.hasTwoIndicatorAxes = !1,
97
- this.indicatorsDefine.forEach((indicatorObject => {
98
- var _a, _b;
99
- if (indicatorObject.chartSpec && indicatorObject.chartSpec.series && indicatorObject.chartSpec.series.length > 1) {
100
- const axes = null !== (_b = null !== (_a = indicatorObject.chartSpec.axes) && void 0 !== _a ? _a : this._table.pivotChartAxes) && void 0 !== _b ? _b : [];
101
- if (!axes.length || axes.every((axis => axis.orient !== (this.indicatorsAsCol ? "top" : "right") || !1 !== axis.visible))) return indicatorObject.hasTwoIndicatorAxes = !0,
102
- this.hasTwoIndicatorAxes = !0, !0;
103
- }
104
- return indicatorObject.hasTwoIndicatorAxes = !1, !1;
105
- })), this.indicatorsDefine.forEach((indicatorObject => {
106
- var _a, _b;
107
- if (indicatorObject.hasTwoIndicatorAxes) return !1;
108
- if (indicatorObject.chartSpec) {
109
- const axes = null !== (_b = null !== (_a = indicatorObject.chartSpec.axes) && void 0 !== _a ? _a : this._table.pivotChartAxes) && void 0 !== _b ? _b : [];
110
- if (this.indicatorsAsCol) {
111
- const topAxis = axes.find((axis => "top" === axis.orient && !1 !== axis.visible)), bottomAxis = axes.find((axis => "bottom" === axis.orient && !1 !== axis.visible));
112
- if (topAxis && bottomAxis) return indicatorObject.hasTwoIndicatorAxes = !0, this.hasTwoIndicatorAxes = !0,
113
- !0;
114
- } else {
115
- const leftAxis = axes.find((axis => "left" === axis.orient && !1 !== axis.visible)), rightAxis = axes.find((axis => "right" === axis.orient && !1 !== axis.visible));
116
- if (leftAxis && rightAxis) return indicatorObject.hasTwoIndicatorAxes = !0, this.hasTwoIndicatorAxes = !0,
117
- !0;
97
+ this._table.isPivotChart() && (this.hasLeftIndicatorAxis = !1, this.hasRightIndicatorAxis = !1,
98
+ this.hasTopIndicatorAxis = !1, this.hasBottomIndicatorAxis = !1, this.indicatorsDefine.forEach((indicatorObject => {
99
+ var _a, _b, _c, _d;
100
+ if (indicatorObject.hasLeftIndicatorAxis = !1, indicatorObject.hasRightIndicatorAxis = !1,
101
+ indicatorObject.hasTopIndicatorAxis = !1, indicatorObject.hasBottomIndicatorAxis = !1,
102
+ !(null == indicatorObject ? void 0 : indicatorObject.chartSpec)) return;
103
+ const axes = null !== (_b = null !== (_a = indicatorObject.chartSpec.axes) && void 0 !== _a ? _a : this._table.pivotChartAxes) && void 0 !== _b ? _b : [], visibleOrients = new Set;
104
+ (null != axes ? axes : []).forEach((axis => {
105
+ (null == axis ? void 0 : axis.orient) && !1 !== axis.visible && visibleOrients.add(axis.orient);
106
+ }));
107
+ const isMultiSeries = (null === (_d = null === (_c = indicatorObject.chartSpec) || void 0 === _c ? void 0 : _c.series) || void 0 === _d ? void 0 : _d.length) > 1;
108
+ if (this.indicatorsAsCol) {
109
+ let hasTop = visibleOrients.has("top"), hasBottom = visibleOrients.has("bottom");
110
+ if (axes.length || (hasBottom = !0), isMultiSeries) {
111
+ const topHiddenExplicitly = axes.some((axis => "top" === (null == axis ? void 0 : axis.orient) && !1 === axis.visible));
112
+ if (!axes.length || !topHiddenExplicitly) {
113
+ hasTop = !0;
114
+ axes.some((axis => "bottom" === (null == axis ? void 0 : axis.orient) && !1 === axis.visible)) || (hasBottom = !0);
115
+ }
116
+ }
117
+ indicatorObject.hasTopIndicatorAxis = hasTop, indicatorObject.hasBottomIndicatorAxis = hasBottom,
118
+ indicatorObject.hasLeftIndicatorAxis = !1, indicatorObject.hasRightIndicatorAxis = !1;
119
+ } else {
120
+ let hasLeft = visibleOrients.has("left"), hasRight = visibleOrients.has("right");
121
+ if (axes.length || (hasLeft = !0), isMultiSeries) {
122
+ const rightHiddenExplicitly = axes.some((axis => "right" === (null == axis ? void 0 : axis.orient) && !1 === axis.visible));
123
+ if (!axes.length || !rightHiddenExplicitly) {
124
+ hasRight = !0;
125
+ axes.some((axis => "left" === (null == axis ? void 0 : axis.orient) && !1 === axis.visible)) || (hasLeft = !0);
126
+ }
118
127
  }
128
+ indicatorObject.hasLeftIndicatorAxis = hasLeft, indicatorObject.hasRightIndicatorAxis = hasRight,
129
+ indicatorObject.hasTopIndicatorAxis = !1, indicatorObject.hasBottomIndicatorAxis = !1;
119
130
  }
120
- return indicatorObject.hasTwoIndicatorAxes = !1, !1;
121
- }))), this.resetColumnHeaderLevelCount(), this._generateColHeaderIds(), this.colIndex = 0,
122
- this._generateRowHeaderIds(), this._rowHeaderCellFullPathIds_FULL = transpose(this._rowHeaderCellFullPathIds_FULL),
131
+ this.hasLeftIndicatorAxis || (this.hasLeftIndicatorAxis = !!indicatorObject.hasLeftIndicatorAxis),
132
+ this.hasRightIndicatorAxis || (this.hasRightIndicatorAxis = !!indicatorObject.hasRightIndicatorAxis),
133
+ this.hasTopIndicatorAxis || (this.hasTopIndicatorAxis = !!indicatorObject.hasTopIndicatorAxis),
134
+ this.hasBottomIndicatorAxis || (this.hasBottomIndicatorAxis = !!indicatorObject.hasBottomIndicatorAxis);
135
+ }))), this.resetRowHeaderLevelCount(), this.resetColumnHeaderLevelCount(), this._generateColHeaderIds(),
136
+ this.colIndex = 0, this._generateRowHeaderIds(), this._rowHeaderCellFullPathIds_FULL = transpose(this._rowHeaderCellFullPathIds_FULL),
123
137
  "tree" === table.options.rowHierarchyType && (null === (_r = this.extensionRows) || void 0 === _r ? void 0 : _r.length) >= 1 && (this.generateExtensionRowTree(),
124
138
  this.extensionRows.forEach((extensionRow => {
125
139
  const rowKeys = [];
@@ -727,12 +741,12 @@ export class PivotHeaderLayoutMap {
727
741
  resetColumnHeaderLevelCount() {
728
742
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
729
743
  if (this.showHeader && this.showColumnHeader) {
730
- 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);
744
+ 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);
731
745
  let count = this._getColumnHeaderTreeExpandedMaxLevelCount();
732
746
  return this.indicatorsAsCol && this.hideIndicatorName && this.colDimensionKeys[this.colDimensionKeys.length - 1] === this.indicatorDimensionKey && count--,
733
747
  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,
734
748
  !this.hideIndicatorName && this.indicatorsAsCol && count++), this.columnHeaderTitle && (count += 1),
735
- this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && checkHasCartesianChart(this.indicatorsDefine) && (count -= 1),
749
+ this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTopIndicatorAxis && checkHasCartesianChart(this.indicatorsDefine) && (count -= 1),
736
750
  void (this.columnHeaderLevelCount = count);
737
751
  }
738
752
  this.columnHeaderLevelCount = this.indicatorsAsCol ? this.hideIndicatorName ? 0 : 1 : 0;
@@ -747,7 +761,7 @@ export class PivotHeaderLayoutMap {
747
761
  const rowLevelCount = this._getRowHeaderTreeExpandedMaxLevelCount();
748
762
  let count = rowLevelCount;
749
763
  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,
750
- this.hideIndicatorName || this.indicatorsAsCol || count++), !this.indicatorsAsCol && this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
764
+ 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),
751
765
  this.rowHeaderTitle && (count += 1), void (this.rowHeaderLevelCount = count);
752
766
  }
753
767
  this.rowHeaderLevelCount = this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
@@ -789,7 +803,7 @@ export class PivotHeaderLayoutMap {
789
803
  get rightFrozenColCount() {
790
804
  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;
791
805
  const axisOption = this._table.pivotChartAxes.find((axisOption => "right" === axisOption.orient));
792
- return !1 === (null == axisOption ? void 0 : axisOption.visible) || this.indicatorsAsCol ? 0 : this.hasTwoIndicatorAxes ? 1 : 0;
806
+ return !1 === (null == axisOption ? void 0 : axisOption.visible) || this.indicatorsAsCol ? 0 : this.hasRightIndicatorAxis ? 1 : 0;
793
807
  }
794
808
  get bodyRowCount() {
795
809
  return this.rowCount - this.bottomFrozenRowCount - this.headerLevelCount;
@@ -1562,7 +1576,7 @@ export class PivotHeaderLayoutMap {
1562
1576
  if (this.indicatorKeys.length >= 1 && checkHasCartesianChart(this.indicatorsDefine)) {
1563
1577
  if (this.isBottomFrozenRow(col, row) && isHasCartesianChartInline(col, row, "col", this) || this.isRightFrozenColumn(col, row) && isHasCartesianChartInline(col, row, "row", this)) return !0;
1564
1578
  if (this.isRowHeader(col, row) && col === this.rowHeaderLevelCount - 1 && isHasCartesianChartInline(col, row, "row", this)) return !0;
1565
- if (this.hasTwoIndicatorAxes && this.indicatorsAsCol && row === this.columnHeaderLevelCount - 1 && isHasCartesianChartInline(col, row, "col", this)) return !0;
1579
+ if (this.hasTopIndicatorAxis && this.indicatorsAsCol && row === this.columnHeaderLevelCount - 1 && isHasCartesianChartInline(col, row, "col", this)) return !0;
1566
1580
  }
1567
1581
  return !1;
1568
1582
  }
@@ -1778,7 +1792,7 @@ export class PivotHeaderLayoutMap {
1778
1792
  get topAxesCount() {
1779
1793
  if (!this._table.isPivotChart()) return 0;
1780
1794
  const axisOption = this._table.pivotChartAxes.find((axisOption => "top" === axisOption.orient));
1781
- return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : this.indicatorsAsCol && this.hasTwoIndicatorAxes ? 1 : 0;
1795
+ return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : this.indicatorsAsCol && this.hasTopIndicatorAxis ? 1 : 0;
1782
1796
  }
1783
1797
  get rightAxesCount() {
1784
1798
  return this.rightFrozenColCount;