@visactor/vtable 0.9.2-alpha.0 → 0.9.2-alpha.2

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 (533) hide show
  1. package/cjs/ListTable.d.ts +2 -1
  2. package/cjs/ListTable.js +17 -13
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +68 -0
  5. package/cjs/PivotChart.js +427 -0
  6. package/cjs/PivotChart.js.map +1 -0
  7. package/cjs/PivotTable.d.ts +2 -1
  8. package/cjs/PivotTable.js +18 -13
  9. package/cjs/PivotTable.js.map +1 -1
  10. package/cjs/body-helper/style/MultilineTextStyle.js +2 -2
  11. package/cjs/body-helper/style/MultilineTextStyle.js.map +1 -1
  12. package/cjs/body-helper/style/ProgressBarStyle.js +15 -15
  13. package/cjs/body-helper/style/ProgressBarStyle.js.map +1 -1
  14. package/cjs/body-helper/style/Style.d.ts +0 -1
  15. package/cjs/body-helper/style/Style.js +25 -28
  16. package/cjs/body-helper/style/Style.js.map +1 -1
  17. package/cjs/components/axis/axis.d.ts +45 -0
  18. package/cjs/components/axis/axis.js +146 -0
  19. package/cjs/components/axis/axis.js.map +1 -0
  20. package/cjs/components/axis/band-scale.d.ts +18 -0
  21. package/cjs/components/axis/band-scale.js +54 -0
  22. package/cjs/components/axis/band-scale.js.map +1 -0
  23. package/cjs/components/axis/get-axis-attributes.d.ts +136 -0
  24. package/cjs/components/axis/get-axis-attributes.js +169 -0
  25. package/cjs/components/axis/get-axis-attributes.js.map +1 -0
  26. package/cjs/components/axis/label-overlap.d.ts +3 -0
  27. package/cjs/components/axis/label-overlap.js +46 -0
  28. package/cjs/components/axis/label-overlap.js.map +1 -0
  29. package/cjs/components/axis/linear-scale.d.ts +45 -0
  30. package/cjs/components/axis/linear-scale.js +120 -0
  31. package/cjs/components/axis/linear-scale.js.map +1 -0
  32. package/cjs/components/legend/get-legend-attributes.d.ts +5 -0
  33. package/cjs/components/legend/get-legend-attributes.js +90 -0
  34. package/cjs/components/legend/get-legend-attributes.js.map +1 -0
  35. package/cjs/components/legend/legend.d.ts +23 -0
  36. package/cjs/components/legend/legend.js +94 -0
  37. package/cjs/components/legend/legend.js.map +1 -0
  38. package/cjs/{menu → components/menu}/dom/BaseMenu.d.ts +2 -2
  39. package/cjs/components/menu/dom/BaseMenu.js.map +1 -0
  40. package/cjs/components/menu/dom/Menu.js.map +1 -0
  41. package/{es → cjs/components}/menu/dom/MenuHandler.d.ts +2 -2
  42. package/cjs/{menu → components/menu}/dom/MenuHandler.js +1 -1
  43. package/cjs/components/menu/dom/MenuHandler.js.map +1 -0
  44. package/cjs/{menu → components/menu}/dom/logic/MenuContainer.d.ts +2 -2
  45. package/cjs/{menu → components/menu}/dom/logic/MenuContainer.js +2 -2
  46. package/cjs/components/menu/dom/logic/MenuContainer.js.map +1 -0
  47. package/cjs/{menu → components/menu}/dom/logic/MenuElement.d.ts +2 -2
  48. package/cjs/{menu → components/menu}/dom/logic/MenuElement.js +4 -4
  49. package/cjs/components/menu/dom/logic/MenuElement.js.map +1 -0
  50. package/cjs/components/menu/dom/logic/MenuElementStyle.js.map +1 -0
  51. package/cjs/components/title/title.d.ts +12 -0
  52. package/cjs/components/title/title.js +66 -0
  53. package/cjs/components/title/title.js.map +1 -0
  54. package/cjs/{tooltip → components/tooltip}/BaseTooltip.d.ts +3 -3
  55. package/cjs/components/tooltip/BaseTooltip.js.map +1 -0
  56. package/cjs/components/tooltip/Tooltip.js.map +1 -0
  57. package/{es → cjs/components}/tooltip/TooltipHandler.d.ts +4 -4
  58. package/cjs/{tooltip → components/tooltip}/TooltipHandler.js +1 -1
  59. package/cjs/components/tooltip/TooltipHandler.js.map +1 -0
  60. package/cjs/{tooltip → components/tooltip}/logic/BubbleTooltipElement.d.ts +4 -4
  61. package/cjs/{tooltip → components/tooltip}/logic/BubbleTooltipElement.js +1 -1
  62. package/cjs/components/tooltip/logic/BubbleTooltipElement.js.map +1 -0
  63. package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -0
  64. package/cjs/components/util/orient.d.ts +3 -0
  65. package/cjs/components/util/orient.js +14 -0
  66. package/cjs/components/util/orient.js.map +1 -0
  67. package/cjs/components/util/register.d.ts +3 -0
  68. package/cjs/components/util/register.js +15 -0
  69. package/cjs/components/util/register.js.map +1 -0
  70. package/cjs/components/util/tick-data/config.d.ts +1 -0
  71. package/cjs/components/util/tick-data/config.js +6 -0
  72. package/cjs/components/util/tick-data/config.js.map +1 -0
  73. package/cjs/components/util/tick-data/continuous.d.ts +2 -0
  74. package/cjs/components/util/tick-data/continuous.js +39 -0
  75. package/cjs/components/util/tick-data/continuous.js.map +1 -0
  76. package/cjs/components/util/tick-data/discrete/linear.d.ts +2 -0
  77. package/cjs/components/util/tick-data/discrete/linear.js +66 -0
  78. package/cjs/components/util/tick-data/discrete/linear.js.map +1 -0
  79. package/cjs/components/util/tick-data/discrete/polar-angle.d.ts +2 -0
  80. package/cjs/components/util/tick-data/discrete/polar-angle.js +46 -0
  81. package/cjs/components/util/tick-data/discrete/polar-angle.js.map +1 -0
  82. package/cjs/components/util/tick-data/index.d.ts +2 -0
  83. package/cjs/components/util/tick-data/index.js +17 -0
  84. package/cjs/components/util/tick-data/index.js.map +1 -0
  85. package/cjs/components/util/tick-data/util.d.ts +21 -0
  86. package/cjs/components/util/tick-data/util.js +115 -0
  87. package/cjs/components/util/tick-data/util.js.map +1 -0
  88. package/cjs/components/util/transform.d.ts +5 -0
  89. package/cjs/components/util/transform.js +45 -0
  90. package/cjs/components/util/transform.js.map +1 -0
  91. package/cjs/core/BaseTable.d.ts +18 -5
  92. package/cjs/core/BaseTable.js +99 -39
  93. package/cjs/core/BaseTable.js.map +1 -1
  94. package/cjs/core/TABLE_EVENT_TYPE.d.ts +3 -0
  95. package/cjs/core/TABLE_EVENT_TYPE.js +4 -1
  96. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  97. package/cjs/core/style.js +1 -1
  98. package/cjs/core/style.js.map +1 -1
  99. package/cjs/core/tableHelper.js +1 -2
  100. package/cjs/data/CachedDataSource.js +2 -1
  101. package/cjs/data/DataSource.js +2 -2
  102. package/cjs/data/DataSource.js.map +1 -1
  103. package/cjs/dataset/dataset.d.ts +12 -19
  104. package/cjs/dataset/dataset.js +168 -196
  105. package/cjs/dataset/dataset.js.map +1 -1
  106. package/cjs/dataset/statistics-helper.d.ts +68 -0
  107. package/cjs/dataset/statistics-helper.js +173 -0
  108. package/cjs/dataset/statistics-helper.js.map +1 -0
  109. package/cjs/dataset/util/zero-align.d.ts +10 -0
  110. package/cjs/dataset/util/zero-align.js +119 -0
  111. package/cjs/dataset/util/zero-align.js.map +1 -0
  112. package/cjs/event/EventHandler.js.map +1 -1
  113. package/cjs/event/EventTarget.d.ts +5 -5
  114. package/cjs/event/EventTarget.js +2 -2
  115. package/cjs/event/EventTarget.js.map +1 -1
  116. package/cjs/event/VChartEventProxy.d.ts +1 -0
  117. package/cjs/event/VChartEventProxy.js +1 -0
  118. package/cjs/event/VChartEventProxy.js.map +1 -0
  119. package/cjs/event/event.js +7 -4
  120. package/cjs/event/event.js.map +1 -1
  121. package/cjs/event/listener/table-group.js +8 -6
  122. package/cjs/event/listener/table-group.js.map +1 -1
  123. package/cjs/event/pivot-chart/axis-click.d.ts +2 -0
  124. package/cjs/event/pivot-chart/axis-click.js +42 -0
  125. package/cjs/event/pivot-chart/axis-click.js.map +1 -0
  126. package/cjs/event/sparkline-event.js.map +1 -1
  127. package/cjs/event/util.js +0 -1
  128. package/cjs/header-helper/header-helper.js +1 -1
  129. package/cjs/header-helper/header-helper.js.map +1 -1
  130. package/cjs/header-helper/style/MultilineTextHeaderStyle.js +2 -2
  131. package/cjs/header-helper/style/MultilineTextHeaderStyle.js.map +1 -1
  132. package/cjs/header-helper/style/Style.d.ts +0 -1
  133. package/cjs/header-helper/style/Style.js +25 -28
  134. package/cjs/header-helper/style/Style.js.map +1 -1
  135. package/cjs/index.d.ts +4 -3
  136. package/cjs/index.js +11 -2
  137. package/cjs/index.js.map +1 -1
  138. package/cjs/layout/index.js +2 -1
  139. package/cjs/layout/pivot-chart/get-axis-config.d.ts +2 -0
  140. package/cjs/layout/pivot-chart/get-axis-config.js +118 -0
  141. package/cjs/layout/pivot-chart/get-axis-config.js.map +1 -0
  142. package/cjs/layout/pivot-chart/get-chart-spec.d.ts +4 -0
  143. package/cjs/layout/pivot-chart/get-chart-spec.js +118 -0
  144. package/cjs/layout/pivot-chart/get-chart-spec.js.map +1 -0
  145. package/cjs/layout/pivot-header-layout.d.ts +11 -5
  146. package/cjs/layout/pivot-header-layout.js +42 -12
  147. package/cjs/layout/pivot-header-layout.js.map +1 -1
  148. package/cjs/layout/pivot-layout.d.ts +53 -8
  149. package/cjs/layout/pivot-layout.js +393 -89
  150. package/cjs/layout/pivot-layout.js.map +1 -1
  151. package/cjs/layout/simple-header-layout.d.ts +8 -0
  152. package/cjs/layout/simple-header-layout.js +34 -0
  153. package/cjs/layout/simple-header-layout.js.map +1 -1
  154. package/cjs/scenegraph/component/table-component.js +3 -3
  155. package/cjs/scenegraph/component/table-component.js.map +1 -1
  156. package/cjs/scenegraph/graphic/chart.d.ts +3 -0
  157. package/cjs/scenegraph/graphic/chart.js +21 -6
  158. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  159. package/cjs/scenegraph/graphic/contributions/chart-render.js +15 -3
  160. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  161. package/cjs/scenegraph/group-creater/cell-helper.js +8 -3
  162. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  163. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  164. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  165. package/cjs/scenegraph/group-creater/column.js.map +1 -1
  166. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.d.ts +3 -0
  167. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +71 -0
  168. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -0
  169. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -1
  170. package/cjs/scenegraph/group-creater/progress/proxy.js +29 -35
  171. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  172. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +10 -9
  173. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  174. package/cjs/scenegraph/layout/compute-col-width.js +23 -15
  175. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  176. package/cjs/scenegraph/layout/compute-row-height.js +20 -9
  177. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  178. package/cjs/scenegraph/layout/move-cell.js +1 -1
  179. package/cjs/scenegraph/layout/move-cell.js.map +1 -1
  180. package/cjs/scenegraph/layout/update-cell.js +3 -2
  181. package/cjs/scenegraph/layout/update-cell.js.map +1 -1
  182. package/cjs/scenegraph/layout/update-height.js +1 -1
  183. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  184. package/cjs/scenegraph/layout/update-row.js +1 -1
  185. package/cjs/scenegraph/layout/update-row.js.map +1 -1
  186. package/cjs/scenegraph/layout/update-width.js +1 -1
  187. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  188. package/cjs/scenegraph/refresh-node/update-chart.d.ts +3 -0
  189. package/cjs/scenegraph/refresh-node/update-chart.js +48 -5
  190. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  191. package/cjs/scenegraph/scenegraph.d.ts +9 -0
  192. package/cjs/scenegraph/scenegraph.js +144 -18
  193. package/cjs/scenegraph/scenegraph.js.map +1 -1
  194. package/cjs/scenegraph/stick-text/index.js +10 -8
  195. package/cjs/scenegraph/stick-text/index.js.map +1 -1
  196. package/cjs/scenegraph/style/frame-border.js +1 -5
  197. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  198. package/cjs/state/state.js +1 -1
  199. package/cjs/state/state.js.map +1 -1
  200. package/cjs/themes/DEFAULT.js +1 -2
  201. package/cjs/tools/LimitPromiseQueue.js +2 -1
  202. package/cjs/tools/calc.d.ts +3 -0
  203. package/cjs/tools/calc.js +11 -3
  204. package/cjs/tools/calc.js.map +1 -1
  205. package/cjs/tools/diff-cell.js +2 -2
  206. package/cjs/tools/dom.js +1 -1
  207. package/cjs/tools/env.js +1 -1
  208. package/cjs/ts-types/base-table.d.ts +29 -12
  209. package/cjs/ts-types/base-table.js.map +1 -1
  210. package/cjs/ts-types/column/style.d.ts +0 -1
  211. package/cjs/ts-types/column/style.js.map +1 -1
  212. package/cjs/ts-types/component/axis.d.ts +12 -0
  213. package/cjs/ts-types/component/axis.js +6 -0
  214. package/cjs/ts-types/component/axis.js.map +1 -0
  215. package/cjs/ts-types/component/legend.d.ts +5 -0
  216. package/cjs/ts-types/component/legend.js +6 -0
  217. package/cjs/ts-types/component/legend.js.map +1 -0
  218. package/cjs/ts-types/component/title.d.ts +47 -0
  219. package/cjs/ts-types/component/title.js +6 -0
  220. package/cjs/ts-types/component/title.js.map +1 -0
  221. package/cjs/ts-types/component/util.d.ts +1 -0
  222. package/cjs/ts-types/component/util.js +6 -0
  223. package/cjs/ts-types/component/util.js.map +1 -0
  224. package/cjs/ts-types/events.d.ts +100 -83
  225. package/cjs/ts-types/events.js.map +1 -1
  226. package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -0
  227. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  228. package/cjs/ts-types/new-data-set.d.ts +18 -5
  229. package/cjs/ts-types/new-data-set.js +2 -2
  230. package/cjs/ts-types/new-data-set.js.map +1 -1
  231. package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.d.ts +4 -0
  232. package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js +3 -1
  233. package/cjs/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js.map +1 -1
  234. package/cjs/ts-types/pivot-table/corner.d.ts +3 -3
  235. package/cjs/ts-types/pivot-table/corner.js.map +1 -1
  236. package/cjs/ts-types/pivot-table/indicator/index.d.ts +1 -0
  237. package/cjs/ts-types/pivot-table/indicator/index.js.map +1 -1
  238. package/cjs/ts-types/pivot-table/title.d.ts +1 -1
  239. package/cjs/ts-types/pivot-table/title.js.map +1 -1
  240. package/cjs/ts-types/table-engine.d.ts +27 -3
  241. package/cjs/ts-types/table-engine.js.map +1 -1
  242. package/dist/vtable.js +22782 -11928
  243. package/dist/vtable.min.js +4 -2
  244. package/es/ListTable.d.ts +2 -1
  245. package/es/ListTable.js +17 -13
  246. package/es/ListTable.js.map +1 -1
  247. package/es/PivotChart.d.ts +68 -0
  248. package/es/PivotChart.js +437 -0
  249. package/es/PivotChart.js.map +1 -0
  250. package/es/PivotTable.d.ts +2 -1
  251. package/es/PivotTable.js +19 -14
  252. package/es/PivotTable.js.map +1 -1
  253. package/es/body-helper/style/MultilineTextStyle.js +2 -2
  254. package/es/body-helper/style/MultilineTextStyle.js.map +1 -1
  255. package/es/body-helper/style/ProgressBarStyle.js +15 -15
  256. package/es/body-helper/style/ProgressBarStyle.js.map +1 -1
  257. package/es/body-helper/style/Style.d.ts +0 -1
  258. package/es/body-helper/style/Style.js +25 -28
  259. package/es/body-helper/style/Style.js.map +1 -1
  260. package/es/components/axis/axis.d.ts +45 -0
  261. package/es/components/axis/axis.js +155 -0
  262. package/es/components/axis/axis.js.map +1 -0
  263. package/es/components/axis/band-scale.d.ts +18 -0
  264. package/es/components/axis/band-scale.js +46 -0
  265. package/es/components/axis/band-scale.js.map +1 -0
  266. package/es/components/axis/get-axis-attributes.d.ts +136 -0
  267. package/es/components/axis/get-axis-attributes.js +166 -0
  268. package/es/components/axis/get-axis-attributes.js.map +1 -0
  269. package/es/components/axis/label-overlap.d.ts +3 -0
  270. package/es/components/axis/label-overlap.js +39 -0
  271. package/es/components/axis/label-overlap.js.map +1 -0
  272. package/es/components/axis/linear-scale.d.ts +45 -0
  273. package/es/components/axis/linear-scale.js +104 -0
  274. package/es/components/axis/linear-scale.js.map +1 -0
  275. package/es/components/legend/get-legend-attributes.d.ts +5 -0
  276. package/es/components/legend/get-legend-attributes.js +84 -0
  277. package/es/components/legend/get-legend-attributes.js.map +1 -0
  278. package/es/components/legend/legend.d.ts +23 -0
  279. package/es/components/legend/legend.js +93 -0
  280. package/es/components/legend/legend.js.map +1 -0
  281. package/es/{menu → components/menu}/dom/BaseMenu.d.ts +2 -2
  282. package/es/components/menu/dom/BaseMenu.js.map +1 -0
  283. package/es/components/menu/dom/Menu.js.map +1 -0
  284. package/{cjs → es/components}/menu/dom/MenuHandler.d.ts +2 -2
  285. package/es/{menu → components/menu}/dom/MenuHandler.js +2 -2
  286. package/es/components/menu/dom/MenuHandler.js.map +1 -0
  287. package/es/{menu → components/menu}/dom/logic/MenuContainer.d.ts +2 -2
  288. package/es/{menu → components/menu}/dom/logic/MenuContainer.js +4 -4
  289. package/es/components/menu/dom/logic/MenuContainer.js.map +1 -0
  290. package/es/{menu → components/menu}/dom/logic/MenuElement.d.ts +2 -2
  291. package/es/{menu → components/menu}/dom/logic/MenuElement.js +9 -9
  292. package/es/components/menu/dom/logic/MenuElement.js.map +1 -0
  293. package/es/components/menu/dom/logic/MenuElementStyle.js.map +1 -0
  294. package/es/components/title/title.d.ts +12 -0
  295. package/es/components/title/title.js +61 -0
  296. package/es/components/title/title.js.map +1 -0
  297. package/es/{tooltip → components/tooltip}/BaseTooltip.d.ts +3 -3
  298. package/es/components/tooltip/BaseTooltip.js.map +1 -0
  299. package/es/components/tooltip/Tooltip.js.map +1 -0
  300. package/{cjs → es/components}/tooltip/TooltipHandler.d.ts +4 -4
  301. package/es/{tooltip → components/tooltip}/TooltipHandler.js +4 -4
  302. package/es/components/tooltip/TooltipHandler.js.map +1 -0
  303. package/es/{tooltip → components/tooltip}/logic/BubbleTooltipElement.d.ts +4 -4
  304. package/es/{tooltip → components/tooltip}/logic/BubbleTooltipElement.js +4 -4
  305. package/es/components/tooltip/logic/BubbleTooltipElement.js.map +1 -0
  306. package/es/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -0
  307. package/es/components/util/orient.d.ts +3 -0
  308. package/es/components/util/orient.js +8 -0
  309. package/es/components/util/orient.js.map +1 -0
  310. package/es/components/util/register.d.ts +3 -0
  311. package/es/components/util/register.js +8 -0
  312. package/es/components/util/register.js.map +1 -0
  313. package/es/components/util/tick-data/config.d.ts +1 -0
  314. package/es/components/util/tick-data/config.js +2 -0
  315. package/es/components/util/tick-data/config.js.map +1 -0
  316. package/es/components/util/tick-data/continuous.d.ts +2 -0
  317. package/es/components/util/tick-data/continuous.js +38 -0
  318. package/es/components/util/tick-data/continuous.js.map +1 -0
  319. package/es/components/util/tick-data/discrete/linear.d.ts +2 -0
  320. package/es/components/util/tick-data/discrete/linear.js +59 -0
  321. package/es/components/util/tick-data/discrete/linear.js.map +1 -0
  322. package/es/components/util/tick-data/discrete/polar-angle.d.ts +2 -0
  323. package/es/components/util/tick-data/discrete/polar-angle.js +39 -0
  324. package/es/components/util/tick-data/discrete/polar-angle.js.map +1 -0
  325. package/es/components/util/tick-data/index.d.ts +2 -0
  326. package/es/components/util/tick-data/index.js +19 -0
  327. package/es/components/util/tick-data/index.js.map +1 -0
  328. package/es/components/util/tick-data/util.d.ts +21 -0
  329. package/es/components/util/tick-data/util.js +104 -0
  330. package/es/components/util/tick-data/util.js.map +1 -0
  331. package/es/components/util/transform.d.ts +5 -0
  332. package/es/components/util/transform.js +34 -0
  333. package/es/components/util/transform.js.map +1 -0
  334. package/es/core/BaseTable.d.ts +18 -5
  335. package/es/core/BaseTable.js +103 -41
  336. package/es/core/BaseTable.js.map +1 -1
  337. package/es/core/TABLE_EVENT_TYPE.d.ts +3 -0
  338. package/es/core/TABLE_EVENT_TYPE.js +4 -1
  339. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  340. package/es/core/style.js +1 -1
  341. package/es/core/style.js.map +1 -1
  342. package/es/core/tableHelper.js +1 -2
  343. package/es/data/CachedDataSource.js +2 -1
  344. package/es/data/DataSource.js +2 -2
  345. package/es/data/DataSource.js.map +1 -1
  346. package/es/dataset/dataset.d.ts +12 -19
  347. package/es/dataset/dataset.js +161 -187
  348. package/es/dataset/dataset.js.map +1 -1
  349. package/es/dataset/statistics-helper.d.ts +68 -0
  350. package/es/dataset/statistics-helper.js +152 -0
  351. package/es/dataset/statistics-helper.js.map +1 -0
  352. package/es/dataset/util/zero-align.d.ts +10 -0
  353. package/es/dataset/util/zero-align.js +111 -0
  354. package/es/dataset/util/zero-align.js.map +1 -0
  355. package/es/event/EventHandler.js.map +1 -1
  356. package/es/event/EventTarget.d.ts +5 -5
  357. package/es/event/EventTarget.js +2 -2
  358. package/es/event/EventTarget.js.map +1 -1
  359. package/es/event/VChartEventProxy.d.ts +1 -0
  360. package/es/event/VChartEventProxy.js +1 -0
  361. package/es/event/VChartEventProxy.js.map +1 -0
  362. package/es/event/event.js +8 -3
  363. package/es/event/event.js.map +1 -1
  364. package/es/event/listener/table-group.js +8 -6
  365. package/es/event/listener/table-group.js.map +1 -1
  366. package/es/event/pivot-chart/axis-click.d.ts +2 -0
  367. package/es/event/pivot-chart/axis-click.js +36 -0
  368. package/es/event/pivot-chart/axis-click.js.map +1 -0
  369. package/es/event/sparkline-event.js.map +1 -1
  370. package/es/event/util.js +1 -2
  371. package/es/header-helper/header-helper.js +1 -1
  372. package/es/header-helper/header-helper.js.map +1 -1
  373. package/es/header-helper/style/MultilineTextHeaderStyle.js +2 -2
  374. package/es/header-helper/style/MultilineTextHeaderStyle.js.map +1 -1
  375. package/es/header-helper/style/Style.d.ts +0 -1
  376. package/es/header-helper/style/Style.js +25 -28
  377. package/es/header-helper/style/Style.js.map +1 -1
  378. package/es/index.d.ts +4 -3
  379. package/es/index.js +4 -2
  380. package/es/index.js.map +1 -1
  381. package/es/layout/index.js +2 -1
  382. package/es/layout/pivot-chart/get-axis-config.d.ts +2 -0
  383. package/es/layout/pivot-chart/get-axis-config.js +110 -0
  384. package/es/layout/pivot-chart/get-axis-config.js.map +1 -0
  385. package/es/layout/pivot-chart/get-chart-spec.d.ts +4 -0
  386. package/es/layout/pivot-chart/get-chart-spec.js +109 -0
  387. package/es/layout/pivot-chart/get-chart-spec.js.map +1 -0
  388. package/es/layout/pivot-header-layout.d.ts +11 -5
  389. package/es/layout/pivot-header-layout.js +41 -11
  390. package/es/layout/pivot-header-layout.js.map +1 -1
  391. package/es/layout/pivot-layout.d.ts +53 -8
  392. package/es/layout/pivot-layout.js +396 -87
  393. package/es/layout/pivot-layout.js.map +1 -1
  394. package/es/layout/simple-header-layout.d.ts +8 -0
  395. package/es/layout/simple-header-layout.js +34 -0
  396. package/es/layout/simple-header-layout.js.map +1 -1
  397. package/es/scenegraph/component/table-component.js +3 -3
  398. package/es/scenegraph/component/table-component.js.map +1 -1
  399. package/es/scenegraph/graphic/chart.d.ts +3 -0
  400. package/es/scenegraph/graphic/chart.js +22 -5
  401. package/es/scenegraph/graphic/chart.js.map +1 -1
  402. package/es/scenegraph/graphic/contributions/chart-render.js +15 -3
  403. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  404. package/es/scenegraph/group-creater/cell-helper.js +9 -2
  405. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  406. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -1
  407. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  408. package/es/scenegraph/group-creater/column.js.map +1 -1
  409. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.d.ts +3 -0
  410. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +65 -0
  411. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -0
  412. package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -1
  413. package/es/scenegraph/group-creater/progress/proxy.js +27 -34
  414. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  415. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +9 -8
  416. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  417. package/es/scenegraph/layout/compute-col-width.js +23 -15
  418. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  419. package/es/scenegraph/layout/compute-row-height.js +20 -9
  420. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  421. package/es/scenegraph/layout/move-cell.js +1 -1
  422. package/es/scenegraph/layout/move-cell.js.map +1 -1
  423. package/es/scenegraph/layout/update-cell.js +3 -1
  424. package/es/scenegraph/layout/update-cell.js.map +1 -1
  425. package/es/scenegraph/layout/update-height.js +1 -1
  426. package/es/scenegraph/layout/update-height.js.map +1 -1
  427. package/es/scenegraph/layout/update-row.js +1 -1
  428. package/es/scenegraph/layout/update-row.js.map +1 -1
  429. package/es/scenegraph/layout/update-width.js +1 -1
  430. package/es/scenegraph/layout/update-width.js.map +1 -1
  431. package/es/scenegraph/refresh-node/update-chart.d.ts +3 -0
  432. package/es/scenegraph/refresh-node/update-chart.js +45 -4
  433. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  434. package/es/scenegraph/scenegraph.d.ts +9 -0
  435. package/es/scenegraph/scenegraph.js +146 -19
  436. package/es/scenegraph/scenegraph.js.map +1 -1
  437. package/es/scenegraph/stick-text/index.js +10 -8
  438. package/es/scenegraph/stick-text/index.js.map +1 -1
  439. package/es/scenegraph/style/frame-border.js +1 -5
  440. package/es/scenegraph/style/frame-border.js.map +1 -1
  441. package/es/state/state.js +1 -1
  442. package/es/state/state.js.map +1 -1
  443. package/es/themes/DEFAULT.js +1 -2
  444. package/es/tools/LimitPromiseQueue.js +2 -1
  445. package/es/tools/calc.d.ts +3 -0
  446. package/es/tools/calc.js +10 -0
  447. package/es/tools/calc.js.map +1 -1
  448. package/es/tools/diff-cell.js +1 -1
  449. package/es/tools/dom.js +1 -1
  450. package/es/tools/env.js +1 -1
  451. package/es/ts-types/base-table.d.ts +29 -12
  452. package/es/ts-types/base-table.js.map +1 -1
  453. package/es/ts-types/column/style.d.ts +0 -1
  454. package/es/ts-types/column/style.js.map +1 -1
  455. package/es/ts-types/component/axis.d.ts +12 -0
  456. package/es/ts-types/component/axis.js +2 -0
  457. package/es/ts-types/component/axis.js.map +1 -0
  458. package/es/ts-types/component/legend.d.ts +5 -0
  459. package/es/ts-types/component/legend.js +2 -0
  460. package/es/ts-types/component/legend.js.map +1 -0
  461. package/es/ts-types/component/title.d.ts +47 -0
  462. package/es/ts-types/component/title.js +2 -0
  463. package/es/ts-types/component/title.js.map +1 -0
  464. package/es/ts-types/component/util.d.ts +1 -0
  465. package/es/ts-types/component/util.js +2 -0
  466. package/es/ts-types/component/util.js.map +1 -0
  467. package/es/ts-types/events.d.ts +100 -83
  468. package/es/ts-types/events.js.map +1 -1
  469. package/es/ts-types/list-table/layout-map/api.d.ts +2 -0
  470. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  471. package/es/ts-types/new-data-set.d.ts +18 -5
  472. package/es/ts-types/new-data-set.js +2 -2
  473. package/es/ts-types/new-data-set.js.map +1 -1
  474. package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.d.ts +4 -0
  475. package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js +4 -0
  476. package/es/ts-types/pivot-table/PIVOT_TABLE_EVENT_TYPE.js.map +1 -1
  477. package/es/ts-types/pivot-table/corner.d.ts +3 -3
  478. package/es/ts-types/pivot-table/corner.js.map +1 -1
  479. package/es/ts-types/pivot-table/indicator/index.d.ts +1 -0
  480. package/es/ts-types/pivot-table/indicator/index.js.map +1 -1
  481. package/es/ts-types/pivot-table/title.d.ts +1 -1
  482. package/es/ts-types/pivot-table/title.js.map +1 -1
  483. package/es/ts-types/table-engine.d.ts +27 -3
  484. package/es/ts-types/table-engine.js.map +1 -1
  485. package/package.json +11 -5
  486. package/cjs/menu/dom/BaseMenu.js.map +0 -1
  487. package/cjs/menu/dom/Menu.js.map +0 -1
  488. package/cjs/menu/dom/MenuHandler.js.map +0 -1
  489. package/cjs/menu/dom/logic/MenuContainer.js.map +0 -1
  490. package/cjs/menu/dom/logic/MenuElement.js.map +0 -1
  491. package/cjs/menu/dom/logic/MenuElementStyle.js.map +0 -1
  492. package/cjs/scenegraph/layout/auto-width.d.ts +0 -2
  493. package/cjs/scenegraph/layout/auto-width.js +0 -85
  494. package/cjs/scenegraph/layout/auto-width.js.map +0 -1
  495. package/cjs/tooltip/BaseTooltip.js.map +0 -1
  496. package/cjs/tooltip/Tooltip.js.map +0 -1
  497. package/cjs/tooltip/TooltipHandler.js.map +0 -1
  498. package/cjs/tooltip/logic/BubbleTooltipElement.js.map +0 -1
  499. package/cjs/tooltip/logic/BubbleTooltipElementStyle.js.map +0 -1
  500. package/es/menu/dom/BaseMenu.js.map +0 -1
  501. package/es/menu/dom/Menu.js.map +0 -1
  502. package/es/menu/dom/MenuHandler.js.map +0 -1
  503. package/es/menu/dom/logic/MenuContainer.js.map +0 -1
  504. package/es/menu/dom/logic/MenuElement.js.map +0 -1
  505. package/es/menu/dom/logic/MenuElementStyle.js.map +0 -1
  506. package/es/scenegraph/layout/auto-width.d.ts +0 -2
  507. package/es/scenegraph/layout/auto-width.js +0 -82
  508. package/es/scenegraph/layout/auto-width.js.map +0 -1
  509. package/es/tooltip/BaseTooltip.js.map +0 -1
  510. package/es/tooltip/Tooltip.js.map +0 -1
  511. package/es/tooltip/TooltipHandler.js.map +0 -1
  512. package/es/tooltip/logic/BubbleTooltipElement.js.map +0 -1
  513. package/es/tooltip/logic/BubbleTooltipElementStyle.js.map +0 -1
  514. /package/cjs/{menu → components/menu}/dom/BaseMenu.js +0 -0
  515. /package/cjs/{menu → components/menu}/dom/Menu.d.ts +0 -0
  516. /package/cjs/{menu → components/menu}/dom/Menu.js +0 -0
  517. /package/cjs/{menu → components/menu}/dom/logic/MenuElementStyle.d.ts +0 -0
  518. /package/cjs/{menu → components/menu}/dom/logic/MenuElementStyle.js +0 -0
  519. /package/cjs/{tooltip → components/tooltip}/BaseTooltip.js +0 -0
  520. /package/cjs/{tooltip → components/tooltip}/Tooltip.d.ts +0 -0
  521. /package/cjs/{tooltip → components/tooltip}/Tooltip.js +0 -0
  522. /package/cjs/{tooltip → components/tooltip}/logic/BubbleTooltipElementStyle.d.ts +0 -0
  523. /package/cjs/{tooltip → components/tooltip}/logic/BubbleTooltipElementStyle.js +0 -0
  524. /package/es/{menu → components/menu}/dom/BaseMenu.js +0 -0
  525. /package/es/{menu → components/menu}/dom/Menu.d.ts +0 -0
  526. /package/es/{menu → components/menu}/dom/Menu.js +0 -0
  527. /package/es/{menu → components/menu}/dom/logic/MenuElementStyle.d.ts +0 -0
  528. /package/es/{menu → components/menu}/dom/logic/MenuElementStyle.js +0 -0
  529. /package/es/{tooltip → components/tooltip}/BaseTooltip.js +0 -0
  530. /package/es/{tooltip → components/tooltip}/Tooltip.d.ts +0 -0
  531. /package/es/{tooltip → components/tooltip}/Tooltip.js +0 -0
  532. /package/es/{tooltip → components/tooltip}/logic/BubbleTooltipElementStyle.d.ts +0 -0
  533. /package/es/{tooltip → components/tooltip}/logic/BubbleTooltipElementStyle.js +0 -0
