@visactor/vtable 1.26.6 → 1.26.8

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 (367) hide show
  1. package/cjs/ListTable-all.js +5 -5
  2. package/cjs/ListTable-all.js.map +1 -1
  3. package/cjs/ListTable.d.ts +2 -2
  4. package/cjs/ListTable.js +26 -16
  5. package/cjs/ListTable.js.map +1 -1
  6. package/cjs/PivotChart.js +21 -20
  7. package/cjs/PivotChart.js.map +1 -1
  8. package/cjs/PivotTable-all.js +4 -3
  9. package/cjs/PivotTable-all.js.map +1 -1
  10. package/cjs/PivotTable.d.ts +1 -1
  11. package/cjs/PivotTable.js +65 -63
  12. package/cjs/PivotTable.js.map +1 -1
  13. package/cjs/body-helper/body-helper.d.ts +1 -1
  14. package/cjs/body-helper/body-helper.js +3 -1
  15. package/cjs/body-helper/body-helper.js.map +1 -1
  16. package/cjs/components/index.js +1 -2
  17. package/cjs/components/tooltip/TooltipHandler.d.ts +4 -0
  18. package/cjs/components/tooltip/TooltipHandler.js +32 -7
  19. package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
  20. package/cjs/core/BaseTable.js +8 -5
  21. package/cjs/core/BaseTable.js.map +1 -1
  22. package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
  23. package/cjs/core/TABLE_EVENT_TYPE.js +1 -0
  24. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  25. package/cjs/core/record-helper.d.ts +1 -1
  26. package/cjs/core/record-helper.js +60 -12
  27. package/cjs/core/record-helper.js.map +1 -1
  28. package/cjs/data/DataSource.d.ts +3 -1
  29. package/cjs/data/DataSource.js +70 -21
  30. package/cjs/data/DataSource.js.map +1 -1
  31. package/cjs/dataset/dataset.d.ts +9 -1
  32. package/cjs/dataset/dataset.js +344 -187
  33. package/cjs/dataset/dataset.js.map +1 -1
  34. package/cjs/event/event.d.ts +94 -8
  35. package/cjs/event/event.js +697 -190
  36. package/cjs/event/event.js.map +1 -1
  37. package/cjs/event/media-click.js +147 -12
  38. package/cjs/event/media-click.js.map +1 -1
  39. package/cjs/event/sparkline-event.js +1 -2
  40. package/cjs/event/util.js +1 -1
  41. package/cjs/event/util.js.map +1 -1
  42. package/cjs/header-helper/header-helper.js +3 -1
  43. package/cjs/header-helper/header-helper.js.map +1 -1
  44. package/cjs/index.d.ts +3 -3
  45. package/cjs/index.js +1 -1
  46. package/cjs/index.js.map +1 -1
  47. package/cjs/layout/pivot-header-layout.js +33 -17
  48. package/cjs/layout/pivot-header-layout.js.map +1 -1
  49. package/cjs/scenegraph/group-creater/cell-helper.d.ts +4 -2
  50. package/cjs/scenegraph/group-creater/cell-helper.js +93 -51
  51. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  52. package/cjs/scenegraph/group-creater/cell-type/audio-cell.d.ts +7 -0
  53. package/cjs/scenegraph/group-creater/cell-type/audio-cell.js +83 -0
  54. package/cjs/scenegraph/group-creater/cell-type/audio-cell.js.map +1 -0
  55. package/cjs/scenegraph/group-creater/cell-type/button-cell.d.ts +1 -1
  56. package/cjs/scenegraph/group-creater/cell-type/button-cell.js +5 -4
  57. package/cjs/scenegraph/group-creater/cell-type/button-cell.js.map +1 -1
  58. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +2 -2
  59. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  60. package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.d.ts +1 -1
  61. package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js +5 -4
  62. package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
  63. package/cjs/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
  64. package/cjs/scenegraph/group-creater/cell-type/image-cell.js +43 -15
  65. package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  66. package/cjs/scenegraph/group-creater/cell-type/index.d.ts +1 -0
  67. package/cjs/scenegraph/group-creater/cell-type/index.js +8 -2
  68. package/cjs/scenegraph/group-creater/cell-type/index.js.map +1 -1
  69. package/cjs/scenegraph/group-creater/cell-type/media-cell-helper.d.ts +13 -0
  70. package/cjs/scenegraph/group-creater/cell-type/media-cell-helper.js +64 -0
  71. package/cjs/scenegraph/group-creater/cell-type/media-cell-helper.js.map +1 -0
  72. package/cjs/scenegraph/group-creater/cell-type/radio-cell.d.ts +1 -1
  73. package/cjs/scenegraph/group-creater/cell-type/radio-cell.js +23 -7
  74. package/cjs/scenegraph/group-creater/cell-type/radio-cell.js.map +1 -1
  75. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +1 -1
  76. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +6 -5
  77. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  78. package/cjs/scenegraph/group-creater/cell-type/switch-cell.d.ts +1 -1
  79. package/cjs/scenegraph/group-creater/cell-type/switch-cell.js +5 -4
  80. package/cjs/scenegraph/group-creater/cell-type/switch-cell.js.map +1 -1
  81. package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  82. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +14 -10
  83. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  84. package/cjs/scenegraph/group-creater/cell-type/video-cell.d.ts +1 -1
  85. package/cjs/scenegraph/group-creater/cell-type/video-cell.js +44 -23
  86. package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  87. package/cjs/scenegraph/group-creater/column-helper.js +14 -7
  88. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  89. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +17 -4
  90. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  91. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -0
  92. package/cjs/scenegraph/group-creater/progress/proxy.js +11 -5
  93. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  94. package/cjs/scenegraph/icon/icon-update.js +1 -0
  95. package/cjs/scenegraph/icon/icon-update.js.map +1 -1
  96. package/cjs/scenegraph/layout/compute-col-width.js +14 -4
  97. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  98. package/cjs/scenegraph/layout/compute-row-height.js +29 -8
  99. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  100. package/cjs/scenegraph/layout/update-height.d.ts +4 -3
  101. package/cjs/scenegraph/layout/update-height.js +44 -30
  102. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  103. package/cjs/scenegraph/layout/update-width.d.ts +2 -1
  104. package/cjs/scenegraph/layout/update-width.js +50 -38
  105. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  106. package/cjs/scenegraph/scenegraph.d.ts +3 -2
  107. package/cjs/scenegraph/scenegraph.js +60 -52
  108. package/cjs/scenegraph/scenegraph.js.map +1 -1
  109. package/cjs/scenegraph/stick-text/index.js +46 -20
  110. package/cjs/scenegraph/stick-text/index.js.map +1 -1
  111. package/cjs/scenegraph/utils/corner-custom-merge.d.ts +10 -0
  112. package/cjs/scenegraph/utils/corner-custom-merge.js +68 -0
  113. package/cjs/scenegraph/utils/corner-custom-merge.js.map +1 -0
  114. package/cjs/scenegraph/utils/deal-promise-data.d.ts +1 -1
  115. package/cjs/scenegraph/utils/deal-promise-data.js +2 -2
  116. package/cjs/scenegraph/utils/deal-promise-data.js.map +1 -1
  117. package/cjs/state/cell-move/index.js +6 -3
  118. package/cjs/state/cell-move/index.js.map +1 -1
  119. package/cjs/state/checkbox/checkbox.d.ts +3 -1
  120. package/cjs/state/checkbox/checkbox.js +53 -34
  121. package/cjs/state/checkbox/checkbox.js.map +1 -1
  122. package/cjs/state/radio/radio.d.ts +3 -1
  123. package/cjs/state/radio/radio.js +69 -12
  124. package/cjs/state/radio/radio.js.map +1 -1
  125. package/cjs/state/resize/update-resize-column.js +25 -13
  126. package/cjs/state/resize/update-resize-column.js.map +1 -1
  127. package/cjs/state/resize/update-resize-row.js +24 -12
  128. package/cjs/state/resize/update-resize-row.js.map +1 -1
  129. package/cjs/state/state.d.ts +3 -2
  130. package/cjs/state/state.js +6 -3
  131. package/cjs/state/state.js.map +1 -1
  132. package/cjs/themes.d.ts +4 -2
  133. package/cjs/themes.js +12 -4
  134. package/cjs/themes.js.map +1 -1
  135. package/cjs/tools/get-data-path/create-dataset.js +4 -4
  136. package/cjs/tools/get-data-path/create-dataset.js.map +1 -1
  137. package/cjs/tools/get-data-path/index.js +4 -4
  138. package/cjs/tools/get-data-path/index.js.map +1 -1
  139. package/cjs/tools/media.d.ts +1 -0
  140. package/cjs/tools/media.js +19 -0
  141. package/cjs/tools/media.js.map +1 -0
  142. package/cjs/tools/style.d.ts +3 -1
  143. package/cjs/tools/style.js +2 -2
  144. package/cjs/tools/style.js.map +1 -1
  145. package/cjs/ts-types/base-table.d.ts +1 -0
  146. package/cjs/ts-types/base-table.js.map +1 -1
  147. package/cjs/ts-types/column/type.d.ts +2 -2
  148. package/cjs/ts-types/column/type.js.map +1 -1
  149. package/cjs/ts-types/common.d.ts +1 -0
  150. package/cjs/ts-types/common.js.map +1 -1
  151. package/cjs/ts-types/dataset/aggregation.d.ts +1 -0
  152. package/cjs/ts-types/dataset/aggregation.js +21 -3
  153. package/cjs/ts-types/dataset/aggregation.js.map +1 -1
  154. package/cjs/ts-types/events.d.ts +3 -1
  155. package/cjs/ts-types/events.js.map +1 -1
  156. package/cjs/ts-types/icon.d.ts +1 -0
  157. package/cjs/ts-types/icon.js.map +1 -1
  158. package/cjs/ts-types/list-table/define/image-define.d.ts +10 -0
  159. package/cjs/ts-types/list-table/define/image-define.js.map +1 -1
  160. package/cjs/ts-types/list-table/define/index.d.ts +5 -4
  161. package/cjs/ts-types/list-table/define/index.js.map +1 -1
  162. package/cjs/ts-types/list-table/layout-map/api.d.ts +4 -4
  163. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  164. package/cjs/ts-types/list-table/layout-map/index.d.ts +1 -1
  165. package/cjs/ts-types/list-table/layout-map/index.js.map +1 -1
  166. package/cjs/ts-types/menu.d.ts +12 -0
  167. package/cjs/ts-types/menu.js.map +1 -1
  168. package/cjs/ts-types/new-data-set.d.ts +1 -0
  169. package/cjs/ts-types/new-data-set.js.map +1 -1
  170. package/cjs/ts-types/pivot-table/dimension/image-dimension.d.ts +5 -0
  171. package/cjs/ts-types/pivot-table/dimension/image-dimension.js.map +1 -1
  172. package/cjs/ts-types/pivot-table/dimension/index.d.ts +5 -3
  173. package/cjs/ts-types/pivot-table/dimension/index.js.map +1 -1
  174. package/cjs/ts-types/pivot-table/indicator/image-indicator.d.ts +10 -0
  175. package/cjs/ts-types/pivot-table/indicator/image-indicator.js.map +1 -1
  176. package/cjs/ts-types/pivot-table/indicator/index.d.ts +3 -3
  177. package/cjs/ts-types/pivot-table/indicator/index.js.map +1 -1
  178. package/cjs/ts-types/table-engine.d.ts +9 -5
  179. package/cjs/ts-types/table-engine.js.map +1 -1
  180. package/cjs/ts-types/tooltip.d.ts +1 -0
  181. package/cjs/ts-types/tooltip.js.map +1 -1
  182. package/cjs/vrender.js.map +1 -1
  183. package/dist/vtable.js +3346 -1099
  184. package/dist/vtable.min.js +1 -1
  185. package/es/ListTable-all.js +4 -4
  186. package/es/ListTable-all.js.map +1 -1
  187. package/es/ListTable.d.ts +2 -2
  188. package/es/ListTable.js +26 -18
  189. package/es/ListTable.js.map +1 -1
  190. package/es/PivotChart.js +20 -20
  191. package/es/PivotChart.js.map +1 -1
  192. package/es/PivotTable-all.js +4 -4
  193. package/es/PivotTable-all.js.map +1 -1
  194. package/es/PivotTable.d.ts +1 -1
  195. package/es/PivotTable.js +65 -63
  196. package/es/PivotTable.js.map +1 -1
  197. package/es/body-helper/body-helper.d.ts +1 -1
  198. package/es/body-helper/body-helper.js +3 -1
  199. package/es/body-helper/body-helper.js.map +1 -1
  200. package/es/components/index.js +1 -2
  201. package/es/components/tooltip/TooltipHandler.d.ts +4 -0
  202. package/es/components/tooltip/TooltipHandler.js +32 -7
  203. package/es/components/tooltip/TooltipHandler.js.map +1 -1
  204. package/es/core/BaseTable.js +8 -5
  205. package/es/core/BaseTable.js.map +1 -1
  206. package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
  207. package/es/core/TABLE_EVENT_TYPE.js +1 -0
  208. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  209. package/es/core/record-helper.d.ts +1 -1
  210. package/es/core/record-helper.js +60 -12
  211. package/es/core/record-helper.js.map +1 -1
  212. package/es/data/DataSource.d.ts +3 -1
  213. package/es/data/DataSource.js +69 -21
  214. package/es/data/DataSource.js.map +1 -1
  215. package/es/dataset/dataset.d.ts +9 -1
  216. package/es/dataset/dataset.js +341 -187
  217. package/es/dataset/dataset.js.map +1 -1
  218. package/es/event/event.d.ts +94 -8
  219. package/es/event/event.js +695 -190
  220. package/es/event/event.js.map +1 -1
  221. package/es/event/media-click.js +150 -11
  222. package/es/event/media-click.js.map +1 -1
  223. package/es/event/sparkline-event.js +1 -2
  224. package/es/event/util.js +1 -1
  225. package/es/event/util.js.map +1 -1
  226. package/es/header-helper/header-helper.js +3 -1
  227. package/es/header-helper/header-helper.js.map +1 -1
  228. package/es/index.d.ts +3 -3
  229. package/es/index.js +1 -1
  230. package/es/index.js.map +1 -1
  231. package/es/layout/pivot-header-layout.js +29 -17
  232. package/es/layout/pivot-header-layout.js.map +1 -1
  233. package/es/scenegraph/group-creater/cell-helper.d.ts +4 -2
  234. package/es/scenegraph/group-creater/cell-helper.js +90 -49
  235. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  236. package/es/scenegraph/group-creater/cell-type/audio-cell.d.ts +7 -0
  237. package/es/scenegraph/group-creater/cell-type/audio-cell.js +89 -0
  238. package/es/scenegraph/group-creater/cell-type/audio-cell.js.map +1 -0
  239. package/es/scenegraph/group-creater/cell-type/button-cell.d.ts +1 -1
  240. package/es/scenegraph/group-creater/cell-type/button-cell.js +5 -4
  241. package/es/scenegraph/group-creater/cell-type/button-cell.js.map +1 -1
  242. package/es/scenegraph/group-creater/cell-type/chart-cell.js +2 -2
  243. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  244. package/es/scenegraph/group-creater/cell-type/checkbox-cell.d.ts +1 -1
  245. package/es/scenegraph/group-creater/cell-type/checkbox-cell.js +5 -4
  246. package/es/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
  247. package/es/scenegraph/group-creater/cell-type/image-cell.d.ts +1 -1
  248. package/es/scenegraph/group-creater/cell-type/image-cell.js +43 -14
  249. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  250. package/es/scenegraph/group-creater/cell-type/index.d.ts +1 -0
  251. package/es/scenegraph/group-creater/cell-type/index.js +6 -0
  252. package/es/scenegraph/group-creater/cell-type/index.js.map +1 -1
  253. package/es/scenegraph/group-creater/cell-type/media-cell-helper.d.ts +13 -0
  254. package/es/scenegraph/group-creater/cell-type/media-cell-helper.js +56 -0
  255. package/es/scenegraph/group-creater/cell-type/media-cell-helper.js.map +1 -0
  256. package/es/scenegraph/group-creater/cell-type/radio-cell.d.ts +1 -1
  257. package/es/scenegraph/group-creater/cell-type/radio-cell.js +23 -7
  258. package/es/scenegraph/group-creater/cell-type/radio-cell.js.map +1 -1
  259. package/es/scenegraph/group-creater/cell-type/spark-line-cell.d.ts +1 -1
  260. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +6 -5
  261. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  262. package/es/scenegraph/group-creater/cell-type/switch-cell.d.ts +1 -1
  263. package/es/scenegraph/group-creater/cell-type/switch-cell.js +5 -4
  264. package/es/scenegraph/group-creater/cell-type/switch-cell.js.map +1 -1
  265. package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  266. package/es/scenegraph/group-creater/cell-type/text-cell.js +13 -8
  267. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  268. package/es/scenegraph/group-creater/cell-type/video-cell.d.ts +1 -1
  269. package/es/scenegraph/group-creater/cell-type/video-cell.js +47 -22
  270. package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  271. package/es/scenegraph/group-creater/column-helper.js +14 -8
  272. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  273. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +17 -5
  274. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  275. package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -0
  276. package/es/scenegraph/group-creater/progress/proxy.js +11 -5
  277. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  278. package/es/scenegraph/icon/icon-update.js +1 -0
  279. package/es/scenegraph/icon/icon-update.js.map +1 -1
  280. package/es/scenegraph/layout/compute-col-width.js +14 -4
  281. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  282. package/es/scenegraph/layout/compute-row-height.js +28 -8
  283. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  284. package/es/scenegraph/layout/update-height.d.ts +4 -3
  285. package/es/scenegraph/layout/update-height.js +41 -27
  286. package/es/scenegraph/layout/update-height.js.map +1 -1
  287. package/es/scenegraph/layout/update-width.d.ts +2 -1
  288. package/es/scenegraph/layout/update-width.js +47 -35
  289. package/es/scenegraph/layout/update-width.js.map +1 -1
  290. package/es/scenegraph/scenegraph.d.ts +3 -2
  291. package/es/scenegraph/scenegraph.js +61 -52
  292. package/es/scenegraph/scenegraph.js.map +1 -1
  293. package/es/scenegraph/stick-text/index.js +46 -18
  294. package/es/scenegraph/stick-text/index.js.map +1 -1
  295. package/es/scenegraph/utils/corner-custom-merge.d.ts +10 -0
  296. package/es/scenegraph/utils/corner-custom-merge.js +59 -0
  297. package/es/scenegraph/utils/corner-custom-merge.js.map +1 -0
  298. package/es/scenegraph/utils/deal-promise-data.d.ts +1 -1
  299. package/es/scenegraph/utils/deal-promise-data.js +2 -2
  300. package/es/scenegraph/utils/deal-promise-data.js.map +1 -1
  301. package/es/state/cell-move/index.js +6 -3
  302. package/es/state/cell-move/index.js.map +1 -1
  303. package/es/state/checkbox/checkbox.d.ts +3 -1
  304. package/es/state/checkbox/checkbox.js +53 -34
  305. package/es/state/checkbox/checkbox.js.map +1 -1
  306. package/es/state/radio/radio.d.ts +3 -1
  307. package/es/state/radio/radio.js +70 -13
  308. package/es/state/radio/radio.js.map +1 -1
  309. package/es/state/resize/update-resize-column.js +19 -10
  310. package/es/state/resize/update-resize-column.js.map +1 -1
  311. package/es/state/resize/update-resize-row.js +19 -9
  312. package/es/state/resize/update-resize-row.js.map +1 -1
  313. package/es/state/state.d.ts +3 -2
  314. package/es/state/state.js +6 -2
  315. package/es/state/state.js.map +1 -1
  316. package/es/themes.d.ts +4 -2
  317. package/es/themes.js +11 -3
  318. package/es/themes.js.map +1 -1
  319. package/es/tools/get-data-path/create-dataset.js +4 -4
  320. package/es/tools/get-data-path/create-dataset.js.map +1 -1
  321. package/es/tools/get-data-path/index.js +4 -4
  322. package/es/tools/get-data-path/index.js.map +1 -1
  323. package/es/tools/media.d.ts +1 -0
  324. package/es/tools/media.js +11 -0
  325. package/es/tools/media.js.map +1 -0
  326. package/es/tools/style.d.ts +3 -1
  327. package/es/tools/style.js +2 -2
  328. package/es/tools/style.js.map +1 -1
  329. package/es/ts-types/base-table.d.ts +1 -0
  330. package/es/ts-types/base-table.js.map +1 -1
  331. package/es/ts-types/column/type.d.ts +2 -2
  332. package/es/ts-types/column/type.js.map +1 -1
  333. package/es/ts-types/common.d.ts +1 -0
  334. package/es/ts-types/common.js.map +1 -1
  335. package/es/ts-types/dataset/aggregation.d.ts +1 -0
  336. package/es/ts-types/dataset/aggregation.js +21 -3
  337. package/es/ts-types/dataset/aggregation.js.map +1 -1
  338. package/es/ts-types/events.d.ts +3 -1
  339. package/es/ts-types/events.js.map +1 -1
  340. package/es/ts-types/icon.d.ts +1 -0
  341. package/es/ts-types/icon.js.map +1 -1
  342. package/es/ts-types/list-table/define/image-define.d.ts +10 -0
  343. package/es/ts-types/list-table/define/image-define.js.map +1 -1
  344. package/es/ts-types/list-table/define/index.d.ts +5 -4
  345. package/es/ts-types/list-table/define/index.js.map +1 -1
  346. package/es/ts-types/list-table/layout-map/api.d.ts +4 -4
  347. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  348. package/es/ts-types/list-table/layout-map/index.d.ts +1 -1
  349. package/es/ts-types/list-table/layout-map/index.js.map +1 -1
  350. package/es/ts-types/menu.d.ts +12 -0
  351. package/es/ts-types/menu.js.map +1 -1
  352. package/es/ts-types/new-data-set.d.ts +1 -0
  353. package/es/ts-types/new-data-set.js.map +1 -1
  354. package/es/ts-types/pivot-table/dimension/image-dimension.d.ts +5 -0
  355. package/es/ts-types/pivot-table/dimension/image-dimension.js.map +1 -1
  356. package/es/ts-types/pivot-table/dimension/index.d.ts +5 -3
  357. package/es/ts-types/pivot-table/dimension/index.js.map +1 -1
  358. package/es/ts-types/pivot-table/indicator/image-indicator.d.ts +10 -0
  359. package/es/ts-types/pivot-table/indicator/image-indicator.js.map +1 -1
  360. package/es/ts-types/pivot-table/indicator/index.d.ts +3 -3
  361. package/es/ts-types/pivot-table/indicator/index.js.map +1 -1
  362. package/es/ts-types/table-engine.d.ts +9 -5
  363. package/es/ts-types/table-engine.js.map +1 -1
  364. package/es/ts-types/tooltip.d.ts +1 -0
  365. package/es/ts-types/tooltip.js.map +1 -1
  366. package/es/vrender.js.map +1 -1
  367. package/package.json +10 -9
