@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
@@ -1,32 +1,46 @@
1
+ import { isArray } from "@visactor/vutils";
2
+
3
+ import { isValid } from "../tools/util";
4
+
1
5
  import { AggregationType, SortType } from "../ts-types";
2
6
 
7
+ import { AvgAggregator, CountAggregator, MaxAggregator, MinAggregator, RecordAggregator, SumAggregator, naturalSort, sortBy, typeSort } from "./statistics-helper";
8
+
9
+ import { getNewRangeToAlign } from "./util/zero-align";
10
+
3
11
  export class Dataset {
4
- constructor(dataConfig, rows, columns, indicators, records) {
5
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
12
+ constructor(dataConfig, rows, columns, indicatorKeys, records, customColTree, customRowTree) {
13
+ 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;
6
14
  this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {}, this.colKeys = [],
7
15
  this.rowKeys = [], this.rowOrder = "key_a_to_z", this.colOrder = "key_a_to_z", this.sorted = !1,
8
16
  this.indicatorStatistics = [], this.aggregators = {}, this.stringJoinChar = String.fromCharCode(0),
9
- this.rowsIsTotal = [], this.colsIsTotal = [], this.registerAggregators(), this.dataConfig = dataConfig,
10
- this.sortRules = this.dataConfig.sortRules, this.aggregationRules = this.dataConfig.aggregationRules,
11
- this.derivedFieldRules = this.dataConfig.derivedFieldRules, this.mappingRules = this.dataConfig.mappingRules,
12
- this.totals = dataConfig.totals, this.rows = rows, this.columns = columns, this.indicators = indicators,
13
- 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 : "总计",
14
- 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 : "小计",
15
- 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 : "总计",
16
- 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 : "小计",
17
- this.rowsIsTotal = new Array(this.rows.length).fill(!1), this.colsIsTotal = new Array(this.columns.length).fill(!1);
18
- 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++) {
17
+ this.rowsIsTotal = [], this.colsIsTotal = [], this.collectedValues = {}, this.registerAggregators(),
18
+ this.dataConfig = dataConfig, this.sortRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.sortRules,
19
+ this.aggregationRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.aggregationRules,
20
+ this.derivedFieldRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.derivedFieldRules,
21
+ this.mappingRules = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.mappingRules,
22
+ this.totals = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals,
23
+ 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 : "总计",
24
+ this.colSubTotalLabel = null !== (_l = null === (_k = null === (_j = this.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.subTotalLabel) && void 0 !== _l ? _l : "小计",
25
+ this.rowGrandTotalLabel = null !== (_p = null === (_o = null === (_m = this.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.grandTotalLabel) && void 0 !== _p ? _p : "总计",
26
+ this.rowSubTotalLabel = null !== (_s = null === (_r = null === (_q = this.totals) || void 0 === _q ? void 0 : _q.row) || void 0 === _r ? void 0 : _r.subTotalLabel) && void 0 !== _s ? _s : "小计",
27
+ this.collectValuesBy = null !== (_u = null === (_t = this.dataConfig) || void 0 === _t ? void 0 : _t.collectValuesBy) && void 0 !== _u ? _u : {
28
+ 230417170554008: {
29
+ by: [ "230417171050031", "230417171050028" ]
30
+ }
31
+ }, this.rowsIsTotal = new Array(this.rows.length).fill(!1), this.colsIsTotal = new Array(this.columns.length).fill(!1);
32
+ 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++) {
19
33
  const dimension = this.totals.row.subTotalsDimensions[i], dimensionIndex = this.rows.indexOf(dimension);
20
34
  this.rowsIsTotal[dimensionIndex] = !0;
21
35
  }
22
- 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++) {
36
+ 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++) {
23
37
  const dimension = this.totals.column.subTotalsDimensions[i], dimensionIndex = this.columns.indexOf(dimension);
24
38
  this.colsIsTotal[dimensionIndex] = !0;
25
39
  }
26
40
  if (records) {
27
41
  this.records = records;
28
42
  const t0 = "undefined" != typeof window ? window.performance.now() : 0;
29
- this.setRecords(records);
43
+ this.setRecords(records), this.processCollectedValuesWithSumBy();
30
44
  const t1 = "undefined" != typeof window ? window.performance.now() : 0;
31
45
  console.log("processRecords:", t1 - t0);
32
46
  const t4 = "undefined" != typeof window ? window.performance.now() : 0;
@@ -38,36 +52,53 @@ export class Dataset {
38
52
  const t3 = "undefined" != typeof window ? window.performance.now() : 0;
39
53
  console.log("sortKeys:", t3 - t2);
40
54
  const t7 = "undefined" != typeof window ? window.performance.now() : 0;
41
- 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)),
42
- 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));
55
+ 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)),
56
+ 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));
43
57
  const t8 = "undefined" != typeof window ? window.performance.now() : 0;
