@visactor/vtable 1.7.3 → 1.7.4

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 (97) hide show
  1. package/cjs/ListTable.js +7 -2
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotTable.d.ts +3 -2
  4. package/cjs/PivotTable.js +31 -28
  5. package/cjs/PivotTable.js.map +1 -1
  6. package/cjs/core/BaseTable.js +1 -1
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/data/CachedDataSource.js +14 -10
  9. package/cjs/data/CachedDataSource.js.map +1 -1
  10. package/cjs/dataset/dataset-pivot-table.d.ts +2 -2
  11. package/cjs/dataset/dataset.d.ts +5 -4
  12. package/cjs/dataset/dataset.js +55 -84
  13. package/cjs/dataset/dataset.js.map +1 -1
  14. package/cjs/dataset/statistics-helper.d.ts +4 -3
  15. package/cjs/dataset/statistics-helper.js +39 -27
  16. package/cjs/dataset/statistics-helper.js.map +1 -1
  17. package/cjs/event/listener/table-group.js +28 -30
  18. package/cjs/event/listener/table-group.js.map +1 -1
  19. package/cjs/header-helper/header-helper.js +1 -1
  20. package/cjs/header-helper/header-helper.js.map +1 -1
  21. package/cjs/index.d.ts +1 -1
  22. package/cjs/index.js +1 -1
  23. package/cjs/index.js.map +1 -1
  24. package/cjs/layout/pivot-header-layout.js +20 -13
  25. package/cjs/layout/pivot-header-layout.js.map +1 -1
  26. package/cjs/scenegraph/graphic/contributions/group-contribution-render.d.ts +1 -7
  27. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +18 -32
  28. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  29. package/cjs/scenegraph/graphic/contributions/index.js +0 -2
  30. package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
  31. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +15 -3
  32. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  33. package/cjs/scenegraph/layout/update-height.js +1 -1
  34. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  35. package/cjs/scenegraph/layout/update-width.js +1 -1
  36. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  37. package/cjs/state/checkbox/checkbox.d.ts +1 -0
  38. package/cjs/state/checkbox/checkbox.js +13 -2
  39. package/cjs/state/checkbox/checkbox.js.map +1 -1
  40. package/cjs/state/state.js +1 -1
  41. package/cjs/state/state.js.map +1 -1
  42. package/cjs/ts-types/new-data-set.d.ts +8 -2
  43. package/cjs/ts-types/new-data-set.js +2 -1
  44. package/cjs/ts-types/new-data-set.js.map +1 -1
  45. package/cjs/ts-types/table-engine.d.ts +2 -2
  46. package/cjs/ts-types/table-engine.js.map +1 -1
  47. package/cjs/vrender.js.map +1 -1
  48. package/dist/vtable.js +281 -220
  49. package/dist/vtable.min.js +2 -2
  50. package/es/ListTable.js +7 -3
  51. package/es/ListTable.js.map +1 -1
  52. package/es/PivotTable.d.ts +3 -2
  53. package/es/PivotTable.js +31 -28
  54. package/es/PivotTable.js.map +1 -1
  55. package/es/core/BaseTable.js +1 -1
  56. package/es/core/BaseTable.js.map +1 -1
  57. package/es/data/CachedDataSource.js +14 -10
  58. package/es/data/CachedDataSource.js.map +1 -1
  59. package/es/dataset/dataset-pivot-table.d.ts +2 -2
  60. package/es/dataset/dataset.d.ts +5 -4
  61. package/es/dataset/dataset.js +55 -84
  62. package/es/dataset/dataset.js.map +1 -1
  63. package/es/dataset/statistics-helper.d.ts +4 -3
  64. package/es/dataset/statistics-helper.js +41 -27
  65. package/es/dataset/statistics-helper.js.map +1 -1
  66. package/es/event/listener/table-group.js +28 -30
  67. package/es/event/listener/table-group.js.map +1 -1
  68. package/es/header-helper/header-helper.js +1 -1
  69. package/es/header-helper/header-helper.js.map +1 -1
  70. package/es/index.d.ts +1 -1
  71. package/es/index.js +1 -1
  72. package/es/index.js.map +1 -1
  73. package/es/layout/pivot-header-layout.js +20 -13
  74. package/es/layout/pivot-header-layout.js.map +1 -1
  75. package/es/scenegraph/graphic/contributions/group-contribution-render.d.ts +1 -7
  76. package/es/scenegraph/graphic/contributions/group-contribution-render.js +16 -30
  77. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  78. package/es/scenegraph/graphic/contributions/index.js +1 -2
  79. package/es/scenegraph/graphic/contributions/index.js.map +1 -1
  80. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +14 -3
  81. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  82. package/es/scenegraph/layout/update-height.js +1 -1
  83. package/es/scenegraph/layout/update-height.js.map +1 -1
  84. package/es/scenegraph/layout/update-width.js +1 -1
  85. package/es/scenegraph/layout/update-width.js.map +1 -1
  86. package/es/state/checkbox/checkbox.d.ts +1 -0
  87. package/es/state/checkbox/checkbox.js +11 -1
  88. package/es/state/checkbox/checkbox.js.map +1 -1
  89. package/es/state/state.js +1 -1
  90. package/es/state/state.js.map +1 -1
  91. package/es/ts-types/new-data-set.d.ts +8 -2
  92. package/es/ts-types/new-data-set.js +2 -1
  93. package/es/ts-types/new-data-set.js.map +1 -1
  94. package/es/ts-types/table-engine.d.ts +2 -2
  95. package/es/ts-types/table-engine.js.map +1 -1
  96. package/es/vrender.js.map +1 -1
  97. package/package.json +4 -4
