@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
@@ -1,823 +1 @@
1
- import { isValid, transpose } from "../tools/util";
2
-
3
- import { IndicatorDimensionKeyPlaceholder } from "../tools/global";
4
-
5
- import { isArray } from "@visactor/vutils";
6
-
7
- import { getAxisConfigInPivotChart } from "./chart-helper/get-axis-config";
8
-
9
- import { getChartAxes, getChartDataId, getChartSpec, getRawChartSpec } from "./chart-helper/get-chart-spec";
10
-
11
- import { getQuadProps } from "../scenegraph/utils/padding";
12
-
13
- const EMPTY_HEADER = {
14
- isEmpty: !0,
15
- id: void 0,
16
- field: void 0,
17
- headerType: void 0,
18
- define: void 0
19
- };
20
-
21
- export class PivotLayoutMap {
22
- constructor(table, dataset) {
23
- var _a, _b, _c, _d, _e, _f, _g, _h;
24
- this._headerObjects = [], this._headerObjectMap = {}, this._indicatorObjects = [],
25
- this._columnWidths = [], this._showRowHeader = !0, this._showColumnHeader = !0,
26
- this._indicatorShowType = "column", this.indicatorsAsCol = !0, this.hideIndicatorName = !1,
27
- this.indicatorDimensionKey = IndicatorDimensionKeyPlaceholder, this._table = table,
28
- this._chartItemSpanSize = 0, this._chartItemBandSize = 0, this.rowTree = table.options.rowTree,
29
- this.columnTree = table.options.columnTree, this.rowsDefine = null !== (_a = table.options.rows) && void 0 !== _a ? _a : [],
30
- this.columnsDefine = null !== (_b = table.options.columns) && void 0 !== _b ? _b : [],
31
- this.indicatorsDefine = null !== (_c = table.options.indicators) && void 0 !== _c ? _c : [],
32
- this.indicatorTitle = table.options.indicatorTitle, this.dataset = dataset, this.dataConfig = dataset.dataConfig,
33
- this.indicatorKeys = dataset.indicatorKeys, this.indicatorsAsCol = null === (_d = table.options.indicatorsAsCol) || void 0 === _d || _d,
34
- this.hideIndicatorName = null !== (_e = table.options.hideIndicatorName) && void 0 !== _e && _e,
35
- this.showRowHeader = null === (_f = table.options.showRowHeader) || void 0 === _f || _f,
36
- this.showColumnHeader = null === (_g = table.options.showColumnHeader) || void 0 === _g || _g,
37
- this.rowHeaderTitle = table.options.rowHeaderTitle, this.columnHeaderTitle = table.options.columnHeaderTitle,
38
- this.cornerSetting = null !== (_h = table.options.corner) && void 0 !== _h ? _h : {
39
- titleOnDimension: "column"
40
- }, this.columns = dataset.columns, this.rows = dataset.rows, this.rowKeysPath = dataset.rowKeysPath,
41
- this.colKeysPath = dataset.colKeysPath, this.tree = dataset.tree, this.initState(),
42
- this.convertColKeys = transpose(this.colKeysPath);
43
- }
44
- initState() {
45
- var _a, _b, _c, _d, _e;
46
- if (this.indicatorsAsCol && !this.hideIndicatorName ? this._indicatorShowType = "column" : this.indicatorsAsCol || this.hideIndicatorName ? this._indicatorShowType = "none" : this._indicatorShowType = "row",
47
- this.colShowAttrs = "column" === this._indicatorShowType ? this.columns.concat(this.indicatorDimensionKey) : Array.from(this.columns),
48
- this.rowShowAttrs = "row" === this._indicatorShowType ? this.rows.concat(this.indicatorDimensionKey) : Array.from(this.rows),
49
- this._bodyRowCount = this.rowKeysPath.length * (this.indicatorsAsCol ? 1 : this.indicatorKeys.length),
50
- this.initHeaderObjects(), this.initIndicatorObjects(), this.rowHeaderTitle) {
51
- const cell_id = "rowHeaderTitle", title = "string" == typeof this.rowHeaderTitle.title ? this.rowHeaderTitle.title : this.rowsDefine.reduce(((title, value) => "string" == typeof value ? title : title + (title ? `/${value.title}` : `${value.title}`)), "");
52
- this._headerObjectMap[title] = {
53
- id: title,
54
- title: title,
55
- field: cell_id,
56
- headerType: null !== (_a = this.rowHeaderTitle.headerType) && void 0 !== _a ? _a : "text",
57
- style: this.rowHeaderTitle.headerStyle,
58
- define: {}
59
- }, this._headerObjectMap[cell_id] = {
60
- id: cell_id,
61
- title: "",
62
- field: cell_id,
63
- headerType: null !== (_b = this.cornerSetting.headerType) && void 0 !== _b ? _b : "text",
64
- style: this.cornerSetting.headerStyle,
65
- define: {}
66
- }, this._headerObjects.push(this._headerObjectMap[title]), this._headerObjects.push(this._headerObjectMap[cell_id]),
67
- this.rowShowAttrs.unshift(cell_id), this.rowKeysPath.forEach(((rowKey, index) => {
68
- rowKey.unshift(title);
69
- }));
70
- }
71
- if (this.columnHeaderTitle) {
72
- const cell_id = "columnHeaderTitleCell", title = "string" == typeof this.columnHeaderTitle.title ? this.columnHeaderTitle.title : this.columnsDefine.reduce(((title, value) => "string" == typeof value ? title : title + (title ? `/${value.title}` : `${value.title}`)), "");
73
- this._headerObjectMap[title] = {
74
- id: title,
75
- title: title,
76
- field: cell_id,
77
- headerType: null !== (_c = this.columnHeaderTitle.headerType) && void 0 !== _c ? _c : "text",
78
- style: this.columnHeaderTitle.headerStyle,
79
- define: {}
80
- }, this._headerObjectMap[cell_id] = {
81
- id: cell_id,
82
- title: "",
83
- field: cell_id,
84
- headerType: null !== (_d = this.cornerSetting.headerType) && void 0 !== _d ? _d : "text",
85
- style: this.cornerSetting.headerStyle,
86
- define: {}
87
- }, this._headerObjects.push(this._headerObjectMap[title]), this._headerObjects.push(this._headerObjectMap[cell_id]),
88
- this.colShowAttrs.unshift(cell_id), this.colKeysPath.forEach(((columnKey, index) => {
89
- columnKey.unshift(title);
90
- }));
91
- }
92
- if (this._table.isPivotChart()) if (this.hasTwoIndicatorAxes = this._indicatorObjects.some((indicatorObject => !!(indicatorObject.chartSpec && indicatorObject.chartSpec.series && indicatorObject.chartSpec.series.length > 1))),
93
- this._chartItemSpanSize = 0, this._chartItemBandSize = 0, this._indicatorObjects.find((indicatorObject => {
94
- var _a, _b, _c, _d, _e, _f, _g, _h;
95
- (null === (_a = null == indicatorObject ? void 0 : indicatorObject.style) || void 0 === _a ? void 0 : _a.padding) && (this._chartPadding = indicatorObject.style.padding),
96
- (null === (_b = indicatorObject.chartSpec) || void 0 === _b ? void 0 : _b.barWidth) && (this._chartItemSpanSize = null === (_c = indicatorObject.chartSpec) || void 0 === _c ? void 0 : _c.barWidth);
97
- const bandAxisConfig = null === (_e = null === (_d = indicatorObject.chartSpec) || void 0 === _d ? void 0 : _d.axes) || void 0 === _e ? void 0 : _e.find((axis => "band" === axis.type));
98
- return (null == bandAxisConfig ? void 0 : bandAxisConfig.bandSize) && (this._chartItemBandSize = null == bandAxisConfig ? void 0 : bandAxisConfig.bandSize,
99
- this._chartPaddingInner = null !== (_f = isArray(bandAxisConfig.paddingInner) ? bandAxisConfig.paddingInner[0] : bandAxisConfig.paddingInner) && void 0 !== _f ? _f : 0,
100
- this._chartPaddingOuter = null !== (_g = isArray(bandAxisConfig.paddingOuter) ? bandAxisConfig.paddingOuter[0] : bandAxisConfig.paddingOuter) && void 0 !== _g ? _g : 0),
101
- this._chartItemSpanSize > 0 || (null === (_h = indicatorObject.chartSpec.series) || void 0 === _h || _h.find((seriesObject => (seriesObject.barWidth && (this._chartItemSpanSize = seriesObject.barWidth),
102
- this._chartItemSpanSize > 0))), !1);
103
- })), this.indicatorsAsCol) {
104
- const cell_id = "rowHeaderEmpty";
105
- this._headerObjectMap[cell_id] = {
106
- id: cell_id,
107
- title: "",
108
- field: cell_id,
109
- headerType: null !== (_e = this.cornerSetting.headerType) && void 0 !== _e ? _e : "text",
110
- style: this.cornerSetting.headerStyle,
111
- define: {}
112
- }, this._headerObjects.push(this._headerObjectMap[cell_id]), this.rowShowAttrs.push(cell_id),
113
- this.hasTwoIndicatorAxes || this.colShowAttrs.pop();
114
- } else {
115
- const axisOption = this._table.pivotChartAxes.find((axisOption => "left" === axisOption.orient));
116
- !1 === (null == axisOption ? void 0 : axisOption.visible) && this.rowShowAttrs.pop();
117
- }
118
- this._colCount = (0 === this.colKeysPath.length ? 1 : this.colKeysPath.length) * (this.indicatorsAsCol ? this.indicatorKeys.length : 1) + this.rowHeaderLevelCount + this.rightFrozenColCount,
119
- this._rowCount = (0 === this.rowKeysPath.length ? 1 : this.rowKeysPath.length) * (this.indicatorsAsCol ? 1 : this.indicatorKeys.length) + this.columnHeaderLevelCount + this.bottomFrozenRowCount,
120
- this.setColumnWidths();
121
- }
122
- setColumnWidths() {
123
- const returnWidths = new Array(this.colCount).fill(void 0);
124
- if (this.showRowHeader && (this.rowHeaderTitle && (returnWidths[0] = {}), this.rowShowAttrs.forEach(((objKey, index) => {
125
- var _a;
126
- const dimension = null === (_a = this.rowsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === objKey));
127
- dimension && (returnWidths[index + (this.rowHeaderTitle ? 1 : 0)] = {
128
- width: dimension.width,
129
- minWidth: dimension.minWidth,
130
- maxWidth: dimension.maxWidth
131
- });
132
- }))), this.indicatorsAsCol) for (let i = this.rowHeaderLevelCount; i < this.colCount; i++) {
133
- const cellDefine = this.getBody(i, this.columnHeaderLevelCount);
134
- returnWidths[i] = {
135
- width: null == cellDefine ? void 0 : cellDefine.width,
136
- minWidth: null == cellDefine ? void 0 : cellDefine.minWidth,
137
- maxWidth: null == cellDefine ? void 0 : cellDefine.maxWidth
138
- };
139
- } else {
140
- let maxWidth, minWidth, isAuto, width = 0;
141
- this._indicatorObjects.forEach(((obj, index) => {
142
- "number" == typeof obj.width ? width = Math.max(obj.width, width) : "auto" === obj.width && (isAuto = !0),
143
- "number" == typeof obj.minWidth && (minWidth = Math.max(obj.minWidth, minWidth)),
144
- "number" == typeof obj.maxWidth && (maxWidth = Math.max(obj.maxWidth, maxWidth));
145
- })), width = width > 0 ? width : isAuto ? "auto" : void 0, returnWidths.fill({
146
- width: width,
147
- minWidth: minWidth,
148
- maxWidth: maxWidth
149
- }, this.rowHeaderLevelCount, this.colCount - this.rightFrozenColCount);
150
- }
151
- this._columnWidths = returnWidths;
152
- }
153
- get columnWidths() {
154
- return this._columnWidths;
155
- }
156
- getColumnWidthDefined(col) {
157
- return this._columnWidths[col];
158
- }
159
- getDimensionInfo(dimensionKey) {
160
- var _a, _b, _c;
161
- return null !== (_b = null === (_a = this.rowsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey))) && void 0 !== _b ? _b : null === (_c = this.columnsDefine) || void 0 === _c ? void 0 : _c.find((dimension => "string" != typeof dimension && dimension.dimensionKey === dimensionKey));
162
- }
163
- getIndicatorInfo(indicatorKey, indicatorValue = "") {
164
- var _a;
165
- return null === (_a = this.indicatorsDefine) || void 0 === _a ? void 0 : _a.find((indicator => "string" != typeof indicator && (indicatorKey ? indicator.indicatorKey === indicatorKey : !!indicatorValue && indicator.title === indicatorValue)));
166
- }
167
- getColKeysPath() {
168
- return this.colKeysPath;
169
- }
170
- getRowKeysPath() {
171
- return this.rowKeysPath;
172
- }
173
- initHeaderObjects() {
174
- var _a, _b, _c, _d, _e, _f, _g, _h;
175
- for (let i = 0, len = this.rowKeysPath.length; i <= len - 1; i++) {
176
- const rowKey = this.rowKeysPath[i];
177
- for (let j = 0, len2 = rowKey.length; j <= len2 - 1; j++) if (!this._headerObjectMap[rowKey[j]]) {
178
- const ids = rowKey[j].split(this.dataset.stringJoinChar), dimensionInfo = this.getDimensionInfo(this.rows[ids.length - 1]);
179
- this._headerObjectMap[rowKey[j]] = {
180
- id: rowKey[j],
181
- field: null !== (_a = null == dimensionInfo ? void 0 : dimensionInfo.dimensionKey) && void 0 !== _a ? _a : this.rows[ids.length - 1],
182
- title: ids[ids.length - 1],
183
- style: null == dimensionInfo ? void 0 : dimensionInfo.headerStyle,
184
- define: {
185
- field: null !== (_b = null == dimensionInfo ? void 0 : dimensionInfo.dimensionKey) && void 0 !== _b ? _b : this.rows[ids.length - 1],
186
- headerType: null !== (_c = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _c ? _c : "text",
187
- cellType: "text"
188
- },
189
- fieldFormat: null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
190
- dropDownMenu: null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
191
- headerType: null !== (_d = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _d ? _d : "text",
192
- width: null == dimensionInfo ? void 0 : dimensionInfo.width
193
- }, this._headerObjects.push(this._headerObjectMap[rowKey[j]]);
194
- }
195
- }
196
- for (let i = 0, len = this.colKeysPath.length; i <= len - 1; i++) {
197
- const colKey = this.colKeysPath[i];
198
- for (let j = 0, len2 = colKey.length; j <= len2 - 1; j++) if (!this._headerObjectMap[colKey[j]]) {
199
- const ids = colKey[j].split(this.dataset.stringJoinChar), dimensionInfo = this.getDimensionInfo(this.columns[ids.length - 1]);
200
- this._headerObjectMap[colKey[j]] = {
201
- id: colKey[j],
202
- field: null !== (_e = null == dimensionInfo ? void 0 : dimensionInfo.dimensionKey) && void 0 !== _e ? _e : this.columns[ids.length - 1],
203
- title: ids[ids.length - 1],
204
- style: null == dimensionInfo ? void 0 : dimensionInfo.headerStyle,
205
- define: {
206
- field: null !== (_f = null == dimensionInfo ? void 0 : dimensionInfo.dimensionKey) && void 0 !== _f ? _f : this.columns[ids.length - 1],
207
- headerType: null !== (_g = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _g ? _g : "text",
208
- cellType: "text"
209
- },
210
- fieldFormat: null == dimensionInfo ? void 0 : dimensionInfo.headerFormat,
211
- dropDownMenu: null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
212
- headerType: null !== (_h = null == dimensionInfo ? void 0 : dimensionInfo.headerType) && void 0 !== _h ? _h : "text",
213
- width: null == dimensionInfo ? void 0 : dimensionInfo.width
214
- }, this._headerObjects.push(this._headerObjectMap[colKey[j]]);
215
- }
216
- }
217
- let cornerAttrs;
218
- this.indicatorsDefine.forEach((indicator => {
219
- var _a, _b, _c;
220
- const indicatorKey = "string" == typeof indicator ? indicator : indicator.indicatorKey, indicatorInfo = "string" == typeof indicator ? void 0 : indicator;
221
- this._headerObjectMap[indicatorKey] || (this._headerObjectMap[indicatorKey] = {
222
- id: indicatorKey,
223
- field: this.indicatorDimensionKey,
224
- title: null !== (_a = null == indicatorInfo ? void 0 : indicatorInfo.title) && void 0 !== _a ? _a : indicatorKey,
225
- style: null == indicatorInfo ? void 0 : indicatorInfo.headerStyle,
226
- define: {
227
- field: this.indicatorDimensionKey,
228
- headerType: null !== (_b = null == indicatorInfo ? void 0 : indicatorInfo.headerType) && void 0 !== _b ? _b : "text",
229
- cellType: "text"
230
- },
231
- dropDownMenu: null == indicatorInfo ? void 0 : indicatorInfo.dropDownMenu,
232
- headerType: null !== (_c = null == indicatorInfo ? void 0 : indicatorInfo.headerType) && void 0 !== _c ? _c : "text",
233
- width: null == indicatorInfo ? void 0 : indicatorInfo.width
234
- }, this._headerObjects.push(this._headerObjectMap[indicatorKey]));
235
- })), "column" === this.cornerSetting.titleOnDimension ? cornerAttrs = this.colShowAttrs : "row" === this.cornerSetting.titleOnDimension && (cornerAttrs = this.rowShowAttrs),
236
- null == cornerAttrs || cornerAttrs.forEach((cornerAttrStr => {
237
- var _a, _b, _c, _d, _e, _f;
238
- if (!this._headerObjectMap[cornerAttrStr]) {
239
- const dimensionInfo = this.getDimensionInfo(cornerAttrStr);
240
- this._headerObjectMap[cornerAttrStr] = {
241
- id: cornerAttrStr,
242
- field: cornerAttrStr,
243
- title: cornerAttrStr === this.indicatorDimensionKey ? this.indicatorTitle : null !== (_a = null == dimensionInfo ? void 0 : dimensionInfo.title) && void 0 !== _a ? _a : cornerAttrStr,
244
- style: null === (_b = this.cornerSetting) || void 0 === _b ? void 0 : _b.headerStyle,
245
- define: {
246
- field: cornerAttrStr,
247
- headerType: null !== (_d = null === (_c = this.cornerSetting) || void 0 === _c ? void 0 : _c.headerType) && void 0 !== _d ? _d : "text",
248
- cellType: "text"
249
- },
250
- dropDownMenu: null == dimensionInfo ? void 0 : dimensionInfo.dropDownMenu,
251
- headerType: null !== (_f = null === (_e = this.cornerSetting) || void 0 === _e ? void 0 : _e.headerType) && void 0 !== _f ? _f : "text",
252
- width: null == dimensionInfo ? void 0 : dimensionInfo.width
253
- }, this._headerObjects.push(this._headerObjectMap[cornerAttrStr]);
254
- }
255
- }));
256
- }
257
- initIndicatorObjects() {
258
- this.indicatorKeys.forEach((indicatorKey => {
259
- var _a, _b, _c, _d, _e;
260
- const indicatorInfo = null === (_a = this.indicatorsDefine) || void 0 === _a ? void 0 : _a.find((indicator => "string" != typeof indicator && indicator.indicatorKey === indicatorKey));
261
- this._indicatorObjects.push({
262
- id: indicatorKey,
263
- indicatorKey: indicatorKey,
264
- field: indicatorKey,
265
- define: Object.assign({
266
- field: indicatorKey,
267
- headerType: "text",
268
- cellType: null !== (_c = null !== (_b = null == indicatorInfo ? void 0 : indicatorInfo.cellType) && void 0 !== _b ? _b : null == indicatorInfo ? void 0 : indicatorInfo.columnType) && void 0 !== _c ? _c : "text"
269
- }, indicatorInfo),
270
- fieldFormat: null == indicatorInfo ? void 0 : indicatorInfo.format,
271
- cellType: null !== (_e = null !== (_d = null == indicatorInfo ? void 0 : indicatorInfo.cellType) && void 0 !== _d ? _d : null == indicatorInfo ? void 0 : indicatorInfo.columnType) && void 0 !== _e ? _e : "text",
272
- chartModule: indicatorInfo && ("chartModule" in indicatorInfo ? null == indicatorInfo ? void 0 : indicatorInfo.chartModule : null),
273
- chartSpec: indicatorInfo && ("chartSpec" in indicatorInfo ? null == indicatorInfo ? void 0 : indicatorInfo.chartSpec : null),
274
- sparklineSpec: indicatorInfo && ("sparklineSpec" in indicatorInfo ? null == indicatorInfo ? void 0 : indicatorInfo.sparklineSpec : null),
275
- style: null == indicatorInfo ? void 0 : indicatorInfo.style,
276
- icon: null == indicatorInfo ? void 0 : indicatorInfo.icon,
277
- width: null == indicatorInfo ? void 0 : indicatorInfo.width,
278
- minWidth: null == indicatorInfo ? void 0 : indicatorInfo.minWidth,
279
- maxWidth: null == indicatorInfo ? void 0 : indicatorInfo.maxWidth,
280
- disableColumnResize: null == indicatorInfo ? void 0 : indicatorInfo.disableColumnResize
281
- });
282
- }));
283
- }
284
- get showColumnHeader() {
285
- return this._showColumnHeader;
286
- }
287
- set showColumnHeader(_showColumnHeader) {
288
- this._showColumnHeader = _showColumnHeader;
289
- }
290
- get showRowHeader() {
291
- return this._showRowHeader;
292
- }
293
- set showRowHeader(_showRowHeader) {
294
- this._showRowHeader = _showRowHeader;
295
- }
296
- get columnHeaderTitle() {
297
- return this._columnHeaderTitle;
298
- }
299
- set columnHeaderTitle(_columnHeaderTitle) {
300
- this._columnHeaderTitle = _columnHeaderTitle;
301
- }
302
- get rowHeaderTitle() {
303
- return this._rowHeaderTitle;
304
- }
305
- set rowHeaderTitle(_rowHeaderTitle) {
306
- this._rowHeaderTitle = _rowHeaderTitle;
307
- }
308
- getCellLocation(col, row) {
309
- return this.isCornerHeader(col, row) ? "cornerHeader" : this.isColumnHeader(col, row) ? "columnHeader" : this.isRowHeader(col, row) ? "rowHeader" : "body";
310
- }
311
- isHeader(col, row) {
312
- return col < this.rowHeaderLevelCount || (row < this.columnHeaderLevelCount || (col >= this.colCount - this.rightFrozenColCount || row >= this.rowCount - this.bottomFrozenRowCount));
313
- }
314
- isCornerHeader(col, row) {
315
- return col < this.rowHeaderLevelCount && row < this.columnHeaderLevelCount;
316
- }
317
- isColumnHeader(col, row) {
318
- return col >= this.rowHeaderLevelCount && row < this.columnHeaderLevelCount;
319
- }
320
- isRightFrozenColumn(col, row) {
321
- return col >= this.colCount - this.rightFrozenColCount && row >= this.columnHeaderLevelCount && row < this.rowCount - this.bottomFrozenRowCount;
322
- }
323
- isBottomFrozenRow(col, row) {
324
- return col >= this.rowHeaderLevelCount && row >= this.rowCount - this.bottomFrozenRowCount && col < this.colCount - this.rightFrozenColCount;
325
- }
326
- isLeftBottomCorner(col, row) {
327
- return col < this.rowHeaderLevelCount && row >= this.rowCount - this.bottomFrozenRowCount;
328
- }
329
- isRightTopCorner(col, row) {
330
- return col >= this.colCount - this.rightFrozenColCount && row < this.columnHeaderLevelCount;
331
- }
332
- isRightBottomCorner(col, row) {
333
- return col >= this.colCount - this.rightFrozenColCount && row >= this.rowCount - this.bottomFrozenRowCount;
334
- }
335
- isRowHeader(col, row) {
336
- return col < this.rowHeaderLevelCount && row >= this.columnHeaderLevelCount;
337
- }
338
- isColumnIndicatorHeader(col, row) {
339
- return "column" === this._indicatorShowType && row === this.columnHeaderLevelCount - 1 && col >= this.rowHeaderLevelCount;
340
- }
341
- isRowIndicatorHeader(col, row) {
342
- return "row" === this._indicatorShowType && col === this.rowHeaderLevelCount - 1 && row >= this.columnHeaderLevelCount;
343
- }
344
- isIndicatorHeader(col, row) {
345
- return this.isColumnIndicatorHeader(col, row) || this.isRowIndicatorHeader(col, row);
346
- }
347
- getColumnHeaderRange() {
348
- return {
349
- start: {
350
- col: this.rowHeaderLevelCount,
351
- row: 0
352
- },
353
- end: {
354
- col: this.colCount - 1,
355
- row: this.columnHeaderLevelCount - 1
356
- }
357
- };
358
- }
359
- getRowHeaderRange() {
360
- return {
361
- start: {
362
- col: 0,
363
- row: this.columnHeaderLevelCount
364
- },
365
- end: {
366
- col: this.rowHeaderLevelCount - 1,
367
- row: this.rowCount - 1
368
- }
369
- };
370
- }
371
- getCornerHeaderRange() {
372
- return {
373
- start: {
374
- col: 0,
375
- row: 0
376
- },
377
- end: {
378
- col: this.rowHeaderLevelCount - 1,
379
- row: this.columnHeaderLevelCount - 1
380
- }
381
- };
382
- }
383
- getBodyRange() {
384
- return {
385
- start: {
386
- col: this.rowHeaderLevelCount,
387
- row: this.columnHeaderLevelCount
388
- },
389
- end: {
390
- col: this.colCount - 1,
391
- row: this.rowCount - 1
392
- }
393
- };
394
- }
395
- resetCellIds() {}
396
- get headerLevelCount() {
397
- return this.columnHeaderLevelCount;
398
- }
399
- get columnHeaderLevelCount() {
400
- const colLevelCount = this.colShowAttrs.length;
401
- if (this.showColumnHeader) {
402
- return this.indicatorsAsCol && this.hideIndicatorName && this.colShowAttrs[this.colShowAttrs.length - 1] === this.indicatorDimensionKey ? colLevelCount - 1 : colLevelCount;
403
- }
404
- return this.indicatorsAsCol ? this.hideIndicatorName ? 0 : 1 : 0;
405
- }
406
- get rowHeaderLevelCount() {
407
- const rowLevelCount = this.rowShowAttrs.length;
408
- if (this.showRowHeader) {
409
- return this.indicatorsAsCol ? rowLevelCount : this.hideIndicatorName && this.rowShowAttrs[this.rowShowAttrs.length - 1] === this.indicatorDimensionKey ? rowLevelCount - 1 : rowLevelCount;
410
- }
411
- return this.indicatorsAsCol || this.hideIndicatorName ? 0 : 1;
412
- }
413
- get colCount() {
414
- return this._colCount;
415
- }
416
- get rowCount() {
417
- return this._rowCount;
418
- }
419
- get bodyRowCount() {
420
- return this._bodyRowCount;
421
- }
422
- get bottomFrozenRowCount() {
423
- if (!this._table.isPivotChart()) return 0;
424
- const axisOption = this._table.pivotChartAxes.find((axisOption => "bottom" === axisOption.orient));
425
- return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : (this.indicatorsAsCol,
426
- 1);
427
- }
428
- get rightFrozenColCount() {
429
- if (!this._table.isPivotChart()) return 0;
430
- const axisOption = this._table.pivotChartAxes.find((axisOption => "right" === axisOption.orient));
431
- return !1 === (null == axisOption ? void 0 : axisOption.visible) || this.indicatorsAsCol ? 0 : this.hasTwoIndicatorAxes ? 1 : 0;
432
- }
433
- get leftAxesCount() {
434
- if (!this._table.isPivotChart()) return 0;
435
- const axisOption = this._table.pivotChartAxes.find((axisOption => "left" === axisOption.orient));
436
- return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : (this.indicatorsAsCol,
437
- 1);
438
- }
439
- get topAxesCount() {
440
- if (!this._table.isPivotChart()) return 0;
441
- const axisOption = this._table.pivotChartAxes.find((axisOption => "top" === axisOption.orient));
442
- return !1 === (null == axisOption ? void 0 : axisOption.visible) ? 0 : this.indicatorsAsCol && this.hasTwoIndicatorAxes ? 1 : 0;
443
- }
444
- get rightAxesCount() {
445
- return this.rightFrozenColCount;
446
- }
447
- get bottomAxesCount() {
448
- return this.bottomFrozenRowCount;
449
- }
450
- get headerObjects() {
451
- return this._headerObjects;
452
- }
453
- get columnObjects() {
454
- return this._indicatorObjects;
455
- }
456
- getCellId(col, row) {
457
- var _a, _b, _c, _d, _e;
458
- if (col < this.rowHeaderLevelCount && row >= this.rowCount - this.bottomFrozenRowCount || row < this.columnHeaderLevelCount && col >= this.colCount - this.rightFrozenColCount) return 0;
459
- if (row >= 0 && col >= 0) if (this.isCornerHeader(col, row)) {
460
- if ("column" === this.cornerSetting.titleOnDimension) return this.colShowAttrs[row];
461
- if ("row" === this.cornerSetting.titleOnDimension) return this.rowShowAttrs[col];
462
- } else {
463
- if (this.isColumnHeader(col, row)) return row < this.columns.length + (this.columnHeaderTitle ? 1 : 0) ? null !== (_b = null === (_a = this.convertColKeys[row]) || void 0 === _a ? void 0 : _a[this.indicatorsAsCol ? Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length) : col - this.rowHeaderLevelCount]) && void 0 !== _b ? _b : `colHeaderAxis-${col}-${row}` : this.indicatorKeys[(col - this.rowHeaderLevelCount) % this.indicatorKeys.length];
464
- if (this.isRowHeader(col, row)) return col < this.rows.length + (this.rowHeaderTitle ? 1 : 0) ? null !== (_d = null === (_c = this.rowKeysPath[this.indicatorsAsCol ? row - this.columnHeaderLevelCount : Math.floor((row - this.columnHeaderLevelCount) / this.indicatorKeys.length)]) || void 0 === _c ? void 0 : _c[col]) && void 0 !== _d ? _d : `rowHeaderAxis-${col}-${row}` : this.indicatorsAsCol && col === this.rowHeaderLevelCount - 1 ? `rowHeaderAxis-${col}-${row}` : this.indicatorKeys[(row - this.columnHeaderLevelCount) % this.indicatorKeys.length];
465
- if (this.isRightFrozenColumn(col, row)) return this.indicatorsAsCol ? this.rowKeysPath[row - this.columnHeaderLevelCount][this.rowHeaderLevelCount - 1] : this.indicatorKeys[(row - this.columnHeaderLevelCount) % this.indicatorKeys.length];
466
- if (this.isBottomFrozenRow(col, row)) return this.indicatorsAsCol ? this.indicatorKeys[(col - this.rowHeaderLevelCount) % this.indicatorKeys.length] : null === (_e = this.convertColKeys[this.convertColKeys.length - 1]) || void 0 === _e ? void 0 : _e[Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length)];
467
- }
468
- return 0;
469
- }
470
- getIndicatorKey(col, row) {
471
- if (this.isHeader(col, row)) return "";
472
- if (this.indicatorsAsCol) {
473
- const bodyCol = col - this.rowHeaderLevelCount;
474
- return this.indicatorKeys[bodyCol % this.indicatorKeys.length];
475
- }
476
- const bodyRow = row - this.columnHeaderLevelCount;
477
- return this.indicatorKeys[bodyRow % this.indicatorKeys.length];
478
- }
479
- getHeader(col, row) {
480
- var _a;
481
- let id = this.getCellId(col, row);
482
- return (null == id ? void 0 : id.toString().startsWith("rowHeaderAxis")) && (id = "rowHeaderEmpty"),
483
- null !== (_a = this._headerObjectMap[id]) && void 0 !== _a ? _a : EMPTY_HEADER;
484
- }
485
- getHeaderField(col, row) {
486
- var _a, _b;
487
- const id = this.getCellId(col, row);
488
- return (null === (_a = this._headerObjectMap[id]) || void 0 === _a ? void 0 : _a.field) || (null === (_b = this.getBody(col, row)) || void 0 === _b ? void 0 : _b.field);
489
- }
490
- getHeaderFieldKey(col, row) {}
491
- getHeaderCellAdress(id) {}
492
- getHeaderCellAddressByField(field) {
493
- throw new Error(`Method not implemented.${field}`);
494
- }
495
- getBody(_col, _row) {
496
- var _a, _b, _c, _d, _e, _f;
497
- const paths = this.getCellHeaderPaths(_col, _row);
498
- if (this.indicatorsAsCol) {
499
- const indicatorKey = null === (_a = paths.colHeaderPaths.find((colPath => colPath.indicatorKey))) || void 0 === _a ? void 0 : _a.indicatorKey;
500
- return null !== (_c = null !== (_b = this._indicatorObjects.find((indicator => indicator.indicatorKey === indicatorKey))) && void 0 !== _b ? _b : this._indicatorObjects[0]) && void 0 !== _c ? _c : {
501
- id: "",
502
- field: void 0,
503
- indicatorKey: void 0,
504
- cellType: void 0,
505
- define: void 0
506
- };
507
- }
508
- const indicatorKey = null === (_d = paths.rowHeaderPaths.find((rowPath => rowPath.indicatorKey))) || void 0 === _d ? void 0 : _d.indicatorKey;
509
- return null !== (_f = null !== (_e = this._indicatorObjects.find((indicator => indicator.indicatorKey === indicatorKey))) && void 0 !== _e ? _e : this._indicatorObjects[0]) && void 0 !== _f ? _f : {
510
- id: "",
511
- field: void 0,
512
- indicatorKey: void 0,
513
- cellType: void 0,
514
- define: void 0
515
- };
516
- }
517
- getBodyLayoutRangeById(id) {
518
- var _a;
519
- for (let col = 0; col < (null !== (_a = this.colCount) && void 0 !== _a ? _a : 0); col++) if (id === this.columnObjects[col].id) return {
520
- start: {
521
- col: col,
522
- row: 0
523
- },
524
- end: {
525
- col: col,
526
- row: 0
527
- }
528
- };
529
- throw new Error(`can not found body layout @id=${id}`);
530
- }
531
- getCellRange(col, row) {
532
- var _a, _b;
533
- const result = {
534
- start: {
535
- col: col,
536
- row: row
537
- },
538
- end: {
539
- col: col,
540
- row: row
541
- }
542
- };
543
- if (!this.isHeader(col, row) || -1 === col || -1 === row || this.isIndicatorHeader(col, row)) return result;
544
- if (this.isRightFrozenColumn(col, row) || this.isBottomFrozenRow(col, row)) return result;
545
- const id = this.getCellId(col, row);
546
- for (let c = col - 1; c >= 0 && id === this.getCellId(c, row); c--) result.start.col = c;
547
- for (let c = col + 1; c < (null !== (_a = this.colCount) && void 0 !== _a ? _a : 0) && id === this.getCellId(c, row); c++) result.end.col = c;
548
- for (let r = row - 1; r >= 0 && id === this.getCellId(col, r); r--) result.start.row = r;
549
- for (let r = row + 1; r < (null !== (_b = this.rowCount) && void 0 !== _b ? _b : 0) && id === this.getCellId(col, r); r++) result.end.row = r;
550
- return result;
551
- }
552
- isCellRangeEqual(col, row, targetCol, targetRow) {
553
- const range1 = this.getCellRange(col, row), range2 = this.getCellRange(targetCol, targetRow);
554
- return range1.start.col === range2.start.col && range1.end.col === range2.end.col && range1.start.row === range2.start.row && range1.end.row === range2.end.row;
555
- }
556
- getRecordIndexByRow(row) {
557
- return row < this.columnHeaderLevelCount ? -1 : this.indicatorsAsCol ? row - this.columnHeaderLevelCount : Math.floor((row - this.columnHeaderLevelCount) / this.indicatorKeys.length);
558
- }
559
- getRecordIndexByCol(col) {
560
- return col < this.rowHeaderLevelCount ? -1 : this.indicatorsAsCol ? Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length) : col - this.rowHeaderLevelCount;
561
- }
562
- getRecordStartRowByRecordIndex(index) {
563
- return this.columnHeaderLevelCount + index;
564
- }
565
- getCellHeaderPaths(col, row) {
566
- var _a, _b, _c, _d;
567
- const recordCol = this.getRecordIndexByCol(col), recordRow = this.getRecordIndexByRow(row);
568
- let colPath, rowPath, colHeaderPaths, rowHeaderPaths;
569
- return recordCol >= 0 && (colPath = this.colKeysPath[recordCol], colHeaderPaths = null === (_a = null == colPath ? void 0 : colPath[colPath.length - 1]) || void 0 === _a ? void 0 : _a.split(this.dataset.stringJoinChar),
570
- colHeaderPaths && this.showColumnHeader && row < this.columns.length - 1 ? colHeaderPaths = colHeaderPaths.slice(0, row + 1) : colHeaderPaths || (colHeaderPaths = [])),
571
- recordRow >= 0 && (rowPath = this.rowKeysPath[recordRow], rowHeaderPaths = null === (_b = null == rowPath ? void 0 : rowPath[rowPath.length - 1]) || void 0 === _b ? void 0 : _b.split(this.dataset.stringJoinChar),
572
- rowHeaderPaths && this.showRowHeader && col < this.rows.length - 1 ? rowHeaderPaths = rowHeaderPaths.slice(0, col + 1) : rowHeaderPaths || (rowHeaderPaths = [])),
573
- colHeaderPaths && this.indicatorsAsCol && col >= this.rowHeaderLevelCount ? colHeaderPaths.push(this.indicatorKeys[(col - this.rowHeaderLevelCount) % this.indicatorKeys.length]) : rowHeaderPaths && row >= this.columnHeaderLevelCount && rowHeaderPaths.push(this.indicatorKeys[(row - this.columnHeaderLevelCount) % this.indicatorKeys.length]),
574
- {
575
- colHeaderPaths: null !== (_c = null == colHeaderPaths ? void 0 : colHeaderPaths.map(((key, index) => {
576
- const indicatorObject = this._indicatorObjects.find((indicator => indicator.indicatorKey === key));
577
- return {
578
- dimensionKey: indicatorObject ? void 0 : this.colShowAttrs[index],
579
- indicatorKey: indicatorObject ? key : void 0,
580
- value: indicatorObject ? indicatorObject.define.title : key
581
- };
582
- }))) && void 0 !== _c ? _c : [],
583
- rowHeaderPaths: null !== (_d = null == rowHeaderPaths ? void 0 : rowHeaderPaths.map(((key, index) => {
584
- const indicatorObject = this._indicatorObjects.find((indicator => indicator.indicatorKey === key));
585
- return {
586
- dimensionKey: indicatorObject ? void 0 : this.rowShowAttrs[index],
587
- indicatorKey: indicatorObject ? key : void 0,
588
- value: indicatorObject ? indicatorObject.define.title : key
589
- };
590
- }))) && void 0 !== _d ? _d : []
591
- };
592
- }
593
- getCellAdressByHeaderPath(dimensionPaths) {
594
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
595
- let colHeaderPaths, rowHeaderPaths;
596
- if (Array.isArray(dimensionPaths)) {
597
- if (dimensionPaths.length > this.rowShowAttrs.length + this.colShowAttrs.length) return;
598
- colHeaderPaths = dimensionPaths.filter((path => this.colShowAttrs.indexOf(path.dimensionKey) >= 0)),
599
- rowHeaderPaths = dimensionPaths.filter((path => this.rowShowAttrs.indexOf(path.dimensionKey) >= 0));
600
- } else colHeaderPaths = dimensionPaths.colHeaderPaths, rowHeaderPaths = dimensionPaths.rowHeaderPaths;
601
- if (!Array.isArray(colHeaderPaths) && !Array.isArray(rowHeaderPaths)) return;
602
- null == colHeaderPaths || colHeaderPaths.sort(((a, b) => {
603
- var _a, _b;
604
- return this.colShowAttrs.indexOf(null !== (_a = a.dimensionKey) && void 0 !== _a ? _a : this.indicatorDimensionKey) - this.colShowAttrs.indexOf(null !== (_b = b.dimensionKey) && void 0 !== _b ? _b : this.indicatorDimensionKey);
605
- })), null == rowHeaderPaths || rowHeaderPaths.sort(((a, b) => {
606
- var _a, _b;
607
- return this.rowShowAttrs.indexOf(null !== (_a = a.dimensionKey) && void 0 !== _a ? _a : this.indicatorDimensionKey) - this.rowShowAttrs.indexOf(null !== (_b = b.dimensionKey) && void 0 !== _b ? _b : this.indicatorDimensionKey);
608
- }));
609
- let needLowestLevel = !1;
610
- (null == colHeaderPaths ? void 0 : colHeaderPaths.length) >= 1 && (null == rowHeaderPaths ? void 0 : rowHeaderPaths.length) >= 1 && (needLowestLevel = !0);
611
- let toFindIndicator, col = 0, row = 0, rowTree = this.rowTree, columnTree = this.columnTree;
612
- if (colHeaderPaths) for (let i = 0; i < colHeaderPaths.length; i++) {
613
- const colDimension = colHeaderPaths[i];
614
- if (colDimension.indicatorKey) {
615
- toFindIndicator = colDimension.indicatorKey;
616
- break;
617
- }
618
- for (let j = 0; j < columnTree.length; j++) {
619
- const dimension = columnTree[j];
620
- if (!isValid(colDimension.indicatorKey) && dimension.dimensionKey === colDimension.dimensionKey && dimension.value === colDimension.value) {
621
- columnTree = dimension.children, columnTree && 0 !== columnTree.length && !(null === (_a = null == columnTree ? void 0 : columnTree[0]) || void 0 === _a ? void 0 : _a.indicatorKey) || (col += j);
622
- break;
623
- }
624
- col += (null === (_c = null === (_b = dimension.children) || void 0 === _b ? void 0 : _b[0]) || void 0 === _c ? void 0 : _c.indicatorKey) ? 0 : null !== (_e = null === (_d = dimension.children) || void 0 === _d ? void 0 : _d.length) && void 0 !== _e ? _e : 0;
625
- }
626
- }
627
- if (rowHeaderPaths) for (let i = 0; i < rowHeaderPaths.length; i++) {
628
- const rowDimension = rowHeaderPaths[i];
629
- if (rowDimension.indicatorKey) {
630
- toFindIndicator = rowDimension.indicatorKey;
631
- break;
632
- }
633
- for (let j = 0; j < rowTree.length; j++) {
634
- const dimension = rowTree[j];
635
- if (!isValid(rowDimension.indicatorKey) && dimension.dimensionKey === rowDimension.dimensionKey && dimension.value === rowDimension.value) {
636
- rowTree = dimension.children, rowTree && 0 !== rowTree.length && !(null === (_f = null == rowTree ? void 0 : rowTree[0]) || void 0 === _f ? void 0 : _f.indicatorKey) || (row += j);
637
- break;
638
- }
639
- row += (null === (_h = null === (_g = dimension.children) || void 0 === _g ? void 0 : _g[0]) || void 0 === _h ? void 0 : _h.indicatorKey) ? 0 : null !== (_k = null === (_j = dimension.children) || void 0 === _j ? void 0 : _j.length) && void 0 !== _k ? _k : 0;
640
- }
641
- }
642
- return col = (this.indicatorsAsCol ? col * this.indicatorKeys.length + this.indicatorKeys.indexOf(toFindIndicator) : col) + this.rowHeaderLevelCount,
643
- row = (this.indicatorsAsCol ? row : row * this.indicatorKeys.length + this.indicatorKeys.indexOf(toFindIndicator)) + this.columnHeaderLevelCount,
644
- isValid(col) || isValid(row) ? {
645
- col: null != col ? col : undefined,
646
- row: null != row ? row : undefined
647
- } : void 0;
648
- }
649
- getHeaderDimension(col, row) {
650
- var _a, _b, _c;
651
- if (this.isHeader(col, row)) {
652
- const header = this.getHeader(col, row);
653
- return null !== (_b = null === (_a = this.rowsDefine) || void 0 === _a ? void 0 : _a.find((dimension => "string" != typeof dimension && dimension.dimensionKey === header.field))) && void 0 !== _b ? _b : null === (_c = this.columnsDefine) || void 0 === _c ? void 0 : _c.find((dimension => "string" != typeof dimension && dimension.dimensionKey === header.field));
654
- }
655
- }
656
- updateDataset(dataset) {
657
- this.dataset = dataset, this.dataConfig = dataset.dataConfig, this.rowKeysPath = dataset.rowKeysPath,
658
- this.colKeysPath = dataset.colKeysPath, this.tree = dataset.tree, this._indicatorObjects = [],
659
- this._headerObjects = [], this._headerObjectMap = {}, this.initState(), this.convertColKeys = transpose(this.colKeysPath);
660
- }
661
- isHeaderForColWidth(col, row) {
662
- return this.isHeader(col, row);
663
- }
664
- getHeaderForColWidth(col, row) {
665
- return this.getHeader(col, row);
666
- }
667
- setChartInstance(_col, _row, chartInstance) {
668
- var _a, _b;
669
- const paths = this.getCellHeaderPaths(_col, _row);
670
- let indicatorObj;
671
- if (this.indicatorsAsCol) {
672
- const indicatorKey = null === (_a = paths.colHeaderPaths.find((colPath => colPath.indicatorKey))) || void 0 === _a ? void 0 : _a.indicatorKey;
673
- indicatorObj = this._indicatorObjects.find((indicator => indicator.indicatorKey === indicatorKey));
674
- } else {
675
- const indicatorKey = null === (_b = paths.rowHeaderPaths.find((rowPath => rowPath.indicatorKey))) || void 0 === _b ? void 0 : _b.indicatorKey;
676
- indicatorObj = this._indicatorObjects.find((indicator => indicator.indicatorKey === indicatorKey));
677
- }
678
- indicatorObj && (indicatorObj.chartInstance = chartInstance);
679
- }
680
- getChartInstance(_col, _row) {
681
- var _a, _b;
682
- const paths = this.getCellHeaderPaths(_col, _row);
683
- let indicatorObj;
684
- if (this.indicatorsAsCol) {
685
- const indicatorKey = null === (_a = paths.colHeaderPaths.find((colPath => colPath.indicatorKey))) || void 0 === _a ? void 0 : _a.indicatorKey;
686
- indicatorObj = this._indicatorObjects.find((indicator => indicator.indicatorKey === indicatorKey));
687
- } else {
688
- const indicatorKey = null === (_b = paths.rowHeaderPaths.find((rowPath => rowPath.indicatorKey))) || void 0 === _b ? void 0 : _b.indicatorKey;
689
- indicatorObj = this._indicatorObjects.find((indicator => indicator.indicatorKey === indicatorKey));
690
- }
691
- return null == indicatorObj ? void 0 : indicatorObj.chartInstance;
692
- }
693
- _generateChartState() {
694
- return {
695
- vtable_selected: {
696
- filter: datum => {
697
- var _a;
698
- if (this._table._selectedDataItemsInChart.length >= 1) {
699
- return !!this._table._selectedDataItemsInChart.find((item => {
700
- for (const itemKey in item) if (item[itemKey] !== datum[itemKey]) return !1;
701
- return !0;
702
- }));
703
- }
704
- if (null === (_a = this._table._selectedDimensionInChart) || void 0 === _a ? void 0 : _a.length) {
705
- return !!this._table._selectedDimensionInChart.every((item => datum[item.key] === item.value));
706
- }
707
- return !1;
708
- }
709
- },
710
- vtable_selected_reverse: {
711
- filter: datum => {
712
- var _a;
713
- if (this._table._selectedDataItemsInChart.length >= 1) {
714
- return !this._table._selectedDataItemsInChart.find((item => {
715
- for (const itemKey in item) if (item[itemKey] !== datum[itemKey]) return !1;
716
- return !0;
717
- }));
718
- }
719
- if (null === (_a = this._table._selectedDimensionInChart) || void 0 === _a ? void 0 : _a.length) {
720
- return !this._table._selectedDimensionInChart.every((item => datum[item.key] === item.value));
721
- }
722
- return !1;
723
- }
724
- }
725
- };
726
- }
727
- updateDataStateToChartInstance(activeChartInstance) {
728
- activeChartInstance || (activeChartInstance = this._table._getActiveChartInstance());
729
- const state = this._generateChartState();
730
- this._indicatorObjects.forEach((_indicatorObject => {
731
- _indicatorObject.chartInstance.updateState(state);
732
- })), null == activeChartInstance || activeChartInstance.updateState(state);
733
- }
734
- updateDataStateToActiveChartInstance(activeChartInstance) {
735
- activeChartInstance || (activeChartInstance = this._table._getActiveChartInstance());
736
- const state = this._generateChartState();
737
- null == activeChartInstance || activeChartInstance.updateState(state);
738
- }
739
- getOptimunWidthForChart(col) {
740
- var _a, _b, _c, _d;
741
- const path = this.getCellHeaderPaths(col, this.columnHeaderLevelCount).colHeaderPaths;
742
- let collectedValues, width;
743
- for (const key in this.dataset.collectValuesBy) if ("xField" === this.dataset.collectValuesBy[key].type && !this.dataset.collectValuesBy[key].range) {
744
- collectedValues = this.dataset.collectedValues[key][path.map((pathObj => pathObj.value)).join(this.dataset.stringJoinChar)];
745
- break;
746
- }
747
- if (this._chartItemBandSize) width = scaleWholeRangeSize(null !== (_a = null == collectedValues ? void 0 : collectedValues.length) && void 0 !== _a ? _a : 0, this._chartItemBandSize, this._chartPaddingInner, this._chartPaddingOuter); else {
748
- const barWidth = this._chartItemSpanSize || 25;
749
- width = (null !== (_b = null == collectedValues ? void 0 : collectedValues.length) && void 0 !== _b ? _b : 0) * (barWidth + barWidth / 3);
750
- }
751
- const padding = getQuadProps(null !== (_d = null !== (_c = this._chartPadding) && void 0 !== _c ? _c : this._table.theme.bodyStyle.padding) && void 0 !== _d ? _d : 0);
752
- return width + padding[1] + padding[3];
753
- }
754
- getOptimunHeightForChart(row) {
755
- var _a, _b, _c, _d;
756
- const path = this.getCellHeaderPaths(this.rowHeaderLevelCount, row).rowHeaderPaths;
757
- let collectedValues, height;
758
- for (const key in this.dataset.collectValuesBy) if ("yField" === this.dataset.collectValuesBy[key].type && !this.dataset.collectValuesBy[key].range) {
759
- collectedValues = this.dataset.collectedValues[key][path.map((pathObj => pathObj.value)).join(this.dataset.stringJoinChar)];
760
- break;
761
- }
762
- if (this._chartItemBandSize) height = scaleWholeRangeSize(null !== (_a = null == collectedValues ? void 0 : collectedValues.length) && void 0 !== _a ? _a : 0, this._chartItemBandSize, this._chartPaddingInner, this._chartPaddingOuter); else {
763
- const barWidth = this._chartItemSpanSize || 25;
764
- height = (null !== (_b = null == collectedValues ? void 0 : collectedValues.length) && void 0 !== _b ? _b : 0) * (barWidth + barWidth / 3);
765
- }
766
- const padding = getQuadProps(null !== (_d = null !== (_c = this._chartPadding) && void 0 !== _c ? _c : this._table.theme.bodyStyle.padding) && void 0 !== _d ? _d : 0);
767
- return height + padding[0] + padding[2];
768
- }
769
- getIndicatorKeyInChartSpec(_col, _row) {
770
- const chartSpec = this.getRawChartSpec(_col, _row), indicatorKeys = [];
771
- return chartSpec ? (!1 === this.indicatorsAsCol ? chartSpec.series ? chartSpec.series.forEach((chartSeries => {
772
- const yField = chartSeries.yField;
773
- indicatorKeys.push(yField);
774
- })) : indicatorKeys.push(chartSpec.yField) : chartSpec.series ? chartSpec.series.forEach((chartSeries => {
775
- const xField = chartSeries.xField;
776
- indicatorKeys.push(xField);
777
- })) : indicatorKeys.push(chartSpec.xField), indicatorKeys) : null;
778
- }
779
- getDimensionKeyInChartSpec(_col, _row) {
780
- var _a, _b, _c, _d;
781
- const chartSpec = this.getRawChartSpec(_col, _row), dimensionKeys = [];
782
- return chartSpec ? (!1 === this.indicatorsAsCol ? dimensionKeys.push(null !== (_a = chartSpec.xField) && void 0 !== _a ? _a : null === (_b = null == chartSpec ? void 0 : chartSpec.series[0]) || void 0 === _b ? void 0 : _b.xField) : dimensionKeys.push(null !== (_c = chartSpec.yField) && void 0 !== _c ? _c : null === (_d = null == chartSpec ? void 0 : chartSpec.series[0]) || void 0 === _d ? void 0 : _d.yField),
783
- dimensionKeys) : null;
784
- }
785
- getAxisConfigInPivotChart(col, row) {
786
- return getAxisConfigInPivotChart(col, row, this);
787
- }
788
- getRawChartSpec(col, row) {
789
- return getRawChartSpec(col, row, this);
790
- }
791
- getChartSpec(col, row) {
792
- return getChartSpec(col, row, this);
793
- }
794
- getChartAxes(col, row) {
795
- return getChartAxes(col, row, this);
796
- }
797
- getChartDataId(col, row) {
798
- return getChartDataId(col, row, this);
799
- }
800
- isEmpty(col, row) {
801
- return !!this._table.isPivotChart() && (col > this.colCount - this.rightFrozenColCount - 1 || row > this.rowCount - this.bottomFrozenRowCount - 1 || !(!this.hasTwoIndicatorAxes || !this.indicatorsAsCol || row !== this.columnHeaderLevelCount - 1));
802
- }
803
- release() {
804
- const activeChartInstance = this._table._getActiveChartInstance();
805
- null == activeChartInstance || activeChartInstance.release(), this._indicatorObjects.forEach((indicatorObject => {
806
- var _a;
807
- null === (_a = indicatorObject.chartInstance) || void 0 === _a || _a.release();
808
- }));
809
- }
810
- clearCellRangeMap() {}
811
- }
812
-
813
- function scaleWholeRangeSize(count, bandwidth, paddingInner, paddingOuter) {
814
- 1 === paddingInner && (paddingInner = 0);
815
- return bandSpace(count, paddingInner, paddingOuter) * (bandwidth / (1 - paddingInner));
816
- }
817
-
818
- function bandSpace(count, paddingInner, paddingOuter) {
819
- let space;
820
- return space = 1 === count ? count + 2 * paddingOuter : count - paddingInner + 2 * paddingOuter,
821
- count ? space > 0 ? space : 1 : 0;
822
- }
823
- //# sourceMappingURL=pivot-layout.js.map
1
+ //# sourceMappingURL=pivot-layout.js.map