44
- console.log("TreeToArr:", t8 - t7);
58
+ console.log("TreeToArr:", t8 - t7), this.dataConfig.isPivotChart && this.dealWithZeroAlign();
45
59
  }
46
- delete this.rowFlatKeys, delete this.colFlatKeys;
47
60
  }
48
61
  registerAggregator(type, aggregator) {
49
62
  this.aggregators[type] = aggregator;
50
63
  }
51
64
  registerAggregators() {
52
- this.registerAggregator(AggregationType.SUM, SumAggregator), this.registerAggregator(AggregationType.COUNT, CountAggregator),
53
- this.registerAggregator(AggregationType.MAX, MaxAggregator), this.registerAggregator(AggregationType.MIN, MinAggregator),
54
- this.registerAggregator(AggregationType.AVG, AvgAggregator);
65
+ this.registerAggregator(AggregationType.RECORD, RecordAggregator), this.registerAggregator(AggregationType.SUM, SumAggregator),
66
+ this.registerAggregator(AggregationType.COUNT, CountAggregator), this.registerAggregator(AggregationType.MAX, MaxAggregator),
67
+ this.registerAggregator(AggregationType.MIN, MinAggregator), this.registerAggregator(AggregationType.AVG, AvgAggregator);
55
68
  }
56
69
  setRecords(records) {
57
70
  this.processRecords();
58
71
  }
72
+ processCollectedValuesWithSumBy() {
73
+ var _a;
74
+ 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]) {
75
+ 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);
76
+ this.collectedValues[field][byKeys] = {}, this.collectedValues[field][byKeys].max = max,
77
+ this.collectedValues[field][byKeys].min = min;
78
+ }
79
+ }
59
80
  processRecords() {
81
+ var _a, _b;
82
+ let isNeedFilter = !1;
83
+ (null === (_b = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules) || void 0 === _b ? void 0 : _b.length) >= 1 && (isNeedFilter = !0);
60
84
  for (let i = 0, len = this.records.length; i < len; i++) {
61
85
  const record = this.records[i];
62
- this.filterRecord(record) && this.processRecord(record);
86
+ isNeedFilter && !this.filterRecord(record) || this.processRecord(record);
63
87
  }
88
+ this.rowFlatKeys = {}, this.colFlatKeys = {};
64
89
  }
