@visactor/vtable 1.15.2 → 1.16.0-alpha.0

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 (139) hide show
  1. package/cjs/PivotChart.d.ts +0 -1
  2. package/cjs/PivotChart.js +2 -5
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/PivotTable.d.ts +2 -2
  5. package/cjs/PivotTable.js +41 -33
  6. package/cjs/PivotTable.js.map +1 -1
  7. package/cjs/core/BaseTable.d.ts +1 -2
  8. package/cjs/core/BaseTable.js +2 -2
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/data/DataSource.d.ts +2 -2
  11. package/cjs/data/DataSource.js +4 -4
  12. package/cjs/data/DataSource.js.map +1 -1
  13. package/cjs/dataset/dataset.d.ts +3 -2
  14. package/cjs/dataset/dataset.js +12 -9
  15. package/cjs/dataset/dataset.js.map +1 -1
  16. package/cjs/index.d.ts +1 -1
  17. package/cjs/index.js +1 -1
  18. package/cjs/index.js.map +1 -1
  19. package/cjs/layout/layout-helper.js +8 -8
  20. package/cjs/layout/layout-helper.js.map +1 -1
  21. package/cjs/layout/pivot-header-layout.d.ts +33 -5
  22. package/cjs/layout/pivot-header-layout.js +137 -31
  23. package/cjs/layout/pivot-header-layout.js.map +1 -1
  24. package/cjs/layout/tree-helper.d.ts +5 -4
  25. package/cjs/layout/tree-helper.js +105 -23
  26. package/cjs/layout/tree-helper.js.map +1 -1
  27. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -1
  28. package/cjs/scenegraph/group-creater/progress/proxy.js +5 -2
  29. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  30. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +8 -4
  31. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  32. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  33. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  34. package/cjs/scenegraph/layout/frozen.d.ts +1 -0
  35. package/cjs/scenegraph/layout/frozen.js +91 -2
  36. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  37. package/cjs/scenegraph/layout/update-col.js +4 -1
  38. package/cjs/scenegraph/layout/update-col.js.map +1 -1
  39. package/cjs/scenegraph/layout/update-row.js +3 -2
  40. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  41. package/cjs/scenegraph/scenegraph.d.ts +5 -0
  42. package/cjs/scenegraph/scenegraph.js +18 -0
  43. package/cjs/scenegraph/scenegraph.js.map +1 -1
  44. package/cjs/scenegraph/utils/get-hierarchy-offset.js +1 -1
  45. package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
  46. package/cjs/state/state.d.ts +2 -0
  47. package/cjs/state/state.js +7 -2
  48. package/cjs/state/state.js.map +1 -1
  49. package/cjs/tools/NumberMap.js +4 -2
  50. package/cjs/tools/NumberMap.js.map +1 -1
  51. package/cjs/tools/diff-cell.d.ts +58 -3
  52. package/cjs/tools/diff-cell.js +90 -11
  53. package/cjs/tools/diff-cell.js.map +1 -1
  54. package/cjs/tools/get-data-path/create-dataset.js +1 -1
  55. package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
  56. package/cjs/ts-types/base-table.d.ts +2 -1
  57. package/cjs/ts-types/base-table.js.map +1 -1
  58. package/cjs/ts-types/list-table/define/basic-define.d.ts +1 -1
  59. package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
  60. package/cjs/ts-types/list-table/layout-map/api.d.ts +4 -4
  61. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  62. package/cjs/ts-types/pivot-table/dimension/basic-dimension.d.ts +2 -2
  63. package/cjs/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
  64. package/cjs/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -1
  65. package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  66. package/cjs/ts-types/table-engine.d.ts +6 -3
  67. package/cjs/ts-types/table-engine.js.map +1 -1
  68. package/cjs/vrender.js.map +1 -1
  69. package/dist/vtable.js +759 -116
  70. package/dist/vtable.min.js +2 -2
  71. package/es/PivotChart.d.ts +0 -1
  72. package/es/PivotChart.js +2 -5
  73. package/es/PivotChart.js.map +1 -1
  74. package/es/PivotTable.d.ts +2 -2
  75. package/es/PivotTable.js +41 -33
  76. package/es/PivotTable.js.map +1 -1
  77. package/es/core/BaseTable.d.ts +1 -2
  78. package/es/core/BaseTable.js +2 -2
  79. package/es/core/BaseTable.js.map +1 -1
  80. package/es/data/DataSource.d.ts +2 -2
  81. package/es/data/DataSource.js +4 -4
  82. package/es/data/DataSource.js.map +1 -1
  83. package/es/dataset/dataset.d.ts +3 -2
  84. package/es/dataset/dataset.js +12 -9
  85. package/es/dataset/dataset.js.map +1 -1
  86. package/es/index.d.ts +1 -1
  87. package/es/index.js +1 -1
  88. package/es/index.js.map +1 -1
  89. package/es/layout/layout-helper.js +8 -8
  90. package/es/layout/layout-helper.js.map +1 -1
  91. package/es/layout/pivot-header-layout.d.ts +33 -5
  92. package/es/layout/pivot-header-layout.js +138 -33
  93. package/es/layout/pivot-header-layout.js.map +1 -1
  94. package/es/layout/tree-helper.d.ts +5 -4
  95. package/es/layout/tree-helper.js +102 -19
  96. package/es/layout/tree-helper.js.map +1 -1
  97. package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -1
  98. package/es/scenegraph/group-creater/progress/proxy.js +5 -2
  99. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  100. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +8 -4
  101. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  102. package/es/scenegraph/layout/compute-col-width.js +1 -1
  103. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  104. package/es/scenegraph/layout/frozen.d.ts +1 -0
  105. package/es/scenegraph/layout/frozen.js +89 -0
  106. package/es/scenegraph/layout/frozen.js.map +1 -1
  107. package/es/scenegraph/layout/update-col.js +4 -1
  108. package/es/scenegraph/layout/update-col.js.map +1 -1
  109. package/es/scenegraph/layout/update-row.js +3 -2
  110. package/es/scenegraph/layout/update-row.js.map +1 -1
  111. package/es/scenegraph/scenegraph.d.ts +5 -0
  112. package/es/scenegraph/scenegraph.js +16 -1
  113. package/es/scenegraph/scenegraph.js.map +1 -1
  114. package/es/scenegraph/utils/get-hierarchy-offset.js +1 -1
  115. package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -1
  116. package/es/state/state.d.ts +2 -0
  117. package/es/state/state.js +7 -2
  118. package/es/state/state.js.map +1 -1
  119. package/es/tools/NumberMap.js +4 -2
  120. package/es/tools/NumberMap.js.map +1 -1
  121. package/es/tools/diff-cell.d.ts +58 -3
  122. package/es/tools/diff-cell.js +85 -9
  123. package/es/tools/diff-cell.js.map +1 -1
  124. package/es/tools/get-data-path/create-dataset.js +1 -1
  125. package/es/tools/get-data-path/create-dataset.js.map +1 -1
  126. package/es/ts-types/base-table.d.ts +2 -1
  127. package/es/ts-types/base-table.js.map +1 -1
  128. package/es/ts-types/list-table/define/basic-define.d.ts +1 -1
  129. package/es/ts-types/list-table/define/basic-define.js.map +1 -1
  130. package/es/ts-types/list-table/layout-map/api.d.ts +4 -4
  131. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  132. package/es/ts-types/pivot-table/dimension/basic-dimension.d.ts +2 -2
  133. package/es/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
  134. package/es/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -1
  135. package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  136. package/es/ts-types/table-engine.d.ts +6 -3
  137. package/es/ts-types/table-engine.js.map +1 -1
  138. package/es/vrender.js.map +1 -1
  139. package/package.json +5 -5
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  const vutils_1 = require("@visactor/vutils"), ts_types_1 = require("../ts-types"), aggregation_1 = require("../ts-types/dataset/aggregation"), global_1 = require("../tools/global"), join_1 = require("../tools/join");
8
8
 
