@visactor/vtable 1.16.0 → 1.16.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 (77) hide show
  1. package/cjs/ListTable.js +2 -2
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/core/BaseTable.js +1 -1
  4. package/cjs/core/BaseTable.js.map +1 -1
  5. package/cjs/dataset/dataset.js +11 -11
  6. package/cjs/dataset/dataset.js.map +1 -1
  7. package/cjs/event/event.js +4 -3
  8. package/cjs/event/event.js.map +1 -1
  9. package/cjs/event/listener/table-group.js +1 -0
  10. package/cjs/event/listener/table-group.js.map +1 -1
  11. package/cjs/index.d.ts +1 -1
  12. package/cjs/index.js +1 -1
  13. package/cjs/index.js.map +1 -1
  14. package/cjs/scenegraph/group-creater/cell-helper.js +20 -12
  15. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  16. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +6 -3
  17. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  18. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +16 -2
  19. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  20. package/cjs/scenegraph/scenegraph.js +17 -1
  21. package/cjs/scenegraph/scenegraph.js.map +1 -1
  22. package/cjs/scenegraph/style/frame-border.js +4 -0
  23. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  24. package/cjs/state/state.d.ts +1 -1
  25. package/cjs/state/state.js +4 -4
  26. package/cjs/state/state.js.map +1 -1
  27. package/cjs/themes/theme.js +4 -0
  28. package/cjs/themes/theme.js.map +1 -1
  29. package/cjs/ts-types/base-table.d.ts +1 -0
  30. package/cjs/ts-types/base-table.js.map +1 -1
  31. package/cjs/ts-types/dataset/aggregation.js +3 -1
  32. package/cjs/ts-types/dataset/aggregation.js.map +1 -1
  33. package/cjs/ts-types/table-engine.d.ts +2 -0
  34. package/cjs/ts-types/table-engine.js.map +1 -1
  35. package/cjs/ts-types/theme.d.ts +3 -2
  36. package/cjs/ts-types/theme.js.map +1 -1
  37. package/cjs/vrender.js.map +1 -1
  38. package/dist/vtable.js +130 -42
  39. package/dist/vtable.min.js +2 -2
  40. package/es/ListTable.js +2 -2
  41. package/es/ListTable.js.map +1 -1
  42. package/es/core/BaseTable.js +1 -1
  43. package/es/core/BaseTable.js.map +1 -1
  44. package/es/dataset/dataset.js +11 -11
  45. package/es/dataset/dataset.js.map +1 -1
  46. package/es/event/event.js +4 -3
  47. package/es/event/event.js.map +1 -1
  48. package/es/event/listener/table-group.js +1 -0
  49. package/es/event/listener/table-group.js.map +1 -1
  50. package/es/index.d.ts +1 -1
  51. package/es/index.js +1 -1
  52. package/es/index.js.map +1 -1
  53. package/es/scenegraph/group-creater/cell-helper.js +20 -12
  54. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  55. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +6 -3
  56. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  57. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +17 -1
  58. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  59. package/es/scenegraph/scenegraph.js +12 -1
  60. package/es/scenegraph/scenegraph.js.map +1 -1
  61. package/es/scenegraph/style/frame-border.js +4 -0
  62. package/es/scenegraph/style/frame-border.js.map +1 -1
  63. package/es/state/state.d.ts +1 -1
  64. package/es/state/state.js +4 -4
  65. package/es/state/state.js.map +1 -1
  66. package/es/themes/theme.js +4 -0
  67. package/es/themes/theme.js.map +1 -1
  68. package/es/ts-types/base-table.d.ts +1 -0
  69. package/es/ts-types/base-table.js.map +1 -1
  70. package/es/ts-types/dataset/aggregation.js +3 -1
  71. package/es/ts-types/dataset/aggregation.js.map +1 -1
  72. package/es/ts-types/table-engine.d.ts +2 -0
  73. package/es/ts-types/table-engine.js.map +1 -1
  74. package/es/ts-types/theme.d.ts +3 -2
  75. package/es/ts-types/theme.js.map +1 -1
  76. package/es/vrender.js.map +1 -1
  77. package/package.json +4 -4
@@ -51,7 +51,7 @@ class Dataset {
51
51
  this.setRecords(records);
52
52
  }