@@ -12,9 +12,11 @@ class Dataset {
12
12
  this.tree = {}, this.changedTree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
13
13
  this.colKeys = [], this.rowKeys = [], this.colKeys_normal = [], this.rowKeys_normal = [],
14
14
  this.rowOrder = "key_a_to_z", this.colOrder = "key_a_to_z", this.sorted = !1, this.indicatorStatistics = [],
15
- this.stringJoinChar = String.fromCharCode(0), this.rowsIsTotal = [], this.colsIsTotal = [],
16
- this.collectedValues = {}, this.cacheCollectedValues = {}, this.totalRecordsTree = {},
17
- this.registerAggregators(), this.dataConfig = dataConfig, this.filterRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules,
15
+ this.stringJoinChar = String.fromCharCode(0), this.groupedGrandTotalKey = String.fromCharCode(1) + "vtable_grouped_grand_total",
16
+ this.groupedGrandTotalSubtotalKey = String.fromCharCode(1) + "vtable_grouped_grand_total_subtotal",
17
+ this.rowsIsTotal = [], this.colsIsTotal = [], this.collectedValues = {}, this.cacheCollectedValues = {},
18
+ this.totalRecordsTree = {}, this.registerAggregators(), this.dataConfig = dataConfig,
19
+ this.filterRules = null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.filterRules,
18
20
  this.rowHierarchyType = null != rowHierarchyType ? rowHierarchyType : "grid", this.columnHierarchyType = null != columnHierarchyType ? columnHierarchyType : "grid",
19
21
  this.sortRules = null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.sortRules,
20
22
  this.aggregationRules = null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.aggregationRules,
@@ -51,7 +53,7 @@ class Dataset {
51
53
  this.setRecords(records);
52
54
  }
53
55
  setRecords(records) {
54
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
56
+ 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, _5, _6;
55
57
  if (this.records = records, this.collectedValues = {}, this.cacheCollectedValues = {},
56
58
  this.totalRecordsTree = {}, this.tree = {}, this.colFlatKeys = {}, this.rowFlatKeys = {},
57
59
  this.colKeys = [], this.rowKeys = [], this.rowsHasValue = [], this.columnsHasValue = [],
@@ -67,10 +69,10 @@ class Dataset {
67
69
  "undefined" != typeof window && window.performance.now();
68
70
  this.sortKeys();
69
71
  "undefined" != typeof window && window.performance.now(), "undefined" != typeof window && window.performance.now();
70
- this.customRowTree ? this.rowHeaderTree = this.customRowTree : "tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, null !== (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotalsOnTop) && void 0 !== _e && _e) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showGrandTotalsOnTop) && void 0 !== _k && _k, null !== (_o = null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showSubTotalsOnTop) && void 0 !== _o && _o),
71
- this.customColTree ? this.colHeaderTree = this.customColTree : this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns.filter(((key, index) => this.columnsHasValue[index])), this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_q = null === (_p = this.totals) || void 0 === _p ? void 0 : _p.column) || void 0 === _q ? void 0 : _q.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showGrandTotalsOnLeft) && void 0 !== _t && _t, null !== (_w = null === (_v = null === (_u = this.totals) || void 0 === _u ? void 0 : _u.column) || void 0 === _v ? void 0 : _v.showSubTotalsOnLeft) && void 0 !== _w && _w);
72
+ this.customRowTree ? this.rowHeaderTree = this.customRowTree : "tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, null !== (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotalsOnTop) && void 0 !== _e && _e, null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.grandTotalDimensions, this.rowSubTotalLabel, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTop) && void 0 !== _k && _k, this.rows) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.row) || void 0 === _p ? void 0 : _p.showGrandTotalsOnTop) && void 0 !== _q && _q, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.row) || void 0 === _s ? void 0 : _s.showSubTotalsOnTop) && void 0 !== _t && _t, null === (_v = null === (_u = this.totals) || void 0 === _u ? void 0 : _u.row) || void 0 === _v ? void 0 : _v.grandTotalDimensions, !0, this.rows),
73
+ this.customColTree ? this.colHeaderTree = this.customColTree : this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns.filter(((key, index) => this.columnsHasValue[index])), this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_x = null === (_w = this.totals) || void 0 === _w ? void 0 : _w.column) || void 0 === _x ? void 0 : _x.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_0 = null === (_z = null === (_y = this.totals) || void 0 === _y ? void 0 : _y.column) || void 0 === _z ? void 0 : _z.showGrandTotalsOnLeft) && void 0 !== _0 && _0, null !== (_3 = null === (_2 = null === (_1 = this.totals) || void 0 === _1 ? void 0 : _1.column) || void 0 === _2 ? void 0 : _2.showSubTotalsOnLeft) && void 0 !== _3 && _3, null === (_5 = null === (_4 = this.totals) || void 0 === _4 ? void 0 : _4.column) || void 0 === _5 ? void 0 : _5.grandTotalDimensions, !1, this.columns);
72
74
  "undefined" != typeof window && window.performance.now();
73
- (null === (_x = this.dataConfig) || void 0 === _x ? void 0 : _x.isPivotChart) && this.cacheDeminsionCollectedValues();
75
+ (null === (_6 = this.dataConfig) || void 0 === _6 ? void 0 : _6.isPivotChart) && this.cacheDeminsionCollectedValues();
74
76
  }
75
77
  }
