@visactor/vtable 0.9.1-alpha.4 → 0.9.1

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 (431) hide show
  1. package/cjs/ListTable.js +15 -4
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotTable.d.ts +2 -1
  4. package/cjs/PivotTable.js +15 -3
  5. package/cjs/PivotTable.js.map +1 -1
  6. package/cjs/body-helper/body-helper.d.ts +1 -0
  7. package/cjs/body-helper/body-helper.js +6 -3
  8. package/cjs/body-helper/body-helper.js.map +1 -1
  9. package/cjs/body-helper/style/ProgressBarStyle.js +14 -8
  10. package/cjs/body-helper/style/ProgressBarStyle.js.map +1 -1
  11. package/cjs/body-helper/style/Style.d.ts +3 -0
  12. package/cjs/body-helper/style/Style.js +21 -14
  13. package/cjs/body-helper/style/Style.js.map +1 -1
  14. package/cjs/core/BaseTable.d.ts +4 -1
  15. package/cjs/core/BaseTable.js +31 -20
  16. package/cjs/core/BaseTable.js.map +1 -1
  17. package/cjs/core/tableHelper.js +11 -6
  18. package/cjs/core/tableHelper.js.map +1 -1
  19. package/cjs/data/DataSource.d.ts +4 -1
  20. package/cjs/data/DataSource.js +3 -3
  21. package/cjs/data/DataSource.js.map +1 -1
  22. package/cjs/event/event.d.ts +14 -19
  23. package/cjs/event/event.js +12 -329
  24. package/cjs/event/event.js.map +1 -1
  25. package/cjs/event/listener/container-dom.d.ts +2 -0
  26. package/cjs/event/listener/container-dom.js +42 -0
  27. package/cjs/event/listener/container-dom.js.map +1 -0
  28. package/cjs/event/listener/scroll-bar.d.ts +2 -0
  29. package/cjs/event/listener/scroll-bar.js +44 -0
  30. package/cjs/event/listener/scroll-bar.js.map +1 -0
  31. package/cjs/event/listener/table-group.d.ts +2 -0
  32. package/cjs/event/listener/table-group.js +262 -0
  33. package/cjs/event/listener/table-group.js.map +1 -0
  34. package/cjs/event/listener/touch.d.ts +2 -0
  35. package/cjs/event/listener/touch.js +76 -0
  36. package/cjs/event/listener/touch.js.map +1 -0
  37. package/cjs/event/scroll.d.ts +2 -0
  38. package/cjs/event/scroll.js +32 -4
  39. package/cjs/event/scroll.js.map +1 -1
  40. package/cjs/event/util.d.ts +16 -0
  41. package/cjs/event/util.js +30 -0
  42. package/cjs/event/util.js.map +1 -0
  43. package/cjs/header-helper/header-helper.d.ts +5 -6
  44. package/cjs/header-helper/header-helper.js +19 -22
  45. package/cjs/header-helper/header-helper.js.map +1 -1
  46. package/cjs/icons.js +11 -11
  47. package/cjs/icons.js.map +1 -1
  48. package/cjs/index.d.ts +1 -1
  49. package/cjs/index.js +1 -1
  50. package/cjs/index.js.map +1 -1
  51. package/cjs/layout/index.js +1 -2
  52. package/cjs/layout/pivot-header-layout.d.ts +4 -1
  53. package/cjs/layout/pivot-header-layout.js +15 -14
  54. package/cjs/layout/pivot-header-layout.js.map +1 -1
  55. package/cjs/layout/simple-header-layout.d.ts +13 -1
  56. package/cjs/layout/simple-header-layout.js +12 -1
  57. package/cjs/layout/simple-header-layout.js.map +1 -1
  58. package/cjs/render/layout/container.js +1 -1
  59. package/cjs/render/layout/container.js.map +1 -1
  60. package/cjs/render/layout/element.d.ts +1 -1
  61. package/cjs/render/layout/element.js.map +1 -1
  62. package/cjs/render/layout/rect.d.ts +2 -2
  63. package/cjs/render/layout/rect.js +2 -2
  64. package/cjs/render/layout/rect.js.map +1 -1
  65. package/cjs/scenegraph/component/custom.js +18 -7
  66. package/cjs/scenegraph/component/custom.js.map +1 -1
  67. package/cjs/scenegraph/component/menu.js +2 -2
  68. package/cjs/scenegraph/component/menu.js.map +1 -1
  69. package/cjs/scenegraph/component/table-component.d.ts +3 -3
  70. package/cjs/scenegraph/component/table-component.js +36 -26
  71. package/cjs/scenegraph/component/table-component.js.map +1 -1
  72. package/cjs/scenegraph/graphic/chart.d.ts +1 -0
  73. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  74. package/cjs/scenegraph/graphic/contributions/chart-render.js +7 -2
  75. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  76. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  77. package/cjs/scenegraph/graphic/group.d.ts +4 -0
  78. package/cjs/scenegraph/graphic/group.js +6 -0
  79. package/cjs/scenegraph/graphic/group.js.map +1 -1
  80. package/cjs/scenegraph/graphic/text.js +7 -7
  81. package/cjs/scenegraph/graphic/text.js.map +1 -1
  82. package/cjs/scenegraph/group-creater/cell-helper.d.ts +3 -4
  83. package/cjs/scenegraph/group-creater/cell-helper.js +25 -18
  84. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  85. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +6 -4
  86. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  87. package/cjs/scenegraph/group-creater/cell-type/image-cell.js +11 -1
  88. package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  89. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +12 -9
  90. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  91. package/cjs/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  92. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +7 -4
  93. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  94. package/cjs/scenegraph/group-creater/cell-type/video-cell.js +1 -1
  95. package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  96. package/cjs/scenegraph/group-creater/column-helper.d.ts +3 -3
  97. package/cjs/scenegraph/group-creater/column-helper.js +22 -11
  98. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  99. package/cjs/scenegraph/group-creater/column.d.ts +0 -6
  100. package/cjs/scenegraph/group-creater/column.js +3 -12
  101. package/cjs/scenegraph/group-creater/column.js.map +1 -1
  102. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +0 -2
  103. package/cjs/scenegraph/group-creater/progress/proxy.js +23 -19
  104. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  105. package/cjs/scenegraph/layout/auto-height.js +1 -1
  106. package/cjs/scenegraph/layout/auto-height.js.map +1 -1
  107. package/cjs/scenegraph/layout/auto-width.js +1 -1
  108. package/cjs/scenegraph/layout/auto-width.js.map +1 -1
  109. package/cjs/scenegraph/layout/compute-col-width.d.ts +1 -1
  110. package/cjs/scenegraph/layout/compute-col-width.js +28 -8
  111. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  112. package/cjs/scenegraph/layout/frozen.d.ts +3 -0
  113. package/cjs/scenegraph/layout/frozen.js +66 -0
  114. package/cjs/scenegraph/layout/frozen.js.map +1 -0
  115. package/cjs/scenegraph/layout/move-cell.js +5 -1
  116. package/cjs/scenegraph/layout/move-cell.js.map +1 -1
  117. package/cjs/scenegraph/layout/update-cell.js +3 -3
  118. package/cjs/scenegraph/layout/update-cell.js.map +1 -1
  119. package/cjs/scenegraph/layout/update-height.js +4 -4
  120. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  121. package/cjs/scenegraph/layout/update-row.d.ts +3 -0
  122. package/cjs/scenegraph/layout/update-row.js +81 -0
  123. package/cjs/scenegraph/layout/update-row.js.map +1 -0
  124. package/cjs/scenegraph/layout/update-width.js +5 -5
  125. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  126. package/cjs/scenegraph/refresh-node/update-chart.d.ts +2 -0
  127. package/cjs/scenegraph/refresh-node/update-chart.js +26 -0
  128. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -0
  129. package/cjs/scenegraph/scenegraph.d.ts +15 -3
  130. package/cjs/scenegraph/scenegraph.js +86 -95
  131. package/cjs/scenegraph/scenegraph.js.map +1 -1
  132. package/cjs/scenegraph/select/create-select-border.js +1 -0
  133. package/cjs/scenegraph/select/create-select-border.js.map +1 -1
  134. package/cjs/scenegraph/stick-text/index.js +52 -40
  135. package/cjs/scenegraph/stick-text/index.js.map +1 -1
  136. package/cjs/scenegraph/style/frame-border.d.ts +1 -1
  137. package/cjs/scenegraph/style/frame-border.js +7 -7
  138. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  139. package/cjs/scenegraph/utils/deal-promise-data.d.ts +2 -0
  140. package/cjs/scenegraph/utils/deal-promise-data.js +14 -0
  141. package/cjs/scenegraph/utils/deal-promise-data.js.map +1 -0
  142. package/cjs/scenegraph/utils/empty-group.d.ts +2 -0
  143. package/cjs/scenegraph/utils/empty-group.js +10 -0
  144. package/cjs/scenegraph/utils/empty-group.js.map +1 -0
  145. package/cjs/scenegraph/utils/get-hierarchy-offset.d.ts +2 -0
  146. package/cjs/scenegraph/utils/get-hierarchy-offset.js +27 -0
  147. package/cjs/scenegraph/utils/get-hierarchy-offset.js.map +1 -0
  148. package/cjs/scenegraph/utils/padding.d.ts +1 -1
  149. package/cjs/scenegraph/utils/padding.js +3 -3
  150. package/cjs/scenegraph/utils/padding.js.map +1 -1
  151. package/cjs/scenegraph/utils/text-icon-layout.d.ts +3 -2
  152. package/cjs/scenegraph/utils/text-icon-layout.js +24 -19
  153. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  154. package/cjs/scenegraph/utils/text-pos.js +1 -1
  155. package/cjs/scenegraph/utils/text-pos.js.map +1 -1
  156. package/cjs/state/cell-move/adjust-header.js +9 -2
  157. package/cjs/state/cell-move/adjust-header.js.map +1 -1
  158. package/cjs/state/cell-move/index.js +9 -3
  159. package/cjs/state/cell-move/index.js.map +1 -1
  160. package/cjs/state/frozen/index.d.ts +2 -0
  161. package/cjs/state/{pin → frozen}/index.js +2 -2
  162. package/cjs/state/frozen/index.js.map +1 -0
  163. package/cjs/state/state.d.ts +1 -1
  164. package/cjs/state/state.js +16 -12
  165. package/cjs/state/state.js.map +1 -1
  166. package/cjs/themes/ARCO.js +1 -1
  167. package/cjs/themes/ARCO.js.map +1 -1
  168. package/cjs/themes/BRIGHT.js +1 -1
  169. package/cjs/themes/BRIGHT.js.map +1 -1
  170. package/cjs/themes/DARK.js +1 -1
  171. package/cjs/themes/DARK.js.map +1 -1
  172. package/cjs/themes/DEFAULT.js +1 -1
  173. package/cjs/themes/DEFAULT.js.map +1 -1
  174. package/cjs/themes/theme.d.ts +1 -1
  175. package/cjs/themes/theme.js +6 -6
  176. package/cjs/themes/theme.js.map +1 -1
  177. package/cjs/tools/LimitPromiseQueue.js +1 -2
  178. package/cjs/tools/NumberMap.js +1 -1
  179. package/cjs/tools/Rect.js +1 -1
  180. package/cjs/tools/calc.js +1 -1
  181. package/cjs/tools/debounce.js +1 -1
  182. package/cjs/tools/diff-cell.d.ts +10 -0
  183. package/cjs/tools/diff-cell.js +49 -0
  184. package/cjs/tools/diff-cell.js.map +1 -0
  185. package/cjs/tools/dom.js +1 -1
  186. package/cjs/tools/env.js +1 -1
  187. package/cjs/tools/helper.d.ts +11 -0
  188. package/cjs/tools/helper.js +7 -2
  189. package/cjs/tools/helper.js.map +1 -1
  190. package/cjs/tooltip/BaseTooltip.js +1 -1
  191. package/cjs/tooltip/Tooltip.js +2 -1
  192. package/cjs/tooltip/TooltipHandler.js +1 -1
  193. package/cjs/ts-types/base-table.d.ts +8 -2
  194. package/cjs/ts-types/base-table.js +1 -1
  195. package/cjs/ts-types/base-table.js.map +1 -1
  196. package/cjs/ts-types/common.js +1 -1
  197. package/cjs/ts-types/customElement.d.ts +11 -2
  198. package/cjs/ts-types/customElement.js +1 -1
  199. package/cjs/ts-types/customElement.js.map +1 -1
  200. package/cjs/ts-types/customLayout.js +1 -1
  201. package/cjs/ts-types/events.js +1 -1
  202. package/cjs/ts-types/icon.d.ts +4 -5
  203. package/cjs/ts-types/icon.js +6 -6
  204. package/cjs/ts-types/icon.js.map +1 -1
  205. package/cjs/ts-types/list-table/define/basic-define.d.ts +4 -1
  206. package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
  207. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  208. package/cjs/ts-types/theme.d.ts +1 -1
  209. package/cjs/ts-types/theme.js.map +1 -1
  210. package/dist/vtable.es5.js +53155 -0
  211. package/dist/vtable.es5.min.js +3 -0
  212. package/dist/vtable.js +17155 -21633
  213. package/dist/vtable.min.js +15 -3
  214. package/es/ListTable.js +16 -3
  215. package/es/ListTable.js.map +1 -1
  216. package/es/PivotTable.d.ts +2 -1
  217. package/es/PivotTable.js +16 -2
  218. package/es/PivotTable.js.map +1 -1
  219. package/es/body-helper/body-helper.d.ts +1 -0
  220. package/es/body-helper/body-helper.js +6 -3
  221. package/es/body-helper/body-helper.js.map +1 -1
  222. package/es/body-helper/style/ProgressBarStyle.js +14 -8
  223. package/es/body-helper/style/ProgressBarStyle.js.map +1 -1
  224. package/es/body-helper/style/Style.d.ts +3 -0
  225. package/es/body-helper/style/Style.js +21 -14
  226. package/es/body-helper/style/Style.js.map +1 -1
  227. package/es/core/BaseTable.d.ts +4 -1
  228. package/es/core/BaseTable.js +31 -21
  229. package/es/core/BaseTable.js.map +1 -1
  230. package/es/core/tableHelper.js +11 -7
  231. package/es/core/tableHelper.js.map +1 -1
  232. package/es/data/DataSource.d.ts +4 -1
  233. package/es/data/DataSource.js +4 -2
  234. package/es/data/DataSource.js.map +1 -1
  235. package/es/event/event.d.ts +14 -19
  236. package/es/event/event.js +16 -333
  237. package/es/event/event.js.map +1 -1
  238. package/es/event/listener/container-dom.d.ts +2 -0
  239. package/es/event/listener/container-dom.js +40 -0
  240. package/es/event/listener/container-dom.js.map +1 -0
  241. package/es/event/listener/scroll-bar.d.ts +2 -0
  242. package/es/event/listener/scroll-bar.js +37 -0
  243. package/es/event/listener/scroll-bar.js.map +1 -0
  244. package/es/event/listener/table-group.d.ts +2 -0
  245. package/es/event/listener/table-group.js +265 -0
  246. package/es/event/listener/table-group.js.map +1 -0
  247. package/es/event/listener/touch.d.ts +2 -0
  248. package/es/event/listener/touch.js +67 -0
  249. package/es/event/listener/touch.js.map +1 -0
  250. package/es/event/scroll.d.ts +2 -0
  251. package/es/event/scroll.js +29 -3
  252. package/es/event/scroll.js.map +1 -1
  253. package/es/event/util.d.ts +16 -0
  254. package/es/event/util.js +24 -0
  255. package/es/event/util.js.map +1 -0
  256. package/es/header-helper/header-helper.d.ts +5 -6
  257. package/es/header-helper/header-helper.js +22 -24
  258. package/es/header-helper/header-helper.js.map +1 -1
  259. package/es/icons.js +11 -11
  260. package/es/icons.js.map +1 -1
  261. package/es/index.d.ts +1 -1
  262. package/es/index.js +1 -1
  263. package/es/index.js.map +1 -1
  264. package/es/layout/index.js +1 -2
  265. package/es/layout/pivot-header-layout.d.ts +4 -1
  266. package/es/layout/pivot-header-layout.js +17 -13
  267. package/es/layout/pivot-header-layout.js.map +1 -1
  268. package/es/layout/simple-header-layout.d.ts +13 -1
  269. package/es/layout/simple-header-layout.js +12 -1
  270. package/es/layout/simple-header-layout.js.map +1 -1
  271. package/es/render/layout/container.js +1 -1
  272. package/es/render/layout/container.js.map +1 -1
  273. package/es/render/layout/element.d.ts +1 -1
  274. package/es/render/layout/element.js.map +1 -1
  275. package/es/render/layout/rect.d.ts +2 -2
  276. package/es/render/layout/rect.js +2 -2
  277. package/es/render/layout/rect.js.map +1 -1
  278. package/es/scenegraph/component/custom.js +20 -9
  279. package/es/scenegraph/component/custom.js.map +1 -1
  280. package/es/scenegraph/component/menu.js +2 -2
  281. package/es/scenegraph/component/menu.js.map +1 -1
  282. package/es/scenegraph/component/table-component.d.ts +3 -3
  283. package/es/scenegraph/component/table-component.js +36 -26
  284. package/es/scenegraph/component/table-component.js.map +1 -1
  285. package/es/scenegraph/graphic/chart.d.ts +1 -0
  286. package/es/scenegraph/graphic/chart.js.map +1 -1
  287. package/es/scenegraph/graphic/contributions/chart-render.js +7 -2
  288. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  289. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  290. package/es/scenegraph/graphic/group.d.ts +4 -0
  291. package/es/scenegraph/graphic/group.js +6 -0
  292. package/es/scenegraph/graphic/group.js.map +1 -1
  293. package/es/scenegraph/graphic/text.js +7 -7
  294. package/es/scenegraph/graphic/text.js.map +1 -1
  295. package/es/scenegraph/group-creater/cell-helper.d.ts +3 -4
  296. package/es/scenegraph/group-creater/cell-helper.js +28 -17
  297. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  298. package/es/scenegraph/group-creater/cell-type/chart-cell.js +6 -4
  299. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  300. package/es/scenegraph/group-creater/cell-type/image-cell.js +12 -2
  301. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  302. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +13 -10
  303. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  304. package/es/scenegraph/group-creater/cell-type/text-cell.d.ts +1 -1
  305. package/es/scenegraph/group-creater/cell-type/text-cell.js +7 -4
  306. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  307. package/es/scenegraph/group-creater/cell-type/video-cell.js +1 -1
  308. package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  309. package/es/scenegraph/group-creater/column-helper.d.ts +3 -3
  310. package/es/scenegraph/group-creater/column-helper.js +25 -10
  311. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  312. package/es/scenegraph/group-creater/column.d.ts +0 -6
  313. package/es/scenegraph/group-creater/column.js +3 -12
  314. package/es/scenegraph/group-creater/column.js.map +1 -1
  315. package/es/scenegraph/group-creater/progress/proxy.d.ts +0 -2
  316. package/es/scenegraph/group-creater/progress/proxy.js +22 -21
  317. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  318. package/es/scenegraph/layout/auto-height.js +1 -1
  319. package/es/scenegraph/layout/auto-height.js.map +1 -1
  320. package/es/scenegraph/layout/auto-width.js +2 -2
  321. package/es/scenegraph/layout/auto-width.js.map +1 -1
  322. package/es/scenegraph/layout/compute-col-width.d.ts +1 -1
  323. package/es/scenegraph/layout/compute-col-width.js +30 -10
  324. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  325. package/es/scenegraph/layout/frozen.d.ts +3 -0
  326. package/es/scenegraph/layout/frozen.js +58 -0
  327. package/es/scenegraph/layout/frozen.js.map +1 -0
  328. package/es/scenegraph/layout/move-cell.js +5 -1
  329. package/es/scenegraph/layout/move-cell.js.map +1 -1
  330. package/es/scenegraph/layout/update-cell.js +4 -4
  331. package/es/scenegraph/layout/update-cell.js.map +1 -1
  332. package/es/scenegraph/layout/update-height.js +5 -5
  333. package/es/scenegraph/layout/update-height.js.map +1 -1
  334. package/es/scenegraph/layout/update-row.d.ts +3 -0
  335. package/es/scenegraph/layout/update-row.js +73 -0
  336. package/es/scenegraph/layout/update-row.js.map +1 -0
  337. package/es/scenegraph/layout/update-width.js +6 -6
  338. package/es/scenegraph/layout/update-width.js.map +1 -1
  339. package/es/scenegraph/refresh-node/update-chart.d.ts +2 -0
  340. package/es/scenegraph/refresh-node/update-chart.js +20 -0
  341. package/es/scenegraph/refresh-node/update-chart.js.map +1 -0
  342. package/es/scenegraph/scenegraph.d.ts +15 -3
  343. package/es/scenegraph/scenegraph.js +92 -94
  344. package/es/scenegraph/scenegraph.js.map +1 -1
  345. package/es/scenegraph/select/create-select-border.js +1 -0
  346. package/es/scenegraph/select/create-select-border.js.map +1 -1
  347. package/es/scenegraph/stick-text/index.js +52 -40
  348. package/es/scenegraph/stick-text/index.js.map +1 -1
  349. package/es/scenegraph/style/frame-border.d.ts +1 -1
  350. package/es/scenegraph/style/frame-border.js +9 -9
  351. package/es/scenegraph/style/frame-border.js.map +1 -1
  352. package/es/scenegraph/utils/deal-promise-data.d.ts +2 -0
  353. package/es/scenegraph/utils/deal-promise-data.js +8 -0
  354. package/es/scenegraph/utils/deal-promise-data.js.map +1 -0
  355. package/es/scenegraph/utils/empty-group.d.ts +2 -0
  356. package/es/scenegraph/utils/empty-group.js +6 -0
  357. package/es/scenegraph/utils/empty-group.js.map +1 -0
  358. package/es/scenegraph/utils/get-hierarchy-offset.d.ts +2 -0
  359. package/es/scenegraph/utils/get-hierarchy-offset.js +19 -0
  360. package/es/scenegraph/utils/get-hierarchy-offset.js.map +1 -0
  361. package/es/scenegraph/utils/padding.d.ts +1 -1
  362. package/es/scenegraph/utils/padding.js +1 -1
  363. package/es/scenegraph/utils/padding.js.map +1 -1
  364. package/es/scenegraph/utils/text-icon-layout.d.ts +3 -2
  365. package/es/scenegraph/utils/text-icon-layout.js +27 -19
  366. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  367. package/es/scenegraph/utils/text-pos.js +2 -2
  368. package/es/scenegraph/utils/text-pos.js.map +1 -1
  369. package/es/state/cell-move/adjust-header.js +9 -2
  370. package/es/state/cell-move/adjust-header.js.map +1 -1
  371. package/es/state/cell-move/index.js +9 -3
  372. package/es/state/cell-move/index.js.map +1 -1
  373. package/es/state/frozen/index.d.ts +2 -0
  374. package/es/state/{pin → frozen}/index.js +1 -1
  375. package/es/state/frozen/index.js.map +1 -0
  376. package/es/state/state.d.ts +1 -1
  377. package/es/state/state.js +16 -12
  378. package/es/state/state.js.map +1 -1
  379. package/es/themes/ARCO.js +1 -1
  380. package/es/themes/ARCO.js.map +1 -1
  381. package/es/themes/BRIGHT.js +1 -1
  382. package/es/themes/BRIGHT.js.map +1 -1
  383. package/es/themes/DARK.js +1 -1
  384. package/es/themes/DARK.js.map +1 -1
  385. package/es/themes/DEFAULT.js +1 -1
  386. package/es/themes/DEFAULT.js.map +1 -1
  387. package/es/themes/theme.d.ts +1 -1
  388. package/es/themes/theme.js +6 -6
  389. package/es/themes/theme.js.map +1 -1
  390. package/es/tools/LimitPromiseQueue.js +1 -2
  391. package/es/tools/NumberMap.js +1 -1
  392. package/es/tools/Rect.js +1 -1
  393. package/es/tools/calc.js +1 -1
  394. package/es/tools/debounce.js +1 -1
  395. package/es/tools/diff-cell.d.ts +10 -0
  396. package/es/tools/diff-cell.js +42 -0
  397. package/es/tools/diff-cell.js.map +1 -0
  398. package/es/tools/dom.js +1 -1
  399. package/es/tools/env.js +1 -1
  400. package/es/tools/helper.d.ts +11 -0
  401. package/es/tools/helper.js +4 -0
  402. package/es/tools/helper.js.map +1 -1
  403. package/es/tooltip/BaseTooltip.js +1 -1
  404. package/es/tooltip/Tooltip.js +2 -1
  405. package/es/tooltip/TooltipHandler.js +1 -1
  406. package/es/ts-types/base-table.d.ts +8 -2
  407. package/es/ts-types/base-table.js +1 -1
  408. package/es/ts-types/base-table.js.map +1 -1
  409. package/es/ts-types/common.js +1 -1
  410. package/es/ts-types/customElement.d.ts +11 -2
  411. package/es/ts-types/customElement.js +1 -1
  412. package/es/ts-types/customElement.js.map +1 -1
  413. package/es/ts-types/customLayout.js +1 -1
  414. package/es/ts-types/events.js +1 -1
  415. package/es/ts-types/icon.d.ts +4 -5
  416. package/es/ts-types/icon.js +6 -6
  417. package/es/ts-types/icon.js.map +1 -1
  418. package/es/ts-types/list-table/define/basic-define.d.ts +4 -1
  419. package/es/ts-types/list-table/define/basic-define.js.map +1 -1
  420. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  421. package/es/ts-types/theme.d.ts +1 -1
  422. package/es/ts-types/theme.js.map +1 -1
  423. package/package.json +9 -9
  424. package/cjs/scenegraph/component/menu.d.ts +0 -41
  425. package/cjs/scenegraph/graphic/text.d.ts +0 -16
  426. package/cjs/state/pin/index.d.ts +0 -2
  427. package/cjs/state/pin/index.js.map +0 -1
  428. package/es/scenegraph/component/menu.d.ts +0 -41
  429. package/es/scenegraph/graphic/text.d.ts +0 -16
  430. package/es/state/pin/index.d.ts +0 -2
  431. package/es/state/pin/index.js.map +0 -1