65
90
  filterRecord(record) {
66
91
  var _a, _b;
67
92
  let isReserved = !0;
68
- for (let i = 0; i < (null === (_a = this.dataConfig.filterRules) || void 0 === _a ? void 0 : _a.length); i++) {
69
- const filterRule = this.dataConfig.filterRules[i];
70
- if (!(null === (_b = filterRule.filterFunc) || void 0 === _b ? void 0 : _b.call(filterRule, record))) {
93
+ for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
94
+ const filterRule = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules[i];
95
+ if (filterRule.filterKey) {
96
+ const filterValue = record[filterRule.filterKey];
97
+ if (-1 === filterRule.filteredValues.indexOf(filterValue)) {
98
+ isReserved = !1;
99
+ break;
100
+ }
101
+ } else if (!(null === (_b = filterRule.filterFunc) || void 0 === _b ? void 0 : _b.call(filterRule, record))) {
71
102
  isReserved = !1;
72
103
  break;
73
104
  }
@@ -75,7 +106,7 @@ export class Dataset {
75
106
  return isReserved;
76
107
  }
77
108
  processRecord(record) {
78
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
109
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
79
110
  null === (_a = this.derivedFieldRules) || void 0 === _a || _a.forEach(((derivedFieldRule, i) => {
80
111
  record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
81
112
  }));
@@ -88,30 +119,47 @@ export class Dataset {
88
119
  const colAttr = this.columns[n];
89
120
  colKey.push(record[colAttr]);
90
121
  }
122
+ for (const field in this.collectValuesBy) if (record[field]) {
123
+ this.collectedValues[field] || (this.collectedValues[field] = {});
124
+ const collectKeys = this.collectValuesBy[field].by.map((byField => record[byField])).join(this.stringJoinChar);
125
+ if (this.collectedValues[field][collectKeys] || (this.collectValuesBy[field].sumBy ? this.collectedValues[field][collectKeys] = {} : this.collectValuesBy[field].range ? this.collectedValues[field][collectKeys] = {
126
+ min: Number.MAX_SAFE_INTEGER,
127
+ max: Number.MIN_SAFE_INTEGER
128
+ } : this.collectedValues[field][collectKeys] = new Set), this.collectValuesBy[field].sumBy) {
129
+ const sumByKeys = this.collectValuesBy[field].sumBy.map((byField => record[byField])).join(this.stringJoinChar);
130
+ this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new this.aggregators[AggregationType.SUM](field)),
131
+ this.collectedValues[field][collectKeys][sumByKeys].push(record);
132
+ } else if (this.collectValuesBy[field].range) {
133
+ const fieldRange = this.collectedValues[field][collectKeys];
134
+ fieldRange.max = Math.max(record[field], fieldRange.max), fieldRange.min = Math.min(record[field], fieldRange.min);
135
+ } else {
136
+ this.collectedValues[field][collectKeys].add(record[field]);
137
+ }
138
+ }
91
139
  const flatRowKey = rowKey.join(this.stringJoinChar), flatColKey = colKey.join(this.stringJoinChar);
92
140
  if (0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
93
141
  this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
94
142
  this.colFlatKeys[flatColKey] = 1)), 0 !== colKey.length || 0 !== rowKey.length) {
95
143
  this.tree[flatRowKey] || (this.tree[flatRowKey] = {}), (null === (_b = this.tree[flatRowKey]) || void 0 === _b ? void 0 : _b[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
96
- for (let i = 0; i < this.indicators.length; i++) {
97
- if (!(null === (_d = null === (_c = this.tree[flatRowKey]) || void 0 === _c ? void 0 : _c[flatColKey]) || void 0 === _d ? void 0 : _d[i])) {
98
- const aggRule = this.getAggregatorRule(this.indicators[i]);
99
- this.tree[flatRowKey][flatColKey][i] = new this.aggregators[null !== (_e = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _e ? _e : AggregationType.SUM](null !== (_f = null == aggRule ? void 0 : aggRule.field) && void 0 !== _f ? _f : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
100
- }
101
- null === (_h = null === (_g = this.tree[flatRowKey]) || void 0 === _g ? void 0 : _g[flatColKey]) || void 0 === _h || _h[i].push(record);
144
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
145
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
146
+ 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 : AggregationType.SUM](null !== (_f = null == aggRule ? void 0 : aggRule.field) && void 0 !== _f ? _f : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun)),
147
+ null == aggRule ? void 0 : aggRule.field) if ("string" == typeof (null == aggRule ? void 0 : aggRule.field)) 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 {
148
+ (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));
149
+ } else 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));
102
150
  }
103
151
  }
104
- if (this.mappingRules) for (let i = 0; i < this.indicators.length; i++) {
152
+ if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
105
153
  if (!this.indicatorStatistics[i]) {
106
- const aggRule = this.getAggregatorRule(this.indicators[i]);
154
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
107
155
  this.indicatorStatistics[i] = {
108
- max: new this.aggregators[AggregationType.MAX](this.indicators[i]),
109
- min: new this.aggregators[AggregationType.MIN](this.indicators[i]),
110
- total: new this.aggregators[null !== (_j = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _j ? _j : AggregationType.SUM](null !== (_k = null == aggRule ? void 0 : aggRule.field) && void 0 !== _k ? _k : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun)
156
+ max: new this.aggregators[AggregationType.MAX](this.indicatorKeys[i]),
157
+ min: new this.aggregators[AggregationType.MIN](this.indicatorKeys[i]),
158
+ total: new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun)
111
159
  };
112
160
  }
113
- 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()),
114
- 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()),
161
+ 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()),
162
+ 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()),
115
163
  this.indicatorStatistics[i].total.push(record);
116
164
  }
117
165
  }
@@ -120,13 +168,17 @@ export class Dataset {
120
168
  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)),
121
169
  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));
122
170
  }
171
+ updateFilterRules(filterRules, isResetTree = !1) {
172
+ 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();
173
+ this.collectedValues = {}, this.processRecords(), this.processCollectedValuesWithSumBy();
174
+ }
123
175
  getAggregatorRule(indicatorKey) {
124
176
  var _a;
125
177
  return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
126
178
  }
