@visactor/vtable 0.11.1-alpha.9 → 0.12.0-alpha.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 (247) hide show
  1. package/cjs/ListTable.d.ts +0 -2
  2. package/cjs/ListTable.js +10 -16
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +2 -2
  5. package/cjs/PivotChart.js +53 -28
  6. package/cjs/PivotChart.js.map +1 -1
  7. package/cjs/PivotTable.d.ts +1 -1
  8. package/cjs/PivotTable.js +63 -31
  9. package/cjs/PivotTable.js.map +1 -1
  10. package/cjs/core/BaseTable.js +6 -6
  11. package/cjs/core/BaseTable.js.map +1 -1
  12. package/cjs/dataset/dataset-pivot-table.js +5 -12
  13. package/cjs/dataset/dataset.d.ts +9 -8
  14. package/cjs/dataset/dataset.js +105 -61
  15. package/cjs/dataset/dataset.js.map +1 -1
  16. package/cjs/dataset/flatDataToObject.js +2 -3
  17. package/cjs/event/event.js +2 -1
  18. package/cjs/event/event.js.map +1 -1
  19. package/cjs/event/listener/container-dom.js +1 -1
  20. package/cjs/event/listener/scroll-bar.js +6 -6
  21. package/cjs/event/listener/scroll-bar.js.map +1 -1
  22. package/cjs/event/pivot-chart/axis-click.js.map +1 -1
  23. package/cjs/event/pivot-chart/axis-hover.js.map +1 -1
  24. package/cjs/event/sparkline-event.js.map +1 -1
  25. package/cjs/index.d.ts +1 -2
  26. package/cjs/index.js +2 -3
  27. package/cjs/index.js.map +1 -1
  28. package/cjs/layout/chart-helper/get-axis-config.d.ts +4 -4
  29. package/cjs/layout/chart-helper/get-axis-config.js +25 -23
  30. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  31. package/cjs/layout/chart-helper/get-axis-domain.d.ts +1 -1
  32. package/cjs/layout/chart-helper/get-axis-domain.js +2 -2
  33. package/cjs/layout/chart-helper/get-axis-domain.js.map +1 -1
  34. package/cjs/layout/chart-helper/get-chart-spec.d.ts +4 -5
  35. package/cjs/layout/chart-helper/get-chart-spec.js +14 -13
  36. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  37. package/cjs/layout/pivot-header-layout.d.ts +58 -44
  38. package/cjs/layout/pivot-header-layout.js +425 -200
  39. package/cjs/layout/pivot-header-layout.js.map +1 -1
  40. package/cjs/layout/pivot-layout-helper.d.ts +40 -0
  41. package/cjs/layout/pivot-layout-helper.js +96 -0
  42. package/cjs/layout/pivot-layout-helper.js.map +1 -0
  43. package/cjs/layout/pivot-layout.d.ts +1 -145
  44. package/cjs/layout/pivot-layout.js +0 -819
  45. package/cjs/layout/pivot-layout.js.map +1 -1
  46. package/cjs/layout/simple-header-layout.d.ts +1 -1
  47. package/cjs/layout/simple-header-layout.js +2 -2
  48. package/cjs/layout/simple-header-layout.js.map +1 -1
  49. package/cjs/scenegraph/component/menu.d.ts +41 -0
  50. package/cjs/scenegraph/context/module.js +2 -4
  51. package/cjs/scenegraph/debug-tool/debug-tool.js +1 -1
  52. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  53. package/cjs/scenegraph/graphic/contributions/chart-render.js +2 -2
  54. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  55. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +9 -9
  56. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  57. package/cjs/scenegraph/graphic/contributions/image-contribution-render.js +3 -3
  58. package/cjs/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
  59. package/cjs/scenegraph/graphic/contributions/index.d.ts +1 -1
  60. package/cjs/scenegraph/graphic/contributions/index.js +2 -2
  61. package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
  62. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +3 -3
  63. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  64. package/cjs/scenegraph/graphic/group.d.ts +3 -0
  65. package/cjs/scenegraph/graphic/group.js +20 -0
  66. package/cjs/scenegraph/graphic/group.js.map +1 -1
  67. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  68. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +1 -1
  69. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  70. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +3 -0
  71. package/cjs/scenegraph/group-creater/progress/proxy.js +15 -13
  72. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  73. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
  74. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  75. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +1 -1
  76. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  77. package/cjs/scenegraph/layout/compute-col-width.js +1 -1
  78. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  79. package/cjs/scenegraph/layout/compute-row-height.js +2 -2
  80. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  81. package/cjs/scenegraph/layout/update-row.d.ts +1 -1
  82. package/cjs/scenegraph/layout/update-row.js +5 -1
  83. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  84. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  85. package/cjs/scenegraph/scenegraph.d.ts +1 -1
  86. package/cjs/scenegraph/scenegraph.js +9 -6
  87. package/cjs/scenegraph/scenegraph.js.map +1 -1
  88. package/cjs/scenegraph/utils/break-string.js +3 -4
  89. package/cjs/scenegraph/utils/deal-promise-data.js +1 -3
  90. package/cjs/scenegraph/utils/render-service.d.ts +7 -0
  91. package/cjs/scenegraph/utils/render-service.js +27 -0
  92. package/cjs/scenegraph/utils/render-service.js.map +1 -0
  93. package/{es/scenegraph/utils/measure-text.d.ts → cjs/scenegraph/utils/text-measure.d.ts} +10 -3
  94. package/cjs/scenegraph/utils/{measure-text.js → text-measure.js} +30 -15
  95. package/cjs/scenegraph/utils/text-measure.js.map +1 -0
  96. package/cjs/state/state.d.ts +1 -0
  97. package/cjs/state/state.js +4 -2
  98. package/cjs/state/state.js.map +1 -1
  99. package/cjs/themes/BRIGHT.js +1 -2
  100. package/cjs/themes/DARK.js +2 -1
  101. package/cjs/tools/LimitPromiseQueue.js +1 -1
  102. package/cjs/tools/calc.js +1 -1
  103. package/cjs/tools/diff-cell.d.ts +9 -2
  104. package/cjs/tools/diff-cell.js +16 -4
  105. package/cjs/tools/diff-cell.js.map +1 -1
  106. package/cjs/tools/get-data-path/create-dataset.js +2 -2
  107. package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
  108. package/cjs/tools/get-data-path/index.js +9 -4
  109. package/cjs/tools/get-data-path/index.js.map +1 -1
  110. package/cjs/tools/isx.d.ts +1 -1
  111. package/cjs/tools/util.d.ts +1 -3
  112. package/cjs/tools/util.js +2 -33
  113. package/cjs/tools/util.js.map +1 -1
  114. package/cjs/ts-types/base-table.d.ts +14 -6
  115. package/cjs/ts-types/base-table.js.map +1 -1
  116. package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -2
  117. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  118. package/cjs/ts-types/new-data-set.js.map +1 -1
  119. package/cjs/ts-types/table-engine.d.ts +9 -0
  120. package/cjs/ts-types/table-engine.js.map +1 -1
  121. package/dist/vtable.js +58114 -69799
  122. package/dist/vtable.min.js +12 -14
  123. package/es/ListTable.d.ts +0 -2
  124. package/es/ListTable.js +8 -12
  125. package/es/ListTable.js.map +1 -1
  126. package/es/PivotChart.d.ts +2 -2
  127. package/es/PivotChart.js +53 -29
  128. package/es/PivotChart.js.map +1 -1
  129. package/es/PivotTable.d.ts +1 -1
  130. package/es/PivotTable.js +61 -32
  131. package/es/PivotTable.js.map +1 -1
  132. package/es/core/BaseTable.js +5 -5
  133. package/es/core/BaseTable.js.map +1 -1
  134. package/es/dataset/dataset-pivot-table.js +5 -12
  135. package/es/dataset/dataset.d.ts +9 -8
  136. package/es/dataset/dataset.js +104 -61
  137. package/es/dataset/dataset.js.map +1 -1
  138. package/es/dataset/flatDataToObject.js +2 -3
  139. package/es/event/event.js +2 -1
  140. package/es/event/event.js.map +1 -1
  141. package/es/event/listener/container-dom.js +1 -1
  142. package/es/event/listener/scroll-bar.js +6 -6
  143. package/es/event/listener/scroll-bar.js.map +1 -1
  144. package/es/event/pivot-chart/axis-click.js.map +1 -1
  145. package/es/event/pivot-chart/axis-hover.js.map +1 -1
  146. package/es/event/sparkline-event.js.map +1 -1
  147. package/es/index.d.ts +1 -2
  148. package/es/index.js +1 -3
  149. package/es/index.js.map +1 -1
  150. package/es/layout/chart-helper/get-axis-config.d.ts +4 -4
  151. package/es/layout/chart-helper/get-axis-config.js +21 -19
  152. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  153. package/es/layout/chart-helper/get-axis-domain.d.ts +1 -1
  154. package/es/layout/chart-helper/get-axis-domain.js +2 -2
  155. package/es/layout/chart-helper/get-axis-domain.js.map +1 -1
  156. package/es/layout/chart-helper/get-chart-spec.d.ts +4 -5
  157. package/es/layout/chart-helper/get-chart-spec.js +13 -12
  158. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  159. package/es/layout/pivot-header-layout.d.ts +58 -44
  160. package/es/layout/pivot-header-layout.js +425 -197
  161. package/es/layout/pivot-header-layout.js.map +1 -1
  162. package/es/layout/pivot-layout-helper.d.ts +40 -0
  163. package/es/layout/pivot-layout-helper.js +94 -0
  164. package/es/layout/pivot-layout-helper.js.map +1 -0
  165. package/es/layout/pivot-layout.d.ts +1 -145
  166. package/es/layout/pivot-layout.js +1 -823
  167. package/es/layout/pivot-layout.js.map +1 -1
  168. package/es/layout/simple-header-layout.d.ts +1 -1
  169. package/es/layout/simple-header-layout.js +2 -2
  170. package/es/layout/simple-header-layout.js.map +1 -1
  171. package/es/scenegraph/component/menu.d.ts +41 -0
  172. package/es/scenegraph/context/module.js +2 -4
  173. package/es/scenegraph/debug-tool/debug-tool.js +1 -1
  174. package/es/scenegraph/graphic/chart.js.map +1 -1
  175. package/es/scenegraph/graphic/contributions/chart-render.js +1 -3
  176. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  177. package/es/scenegraph/graphic/contributions/group-contribution-render.js +1 -3
  178. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  179. package/es/scenegraph/graphic/contributions/image-contribution-render.js +1 -3
  180. package/es/scenegraph/graphic/contributions/image-contribution-render.js.map +1 -1
  181. package/es/scenegraph/graphic/contributions/index.d.ts +1 -1
  182. package/es/scenegraph/graphic/contributions/index.js +1 -3
  183. package/es/scenegraph/graphic/contributions/index.js.map +1 -1
  184. package/es/scenegraph/graphic/contributions/rect-contribution-render.js +1 -3
  185. package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  186. package/es/scenegraph/graphic/group.d.ts +3 -0
  187. package/es/scenegraph/graphic/group.js +20 -0
  188. package/es/scenegraph/graphic/group.js.map +1 -1
  189. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  190. package/es/scenegraph/group-creater/cell-type/chart-cell.js +1 -1
  191. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  192. package/es/scenegraph/group-creater/progress/proxy.d.ts +3 -0
  193. package/es/scenegraph/group-creater/progress/proxy.js +15 -13
  194. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  195. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -3
  196. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  197. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +1 -1
  198. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  199. package/es/scenegraph/layout/compute-col-width.js +1 -1
  200. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  201. package/es/scenegraph/layout/compute-row-height.js +2 -2
  202. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  203. package/es/scenegraph/layout/update-row.d.ts +1 -1
  204. package/es/scenegraph/layout/update-row.js +5 -1
  205. package/es/scenegraph/layout/update-row.js.map +1 -1
  206. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  207. package/es/scenegraph/scenegraph.d.ts +1 -1
  208. package/es/scenegraph/scenegraph.js +10 -7
  209. package/es/scenegraph/scenegraph.js.map +1 -1
  210. package/es/scenegraph/utils/break-string.js +3 -4
  211. package/es/scenegraph/utils/deal-promise-data.js +1 -3
  212. package/es/scenegraph/utils/render-service.d.ts +7 -0
  213. package/es/scenegraph/utils/render-service.js +19 -0
  214. package/es/scenegraph/utils/render-service.js.map +1 -0
  215. package/{cjs/scenegraph/utils/measure-text.d.ts → es/scenegraph/utils/text-measure.d.ts} +10 -3
  216. package/es/scenegraph/utils/{measure-text.js → text-measure.js} +31 -19
  217. package/es/scenegraph/utils/text-measure.js.map +1 -0
  218. package/es/state/state.d.ts +1 -0
  219. package/es/state/state.js +4 -2
  220. package/es/state/state.js.map +1 -1
  221. package/es/themes/BRIGHT.js +1 -2
  222. package/es/themes/DARK.js +2 -1
  223. package/es/tools/LimitPromiseQueue.js +1 -1
  224. package/es/tools/calc.js +1 -1
  225. package/es/tools/diff-cell.d.ts +9 -2
  226. package/es/tools/diff-cell.js +16 -4
  227. package/es/tools/diff-cell.js.map +1 -1
  228. package/es/tools/get-data-path/create-dataset.js +2 -2
  229. package/es/tools/get-data-path/create-dataset.js.map +1 -1
  230. package/es/tools/get-data-path/index.js +10 -5
  231. package/es/tools/get-data-path/index.js.map +1 -1
  232. package/es/tools/isx.d.ts +1 -1
  233. package/es/tools/util.d.ts +1 -3
  234. package/es/tools/util.js +1 -31
  235. package/es/tools/util.js.map +1 -1
  236. package/es/ts-types/base-table.d.ts +14 -6
  237. package/es/ts-types/base-table.js.map +1 -1
  238. package/es/ts-types/list-table/layout-map/api.d.ts +2 -2
  239. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  240. package/es/ts-types/new-data-set.js.map +1 -1
  241. package/es/ts-types/table-engine.d.ts +9 -0
  242. package/es/ts-types/table-engine.js.map +1 -1
  243. package/package.json +8 -9
  244. package/cjs/components/axis/get-axis-attributes.d.ts +0 -151
  245. package/cjs/scenegraph/utils/measure-text.js.map +0 -1
  246. package/es/components/axis/get-axis-attributes.d.ts +0 -151
  247. package/es/scenegraph/utils/measure-text.js.map +0 -1
