@visactor/vtable 0.11.1-alpha.8 → 0.12.0-alpha.0

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