@@ -0,0 +1,58 @@
1
+ import { Group } from "../graphic/group";
2
+
3
+ export function dealFrozen(scene) {
4
+ var _a, _b;
5
+ if (scene.table.frozenColCount > scene.table.rowHeaderLevelCount) {
6
+ scene.rowHeaderGroup.setAttribute("height", scene.bodyGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.bodyGroup.attribute.y),
7
+ scene.cornerHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height);
8
+ for (let i = 0; i < scene.table.frozenColCount - scene.table.rowHeaderLevelCount; i++) moveColumnFromBodyToRowHeader(scene),
9
+ moveColumnFromColHeaderToCornerHeader(scene);
10
+ } else if (scene.table.frozenColCount < scene.table.rowHeaderLevelCount) for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.table.frozenColCount; i++) moveColumnFromRowHeaderToBody(scene),
11
+ moveColumnFromCornerHeaderToColHeader(scene);
12
+ scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width),
13
+ scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.transpose || scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1),
14
+ scene.hasFrozen = !0, scene.frozenColCount = scene.table.frozenColCount, scene.frozenRowCount = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : 0;
15
+ }
16
+
17
+ export function resetFrozen(scene) {
18
+ var _a, _b;
19
+ if (scene.frozenColCount > scene.table.rowHeaderLevelCount) for (let i = 0; i < scene.frozenColCount - scene.table.rowHeaderLevelCount; i++) moveColumnFromRowHeaderToBody(scene),
20
+ moveColumnFromCornerHeaderToColHeader(scene); else if (scene.frozenColCount < scene.table.rowHeaderLevelCount) {
21
+ scene.rowHeaderGroup.setAttribute("height", scene.bodyGroup.attribute.height), scene.rowHeaderGroup.setAttribute("y", scene.bodyGroup.attribute.y),
22
+ scene.cornerHeaderGroup.setAttribute("height", scene.colHeaderGroup.attribute.height);
23
+ for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.frozenColCount; i++) moveColumnFromBodyToRowHeader(scene),
24
+ moveColumnFromColHeaderToCornerHeader(scene);
25
+ }
26
+ scene.bodyGroup.setAttribute("x", scene.rowHeaderGroup.attribute.width), scene.colHeaderGroup.setAttribute("x", scene.cornerHeaderGroup.attribute.width),
27
+ scene.updateContainer(), scene.updateBorderSizeAndPosition(), scene.isPivot || scene.transpose || scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1),
28
+ scene.hasFrozen = !0, scene.frozenColCount = scene.table.rowHeaderLevelCount, scene.frozenRowCount = null !== (_b = null === (_a = scene.colHeaderGroup.firstChild) || void 0 === _a ? void 0 : _a.childrenCount) && void 0 !== _b ? _b : 0;
29
+ }
30
+
31
+ function moveColumnFromBodyToRowHeader(scene) {
32
+ const column = scene.bodyGroup.firstChild instanceof Group ? scene.bodyGroup.firstChild : null;
33
+ column && (scene.rowHeaderGroup.appendChild(column), scene.rowHeaderGroup.setAttribute("width", scene.rowHeaderGroup.attribute.width + column.attribute.width),
34
+ scene.bodyGroup.setAttribute("width", scene.bodyGroup.attribute.width - column.attribute.width));
35
+ }
36
+
37
+ function moveColumnFromColHeaderToCornerHeader(scene) {
38
+ const headerColumn = scene.colHeaderGroup.firstChild instanceof Group ? scene.colHeaderGroup.firstChild : null;
39
+ headerColumn && (scene.cornerHeaderGroup.appendChild(headerColumn), scene.cornerHeaderGroup.setAttribute("width", scene.cornerHeaderGroup.attribute.width + headerColumn.attribute.width),
40
+ scene.colHeaderGroup.setAttribute("width", scene.colHeaderGroup.attribute.width - headerColumn.attribute.width));
41
+ }
42
+
43
+ function moveColumnFromRowHeaderToBody(scene) {
44
+ var _a;
45
+ const column = scene.rowHeaderGroup.lastChild instanceof Group ? scene.rowHeaderGroup.lastChild : null === (_a = scene.rowHeaderGroup.lastChild) || void 0 === _a ? void 0 : _a._prev;
46
+ column && (scene.bodyGroup.firstChild ? scene.bodyGroup.insertBefore(column, scene.bodyGroup.firstChild) : scene.bodyGroup.appendChild(column),
47
+ scene.bodyGroup.setAttribute("width", scene.bodyGroup.attribute.width + column.attribute.width),
48
+ scene.rowHeaderGroup.setAttribute("width", scene.rowHeaderGroup.attribute.width - column.attribute.width));
49
+ }
50
+
51
+ function moveColumnFromCornerHeaderToColHeader(scene) {
52
+ var _a;
53
+ const headerColumn = scene.cornerHeaderGroup.lastChild instanceof Group ? scene.cornerHeaderGroup.lastChild : null === (_a = scene.cornerHeaderGroup.lastChild) || void 0 === _a ? void 0 : _a._prev;
54
+ headerColumn && (scene.colHeaderGroup.firstChild ? scene.colHeaderGroup.insertBefore(headerColumn, scene.colHeaderGroup.firstChild) : scene.bodyGroup.appendChild(headerColumn),
55
+ scene.colHeaderGroup.setAttribute("width", scene.colHeaderGroup.attribute.width + headerColumn.attribute.width),
56
+ scene.cornerHeaderGroup.setAttribute("width", scene.cornerHeaderGroup.attribute.width - headerColumn.attribute.width));
57
+ }
58
+ //# sourceMappingURL=frozen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["scenegraph/layout/frozen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,MAAM,UAAU,UAAU,CAAC,KAAiB;;IAC1C,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE;QAEhE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9E,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpE,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACtF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,mBAAmB,EAAE,CAAC,EAAE,EAAE;YACrF,6BAA6B,CAAC,KAAK,CAAC,CAAC;YACrC,qCAAqC,CAAC,KAAK,CAAC,CAAC;SAC9C;KACF;SAAM,IAAI,KAAK,CAAC,KAAK,CAAC,cAAc,G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,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;SAClF;aAAM;YACL,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;SAC3C;QACD,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,GAAG,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAChH,KAAK,CAAC,iBAAiB,CAAC,YAAY,CAClC,OAAO,EACP,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,KAAK,GAAG,YAAY,CAAC,SAAS,CAAC,KAAK,CACvE,CAAC;KACH;AACH,CAAC","file":"frozen.js","sourcesContent":["import { Group } from '../graphic/group';\nimport type { Scenegraph } from '../scenegraph';\n\nexport function dealFrozen(scene: Scenegraph) {\n if (scene.table.frozenColCount > scene.table.rowHeaderLevelCount) {\n // 将对应列移入rowHeaderGroup\n scene.rowHeaderGroup.setAttribute('height', scene.bodyGroup.attribute.height);\n scene.rowHeaderGroup.setAttribute('y', scene.bodyGroup.attribute.y);\n scene.cornerHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height);\n for (let i = 0; i < scene.table.frozenColCount - scene.table.rowHeaderLevelCount; i++) {\n moveColumnFromBodyToRowHeader(scene);\n moveColumnFromColHeaderToCornerHeader(scene);\n }\n } else if (scene.table.frozenColCount < scene.table.rowHeaderLevelCount) {\n // move columnGroup from rowHeaderGroup into bodyGroup(from cornerHeaderGroup into colHeaderGroup)\n for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.table.frozenColCount; i++) {\n moveColumnFromRowHeaderToBody(scene);\n moveColumnFromCornerHeaderToColHeader(scene);\n }\n }\n scene.bodyGroup.setAttribute('x', scene.rowHeaderGroup.attribute.width);\n scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);\n\n scene.updateContainer();\n scene.updateBorderSizeAndPosition();\n\n if (!scene.isPivot && !scene.transpose) {\n scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);\n }\n scene.hasFrozen = true;\n\n // scene.frozenColCount = scene.rowHeaderGroup.childrenCount;\n scene.frozenColCount = scene.table.frozenColCount;\n scene.frozenRowCount = scene.colHeaderGroup.firstChild?.childrenCount ?? 0;\n}\n\nexport function resetFrozen(scene: Scenegraph) {\n if (scene.frozenColCount > scene.table.rowHeaderLevelCount) {\n // move columnGroup from rowHeaderGroup into bodyGroup(from cornerHeaderGroup into colHeaderGroup)\n for (let i = 0; i < scene.frozenColCount - scene.table.rowHeaderLevelCount; i++) {\n moveColumnFromRowHeaderToBody(scene);\n moveColumnFromCornerHeaderToColHeader(scene);\n }\n } else if (scene.frozenColCount < scene.table.rowHeaderLevelCount) {\n // move columnGroup from bodyGroup into rowHeaderGroup(from colHeaderGroup into cornerHeaderGroup)\n scene.rowHeaderGroup.setAttribute('height', scene.bodyGroup.attribute.height);\n scene.rowHeaderGroup.setAttribute('y', scene.bodyGroup.attribute.y);\n scene.cornerHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height);\n for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.frozenColCount; i++) {\n moveColumnFromBodyToRowHeader(scene);\n moveColumnFromColHeaderToCornerHeader(scene);\n }\n }\n scene.bodyGroup.setAttribute('x', scene.rowHeaderGroup.attribute.width);\n scene.colHeaderGroup.setAttribute('x', scene.cornerHeaderGroup.attribute.width);\n\n scene.updateContainer();\n scene.updateBorderSizeAndPosition();\n\n if (!scene.isPivot && !scene.transpose) {\n scene.component.setFrozenColumnShadow(scene.table.frozenColCount - 1);\n }\n scene.hasFrozen = true;\n\n // scene.frozenColCount = scene.rowHeaderGroup.childrenCount;\n scene.frozenColCount = scene.table.rowHeaderLevelCount;\n scene.frozenRowCount = scene.colHeaderGroup.firstChild?.childrenCount ?? 0;\n}\n\nfunction moveColumnFromBodyToRowHeader(scene: Scenegraph) {\n // deal with bodyGroup\n const column = scene.bodyGroup.firstChild instanceof Group ? scene.bodyGroup.firstChild : null;\n if (column) {\n scene.rowHeaderGroup.appendChild(column);\n // update container width\n scene.rowHeaderGroup.setAttribute('width', scene.rowHeaderGroup.attribute.width + column.attribute.width);\n scene.bodyGroup.setAttribute('width', scene.bodyGroup.attribute.width - column.attribute.width);\n }\n}\n\nfunction moveColumnFromColHeaderToCornerHeader(scene: Scenegraph) {\n // deal width colHeaderGroup\n const headerColumn = scene.colHeaderGroup.firstChild instanceof Group ? scene.colHeaderGroup.firstChild : null;\n if (headerColumn) {\n scene.cornerHeaderGroup.appendChild(headerColumn);\n scene.cornerHeaderGroup.setAttribute(\n 'width',\n scene.cornerHeaderGroup.attribute.width + headerColumn.attribute.width\n );\n scene.colHeaderGroup.setAttribute('width', scene.colHeaderGroup.attribute.width - headerColumn.attribute.width);\n }\n}\n\nfunction moveColumnFromRowHeaderToBody(scene: Scenegraph) {\n const column =\n scene.rowHeaderGroup.lastChild instanceof Group\n ? scene.rowHeaderGroup.lastChild\n : (scene.rowHeaderGroup.lastChild?._prev as Group);\n if (column) {\n if (scene.bodyGroup.firstChild) {\n scene.bodyGroup.insertBefore(column, scene.bodyGroup.firstChild);\n } else {\n scene.bodyGroup.appendChild(column);\n }\n // 更新容器宽度\n scene.bodyGroup.setAttribute('width', scene.bodyGroup.attribute.width + column.attribute.width);\n scene.rowHeaderGroup.setAttribute('width', scene.rowHeaderGroup.attribute.width - column.attribute.width);\n }\n}\n\nfunction moveColumnFromCornerHeaderToColHeader(scene: Scenegraph) {\n // 处理列表头\n const headerColumn =\n scene.cornerHeaderGroup.lastChild instanceof Group\n ? scene.cornerHeaderGroup.lastChild\n : (scene.cornerHeaderGroup.lastChild?._prev as Group);\n if (headerColumn) {\n if (scene.colHeaderGroup.firstChild) {\n scene.colHeaderGroup.insertBefore(headerColumn, scene.colHeaderGroup.firstChild);\n } else {\n scene.bodyGroup.appendChild(headerColumn);\n }\n scene.colHeaderGroup.setAttribute('width', scene.colHeaderGroup.attribute.width + headerColumn.attribute.width);\n scene.cornerHeaderGroup.setAttribute(\n 'width',\n scene.cornerHeaderGroup.attribute.width - headerColumn.attribute.width\n );\n }\n}\n"]}
@@ -23,13 +23,17 @@ export function moveHeaderPosition(colSource, rowSource, colTarget, rowTarget, t
23
23
  sourceColEnd = table.colCount - 1, targetColStart = colTarget, targetColEnd = table.colCount - 1;
24
24
  }