@@ -33,23 +33,16 @@ class DatasetForPivotTable {
33
33
  }
34
34
  if (records) {
35
35
  this.records = records;
36
- const t0 = "undefined" != typeof window ? window.performance.now() : 0;
36
+ "undefined" != typeof window && window.performance.now();
37
37
  this.setRecords(records);
38
- const t1 = "undefined" != typeof window ? window.performance.now() : 0;
39
- console.log("processRecords:", t1 - t0);
40
- const t4 = "undefined" != typeof window ? window.performance.now() : 0;
38
+ "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
41
39
  this.totalStatistics();
42
- const t5 = "undefined" != typeof window ? window.performance.now() : 0;
43
- console.log("totalStatistics:", t5 - t4);
44
- const t2 = "undefined" != typeof window ? window.performance.now() : 0;
40
+ "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
45
41
  this.sortKeys();
46
- const t3 = "undefined" != typeof window ? window.performance.now() : 0;
47
- console.log("sortKeys:", t3 - t2);
48
- const t7 = "undefined" != typeof window ? window.performance.now() : 0;
42
+ "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
49
43
  this.rowKeysPath = customRowTree ? this.TreeToArr2(customRowTree) : this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_0 = null === (_z = null == this ? void 0 : this.totals) || void 0 === _z ? void 0 : _z.row) || void 0 === _0 ? void 0 : _0.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