@@ -4,35 +4,41 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.Dataset = void 0;
6
6
 
7
- const ts_types_1 = require("../ts-types");
7
+ const vutils_1 = require("@visactor/vutils"), util_1 = require("../tools/util"), ts_types_1 = require("../ts-types"), statistics_helper_1 = require("./statistics-helper"), zero_align_1 = require("./util/zero-align");
8
8
 
9
9
  class Dataset {
10
- constructor(dataConfig, rows, columns, indicators, records) {
11
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
10
+ constructor(dataConfig, rows, columns, indicatorKeys, records, customColTree, customRowTree) {
11
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
12
12
  this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {}, this.colKeys = [],
13
13
  this.rowKeys = [], this.rowOrder = "key_a_to_z", this.colOrder = "key_a_to_z", this.sorted = !1,
14
14
  this.indicatorStatistics = [], this.aggregators = {}, this.stringJoinChar = String.fromCharCode(0),
15
- this.rowsIsTotal = [], this.colsIsTotal = [], this.registerAggregators(), this.dataConfig = dataConfig,
16
- this.sortRules = this.dataConfig.sortRules, this.aggregationRules = this.dataConfig.aggregationRules,
17
- this.derivedFieldRules = this.dataConfig.derivedFieldRules, this.mappingRules = this.dataConfig.mappingRules,
18
- this.totals = dataConfig.totals, this.rows = rows, this.columns = columns, this.indicators = indicators,
19
- this.colGrandTotalLabel = null !== (_c = null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.column) || void 0 === _b ? void 0 : _b.grandTotalLabel) && void 0 !== _c ? _c : "总计",
20
- this.colSubTotalLabel = null !== (_f = null === (_e = null === (_d = this.totals) || void 0 === _d ? void 0 : _d.column) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计",
21
- this.rowGrandTotalLabel = null !== (_j = null === (_h = null === (_g = this.totals) || void 0 === _g ? void 0 : _g.row) || void 0 === _h ? void 0 : _h.grandTotalLabel) && void 0 !== _j ? _j : "总计",
22
- this.rowSubTotalLabel = null !== (_m = null === (_l = null === (_k = this.totals) || void 0 === _k ? void 0 : _k.row) || void 0 === _l ? void 0 : _l.subTotalLabel) && void 0 !== _m ? _m : "小计",
23
- this.rowsIsTotal = new Array(this.rows.length).fill(!1), this.colsIsTotal = new Array(this.columns.length).fill(!1);
24
- for (let i = 0, len = null === (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.row) || void 0 === _p ? void 0 : _p.subTotalsDimensions) || void 0 === _q ? void 0 : _q.length; i < len; i++) {
15
+ this.rowsIsTotal = [], this.colsIsTotal = [], this.collectedValues = {}, this.registerAggregators(),
16
+ this.dataConfig = dataConfig, this.sortRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.sortRules,
17
+ this.aggregationRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.aggregationRules,
18
+ this.derivedFieldRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.derivedFieldRules,
19
+ this.mappingRules = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.mappingRules,
20
+ this.totals = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals,
21
+ this.rows = rows, this.columns = columns, this.indicatorKeys = indicatorKeys, this.colGrandTotalLabel = null !== (_h = null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.column) || void 0 === _g ? void 0 : _g.grandTotalLabel) && void 0 !== _h ? _h : "总计",
22
+ this.colSubTotalLabel = null !== (_l = null === (_k = null === (_j = this.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.subTotalLabel) && void 0 !== _l ? _l : "小计",
23
+ this.rowGrandTotalLabel = null !== (_p = null === (_o = null === (_m = this.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.grandTotalLabel) && void 0 !== _p ? _p : "总计",
24
+ this.rowSubTotalLabel = null !== (_s = null === (_r = null === (_q = this.totals) || void 0 === _q ? void 0 : _q.row) || void 0 === _r ? void 0 : _r.subTotalLabel) && void 0 !== _s ? _s : "小计",
25
+ this.collectValuesBy = null !== (_u = null === (_t = this.dataConfig) || void 0 === _t ? void 0 : _t.collectValuesBy) && void 0 !== _u ? _u : {
26
+ 230417170554008: {
27
+ by: [ "230417171050031", "230417171050028" ]
28
+ }
29
+ }, this.rowsIsTotal = new Array(this.rows.length).fill(!1), this.colsIsTotal = new Array(this.columns.length).fill(!1);
30
+ for (let i = 0, len = null === (_x = null === (_w = null === (_v = this.totals) || void 0 === _v ? void 0 : _v.row) || void 0 === _w ? void 0 : _w.subTotalsDimensions) || void 0 === _x ? void 0 : _x.length; i < len; i++) {
25
31
  const dimension = this.totals.row.subTotalsDimensions[i], dimensionIndex = this.rows.indexOf(dimension);
26
32
  this.rowsIsTotal[dimensionIndex] = !0;
27
33
  }
28
- for (let i = 0, len = null === (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.subTotalsDimensions) || void 0 === _t ? void 0 : _t.length; i < len; i++) {
34
+ for (let i = 0, len = null === (_0 = null === (_z = null === (_y = this.totals) || void 0 === _y ? void 0 : _y.column) || void 0 === _z ? void 0 : _z.subTotalsDimensions) || void 0 === _0 ? void 0 : _0.length; i < len; i++) {
29
35
  const dimension = this.totals.column.subTotalsDimensions[i], dimensionIndex = this.columns.indexOf(dimension);
30
36
  this.colsIsTotal[dimensionIndex] = !0;
31
37
  }
32
38
  if (records) {
33
39
  this.records = records;
34
40
  const t0 = "undefined" != typeof window ? window.performance.now() : 0;
35
- this.setRecords(records);
41
+ this.setRecords(records), this.processCollectedValuesWithSumBy();
36
42
  const t1 = "undefined" != typeof window ? window.performance.now() : 0;
37
43
  console.log("processRecords:", t1 - t0);
38
44
  const t4 = "undefined" != typeof window ? window.performance.now() : 0;
@@ -44,36 +50,56 @@ class Dataset {
44
50
  const t3 = "undefined" != typeof window ? window.performance.now() : 0;
45
51
  console.log("sortKeys:", t3 - t2);
46
52
  const t7 = "undefined" != typeof window ? window.performance.now() : 0;
47
- this.rowKeysPath = this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_v = null === (_u = null == this ? void 0 : this.totals) || void 0 === _u ? void 0 : _u.row) || void 0 === _v ? void 0 : _v.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
48
- this.colKeysPath = this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_x = null === (_w = this.totals) || void 0 === _w ? void 0 : _w.column) || void 0 === _x ? void 0 : _x.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
53
+ this.rowKeysPath = customRowTree ? this.TreeToArr2(customRowTree) : this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_2 = null === (_1 = null == this ? void 0 : this.totals) || void 0 === _1 ? void 0 : _1.row) || void 0 === _2 ? void 0 : _2.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
54
+ this.colKeysPath = customColTree ? this.TreeToArr2(customColTree) : this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_4 = null === (_3 = this.totals) || void 0 === _3 ? void 0 : _3.column) || void 0 === _4 ? void 0 : _4.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
49
55
  const t8 = "undefined" != typeof window ? window.performance.now() : 0;
50
- console.log("TreeToArr:", t8 - t7);
56
+ console.log("TreeToArr:", t8 - t7), this.dataConfig.isPivotChart && this.dealWithZeroAlign();
51
57
  }
52
- delete this.rowFlatKeys, delete this.colFlatKeys;
53
58
  }
54
59
  registerAggregator(type, aggregator) {
55
60
  this.aggregators[type] = aggregator;
56
61
  }
57
62
  registerAggregators() {
58
- this.registerAggregator(ts_types_1.AggregationType.SUM, SumAggregator), this.registerAggregator(ts_types_1.AggregationType.COUNT, CountAggregator),
59
- this.registerAggregator(ts_types_1.AggregationType.MAX, MaxAggregator), this.registerAggregator(ts_types_1.AggregationType.MIN, MinAggregator),
60
- this.registerAggregator(ts_types_1.AggregationType.AVG, AvgAggregator);
63
+ this.registerAggregator(ts_types_1.AggregationType.RECORD, statistics_helper_1.RecordAggregator),
64
+ this.registerAggregator(ts_types_1.AggregationType.SUM, statistics_helper_1.SumAggregator),
65
+ this.registerAggregator(ts_types_1.AggregationType.COUNT, statistics_helper_1.CountAggregator),
66
+ this.registerAggregator(ts_types_1.AggregationType.MAX, statistics_helper_1.MaxAggregator),
67
+ this.registerAggregator(ts_types_1.AggregationType.MIN, statistics_helper_1.MinAggregator),
68
+ this.registerAggregator(ts_types_1.AggregationType.AVG, statistics_helper_1.AvgAggregator);
61
69
  }
62
70
  setRecords(records) {
63
71
  this.processRecords();
64
72
  }
73
+ processCollectedValuesWithSumBy() {
74
+ var _a;
75
+ for (const field in this.collectedValues) if (null === (_a = this.collectValuesBy[field]) || void 0 === _a ? void 0 : _a.sumBy) for (const byKeys in this.collectedValues[field]) {
76
+ const max = Object.values(this.collectedValues[field][byKeys]).reduce(((acc, cur) => cur.value() > acc ? cur.value() : acc), Number.MIN_SAFE_INTEGER), min = Object.values(this.collectedValues[field][byKeys]).reduce(((acc, cur) => cur.value() < acc ? cur.value() : acc), Number.MAX_SAFE_INTEGER);
77
+ this.collectedValues[field][byKeys] = {}, this.collectedValues[field][byKeys].max = max,
78
+ this.collectedValues[field][byKeys].min = min;
79
+ }
80
+ }
65
81
  processRecords() {
82
+ var _a, _b;
83
+ let isNeedFilter = !1;
84
+ (null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules) || void 0 === _b ? void 0 : _b.length) >= 1 && (isNeedFilter = !0);
66
85
  for (let i = 0, len = this.records.length; i < len; i++) {
67
86
  const record = this.records[i];
68
- this.filterRecord(record) && this.processRecord(record);
87
+ isNeedFilter && !this.filterRecord(record) || this.processRecord(record);
69
88
  }
89
+ this.rowFlatKeys = {}, this.colFlatKeys = {};
70
90
  }
71
91
  filterRecord(record) {
72
92
  var _a, _b;
73
93
  let isReserved = !0;
74
- for (let i = 0; i < (null === (_a = this.dataConfig.filterRules) || void 0 === _a ? void 0 : _a.length); i++) {
75
- const filterRule = this.dataConfig.filterRules[i];
76
- if (!(null === (_b = filterRule.filterFunc) || void 0 === _b ? void 0 : _b.call(filterRule, record))) {
94
+ for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
95
+ const filterRule = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules[i];
96
+ if (filterRule.filterKey) {
97
+ const filterValue = record[filterRule.filterKey];
98
+ if (-1 === filterRule.filteredValues.indexOf(filterValue)) {
99
+ isReserved = !1;
100
+ break;
101
+ }
102
+ } else if (!(null === (_b = filterRule.filterFunc) || void 0 === _b ? void 0 : _b.call(filterRule, record))) {
77
103
  isReserved = !1;
78
104
  break;
79
105
  }
@@ -81,7 +107,7 @@ class Dataset {
81
107
  return isReserved;
82
108
  }
83
109
  processRecord(record) {
84
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
110
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
85
111
  null === (_a = this.derivedFieldRules) || void 0 === _a || _a.forEach(((derivedFieldRule, i) => {
86
112
  record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
87
113
  }));
@@ -94,30 +120,48 @@ class Dataset {
94
120
  const colAttr = this.columns[n];
95
121
  colKey.push(record[colAttr]);
96
122
  }
123
+ for (const field in this.collectValuesBy) if (record[field]) {
124
+ this.collectedValues[field] || (this.collectedValues[field] = {});
125
+ const collectKeys = this.collectValuesBy[field].by.map((byField => record[byField])).join(this.stringJoinChar);
126
+ if (this.collectedValues[field][collectKeys] || (this.collectValuesBy[field].sumBy ? this.collectedValues[field][collectKeys] = {} : this.collectValuesBy[field].range ? this.collectedValues[field][collectKeys] = {
127
+ min: Number.MAX_SAFE_INTEGER,
128
+ max: Number.MIN_SAFE_INTEGER
129
+ } : this.collectedValues[field][collectKeys] = new Set), this.collectValuesBy[field].sumBy) {
130
+ const sumByKeys = this.collectValuesBy[field].sumBy.map((byField => record[byField])).join(this.stringJoinChar);
131
+ this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[ts_types_1.AggregationType.SUM](field)),
132
+ this.collectedValues[field][collectKeys][sumByKeys].push(record);
133
+ } else if (this.collectValuesBy[field].range) {
134
+ const fieldRange = this.collectedValues[field][collectKeys];
135
+ fieldRange.max = Math.max(record[field], fieldRange.max), fieldRange.min = Math.min(record[field], fieldRange.min);
136
+ } else {
137
+ this.collectedValues[field][collectKeys].add(record[field]);
138
+ }
139
+ }
97
140
  const flatRowKey = rowKey.join(this.stringJoinChar), flatColKey = colKey.join(this.stringJoinChar);
98
141
  if (0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
99
142
  this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
100
143
  this.colFlatKeys[flatColKey] = 1)), 0 !== colKey.length || 0 !== rowKey.length) {
101
144
  this.tree[flatRowKey] || (this.tree[flatRowKey] = {}), (null === (_b = this.tree[flatRowKey]) || void 0 === _b ? void 0 : _b[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
102
- for (let i = 0; i < this.indicators.length; i++) {
103
- if (!(null === (_d = null === (_c = this.tree[flatRowKey]) || void 0 === _c ? void 0 : _c[flatColKey]) || void 0 === _d ? void 0 : _d[i])) {
104
- const aggRule = this.getAggregatorRule(this.indicators[i]);
105
- this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_e = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _e ? _e : ts_types_1.AggregationType.SUM](null !== (_f = null == aggRule ? void 0 : aggRule.field) && void 0 !== _f ? _f : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
106
- }
107
- null === (_h = null === (_g = this.tree[flatRowKey]) || void 0 === _g ? void 0 : _g[flatColKey]) || void 0 === _h || _h[i].push(record);
145
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
146
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
147
+ if ((null === (_d = null === (_c = this.tree[flatRowKey]) || void 0 === _c ? void 0 : _c[flatColKey]) || void 0 === _d ? void 0 : _d[i]) || (this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_e = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _e ? _e : ts_types_1.AggregationType.SUM](null !== (_f = null == aggRule ? void 0 : aggRule.field) && void 0 !== _f ? _f : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun)),
148
+ null == aggRule ? void 0 : aggRule.field) if ("string" == typeof (null == aggRule ? void 0 : aggRule.field)) (0,
149
+ util_1.isValid)(record[null == aggRule ? void 0 : aggRule.field]) && (null === (_h = null === (_g = this.tree[flatRowKey]) || void 0 === _g ? void 0 : _g[flatColKey]) || void 0 === _h || _h[i].push(record)); else {
150
+ (null == aggRule ? void 0 : aggRule.field.find((field => record[field]))) && (null === (_k = null === (_j = this.tree[flatRowKey]) || void 0 === _j ? void 0 : _j[flatColKey]) || void 0 === _k || _k[i].push(record));
151
+ } else (0, util_1.isValid)(record[this.indicatorKeys[i]]) && (null === (_m = null === (_l = this.tree[flatRowKey]) || void 0 === _l ? void 0 : _l[flatColKey]) || void 0 === _m || _m[i].push(record));
108
152
  }
109
153
  }
110
- if (this.mappingRules) for (let i = 0; i < this.indicators.length; i++) {
154
+ if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
111
155
  if (!this.indicatorStatistics[i]) {
112
- const aggRule = this.getAggregatorRule(this.indicators[i]);
156
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
113
157
  this.indicatorStatistics[i] = {
114
- max: new this.aggregators[ts_types_1.AggregationType.MAX](this.indicators[i]),
115
- min: new this.aggregators[ts_types_1.AggregationType.MIN](this.indicators[i]),
116
- total: new this.aggregators[null !== (_j = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _j ? _j : ts_types_1.AggregationType.SUM](null !== (_k = null == aggRule ? void 0 : aggRule.field) && void 0 !== _k ? _k : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun)
158
+ max: new this.aggregators[ts_types_1.AggregationType.MAX](this.indicatorKeys[i]),
159
+ min: new this.aggregators[ts_types_1.AggregationType.MIN](this.indicatorKeys[i]),
160
+ total: new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : ts_types_1.AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun)
117
161
  };
118
162
  }
119
- this.indicatorStatistics[i].max.push(null === (_m = null === (_l = this.tree[flatRowKey]) || void 0 === _l ? void 0 : _l[flatColKey]) || void 0 === _m ? void 0 : _m[i].value()),
120
- this.indicatorStatistics[i].min.push(null === (_p = null === (_o = this.tree[flatRowKey]) || void 0 === _o ? void 0 : _o[flatColKey]) || void 0 === _p ? void 0 : _p[i].value()),
163
+ this.indicatorStatistics[i].max.push(null === (_r = null === (_q = this.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[i].value()),
164
+ this.indicatorStatistics[i].min.push(null === (_t = null === (_s = this.tree[flatRowKey]) || void 0 === _s ? void 0 : _s[flatColKey]) || void 0 === _t ? void 0 : _t[i].value()),
121
165
  this.indicatorStatistics[i].total.push(record);
122
166
  }
123
167
  }
@@ -126,13 +170,17 @@ class Dataset {
126
170
  this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.rowKeysPath = this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, (null === (_b = null === (_a = null == this ? void 0 : this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || 0 === this.columns.length, this.rowGrandTotalLabel, this.rowSubTotalLabel)),
127
171
  this.colKeysPath = this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, (null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.column) || void 0 === _d ? void 0 : _d.showGrandTotals) || 0 === this.rows.length, this.colGrandTotalLabel, this.colSubTotalLabel));
128
172
  }
173
+ updateFilterRules(filterRules, isResetTree = !1) {
174
+ if (this.filterRules = filterRules, isResetTree) this.tree = {}; else for (const treeRowKey in this.tree) for (const treeColKey in this.tree[treeRowKey]) for (let i = 0; i < this.tree[treeRowKey][treeColKey].length; i++) this.tree[treeRowKey][treeColKey][i].reset();
175
+ this.collectedValues = {}, this.processRecords(), this.processCollectedValuesWithSumBy();
176
+ }
129
177
  getAggregatorRule(indicatorKey) {
130
178
  var _a;
131
179
  return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
132
180
  }
133
181
  getAggregator(rowKey = [], colKey = [], indicator) {
134
182
  var _a, _b;
135
- const indicatorIndex = this.indicators.indexOf(indicator);
183
+ const indicatorIndex = this.indicatorKeys.indexOf(indicator);
136
184
  let agg, flatRowKey, flatColKey;
137
185
  return flatRowKey = "string" == typeof rowKey ? rowKey : rowKey.join(this.stringJoinChar),
138
186
  flatColKey = "string" == typeof colKey ? colKey : colKey.join(this.stringJoinChar),
@@ -141,7 +189,8 @@ class Dataset {
141
189
  className: "",
142
190
  push() {},
143
191
  value: () => null,
144
- formatValue: () => ""
192
+ formatValue: () => "",
193
+ reset() {}
145
194
  };
146
195
  }
147
196
  sortKeys() {
@@ -154,13 +203,13 @@ class Dataset {
154
203
  switch (this.rowOrder) {
155
204
  case "value_a_to_z":
156
205
  this.rowKeys.sort((function(a, b) {
157
- return naturalSort(getValue(a, []), getValue(b, []));
206
+ return (0, statistics_helper_1.naturalSort)(getValue(a, []), getValue(b, []));
158
207
  }));
159
208
  break;
160
209
 
161
210
  case "value_z_to_a":
162
211
  this.rowKeys.sort((function(a, b) {
163
- return -naturalSort(getValue(a, []), getValue(b, []));
212
+ return -(0, statistics_helper_1.naturalSort)(getValue(a, []), getValue(b, []));
164
213
  }));
165
214
  break;
166
215
 
@@ -170,13 +219,13 @@ class Dataset {
170
219
  switch (this.colOrder) {
171
220
  case "value_a_to_z":
172
221
  this.colKeys.sort((function(a, b) {
173
- return naturalSort(getValue([], a), getValue([], b));
222
+ return (0, statistics_helper_1.naturalSort)(getValue([], a), getValue([], b));
174
223
  }));
175
224
  break;
176
225
 
177
226
  case "value_z_to_a":
178
227
  this.colKeys.sort((function(a, b) {
179
- return -naturalSort(getValue([], a), getValue([], b));
228
+ return -(0, statistics_helper_1.naturalSort)(getValue([], a), getValue([], b));
180
229
  }));
181
230
  break;
182
231
 
@@ -203,7 +252,7 @@ class Dataset {
203
252
  isHasSortRule || results.push({
204
253
  field: field,
205
254
  fieldIndex: l,
206
- func: naturalSort
255
+ func: statistics_helper_1.naturalSort
207
256
  });
208
257
  }
209
258
  return results;
@@ -232,8 +281,9 @@ class Dataset {
232
281
  colKey.length < that.columns.length && colKey[colKey.length - 1] !== that.colSubTotalLabel && colKey[colKey.length - 1] !== that.colGrandTotalLabel && colKey.push(that.colSubTotalLabel),
233
282
  that.getAggregator(rowKey, colKey, sortRule.sortByIndicator).value();
234
283
  };
235
- return isSortRow ? naturalSort(getValue(a, sortRule.query), getValue(b, sortRule.query)) : naturalSort(getValue(sortRule.query, a), getValue(sortRule.query, b));
236
- } : sortRule.sortBy ? sortBy(sortRule.sortBy) : sortRule.sortType ? typeSort : sortRule.sortFunc ? sortRule.sortFunc : naturalSort;
284
+ return isSortRow ? (0, statistics_helper_1.naturalSort)(getValue(a, sortRule.query), getValue(b, sortRule.query)) : (0,
285
+ statistics_helper_1.naturalSort)(getValue(sortRule.query, a), getValue(sortRule.query, b));
286
+ } : sortRule.sortBy ? (0, statistics_helper_1.sortBy)(sortRule.sortBy) : sortRule.sortType ? statistics_helper_1.typeSort : sortRule.sortFunc ? sortRule.sortFunc : statistics_helper_1.naturalSort;
237
287
  }
238
288
  totalStatistics() {
239
289
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
@@ -249,10 +299,10 @@ class Dataset {
249
299
  colTotalKey.push(null !== (_f = null === (_e = null === (_d = that.totals) || void 0 === _d ? void 0 : _d.column) || void 0 === _e ? void 0 : _e.subTotalLabel) && void 0 !== _f ? _f : "小计");
250
300
  const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
251
301
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
252
- for (let i = 0; i < this.indicators.length; i++) {
302
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
253
303
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
254
- const aggRule = this.getAggregatorRule(this.indicators[i]);
255
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : ts_types_1.AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
304
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
305
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : ts_types_1.AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
256
306
  }
257
307
  this.tree[flatRowKey][flatColTotalKey][i].push(null === (_k = null === (_j = that.tree[flatRowKey]) || void 0 === _j ? void 0 : _j[flatColKey]) || void 0 === _k ? void 0 : _k[i]);
258
308
  }
@@ -261,10 +311,10 @@ class Dataset {
261
311
  if ((null === (_m = null === (_l = that.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) || 0 === this.rows.length) {
262
312
  const flatColTotalKey = that.colGrandTotalLabel;
263
313
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
264
- for (let i = 0; i < this.indicators.length; i++) {
314
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
265
315
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
266
- const aggRule = this.getAggregatorRule(this.indicators[i]);
267
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : ts_types_1.AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
316
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
317
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : ts_types_1.AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
268
318
  }
269
319
  this.tree[flatRowKey][flatColTotalKey][i].push(null === (_r = null === (_q = that.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[i]);
270
320
  }
@@ -283,29 +333,29 @@ class Dataset {
283
333
  if (this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
284
334
  !this.tree[flatRowTotalKey][flatColKey]) {
285
335
  this.tree[flatRowTotalKey][flatColKey] = [];
286
- for (let i = 0; i < this.indicators.length; i++) {
336
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
287
337
  if (!this.tree[flatRowTotalKey][flatColKey][i]) {
288
- const aggRule = this.getAggregatorRule(this.indicators[i]);
289
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : ts_types_1.AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
338
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
339
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : ts_types_1.AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
290
340
  }
291
341
  this.tree[flatRowTotalKey][flatColKey][i].push(null === (_k = null === (_j = that.tree[flatRowKey]) || void 0 === _j ? void 0 : _j[flatColKey]) || void 0 === _k ? void 0 : _k[i]);
292
342
  }
293
343
  }
294
344
  }
295
- if ((null === (_m = null === (_l = that.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showGrandTotals) || 0 === this.columns.length) {
296
- const flatRowTotalKey = that.rowGrandTotalLabel;
297
- this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
298
- this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
299
- for (let i = 0; i < this.indicators.length; i++) {
300
- if (!this.tree[flatRowTotalKey][flatColKey][i]) {
301
- const aggRule = this.getAggregatorRule(this.indicators[i]);
302
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : ts_types_1.AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
303
- }
304
- this.tree[flatRowTotalKey][flatColKey][i].push(null === (_r = null === (_q = that.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[i]);
345
+ }
346
+ if ((null === (_m = null === (_l = that.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showGrandTotals) || 0 === this.columns.length) {
347
+ const flatRowTotalKey = that.rowGrandTotalLabel;
348
+ this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
349
+ this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
350
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
351
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) {
352
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
353
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : ts_types_1.AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
305
354
  }
355
+ this.tree[flatRowTotalKey][flatColKey][i].push(null === (_r = null === (_q = that.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[i]);
306
356
  }
307
- colCompute(flatRowKey, flatColKey);
308
357
  }
358
+ colCompute(flatRowKey, flatColKey);
309
359
  }));
310
360
  })), rowTotalKeys.forEach((flatRowKey => {
311
361
  Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
@@ -326,33 +376,33 @@ class Dataset {
326
376
  if (!item) {
327
377
  if (item = {
328
378
  id: flatKey,
329
- child: []
379
+ children: []
330
380
  }, subTotalFlags[index]) {
331
- let curChild = item.child;
381
+ let curChild = item.children;
332
382
  for (let i = index; i < list.length - 1; i++) {
333
383
  const totalChild = {
334
384
  id: `${flatKey}${concatStr}${subTotalLabel}`,
335
- child: []
385
+ children: []
336
386
  };
337
- curChild.push(totalChild), curChild = totalChild.child;
387
+ curChild.push(totalChild), curChild = totalChild.children;
338
388
  }
339
389
  }
340
- map.set(flatKey, item), node ? subTotalFlags[index - 1] ? node.child.splice(node.child.length - 1, 0, item) : node.child.push(item) : result.push(item);
390
+ map.set(flatKey, item), node ? subTotalFlags[index - 1] ? node.children.splice(node.children.length - 1, 0, item) : node.children.push(item) : result.push(item);
341
391
  }
342
392
  node = item;
343
393
  }));
344
394
  }(item))), isGrandTotal) {
345
395
  const node = {
346
396
  id: grandTotalLabel,
347
- child: []
397
+ children: []
348
398
  };
349
- let curChild = node.child;
399
+ let curChild = node.children;
350
400
  for (let i = 1; i < subTotalFlags.length; i++) {
351
401
  const totalChild = {
352
402
  id: grandTotalLabel,
353
- child: []
403
+ children: []
354
404
  };
355
- curChild.push(totalChild), curChild = totalChild.child;
405
+ curChild.push(totalChild), curChild = totalChild.children;
356
406
  }
357
407
  result.push(node);
358
408
  }
@@ -362,129 +412,51 @@ class Dataset {
362
412
  const result = [];
363
413
  function getPath(node, arr) {
364
414
  var _a;
365
- arr.push(node.id), node.child.length > 0 ? null === (_a = node.child) || void 0 === _a || _a.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
415
+ arr.push(node.id), node.children.length > 0 ? null === (_a = node.children) || void 0 === _a || _a.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
366
416
  }
367
417
  return tree.forEach((treeNode => getPath(treeNode, []))), result;
368
418
  }
369
- }
370
-
371
- exports.Dataset = Dataset;
372
-
373
- class Aggregator {
374
- constructor(dimension, formatFun, isRecord) {
375
- this.className = "Aggregator", this.isRecord = !0, this.records = [], this.field = dimension,
376
- this.formatFun = formatFun, this.isRecord = null != isRecord ? isRecord : this.isRecord;
377
- }
378
- formatValue() {
379
- return this._formatedValue || (this.formatFun ? this._formatedValue = this.formatFun(this.value()) : this._formatedValue = this.value()),
380
- this._formatedValue;
381
- }
382
- }
383
-
384
- class SumAggregator extends Aggregator {
385
- constructor() {
386
- super(...arguments), this.type = ts_types_1.AggregationType.SUM, this.sum = 0;
387
- }
388
- push(record) {
389
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
390
- "Aggregator" === record.className ? this.sum += record.value() : isNaN(parseFloat(record[this.field])) || (this.sum += parseFloat(record[this.field]));
391
- }
392
- value() {
393
- return this.sum;
394
- }
395
- }
396
-
397
- class CountAggregator extends Aggregator {
398
- constructor() {
399
- super(...arguments), this.type = ts_types_1.AggregationType.COUNT, this.count = 0;
400
- }
401
- push(record) {
402
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
403
- "Aggregator" === record.className ? this.count += record.value() : this.count++;
404
- }
405
- value() {
406
- return this.count;
407
- }
408
- }
409
-
410
- class AvgAggregator extends Aggregator {
411
- constructor() {
412
- super(...arguments), this.type = ts_types_1.AggregationType.AVG, this.sum = 0, this.count = 0;
413
- }
414
- push(record) {
415
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
416
- "Aggregator" === record.className && record.type === ts_types_1.AggregationType.AVG ? (this.sum += record.sum,
417
- this.count += record.count) : isNaN(parseFloat(record[this.field])) || (this.sum += parseFloat(record[this.field]),
418
- this.count++);
419
- }
420
- value() {
421
- return this.sum / this.count;
422
- }
423
- }
424
-
425
- class MaxAggregator extends Aggregator {
426
- constructor() {
427
- super(...arguments), this.type = ts_types_1.AggregationType.MAX, this.max = Number.MIN_SAFE_INTEGER,
428
- this.isRecord = !1;
429
- }
430
- push(record) {
431
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
432
- "number" == typeof record ? this.max = record > this.max ? record : this.max : "number" == typeof record[this.field] ? this.max = record[this.field] > this.max ? record[this.field] : this.max : isNaN(record[this.field]) || (this.max = parseFloat(record[this.field]) > this.max ? parseFloat(record[this.field]) : this.max);
433
- }
434
- value() {
435
- return this.max;
436
- }
437
- }
438
-
439
- class MinAggregator extends Aggregator {
440
- constructor() {
441
- super(...arguments), this.type = ts_types_1.AggregationType.MIN, this.min = Number.MAX_SAFE_INTEGER,
442
- this.isRecord = !1;
443
- }
444
- push(record) {
445
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
446
- "number" == typeof record ? this.min = record < this.min ? record : this.min : "number" == typeof record[this.field] && (this.min = record[this.field] < this.min ? record[this.field] : this.min);
419
+ TreeToArr2(tree) {
420
+ const result = [];
421
+ function getPath(node, arr) {
422
+ var _a, _b;
423
+ arr.push(arr.length > 0 ? [ arr[arr.length - 1], node.value ].join(String.fromCharCode(0)) : node.value),
424
+ (null === (_a = node.children) || void 0 === _a ? void 0 : _a.length) > 0 && !node.children[0].indicatorKey ? null === (_b = node.children) || void 0 === _b || _b.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
425
+ }
426
+ return tree.forEach((treeNode => getPath(treeNode, []))), result;
447
427
  }
448
- value() {
449
- return this.min;
428
+ dealWithZeroAlign() {
429
+ const indicatorsToAlign = [];
430
+ for (let i = 0; i < this.aggregationRules.length; i++) {
431
+ const rule = this.aggregationRules[i];
432
+ (0, vutils_1.isArray)(rule.field) && 2 === rule.field.length && indicatorsToAlign.push(rule.field);
433
+ }
434
+ indicatorsToAlign.forEach((indicatorToAlign => {
435
+ const indicator1 = indicatorToAlign[0], indicator2 = indicatorToAlign[1], collectedValue1 = this.collectedValues[indicator1], collectedValue2 = this.collectedValues[indicator2];
436
+ this.collectedValues[indicator1 + "_align"] = {}, this.collectedValues[indicator2 + "_align"] = {};
437
+ for (const key in collectedValue1) {
438
+ const range1 = collectedValue1[key], range2 = collectedValue2[key], newRanges = (0,
439
+ zero_align_1.getNewRangeToAlign)(range1, range2);
440
+ if (newRanges) {
441
+ const {range1: newRange1, range2: newRange2} = newRanges;
442
+ this.collectedValues[indicator1 + "_align"][key] = {
443
+ min: newRange1[0],
444
+ max: newRange1[1]
445
+ }, this.collectedValues[indicator2 + "_align"][key] = {
446
+ min: newRange2[0],
447
+ max: newRange2[1]
448
+ };
449
+ } else this.collectedValues[indicator1 + "_align"][key] = {
450
+ min: range1.min,
451
+ max: range1.max
452
+ }, this.collectedValues[indicator2 + "_align"][key] = {
453
+ min: range2.min,
454
+ max: range2.max
455
+ };
456
+ }
457
+ }));
450
458
  }
451
459
  }
452
460
 
453
- function indicatorSort(a, b) {
454
- return a && b ? a.toString().localeCompare(b.toString(), "zh") : a ? 1 : -1;
455
- }
456
-
457
- function typeSort(a, b) {
458
- return a && b ? a.toString().localeCompare(b.toString(), "zh") : a ? 1 : -1;
459
- }
460
-
461
- function naturalSort(as, bs) {
462
- const rx = /(\d+)|(\D+)/g, rd = /\d/, rz = /^0/;
463
- let a, a1, b, b1, nas = 0, nbs = 0;
464
- if (null !== bs && null === as) return -1;
465
- if (null !== as && null === bs) return 1;
466
- if ("number" == typeof as && isNaN(as)) return -1;
467
- if ("number" == typeof bs && isNaN(bs)) return 1;
468
- if (nas = +as, nbs = +bs, nas < nbs) return -1;
469
- if (nas > nbs) return 1;
470
- if ("number" == typeof as && "number" != typeof bs) return -1;
471
- if ("number" == typeof bs && "number" != typeof as) return 1;
472
- if ("number" == typeof as && "number" == typeof bs) return 0;
473
- if (isNaN(nbs) && !isNaN(nas)) return -1;
474
- if (isNaN(nas) && !isNaN(nbs)) return 1;
475
- if (a = String(as), b = String(bs), a === b) return 0;
476
- if (!rd.test(a) || !rd.test(b)) return a > b ? 1 : -1;
477
- for (a = a.match(rx), b = b.match(rx); a.length && b.length; ) if (a1 = a.shift(),
478
- b1 = b.shift(), a1 !== b1) return rd.test(a1) && rd.test(b1) ? a1.replace(rz, ".0") - b1.replace(rz, ".0") : a1 > b1 ? 1 : -1;
479
- return a.length - b.length;
480
- }
481
-
482
- function sortBy(order) {
483
- let x;
484
- const mapping = {}, lowercase_mapping = {};
485
- for (let i = 0; i < order.length; i++) x = order[i], mapping[x] = i, "string" == typeof x && (lowercase_mapping[x.toLowerCase()] = i);
486
- return function(a, b) {
487
- return null !== mapping[a] && void 0 !== mapping[a] && null !== mapping[b] && void 0 !== mapping[b] ? mapping[a] - mapping[b] : null !== mapping[a] && void 0 !== mapping[a] ? -1 : null !== mapping[b] && void 0 !== mapping[b] ? 1 : null !== lowercase_mapping[a] && void 0 !== mapping[a] && null !== lowercase_mapping[b] && void 0 !== mapping[b] ? lowercase_mapping[a] - lowercase_mapping[b] : null === lowercase_mapping[a] || void 0 === mapping[a] || null === lowercase_mapping[b] || void 0 === mapping[b] ? 0 : null !== lowercase_mapping[a] && void 0 !== mapping[a] ? -1 : null !== lowercase_mapping[b] && void 0 !== mapping[b] ? 1 : naturalSort(a, b);
488
- };
489
- }
461
+ exports.Dataset = Dataset;
490
462
  //# sourceMappingURL=dataset.js.map