@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
@@ -77,7 +77,7 @@ export class PivotHeaderLayoutMap {
77
77
  })), this._extensionRowDimensionKeys.push(rowKeys), this.fullRowDimensionKeys = this.fullRowDimensionKeys.concat(rowKeys);
78
78
  }))), this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
79
79
  let rowDimensionKeys, colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();
80
- !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)),
80
+ !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)),
81
81
  this.indicatorsAsCol && colDimensionKeys.push(this.indicatorDimensionKey)), colDimensionKeys = this.columnHeaderTitle ? [ "" ].concat(colDimensionKeys) : colDimensionKeys;
82
82
  let extensionRowDimensions = [];
83
83
  if ("tree" === this.rowHierarchyType && (null === (_q = this.extensionRows) || void 0 === _q ? void 0 : _q.length) >= 1) {
@@ -87,7 +87,7 @@ export class PivotHeaderLayoutMap {
87
87
  })), extensionRowDimensions = this.extensionRows.reduce(((dimensions, cur) => dimensions.concat(cur.rows)), []),
88
88
  rowDimensionKeys = this.rowHeaderTitle ? [ "" ].concat(rowTreeFirstKey) : rowTreeFirstKey;
89
89
  } else rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr(),
90
- !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)),
90
+ !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)),
91
91
  this.indicatorsAsCol || rowDimensionKeys.push(this.indicatorDimensionKey)), rowDimensionKeys = this.rowHeaderTitle ? [ "" ].concat(rowDimensionKeys) : rowDimensionKeys;
92
92
  this.cornerHeaderObjs = this._addCornerHeaders(colDimensionKeys, rowDimensionKeys, this.columnsDefine.concat(...this.rowsDefine, ...extensionRowDimensions)),
93
93
  this.colIndex = 0, this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e,
@@ -142,7 +142,7 @@ export class PivotHeaderLayoutMap {
142
142
  var _a, _b, _c, _d, _e, _f, _g, _h;
143
143
  if ((null === (_a = this.columnDimensionTree.tree.children) || void 0 === _a ? void 0 : _a.length) >= 1) {
144
144
  let startRow = 0;
145
- 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) {
145
+ 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) {
146
146
  startRow = this.columnHeaderLevelCount - this.columnDimensionTree.totalLevel;
147
147
  for (let i = 0; i < startRow; i++) this._columnHeaderCellFullPathIds.unshift([]);
148
148
  }
@@ -171,7 +171,7 @@ export class PivotHeaderLayoutMap {
171
171
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
172
172
  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 {
173
173
  let startRow = 0;
174
- 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) {
174
+ 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) {
175
175
  startRow = this.rowHeaderLevelCount - this.rowDimensionTree.totalLevel;
176
176
  for (let i = 0; i < startRow; i++) this._rowHeaderCellFullPathIds_FULL.unshift([]);
177
177
  }
@@ -646,9 +646,10 @@ export class PivotHeaderLayoutMap {
646
646
  if (this.showHeader && this.showColumnHeader) {
647
647
  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);
648
648
  let count = this.indicatorsAsCol && this.hideIndicatorName && this.colDimensionKeys[this.colDimensionKeys.length - 1] === this.indicatorDimensionKey ? this.columnDimensionTree.totalLevel - 1 : this.columnDimensionTree.totalLevel;
649
- return this.columnHeaderTitle && (count += 1), this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && checkHasCartesianChart(this.indicatorsDefine) && (count -= 1),
650
- 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,
651
- !this.hideIndicatorName && this.indicatorsAsCol && count++), void (this.columnHeaderLevelCount = count);
649
+ 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,
650
+ !this.hideIndicatorName && this.indicatorsAsCol && count++), this.columnHeaderTitle && (count += 1),
651
+ this._table.isPivotChart() && this.indicatorsAsCol && !this.hasTwoIndicatorAxes && checkHasCartesianChart(this.indicatorsDefine) && (count -= 1),
652
+ void (this.columnHeaderLevelCount = count);
652
653
  }