50
44
  this.colKeysPath = customColTree ? this.TreeToArr2(customColTree) : this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_2 = null === (_1 = this.totals) || void 0 === _1 ? void 0 : _1.column) || void 0 === _2 ? void 0 : _2.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
51
- const t8 = "undefined" != typeof window ? window.performance.now() : 0;
52
- console.log("TreeToArr:", t8 - t7);
45
+ "undefined" != typeof window && window.performance.now();
53
46
  }
54
47
  delete this.rowFlatKeys, delete this.colFlatKeys;
55
48
  }
@@ -1,17 +1,14 @@
1
- import type { FilterRules, IDataConfig, SortRule, AggregationRules, SortRules, DerivedFieldRules, Totals, MappingRules, IHeaderTreeDefine, CollectValueBy, CollectedValue, IPagination } from '../ts-types';
1
+ import type { FilterRules, IDataConfig, SortRule, AggregationRules, SortRules, DerivedFieldRules, Totals, MappingRules, IHeaderTreeDefine, CollectValueBy, CollectedValue, IIndicator } from '../ts-types';
2
2
  import type { Aggregator } from './statistics-helper';
3
3
  import { typeSort } from './statistics-helper';
4
4
  export declare class Dataset {
5
5
  dataConfig: IDataConfig;
6
- pagination: IPagination;
7
6
  records: any[] | Record<string, any[]>;
8
7
  tree: Record<string, Record<string, Aggregator[]>>;
9
8
  private colFlatKeys;
10
9
  private rowFlatKeys;
11
10
  colKeys: string[][];
12
11
  rowKeys: string[][];
13
- rowKeysPath: string[][];
14
- colKeysPath: string[][];
15
12
  rowOrder: string;
16
13
  colOrder: string;
17
14
  sorted: boolean;
@@ -45,8 +42,12 @@ export declare class Dataset {
45
42
  rows: string[];
46
43
  columns: string[];
47
44
  indicatorKeys: string[];
48
- private rowKeysPath_FULL;
49
- constructor(dataConfig: IDataConfig, pagination: IPagination, rows: string[], columns: string[], indicatorKeys: string[], records: any[] | Record<string, any[]>, customColTree?: IHeaderTreeDefine[], customRowTree?: IHeaderTreeDefine[], needSplitPositiveAndNegative?: boolean);
45
+ colHeaderTree: any[];
46
+ rowHeaderTree: any[];
47
+ rowHierarchyType: 'grid' | 'tree';
48
+ indicators: (string | IIndicator)[];
49
+ indicatorsAsCol: boolean;
50
+ constructor(dataConfig: IDataConfig, rows: string[], columns: string[], indicatorKeys: string[], indicators: (string | IIndicator)[], indicatorsAsCol: boolean, records: any[] | Record<string, any[]>, rowHierarchyType?: 'grid' | 'tree', customColTree?: IHeaderTreeDefine[], customRowTree?: IHeaderTreeDefine[], needSplitPositiveAndNegative?: boolean);
50
51
  registerAggregator(type: string, aggregator: any): void;
51
52
  registerAggregators(): void;
52
53
  private setRecords;
@@ -57,16 +58,16 @@ export declare class Dataset {
57
58
  private processRecord;
58
59
  updateSortRules(sortRules: SortRules): void;
59
60
  updateFilterRules(filterRules: FilterRules, isResetTree?: boolean): void;
60
- updatePagination(pagination: IPagination): void;
61
61
  private getAggregatorRule;
62
62
  getAggregator(rowKey: string[] | string, colKey: string[] | string, indicator: string): Aggregator;
63
63
  sortKeys(): void;
64
64
  arrSort(fieldArr: string[], isRow: boolean): (a: string[], b: string[]) => number;
65
65
  getSort(sortRule: SortRule, isSortRow: boolean): typeof typeSort;
66
66
  totalStatistics(): void;
67
+ private ArrToTree1;
67
68
  private ArrToTree;
68
69
  private TreeToArr;
69
- private TreeToArr2;
70
70
  private dealWithZeroAlign;
71
71
  private cacheDeminsionCollectedValues;
72
+ private _adjustCustomTree;
72
73
  }
@@ -4,21 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.Dataset = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), util_1 = require("../tools/util"), ts_types_1 = require("../ts-types"), statistics_helper_1 = require("./statistics-helper"), zero_align_1 = require("./util/zero-align");
7
+ const vutils_1 = require("@visactor/vutils"), ts_types_1 = require("../ts-types"), statistics_helper_1 = require("./statistics-helper"), zero_align_1 = require("./util/zero-align");
8
8
 
9
9
  class Dataset {
10
- constructor(dataConfig, pagination, rows, columns, indicatorKeys, records, customColTree, customRowTree, needSplitPositiveAndNegative) {
10
+ constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
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;
12
12
  this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {}, this.colKeys = [],
13
13
  this.rowKeys = [], this.rowOrder = "key_a_to_z", this.colOrder = "key_a_to_z", this.sorted = !1,
14
14
  this.indicatorStatistics = [], this.aggregators = {}, this.stringJoinChar = String.fromCharCode(0),
15
15
  this.rowsIsTotal = [], this.colsIsTotal = [], this.collectedValues = {}, this.cacheCollectedValues = {},
16
- this.registerAggregators(), this.dataConfig = dataConfig, this.sortRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.sortRules,
16
+ this.registerAggregators(), this.dataConfig = dataConfig, this.rowHierarchyType = null != rowHierarchyType ? rowHierarchyType : "grid",
17
+ this.sortRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.sortRules,
17
18
  this.aggregationRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.aggregationRules,
18
19
  this.derivedFieldRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.derivedFieldRules,
19
20
  this.mappingRules = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.mappingRules,
20
21
  this.totals = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals,
21
- this.rows = rows, this.columns = columns, this.indicatorKeys = indicatorKeys, this.colGrandTotalLabel = null !== (_h = null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.column) || void 0 === _g ? void 0 : _g.grandTotalLabel) && void 0 !== _h ? _h : "总计",
22
+ this.rows = rows, this.columns = columns, this.indicatorKeys = indicatorKeys, this.indicatorsAsCol = indicatorsAsCol,
23
+ this.indicators = indicators, this.colGrandTotalLabel = null !== (_h = null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.column) || void 0 === _g ? void 0 : _g.grandTotalLabel) && void 0 !== _h ? _h : "总计",
22
24
  this.colSubTotalLabel = null !== (_l = null === (_k = null === (_j = this.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.subTotalLabel) && void 0 !== _l ? _l : "小计",
23
25
  this.rowGrandTotalLabel = null !== (_p = null === (_o = null === (_m = this.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.grandTotalLabel) && void 0 !== _p ? _p : "总计",
24
26
  this.rowSubTotalLabel = null !== (_s = null === (_r = null === (_q = this.totals) || void 0 === _q ? void 0 : _q.row) || void 0 === _r ? void 0 : _r.subTotalLabel) && void 0 !== _s ? _s : "小计",
@@ -33,28 +35,23 @@ class Dataset {
33
35
  const dimension = this.totals.column.subTotalsDimensions[i], dimensionIndex = this.columns.indexOf(dimension);
34
36
  this.colsIsTotal[dimensionIndex] = !0;
35
37
  }
36
- if (this.rowKeysPath = [], this.rowKeysPath_FULL = [], this.colKeysPath = [], records) {
38
+ if (records) {
37
39
  this.records = records;
38
- const t0 = "undefined" != typeof window ? window.performance.now() : 0;
40
+ "undefined" != typeof window && window.performance.now();
39
41
  this.setRecords(), this.processCollectedValuesWithSumBy(), this.processCollectedValuesWithSortBy();
40
- const t1 = "undefined" != typeof window ? window.performance.now() : 0;
41
- console.log("processRecords:", t1 - t0);
42
- const t4 = "undefined" != typeof window ? window.performance.now() : 0;
42
+ "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
43
43
  this.totalStatistics();
44
- const t5 = "undefined" != typeof window ? window.performance.now() : 0;
45
- console.log("totalStatistics:", t5 - t4);
46
- const t2 = "undefined" != typeof window ? window.performance.now() : 0;
44
+ "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
47
45
  this.sortKeys();
48
- const t3 = "undefined" != typeof window ? window.performance.now() : 0;
49
- console.log("sortKeys:", t3 - t2);
50
- const t7 = "undefined" != typeof window ? window.performance.now() : 0;
51
- this.rowKeysPath_FULL = customRowTree ? this.TreeToArr2(customRowTree) : this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, null === (_1 = null === (_0 = null == this ? void 0 : this.totals) || void 0 === _0 ? void 0 : _0.row) || void 0 === _1 ? void 0 : _1.showGrandTotals, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
52
- this.colKeysPath = customColTree ? this.TreeToArr2(customColTree) : this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, null === (_3 = null === (_2 = this.totals) || void 0 === _2 ? void 0 : _2.column) || void 0 === _3 ? void 0 : _3.showGrandTotals, this.colGrandTotalLabel, this.colSubTotalLabel));
53
- const t8 = "undefined" != typeof window ? window.performance.now() : 0;
54
- console.log("TreeToArr:", t8 - t7), (null === (_4 = this.dataConfig) || void 0 === _4 ? void 0 : _4.isPivotChart) && (this.dealWithZeroAlign(),
46
+ "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
47
+ customRowTree ? (indicatorsAsCol || (customRowTree = this._adjustCustomTree(customRowTree)),
48
+ this.rowHeaderTree = customRowTree) : "tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows, indicatorsAsCol ? void 0 : indicators) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows, indicatorsAsCol ? void 0 : indicators, this.rowsIsTotal, (null === (_1 = null === (_0 = null == this ? void 0 : this.totals) || void 0 === _0 ? void 0 : _0.row) || void 0 === _1 ? void 0 : _1.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel),
49
+ customColTree ? (indicatorsAsCol && (customColTree = this._adjustCustomTree(customColTree)),
50
+ this.colHeaderTree = customColTree) : this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns, indicatorsAsCol ? indicators : void 0, this.colsIsTotal, null === (_3 = null === (_2 = this.totals) || void 0 === _2 ? void 0 : _2.column) || void 0 === _3 ? void 0 : _3.showGrandTotals, this.colGrandTotalLabel, this.colSubTotalLabel);
51
+ "undefined" != typeof window && window.performance.now();
52
+ (null === (_4 = this.dataConfig) || void 0 === _4 ? void 0 : _4.isPivotChart) && (this.dealWithZeroAlign(),
55
53
  this.cacheDeminsionCollectedValues());
56
54
  }
57
- this.updatePagination(pagination);
58
55
  }
59
56
  registerAggregator(type, aggregator) {
60
57
  this.aggregators[type] = aggregator;
@@ -179,9 +176,7 @@ class Dataset {
179
176
  }
180
177
  }
181
178
  updateSortRules(sortRules) {
182
- var _a, _b, _c, _d;
183
- this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.rowKeysPath_FULL = this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_b = null === (_a = null == this ? void 0 : this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
184
- this.colKeysPath = this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.column) || void 0 === _d ? void 0 : _d.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
179
+ this.sorted = !1, this.sortRules = sortRules, this.sortKeys();
185
180
  }
186
181
  updateFilterRules(filterRules, isResetTree = !1) {
187
182
  var _a;
@@ -189,16 +184,6 @@ class Dataset {
189
184
  this.collectedValues = {}, this.processRecords(), this.processCollectedValuesWithSumBy(),
190
185
  this.processCollectedValuesWithSortBy(), (null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.isPivotChart) && this.dealWithZeroAlign();
191
186
  }
192
- updatePagination(pagination) {
193
- var _a, _b, _c, _d;
194
- if (this.pagination = pagination, (0, util_1.isValid)(null === (_a = this.pagination) || void 0 === _a ? void 0 : _a.perPageCount) && (0,
195
- util_1.isValid)(null === (_b = this.pagination) || void 0 === _b ? void 0 : _b.currentPage)) {
196
- this.pagination.perPageCount = Math.ceil(this.pagination.perPageCount / this.indicatorKeys.length) * this.indicatorKeys.length;
197
- const {perPageCount: perPageCount, currentPage: currentPage} = this.pagination, startIndex = Math.ceil(perPageCount * (currentPage || 0) / this.indicatorKeys.length), endIndex = startIndex + Math.ceil(perPageCount / this.indicatorKeys.length);
198
- this.rowKeysPath = null === (_c = this.rowKeysPath_FULL) || void 0 === _c ? void 0 : _c.slice(startIndex, endIndex);
199
- } else this.rowKeysPath = this.rowKeysPath_FULL;
200
- this.pagination && (this.pagination.totalCount = null === (_d = this.rowKeysPath_FULL) || void 0 === _d ? void 0 : _d.length);
201
- }
202
187
  getAggregatorRule(indicatorKey) {
203
188
  var _a;
204
189
  return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
@@ -321,7 +306,7 @@ class Dataset {
321
306
  const dimension = that.totals.column.subTotalsDimensions[i], dimensionIndex = that.columns.indexOf(dimension);
322
307
  if (dimensionIndex >= 0) {
323
308
  const colTotalKey = colKey.slice(0, dimensionIndex + 1);
324
- colTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.column) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
309
+ "grid" === this.rowHierarchyType && colTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.column) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
325
310
  const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
326
311
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
327
312
  for (let i = 0; i < this.indicatorKeys.length; i++) {
@@ -353,7 +338,7 @@ class Dataset {
353
338
  const dimension = that.totals.row.subTotalsDimensions[i], dimensionIndex = that.rows.indexOf(dimension);
354
339
  if (dimensionIndex >= 0) {
355
340
  const rowTotalKey = rowKey.slice(0, dimensionIndex + 1);
356
- rowTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.row) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
341
+ "grid" === this.rowHierarchyType && rowTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.row) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
357
342
  const flatRowTotalKey = rowTotalKey.join(this.stringJoinChar);
358
343
  if (this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
359
344
  !this.tree[flatRowTotalKey][flatColKey]) {
@@ -389,9 +374,35 @@ class Dataset {
389
374
  }));
390
375
  }
391
376
  }
392
- ArrToTree(arr, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel) {
377
+ ArrToTree1(arr, rows, indicators) {
393
378
  const result = [], concatStr = this.stringJoinChar, map = new Map;
394
- if (arr.forEach((item => function(list) {
379
+ return arr.forEach((item => function(list) {
380
+ const path = [];
381
+ let node;
382
+ list.forEach(((value, index) => {
383
+ path.push(value);
384
+ const flatKey = path.join(concatStr);
385
+ let item = map.get(flatKey);
386
+ item || (item = {
387
+ value: value,
388
+ dimensionKey: rows[index],
389
+ children: index === list.length - 1 && (null == indicators ? void 0 : indicators.length) >= 1 ? null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
390
+ indicatorKey: indicator,
391
+ value: indicator
392
+ } : {
393
+ indicatorKey: indicator.indicatorKey,
394
+ value: indicator.title
395
+ })) : []
396
+ }, map.set(flatKey, item), node ? node.children.push(item) : result.push(item)),
397
+ node = item;
398
+ }));
399
+ }(item))), result;
400
+ }
401
+ ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel) {
402
+ var _a;
403
+ let result = [];
404
+ const concatStr = this.stringJoinChar, map = new Map;
405
+ if ((null == arr ? void 0 : arr.length) ? arr.forEach((item => function(list) {
395
406
  const path = [];
396
407
  let node;
397
408
  list.forEach(((value, index) => {
@@ -400,14 +411,28 @@ class Dataset {
400
411
  let item = map.get(flatKey);
401
412
  if (!item) {
402
413
  if (item = {
403
- id: flatKey,
404
- children: []
414
+ value: value,
415
+ dimensionKey: rows[index],
416
+ children: index === list.length - 1 && (null == indicators ? void 0 : indicators.length) >= 1 ? null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
417
+ indicatorKey: indicator,
418
+ value: indicator
419
+ } : {
420
+ indicatorKey: indicator.indicatorKey,
421
+ value: indicator.title
422
+ })) : []
405
423
  }, subTotalFlags[index]) {
406
424
  let curChild = item.children;
407
425
  for (let i = index; i < list.length - 1; i++) {
408
426
  const totalChild = {
409
- id: `${flatKey}${concatStr}${subTotalLabel}`,
410
- children: []
427
+ value: subTotalLabel,
428
+ dimensionKey: rows[index + 1],
429
+ children: index + 1 === list.length - 1 && (null == indicators ? void 0 : indicators.length) >= 1 ? null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
430
+ indicatorKey: indicator,
431
+ value: indicator
432
+ } : {
433
+ indicatorKey: indicator.indicatorKey,
434
+ value: indicator.title
435
+ })) : []
411
436
  };
412
437
  curChild.push(totalChild), curChild = totalChild.children;
413
438
  }
@@ -416,19 +441,25 @@ class Dataset {
416
441
  }
417
442
  node = item;
418
443
  }));
419
- }(item))), isGrandTotal) {
444
+ }(item))) : indicators && (result = null == indicators ? void 0 : indicators.map((indicator => {
445
+ var _a;
446
+ return {
447
+ indicatorKey: indicator.indicatorKey,
448
+ value: null !== (_a = indicator.title) && void 0 !== _a ? _a : indicator.indicatorKey
449
+ };
450
+ }))), isGrandTotal && (null == arr ? void 0 : arr.length)) {
420
451
  const node = {
421
- id: grandTotalLabel,
422
- children: []
452
+ value: grandTotalLabel,
453
+ dimensionKey: rows[0],
454
+ rowSpan: subTotalFlags.length,
455
+ children: null !== (_a = null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
456
+ indicatorKey: indicator,
457
+ value: indicator
458
+ } : {
459
+ indicatorKey: indicator.indicatorKey,
460
+ value: indicator.title
461
+ }))) && void 0 !== _a ? _a : []
423
462
  };