127
179
  getAggregator(rowKey = [], colKey = [], indicator) {
128
180
  var _a, _b;
129
- const indicatorIndex = this.indicators.indexOf(indicator);
181
+ const indicatorIndex = this.indicatorKeys.indexOf(indicator);
130
182
  let agg, flatRowKey, flatColKey;
131
183
  return flatRowKey = "string" == typeof rowKey ? rowKey : rowKey.join(this.stringJoinChar),
132
184
  flatColKey = "string" == typeof colKey ? colKey : colKey.join(this.stringJoinChar),
@@ -135,7 +187,8 @@ export class Dataset {
135
187
  className: "",
136
188
  push() {},
137
189
  value: () => null,
138
- formatValue: () => ""
190
+ formatValue: () => "",
191
+ reset() {}
139
192
  };
140
193
  }
141
194
  sortKeys() {
@@ -243,10 +296,10 @@ export class Dataset {
243
296
  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 : "小计");
244
297
  const flatColTotalKey = colTotalKey.join(this.stringJoinChar);
245
298
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
246
- for (let i = 0; i < this.indicators.length; i++) {
299
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
247
300
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
248
- const aggRule = this.getAggregatorRule(this.indicators[i]);
249
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
301
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
302
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
250
303
  }
251
304
  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]);
252
305
  }
@@ -255,10 +308,10 @@ export class Dataset {
255
308
  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) {
256
309
  const flatColTotalKey = that.colGrandTotalLabel;
257
310
  this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
258
- for (let i = 0; i < this.indicators.length; i++) {
311
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
259
312
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
260
- const aggRule = this.getAggregatorRule(this.indicators[i]);
261
- this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
313
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
314
+ this.tree[flatRowKey][flatColTotalKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
262
315
  }
263
316
  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]);
264
317
  }
@@ -277,29 +330,29 @@ export class Dataset {
277
330
  if (this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
278
331
  !this.tree[flatRowTotalKey][flatColKey]) {
279
332
  this.tree[flatRowTotalKey][flatColKey] = [];
280
- for (let i = 0; i < this.indicators.length; i++) {
333
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
281
334
  if (!this.tree[flatRowTotalKey][flatColKey][i]) {
282
- const aggRule = this.getAggregatorRule(this.indicators[i]);
283
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
335
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
336
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_g = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _g ? _g : AggregationType.SUM](null !== (_h = null == aggRule ? void 0 : aggRule.field) && void 0 !== _h ? _h : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
284
337
  }
285
338
  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]);
286
339
  }
287
340
  }
288
341
  }
289
- 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) {
290
- const flatRowTotalKey = that.rowGrandTotalLabel;
291
- this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
292
- this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
293
- for (let i = 0; i < this.indicators.length; i++) {
294
- if (!this.tree[flatRowTotalKey][flatColKey][i]) {
295
- const aggRule = this.getAggregatorRule(this.indicators[i]);
296
- this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicators[i], null == aggRule ? void 0 : aggRule.formatFun);
297
- }
298
- 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]);
342
+ }
343
+ 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) {
344
+ const flatRowTotalKey = that.rowGrandTotalLabel;
345
+ this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
346
+ this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
347
+ for (let i = 0; i < this.indicatorKeys.length; i++) {
348
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) {
349
+ const aggRule = this.getAggregatorRule(this.indicatorKeys[i]);
350
+ this.tree[flatRowTotalKey][flatColKey][i] = new this.aggregators[null !== (_o = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _o ? _o : AggregationType.SUM](null !== (_p = null == aggRule ? void 0 : aggRule.field) && void 0 !== _p ? _p : this.indicatorKeys[i], null == aggRule ? void 0 : aggRule.formatFun);
299
351
  }
352
+ 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]);
300
353
  }
301
- colCompute(flatRowKey, flatColKey);
302
354
  }
355
+ colCompute(flatRowKey, flatColKey);
303
356
  }));