25
25
  const updateColStart = Math.min(sourceColStart, targetColStart), updateColEnd = Math.max(sourceColEnd, targetColEnd), updateRowStart = Math.min(sourceRowStart, targetRowStart), updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);
26
- for (let col = updateColStart; col <= updateColEnd; col++) for (let row = updateRowStart; row <= updateRowEnd; row++) scene.updateCellContent(col, row);
27
26
  for (let col = updateColStart; col <= updateColEnd; col++) {
28
27
  const columnHeaderGroup = table.scenegraph.getColGroup(col, !0), columnGroup = table.scenegraph.getColGroup(col);
29
28
  columnHeaderGroup && columnHeaderGroup.setAttribute("width", table.getColWidth(col)),
30
29
  columnGroup && columnGroup.setAttribute("width", table.getColWidth(col));
31
30
  }
32
31
  scene.updateContainer();
32
+ for (let col = updateColStart; col <= updateColEnd; col++) {
33
+ const columnGroup = table.scenegraph.getColGroup(col);
34
+ null == columnGroup || columnGroup.setAttribute("chartInstance", void 0);
35
+ for (let row = updateRowStart; row <= updateRowEnd; row++) scene.updateCellContent(col, row);
36
+ }
33
37
  }
34
38
 
35
39
  function changeCell(colSource, rowSource, colTarget, rowTarget, table) {
@@ -1 +1 @@
1
- {"version":3,"sources":["scenegraph/layout/move-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,MAAM,gBAAgB,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;AAEvC,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,KAAmB;IAEnB,MAAM,KA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C;IAChC,eAAe,CAAC,GAAG,GAAG,SAAS,CAAC;IAEhC,eAAe,CAAC,aAAa,CAAC;QAC5B,CAAC,EAAE,OAAO;QACV,CAAC,EAAE,OAAO;KACX,CAAC,CAAC;IACH,eAAe,CAAC,GAAG,GAAG,SAAS,CAAC;IAChC,eAAe,CAAC,GAAG,GAAG,SAAS,CAAC;IAChC,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;QAC5E,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;KACjE;IACD,IAAI,OAAO,cAAc,KAAK,QAAQ,IAAI,OAAO,cAAc,KAAK,QAAQ,EAAE;QAC5E,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;KACjE;AACH,CAAC","file":"move-cell.js","sourcesContent":["import { Group } from '@visactor/vrender';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nconst groupForPosition = new Group({});\n\nexport function moveHeaderPosition(\n colSource: number,\n rowSource: number,\n colTarget: number,\n rowTarget: number,\n table: BaseTableAPI\n) {\n const scene = table.scenegraph;\n\n // 判断方向\n const cellType = table.getCellType(colTarget, rowTarget);\n const direction = cellType === 'columnHeader' ? 'column' : cellType === 'rowHeader' ? 'row' : undefined;\n\n let sourceColStart = 0;\n let sourceRowStart = 0;\n let sourceColEnd = 0;\n let sourceRowEnd = 0;\n let targetColStart = 0;\n let targetRowStart = 0;\n let targetColEnd = 0;\n let targetRowEnd = 0;\n if (direction === 'column') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colTarget, rowTarget);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceColStart = sourceMergeInfo.start.col;\n sourceColEnd = sourceMergeInfo.end.col;\n targetColStart = targetMergeInfo.start.col;\n targetColEnd = targetMergeInfo.end.col;\n } else {\n sourceColStart = colSource;\n sourceColEnd = colSource;\n targetColStart = colTarget;\n targetColEnd = colTarget;\n }\n sourceRowStart = rowSource;\n sourceRowEnd = table.rowCount - 1;\n targetRowStart = rowTarget;\n targetRowEnd = table.rowCount - 1;\n } else if (direction === 'row') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceRowStart = sourceMergeInfo.start.row;\n sourceRowEnd = sourceMergeInfo.end.row;\n targetRowStart = targetMergeInfo.start.row;\n targetRowEnd = targetMergeInfo.end.row;\n } else {\n sourceRowStart = rowSource;\n sourceRowEnd = rowSource;\n targetRowStart = rowTarget;\n targetRowEnd = rowTarget;\n }\n sourceColStart = colSource;\n sourceColEnd = table.colCount - 1;\n targetColStart = colTarget;\n targetColEnd = table.colCount - 1;\n }\n\n const updateColStart = Math.min(sourceColStart, targetColStart);\n const updateColEnd = Math.max(sourceColEnd, targetColEnd);\n const updateRowStart = Math.min(sourceRowStart, targetRowStart);\n const updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);\n\n for (let col = updateColStart; col <= updateColEnd; col++) {\n // 更新单元格记录全量属性,不更新column theme\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n\n // 更新columnGroup列宽\n for (let col = updateColStart; col <= updateColEnd; col++) {\n const columnHeaderGroup = table.scenegraph.getColGroup(col, true);\n const columnGroup = table.scenegraph.getColGroup(col);\n if (columnHeaderGroup) {\n columnHeaderGroup.setAttribute('width', table.getColWidth(col));\n }\n if (columnGroup) {\n columnGroup.setAttribute('width', table.getColWidth(col));\n }\n }\n\n // 更新容器尺寸\n scene.updateContainer();\n}\n\nfunction changeCell(colSource: number, rowSource: number, colTarget: number, rowTarget: number, table: BaseTableAPI) {\n // 记录基础属性\n const scene = table.scenegraph;\n const sourceCellGroup = scene.getCell(colSource, rowSource, true);\n const targetCellGroup = scene.getCell(colTarget, rowTarget, true);\n if (sourceCellGroup.role === 'empty' || targetCellGroup.role === 'empty') {\n return;\n }\n const sourceParent = sourceCellGroup.parent as Group;\n const targetParent = targetCellGroup.parent as Group;\n const { x: sourceX, y: sourceY } = sourceCellGroup.attribute;\n const { x: targetX, y: targetY } = targetCellGroup.attribute;\n\n // 判断merge属性\n let sourceDeltaCol;\n let sourceDeltaRow;\n let targetDeltaCol;\n let targetDeltaRow;\n const sourceMergeCol = sourceCellGroup.mergeCol;\n const sourceMergeRow = sourceCellGroup.mergeRow;\n const targetMergeCol = targetCellGroup.mergeCol;\n const targetMergeRow = targetCellGroup.mergeRow;\n if (typeof sourceMergeCol === 'number' && typeof sourceMergeRow === 'number') {\n sourceDeltaCol = sourceMergeCol - colSource;\n sourceDeltaRow = sourceMergeRow - rowSource;\n }\n if (typeof targetMergeCol === 'number' && typeof targetMergeRow === 'number') {\n targetDeltaCol = targetMergeCol - colTarget;\n targetDeltaRow = targetMergeRow - rowTarget;\n }\n\n // 更新位置\n targetParent.insertAfter(groupForPosition, targetCellGroup);\n sourceParent.insertAfter(targetCellGroup, sourceCellGroup);\n targetParent.insertAfter(sourceCellGroup, groupForPosition);\n targetParent.removeChild(groupForPosition);\n\n // 更新属性\n sourceCellGroup.setAttributes({\n x: targetX,\n y: targetY\n });\n sourceCellGroup.col = colTarget;\n sourceCellGroup.row = rowTarget;\n\n targetCellGroup.setAttributes({\n x: sourceX,\n y: sourceY\n });\n targetCellGroup.col = colSource;\n targetCellGroup.row = rowSource;\n if (typeof sourceDeltaCol === 'number' && typeof sourceDeltaRow === 'number') {\n sourceCellGroup.mergeCol = sourceCellGroup.col + sourceDeltaCol;\n sourceCellGroup.mergeRow = sourceCellGroup.row + sourceDeltaRow;\n }\n if (typeof targetDeltaCol === 'number' && typeof targetDeltaRow === 'number') {\n targetCellGroup.mergeCol = targetCellGroup.col + targetDeltaCol;\n targetCellGroup.mergeRow = targetCellGroup.row + targetDeltaRow;\n }\n}\n"]}
1
+ {"version":3,"sources":["scenegraph/layout/move-cell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,MAAM,gBAAgB,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;AAEvC,MAAM,UAAU,kBAAkB,CAChC,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,SAAiB,EACjB,KAAmB;IAEnB,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IAG/B,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,QAAQ,KAAK,cAAc,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IAExG,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,IAAI,SAAS,KAAK,QAAQ,EAAE;QAC1B,MAAM,eAAe,GAAG,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACtE,MAAM,eAAe,GAAG,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;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QAAQ,GAAG,eAAe,CAAC,GAAG,GAAG,cAAc,CAAC;KACjE;AACH,CAAC","file":"move-cell.js","sourcesContent":["import { Group } from '@visactor/vrender';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\n\nconst groupForPosition = new Group({});\n\nexport function moveHeaderPosition(\n colSource: number,\n rowSource: number,\n colTarget: number,\n rowTarget: number,\n table: BaseTableAPI\n) {\n const scene = table.scenegraph;\n\n // 判断方向\n const cellType = table.getCellType(colTarget, rowTarget);\n const direction = cellType === 'columnHeader' ? 'column' : cellType === 'rowHeader' ? 'row' : undefined;\n\n let sourceColStart = 0;\n let sourceRowStart = 0;\n let sourceColEnd = 0;\n let sourceRowEnd = 0;\n let targetColStart = 0;\n let targetRowStart = 0;\n let targetColEnd = 0;\n let targetRowEnd = 0;\n if (direction === 'column') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colTarget, rowTarget);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceColStart = sourceMergeInfo.start.col;\n sourceColEnd = sourceMergeInfo.end.col;\n targetColStart = targetMergeInfo.start.col;\n targetColEnd = targetMergeInfo.end.col;\n } else {\n sourceColStart = colSource;\n sourceColEnd = colSource;\n targetColStart = colTarget;\n targetColEnd = colTarget;\n }\n sourceRowStart = rowSource;\n sourceRowEnd = table.rowCount - 1;\n targetRowStart = rowTarget;\n targetRowEnd = table.rowCount - 1;\n } else if (direction === 'row') {\n const sourceMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n const targetMergeInfo = getCellMergeInfo(table, colSource, rowSource);\n if (sourceMergeInfo && targetMergeInfo) {\n sourceRowStart = sourceMergeInfo.start.row;\n sourceRowEnd = sourceMergeInfo.end.row;\n targetRowStart = targetMergeInfo.start.row;\n targetRowEnd = targetMergeInfo.end.row;\n } else {\n sourceRowStart = rowSource;\n sourceRowEnd = rowSource;\n targetRowStart = rowTarget;\n targetRowEnd = rowTarget;\n }\n sourceColStart = colSource;\n sourceColEnd = table.colCount - 1;\n targetColStart = colTarget;\n targetColEnd = table.colCount - 1;\n }\n\n const updateColStart = Math.min(sourceColStart, targetColStart);\n const updateColEnd = Math.max(sourceColEnd, targetColEnd);\n const updateRowStart = Math.min(sourceRowStart, targetRowStart);\n const updateRowEnd = Math.max(sourceRowEnd, targetRowEnd);\n\n // 更新columnGroup列宽\n for (let col = updateColStart; col <= updateColEnd; col++) {\n const columnHeaderGroup = table.scenegraph.getColGroup(col, true);\n const columnGroup = table.scenegraph.getColGroup(col);\n if (columnHeaderGroup) {\n columnHeaderGroup.setAttribute('width', table.getColWidth(col));\n }\n if (columnGroup) {\n columnGroup.setAttribute('width', table.getColWidth(col));\n }\n }\n\n // 更新容器尺寸\n scene.updateContainer();\n\n for (let col = updateColStart; col <= updateColEnd; col++) {\n // 将该列的chartInstance清除掉\n const columnGroup = table.scenegraph.getColGroup(col);\n columnGroup?.setAttribute('chartInstance', undefined);\n // 更新单元格记录全量属性,不更新column theme\n for (let row = updateRowStart; row <= updateRowEnd; row++) {\n scene.updateCellContent(col, row);\n }\n }\n}\n\nfunction changeCell(colSource: number, rowSource: number, colTarget: number, rowTarget: number, table: BaseTableAPI) {\n // 记录基础属性\n const scene = table.scenegraph;\n const sourceCellGroup = scene.getCell(colSource, rowSource, true);\n const targetCellGroup = scene.getCell(colTarget, rowTarget, true);\n if (sourceCellGroup.role === 'empty' || targetCellGroup.role === 'empty') {\n return;\n }\n const sourceParent = sourceCellGroup.parent as Group;\n const targetParent = targetCellGroup.parent as Group;\n const { x: sourceX, y: sourceY } = sourceCellGroup.attribute;\n const { x: targetX, y: targetY } = targetCellGroup.attribute;\n\n // 判断merge属性\n let sourceDeltaCol;\n let sourceDeltaRow;\n let targetDeltaCol;\n let targetDeltaRow;\n const sourceMergeCol = sourceCellGroup.mergeCol;\n const sourceMergeRow = sourceCellGroup.mergeRow;\n const targetMergeCol = targetCellGroup.mergeCol;\n const targetMergeRow = targetCellGroup.mergeRow;\n if (typeof sourceMergeCol === 'number' && typeof sourceMergeRow === 'number') {\n sourceDeltaCol = sourceMergeCol - colSource;\n sourceDeltaRow = sourceMergeRow - rowSource;\n }\n if (typeof targetMergeCol === 'number' && typeof targetMergeRow === 'number') {\n targetDeltaCol = targetMergeCol - colTarget;\n targetDeltaRow = targetMergeRow - rowTarget;\n }\n\n // 更新位置\n targetParent.insertAfter(groupForPosition, targetCellGroup);\n sourceParent.insertAfter(targetCellGroup, sourceCellGroup);\n targetParent.insertAfter(sourceCellGroup, groupForPosition);\n targetParent.removeChild(groupForPosition);\n\n // 更新属性\n sourceCellGroup.setAttributes({\n x: targetX,\n y: targetY\n });\n sourceCellGroup.col = colTarget;\n sourceCellGroup.row = rowTarget;\n\n targetCellGroup.setAttributes({\n x: sourceX,\n y: sourceY\n });\n targetCellGroup.col = colSource;\n targetCellGroup.row = rowSource;\n if (typeof sourceDeltaCol === 'number' && typeof sourceDeltaRow === 'number') {\n sourceCellGroup.mergeCol = sourceCellGroup.col + sourceDeltaCol;\n sourceCellGroup.mergeRow = sourceCellGroup.row + sourceDeltaRow;\n }\n if (typeof targetDeltaCol === 'number' && typeof targetDeltaRow === 'number') {\n targetCellGroup.mergeCol = targetCellGroup.col + targetDeltaCol;\n targetCellGroup.mergeRow = targetCellGroup.row + targetDeltaRow;\n }\n}\n"]}
@@ -8,7 +8,7 @@ import { getCellMergeInfo } from "../utils/get-cell-merge";
8
8
 
9
9
  import { getProp } from "../utils/get-prop";
10
10
 
11
- import { getPadding } from "../utils/padding";
11
+ import { getQuadProps } from "../utils/padding";
12
12
 
13
13
  import { updateCellContentWidth } from "../utils/text-icon-layout";
14
14
 
@@ -25,16 +25,16 @@ export function updateCellLayout(scene, cell, col, row, width, height, detaX, de
25
25
  if (!cellGroup) return;
26
26
  const type = scene.table.isHeader(col, row) ? scene.table._getHeaderLayoutMap(col, row).headerType : scene.table.getBodyColumnType(col, row);
27
27
  if ("progressbar" === type) {
28
- const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = getPadding(getProp("padding", style, col, row, scene.table)), newBarCell = createProgressBarCell(columnDefine, style, cell.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cell.getChildByName("progress-bar");
28
+ const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = getQuadProps(getProp("padding", style, col, row, scene.table)), newBarCell = createProgressBarCell(columnDefine, style, cell.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cell.getChildByName("progress-bar");
29
29
  cell.insertBefore(newBarCell, oldBarCell), cell.removeChild(oldBarCell), oldBarCell.removeAllChild(),
30
30
  oldBarCell.release();
31
31
  } else if ("sparkline" === type) {
32
32
  cell.removeAllChild();
33
- const headerStyle = scene.table._getCellStyle(col, row), padding = getPadding(getProp("padding", headerStyle, col, row, scene.table));
33
+ const headerStyle = scene.table._getCellStyle(col, row), padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
34
34
  createSparkLineCellGroup(cell, cell.parent, cell.attribute.x, cell.attribute.y, col, row, cell.attribute.width, cell.attribute.height, padding, scene.table);
35
35
  } else if ("image" === type || "video" === type) ; else {
36
36
  const style = scene.table._getCellStyle(col, row);
37
- updateCellContentWidth(cell, distWidth, detaX, autoRowHeight, getPadding(style.padding), style.textAlign, style.textBaseline, scene);
37
+ updateCellContentWidth(cell, distWidth, detaX, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, scene);
38
38
  const customContainer = cellGroup.getChildByName("custom-container");
39
39
  if (customContainer) {
40
40
  let customRender, customLayout;
@@ -1 +1 @@
1
- {"version":3,"sources":["scenegraph/layout/update-cell.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,E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sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getPadding } from '../utils/padding';\nimport { updateCellContentWidth } from '../utils/text-icon-layout';\n\n/**\n * @description: 更新单个单元格宽度/高度\n * @return {*}\n */\nexport function updateCellLayout(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n width: number,\n height: number,\n detaX: number,\n detaY: number,\n isHeader: boolean,\n autoColWidth: boolean,\n autoRowHeight: boolean\n) {\n let cellGroup;\n let distWidth;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col) {\n // 更新横向merge cell width\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellWidth = mergeCell.attribute.width;\n mergeCell.setAttribute('width', mergeCellWidth + detaX);\n\n cellGroup = mergeCell;\n distWidth = mergeCell.attribute.width;\n } else if (mergeInfo && mergeInfo.start.row === row) {\n // 更新纵向merge cell width,只更新一次\n cell.setAttribute('width', width + detaX);\n\n cellGroup = cell;\n distWidth = width + detaX;\n } else if (!mergeInfo) {\n cell.setAttribute('width', width + detaX);\n cellGroup = cell;\n distWidth = width + detaX;\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n // 更新单元格布局\n\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getPadding(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getPadding(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table\n );\n } else if (type === 'image' || type === 'video') {\n // // 只更新背景边框\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('width', cell.attribute.width);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentWidth(\n cell,\n distWidth,\n detaX,\n autoRowHeight,\n getPadding(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene\n );\n\n // 处理自定义渲染\n const customContainer = cellGroup.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cellGroup.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(cellGroup.col, cellGroup.row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(cellGroup.col, cellGroup.row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(cellGroup.col, cellGroup.row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n cellGroup.col,\n cellGroup.row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n false,\n false,\n scene.table\n );\n cellGroup.appendChild(customResult.elementsGroup);\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["scenegraph/layout/update-cell.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAMnE,MAAM,UAAU,gBAAgB,CAC9B,KAAiB,EACjB,IAAW,EACX,GAAW,EACX,GAAW,EACX,KAAa,EACb,MAAc,EACd,KAAa,EACb,KAAa,EACb,QAAiB,EACjB,YAAqB,EACrB,aAAsB;IAEtB,IAAI,SAAS,CAAC;IACd,IAAI,SAAS,CAAC;IACd,MAAM,SAAS,GAAG,gBAAgB,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAG1D,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE;QAExD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1E,MAAM,cAAc,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC;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AAE,YAAY,CAAC;aACrC;YACD,MAAM,YAAY,GAAG,cAAc,CACjC,YAAY,EACZ,YAAY,EACZ,SAAS,CAAC,GAAG,EACb,SAAS,CAAC,GAAG,EACb,SAAS,CAAC,SAAS,CAAC,KAAK,EACzB,SAAS,CAAC,SAAS,CAAC,MAAM,EAC1B,KAAK,EACL,KAAK,EACL,KAAK,CAAC,KAAK,CACZ,CAAC;YACF,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;SACnD;KACF;AACH,CAAC","file":"update-cell.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentWidth } from '../utils/text-icon-layout';\n\n/**\n * @description: 更新单个单元格宽度/高度\n * @return {*}\n */\nexport function updateCellLayout(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n width: number,\n height: number,\n detaX: number,\n detaY: number,\n isHeader: boolean,\n autoColWidth: boolean,\n autoRowHeight: boolean\n) {\n let cellGroup;\n let distWidth;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col) {\n // 更新横向merge cell width\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellWidth = mergeCell.attribute.width;\n mergeCell.setAttribute('width', mergeCellWidth + detaX);\n\n cellGroup = mergeCell;\n distWidth = mergeCell.attribute.width;\n } else if (mergeInfo && mergeInfo.start.row === row) {\n // 更新纵向merge cell width,只更新一次\n cell.setAttribute('width', width + detaX);\n\n cellGroup = cell;\n distWidth = width + detaX;\n } else if (!mergeInfo) {\n cell.setAttribute('width', width + detaX);\n cellGroup = cell;\n distWidth = width + detaX;\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n // 更新单元格布局\n\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table\n );\n } else if (type === 'image' || type === 'video') {\n // // 只更新背景边框\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('width', cell.attribute.width);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentWidth(\n cell,\n distWidth,\n detaX,\n autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline,\n scene\n );\n\n // 处理自定义渲染\n const customContainer = cellGroup.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cellGroup.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(cellGroup.col, cellGroup.row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(cellGroup.col, cellGroup.row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(cellGroup.col, cellGroup.row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n cellGroup.col,\n cellGroup.row,\n cellGroup.attribute.width,\n cellGroup.attribute.height,\n false,\n false,\n scene.table\n );\n cellGroup.appendChild(customResult.elementsGroup);\n }\n }\n}\n"]}
@@ -6,7 +6,7 @@ import { getCellMergeInfo } from "../utils/get-cell-merge";
6
6
 
7
7
  import { getProp } from "../utils/get-prop";
8
8
 
9
- import { getPadding } from "../utils/padding";
9
+ import { getQuadProps } from "../utils/padding";
10
10
 
11
11
  import { updateCellContentHeight } from "../utils/text-icon-layout";
12
12
 
@@ -61,16 +61,16 @@ export function updateCellHeightForColumn(scene, cell, col, row, height, detaY,
61
61
  export function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHeader) {
62
62
  const type = scene.table.isHeader(col, row) ? scene.table._getHeaderLayoutMap(col, row).headerType : scene.table.getBodyColumnType(col, row);
63
63
  if ("progressbar" === type) {
64
- const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = getPadding(getProp("padding", style, col, row, scene.table)), newBarCell = createProgressBarCell(columnDefine, style, cell.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cell.getChildByName("progress-bar");
64
+ const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = getQuadProps(getProp("padding", style, col, row, scene.table)), newBarCell = createProgressBarCell(columnDefine, style, cell.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cell.getChildByName("progress-bar");
65
65
  cell.insertBefore(newBarCell, oldBarCell), cell.removeChild(oldBarCell), oldBarCell.removeAllChild(),
66
66
  oldBarCell.release();
67
67
  } else if ("sparkline" === type) {
68
68
  cell.removeAllChild();
69
- const headerStyle = scene.table._getCellStyle(col, row), padding = getPadding(getProp("padding", headerStyle, col, row, scene.table));
69
+ const headerStyle = scene.table._getCellStyle(col, row), padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
70
70
  createSparkLineCellGroup(cell, cell.parent, cell.attribute.x, cell.attribute.y, col, row, cell.attribute.width, cell.attribute.height, padding, scene.table);
71
71
  } else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cell, col, row, scene.table); else {
72
72
  const style = scene.table._getCellStyle(col, row);
73
- updateCellContentHeight(cell, distHeight, detaY, scene.table.internalProps.autoRowHeight, getPadding(style.padding), style.textAlign, style.textBaseline);
73
+ updateCellContentHeight(cell, distHeight, detaY, scene.table.internalProps.autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline);
74
74
  const customContainer = cell.getChildByName("custom-container");
75
75
  if (customContainer) {
76
76
  let customRender, customLayout;
@@ -84,7 +84,7 @@ export function updateCellHeight(scene, cell, col, row, distHeight, detaY, isHea
84
84
  customLayout = null == define ? void 0 : define.customLayout;
85
85
  }
86
86
  const customResult = dealWithCustom(customLayout, customRender, col, row, cell.attribute.width, cell.attribute.height, !1, !1, scene.table);
87
- cell.appendChild(customResult.elementsGroup);
87
+ cell.childrenCount > 0 ? cell.insertBefore(customResult.elementsGroup, cell.firstChild) : cell.appendChild(customResult.elementsGroup);
88
88
  }
89
89
  }
90
90
  }
@@ -1 +1 @@
1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ACZ,YAAY,EACZ,GAAG,EACH,GAAG,EACH,IAAI,CAAC,SAAS,CAAC,KAAK,EACpB,IAAI,CAAC,SAAS,CAAC,MAAM,EACrB,KAAK,EACL,KAAK,EACL,KAAK,CAAC,KAAK,CACZ,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;SAC9C;KACF;AACH,CAAC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getPadding } from '../utils/padding';\nimport { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);\n scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n // if (rowIndex === 2) debugger;\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n const mergeInfo = getCellMergeInfo(scene.table, colIndex, rowIndex);\n if (mergeInfo && (mergeInfo.start.col !== colIndex || mergeInfo.start.row !== rowIndex)) {\n continue;\n }\n\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n\n // 更新table行高存储\n scene.table.setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n let cellGroup;\n let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col && mergeInfo.start.col === col) {\n // 更新横向merge cell height,只更新一次\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellheight = mergeCell.attribute.height;\n mergeCell.setAttribute('height', mergeCellheight + detaY);\n\n cellGroup = mergeCell;\n distHeight = mergeCell.attribute.height;\n } else if (mergeInfo) {\n // 更新纵向merge cell width\n cell.setAttribute('height', height + detaY);\n\n cellGroup = cell;\n distHeight = height + detaY;\n } else if (!mergeInfo) {\n cell.setAttribute('height', height + detaY);\n cellGroup = cell;\n distHeight = height + detaY;\n // cell.setTheme({\n // rect: {\n // height: cell.attribute.height,\n // },\n // });\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n let cellGroup;\n // let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n if (row === mergeInfo.start.row) {\n // 初始化高度\n (cell as any)._tempHeight = height;\n return;\n } else if (row === mergeInfo.end.row) {\n cell.setAttribute('height', (cell as any)._tempHeight + height);\n cellGroup = cell;\n height = cell.attribute.height;\n // updateCellHeight(scene, cellGroup, col, row, cell.attribute.height, 0, isHeader);\n } else {\n // 累加高度\n (cell as any)._tempHeight += height;\n return;\n }\n } else if (mergeInfo) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n cell.setAttribute('height', height);\n cellGroup = cell;\n\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('height', cell.attribute.height);\n } else {\n cell.setAttribute('height', height);\n cellGroup = cell;\n }\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getPadding(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getPadding(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentHeight(\n cell,\n distHeight,\n detaY,\n scene.table.internalProps.autoRowHeight,\n getPadding(style.padding as number),\n style.textAlign,\n style.textBaseline\n );\n\n // 处理自定义渲染\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(col, row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n false,\n scene.table\n );\n cell.appendChild(customResult.elementsGroup);\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["scenegraph/layout/update-height.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,EAAE,wBAA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,EACL,KAAK,CAAC,KAAK,CACZ,CAAC;YACF,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE;gBAC1B,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,aAAa,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;aAChE;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;aAC9C;SACF;KACF;AACH,CAAC","file":"update-height.js","sourcesContent":["import type { ProgressBarStyle } from '../../body-helper/style/ProgressBarStyle';\nimport type { Group } from '../graphic/group';\nimport { createProgressBarCell } from '../group-creater/cell-type/progress-bar-cell';\nimport { createSparkLineCellGroup } from '../group-creater/cell-type/spark-line-cell';\nimport type { Scenegraph } from '../scenegraph';\nimport { getCellMergeInfo } from '../utils/get-cell-merge';\nimport { getProp } from '../utils/get-prop';\nimport { getQuadProps } from '../utils/padding';\nimport { updateCellContentHeight } from '../utils/text-icon-layout';\nimport type { IProgressbarColumnBodyDefine } from '../../ts-types/list-table/define/progressbar-define';\nimport { dealWithCustom } from '../component/custom';\nimport { updateImageCellContentWhileResize } from '../group-creater/cell-type/image-cell';\n\nexport function updateRowHeight(scene: Scenegraph, row: number, detaY: number) {\n for (let col = 0; col < scene.table.colCount; col++) {\n const cell = scene.getCell(col, row);\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.start.col !== col) {\n continue;\n }\n const height = cell.attribute.height;\n // cell.setAttribute('height', height);\n // (cell.firstChild as Rect).setAttribute('height', cell.attribute.height);\n updateCellHeightForRow(scene, cell, col, row, height, detaY, scene.table.isHeader(col, row));\n\n scene.updateCellContentWhileResize(col, row);\n }\n\n let rowStart = 0;\n let rowEnd = 0;\n // 更新header 高度\n if (row < scene.table.columnHeaderLevelCount) {\n scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);\n scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);\n scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);\n\n rowStart = row + 1;\n rowEnd = scene.table.columnHeaderLevelCount - 1;\n } else {\n rowStart = row + 1;\n // rowEnd = scene.table.rowCount - 1;\n rowEnd = scene.bodyRowEnd;\n }\n\n // 更新以下行位置\n for (let rowIndex = rowStart; rowIndex <= rowEnd; rowIndex++) {\n // if (rowIndex === 2) debugger;\n for (let colIndex = 0; colIndex < scene.table.colCount; colIndex++) {\n const cellGroup = scene.getCell(colIndex, rowIndex);\n const mergeInfo = getCellMergeInfo(scene.table, colIndex, rowIndex);\n if (mergeInfo && (mergeInfo.start.col !== colIndex || mergeInfo.start.row !== rowIndex)) {\n continue;\n }\n\n cellGroup.setAttribute('y', cellGroup.attribute.y + detaY);\n }\n }\n\n // 更新table行高存储\n scene.table.setRowHeight(row, scene.table.getRowHeight(row) + detaY, true);\n}\n\n/**\n * @description: 更新单个单元格高度\n * @return {*}\n */\nexport function updateCellHeightForRow(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n // autoRowHeight: boolean\n) {\n let cellGroup;\n let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n // TO BE FIXED 这里使用横向和纵向来判断单元格merge情况,目前没有横纵都merge的情况,\n // 如果有这里的逻辑要修改\n if (mergeInfo && mergeInfo.end.col - mergeInfo.start.col && mergeInfo.start.col === col) {\n // 更新横向merge cell height,只更新一次\n const mergeCell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n const mergeCellheight = mergeCell.attribute.height;\n mergeCell.setAttribute('height', mergeCellheight + detaY);\n\n cellGroup = mergeCell;\n distHeight = mergeCell.attribute.height;\n } else if (mergeInfo) {\n // 更新纵向merge cell width\n cell.setAttribute('height', height + detaY);\n\n cellGroup = cell;\n distHeight = height + detaY;\n } else if (!mergeInfo) {\n cell.setAttribute('height', height + detaY);\n cellGroup = cell;\n distHeight = height + detaY;\n // cell.setTheme({\n // rect: {\n // height: cell.attribute.height,\n // },\n // });\n }\n\n if (!cellGroup) {\n // 合并单元格非主单元格,不处理\n return;\n }\n\n updateCellHeight(scene, cellGroup, col, row, distHeight, detaY, isHeader);\n}\n\nexport function updateCellHeightForColumn(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n height: number,\n detaY: number,\n isHeader: boolean\n) {\n let cellGroup;\n // let distHeight;\n const mergeInfo = getCellMergeInfo(scene.table, col, row);\n if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n if (row === mergeInfo.start.row) {\n // 初始化高度\n (cell as any)._tempHeight = height;\n return;\n } else if (row === mergeInfo.end.row) {\n cell.setAttribute('height', (cell as any)._tempHeight + height);\n cellGroup = cell;\n height = cell.attribute.height;\n // updateCellHeight(scene, cellGroup, col, row, cell.attribute.height, 0, isHeader);\n } else {\n // 累加高度\n (cell as any)._tempHeight += height;\n return;\n }\n } else if (mergeInfo) {\n cell = scene.getCell(mergeInfo.start.col, mergeInfo.start.row);\n cell.setAttribute('height', height);\n cellGroup = cell;\n\n // const rect = cell.firstChild as Rect;\n // rect.setAttribute('height', cell.attribute.height);\n } else {\n cell.setAttribute('height', height);\n cellGroup = cell;\n }\n updateCellHeight(scene, cellGroup, col, row, height, 0, isHeader);\n}\n\nexport function updateCellHeight(\n scene: Scenegraph,\n cell: Group,\n col: number,\n row: number,\n distHeight: number,\n detaY: number,\n isHeader: boolean\n) {\n // 更新单元格布局\n const type = scene.table.isHeader(col, row)\n ? scene.table._getHeaderLayoutMap(col, row).headerType\n : scene.table.getBodyColumnType(col, row);\n if (type === 'progressbar') {\n // 目前先采用重新生成节点的方案\n const columnDefine = scene.table.getBodyColumnDefine(col, row) as IProgressbarColumnBodyDefine;\n const style = scene.table._getCellStyle(col, row) as ProgressBarStyle;\n const value = scene.table.getCellValue(col, row);\n const dataValue = scene.table.getCellOriginValue(col, row);\n const padding = getQuadProps(getProp('padding', style, col, row, scene.table));\n\n const newBarCell = createProgressBarCell(\n columnDefine,\n style,\n cell.attribute.width,\n // cell.attribute.height,\n value,\n dataValue,\n col,\n row,\n padding,\n scene.table\n );\n\n const oldBarCell = cell.getChildByName('progress-bar') as Group;\n // cell.replaceChild(newBarCell, oldBarCell);\n cell.insertBefore(newBarCell, oldBarCell);\n cell.removeChild(oldBarCell);\n oldBarCell.removeAllChild();\n oldBarCell.release();\n } else if (type === 'sparkline') {\n // 目前先采用重新生成节点的方案\n cell.removeAllChild();\n const headerStyle = scene.table._getCellStyle(col, row);\n const padding = getQuadProps(getProp('padding', headerStyle, col, row, scene.table));\n createSparkLineCellGroup(\n cell,\n cell.parent,\n cell.attribute.x,\n cell.attribute.y,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n padding,\n scene.table\n );\n } else if (type === 'image' || type === 'video') {\n updateImageCellContentWhileResize(cell, col, row, scene.table);\n } else {\n // 处理文字\n const style = scene.table._getCellStyle(col, row);\n updateCellContentHeight(\n cell,\n distHeight,\n detaY,\n scene.table.internalProps.autoRowHeight,\n getQuadProps(style.padding as number),\n style.textAlign,\n style.textBaseline\n );\n\n // 处理自定义渲染\n const customContainer = cell.getChildByName('custom-container') as Group;\n if (customContainer) {\n customContainer.clear();\n cell.removeChild(customContainer);\n\n let customRender;\n let customLayout;\n const cellType = scene.table.getCellType(col, row);\n if (cellType !== 'body') {\n const define = scene.table.getHeaderDefine(col, row);\n customRender = define?.headerCustomRender;\n customLayout = define?.headerCustomLayout;\n } else {\n const define = scene.table.getBodyColumnDefine(col, row);\n customRender = define?.customRender || scene.table.customRender;\n customLayout = define?.customLayout;\n }\n const customResult = dealWithCustom(\n customLayout,\n customRender,\n col,\n row,\n cell.attribute.width,\n cell.attribute.height,\n false,\n false,\n scene.table\n );\n if (cell.childrenCount > 0) {\n cell.insertBefore(customResult.elementsGroup, cell.firstChild);\n } else {\n cell.appendChild(customResult.elementsGroup);\n }\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { CellAddress } from '../../ts-types';
2
+ import type { BaseTableAPI } from '../../ts-types/base-table';
3
+ export declare function updateRow(removeCells: CellAddress[], addCells: CellAddress[], table: BaseTableAPI): void;
@@ -0,0 +1,73 @@
1
+ import { updateCell } from "../group-creater/cell-helper";
2
+
3
+ export function updateRow(removeCells, addCells, table) {
4
+ const scene = table.scenegraph, removeRows = deduplication(removeCells.map((cell => cell.row))).sort(((a, b) => a - b)), addRows = deduplication(addCells.map((cell => cell.row))).sort(((a, b) => a - b));
5
+ removeRows.forEach((row => {
6
+ removeRow(row, scene);
7
+ })), removeRows.length && resetRowNumber(scene), addRows.forEach((row => {
8
+ addRow(row, scene);
9
+ })), resetRowNumberAndY(scene);
10
+ }
11
+
12
+ function removeRow(row, scene) {
13
+ for (let col = 0; col < scene.table.colCount; col++) {
14
+ const colGroup = scene.getColGroup(col, !1);
15
+ let cellGroup;
16
+ colGroup.forEachChildren((cell => cell.row === row && (cellGroup = cell, !0))),
17
+ cellGroup && colGroup.removeChild(cellGroup);
18
+ }
19
+ }
20
+
21
+ function addRow(row, scene) {
22
+ var _a;
23
+ for (let col = 0; col < scene.table.colCount; col++) {
24
+ const cellGroup = updateCell(col, row, scene.table, !0);
25
+ if (!cellGroup) continue;
26
+ const colGroup = scene.getColGroup(col);
27
+ if (colGroup.firstChild && row < colGroup.firstChild.row) colGroup.insertBefore(cellGroup, colGroup.firstChild); else if (colGroup.lastChild && row > colGroup.lastChild.row) colGroup.appendChild(cellGroup); else {
28
+ let cellBefore;
29
+ colGroup.forEachChildren((cellGroup => cellGroup.row === row && (cellBefore = cellGroup,
30
+ !0))), cellBefore !== cellGroup && colGroup.insertBefore(cellGroup, cellBefore);
31
+ }
32
+ let rowIndex = null === (_a = colGroup.firstChild) || void 0 === _a ? void 0 : _a.row;
33
+ colGroup.forEachChildren((cellGroup => {
34
+ cellGroup.row = rowIndex, rowIndex++;
35
+ }));
36
+ }
37
+ }
38
+
39
+ function deduplication(array) {
40
+ const result = [];
41
+ for (let i = 0; i < array.length; i++) -1 === result.indexOf(array[i]) && result.push(array[i]);
42
+ return result;
43
+ }
44
+
45
+ function resetRowNumber(scene) {
46
+ var _a, _b;
47
+ for (let col = 0; col < scene.table.colCount; col++) {
48
+ const headerColGroup = scene.getColGroup(col, !0), colGroup = scene.getColGroup(col, !1);
49
+ let rowIndex = null === (_a = headerColGroup.firstChild) || void 0 === _a ? void 0 : _a.row;
50
+ headerColGroup.forEachChildren((cellGroup => {
51
+ cellGroup.row = rowIndex, rowIndex++;
52
+ })), rowIndex = null === (_b = colGroup.firstChild) || void 0 === _b ? void 0 : _b.row,
53
+ colGroup.forEachChildren((cellGroup => {
54
+ cellGroup.row = rowIndex, rowIndex++;
55
+ }));
56
+ }
57
+ }
58
+
59
+ function resetRowNumberAndY(scene) {
60
+ var _a, _b;
61
+ let newTotalHeight = 0;
62
+ for (let col = 0; col < scene.table.colCount; col++) {
63
+ const headerColGroup = scene.getColGroup(col, !0), colGroup = scene.getColGroup(col, !1);
64
+ let rowIndex = null === (_a = headerColGroup.firstChild) || void 0 === _a ? void 0 : _a.row, y = 0;
65
+ rowIndex = null === (_b = colGroup.firstChild) || void 0 === _b ? void 0 : _b.row,
66
+ y = 0, colGroup.forEachChildren((cellGroup => {
67
+ cellGroup.row = rowIndex, rowIndex++, "cell" === cellGroup.role && (cellGroup.setAttribute("y", y),
68
+ y += cellGroup.attribute.height);
69
+ })), newTotalHeight = y;
70
+ }
71
+ scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height);
72
+ }
73
+ //# sourceMappingURL=update-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["scenegraph/layout/update-row.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAM1D,MAAM,UAAU,SAAS,CAAC,WAA0B,EAAE,QAAuB,EAAE,KAAmB;IAChG,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC;IAE/B,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C,CAAC,CAAC;KACJ;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAiB;;IAC3C,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;QACnD,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAE/C,IAAI,QAAQ,GAAG,MAAC,cAAc,CAAC,UAAoB,0CAAE,GAAG,CAAC;QACzD,IAAI,CAAC,GAAG,CAAC,CAAC;QAUV,QAAQ,GAAG,MAAC,QAAQ,CAAC,UAAoB,0CAAE,GAAG,CAAC;QAC/C,CAAC,GAAG,CAAC,CAAC;QACN,QAAQ,CAAC,eAAe,CAAC,CAAC,SAAgB,EAAE,EAAE;YAC5C,SAAS,CAAC,GAAG,GAAG,QAAQ,CAAC;YACzB,QAAQ,EAAE,CAAC;YACX,IAAI,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE;gBAC7B,OAAO;aACR;YACD,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAC/B,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC;QAClC,CAAC,CAAC,CAAC;QACH,cAAc,GAAG,CAAC,CAAC;KACpB;IAGD,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,cAAc,EAAE,cAAc,GAAG,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC7G,CAAC","file":"update-row.js","sourcesContent":["import type { CellAddress } from '../../ts-types';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { Group } from '../graphic/group';\nimport { updateCell } from '../group-creater/cell-helper';\nimport type { Scenegraph } from '../scenegraph';\n\n/**\n * add and remove rows in scenegraph\n */\nexport function updateRow(removeCells: CellAddress[], addCells: CellAddress[], table: BaseTableAPI) {\n const scene = table.scenegraph;\n // deduplication\n const removeRows = deduplication(removeCells.map(cell => cell.row)).sort((a, b) => a - b);\n const addRows = deduplication(addCells.map(cell => cell.row)).sort((a, b) => a - b);\n\n // remove cells\n removeRows.forEach(row => {\n removeRow(row, scene);\n });\n\n if (removeRows.length) {\n resetRowNumber(scene);\n }\n\n // add cells\n addRows.forEach(row => {\n addRow(row, scene);\n });\n\n // reset attribute y and row number in CellGroup\n resetRowNumberAndY(scene);\n}\n\nfunction removeRow(row: number, scene: Scenegraph) {\n for (let col = 0; col < scene.table.colCount; col++) {\n // const headerColGroup = scene.getColGroup(col, true);\n const colGroup = scene.getColGroup(col, false);\n\n // // remove cellGroup in headerColGroup\n // let headerCellGroup;\n // headerColGroup.forEachChildren((cellGroup: Group) => {\n // if (cellGroup.row === row) {\n // headerCellGroup = cellGroup;\n // return true;\n // }\n // return false;\n // });\n // if (headerCellGroup) {\n // headerColGroup.removeChild(headerCellGroup);\n // }\n\n // remove cellGroup in colGroup\n let cellGroup;\n colGroup.forEachChildren((cell: Group) => {\n if (cell.row === row) {\n cellGroup = cell;\n return true;\n }\n return false;\n });\n if (cellGroup) {\n colGroup.removeChild(cellGroup);\n }\n }\n}\n\nfunction addRow(row: number, scene: Scenegraph) {\n for (let col = 0; col < scene.table.colCount; col++) {\n // create cellGroup\n const cellGroup = updateCell(col, row, scene.table, true);\n\n if (!cellGroup) {\n // TODO: deal with data promise situation\n continue;\n }\n\n // insert cellGroup in colGroup\n const colGroup = scene.getColGroup(col);\n if (colGroup.firstChild && row < (colGroup.firstChild as Group).row) {\n colGroup.insertBefore(cellGroup, colGroup.firstChild);\n } else if (colGroup.lastChild && row > (colGroup.lastChild as Group).row) {\n colGroup.appendChild(cellGroup);\n } else {\n let cellBefore;\n colGroup.forEachChildren((cellGroup: Group) => {\n if (cellGroup.row === row) {\n cellBefore = cellGroup;\n return true;\n }\n return false;\n });\n if (cellBefore !== cellGroup) {\n colGroup.insertBefore(cellGroup, cellBefore);\n }\n }\n\n // reset row number\n let rowIndex = (colGroup.firstChild as Group)?.row;\n colGroup.forEachChildren((cellGroup: Group) => {\n cellGroup.row = rowIndex;\n rowIndex++;\n });\n }\n}\n\n// array deduplication\nfunction deduplication(array: number[]) {\n const result = [];\n for (let i = 0; i < array.length; i++) {\n if (result.indexOf(array[i]) === -1) {\n result.push(array[i]);\n }\n }\n return result;\n}\n\nfunction resetRowNumber(scene: Scenegraph) {\n for (let col = 0; col < scene.table.colCount; col++) {\n const headerColGroup = scene.getColGroup(col, true);\n const colGroup = scene.getColGroup(col, false);\n // reset row number\n let rowIndex = (headerColGroup.firstChild as Group)?.row;\n headerColGroup.forEachChildren((cellGroup: Group) => {\n cellGroup.row = rowIndex;\n rowIndex++;\n });\n rowIndex = (colGroup.firstChild as Group)?.row;\n colGroup.forEachChildren((cellGroup: Group) => {\n cellGroup.row = rowIndex;\n rowIndex++;\n });\n }\n}\n\nfunction resetRowNumberAndY(scene: Scenegraph) {\n let newTotalHeight = 0;\n for (let col = 0; col < scene.table.colCount; col++) {\n const headerColGroup = scene.getColGroup(col, true);\n const colGroup = scene.getColGroup(col, false);\n // reset row number\n let rowIndex = (headerColGroup.firstChild as Group)?.row;\n let y = 0;\n // headerColGroup.forEachChildren((cellGroup: Group) => {\n // cellGroup.row = rowIndex;\n // rowIndex++;\n // if (cellGroup.role !== 'cell') {\n // return;\n // }\n // cellGroup.setAttribute('y', y);\n // y+= cellGroup.attribute.height;\n // });\n rowIndex = (colGroup.firstChild as Group)?.row;\n y = 0;\n colGroup.forEachChildren((cellGroup: Group) => {\n cellGroup.row = rowIndex;\n rowIndex++;\n if (cellGroup.role !== 'cell') {\n return;\n }\n cellGroup.setAttribute('y', y);\n y += cellGroup.attribute.height;\n });\n newTotalHeight = y;\n }\n\n // update table size\n scene.updateContainerHeight(scene.table.frozenRowCount, newTotalHeight - scene.bodyGroup.attribute.height);\n}\n"]}
@@ -8,7 +8,7 @@ import { getCellMergeInfo } from "../utils/get-cell-merge";
8
8
 
9
9
  import { getProp } from "../utils/get-prop";
10
10
 
11
- import { getPadding } from "../utils/padding";
11
+ import { getQuadProps } from "../utils/padding";
12
12
 
13
13
  import { updateCellContentWidth } from "../utils/text-icon-layout";
14
14
 
@@ -17,7 +17,7 @@ import { updateCellHeightForRow } from "./update-height";
17
17
  export function updateColWidth(scene, col, detaX) {
18
18
  const {autoRowHeight: autoRowHeight} = scene.table.internalProps;
19
19
  let needRerangeRow = !1;
20
- const colOrCornerHeaderColumn = scene.getColGroup(col, !0), oldColOrCornerHeaderColumnWidth = colOrCornerHeaderColumn.attribute.width;
20
+ const colOrCornerHeaderColumn = scene.getColGroup(col, !0), oldColOrCornerHeaderColumnWidth = null == colOrCornerHeaderColumn ? void 0 : colOrCornerHeaderColumn.attribute.width;
21
21
  if (null == colOrCornerHeaderColumn || colOrCornerHeaderColumn.setAttribute("width", oldColOrCornerHeaderColumnWidth + detaX),
22
22
  null == colOrCornerHeaderColumn || colOrCornerHeaderColumn.forEachChildren(((cell, index) => {
23
23
  if (updateCellWidth(scene, cell, col, cell.row, oldColOrCornerHeaderColumnWidth, detaX, index < scene.table.columnHeaderLevelCount, autoRowHeight)) {
@@ -81,16 +81,16 @@ function updateCellWidth(scene, cell, col, row, width, detaX, isHeader, autoRowH
81
81
  const type = scene.table.isHeader(col, row) ? scene.table._getHeaderLayoutMap(col, row).headerType : scene.table.getBodyColumnType(col, row);
82
82
  let isHeightChange = !1;
83
83
  if ("progressbar" === type) {
84
- const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = getPadding(getProp("padding", style, col, row, scene.table)), newBarCell = createProgressBarCell(columnDefine, style, cellGroup.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cellGroup.getChildByName("progress-bar");
84
+ const columnDefine = scene.table.getBodyColumnDefine(col, row), style = scene.table._getCellStyle(col, row), value = scene.table.getCellValue(col, row), dataValue = scene.table.getCellOriginValue(col, row), padding = getQuadProps(getProp("padding", style, col, row, scene.table)), newBarCell = createProgressBarCell(columnDefine, style, cellGroup.attribute.width, value, dataValue, col, row, padding, scene.table), oldBarCell = cellGroup.getChildByName("progress-bar");
85
85
  cellGroup.insertBefore(newBarCell, oldBarCell), cellGroup.removeChild(oldBarCell),
86
86
  oldBarCell.removeAllChild(), oldBarCell.release();
87
87
  } else if ("sparkline" === type) {
88
88
  cellGroup.removeAllChild();
89
- const headerStyle = scene.table._getCellStyle(col, row), padding = getPadding(getProp("padding", headerStyle, col, row, scene.table));
89
+ const headerStyle = scene.table._getCellStyle(col, row), padding = getQuadProps(getProp("padding", headerStyle, col, row, scene.table));
90
90
  createSparkLineCellGroup(cellGroup, cellGroup.parent, cellGroup.attribute.x, cellGroup.attribute.y, col, row, cellGroup.attribute.width, cellGroup.attribute.height, padding, scene.table);
91
91
  } else if ("image" === type || "video" === type) updateImageCellContentWhileResize(cellGroup, col, row, scene.table); else {
92
92
  const style = scene.table._getCellStyle(col, row);
93
- isHeightChange = updateCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, getPadding(style.padding), style.textAlign, style.textBaseline, scene);
93
+ isHeightChange = updateCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, scene);
94
94
  }
95
95
  return isHeightChange;
96
96
  }
@@ -117,7 +117,7 @@ function getCleanCellHeight(cell, scene) {
117
117
  cell.forEachChildren((child => {
118
118
  "icon-left" !== child.role && "icon-right" !== child.role && "text" !== child.name && "content" !== child.name || (maxHeight = Math.max(maxHeight, child.AABBBounds.height()));
119
119
  }));
120
- const padding = getPadding(scene.table._getCellStyle(cell.col, cell.row).padding);
120
+ const padding = getQuadProps(scene.table._getCellStyle(cell.col, cell.row).padding);
121
121
  return maxHeight + padding[0] + padding[2];
122
122
  }
123
123
  //# sourceMappingURL=update-width.js.map