653
654
  this.columnHeaderLevelCount = this.indicatorsAsCol ? this.hideIndicatorName ? 0 : 1 : 0;
654
655
  }
@@ -661,9 +662,9 @@ export class PivotHeaderLayoutMap {
661
662
  }
662
663
  const rowLevelCount = this.rowDimensionTree.totalLevel;
663
664
  let count = rowLevelCount;
664
- return this.indicatorsAsCol || this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
665
- 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,
666
- this.hideIndicatorName || this.indicatorsAsCol || count++), void (this.rowHeaderLevelCount = count);
665
+ 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,
666
+ this.hideIndicatorName || this.indicatorsAsCol || count++), !this.indicatorsAsCol && this.hideIndicatorName && this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey && (count = rowLevelCount - 1),
667
+ this.rowHeaderTitle && (count += 1), void (this.rowHeaderLevelCount = count);
667
668
  }
668
669
  this.rowHeaderLevelCount = this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
669
670
  }
@@ -972,6 +973,7 @@ export class PivotHeaderLayoutMap {
972
973
  }
973
974
  toggleHierarchyState(col, row) {
974
975
  var _a, _b, _c, _d, _e, _f;
976
+ this.colIndex = 0;
975
977
  const oldRowHeaderCellIds = this._rowHeaderCellFullPathIds_FULL.slice(0), oldRowHeaderCellPositons = oldRowHeaderCellIds.map(((id, row) => ({
976
978
  col: col,
977
979
  row: row + this.columnHeaderLevelCount
@@ -1562,12 +1564,17 @@ export class PivotHeaderLayoutMap {
1562
1564
  })), totalCount;
1563
1565
  }
1564
1566
  resetHeaderTree() {
1565
- var _a, _b;
1567
+ var _a, _b, _c;
1566
1568
  this.colIndex = 0, this._rowHeaderCellFullPathIds_FULL = [], this._columnHeaderCellFullPathIds = [],
1567
1569
  this._columnHeaderCellIds = [];
1568
1570
  const dataset = this.dataset;
1569
- this.rowTree = dataset.rowHeaderTree, this.columnTree = dataset.colHeaderTree, this.columnDimensionTree = new DimensionTree(null !== (_a = this.columnTree) && void 0 !== _a ? _a : [], this.sharedVar),
1570
- this.rowDimensionTree = new DimensionTree(null !== (_b = this.rowTree) && void 0 !== _b ? _b : [], this.sharedVar, this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
1571
+ this.rowTree = dataset.rowHeaderTree, this.columnTree = dataset.colHeaderTree;
1572
+ const beforeRowDimensions = this.rowDimensionTree.tree.children;
1573
+ null === (_a = this.rowTree) || void 0 === _a || _a.forEach(((node, index) => {
1574
+ const beforeRowDimension = beforeRowDimensions.find((item => item.dimensionKey === node.dimensionKey && item.value === node.value));
1575
+ beforeRowDimension && this._table._syncHierarchyState(beforeRowDimension, node);
1576
+ })), this.columnDimensionTree = new DimensionTree(null !== (_b = this.columnTree) && void 0 !== _b ? _b : [], this.sharedVar),
1577
+ this.rowDimensionTree = new DimensionTree(null !== (_c = this.rowTree) && void 0 !== _c ? _c : [], this.sharedVar, this.rowHierarchyType, "tree" === this.rowHierarchyType ? this.rowExpandLevel : void 0),
1571
1578
  this.resetColumnHeaderLevelCount(), this._generateColHeaderIds(), this.colIndex = 0,
1572
1579
  this._generateRowHeaderIds(), this._rowHeaderCellFullPathIds_FULL = transpose(this._rowHeaderCellFullPathIds_FULL),
1573
1580
  this._headerObjectMap = this._headerObjects.reduce(((o, e) => (o[e.id] = e, o)), {}),