424
- let curChild = node.children;
425
- for (let i = 1; i < subTotalFlags.length; i++) {
426
- const totalChild = {
427
- id: grandTotalLabel,
428
- children: []
429
- };
430
- curChild.push(totalChild), curChild = totalChild.children;
431
- }
432
463
  result.push(node);
433
464
  }
434
465
  return result;
@@ -441,15 +472,6 @@ class Dataset {
441
472
  }
442
473
  return tree.forEach((treeNode => getPath(treeNode, []))), result;
443
474
  }
444
- TreeToArr2(tree) {
445
- const result = [];
446
- function getPath(node, arr) {
447
- var _a, _b;
448
- arr.push(arr.length > 0 ? [ arr[arr.length - 1], node.value ].join(String.fromCharCode(0)) : node.value),
449
- (null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) > 0 && !node.children[0].indicatorKey ? null === (_b = node.children) || void 0 === _b || _b.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
450
- }
451
- return tree.forEach((treeNode => getPath(treeNode, []))), result;
452
- }
453
475
  dealWithZeroAlign() {
454
476
  const indicatorsToAlign = [];
455
477
  for (let i = 0; i < this.aggregationRules.length; i++) {
@@ -491,6 +513,28 @@ class Dataset {
491
513
  cacheDeminsionCollectedValues() {
492
514
  for (const key in this.collectValuesBy) "xField" !== this.collectValuesBy[key].type && "yField" !== this.collectValuesBy[key].type || (this.dataConfig.dimensionSortArray ? this.cacheCollectedValues[key] = arraySortByAnotherArray(this.collectedValues[key], this.dataConfig.dimensionSortArray) : this.cacheCollectedValues[key] = this.collectedValues[key]);
493
515
  }
516
+ _adjustCustomTree(customTree) {
517
+ var _a;
518
+ const checkNode = (nodes, isHasIndicator) => {
519
+ nodes.forEach((node => {
520
+ var _a, _b;
521
+ node.indicatorKey || isHasIndicator || (null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) ? node.children && checkNode(node.children, isHasIndicator || !!node.indicatorKey) : node.children = null === (_b = this.indicators) || void 0 === _b ? void 0 : _b.map((indicator => {
522
+ var _a;
523
+ return {
524
+ indicatorKey: indicator.indicatorKey,
525
+ value: null !== (_a = indicator.title) && void 0 !== _a ? _a : indicator.indicatorKey
526
+ };
527
+ }));
528
+ }));
529
+ };
530
+ return (null == customTree ? void 0 : customTree.length) ? checkNode(customTree, !1) : customTree = null === (_a = this.indicators) || void 0 === _a ? void 0 : _a.map((indicator => {
531
+ var _a;
532
+ return {
533
+ indicatorKey: indicator.indicatorKey,
534
+ value: null !== (_a = indicator.title) && void 0 !== _a ? _a : indicator.indicatorKey
535
+ };
536
+ })), customTree;
537
+ }
494
538
  }
495
539
 
496
540
  function arraySortByAnotherArray(array, sortArray) {