304
357
  })), rowTotalKeys.forEach((flatRowKey => {
305
358
  Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
@@ -320,33 +373,33 @@ export class Dataset {
320
373
  if (!item) {
321
374
  if (item = {
322
375
  id: flatKey,
323
- child: []
376
+ children: []
324
377
  }, subTotalFlags[index]) {
325
- let curChild = item.child;
378
+ let curChild = item.children;
326
379
  for (let i = index; i < list.length - 1; i++) {
327
380
  const totalChild = {
328
381
  id: `${flatKey}${concatStr}${subTotalLabel}`,
329
- child: []
382
+ children: []
330
383
  };
331
- curChild.push(totalChild), curChild = totalChild.child;
384
+ curChild.push(totalChild), curChild = totalChild.children;
332
385
  }
333
386
  }
334
- map.set(flatKey, item), node ? subTotalFlags[index - 1] ? node.child.splice(node.child.length - 1, 0, item) : node.child.push(item) : result.push(item);
387
+ map.set(flatKey, item), node ? subTotalFlags[index - 1] ? node.children.splice(node.children.length - 1, 0, item) : node.children.push(item) : result.push(item);
335
388
  }
336
389
  node = item;
337
390
  }));
338
391
  }(item))), isGrandTotal) {
339
392
  const node = {
340
393
  id: grandTotalLabel,
341
- child: []
394
+ children: []
342
395
  };
343
- let curChild = node.child;
396
+ let curChild = node.children;
344
397
  for (let i = 1; i < subTotalFlags.length; i++) {
345
398
  const totalChild = {
346
399
  id: grandTotalLabel,
347
- child: []
400
+ children: []
348
401
  };
349
- curChild.push(totalChild), curChild = totalChild.child;
402
+ curChild.push(totalChild), curChild = totalChild.children;
350
403
  }
351
404
  result.push(node);
352
405
  }
@@ -356,127 +409,48 @@ export class Dataset {
356
409
  const result = [];
357
410
  function getPath(node, arr) {
358
411
  var _a;
359
- arr.push(node.id), node.child.length > 0 ? null === (_a = node.child) || void 0 === _a || _a.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
412
+ arr.push(node.id), node.children.length > 0 ? null === (_a = node.children) || void 0 === _a || _a.forEach((childItem => getPath(childItem, [ ...arr ]))) : result.push(arr);
360
413
  }
361
414
  return tree.forEach((treeNode => getPath(treeNode, []))), result;
362
415
  }