53
53
  setRecords(records) {
54
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
54
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
55
55
  if (this.records = records, this.collectedValues = {}, this.cacheCollectedValues = {},
56
56
  this.totalRecordsTree = {}, this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
57
57
  this.colKeys = [], this.rowKeys = [], this.rowsHasValue = [], this.columnsHasValue = [],
@@ -67,10 +67,10 @@ class Dataset {
67
67
  "undefined" != typeof window && window.performance.now();
68
68
  this.sortKeys();
69
69
  "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
70
- 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),
71
- 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);
70
+ 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, null !== (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotalsOnTop) && void 0 !== _e && _e) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showGrandTotalsOnTop) && void 0 !== _k && _k, null !== (_o = null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showSubTotalsOnTop) && void 0 !== _o && _o),
71
+ 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 === (_q = null === (_p = this.totals) || void 0 === _p ? void 0 : _p.column) || void 0 === _q ? void 0 : _q.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showGrandTotalsOnLeft) && void 0 !== _t && _t, null !== (_w = null === (_v = null === (_u = this.totals) || void 0 === _u ? void 0 : _u.column) || void 0 === _v ? void 0 : _v.showSubTotalsOnLeft) && void 0 !== _w && _w);
72
72
  "undefined" != typeof window && window.performance.now();
73
- (null === (_u = this.dataConfig) || void 0 === _u ? void 0 : _u.isPivotChart) && this.cacheDeminsionCollectedValues();
73
+ (null === (_x = this.dataConfig) || void 0 === _x ? void 0 : _x.isPivotChart) && this.cacheDeminsionCollectedValues();
74
74
  }
75
75
  }
76
76
  registerAggregator(type, aggregator) {
@@ -339,9 +339,9 @@ class Dataset {
339
339
  }
340
340
  }
341
341
  updateSortRules(sortRules) {
342
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
343
- 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)),
344
- 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));
342
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
343
+ 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, null !== (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotalsOnTop) && void 0 !== _e && _e) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showGrandTotalsOnTop) && void 0 !== _k && _k, null !== (_o = null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showSubTotalsOnTop) && void 0 !== _o && _o)),
344
+ 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 === (_q = null === (_p = this.totals) || void 0 === _p ? void 0 : _p.column) || void 0 === _q ? void 0 : _q.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showGrandTotalsOnLeft) && void 0 !== _t && _t, null !== (_w = null === (_v = null === (_u = this.totals) || void 0 === _u ? void 0 : _u.column) || void 0 === _v ? void 0 : _v.showSubTotalsOnLeft) && void 0 !== _w && _w));
345
345
  }
346
346
  updateFilterRules(filterRules, isResetTree = !1) {
347
347
  var _a, _b;
@@ -601,9 +601,9 @@ class Dataset {
601
601
  }
602
602
  for (const flatRowKey in that.totalRecordsTree) for (const flatColKey in that.totalRecordsTree[flatRowKey]) colCompute(flatRowKey, flatColKey);
603
603
  }
604
- ArrToTree1(arr, rows, indicators, isGrandTotal, grandTotalLabel) {
604
+ ArrToTree1(arr, rows, indicators, isGrandTotal, grandTotalLabel, showGrandTotalsOnTop) {
605
605
  const result = [], concatStr = this.stringJoinChar, map = new Map;
606
- function addList(list) {
606
+ function addList(list, isGrandTotal) {
607
607
  const path = [];
608
608
  let node;
609
609
  list.forEach(((value, index) => {
@@ -621,11 +621,11 @@ class Dataset {
621
621
  indicatorKey: indicator.indicatorKey,
622
622
  value: indicator.title
623
623
  })) : []
624
- }, map.set(flatKey, item), node ? node.children.push(item) : result.push(item)),
624
+ }, map.set(flatKey, item), node ? node.children.push(item) : showGrandTotalsOnTop && isGrandTotal ? result.unshift(item) : result.push(item)),
625
625
  node = item;
626
626
  }));
627
627
  }
628
- return arr.forEach((item => addList(item))), isGrandTotal && addList([ grandTotalLabel ]),
628
+ return arr.forEach((item => addList(item, !1))), isGrandTotal && addList([ grandTotalLabel ], isGrandTotal),
629
629
  result;
630
630
  }
631
631
  ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel, showGrandTotalsOnTop, showSubTotalsOnTop) {