@@ -65,7 +65,7 @@ class PivotHeaderLayoutMap {
65
65
  })), this._extensionRowDimensionKeys.push(rowKeys), this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(rowKeys);
66
66
  }))), this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
67
67
  let rowDimensionKeys, colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();
68
- !this.dataset || 0 !== (null !== (_p = null === (_o = this.dataset.records) || void 0 === _o ? void 0 : _o.length) && void 0 !== _p ? _p : 0) || this.dataset.customColTree || this.dataset.customRowTree || (colDimensionKeys = this.columnsDefine.map((define => "string" == typeof define ? define : define.dimensionKey)),
68
+ !this.dataset || this._table.isPivotChart() || 0 !== (null !== (_p = null === (_o = this.dataset.records) || void 0 === _o ? void 0 : _o.length) && void 0 !== _p ? _p : 0) || this.dataset.customColTree || (colDimensionKeys = this.columnsDefine.map((define => "string" == typeof define ? define : define.dimensionKey)),
69
69
  this.indicatorsAsCol && colDimensionKeys.push(this.indicatorDimensionKey)), colDimensionKeys = this.columnHeaderTitle ? [ "" ].concat(colDimensionKeys) : colDimensionKeys;
70
70
  let extensionRowDimensions = [];
71
71
  if ("tree" === this.rowHierarchyType && (null === (_q = this.extensionRows) || void 0 === _q ? void 0 : _q.length) >= 1) {
@@ -75,7 +75,7 @@ class PivotHeaderLayoutMap {
75
75
  })), extensionRowDimensions = this.extensionRows.reduce(((dimensions, cur) => dimensions.concat(cur.rows)), []),
76
76
  rowDimensionKeys = this.rowHeaderTitle ? [ "" ].concat(rowTreeFirstKey) : rowTreeFirstKey;
77
77
  } else rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),