76
78
  registerAggregator(type, aggregator) {
@@ -126,7 +128,10 @@ class Dataset {
126
128
  processRecords() {
127
129
  var _a, _b;
128
130
  let isNeedFilter = !1;
129
- if ((null !== (_b = null === (_a = this.filterRules) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0) >= 1 && (isNeedFilter = !0),
131
+ (null !== (_b = null === (_a = this.filterRules) || void 0 === _a ? void 0 : _a.length) && void 0 !== _b ? _b : 0) >= 1 && (isNeedFilter = !0);
132
+ const records = (Array.isArray(this.records) ? this.records : Object.values(this.records).flat()).filter((record => !isNeedFilter || this.filterRecord(record)));
133
+ if (this.rowsHasValue = this.rows.map((row => records.some((record => record && row in record)))),
134
+ this.columnsHasValue = this.columns.map((column => records.some((record => record && column in record)))),
130
135
  Array.isArray(this.records)) {
131
136
  this.filteredRecords || (this.filteredRecords = []);
132
137
  for (let i = 0, len = this.records.length; i < len; i++) {
@@ -162,53 +167,72 @@ class Dataset {
162
167
  }
163
168
  return isReserved;
164
169
  }
170
+ collectValue(field, collectKeys, record) {
171
+ var _a;
172
+ if (this.collectedValues[field] || (this.collectedValues[field] = {}), this.collectedValues[field][collectKeys] || (this.collectValuesBy[field].sumBy ? this.collectedValues[field][collectKeys] = {} : this.collectValuesBy[field].range ? this.collectedValues[field][collectKeys] = {
173
+ min: Number.MAX_SAFE_INTEGER,
174
+ max: Number.MIN_SAFE_INTEGER
175
+ } : this.collectedValues[field][collectKeys] = []), this.collectValuesBy[field].sumBy) {
176
+ const sumByKeys = null === (_a = this.collectValuesBy[field].sumBy) || void 0 === _a ? void 0 : _a.map((byField => record[byField])).join(this.stringJoinChar);
177
+ this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.SUM]({
178
+ key: field,
179
+ field: field,
180
+ isRecord: void 0,
181
+ needSplitPositiveAndNegative: this.needSplitPositiveAndNegative
182
+ })), this.collectedValues[field][collectKeys][sumByKeys].push(record);
183
+ } else if (this.collectValuesBy[field].range) {
184
+ const fieldRange = this.collectedValues[field][collectKeys];
185
+ let max = Math.max(record[field], fieldRange.max), min = Math.min(record[field], fieldRange.min);
186
+ if (this.collectValuesBy[field].considerFields) for (const considerField of this.collectValuesBy[field].considerFields) record[considerField] && ("number" == typeof record[considerField] ? (max = Math.max(record[considerField], max),
187
+ min = Math.min(record[considerField], min)) : Array.isArray(record[considerField]) && (max = Math.max(...record[considerField], max),
188
+ min = Math.min(...record[considerField], min)));
189
+ isNaN(max) || (fieldRange.max = max, fieldRange.min = min);
190
+ } else {
191
+ const fieldValues = this.collectedValues[field][collectKeys];
192
+ -1 === fieldValues.indexOf(record[field]) && fieldValues.push(record[field]);
193
+ }
194
+ }
195
+ getGroupedCollectedValueKeys(by, record) {
196
+ var _a, _b, _c;
197
+ if (!(null === (_a = this.dataConfig) || void 0 === _a ? void 0 : _a.isPivotChart)) return [];
198
+ const keys = new Set;
199
+ return [ {
200
+ dimensions: this.rows,
201
+ totals: null === (_b = this.totals) || void 0 === _b ? void 0 : _b.row
202
+ }, {
203
+ dimensions: this.columns,
204
+ totals: null === (_c = this.totals) || void 0 === _c ? void 0 : _c.column
205
+ } ].forEach((({dimensions: dimensions, totals: totals}) => {
206
+ if (!(null == totals ? void 0 : totals.showGrandTotals)) return;
207
+ const dimensionIndexes = this.getGrandTotalDimensionIndexes(dimensions, totals.grandTotalDimensions);
208
+ dimensionIndexes.length && dimensionIndexes.every((index => -1 !== by.indexOf(dimensions[index]))) && (keys.add((0,
209
+ join_1.join)([ this.groupedGrandTotalKey, ...dimensionIndexes.map((index => record[dimensions[index]])) ], this.stringJoinChar)),
210
+ keys.add((0, join_1.join)([ this.groupedGrandTotalKey, this.groupedGrandTotalSubtotalKey ], this.stringJoinChar)));
211
+ })), Array.from(keys);
212
+ }
165
213
  processRecord(record, assignedIndicatorKey) {
166
- 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, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41;
214
+ 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, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52;
167
215
  null === (_a = this.derivedFieldRules) || void 0 === _a || _a.forEach(((derivedFieldRule, i) => {
168
216
  derivedFieldRule.fieldName && derivedFieldRule.derivedFunc && (record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record));
169
217
  }));
170
- for (const field in this.collectValuesBy) if ((0, vutils_1.isValid)(record[field])) {
171
- this.collectedValues[field] || (this.collectedValues[field] = {});
172
- const collectKeys = this.collectValuesBy[field].by.map((byField => record[byField])).join(this.stringJoinChar);
173
- if (this.collectedValues[field][collectKeys] || (this.collectValuesBy[field].sumBy ? this.collectedValues[field][collectKeys] = {} : this.collectValuesBy[field].range ? this.collectedValues[field][collectKeys] = {
174
- min: Number.MAX_SAFE_INTEGER,
175
- max: Number.MIN_SAFE_INTEGER
176
- } : this.collectedValues[field][collectKeys] = []), this.collectValuesBy[field].sumBy) {
177
- const sumByKeys = null === (_b = this.collectValuesBy[field].sumBy) || void 0 === _b ? void 0 : _b.map((byField => record[byField])).join(this.stringJoinChar);
178
- this.collectedValues[field][collectKeys][sumByKeys] || (this.collectedValues[field][collectKeys][sumByKeys] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.SUM]({
179
- key: field,
180
- field: field,
181
- isRecord: void 0,
182
- needSplitPositiveAndNegative: this.needSplitPositiveAndNegative
183
- })), this.collectedValues[field][collectKeys][sumByKeys].push(record);
184
- } else if (this.collectValuesBy[field].range) {
185
- const fieldRange = this.collectedValues[field][collectKeys];
186
- let max = Math.max(record[field], fieldRange.max), min = Math.min(record[field], fieldRange.min);
187
- if (this.collectValuesBy[field].considerFields) for (const considerField of this.collectValuesBy[field].considerFields) record[considerField] && ("number" == typeof record[considerField] ? (max = Math.max(record[considerField], max),
188
- min = Math.min(record[considerField], min)) : Array.isArray(record[considerField]) && (max = Math.max(...record[considerField], max),
189
- min = Math.min(...record[considerField], min)));
190
- isNaN(max) || (fieldRange.max = max, fieldRange.min = min);
191
- } else {
192
- const fieldRange = this.collectedValues[field][collectKeys];
193
- -1 === fieldRange.indexOf(record[field]) && fieldRange.push(record[field]);
194
- }
195
- }
196
218
  let isToTalRecord = !1;
197
219
  const colKeys = [], rowKeys = [];
198
- if (!this.parseCustomTreeToMatchRecords || (null === (_c = this.dataConfig) || void 0 === _c ? void 0 : _c.isPivotChart) || !(null === (_d = this.customRowTree) || void 0 === _d ? void 0 : _d.length) || assignedIndicatorKey || this.hasExtensionRowTree) {
220
+ if (!this.parseCustomTreeToMatchRecords || (null === (_b = this.dataConfig) || void 0 === _b ? void 0 : _b.isPivotChart) || !(null === (_c = this.customRowTree) || void 0 === _c ? void 0 : _c.length) || assignedIndicatorKey || this.hasExtensionRowTree) {
199
221
  const rowKey = [];
200
222
  rowKeys.push({
201
223
  rowKey: rowKey,
202
224
  indicatorKey: assignedIndicatorKey
203
225
  });
204
- for (let l = 0, len1 = this.rows.length; l < len1; l++) {
226
+ const customGroupedGrandTotalKey = (null === (_f = null === (_e = null === (_d = this.dataConfig) || void 0 === _d ? void 0 : _d.totals) || void 0 === _e ? void 0 : _e.row) || void 0 === _f ? void 0 : _f.showGrandTotals) && this.rowsHasValue[0] ? this.getCustomGroupedGrandTotalKey(record, this.rows, null === (_j = null === (_h = null === (_g = this.dataConfig) || void 0 === _g ? void 0 : _g.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.grandTotalDimensions) : void 0;
227
+ if (customGroupedGrandTotalKey) rowKey.push(...customGroupedGrandTotalKey), isToTalRecord = !0; else for (let l = 0, len1 = this.rows.length; l < len1; l++) {
205
228
  const rowAttr = this.rows[l];
206
229
  if (rowAttr in record) this.rowsHasValue[l] = !0, rowKey.push(record[rowAttr]); else if (rowAttr !== global_1.IndicatorDimensionKeyPlaceholder) {
207
- if ((null === (_g = null === (_f = null === (_e = this.dataConfig) || void 0 === _e ? void 0 : _e.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showGrandTotals) && 0 === l && !this.rows.find((rk => rk in record))) {
208
- rowKey.push(this.rowGrandTotalLabel), isToTalRecord = !0;
230
+ if ((null === (_m = null === (_l = null === (_k = this.dataConfig) || void 0 === _k ? void 0 : _k.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showGrandTotals) && 0 === l && !this.rows.find((rk => rk in record))) {
231
+ this.getGrandTotalDimensionIndexes(this.rows, this.dataConfig.totals.row.grandTotalDimensions).length ? rowKey.push(this.groupedGrandTotalKey, this.groupedGrandTotalSubtotalKey) : rowKey.push(this.rowGrandTotalLabel),
232
+ isToTalRecord = !0;
209
233
  break;
210
234
  }
211
- if ((null === (_k = null === (_j = null === (_h = this.dataConfig) || void 0 === _h ? void 0 : _h.totals) || void 0 === _j ? void 0 : _j.row) || void 0 === _k ? void 0 : _k.subTotalsDimensions) && (null === (_o = null === (_m = null === (_l = this.dataConfig) || void 0 === _l ? void 0 : _l.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.subTotalsDimensions.indexOf(this.rows[l - 1])) >= 0) {
235
+ if ((null === (_q = null === (_p = null === (_o = this.dataConfig) || void 0 === _o ? void 0 : _o.totals) || void 0 === _p ? void 0 : _p.row) || void 0 === _q ? void 0 : _q.subTotalsDimensions) && (null === (_t = null === (_s = null === (_r = this.dataConfig) || void 0 === _r ? void 0 : _r.totals) || void 0 === _s ? void 0 : _s.row) || void 0 === _t ? void 0 : _t.subTotalsDimensions.indexOf(this.rows[l - 1])) >= 0) {
212
236
  "tree" !== this.rowHierarchyType && rowKey.push(this.rowSubTotalLabel), isToTalRecord = !0;
213
237
  break;
214
238
  }
@@ -226,20 +250,22 @@ class Dataset {
226
250
  });
227
251
  }
228
252
  }
229
- if (!this.parseCustomTreeToMatchRecords || (null === (_p = this.dataConfig) || void 0 === _p ? void 0 : _p.isPivotChart) || !(null === (_q = this.customColTree) || void 0 === _q ? void 0 : _q.length) || assignedIndicatorKey || this.hasExtensionRowTree) {
253
+ if (!this.parseCustomTreeToMatchRecords || (null === (_u = this.dataConfig) || void 0 === _u ? void 0 : _u.isPivotChart) || !(null === (_v = this.customColTree) || void 0 === _v ? void 0 : _v.length) || assignedIndicatorKey || this.hasExtensionRowTree) {
230
254
  const colKey = [];
231
255
  colKeys.push({
232
256
  colKey: colKey,
233
257
  indicatorKey: assignedIndicatorKey
234
258
  });
235
- for (let n = 0, len2 = this.columns.length; n < len2; n++) {
259
+ const customGroupedGrandTotalKey = (null === (_y = null === (_x = null === (_w = this.dataConfig) || void 0 === _w ? void 0 : _w.totals) || void 0 === _x ? void 0 : _x.column) || void 0 === _y ? void 0 : _y.showGrandTotals) && this.columnsHasValue[0] ? this.getCustomGroupedGrandTotalKey(record, this.columns, null === (_1 = null === (_0 = null === (_z = this.dataConfig) || void 0 === _z ? void 0 : _z.totals) || void 0 === _0 ? void 0 : _0.column) || void 0 === _1 ? void 0 : _1.grandTotalDimensions) : void 0;
260
+ if (customGroupedGrandTotalKey) colKey.push(...customGroupedGrandTotalKey), isToTalRecord = !0; else for (let n = 0, len2 = this.columns.length; n < len2; n++) {
236
261
  const colAttr = this.columns[n];
237
262
  if (colAttr in record) this.columnsHasValue[n] = !0, colKey.push(record[colAttr]); else if (colAttr !== global_1.IndicatorDimensionKeyPlaceholder) {
238
- if ((null === (_t = null === (_s = null === (_r = this.dataConfig) || void 0 === _r ? void 0 : _r.totals) || void 0 === _s ? void 0 : _s.column) || void 0 === _t ? void 0 : _t.showGrandTotals) && 0 === n && !this.columns.find((ck => ck in record))) {
239
- colKey.push(this.colGrandTotalLabel), isToTalRecord = !0;
263
+ if ((null === (_4 = null === (_3 = null === (_2 = this.dataConfig) || void 0 === _2 ? void 0 : _2.totals) || void 0 === _3 ? void 0 : _3.column) || void 0 === _4 ? void 0 : _4.showGrandTotals) && 0 === n && !this.columns.find((ck => ck in record))) {
264
+ this.getGrandTotalDimensionIndexes(this.columns, this.dataConfig.totals.column.grandTotalDimensions).length ? colKey.push(this.groupedGrandTotalKey, this.groupedGrandTotalSubtotalKey) : colKey.push(this.colGrandTotalLabel),
265
+ isToTalRecord = !0;
240
266
  break;
241
267
  }
242
- if ((null === (_w = null === (_v = null === (_u = this.dataConfig) || void 0 === _u ? void 0 : _u.totals) || void 0 === _v ? void 0 : _v.column) || void 0 === _w ? void 0 : _w.subTotalsDimensions) && (null === (_z = null === (_y = null === (_x = this.dataConfig) || void 0 === _x ? void 0 : _x.totals) || void 0 === _y ? void 0 : _y.column) || void 0 === _z ? void 0 : _z.subTotalsDimensions.indexOf(this.columns[n - 1])) >= 0) {
268
+ if ((null === (_7 = null === (_6 = null === (_5 = this.dataConfig) || void 0 === _5 ? void 0 : _5.totals) || void 0 === _6 ? void 0 : _6.column) || void 0 === _7 ? void 0 : _7.subTotalsDimensions) && (null === (_10 = null === (_9 = null === (_8 = this.dataConfig) || void 0 === _8 ? void 0 : _8.totals) || void 0 === _9 ? void 0 : _9.column) || void 0 === _10 ? void 0 : _10.subTotalsDimensions.indexOf(this.columns[n - 1])) >= 0) {
243
269
  colKey.push(this.colSubTotalLabel), isToTalRecord = !0;
244
270
  break;
245
271
  }
@@ -257,6 +283,12 @@ class Dataset {
257
283
  });
258
284
  }
259
285
  }
286
+ if (!isToTalRecord) for (const field in this.collectValuesBy) if ((0, vutils_1.isValid)(record[field])) {
287
+ const collectKeys = this.collectValuesBy[field].by.map((byField => record[byField])).join(this.stringJoinChar);
288
+ this.collectValue(field, collectKeys, record), this.getGroupedCollectedValueKeys(this.collectValuesBy[field].by, record).forEach((groupedCollectKeys => {
289
+ this.collectValue(field, groupedCollectKeys, record);
290
+ }));
291
+ }
260
292
  for (let row_i = 0; row_i < rowKeys.length; row_i++) {
261
293
  const rowKey = rowKeys[row_i].rowKey;
262
294
  let assignedIndicatorKey_value;
@@ -270,55 +302,55 @@ class Dataset {
270
302
  this.totalRecordsTree[flatRowKey] || (this.totalRecordsTree[flatRowKey] = {}), this.totalRecordsTree[flatRowKey][flatColKey] || (this.totalRecordsTree[flatRowKey][flatColKey] = []);
271
303
  const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
272
304
  for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
273
- const calculatedFieldRule = null === (_0 = this.calculatedFieldRules) || void 0 === _0 ? void 0 : _0.find((rule => rule.key === toComputeIndicatorKeys[i]));
274
- (null === (_2 = null === (_1 = this.totalRecordsTree[flatRowKey]) || void 0 === _1 ? void 0 : _1[flatColKey]) || void 0 === _2 ? void 0 : _2[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
305
+ const calculatedFieldRule = null === (_11 = this.calculatedFieldRules) || void 0 === _11 ? void 0 : _11.find((rule => rule.key === toComputeIndicatorKeys[i]));
306
+ (null === (_13 = null === (_12 = this.totalRecordsTree[flatRowKey]) || void 0 === _12 ? void 0 : _12[flatColKey]) || void 0 === _13 ? void 0 : _13[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
275
307
  key: toComputeIndicatorKeys[i],
276
308
  field: toComputeIndicatorKeys[i],
277
309
  isRecord: !0,
278
- formatFun: null === (_4 = null === (_3 = this.indicators) || void 0 === _3 ? void 0 : _3.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _4 ? void 0 : _4.format,
310
+ formatFun: null === (_15 = null === (_14 = this.indicators) || void 0 === _14 ? void 0 : _14.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _15 ? void 0 : _15.format,
279
311
  calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
280
312
  dependAggregators: this.totalRecordsTree[flatRowKey][flatColKey],
281
313
  dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
282
- })), toComputeIndicatorKeys[i] in record && (null === (_6 = null === (_5 = this.totalRecordsTree[flatRowKey]) || void 0 === _5 ? void 0 : _5[flatColKey]) || void 0 === _6 || _6[i].push(record));
314
+ })), toComputeIndicatorKeys[i] in record && (null === (_17 = null === (_16 = this.totalRecordsTree[flatRowKey]) || void 0 === _16 ? void 0 : _16[flatColKey]) || void 0 === _17 || _17[i].push(record));
283
315
  } else {
284
316
  const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
285
- (null === (_8 = null === (_7 = this.totalRecordsTree[flatRowKey]) || void 0 === _7 ? void 0 : _7[flatColKey]) || void 0 === _8 ? void 0 : _8[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (_9 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _9 ? _9 : ts_types_1.AggregationType.SUM]({
317
+ (null === (_19 = null === (_18 = this.totalRecordsTree[flatRowKey]) || void 0 === _18 ? void 0 : _18[flatColKey]) || void 0 === _19 ? void 0 : _19[i]) || (this.totalRecordsTree[flatRowKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (_20 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _20 ? _20 : ts_types_1.AggregationType.SUM]({
286
318
  key: toComputeIndicatorKeys[i],
287
- field: null !== (_10 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _10 ? _10 : toComputeIndicatorKeys[i],
319
+ field: null !== (_21 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _21 ? _21 : toComputeIndicatorKeys[i],
288
320
  aggregationFun: null == aggRule ? void 0 : aggRule.aggregationFun,
289
- formatFun: null !== (_11 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _11 ? _11 : null === (_13 = null === (_12 = this.indicators) || void 0 === _12 ? void 0 : _12.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _13 ? void 0 : _13.format
290
- })), toComputeIndicatorKeys[i] in record && (null === (_15 = null === (_14 = this.totalRecordsTree[flatRowKey]) || void 0 === _14 ? void 0 : _14[flatColKey]) || void 0 === _15 || _15[i].push(record));
321
+ formatFun: null !== (_22 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _22 ? _22 : null === (_24 = null === (_23 = this.indicators) || void 0 === _23 ? void 0 : _23.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _24 ? void 0 : _24.format
322
+ })), toComputeIndicatorKeys[i] in record && (null === (_26 = null === (_25 = this.totalRecordsTree[flatRowKey]) || void 0 === _25 ? void 0 : _25[flatColKey]) || void 0 === _26 || _26[i].push(record));
291
323
  }
292
324
  return;
293
325
  }
294
326
  0 !== rowKey.length && (this.rowFlatKeys[flatRowKey] || (this.rowKeys.push(rowKey),
295
327
  this.rowFlatKeys[flatRowKey] = 1)), 0 !== colKey.length && (this.colFlatKeys[flatColKey] || (this.colKeys.push(colKey),
296
328
  this.colFlatKeys[flatColKey] = 1)), this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
297
- (null === (_16 = this.tree[flatRowKey]) || void 0 === _16 ? void 0 : _16[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
329
+ (null === (_27 = this.tree[flatRowKey]) || void 0 === _27 ? void 0 : _27[flatColKey]) || (this.tree[flatRowKey][flatColKey] = []);
298
330
  const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
299
331
  for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
300
- const calculatedFieldRule = null === (_17 = this.calculatedFieldRules) || void 0 === _17 ? void 0 : _17.find((rule => rule.key === toComputeIndicatorKeys[i]));
301
- (null === (_19 = null === (_18 = this.tree[flatRowKey]) || void 0 === _18 ? void 0 : _18[flatColKey]) || void 0 === _19 ? void 0 : _19[i]) || (this.tree[flatRowKey][flatColKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
332
+ const calculatedFieldRule = null === (_28 = this.calculatedFieldRules) || void 0 === _28 ? void 0 : _28.find((rule => rule.key === toComputeIndicatorKeys[i]));
333
+ (null === (_30 = null === (_29 = this.tree[flatRowKey]) || void 0 === _29 ? void 0 : _29[flatColKey]) || void 0 === _30 ? void 0 : _30[i]) || (this.tree[flatRowKey][flatColKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
302
334
  key: toComputeIndicatorKeys[i],
303
335
  field: toComputeIndicatorKeys[i],
304
336
  isRecord: !0,
305
- formatFun: null === (_21 = null === (_20 = this.indicators) || void 0 === _20 ? void 0 : _20.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _21 ? void 0 : _21.format,
337
+ formatFun: null === (_32 = null === (_31 = this.indicators) || void 0 === _31 ? void 0 : _31.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _32 ? void 0 : _32.format,
306
338
  calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
307
339
  dependAggregators: this.tree[flatRowKey][flatColKey],
308
340
  dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
309
- })), null === (_23 = null === (_22 = this.tree[flatRowKey]) || void 0 === _22 ? void 0 : _22[flatColKey]) || void 0 === _23 || _23[i].push(record);
341
+ })), null === (_34 = null === (_33 = this.tree[flatRowKey]) || void 0 === _33 ? void 0 : _33[flatColKey]) || void 0 === _34 || _34[i].push(record);
310
342
  } else {
311
343
  const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
312
344
  let needAddToAggregator = !1;
313
345
  if (assignedIndicatorKey_value) assignedIndicatorKey === assignedIndicatorKey_value ? toComputeIndicatorKeys[i] === assignedIndicatorKey_value && (needAddToAggregator = !0) : toComputeIndicatorKeys[i] === assignedIndicatorKey_value && toComputeIndicatorKeys[i] in record && (needAddToAggregator = !0); else if (null == aggRule ? void 0 : aggRule.field) if ("string" == typeof (null == aggRule ? void 0 : aggRule.field)) (null == aggRule ? void 0 : aggRule.field) in record && (needAddToAggregator = !0); else {
314
346
  (null == aggRule ? void 0 : aggRule.field.find((field => field in record))) && (needAddToAggregator = !0);
315
347
  } else toComputeIndicatorKeys[i] in record && (needAddToAggregator = !0);
316
- !(null === (_25 = null === (_24 = this.tree[flatRowKey]) || void 0 === _24 ? void 0 : _24[flatColKey]) || void 0 === _25 ? void 0 : _25[i]) && needAddToAggregator && (this.tree[flatRowKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (_26 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _26 ? _26 : ts_types_1.AggregationType.SUM]({
348
+ !(null === (_36 = null === (_35 = this.tree[flatRowKey]) || void 0 === _35 ? void 0 : _35[flatColKey]) || void 0 === _36 ? void 0 : _36[i]) && needAddToAggregator && (this.tree[flatRowKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (_37 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _37 ? _37 : ts_types_1.AggregationType.SUM]({
317
349
  key: toComputeIndicatorKeys[i],
318
- field: null !== (_27 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _27 ? _27 : toComputeIndicatorKeys[i],
350
+ field: null !== (_38 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _38 ? _38 : toComputeIndicatorKeys[i],
319
351
  aggregationFun: null == aggRule ? void 0 : aggRule.aggregationFun,
320
- formatFun: null !== (_28 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _28 ? _28 : null === (_30 = null === (_29 = this.indicators) || void 0 === _29 ? void 0 : _29.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _30 ? void 0 : _30.format
321
- })), needAddToAggregator && (null === (_32 = null === (_31 = this.tree[flatRowKey]) || void 0 === _31 ? void 0 : _31[flatColKey]) || void 0 === _32 || _32[i].push(record));
352
+ formatFun: null !== (_39 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _39 ? _39 : null === (_41 = null === (_40 = this.indicators) || void 0 === _40 ? void 0 : _40.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _41 ? void 0 : _41.format
353
+ })), needAddToAggregator && (null === (_43 = null === (_42 = this.tree[flatRowKey]) || void 0 === _42 ? void 0 : _42[flatColKey]) || void 0 === _43 || _43[i].push(record));
322
354
  }
323
355
  if (this.mappingRules) for (let i = 0; i < this.indicatorKeys.length; i++) {
324
356
  if (!this.indicatorStatistics[i]) {
@@ -332,25 +364,25 @@ class Dataset {
332
364
  key: this.indicatorKeys[i],
333
365
  field: this.indicatorKeys[i]
334
366
  }),
335
- total: new aggregation_1.registeredAggregators[null !== (_33 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _33 ? _33 : ts_types_1.AggregationType.SUM]({
367
+ total: new aggregation_1.registeredAggregators[null !== (_44 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _44 ? _44 : ts_types_1.AggregationType.SUM]({
336
368
  key: this.indicatorKeys[i],
337
- field: null !== (_34 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _34 ? _34 : this.indicatorKeys[i],
369
+ field: null !== (_45 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _45 ? _45 : this.indicatorKeys[i],
338
370
  aggregationFun: null == aggRule ? void 0 : aggRule.aggregationFun,
339
- formatFun: null !== (_35 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _35 ? _35 : null === (_37 = null === (_36 = this.indicators) || void 0 === _36 ? void 0 : _36.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _37 ? void 0 : _37.format
371
+ formatFun: null !== (_46 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _46 ? _46 : null === (_48 = null === (_47 = this.indicators) || void 0 === _47 ? void 0 : _47.find((indicator => "string" != typeof indicator && indicator.indicatorKey === this.indicatorKeys[i]))) || void 0 === _48 ? void 0 : _48.format
340
372
  })
341
373
  };
342
374
  }
343
- this.indicatorStatistics[i].max.push(null === (_39 = null === (_38 = this.tree[flatRowKey]) || void 0 === _38 ? void 0 : _38[flatColKey]) || void 0 === _39 ? void 0 : _39[i].value()),
344
- this.indicatorStatistics[i].min.push(null === (_41 = null === (_40 = this.tree[flatRowKey]) || void 0 === _40 ? void 0 : _40[flatColKey]) || void 0 === _41 ? void 0 : _41[i].value()),
375
+ this.indicatorStatistics[i].max.push(null === (_50 = null === (_49 = this.tree[flatRowKey]) || void 0 === _49 ? void 0 : _49[flatColKey]) || void 0 === _50 ? void 0 : _50[i].value()),
376
+ this.indicatorStatistics[i].min.push(null === (_52 = null === (_51 = this.tree[flatRowKey]) || void 0 === _51 ? void 0 : _51[flatColKey]) || void 0 === _52 ? void 0 : _52[i].value()),
345
377
  this.indicatorStatistics[i].total.push(record);
346
378
  }
347
379
  }
348
380
  }
349
381
  }
350
382
  updateSortRules(sortRules) {
351
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
352
- this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.customRowTree || ("tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, null !== (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotalsOnTop) && void 0 !== _e && _e) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showGrandTotalsOnTop) && void 0 !== _k && _k, null !== (_o = null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showSubTotalsOnTop) && void 0 !== _o && _o)),
353
- this.customColTree || (this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns.filter(((key, index) => this.columnsHasValue[index])), this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_q = null === (_p = this.totals) || void 0 === _p ? void 0 : _p.column) || void 0 === _q ? void 0 : _q.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.column) || void 0 === _s ? void 0 : _s.showGrandTotalsOnLeft) && void 0 !== _t && _t, null !== (_w = null === (_v = null === (_u = this.totals) || void 0 === _u ? void 0 : _u.column) || void 0 === _v ? void 0 : _v.showSubTotalsOnLeft) && void 0 !== _w && _w));
383
+ 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, _5;
384
+ this.sorted = !1, this.sortRules = sortRules, this.sortKeys(), this.customRowTree || ("tree" === this.rowHierarchyType ? this.rowHeaderTree = this.ArrToTree1(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, (null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, null !== (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.showGrandTotalsOnTop) && void 0 !== _e && _e, null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.grandTotalDimensions, this.rowSubTotalLabel, null !== (_k = null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTop) && void 0 !== _k && _k, this.rows) : this.rowHeaderTree = this.ArrToTree(this.rowKeys, this.rows.filter(((key, index) => this.rowsHasValue[index])), this.indicatorsAsCol ? void 0 : this.indicators, this.rowsIsTotal, (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.row) || void 0 === _m ? void 0 : _m.showGrandTotals) || this.indicatorsAsCol && 0 === this.rows.length, this.rowGrandTotalLabel, this.rowSubTotalLabel, null !== (_q = null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.row) || void 0 === _p ? void 0 : _p.showGrandTotalsOnTop) && void 0 !== _q && _q, null !== (_t = null === (_s = null === (_r = this.totals) || void 0 === _r ? void 0 : _r.row) || void 0 === _s ? void 0 : _s.showSubTotalsOnTop) && void 0 !== _t && _t, null === (_v = null === (_u = this.totals) || void 0 === _u ? void 0 : _u.row) || void 0 === _v ? void 0 : _v.grandTotalDimensions, !0, this.rows)),
385
+ this.customColTree || (this.colHeaderTree = this.ArrToTree(this.colKeys, this.columns.filter(((key, index) => this.columnsHasValue[index])), this.indicatorsAsCol ? this.indicators : void 0, this.colsIsTotal, (null === (_x = null === (_w = this.totals) || void 0 === _w ? void 0 : _w.column) || void 0 === _x ? void 0 : _x.showGrandTotals) || !this.indicatorsAsCol && 0 === this.columns.length, this.colGrandTotalLabel, this.colSubTotalLabel, null !== (_0 = null === (_z = null === (_y = this.totals) || void 0 === _y ? void 0 : _y.column) || void 0 === _z ? void 0 : _z.showGrandTotalsOnLeft) && void 0 !== _0 && _0, null !== (_3 = null === (_2 = null === (_1 = this.totals) || void 0 === _1 ? void 0 : _1.column) || void 0 === _2 ? void 0 : _2.showSubTotalsOnLeft) && void 0 !== _3 && _3, null === (_5 = null === (_4 = this.totals) || void 0 === _4 ? void 0 : _4.column) || void 0 === _5 ? void 0 : _5.grandTotalDimensions, !1, this.columns));
354
386
  }
355
387
  updateFilterRules(filterRules, isResetTree = !1) {
356
388
  var _a, _b;
@@ -364,7 +396,7 @@ class Dataset {
364
396
  return null === (_a = this.aggregationRules) || void 0 === _a ? void 0 : _a.find(((value, index) => indicatorKey === value.indicatorKey));
365
397
  }
366
398
  getAggregator(rowKey = [], colKey = [], indicator, considerChangedValue = !0, indicatorPosition) {
367
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
399
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
368
400
  const indicatorIndex = this.indicatorKeys.indexOf(indicator);
369
401
  let rowDimensionKey, colDimensionKey, flatRowKey, flatColKey;
370
402
  if ("row" === (null == indicatorPosition ? void 0 : indicatorPosition.position)) rowDimensionKey = rowKey.length >= 2 ? this.rows[rowKey.length - 2] : void 0; else {
@@ -375,15 +407,24 @@ class Dataset {
375
407
  const colIndex = colKey.length - 1;
376
408
  colDimensionKey = colIndex >= 0 && colIndex < this.columns.length ? this.columns[colIndex] : void 0;
377
409
  }
378
- "string" == typeof rowKey ? flatRowKey = rowKey : (indicatorPosition && "row" !== indicatorPosition.position || rowKey.map(((key, i) => {
410
+ if ("string" == typeof rowKey ? flatRowKey = rowKey : (indicatorPosition && "row" !== indicatorPosition.position || rowKey.map(((key, i) => {
379
411
  key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || rowKey.splice(i, 1);
380
- })), rowKey.length < this.rows.length && "grid-tree" === this.rowHierarchyType && (rowKey[0] === this.rowGrandTotalLabel || ((null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 && this.totals.row.subTotalsDimensions.find((dimension => dimension === rowDimensionKey)) || (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showSubTotalsOnTreeNode)) && rowKey[rowKey.length - 1] !== this.rowSubTotalLabel && rowKey.push(this.rowSubTotalLabel)),
412
+ })), rowKey.length < this.rows.length && "grid-tree" === this.rowHierarchyType && (rowKey[0] === this.rowGrandTotalLabel || rowKey[0] === this.groupedGrandTotalKey || ((null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 && this.totals.row.subTotalsDimensions.find((dimension => dimension === rowDimensionKey)) || (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showSubTotalsOnTreeNode)) && rowKey[rowKey.length - 1] !== this.rowSubTotalLabel && rowKey.push(this.rowSubTotalLabel)),
381
413
  flatRowKey = (0, join_1.join)(rowKey, this.stringJoinChar)), "string" == typeof colKey ? flatColKey = colKey : (indicatorPosition && "col" !== indicatorPosition.position || colKey.map(((key, i) => {
382
414
  key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || colKey.splice(i, 1);
383
- })), colKey.length < this.columns.length && "grid-tree" === this.columnHierarchyType && (colKey[0] === this.colGrandTotalLabel || ((null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.column) || void 0 === _j ? void 0 : _j.subTotalsDimensions) && (null === (_m = null === (_l = null === (_k = this.totals) || void 0 === _k ? void 0 : _k.column) || void 0 === _l ? void 0 : _l.subTotalsDimensions) || void 0 === _m ? void 0 : _m.length) >= 1 && this.totals.column.subTotalsDimensions.find((dimension => dimension === colDimensionKey)) || (null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showSubTotalsOnTreeNode)) && colKey[colKey.length - 1] !== this.colSubTotalLabel && colKey.push(this.colSubTotalLabel)),
384
- flatColKey = (0, join_1.join)(colKey, this.stringJoinChar));
385
- const agg = null === (_r = null === (_q = this.tree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) || void 0 === _r ? void 0 : _r[indicatorIndex];
386
- if (considerChangedValue && (0, vutils_1.isValid)(null === (_t = null === (_s = this.changedTree[flatRowKey]) || void 0 === _s ? void 0 : _s[flatColKey]) || void 0 === _t ? void 0 : _t[indicatorIndex])) {
415
+ })), colKey.length < this.columns.length && "grid-tree" === this.columnHierarchyType && (colKey[0] === this.colGrandTotalLabel || colKey[0] === this.groupedGrandTotalKey || ((null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.column) || void 0 === _j ? void 0 : _j.subTotalsDimensions) && (null === (_m = null === (_l = null === (_k = this.totals) || void 0 === _k ? void 0 : _k.column) || void 0 === _l ? void 0 : _l.subTotalsDimensions) || void 0 === _m ? void 0 : _m.length) >= 1 && this.totals.column.subTotalsDimensions.find((dimension => dimension === colDimensionKey)) || (null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showSubTotalsOnTreeNode)) && colKey[colKey.length - 1] !== this.colSubTotalLabel && colKey.push(this.colSubTotalLabel)),
416
+ flatColKey = (0, join_1.join)(colKey, this.stringJoinChar)), Array.isArray(rowKey) && rowKey[0] === this.rowGrandTotalLabel && !this.tree[flatRowKey] && this.getGrandTotalDimensionIndexes(this.rows.filter(((_, index) => this.rowsHasValue[index])), null === (_r = null === (_q = this.totals) || void 0 === _q ? void 0 : _q.row) || void 0 === _r ? void 0 : _r.grandTotalDimensions, this.rows).length) {
417
+ const internalRowKey = rowKey.slice();
418
+ internalRowKey[0] = this.groupedGrandTotalKey, 2 === internalRowKey.length && internalRowKey[1] === this.rowSubTotalLabel && (internalRowKey[1] = this.groupedGrandTotalSubtotalKey),
419
+ flatRowKey = (0, join_1.join)(internalRowKey, this.stringJoinChar);
420
+ }
421
+ if (Array.isArray(colKey) && colKey[0] === this.colGrandTotalLabel && !(null === (_s = this.tree[flatRowKey]) || void 0 === _s ? void 0 : _s[flatColKey]) && this.getGrandTotalDimensionIndexes(this.columns.filter(((_, index) => this.columnsHasValue[index])), null === (_u = null === (_t = this.totals) || void 0 === _t ? void 0 : _t.column) || void 0 === _u ? void 0 : _u.grandTotalDimensions, this.columns).length) {
422
+ const internalColKey = colKey.slice();
423
+ internalColKey[0] = this.groupedGrandTotalKey, 2 === internalColKey.length && internalColKey[1] === this.colSubTotalLabel && (internalColKey[1] = this.groupedGrandTotalSubtotalKey),
424
+ flatColKey = (0, join_1.join)(internalColKey, this.stringJoinChar);
425
+ }
426
+ const agg = null === (_w = null === (_v = this.tree[flatRowKey]) || void 0 === _v ? void 0 : _v[flatColKey]) || void 0 === _w ? void 0 : _w[indicatorIndex];
427
+ if (considerChangedValue && (0, vutils_1.isValid)(null === (_y = null === (_x = this.changedTree[flatRowKey]) || void 0 === _x ? void 0 : _x[flatColKey]) || void 0 === _y ? void 0 : _y[indicatorIndex])) {
387
428
  const changeValue = this.changedTree[flatRowKey][flatColKey][indicatorIndex];
388
429
  return agg ? {
389
430
  value: () => changeValue,
@@ -427,7 +468,7 @@ class Dataset {
427
468
  this.colKeys.sort(sortfun);
428
469
  }
429
470
  }
430
- arrSort(fieldArr, isRow) {
471
+ arrSort(fieldArr, isRow, pathPrefix) {
431
472
  let field;
432
473
  const that = this, sortersArr = function(_this) {
433
474
  const results = [];
@@ -451,9 +492,10 @@ class Dataset {
451
492
  if (sorter = sortersArr[i], null === (_a = sorter.sortRule) || void 0 === _a ? void 0 : _a.sortByIndicator) {
452
493
  let aChanged = a, bChanged = b;
453
494
  sorter.fieldIndex < fieldArr.length - 1 && (aChanged = a.slice(0, sorter.fieldIndex + 1),
454
- "grid" === that.rowHierarchyType && isRow ? aChanged.push(that.rowSubTotalLabel) : isRow || aChanged.push(that.colSubTotalLabel),
455
- bChanged = b.slice(0, sorter.fieldIndex + 1), "grid" === that.rowHierarchyType && isRow ? bChanged.push(that.rowSubTotalLabel) : isRow || bChanged.push(that.colSubTotalLabel)),
456
- comparison = sorter.func(aChanged, bChanged, null === (_b = sorter.sortRule) || void 0 === _b ? void 0 : _b.sortType);
495
+ !(null == pathPrefix ? void 0 : pathPrefix.length) && "grid" === that.rowHierarchyType && isRow ? aChanged.push(that.rowSubTotalLabel) : (null == pathPrefix ? void 0 : pathPrefix.length) || isRow || aChanged.push(that.colSubTotalLabel),
496
+ bChanged = b.slice(0, sorter.fieldIndex + 1), !(null == pathPrefix ? void 0 : pathPrefix.length) && "grid" === that.rowHierarchyType && isRow ? bChanged.push(that.rowSubTotalLabel) : (null == pathPrefix ? void 0 : pathPrefix.length) || isRow || bChanged.push(that.colSubTotalLabel)),
497
+ (null == pathPrefix ? void 0 : pathPrefix.length) && (aChanged = [ ...pathPrefix, ...aChanged ],
498
+ bChanged = [ ...pathPrefix, ...bChanged ]), comparison = sorter.func(aChanged, bChanged, null === (_b = sorter.sortRule) || void 0 === _b ? void 0 : _b.sortType);
457
499
  } else comparison = null === (_c = sorter.func) || void 0 === _c ? void 0 : _c.call(sorter, a[sorter.fieldIndex], b[sorter.fieldIndex], null === (_d = sorter.sortRule) || void 0 === _d ? void 0 : _d.sortType);
458
500
  if (0 !== comparison) return comparison;
459
501
  }
@@ -464,8 +506,8 @@ class Dataset {
464
506
  const that = this;
465
507
  return sortRule.sortByIndicator ? (a, b, sortType) => {
466
508
  const getValue = function(rowKey, colKey) {
467
- return "grid" === that.rowHierarchyType && rowKey.length < that.rows.length && rowKey[rowKey.length - 1] !== that.rowSubTotalLabel && rowKey[rowKey.length - 1] !== that.rowGrandTotalLabel && rowKey.push(that.rowSubTotalLabel),
468
- colKey.length < that.columns.length && colKey[colKey.length - 1] !== that.colSubTotalLabel && colKey[colKey.length - 1] !== that.colGrandTotalLabel && colKey.push(that.colSubTotalLabel),
509
+ return "grid" === that.rowHierarchyType && rowKey.length < that.rows.length && rowKey[rowKey.length - 1] !== that.rowSubTotalLabel && rowKey[rowKey.length - 1] !== that.rowGrandTotalLabel && rowKey[0] !== that.groupedGrandTotalKey && rowKey.push(that.rowSubTotalLabel),
510
+ colKey.length < that.columns.length && colKey[colKey.length - 1] !== that.colSubTotalLabel && colKey[colKey.length - 1] !== that.colGrandTotalLabel && colKey[0] !== that.groupedGrandTotalKey && colKey.push(that.colSubTotalLabel),
469
511
  that.getAggregator(rowKey, colKey, sortRule.sortByIndicator).value();
470
512
  };
471
513
  return isSortRow ? sortRule.sortFunc ? sortRule.sortFunc(getValue(a, sortRule.query), getValue(b, sortRule.query), a, b, sortType) : (0,
@@ -476,7 +518,7 @@ class Dataset {
476
518
  totalStatistics() {
477
519
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
478
520
  const that = this, colCompute = (flatRowKey, flatColKey) => {
479
- 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, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32;
521
+ 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, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34;
480
522
  if (null === (_b = null === (_a = this.totalRecordsTree) || void 0 === _a ? void 0 : _a[flatRowKey]) || void 0 === _b ? void 0 : _b[flatColKey]) return this.tree[flatRowKey] || (this.tree[flatRowKey] = {}),
481
523
  void (this.tree[flatRowKey][flatColKey] = null === (_d = null === (_c = this.totalRecordsTree) || void 0 === _c ? void 0 : _c[flatRowKey]) || void 0 === _d ? void 0 : _d[flatColKey]);
482
524
  const colKey = flatColKey.split(this.stringJoinChar);
@@ -518,32 +560,38 @@ class Dataset {
518
560
  }
519
561
  }
520
562
  }
521
- if ((null === (_14 = null === (_13 = that.totals) || void 0 === _13 ? void 0 : _13.column) || void 0 === _14 ? void 0 : _14.showGrandTotals) || 0 === this.rows.length) {
522
- const flatColTotalKey = that.colGrandTotalLabel;
523
- if (null === (_16 = null === (_15 = this.totalRecordsTree) || void 0 === _15 ? void 0 : _15[flatRowKey]) || void 0 === _16 ? void 0 : _16[flatColTotalKey]) return void (this.tree[flatRowKey][flatColTotalKey] = null === (_18 = null === (_17 = this.totalRecordsTree) || void 0 === _17 ? void 0 : _17[flatRowKey]) || void 0 === _18 ? void 0 : _18[flatColTotalKey]);
524
- this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
525
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
526
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
527
- const calculatedFieldRule = null === (_19 = this.calculatedFieldRules) || void 0 === _19 ? void 0 : _19.find((rule => rule.key === toComputeIndicatorKeys[i]));
528
- (null === (_21 = null === (_20 = this.tree[flatRowKey]) || void 0 === _20 ? void 0 : _20[flatColTotalKey]) || void 0 === _21 ? void 0 : _21[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
529
- key: toComputeIndicatorKeys[i],
530
- field: toComputeIndicatorKeys[i],
531
- isRecord: !0,
532
- formatFun: null === (_23 = null === (_22 = this.indicators) || void 0 === _22 ? void 0 : _22.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _23 ? void 0 : _23.format,
533
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
534
- dependAggregators: this.tree[flatRowKey][flatColTotalKey],
535
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
536
- })), flatColTotalKey !== flatColKey && this.tree[flatRowKey][flatColTotalKey][i].push(null === (_25 = null === (_24 = that.tree[flatRowKey]) || void 0 === _24 ? void 0 : _24[flatColKey]) || void 0 === _25 ? void 0 : _25[i]);
537
- } else {
538
- if (!this.tree[flatRowKey][flatColTotalKey][i]) {
539
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
540
- this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[null !== (_26 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _26 ? _26 : ts_types_1.AggregationType.SUM]({
563
+ if (((null === (_14 = null === (_13 = that.totals) || void 0 === _13 ? void 0 : _13.column) || void 0 === _14 ? void 0 : _14.showGrandTotals) || 0 === this.rows.length) && colKey[0] !== this.groupedGrandTotalKey) {
564
+ const flatColTotalKeys = this.getGrandTotalKeys(colKey, that.columns.filter(((_, index) => that.columnsHasValue[index])), null === (_16 = null === (_15 = that.totals) || void 0 === _15 ? void 0 : _15.column) || void 0 === _16 ? void 0 : _16.grandTotalDimensions, that.colGrandTotalLabel, that.columns);
565
+ for (const flatColTotalKey of flatColTotalKeys) {
566
+ if (null === (_18 = null === (_17 = this.totalRecordsTree) || void 0 === _17 ? void 0 : _17[flatRowKey]) || void 0 === _18 ? void 0 : _18[flatColTotalKey]) {
567
+ this.tree[flatRowKey][flatColTotalKey] = null === (_20 = null === (_19 = this.totalRecordsTree) || void 0 === _19 ? void 0 : _19[flatRowKey]) || void 0 === _20 ? void 0 : _20[flatColTotalKey];
568
+ continue;
569
+ }
570
+ this.tree[flatRowKey][flatColTotalKey] || (this.tree[flatRowKey][flatColTotalKey] = []);
571
+ const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
572
+ for (let i = 0; i < toComputeIndicatorKeys.length; i++) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
573
+ const calculatedFieldRule = null === (_21 = this.calculatedFieldRules) || void 0 === _21 ? void 0 : _21.find((rule => rule.key === toComputeIndicatorKeys[i]));
574
+ (null === (_23 = null === (_22 = this.tree[flatRowKey]) || void 0 === _22 ? void 0 : _22[flatColTotalKey]) || void 0 === _23 ? void 0 : _23[i]) || (this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
541
575
  key: toComputeIndicatorKeys[i],
542
- field: null !== (_27 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _27 ? _27 : toComputeIndicatorKeys[i],
543
- formatFun: null !== (_28 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _28 ? _28 : null === (_30 = null === (_29 = this.indicators) || void 0 === _29 ? void 0 : _29.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _30 ? void 0 : _30.format
544
- });
576
+ field: toComputeIndicatorKeys[i],
577
+ isRecord: !0,
578
+ formatFun: null === (_25 = null === (_24 = this.indicators) || void 0 === _24 ? void 0 : _24.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _25 ? void 0 : _25.format,
579
+ calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
580
+ dependAggregators: this.tree[flatRowKey][flatColTotalKey],
581
+ dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
582
+ })), flatColTotalKey !== flatColKey && this.tree[flatRowKey][flatColTotalKey][i].push(null === (_27 = null === (_26 = that.tree[flatRowKey]) || void 0 === _26 ? void 0 : _26[flatColKey]) || void 0 === _27 ? void 0 : _27[i]);
583
+ } else {
584
+ if (!this.tree[flatRowKey][flatColTotalKey][i]) {
585
+ const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
586
+ this.tree[flatRowKey][flatColTotalKey][i] = new aggregation_1.registeredAggregators[null !== (_28 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _28 ? _28 : ts_types_1.AggregationType.SUM]({
587
+ key: toComputeIndicatorKeys[i],
588
+ field: null !== (_29 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _29 ? _29 : toComputeIndicatorKeys[i],
589
+ aggregationFun: null == aggRule ? void 0 : aggRule.aggregationFun,
590
+ formatFun: null !== (_30 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _30 ? _30 : null === (_32 = null === (_31 = this.indicators) || void 0 === _31 ? void 0 : _31.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _32 ? void 0 : _32.format
591
+ }), this.tree[flatRowKey][flatColTotalKey][i] instanceof aggregation_1.CustomAggregator && flatColTotalKey.startsWith(this.groupedGrandTotalKey) && (this.tree[flatRowKey][flatColTotalKey][i].recalculateFromChildren = !0);
592
+ }
593
+ flatColTotalKey !== flatColKey && this.tree[flatRowKey][flatColTotalKey][i].push(null === (_34 = null === (_33 = that.tree[flatRowKey]) || void 0 === _33 ? void 0 : _33[flatColKey]) || void 0 === _34 ? void 0 : _34[i]);
545
594
  }
546
- flatColTotalKey !== flatColKey && this.tree[flatRowKey][flatColTotalKey][i].push(null === (_32 = null === (_31 = that.tree[flatRowKey]) || void 0 === _31 ? void 0 : _31[flatColKey]) || void 0 === _32 ? void 0 : _32[i]);
547
595
  }
548
596
  }
549
597
  };
@@ -552,7 +600,7 @@ class Dataset {
552
600
  Object.keys(that.tree).forEach((flatRowKey => {
553
601
  const rowKey = flatRowKey.split(this.stringJoinChar);
554
602
  Object.keys(that.tree[flatRowKey]).forEach((flatColKey => {
555
- 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, _5, _6, _7, _8, _9, _10, _11, _12;
603
+ 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, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
556
604
  if ((null === (_b = null === (_a = that.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = that.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) > 0 && (!1 !== (null === (_g = null === (_f = that.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showSubTotals) || (null === (_j = null === (_h = that.totals) || void 0 === _h ? void 0 : _h.row) || void 0 === _j ? void 0 : _j.showSubTotalsOnTreeNode)) || (null === (_l = null === (_k = that.totals) || void 0 === _k ? void 0 : _k.row) || void 0 === _l ? void 0 : _l.showSubTotalsOnTreeNode) && that.rows.length > 0) {
557
605
  let rowSubTotalDimensions = (null === (_o = null === (_m = that.totals) || void 0 === _m ? void 0 : _m.row) || void 0 === _o ? void 0 : _o.subTotalsDimensions) || [];
558
606
  (null === (_q = null === (_p = that.totals) || void 0 === _p ? void 0 : _p.row) || void 0 === _q ? void 0 : _q.showSubTotalsOnTreeNode) && 0 === rowSubTotalDimensions.length && (rowSubTotalDimensions = that.rows.map((row => row)));
@@ -590,32 +638,35 @@ class Dataset {
590
638
  }
591
639
  }
592
640
  }
593
- if ((null === (_2 = null === (_1 = that.totals) || void 0 === _1 ? void 0 : _1.row) || void 0 === _2 ? void 0 : _2.showGrandTotals) || 0 === this.columns.length) {
594
- const flatRowTotalKey = that.rowGrandTotalLabel;
595
- this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
596
- this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
597
- const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
598
- for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
599
- if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
600
- const calculatedFieldRule = null === (_3 = this.calculatedFieldRules) || void 0 === _3 ? void 0 : _3.find((rule => rule.key === toComputeIndicatorKeys[i]));
601
- this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
602
- key: toComputeIndicatorKeys[i],
603
- field: toComputeIndicatorKeys[i],
604
- isRecord: !0,
605
- formatFun: null === (_5 = null === (_4 = this.indicators) || void 0 === _4 ? void 0 : _4.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _5 ? void 0 : _5.format,
606
- calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
607
- dependAggregators: this.tree[flatRowTotalKey][flatColKey],
608
- dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
609
- });
610
- } else {
611
- const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
612
- this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (_6 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _6 ? _6 : ts_types_1.AggregationType.SUM]({
613
- key: toComputeIndicatorKeys[i],
614
- field: null !== (_7 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _7 ? _7 : toComputeIndicatorKeys[i],
615
- formatFun: null !== (_8 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _8 ? _8 : null === (_10 = null === (_9 = this.indicators) || void 0 === _9 ? void 0 : _9.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _10 ? void 0 : _10.format
616
- });
641
+ if (((null === (_2 = null === (_1 = that.totals) || void 0 === _1 ? void 0 : _1.row) || void 0 === _2 ? void 0 : _2.showGrandTotals) || 0 === this.columns.length) && rowKey[0] !== this.groupedGrandTotalKey) {
642
+ const flatRowTotalKeys = this.getGrandTotalKeys(rowKey, that.rows.filter(((_, index) => that.rowsHasValue[index])), null === (_4 = null === (_3 = that.totals) || void 0 === _3 ? void 0 : _3.row) || void 0 === _4 ? void 0 : _4.grandTotalDimensions, that.rowGrandTotalLabel, that.rows);
643
+ for (const flatRowTotalKey of flatRowTotalKeys) {
644
+ this.tree[flatRowTotalKey] || (this.tree[flatRowTotalKey] = {}, rowTotalKeys.push(flatRowTotalKey)),
645
+ this.tree[flatRowTotalKey][flatColKey] || (this.tree[flatRowTotalKey][flatColKey] = []);
646
+ const toComputeIndicatorKeys = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys;
647
+ for (let i = 0; i < toComputeIndicatorKeys.length; i++) {
648
+ if (!this.tree[flatRowTotalKey][flatColKey][i]) if (this.calculatedFiledKeys.indexOf(toComputeIndicatorKeys[i]) >= 0) {
649
+ const calculatedFieldRule = null === (_5 = this.calculatedFieldRules) || void 0 === _5 ? void 0 : _5.find((rule => rule.key === toComputeIndicatorKeys[i]));
650
+ this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[ts_types_1.AggregationType.RECALCULATE]({
651
+ key: toComputeIndicatorKeys[i],
652
+ field: toComputeIndicatorKeys[i],
653
+ isRecord: !0,
654
+ formatFun: null === (_7 = null === (_6 = this.indicators) || void 0 === _6 ? void 0 : _6.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _7 ? void 0 : _7.format,
655
+ calculateFun: null == calculatedFieldRule ? void 0 : calculatedFieldRule.calculateFun,
656
+ dependAggregators: this.tree[flatRowTotalKey][flatColKey],
657
+ dependIndicatorKeys: null == calculatedFieldRule ? void 0 : calculatedFieldRule.dependIndicatorKeys
658
+ });
659
+ } else {
660
+ const aggRule = this.getAggregatorRule(toComputeIndicatorKeys[i]);
661
+ this.tree[flatRowTotalKey][flatColKey][i] = new aggregation_1.registeredAggregators[null !== (_8 = null == aggRule ? void 0 : aggRule.aggregationType) && void 0 !== _8 ? _8 : ts_types_1.AggregationType.SUM]({
662
+ key: toComputeIndicatorKeys[i],
663
+ field: null !== (_9 = null == aggRule ? void 0 : aggRule.field) && void 0 !== _9 ? _9 : toComputeIndicatorKeys[i],
664
+ aggregationFun: null == aggRule ? void 0 : aggRule.aggregationFun,
665
+ formatFun: null !== (_10 = null == aggRule ? void 0 : aggRule.formatFun) && void 0 !== _10 ? _10 : null === (_12 = null === (_11 = this.indicators) || void 0 === _11 ? void 0 : _11.find((indicator => "string" != typeof indicator && indicator.indicatorKey === toComputeIndicatorKeys[i]))) || void 0 === _12 ? void 0 : _12.format
666
+ }), this.tree[flatRowTotalKey][flatColKey][i] instanceof aggregation_1.CustomAggregator && flatRowTotalKey.startsWith(this.groupedGrandTotalKey) && (this.tree[flatRowTotalKey][flatColKey][i].recalculateFromChildren = !0);
667
+ }
668
+ flatRowTotalKey !== flatRowKey && this.tree[flatRowTotalKey][flatColKey][i].push(null === (_14 = null === (_13 = that.tree[flatRowKey]) || void 0 === _13 ? void 0 : _13[flatColKey]) || void 0 === _14 ? void 0 : _14[i]);
617
669
  }
618
- flatRowTotalKey !== flatRowKey && this.tree[flatRowTotalKey][flatColKey][i].push(null === (_12 = null === (_11 = that.tree[flatRowKey]) || void 0 === _11 ? void 0 : _11[flatColKey]) || void 0 === _12 ? void 0 : _12[i]);
619
670
  }
620
671
  }
621
672
  colCompute(flatRowKey, flatColKey);
@@ -628,7 +679,37 @@ class Dataset {
628
679
  }
629
680
  for (const flatRowKey in that.totalRecordsTree) for (const flatColKey in that.totalRecordsTree[flatRowKey]) colCompute(flatRowKey, flatColKey);
630
681
  }
631
- ArrToTree1(arr, rows, indicators, isGrandTotal, grandTotalLabel, showGrandTotalsOnTop) {
682
+ getGrandTotalDimensionIndexes(dimensions, grandTotalDimensions, configuredDimensions = dimensions) {
683
+ return (null == grandTotalDimensions ? void 0 : grandTotalDimensions.length) ? grandTotalDimensions.map((dimension => ({
684
+ configuredIndex: configuredDimensions.indexOf(dimension),
685
+ activeIndex: dimensions.indexOf(dimension)
686
+ }))).filter((({configuredIndex: configuredIndex, activeIndex: activeIndex}, position, indexes) => configuredIndex > 0 && activeIndex >= 0 && indexes.findIndex((item => item.activeIndex === activeIndex)) === position)).map((({activeIndex: activeIndex}) => activeIndex)).sort(((a, b) => a - b)) : [];
687
+ }
688
+ getCustomGroupedGrandTotalKey(record, dimensions, grandTotalDimensions) {
689
+ const dimensionIndexes = this.getGrandTotalDimensionIndexes(dimensions, grandTotalDimensions);
690
+ if (!dimensionIndexes.length || dimensions.some(((dimension, index) => -1 === dimensionIndexes.indexOf(index) && dimension in record))) return;
691
+ const prefixIndexes = [];
692
+ for (const index of dimensionIndexes) {
693
+ if (!(dimensions[index] in record)) break;
694
+ prefixIndexes.push(index);
695
+ }
696
+ return prefixIndexes.length && !dimensionIndexes.slice(prefixIndexes.length).some((index => dimensions[index] in record)) ? [ this.groupedGrandTotalKey, ...prefixIndexes.map((index => record[dimensions[index]])) ] : void 0;
697
+ }
698
+ getGroupedGrandTotalPaths(keys, dimensions, grandTotalDimensions, isRow = !0, configuredDimensions = dimensions) {
699
+ const dimensionIndexes = this.getGrandTotalDimensionIndexes(dimensions, grandTotalDimensions, configuredDimensions), groupedPaths = new Map;
700
+ return keys.forEach((key => {
701
+ const path = dimensionIndexes.map((index => key[index]));
702
+ groupedPaths.set((0, join_1.join)(path, this.stringJoinChar), path);
703
+ })), Array.from(groupedPaths.values()).sort(this.arrSort(dimensionIndexes.map((index => dimensions[index])), isRow, [ this.groupedGrandTotalKey ]));
704
+ }
705
+ getGrandTotalKeys(dimensionKey, dimensions, grandTotalDimensions, grandTotalLabel, configuredDimensions = dimensions) {
706
+ const dimensionIndexes = this.getGrandTotalDimensionIndexes(dimensions, grandTotalDimensions, configuredDimensions);
707
+ if (!dimensionIndexes.length) return [ grandTotalLabel ];
708
+ const groupedKey = [ this.groupedGrandTotalKey, ...dimensionIndexes.map((dimensionIndex => dimensionKey[dimensionIndex])) ];
709
+ return [ ...groupedKey.slice(1).map(((_, index) => (0, join_1.join)(groupedKey.slice(0, index + 2), this.stringJoinChar))), (0,
710
+ join_1.join)([ this.groupedGrandTotalKey, this.groupedGrandTotalSubtotalKey ], this.stringJoinChar) ];
711
+ }
712
+ ArrToTree1(arr, rows, indicators, isGrandTotal, grandTotalLabel, showGrandTotalsOnTop, grandTotalDimensions, subTotalLabel, showSubTotalsOnTop, configuredRows = rows) {
632
713
  const result = [], concatStr = this.stringJoinChar, map = new Map;
633
714
  function addList(list, isGrandTotal) {
634
715
  const path = [];
@@ -652,10 +733,55 @@ class Dataset {
652
733
  node = item;
653
734
  }));
654
735
  }
655
- return arr.forEach((item => addList(item, !1))), isGrandTotal && addList([ grandTotalLabel ], isGrandTotal),
656
- result;
736
+ const createIndicatorChildren = () => {
737
+ var _a;
738
+ return null !== (_a = null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
739
+ indicatorKey: indicator,
740
+ value: indicator
741
+ } : {
742
+ indicatorKey: indicator.indicatorKey,
743
+ value: indicator.title
744
+ }))) && void 0 !== _a ? _a : [];
745
+ };
746
+ if (arr.forEach((item => addList(item, !1))), isGrandTotal) {
747
+ const grandTotalDimensionIndexes = this.getGrandTotalDimensionIndexes(rows, grandTotalDimensions, configuredRows);
748
+ if (grandTotalDimensionIndexes.length) {
749
+ const grandTotalNode = {
750
+ value: grandTotalLabel,
751
+ dataValue: this.groupedGrandTotalKey,
752
+ dimensionKey: rows[0],
753
+ children: [],
754
+ role: "grand-total"
755
+ }, grandTotalMap = new Map;
756
+ this.getGroupedGrandTotalPaths(arr, rows, grandTotalDimensions, !0, configuredRows).forEach((list => {
757
+ let parent = grandTotalNode;
758
+ const path = [ this.groupedGrandTotalKey ];
759
+ grandTotalDimensionIndexes.forEach(((dimensionIndex, index) => {
760
+ const value = list[index];
761
+ path.push(value);
762
+ const flatKey = (0, join_1.join)(path, concatStr);
763
+ let item = grandTotalMap.get(flatKey);
764
+ item || (item = {
765
+ value: value,
766
+ dataValue: value,
767
+ dimensionKey: rows[dimensionIndex],
768
+ children: index === grandTotalDimensionIndexes.length - 1 ? createIndicatorChildren() : []
769
+ }, grandTotalMap.set(flatKey, item), parent.children.push(item)), parent = item;
770
+ }));
771
+ }));
772
+ const totalChild = {
773
+ value: subTotalLabel,
774
+ dataValue: this.groupedGrandTotalSubtotalKey,
775
+ dimensionKey: rows[grandTotalDimensionIndexes[0]],
776
+ children: createIndicatorChildren()
777
+ };
778
+ showSubTotalsOnTop ? grandTotalNode.children.unshift(totalChild) : grandTotalNode.children.push(totalChild),
779
+ showGrandTotalsOnTop ? result.unshift(grandTotalNode) : result.push(grandTotalNode);
780
+ } else addList([ grandTotalLabel ], isGrandTotal);
781
+ }
782
+ return result;
657
783
  }
658
- ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel, showGrandTotalsOnTop, showSubTotalsOnTop) {
784
+ ArrToTree(arr, rows, indicators, subTotalFlags, isGrandTotal, grandTotalLabel, subTotalLabel, showGrandTotalsOnTop, showSubTotalsOnTop, grandTotalDimensions, isRow, configuredRows = rows) {
659
785
  var _a;
660
786
  let result = [];
661
787
  const concatStr = this.stringJoinChar, map = new Map;
@@ -709,19 +835,56 @@ class Dataset {
709
835
  value: null !== (_a = indicator.title) && void 0 !== _a ? _a : indicator.indicatorKey
710
836
  };
711
837
  }))), isGrandTotal && (null == arr ? void 0 : arr.length)) {
712
- const node = {
713
- value: grandTotalLabel,
714
- dimensionKey: rows[0],
715
- levelSpan: subTotalFlags.length,
716
- children: null !== (_a = null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
838
+ const grandTotalDimensionIndexes = this.getGrandTotalDimensionIndexes(rows, grandTotalDimensions, configuredRows), createIndicatorChildren = () => {
839
+ var _a;
840
+ return null !== (_a = null == indicators ? void 0 : indicators.map((indicator => "string" == typeof indicator ? {
717
841
  indicatorKey: indicator,
718
842
  value: indicator
719
843
  } : {
720
844
  indicatorKey: indicator.indicatorKey,
721
845
  value: indicator.title
722
- }))) && void 0 !== _a ? _a : [],
846
+ }))) && void 0 !== _a ? _a : [];
847
+ }, node = {
848
+ value: grandTotalLabel,
849
+ dataValue: grandTotalDimensionIndexes.length ? this.groupedGrandTotalKey : void 0,
850
+ dimensionKey: rows[0],
851
+ levelSpan: Math.max(1, null !== (_a = grandTotalDimensionIndexes[0]) && void 0 !== _a ? _a : subTotalFlags.length),
852
+ children: [],
723
853
  role: "grand-total"
724
854
  };
855
+ if (grandTotalDimensionIndexes.length) {
856
+ const grandTotalMap = new Map;
857
+ this.getGroupedGrandTotalPaths(arr, rows, grandTotalDimensions, isRow, configuredRows).forEach((list => {
858
+ let parent = node;
859
+ const path = [ this.groupedGrandTotalKey ];
860
+ grandTotalDimensionIndexes.forEach(((dimensionIndex, index) => {
861
+ var _a;
862
+ const value = list[index];
863
+ path.push(value);
864
+ const flatKey = (0, join_1.join)(path, concatStr);
865
+ let item = grandTotalMap.get(flatKey);
866
+ if (!item) {
867
+ const nextDimensionIndex = null !== (_a = grandTotalDimensionIndexes[index + 1]) && void 0 !== _a ? _a : rows.length;
868
+ item = {
869
+ value: value,
870
+ dataValue: value,
871
+ dimensionKey: rows[dimensionIndex],
872
+ levelSpan: nextDimensionIndex - dimensionIndex,
873
+ children: index === grandTotalDimensionIndexes.length - 1 ? createIndicatorChildren() : []
874
+ }, grandTotalMap.set(flatKey, item), parent.children.push(item);
875
+ }
876
+ parent = item;
877
+ }));
878
+ }));
879
+ const totalChild = {
880
+ value: subTotalLabel,
881
+ dataValue: this.groupedGrandTotalSubtotalKey,
882
+ dimensionKey: rows[grandTotalDimensionIndexes[0]],
883
+ levelSpan: rows.length - grandTotalDimensionIndexes[0],
884
+ children: createIndicatorChildren()
885
+ };
886
+ showSubTotalsOnTop ? node.children.unshift(totalChild) : node.children.push(totalChild);
887
+ } else node.children = createIndicatorChildren();
725
888
  showGrandTotalsOnTop ? result.unshift(node) : result.push(node);
726
889
  }
727
890
  return result;
@@ -743,10 +906,10 @@ class Dataset {
743
906
  }
744
907
  "string" == typeof rowKey ? flatRowKey = rowKey : (indicatorPosition && "row" !== indicatorPosition.position || rowKey.map(((key, i) => {
745
908
  key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || rowKey.splice(i, 1);
746
- })), rowKey.length < this.rows.length && "grid-tree" === this.rowHierarchyType && (rowKey[0] === this.rowGrandTotalLabel || ((null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 && this.totals.row.subTotalsDimensions.find((dimension => dimension === rowDimensionKey)) || (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showSubTotalsOnTreeNode)) && rowKey[rowKey.length - 1] !== this.rowSubTotalLabel && rowKey.push(this.rowSubTotalLabel)),
909
+ })), rowKey.length < this.rows.length && "grid-tree" === this.rowHierarchyType && (rowKey[0] === this.rowGrandTotalLabel || rowKey[0] === this.groupedGrandTotalKey || ((null === (_b = null === (_a = this.totals) || void 0 === _a ? void 0 : _a.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && (null === (_e = null === (_d = null === (_c = this.totals) || void 0 === _c ? void 0 : _c.row) || void 0 === _d ? void 0 : _d.subTotalsDimensions) || void 0 === _e ? void 0 : _e.length) >= 1 && this.totals.row.subTotalsDimensions.find((dimension => dimension === rowDimensionKey)) || (null === (_g = null === (_f = this.totals) || void 0 === _f ? void 0 : _f.row) || void 0 === _g ? void 0 : _g.showSubTotalsOnTreeNode)) && rowKey[rowKey.length - 1] !== this.rowSubTotalLabel && rowKey.push(this.rowSubTotalLabel)),
747
910
  flatRowKey = (0, join_1.join)(rowKey, this.stringJoinChar)), "string" == typeof colKey ? flatColKey = colKey : (indicatorPosition && "col" !== indicatorPosition.position || colKey.map(((key, i) => {
748
911
  key !== indicator || (0, vutils_1.isValid)(null == indicatorPosition ? void 0 : indicatorPosition.index) && i !== indicatorPosition.index || colKey.splice(i, 1);
749
- })), colKey.length < this.columns.length && "grid-tree" === this.columnHierarchyType && (colKey[0] === this.colGrandTotalLabel || ((null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.column) || void 0 === _j ? void 0 : _j.subTotalsDimensions) && (null === (_m = null === (_l = null === (_k = this.totals) || void 0 === _k ? void 0 : _k.column) || void 0 === _l ? void 0 : _l.subTotalsDimensions) || void 0 === _m ? void 0 : _m.length) >= 1 && this.totals.column.subTotalsDimensions.find((dimension => dimension === colDimensionKey)) || (null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showSubTotalsOnTreeNode)) && colKey[colKey.length - 1] !== this.colSubTotalLabel && colKey.push(this.colSubTotalLabel)),
912
+ })), colKey.length < this.columns.length && "grid-tree" === this.columnHierarchyType && (colKey[0] === this.colGrandTotalLabel || colKey[0] === this.groupedGrandTotalKey || ((null === (_j = null === (_h = this.totals) || void 0 === _h ? void 0 : _h.column) || void 0 === _j ? void 0 : _j.subTotalsDimensions) && (null === (_m = null === (_l = null === (_k = this.totals) || void 0 === _k ? void 0 : _k.column) || void 0 === _l ? void 0 : _l.subTotalsDimensions) || void 0 === _m ? void 0 : _m.length) >= 1 && this.totals.column.subTotalsDimensions.find((dimension => dimension === colDimensionKey)) || (null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showSubTotalsOnTreeNode)) && colKey[colKey.length - 1] !== this.colSubTotalLabel && colKey.push(this.colSubTotalLabel)),
750
913
  flatColKey = (0, join_1.join)(colKey, this.stringJoinChar)), "string" == typeof newValue && (isNaN(parseFloat(newValue)) || (newValue = parseFloat(newValue))),
751
914
  (null === (_q = this.changedTree[flatRowKey]) || void 0 === _q ? void 0 : _q[flatColKey]) ? this.changedTree[flatRowKey][flatColKey][indicatorIndex] = newValue : this.changedTree[flatRowKey] ? (this.changedTree[flatRowKey][flatColKey] = [],
752
915
  this.changedTree[flatRowKey][flatColKey][indicatorIndex] = newValue) : (this.changedTree[flatRowKey] = {},
@@ -764,60 +927,54 @@ class Dataset {
764
927
  }
765
928
  }
766
929
  recalculateTotals(rowKey = [], colKey = [], indicator, newCellAggregator) {
767
- 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, _5, _6, _7, _8, _9, _10, _11;
930
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
768
931
  if (!this.totals || 0 === Object.keys(this.tree).length || !((null === (_a = this.totals.row) || void 0 === _a ? void 0 : _a.showGrandTotals) || (null === (_b = this.totals.row) || void 0 === _b ? void 0 : _b.subTotalsDimensions) && this.totals.row.subTotalsDimensions.length > 0 && !1 !== this.totals.row.showSubTotals) && !((null === (_c = this.totals.column) || void 0 === _c ? void 0 : _c.showGrandTotals) || (null === (_d = this.totals.column) || void 0 === _d ? void 0 : _d.subTotalsDimensions) && this.totals.column.subTotalsDimensions.length > 0 && !1 !== this.totals.column.showSubTotals)) return;
769
- const flatRowKey = Array.isArray(rowKey) ? rowKey.join(this.stringJoinChar) : rowKey, flatColKey = Array.isArray(colKey) ? colKey.join(this.stringJoinChar) : colKey, indicatorIndex = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys.indexOf(indicator), aggregatorsToReset = new Set, subTotalAggregators = new Set, rowKeyParts = flatRowKey.split(this.stringJoinChar), colKeyParts = flatColKey.split(this.stringJoinChar), addAggregatorToResetSet = (agg, rowKey, colKey) => {
932
+ const flatRowKey = Array.isArray(rowKey) ? (0, join_1.join)(rowKey, this.stringJoinChar) : rowKey, flatColKey = Array.isArray(colKey) ? (0,
933
+ join_1.join)(colKey, this.stringJoinChar) : colKey, indicatorIndex = this.indicatorKeysIncludeCalculatedFieldDependIndicatorKeys.indexOf(indicator), aggregatorsToReset = new Set, subTotalAggregators = new Set, rowKeyParts = Array.isArray(rowKey) ? rowKey.slice() : rowKey.split(this.stringJoinChar), colKeyParts = Array.isArray(colKey) ? colKey.slice() : colKey.split(this.stringJoinChar), addAggregatorToResetSet = (agg, rowKey, colKey) => {
770
934
  !agg || rowKey === flatRowKey && colKey === flatColKey || (aggregatorsToReset.add(agg),
771
935
  rowKey !== flatRowKey && colKey !== flatColKey || subTotalAggregators.add(agg));
772
- };
936
+ }, rowAggregateKeys = [], colAggregateKeys = [];
773
937
  if ((null === (_f = null === (_e = this.totals) || void 0 === _e ? void 0 : _e.row) || void 0 === _f ? void 0 : _f.subTotalsDimensions) && !1 !== this.totals.row.showSubTotals) for (let i = 0; i < this.totals.row.subTotalsDimensions.length; i++) {
774
938
  const dimension = this.totals.row.subTotalsDimensions[i], dimensionIndex = this.rows.indexOf(dimension);
775
939
  if (dimensionIndex >= 0 && dimensionIndex < rowKeyParts.length) {
776
940
  const rowSubTotalKeyParts = rowKeyParts.slice(0, dimensionIndex + 1);
777
941
  "tree" !== this.rowHierarchyType && rowSubTotalKeyParts.push(this.rowSubTotalLabel);
778
942
  const flatRowSubTotalKey = rowSubTotalKeyParts.join(this.stringJoinChar);
779
- if ((null === (_h = null === (_g = this.tree[flatRowSubTotalKey]) || void 0 === _g ? void 0 : _g[flatColKey]) || void 0 === _h ? void 0 : _h[indicatorIndex]) && addAggregatorToResetSet(this.tree[flatRowSubTotalKey][flatColKey][indicatorIndex], flatRowSubTotalKey, flatColKey),
780
- (null === (_k = null === (_j = this.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.subTotalsDimensions) && !1 !== this.totals.column.showSubTotals) for (let j = 0; j < this.totals.column.subTotalsDimensions.length; j++) {
781
- const colDimension = this.totals.column.subTotalsDimensions[j], colDimensionIndex = this.columns.indexOf(colDimension);
782
- if (colDimensionIndex >= 0 && colDimensionIndex < colKeyParts.length) {
783
- const colSubTotalKeyParts = colKeyParts.slice(0, colDimensionIndex + 1);
784
- colSubTotalKeyParts.push(this.colSubTotalLabel);
785
- const flatColSubTotalKey = colSubTotalKeyParts.join(this.stringJoinChar);
786
- (null === (_m = null === (_l = this.tree[flatRowSubTotalKey]) || void 0 === _l ? void 0 : _l[flatColSubTotalKey]) || void 0 === _m ? void 0 : _m[indicatorIndex]) && addAggregatorToResetSet(this.tree[flatRowSubTotalKey][flatColSubTotalKey][indicatorIndex], flatRowSubTotalKey, flatColSubTotalKey);
787
- }
788
- }
789
- (null === (_p = null === (_o = this.totals) || void 0 === _o ? void 0 : _o.column) || void 0 === _p ? void 0 : _p.showGrandTotals) && (null === (_r = null === (_q = this.tree[flatRowSubTotalKey]) || void 0 === _q ? void 0 : _q[this.colGrandTotalLabel]) || void 0 === _r ? void 0 : _r[indicatorIndex]) && addAggregatorToResetSet(this.tree[flatRowSubTotalKey][this.colGrandTotalLabel][indicatorIndex], flatRowSubTotalKey, this.colGrandTotalLabel);
943
+ -1 === rowAggregateKeys.indexOf(flatRowSubTotalKey) && rowAggregateKeys.push(flatRowSubTotalKey);
790
944
  }
791
945
  }
792
- if (null === (_t = null === (_s = this.totals) || void 0 === _s ? void 0 : _s.row) || void 0 === _t ? void 0 : _t.showGrandTotals) {
793
- if (null === (_v = null === (_u = this.tree[this.rowGrandTotalLabel]) || void 0 === _u ? void 0 : _u[flatColKey]) || void 0 === _v ? void 0 : _v[indicatorIndex]) {
794
- if (addAggregatorToResetSet(this.tree[this.rowGrandTotalLabel][flatColKey][indicatorIndex], this.rowGrandTotalLabel, flatColKey),
795
- (null === (_x = null === (_w = this.totals) || void 0 === _w ? void 0 : _w.column) || void 0 === _x ? void 0 : _x.subTotalsDimensions) && !1 !== this.totals.column.showSubTotals) for (let j = 0; j < this.totals.column.subTotalsDimensions.length; j++) {
796
- const colDimension = this.totals.column.subTotalsDimensions[j], colDimensionIndex = this.columns.indexOf(colDimension);
797
- if (colDimensionIndex >= 0 && colDimensionIndex < colKeyParts.length) {
798
- const colSubTotalKeyParts = colKeyParts.slice(0, colDimensionIndex + 1);
799
- colSubTotalKeyParts.push(this.colSubTotalLabel);
800
- const flatColSubTotalKey = colSubTotalKeyParts.join(this.stringJoinChar);
801
- (null === (_z = null === (_y = this.tree[this.rowGrandTotalLabel]) || void 0 === _y ? void 0 : _y[flatColSubTotalKey]) || void 0 === _z ? void 0 : _z[indicatorIndex]) && addAggregatorToResetSet(this.tree[this.rowGrandTotalLabel][flatColSubTotalKey][indicatorIndex], this.rowGrandTotalLabel, flatColSubTotalKey);
802
- }
803
- }
804
- (null === (_1 = null === (_0 = this.totals) || void 0 === _0 ? void 0 : _0.column) || void 0 === _1 ? void 0 : _1.showGrandTotals) && (null === (_3 = null === (_2 = this.tree[this.rowGrandTotalLabel]) || void 0 === _2 ? void 0 : _2[this.colGrandTotalLabel]) || void 0 === _3 ? void 0 : _3[indicatorIndex]) && addAggregatorToResetSet(this.tree[this.rowGrandTotalLabel][this.colGrandTotalLabel][indicatorIndex], this.rowGrandTotalLabel, this.colGrandTotalLabel);
805
- }
806
- if ((null === (_5 = null === (_4 = this.totals) || void 0 === _4 ? void 0 : _4.column) || void 0 === _5 ? void 0 : _5.subTotalsDimensions) && !1 !== this.totals.column.showSubTotals) for (let j = 0; j < this.totals.column.subTotalsDimensions.length; j++) {
807
- const colDimension = this.totals.column.subTotalsDimensions[j], colDimensionIndex = this.columns.indexOf(colDimension);
808
- if (colDimensionIndex >= 0 && colDimensionIndex < colKeyParts.length) {
809
- const colSubTotalKeyParts = colKeyParts.slice(0, colDimensionIndex + 1);
810
- colSubTotalKeyParts.push(this.colSubTotalLabel);
811
- const flatColSubTotalKey = colSubTotalKeyParts.join(this.stringJoinChar);
812
- (null === (_7 = null === (_6 = this.tree[flatRowKey]) || void 0 === _6 ? void 0 : _6[flatColSubTotalKey]) || void 0 === _7 ? void 0 : _7[indicatorIndex]) && addAggregatorToResetSet(this.tree[flatRowKey][flatColSubTotalKey][indicatorIndex], flatRowKey, flatColSubTotalKey);
813
- }
946
+ if (null === (_h = null === (_g = this.totals) || void 0 === _g ? void 0 : _g.row) || void 0 === _h ? void 0 : _h.showGrandTotals) {
947
+ const rowGrandTotalKeys = this.getGrandTotalKeys(rowKeyParts, this.rows.filter(((_, index) => this.rowsHasValue[index])), this.totals.row.grandTotalDimensions, this.rowGrandTotalLabel, this.rows);
948
+ for (const rowGrandTotalKey of rowGrandTotalKeys) -1 === rowAggregateKeys.indexOf(rowGrandTotalKey) && rowAggregateKeys.push(rowGrandTotalKey);
949
+ }
950
+ if ((null === (_k = null === (_j = this.totals) || void 0 === _j ? void 0 : _j.column) || void 0 === _k ? void 0 : _k.subTotalsDimensions) && !1 !== this.totals.column.showSubTotals) for (let j = 0; j < this.totals.column.subTotalsDimensions.length; j++) {
951
+ const colDimension = this.totals.column.subTotalsDimensions[j], colDimensionIndex = this.columns.indexOf(colDimension);
952
+ if (colDimensionIndex >= 0 && colDimensionIndex < colKeyParts.length) {
953
+ const colSubTotalKeyParts = colKeyParts.slice(0, colDimensionIndex + 1);
954
+ colSubTotalKeyParts.push(this.colSubTotalLabel);
955
+ const flatColSubTotalKey = colSubTotalKeyParts.join(this.stringJoinChar);
956
+ -1 === colAggregateKeys.indexOf(flatColSubTotalKey) && colAggregateKeys.push(flatColSubTotalKey);
814
957
  }
815
- (null === (_9 = null === (_8 = this.totals) || void 0 === _8 ? void 0 : _8.column) || void 0 === _9 ? void 0 : _9.showGrandTotals) && (null === (_11 = null === (_10 = this.tree[flatRowKey]) || void 0 === _10 ? void 0 : _10[this.colGrandTotalLabel]) || void 0 === _11 ? void 0 : _11[indicatorIndex]) && addAggregatorToResetSet(this.tree[flatRowKey][this.colGrandTotalLabel][indicatorIndex], flatRowKey, this.colGrandTotalLabel),
816
- aggregatorsToReset.forEach((agg => {
817
- newCellAggregator && subTotalAggregators.has(agg) && agg.push(newCellAggregator),
818
- agg.recalculate();
819
- }));
820
958
  }
959
+ if (null === (_m = null === (_l = this.totals) || void 0 === _l ? void 0 : _l.column) || void 0 === _m ? void 0 : _m.showGrandTotals) {
960
+ const colGrandTotalKeys = this.getGrandTotalKeys(colKeyParts, this.columns.filter(((_, index) => this.columnsHasValue[index])), this.totals.column.grandTotalDimensions, this.colGrandTotalLabel, this.columns);
961
+ for (const colGrandTotalKey of colGrandTotalKeys) -1 === colAggregateKeys.indexOf(colGrandTotalKey) && colAggregateKeys.push(colGrandTotalKey);
962
+ }
963
+ rowAggregateKeys.forEach((rowAggregateKey => {
964
+ var _a, _b;
965
+ addAggregatorToResetSet(null === (_b = null === (_a = this.tree[rowAggregateKey]) || void 0 === _a ? void 0 : _a[flatColKey]) || void 0 === _b ? void 0 : _b[indicatorIndex], rowAggregateKey, flatColKey);
966
+ })), colAggregateKeys.forEach((colAggregateKey => {
967
+ var _a, _b;
968
+ addAggregatorToResetSet(null === (_b = null === (_a = this.tree[flatRowKey]) || void 0 === _a ? void 0 : _a[colAggregateKey]) || void 0 === _b ? void 0 : _b[indicatorIndex], flatRowKey, colAggregateKey);
969
+ })), rowAggregateKeys.forEach((rowAggregateKey => {
970
+ colAggregateKeys.forEach((colAggregateKey => {
971
+ var _a, _b;
972
+ addAggregatorToResetSet(null === (_b = null === (_a = this.tree[rowAggregateKey]) || void 0 === _a ? void 0 : _a[colAggregateKey]) || void 0 === _b ? void 0 : _b[indicatorIndex], rowAggregateKey, colAggregateKey);
973
+ }));
974
+ })), aggregatorsToReset.forEach((agg => {
975
+ newCellAggregator && subTotalAggregators.has(agg) && agg.push(newCellAggregator),
976
+ agg.recalculate();
977
+ }));
821
978
  }
822
979
  changeRecordFieldValue(fieldName, oldValue, value) {
823
980
  var _a;