@visactor/vtable 1.3.1-alpha.0 → 1.3.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 (69) hide show
  1. package/cjs/ListTable.js +13 -11
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.js +7 -6
  4. package/cjs/PivotChart.js.map +1 -1
  5. package/cjs/PivotTable.js +19 -23
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/components/empty-tip/empty-tip.js +2 -2
  8. package/cjs/components/empty-tip/empty-tip.js.map +1 -1
  9. package/cjs/core/BaseTable.js +3 -3
  10. package/cjs/core/BaseTable.js.map +1 -1
  11. package/cjs/dataset/dataset.d.ts +0 -2
  12. package/cjs/dataset/dataset.js +7 -8
  13. package/cjs/dataset/dataset.js.map +1 -1
  14. package/cjs/event/listener/container-dom.js +3 -2
  15. package/cjs/event/listener/container-dom.js.map +1 -1
  16. package/cjs/index.d.ts +1 -1
  17. package/cjs/index.js +2 -2
  18. package/cjs/index.js.map +1 -1
  19. package/cjs/layout/pivot-header-layout.js +15 -19
  20. package/cjs/layout/pivot-header-layout.js.map +1 -1
  21. package/cjs/layout/row-height-map.js +1 -0
  22. package/cjs/layout/row-height-map.js.map +1 -1
  23. package/cjs/scenegraph/layout/compute-row-height.js +4 -1
  24. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  25. package/cjs/scenegraph/scenegraph.js +2 -2
  26. package/cjs/scenegraph/scenegraph.js.map +1 -1
  27. package/cjs/state/cell-move/index.js +1 -1
  28. package/cjs/state/cell-move/index.js.map +1 -1
  29. package/cjs/state/sort/index.js +2 -2
  30. package/cjs/state/sort/index.js.map +1 -1
  31. package/cjs/ts-types/base-table.d.ts +3 -2
  32. package/cjs/ts-types/base-table.js.map +1 -1
  33. package/cjs/vrender.js.map +1 -1
  34. package/dist/vtable.js +54 -104
  35. package/dist/vtable.min.js +2 -2
  36. package/es/ListTable.js +13 -12
  37. package/es/ListTable.js.map +1 -1
  38. package/es/PivotChart.js +8 -7
  39. package/es/PivotChart.js.map +1 -1
  40. package/es/PivotTable.js +20 -24
  41. package/es/PivotTable.js.map +1 -1
  42. package/es/components/empty-tip/empty-tip.js +2 -2
  43. package/es/components/empty-tip/empty-tip.js.map +1 -1
  44. package/es/core/BaseTable.js +3 -3
  45. package/es/core/BaseTable.js.map +1 -1
  46. package/es/dataset/dataset.d.ts +0 -2
  47. package/es/dataset/dataset.js +7 -8
  48. package/es/dataset/dataset.js.map +1 -1
  49. package/es/event/listener/container-dom.js +3 -2
  50. package/es/event/listener/container-dom.js.map +1 -1
  51. package/es/index.d.ts +1 -1
  52. package/es/index.js +1 -1
  53. package/es/index.js.map +1 -1
  54. package/es/layout/pivot-header-layout.js +15 -18
  55. package/es/layout/pivot-header-layout.js.map +1 -1
  56. package/es/layout/row-height-map.js +1 -0
  57. package/es/layout/row-height-map.js.map +1 -1
  58. package/es/scenegraph/layout/compute-row-height.js +4 -1
  59. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  60. package/es/scenegraph/scenegraph.js +2 -2
  61. package/es/scenegraph/scenegraph.js.map +1 -1
  62. package/es/state/cell-move/index.js +1 -1
  63. package/es/state/cell-move/index.js.map +1 -1
  64. package/es/state/sort/index.js +2 -2
  65. package/es/state/sort/index.js.map +1 -1
  66. package/es/ts-types/base-table.d.ts +3 -2
  67. package/es/ts-types/base-table.js.map +1 -1
  68. package/es/vrender.js.map +1 -1
  69. package/package.json +5 -5