363
- }
364
-
365
- class Aggregator {
366
- constructor(dimension, formatFun, isRecord) {
367
- this.className = "Aggregator", this.isRecord = !0, this.records = [], this.field = dimension,
368
- this.formatFun = formatFun, this.isRecord = null != isRecord ? isRecord : this.isRecord;
369
- }
370
- formatValue() {
371
- return this._formatedValue || (this.formatFun ? this._formatedValue = this.formatFun(this.value()) : this._formatedValue = this.value()),
372
- this._formatedValue;
373
- }
374
- }
375
-
376
- class SumAggregator extends Aggregator {
377
- constructor() {
378
- super(...arguments), this.type = AggregationType.SUM, this.sum = 0;
379
- }
380
- push(record) {
381
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
382
- "Aggregator" === record.className ? this.sum += record.value() : isNaN(parseFloat(record[this.field])) || (this.sum += parseFloat(record[this.field]));
383
- }
384
- value() {
385
- return this.sum;
386
- }
387
- }
388
-
389
- class CountAggregator extends Aggregator {
390
- constructor() {
391
- super(...arguments), this.type = AggregationType.COUNT, this.count = 0;
392
- }
393
- push(record) {
394
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
395
- "Aggregator" === record.className ? this.count += record.value() : this.count++;
396
- }
397
- value() {
398
- return this.count;
399
- }
400
- }
401
-
402
- class AvgAggregator extends Aggregator {
403
- constructor() {
404
- super(...arguments), this.type = AggregationType.AVG, this.sum = 0, this.count = 0;
405
- }
406
- push(record) {
407
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
408
- "Aggregator" === record.className && record.type === AggregationType.AVG ? (this.sum += record.sum,
409
- this.count += record.count) : isNaN(parseFloat(record[this.field])) || (this.sum += parseFloat(record[this.field]),
410
- this.count++);
411
- }
412
- value() {
413
- return this.sum / this.count;
414
- }
415
- }
416
-
417
- class MaxAggregator extends Aggregator {
418
- constructor() {
419
- super(...arguments), this.type = AggregationType.MAX, this.max = Number.MIN_SAFE_INTEGER,
420
- this.isRecord = !1;
421
- }
422
- push(record) {
423
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
424
- "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);
425
- }
426
- value() {
427
- return this.max;
428
- }
429
- }
430
-
431
- class MinAggregator extends Aggregator {
432
- constructor() {
433
- super(...arguments), this.type = AggregationType.MIN, this.min = Number.MAX_SAFE_INTEGER,
434
- this.isRecord = !1;
435
- }
436
- push(record) {
437
- this.isRecord && ("Aggregator" === record.className ? this.records.push(...record.records) : this.records.push(record)),
438
- "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);
416
+ TreeToArr2(tree) {
417
+ const result = [];
418
+ function getPath(node, arr) {
419
+ var _a, _b;
420
+ arr.push(arr.length > 0 ? [ arr[arr.length - 1], node.value ].join(String.fromCharCode(0)) : node.value),
421
+ (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);
422
+ }
423
+ return tree.forEach((treeNode => getPath(treeNode, []))), result;
439
424
  }
440
- value() {
441
- return this.min;
425
+ dealWithZeroAlign() {
426
+ const indicatorsToAlign = [];
427
+ for (let i = 0; i < this.aggregationRules.length; i++) {
428
+ const rule = this.aggregationRules[i];
429
+ isArray(rule.field) && 2 === rule.field.length && indicatorsToAlign.push(rule.field);
430
+ }
431
+ indicatorsToAlign.forEach((indicatorToAlign => {
432
+ const indicator1 = indicatorToAlign[0], indicator2 = indicatorToAlign[1], collectedValue1 = this.collectedValues[indicator1], collectedValue2 = this.collectedValues[indicator2];
433
+ this.collectedValues[indicator1 + "_align"] = {}, this.collectedValues[indicator2 + "_align"] = {};
434
+ for (const key in collectedValue1) {
435
+ const range1 = collectedValue1[key], range2 = collectedValue2[key], newRanges = getNewRangeToAlign(range1, range2);
436
+ if (newRanges) {
437
+ const {range1: newRange1, range2: newRange2} = newRanges;
438
+ this.collectedValues[indicator1 + "_align"][key] = {
439
+ min: newRange1[0],
440
+ max: newRange1[1]
441
+ }, this.collectedValues[indicator2 + "_align"][key] = {
442
+ min: newRange2[0],
443
+ max: newRange2[1]
444
+ };
445
+ } else this.collectedValues[indicator1 + "_align"][key] = {
446
+ min: range1.min,
447
+ max: range1.max
448
+ }, this.collectedValues[indicator2 + "_align"][key] = {
449
+ min: range2.min,
450
+ max: range2.max
451
+ };
452
+ }
453
+ }));
442
454
  }
443
455
  }
444
-
445
- function indicatorSort(a, b) {
446
- return a && b ? a.toString().localeCompare(b.toString(), "zh") : a ? 1 : -1;
447
- }
448
-
449
- function typeSort(a, b) {
450
- return a && b ? a.toString().localeCompare(b.toString(), "zh") : a ? 1 : -1;
451
- }
452
-
453
- function naturalSort(as, bs) {
454
- const rx = /(\d+)|(\D+)/g, rd = /\d/, rz = /^0/;
455
- let a, a1, b, b1, nas = 0, nbs = 0;
456
- if (null !== bs && null === as) return -1;
457
- if (null !== as && null === bs) return 1;
458
- if ("number" == typeof as && isNaN(as)) return -1;
459
- if ("number" == typeof bs && isNaN(bs)) return 1;
460
- if (nas = +as, nbs = +bs, nas < nbs) return -1;
461
- if (nas > nbs) return 1;
462
- if ("number" == typeof as && "number" != typeof bs) return -1;
463
- if ("number" == typeof bs && "number" != typeof as) return 1;
464
- if ("number" == typeof as && "number" == typeof bs) return 0;
465
- if (isNaN(nbs) && !isNaN(nas)) return -1;
466
- if (isNaN(nas) && !isNaN(nbs)) return 1;
467
- if (a = String(as), b = String(bs), a === b) return 0;
468
- if (!rd.test(a) || !rd.test(b)) return a > b ? 1 : -1;
469
- for (a = a.match(rx), b = b.match(rx); a.length && b.length; ) if (a1 = a.shift(),
470
- b1 = b.shift(), a1 !== b1) return rd.test(a1) && rd.test(b1) ? a1.replace(rz, ".0") - b1.replace(rz, ".0") : a1 > b1 ? 1 : -1;
471
- return a.length - b.length;
472
- }
473
-
474
- function sortBy(order) {
475
- let x;
476
- const mapping = {}, lowercase_mapping = {};
477
- for (let i = 0; i < order.length; i++) x = order[i], mapping[x] = i, "string" == typeof x && (lowercase_mapping[x.toLowerCase()] = i);
478
- return function(a, b) {
479
- 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);
480
- };
481
- }
482
456
  //# sourceMappingURL=dataset.js.map