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