9
9
  class Dataset {
10
- constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative, hasExtensionRowTree, parseCustomTreeToMatchRecords) {
10
+ constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, columnHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative, hasExtensionRowTree, parseCustomTreeToMatchRecords) {
11
11
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13;
12
12
  this.tree = {}, this.changedTree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
13
13
  this.colKeys = [], this.rowKeys = [], this.colKeys_normal = [], this.rowKeys_normal = [],
@@ -15,7 +15,8 @@ class Dataset {
15
15
  this.stringJoinChar = String.fromCharCode(0), this.rowsIsTotal = [], this.colsIsTotal = [],
16
16
  this.collectedValues = {}, this.cacheCollectedValues = {}, this.totalRecordsTree = {},
17
17
  this.registerAggregators(), this.dataConfig = dataConfig, this.filterRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules,
18
- this.rowHierarchyType = null != rowHierarchyType ? rowHierarchyType : "grid", this.sortRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.sortRules,
18
+ this.rowHierarchyType = null != rowHierarchyType ? rowHierarchyType : "grid", this.columnHierarchyType = null != columnHierarchyType ? columnHierarchyType : "grid",
19
+ this.sortRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.sortRules,
19
20
  this.aggregationRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.aggregationRules,
20
21
  this.derivedFieldRules = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.derivedFieldRules,
21
22
  this.mappingRules = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.mappingRules,
@@ -200,7 +201,7 @@ class Dataset {
200
201
  break;
201
202
  }
202
203
  if ((null === (_k = null === (_j = null === (_h = this.dataConfig) || void 0 === _h ? void 0 : _h.totals) || void 0 === _j ? void 0 : _j.row) || void 0 === _k ? void 0 : _k.subTotalsDimensions) && (null === (_o = null === (_m = null === (_l = this.dataConfig) || void 0 === _l ? void 0 : _l.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.subTotalsDimensions.indexOf(this.rows[l - 1])) >= 0) {
203
- "grid" === this.rowHierarchyType && rowKey.push(this.rowSubTotalLabel), isToTalRecord = !0;
204
+ "tree" !== this.rowHierarchyType && rowKey.push(this.rowSubTotalLabel), isToTalRecord = !0;
204
205
  break;
205
206
  }
206
207
  }
@@ -353,16 +354,18 @@ class Dataset {
353
354
  return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
354
355
  }
355
356
  getAggregator(rowKey = [], colKey = [], indicator, considerChangedValue = !0, indicatorPosition) {
356
- var _a, _b, _c, _d;
357
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
357
358
  const indicatorIndex = this.indicatorKeys.indexOf(indicator);
358
359
  let flatRowKey, flatColKey;
359
360
  "string" == typeof rowKey ? flatRowKey = rowKey : (indicatorPosition && "row" !== indicatorPosition.position || rowKey.map(((key, i) => {
360
361
  key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || rowKey.splice(i, 1);
361
- })), flatRowKey = (0, join_1.join)(rowKey, this.stringJoinChar)), "string" == typeof colKey ? flatColKey = colKey : (indicatorPosition && "col" !== indicatorPosition.position || colKey.map(((key, i) => {
362
+ })), rowKey.length < this.rows.length && "grid-tree" === this.rowHierarchyType && (rowKey[0] === this.rowGrandTotalLabel || (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 && rowKey[rowKey.length - 1] !== this.rowSubTotalLabel && rowKey.push(this.rowSubTotalLabel)),
363
+ flatRowKey = (0, join_1.join)(rowKey, this.stringJoinChar)), "string" == typeof colKey ? flatColKey = colKey : (indicatorPosition && "col" !== indicatorPosition.position || colKey.map(((key, i) => {
362
364
  key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || colKey.splice(i, 1);
363
- })), flatColKey = (0, join_1.join)(colKey, this.stringJoinChar));
364
- const agg = null === (_b = null === (_a = this.tree[flatRowKey]) || void 0 === _a ? void 0 : _a[flatColKey]) || void 0 === _b ? void 0 : _b[indicatorIndex];
365
- if (considerChangedValue && (0, vutils_1.isValid)(null === (_d = null === (_c = this.changedTree[flatRowKey]) || void 0 === _c ? void 0 : _c[flatColKey]) || void 0 === _d ? void 0 : _d[indicatorIndex])) {
365
+ })), colKey.length < this.columns.length && "grid-tree" === this.columnHierarchyType && (colKey[0] === this.colGrandTotalLabel || (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.column) || void 0 === _g ? void 0 : _g.subTotalsDimensions) && (null === (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.column) || void 0 === _j ? void 0 : _j.subTotalsDimensions) || void 0 === _k ? void 0 : _k.length) >= 1 && colKey[colKey.length - 1] !== this.colSubTotalLabel && colKey.push(this.colSubTotalLabel)),
366
+ flatColKey = (0, join_1.join)(colKey, this.stringJoinChar));
367
+ const agg = null === (_m = null === (_l = this.tree[flatRowKey]) || void 0 === _l ? void 0 : _l[flatColKey]) || void 0 === _m ? void 0 : _m[indicatorIndex];
368
+ if (considerChangedValue && (0, vutils_1.isValid)(null === (_p = null === (_o = this.changedTree[flatRowKey]) || void 0 === _o ? void 0 : _o[flatColKey]) || void 0 === _p ? void 0 : _p[indicatorIndex])) {
366
369
  const changeValue = this.changedTree[flatRowKey][flatColKey][indicatorIndex];
367
370
  return agg ? {
368
371
  value: () => changeValue,
@@ -531,7 +534,7 @@ class Dataset {
531
534
  const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
532
535
  if (dimensionIndex >= 0 && dimensionIndex < that.rows.length - 1) {
533
536
  const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
534
- "grid" === this.rowHierarchyType && rowTotalKey.push(that.rowSubTotalLabel);
537
+ "tree" !== this.rowHierarchyType && rowTotalKey.push(that.rowSubTotalLabel);
535
538
  const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
536
539
  this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
537
540
  this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);