78
- !this.dataset || 0 !== (null !== (_s = null === (_r = this.dataset.records) || void 0 === _r ? void 0 : _r.length) && void 0 !== _s ? _s : 0) || this.dataset.customColTree || this.dataset.customRowTree || (rowDimensionKeys = this.rowsDefine.map((define => "string" == typeof define ? define : define.dimensionKey)),
78
+ !this.dataset || this._table.isPivotChart() || 0 !== (null !== (_s = null === (_r = this.dataset.records) || void 0 === _r ? void 0 : _r.length) && void 0 !== _s ? _s : 0) || this.dataset.customRowTree || (rowDimensionKeys = this.rowsDefine.map((define => "string" == typeof define ? define : define.dimensionKey)),
79
79
  this.indicatorsAsCol || rowDimensionKeys.push(this.indicatorDimensionKey)), rowDimensionKeys = this.rowHeaderTitle ? [ "" ].concat(rowDimensionKeys) : rowDimensionKeys;
80
80
  this.cornerHeaderObjs = this._addCornerHeaders(colDimensionKeys, rowDimensionKeys, this.columnsDefine.concat(...this.rowsDefine, ...extensionRowDimensions)),
81
81
  this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
@@ -130,7 +130,7 @@ class PivotHeaderLayoutMap {
130
130
  var _a, _b, _c, _d, _e, _f, _g, _h;
131
131
  if ((null === (_a = this.columnDimensionTree.tree.children) || void 0 === _a ? void 0 : _a.length) >= 1) {
132
132
  let startRow = 0;
133
- if (this.dataset && 0 === (null !== (_c = null === (_b = this.dataset.records) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0) && !this.dataset.customColTree && !this.dataset.customRowTree && this.indicatorsAsCol && this.columnDimensionTree.totalLevel < this.columnHeaderLevelCount) {
133
+ if (this.dataset && !this._table.isPivotChart() && 0 === (null !== (_c = null === (_b = this.dataset.records) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0) && !this.dataset.customColTree && !this.dataset.customRowTree && this.indicatorsAsCol && this.columnDimensionTree.totalLevel < this.columnHeaderLevelCount) {
134
134
  startRow = this.columnHeaderLevelCount - this.columnDimensionTree.totalLevel;
135
135
  for (let i = 0; i < startRow; i++) this._columnHeaderCellFullPathIds.unshift([]);
136
136
  }
@@ -159,7 +159,7 @@ class PivotHeaderLayoutMap {
159
159
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
160
160
  if ((null === (_a = this.rowDimensionTree.tree.children) || void 0 === _a ? void 0 : _a.length) >= 1) if ("tree" === this.rowHierarchyType) this._addHeadersForTreeMode(this._rowHeaderCellFullPathIds_FULL, 0, this.rowDimensionTree.tree.children, [], this.rowDimensionTree.totalLevel, !0, this.rowsDefine, this.rowHeaderObjs); else {
161
161
  let startRow = 0;
162
- if (this.dataset && 0 === (null !== (_c = null === (_b = this.dataset.records) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0) && !this.dataset.customColTree && !this.dataset.customRowTree && !this.indicatorsAsCol && this.rowDimensionTree.totalLevel < this.rowHeaderLevelCount) {
162
+ if (this.dataset && !this._table.isPivotChart() && 0 === (null !== (_c = null === (_b = this.dataset.records) || void 0 === _b ? void 0 : _b.length) && void 0 !== _c ? _c : 0) && !this.dataset.customColTree && !this.dataset.customRowTree && !this.indicatorsAsCol && this.rowDimensionTree.totalLevel < this.rowHeaderLevelCount) {
163
163
  startRow = this.rowHeaderLevelCount - this.rowDimensionTree.totalLevel;
164
164
  for (let i = 0; i < startRow; i++) this._rowHeaderCellFullPathIds_FULL.unshift([]);
165
165
  }
@@ -634,10 +634,11 @@ class PivotHeaderLayoutMap {
634
634
  if (this.showHeader && this.showColumnHeader) {
635
635
  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);
636
636
  let count = this.indicatorsAsCol && this.hideIndicatorName && this.colDimensionKeys[this.colDimensionKeys.length - 1] === this.indicatorDimensionKey ? this.columnDimensionTree.totalLevel - 1 : this.columnDimensionTree.totalLevel;
637
- return this.columnHeaderTitle && (count += 1), this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && (0,
637
+ return 0 === count && this.dataset && !(null === (_e = this.dataset.customColTree) || void 0 === _e ? void 0 : _e.length) ? "row" === this.cornerSetting.titleOnDimension && this.cornerSetting.forceShowHeader ? count = 1 : 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) : !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,
638
+ !this.hideIndicatorName && this.indicatorsAsCol && count++), this.columnHeaderTitle && (count += 1),
639
+ this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && (0,
638
640
  get_chart_spec_1.checkHasCartesianChart)(this.indicatorsDefine) && (count -= 1),
639
- 0 === count && this.dataset && !(null === (_e = this.dataset.customColTree) || void 0 === _e ? void 0 : _e.length) ? "row" === this.cornerSetting.titleOnDimension && this.cornerSetting.forceShowHeader ? count = 1 : 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) : !this.dataset || 0 !== (null !== (_k = null === (_j = this.dataset.records) || void 0 === _j ? void 0 : _j.length) && void 0 !== _k ? _k : 0) || this.dataset.customColTree || this.dataset.customRowTree || "column" !== this.cornerSetting.titleOnDimension && "all" !== this.cornerSetting.titleOnDimension || (count = null !== (_l = this.columnsDefine.length) && void 0 !== _l ? _l : 0,
640
- !this.hideIndicatorName && this.indicatorsAsCol && count++), void (this.columnHeaderLevelCount = count);
641
+ void (this.columnHeaderLevelCount = count);
641
642
  }
642
643
  this.columnHeaderLevelCount = this.indicatorsAsCol ? this.hideIndicatorName ? 0 : 1 : 0;
643
644
  }
@@ -650,9 +651,9 @@ class PivotHeaderLayoutMap {
650
651
  }
651
652
  const rowLevelCount = this.rowDimensionTree.totalLevel;
652
653
  let count = rowLevelCount;
653
- return this.indicatorsAsCol || this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
654
- this.rowHeaderTitle && (count += 1), 0 === count && this.dataset && !(null === (_c = this.dataset.customRowTree) || void 0 === _c ? void 0 : _c.length) ? "column" === this.cornerSetting.titleOnDimension && this.cornerSetting.forceShowHeader ? count = 1 : 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) : !this.dataset || 0 !== (null !== (_h = null === (_g = this.dataset.records) || void 0 === _g ? void 0 : _g.length) && void 0 !== _h ? _h : 0) || this.dataset.customColTree || this.dataset.customRowTree || "row" !== this.cornerSetting.titleOnDimension && "all" !== this.cornerSetting.titleOnDimension || (count = this.rowsDefine.length,
655
- this.hideIndicatorName || this.indicatorsAsCol || count++), void (this.rowHeaderLevelCount = count);
654
+ return 0 === count && this.dataset && !(null === (_c = this.dataset.customRowTree) || void 0 === _c ? void 0 : _c.length) ? "column" === this.cornerSetting.titleOnDimension && this.cornerSetting.forceShowHeader ? count = 1 : 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) : !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,
655
+ this.hideIndicatorName || this.indicatorsAsCol || count++), !this.indicatorsAsCol && this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
656
+ this.rowHeaderTitle && (count += 1), void (this.rowHeaderLevelCount = count);
656
657
  }
657
658
  this.rowHeaderLevelCount = this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
658
659
  }
@@ -963,6 +964,7 @@ class PivotHeaderLayoutMap {
963
964
  }
964
965
  toggleHierarchyState(col, row) {
965
966
  var _a, _b, _c, _d, _e, _f;
967
+ this.colIndex = 0;
966
968
  const oldRowHeaderCellIds = this._rowHeaderCellFullPathIds_FULL.slice(0), oldRowHeaderCellPositons = oldRowHeaderCellIds.map(((id, row) => ({
967
969
  col: col,
968
970
  row: row + this.columnHeaderLevelCount
@@ -1568,12 +1570,17 @@ class PivotHeaderLayoutMap {
1568
1570
  })), totalCount;
1569
1571
  }
1570
1572
  resetHeaderTree() {
1571
- var _a, _b;
1573
+ var _a, _b, _c;
1572
1574
  this.colIndex = 0, this._rowHeaderCellFullPathIds_FULL = [], this._columnHeaderCellFullPathIds = [],
1573
1575
  this._columnHeaderCellIds = [];
1574
1576
  const dataset = this.dataset;
1575
- this.rowTree = dataset.rowHeaderTree, this.columnTree = dataset.colHeaderTree, this.columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_a = this.columnTree) && void 0 !== _a ? _a : [], this.sharedVar),
1576
- this.rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_b = this.rowTree) && void 0 !== _b ? _b : [], this.sharedVar, this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
1577
+ this.rowTree = dataset.rowHeaderTree, this.columnTree = dataset.colHeaderTree;
1578
+ const beforeRowDimensions = this.rowDimensionTree.tree.children;
1579
+ null === (_a = this.rowTree) || void 0 === _a || _a.forEach(((node, index) => {
1580
+ const beforeRowDimension = beforeRowDimensions.find((item => item.dimensionKey === node.dimensionKey && item.value === node.value));
1581
+ beforeRowDimension && this._table._syncHierarchyState(beforeRowDimension, node);
1582
+ })), this.columnDimensionTree = new tree_helper_1.DimensionTree(null !== (_b = this.columnTree) && void 0 !== _b ? _b : [], this.sharedVar),
1583
+ this.rowDimensionTree = new tree_helper_1.DimensionTree(null !== (_c = this.rowTree) && void 0 !== _c ? _c : [], this.sharedVar, this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
1577
1584
  this.resetColumnHeaderLevelCount(), this._generateColHeaderIds(), this.colIndex = 0,
1578
1585
  this._generateRowHeaderIds(), this._rowHeaderCellFullPathIds_FULL = (0, util_1.transpose)(this._rowHeaderCellFullPathIds_FULL),
1579
1586
  this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e, o)), {}),