@@ -41,9 +41,7 @@ export declare class Dataset {
41
41
  collectedValues: Record<string, Record<string, CollectedValue>>;
42
42
  cacheCollectedValues: Record<string, Record<string, CollectedValue>>;
43
43
  rows: string[];
44
- rowsHasValue: boolean[];
45
44
  columns: string[];
46
- columnsHasValue: boolean[];
47
45
  indicatorKeys: string[];
48
46
  customRowTree?: IHeaderTreeDefine[];
49
47
  customColTree?: IHeaderTreeDefine[];
@@ -43,8 +43,7 @@ class Dataset {
43
43
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
44
44
  if (this.records = records, this.collectedValues = {}, this.cacheCollectedValues = {},
45
45
  this.totalRecordsTree = {}, this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
46
- this.colKeys = [], this.rowKeys = [], this.rowsHasValue = [], this.columnsHasValue = [],
47
- records) {
46
+ this.colKeys = [], this.rowKeys = [], records) {
48
47
  this.records = records;
49
48
  "undefined" != typeof window && window.performance.now();
50
49
  this.processRecords(), this.processCollectedValuesWithSumBy(), this.generateCollectedValuesSortRule(),
@@ -54,8 +53,8 @@ class Dataset {
54
53
  "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
55
54
  this.sortKeys();
56
55
  "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
57
- this.customRowTree ? this.rowHeaderTree = this.customRowTree : "tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_g = null === (_f = null === (_e = this.totals) || void 0 === _e ? void 0 : _e.row) || void 0 === _f ? void 0 : _f.showGrandTotalsOnTop) && void 0 !== _g && _g, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTop) && void 0 !== _k && _k),
58
- this.customColTree ? this.colHeaderTree = this.customColTree : this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns.filter(((key, index) => this.columnsHasValue[index])), this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showGrandTotalsOnLeft) && void 0 !== _q && _q, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showSubTotalsOnLeft) && void 0 !== _t && _t);
56
+ this.customRowTree ? this.rowHeaderTree = this.customRowTree : "tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_g = null === (_f = null === (_e = this.totals) || void 0 === _e ? void 0 : _e.row) || void 0 === _f ? void 0 : _f.showGrandTotalsOnTop) && void 0 !== _g && _g, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTop) && void 0 !== _k && _k),
57
+ this.customColTree ? this.colHeaderTree = this.customColTree : this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showGrandTotalsOnLeft) && void 0 !== _q && _q, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showSubTotalsOnLeft) && void 0 !== _t && _t);
59
58
  "undefined" != typeof window && window.performance.now();
60
59
  (null === (_u = this.dataConfig) || void 0 === _u ? void 0 : _u.isPivotChart) && this.cacheDeminsionCollectedValues();
61
60
  }
@@ -162,7 +161,7 @@ class Dataset {
162
161
  let isToTalRecord = !1;
163
162
  for (let l = 0, len1 = this.rows.length; l < len1; l++) {
164
163
  const rowAttr = this.rows[l];
165
- if (rowAttr in record) this.rowsHasValue[l] = !0, rowKey.push(record[rowAttr]); else if (rowAttr !== global_1.IndicatorDimensionKeyPlaceholder) {
164
+ if (rowAttr in record) rowKey.push(record[rowAttr]); else if (rowAttr !== global_1.IndicatorDimensionKeyPlaceholder) {
166
165
  if ((null === (_d = null === (_c = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotals) && 0 === l && !this.rows.find((rk => rk in record))) {
167
166
  rowKey.push(this.rowGrandTotalLabel), isToTalRecord = !0;
168
167
  break;
@@ -175,7 +174,7 @@ class Dataset {
175
174
  }
176
175
  for (let n = 0, len2 = this.columns.length; n < len2; n++) {
177
176
  const colAttr = this.columns[n];
178
- if (colAttr in record) this.columnsHasValue[n] = !0, colKey.push(record[colAttr]); else if (colAttr !== global_1.IndicatorDimensionKeyPlaceholder) {
177
+ if (colAttr in record) colKey.push(record[colAttr]); else if (colAttr !== global_1.IndicatorDimensionKeyPlaceholder) {
179
178
  if ((null === (_o = null === (_m = null === (_l = this.dataConfig) || void 0 === _l ? void 0 : _l.totals) || void 0 === _m ? void 0 : _m.column) || void 0 === _o ? void 0 : _o.showGrandTotals) && 0 === n && !this.columns.find((ck => ck in record))) {
180
179
  colKey.push(this.colGrandTotalLabel), isToTalRecord = !0;
181
180
  break;
@@ -225,8 +224,8 @@ class Dataset {
225
224
  }
226
225
  updateSortRules(sortRules) {
227
226
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
228
- this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.customRowTree || ("tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_g = null === (_f = null === (_e = this.totals) || void 0 === _e ? void 0 : _e.row) || void 0 === _f ? void 0 : _f.showGrandTotalsOnTop) && void 0 !== _g && _g, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTop) && void 0 !== _k && _k)),
229
- this.customColTree || (this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns.filter(((key, index) => this.columnsHasValue[index])), this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showGrandTotalsOnLeft) && void 0 !== _q && _q, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showSubTotalsOnLeft) && void 0 !== _t && _t));
227
+ this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.customRowTree || ("tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_g = null === (_f = null === (_e = this.totals) || void 0 === _e ? void 0 : _e.row) || void 0 === _f ? void 0 : _f.showGrandTotalsOnTop) && void 0 !== _g && _g, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTop) && void 0 !== _k && _k)),
228
+ this.customColTree || (this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showGrandTotalsOnLeft) && void 0 !== _q && _q, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showSubTotalsOnLeft) && void 0 !== _t && _t));
230
229
  }
231
230
  updateFilterRules(filterRules, isResetTree = !1) {
232
231
  var _a;