@visactor/vtable 0.20.4-alpha.3 → 0.21.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 (239) hide show
  1. package/cjs/ListTable.d.ts +9 -2
  2. package/cjs/ListTable.js +25 -9
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +7 -1
  5. package/cjs/PivotChart.js +7 -7
  6. package/cjs/PivotChart.js.map +1 -1
  7. package/cjs/PivotTable.d.ts +9 -2
  8. package/cjs/PivotTable.js +26 -11
  9. package/cjs/PivotTable.js.map +1 -1
  10. package/cjs/body-helper/style/Style.d.ts +3 -0
  11. package/cjs/body-helper/style/Style.js +16 -9
  12. package/cjs/body-helper/style/Style.js.map +1 -1
  13. package/cjs/core/BaseTable.d.ts +7 -1
  14. package/cjs/core/BaseTable.js +4 -2
  15. package/cjs/core/BaseTable.js.map +1 -1
  16. package/cjs/core/tableHelper.js +3 -1
  17. package/cjs/core/tableHelper.js.map +1 -1
  18. package/cjs/edit/edit-manager.js +3 -1
  19. package/cjs/edit/edit-manager.js.map +1 -1
  20. package/cjs/event/listener/container-dom.js +58 -12
  21. package/cjs/event/listener/container-dom.js.map +1 -1
  22. package/cjs/event/listener/table-group.js +2 -1
  23. package/cjs/event/listener/table-group.js.map +1 -1
  24. package/cjs/header-helper/style/Style.d.ts +3 -0
  25. package/cjs/header-helper/style/Style.js +15 -8
  26. package/cjs/header-helper/style/Style.js.map +1 -1
  27. package/cjs/index.d.ts +3 -2
  28. package/cjs/index.js +16 -2
  29. package/cjs/index.js.map +1 -1
  30. package/cjs/layout/pivot-header-layout.d.ts +3 -2
  31. package/cjs/layout/pivot-header-layout.js +24 -18
  32. package/cjs/layout/pivot-header-layout.js.map +1 -1
  33. package/cjs/layout/row-height-map.d.ts +1 -0
  34. package/cjs/layout/row-height-map.js +25 -1
  35. package/cjs/layout/row-height-map.js.map +1 -1
  36. package/cjs/layout/simple-header-layout.d.ts +3 -3
  37. package/cjs/layout/simple-header-layout.js +22 -23
  38. package/cjs/layout/simple-header-layout.js.map +1 -1
  39. package/cjs/plugins/custom-cell-style.js +11 -8
  40. package/cjs/plugins/custom-cell-style.js.map +1 -1
  41. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +29 -7
  42. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  43. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js +5 -2
  44. package/cjs/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  45. package/cjs/scenegraph/group-creater/cell-helper.js +11 -4
  46. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  47. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +22 -19
  48. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  49. package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js +21 -18
  50. package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
  51. package/cjs/scenegraph/group-creater/cell-type/image-cell.js +7 -7
  52. package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  53. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +21 -18
  54. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  55. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +11 -10
  56. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  57. package/cjs/scenegraph/group-creater/cell-type/video-cell.js +7 -7
  58. package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  59. package/cjs/scenegraph/group-creater/progress/default-width-height.d.ts +3 -0
  60. package/cjs/scenegraph/group-creater/progress/default-width-height.js +24 -0
  61. package/cjs/scenegraph/group-creater/progress/default-width-height.js.map +1 -0
  62. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +8 -4
  63. package/cjs/scenegraph/group-creater/progress/proxy.js +50 -10
  64. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  65. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +1 -1
  66. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +14 -16
  67. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  68. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +1 -1
  69. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +28 -30
  70. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  71. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js +1 -1
  72. package/cjs/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  73. package/cjs/scenegraph/group-creater/progress/update-position/util.js.map +1 -1
  74. package/cjs/scenegraph/layout/compute-row-height.js +3 -2
  75. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  76. package/cjs/scenegraph/layout/move-cell.d.ts +1 -2
  77. package/cjs/scenegraph/layout/move-cell.js +3 -16
  78. package/cjs/scenegraph/layout/move-cell.js.map +1 -1
  79. package/cjs/scenegraph/scenegraph.d.ts +4 -4
  80. package/cjs/scenegraph/scenegraph.js +12 -7
  81. package/cjs/scenegraph/scenegraph.js.map +1 -1
  82. package/cjs/scenegraph/stick-text/index.js +1 -1
  83. package/cjs/scenegraph/stick-text/index.js.map +1 -1
  84. package/cjs/scenegraph/utils/cell-border-stroke-width.d.ts +3 -0
  85. package/cjs/scenegraph/utils/cell-border-stroke-width.js +16 -0
  86. package/cjs/scenegraph/utils/cell-border-stroke-width.js.map +1 -0
  87. package/cjs/scenegraph/utils/get-prop.js +3 -3
  88. package/cjs/scenegraph/utils/get-prop.js.map +1 -1
  89. package/cjs/scenegraph/utils/text-icon-layout.js +9 -3
  90. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  91. package/cjs/scenegraph/utils/text-measure.d.ts +4 -2
  92. package/cjs/scenegraph/utils/text-measure.js +20 -5
  93. package/cjs/scenegraph/utils/text-measure.js.map +1 -1
  94. package/cjs/state/cell-move/index.js +6 -6
  95. package/cjs/state/cell-move/index.js.map +1 -1
  96. package/cjs/state/state.js +2 -2
  97. package/cjs/state/state.js.map +1 -1
  98. package/cjs/themes/theme.d.ts +3 -0
  99. package/cjs/themes/theme.js +20 -0
  100. package/cjs/themes/theme.js.map +1 -1
  101. package/cjs/tools/NumberMap.d.ts +1 -0
  102. package/cjs/tools/NumberMap.js +21 -0
  103. package/cjs/tools/NumberMap.js.map +1 -1
  104. package/cjs/ts-types/base-table.d.ts +7 -0
  105. package/cjs/ts-types/base-table.js.map +1 -1
  106. package/cjs/ts-types/column/style.d.ts +1 -0
  107. package/cjs/ts-types/column/style.js.map +1 -1
  108. package/cjs/ts-types/common.d.ts +5 -3
  109. package/cjs/ts-types/common.js.map +1 -1
  110. package/cjs/ts-types/customElement.d.ts +2 -0
  111. package/cjs/ts-types/customElement.js.map +1 -1
  112. package/cjs/ts-types/style-define.d.ts +2 -0
  113. package/cjs/ts-types/style-define.js.map +1 -1
  114. package/cjs/ts-types/table-engine.d.ts +1 -1
  115. package/cjs/ts-types/table-engine.js.map +1 -1
  116. package/cjs/ts-types/theme.d.ts +3 -0
  117. package/cjs/ts-types/theme.js.map +1 -1
  118. package/cjs/vrender.js.map +1 -1
  119. package/dist/vtable.js +4376 -2132
  120. package/dist/vtable.min.js +2 -2
  121. package/es/ListTable.d.ts +9 -2
  122. package/es/ListTable.js +25 -9
  123. package/es/ListTable.js.map +1 -1
  124. package/es/PivotChart.d.ts +7 -1
  125. package/es/PivotChart.js +7 -7
  126. package/es/PivotChart.js.map +1 -1
  127. package/es/PivotTable.d.ts +9 -2
  128. package/es/PivotTable.js +27 -12
  129. package/es/PivotTable.js.map +1 -1
  130. package/es/body-helper/style/Style.d.ts +3 -0
  131. package/es/body-helper/style/Style.js +16 -9
  132. package/es/body-helper/style/Style.js.map +1 -1
  133. package/es/core/BaseTable.d.ts +7 -1
  134. package/es/core/BaseTable.js +4 -2
  135. package/es/core/BaseTable.js.map +1 -1
  136. package/es/core/tableHelper.js +3 -1
  137. package/es/core/tableHelper.js.map +1 -1
  138. package/es/edit/edit-manager.js +3 -1
  139. package/es/edit/edit-manager.js.map +1 -1
  140. package/es/event/listener/container-dom.js +57 -13
  141. package/es/event/listener/container-dom.js.map +1 -1
  142. package/es/event/listener/table-group.js +1 -1
  143. package/es/event/listener/table-group.js.map +1 -1
  144. package/es/header-helper/style/Style.d.ts +3 -0
  145. package/es/header-helper/style/Style.js +15 -8
  146. package/es/header-helper/style/Style.js.map +1 -1
  147. package/es/index.d.ts +3 -2
  148. package/es/index.js +4 -2
  149. package/es/index.js.map +1 -1
  150. package/es/layout/pivot-header-layout.d.ts +3 -2
  151. package/es/layout/pivot-header-layout.js +24 -18
  152. package/es/layout/pivot-header-layout.js.map +1 -1
  153. package/es/layout/row-height-map.d.ts +1 -0
  154. package/es/layout/row-height-map.js +25 -1
  155. package/es/layout/row-height-map.js.map +1 -1
  156. package/es/layout/simple-header-layout.d.ts +3 -3
  157. package/es/layout/simple-header-layout.js +22 -23
  158. package/es/layout/simple-header-layout.js.map +1 -1
  159. package/es/plugins/custom-cell-style.js +11 -8
  160. package/es/plugins/custom-cell-style.js.map +1 -1
  161. package/es/scenegraph/graphic/contributions/group-contribution-render.js +29 -6
  162. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  163. package/es/scenegraph/graphic/contributions/rect-contribution-render.js +5 -2
  164. package/es/scenegraph/graphic/contributions/rect-contribution-render.js.map +1 -1
  165. package/es/scenegraph/group-creater/cell-helper.js +11 -4
  166. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  167. package/es/scenegraph/group-creater/cell-type/chart-cell.js +23 -18
  168. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  169. package/es/scenegraph/group-creater/cell-type/checkbox-cell.js +22 -17
  170. package/es/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
  171. package/es/scenegraph/group-creater/cell-type/image-cell.js +8 -6
  172. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  173. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +22 -17
  174. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  175. package/es/scenegraph/group-creater/cell-type/text-cell.js +11 -9
  176. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  177. package/es/scenegraph/group-creater/cell-type/video-cell.js +8 -6
  178. package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  179. package/es/scenegraph/group-creater/progress/default-width-height.d.ts +3 -0
  180. package/es/scenegraph/group-creater/progress/default-width-height.js +18 -0
  181. package/es/scenegraph/group-creater/progress/default-width-height.js.map +1 -0
  182. package/es/scenegraph/group-creater/progress/proxy.d.ts +8 -4
  183. package/es/scenegraph/group-creater/progress/proxy.js +51 -11
  184. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  185. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.d.ts +1 -1
  186. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +14 -16
  187. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  188. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.d.ts +1 -1
  189. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +28 -31
  190. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  191. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js +1 -1
  192. package/es/scenegraph/group-creater/progress/update-position/update-auto-row.js.map +1 -1
  193. package/es/scenegraph/group-creater/progress/update-position/util.js.map +1 -1
  194. package/es/scenegraph/layout/compute-row-height.js +3 -1
  195. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  196. package/es/scenegraph/layout/move-cell.d.ts +1 -2
  197. package/es/scenegraph/layout/move-cell.js +3 -16
  198. package/es/scenegraph/layout/move-cell.js.map +1 -1
  199. package/es/scenegraph/scenegraph.d.ts +4 -4
  200. package/es/scenegraph/scenegraph.js +12 -7
  201. package/es/scenegraph/scenegraph.js.map +1 -1
  202. package/es/scenegraph/stick-text/index.js +1 -1
  203. package/es/scenegraph/stick-text/index.js.map +1 -1
  204. package/es/scenegraph/utils/cell-border-stroke-width.d.ts +3 -0
  205. package/es/scenegraph/utils/cell-border-stroke-width.js +10 -0
  206. package/es/scenegraph/utils/cell-border-stroke-width.js.map +1 -0
  207. package/es/scenegraph/utils/get-prop.js +3 -3
  208. package/es/scenegraph/utils/get-prop.js.map +1 -1
  209. package/es/scenegraph/utils/text-icon-layout.js +9 -3
  210. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  211. package/es/scenegraph/utils/text-measure.d.ts +4 -2
  212. package/es/scenegraph/utils/text-measure.js +19 -5
  213. package/es/scenegraph/utils/text-measure.js.map +1 -1
  214. package/es/state/cell-move/index.js +6 -6
  215. package/es/state/cell-move/index.js.map +1 -1
  216. package/es/state/state.js +2 -2
  217. package/es/state/state.js.map +1 -1
  218. package/es/themes/theme.d.ts +3 -0
  219. package/es/themes/theme.js +20 -0
  220. package/es/themes/theme.js.map +1 -1
  221. package/es/tools/NumberMap.d.ts +1 -0
  222. package/es/tools/NumberMap.js +21 -0
  223. package/es/tools/NumberMap.js.map +1 -1
  224. package/es/ts-types/base-table.d.ts +7 -0
  225. package/es/ts-types/base-table.js.map +1 -1
  226. package/es/ts-types/column/style.d.ts +1 -0
  227. package/es/ts-types/column/style.js.map +1 -1
  228. package/es/ts-types/common.d.ts +5 -3
  229. package/es/ts-types/common.js.map +1 -1
  230. package/es/ts-types/customElement.d.ts +2 -0
  231. package/es/ts-types/customElement.js.map +1 -1
  232. package/es/ts-types/style-define.d.ts +2 -0
  233. package/es/ts-types/style-define.js.map +1 -1
  234. package/es/ts-types/table-engine.d.ts +1 -1
  235. package/es/ts-types/table-engine.js.map +1 -1
  236. package/es/ts-types/theme.d.ts +3 -0
  237. package/es/ts-types/theme.js.map +1 -1
  238. package/es/vrender.js.map +1 -1
  239. package/package.json +10 -10
@@ -4,14 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  }), exports.createCellGroup = void 0;
6
6
 
7
- const vrender_1 = require("./../../../vrender"), vutils_1 = require("@visactor/vutils"), group_1 = require("../../graphic/group"), get_prop_1 = require("../../utils/get-prop"), text_icon_layout_1 = require("../../utils/text-icon-layout");
7
+ const vrender_1 = require("./../../../vrender"), vutils_1 = require("@visactor/vutils"), group_1 = require("../../graphic/group"), get_prop_1 = require("../../utils/get-prop"), text_icon_layout_1 = require("../../utils/text-icon-layout"), cell_border_stroke_width_1 = require("../../utils/cell-border-stroke-width");
8
8
 
9
9
  function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row, colWidth, cellWidth, cellHeight, padding, textAlign, textBaseline, mayHaveIcon, customElementsGroup, renderDefault, cellTheme, range) {
10
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
10
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
11
11
  const headerStyle = table._getCellStyle(col, row), functionalPadding = (0, get_prop_1.getFunctionalProp)("padding", headerStyle, col, row, table);
12
12
  (0, vutils_1.isValid)(functionalPadding) && (padding = functionalPadding), (null === (_a = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _a ? void 0 : _a.textAlign) && (textAlign = null === (_b = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _b ? void 0 : _b.textAlign),
13
13
  (null === (_c = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _c ? void 0 : _c.textBaseline) && (textBaseline = null === (_d = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _d ? void 0 : _d.textBaseline);
14
- const autoRowHeight = "autoHeight" === table.heightMode, autoColWidth = "auto" === colWidth, autoWrapText = null !== (_e = headerStyle.autoWrapText) && void 0 !== _e ? _e : table.internalProps.autoWrapText, lineClamp = headerStyle.lineClamp, cellGroup = new group_1.Group({
14
+ const autoRowHeight = "autoHeight" === table.heightMode, autoColWidth = "auto" === colWidth, autoWrapText = null !== (_e = headerStyle.autoWrapText) && void 0 !== _e ? _e : table.internalProps.autoWrapText, lineClamp = headerStyle.lineClamp, strokeArrayWidth = (0,
15
+ cell_border_stroke_width_1.getCellBorderStrokeWidth)(col, row, cellTheme, table), cellGroup = new group_1.Group({
15
16
  x: xOrigin,
16
17
  y: yOrigin,
17
18
  width: cellWidth,
@@ -19,10 +20,10 @@ function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row,
19
20
  lineWidth: null !== (_g = null === (_f = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _f ? void 0 : _f.lineWidth) && void 0 !== _g ? _g : void 0,
20
21
  fill: null !== (_j = null === (_h = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _h ? void 0 : _h.fill) && void 0 !== _j ? _j : void 0,
21
22
  stroke: null !== (_l = null === (_k = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _k ? void 0 : _k.stroke) && void 0 !== _l ? _l : void 0,
22
- strokeArrayWidth: null !== (_o = null === (_m = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _m ? void 0 : _m.strokeArrayWidth) && void 0 !== _o ? _o : void 0,
23
- strokeArrayColor: null !== (_q = null === (_p = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _p ? void 0 : _p.strokeArrayColor) && void 0 !== _q ? _q : void 0,
24
- cursor: null !== (_s = null === (_r = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _r ? void 0 : _r.cursor) && void 0 !== _s ? _s : void 0,
25
- lineDash: null !== (_u = null === (_t = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _t ? void 0 : _t.lineDash) && void 0 !== _u ? _u : void 0,
23
+ strokeArrayWidth: null != strokeArrayWidth ? strokeArrayWidth : void 0,
24
+ strokeArrayColor: null !== (_o = null === (_m = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _m ? void 0 : _m.strokeArrayColor) && void 0 !== _o ? _o : void 0,
25
+ cursor: null !== (_q = null === (_p = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _p ? void 0 : _p.cursor) && void 0 !== _q ? _q : void 0,
26
+ lineDash: null !== (_s = null === (_r = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _r ? void 0 : _r.lineDash) && void 0 !== _s ? _s : void 0,
26
27
  lineCap: "square",
27
28
  clip: !0,
28
29
  cornerRadius: cellTheme.group.cornerRadius
@@ -36,7 +37,7 @@ function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row,
36
37
  range && (iconCol = range.start.col, iconRow = range.start.row), icons = table.getCellIcons(iconCol, iconRow);
37
38
  }
38
39
  if ((0, text_icon_layout_1.createCellContent)(cellGroup, icons, textStr, padding, autoColWidth, autoRowHeight, autoWrapText, "number" == typeof lineClamp ? lineClamp : void 0, cellWidth, cellHeight, textAlign, textBaseline, table, cellTheme, range),
39
- null === (_v = null == cellTheme ? void 0 : cellTheme._vtable) || void 0 === _v ? void 0 : _v.marked) {
40
+ null === (_t = null == cellTheme ? void 0 : cellTheme._vtable) || void 0 === _t ? void 0 : _t.marked) {
40
41
  const mark = (0, vrender_1.createArc)({
41
42
  x: cellGroup.attribute.width,
42
43
  y: 0,
@@ -50,8 +51,8 @@ function createCellGroup(table, value, columnGroup, xOrigin, yOrigin, col, row,
50
51
  }
51
52
  }
52
53
  return customElementsGroup && cellGroup.setAttributes({
53
- width: Math.max(cellGroup.attribute.width, null !== (_w = customElementsGroup.attribute.width) && void 0 !== _w ? _w : 0),
54
- height: Math.max(cellGroup.attribute.height, null !== (_x = customElementsGroup.attribute.height) && void 0 !== _x ? _x : 0)
54
+ width: Math.max(cellGroup.attribute.width, null !== (_u = customElementsGroup.attribute.width) && void 0 !== _u ? _u : 0),
55
+ height: Math.max(cellGroup.attribute.height, null !== (_v = customElementsGroup.attribute.height) && void 0 !== _v ? _v : 0)
55
56
  }), cellGroup;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AC;SAC7B;KACF;IACD,IAAI,mBAAmB,EAAE;QACvB,SAAS,CAAC,aAAa,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAA,mBAAmB,CAAC,SAAS,CAAC,KAAK,mCAAI,CAAC,CAAC;YACpF,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAA,mBAAmB,CAAC,SAAS,CAAC,MAAM,mCAAI,CAAC,CAAC;SACxF,CAAC,CAAC;KACJ;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAzHD,0CAyHC","file":"text-cell.js","sourcesContent":["/* eslint-disable no-undef */\nimport type { IThemeSpec, Group as VGroup } from './../../../vrender';\nimport { createArc } from './../../../vrender';\nimport { isValid } from '@visactor/vutils';\nimport { Group } from '../../graphic/group';\n// import { parseFont } from '../../utils/font';\nimport { getFunctionalProp } from '../../utils/get-prop';\nimport { createCellContent } from '../../utils/text-icon-layout';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { getStyleTheme } from '../../../core/tableHelper';\nimport type { CellRange } from '../../../ts-types';\n\n/**\n * @description: 创建单元格场景节点\n * @param {Group} columnGroup 列Group\n * @param {number} xOrigin 起始x坐标\n * @param {number} yOrigin 起始y坐标\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @param {number | 'auto'} colWidth 配置列宽\n * @param {number} padding 单元格padding\n * @param {CanvasTextAlign} textAlign\n * @param {CanvasTextBaseline} textBaseline\n * @param {boolean} noWrap 不进行折行(default column type)\n * @param {IThemeSpec} cellTheme 单元格主题\n * @return {Group}\n */\nexport function createCellGroup(\n table: BaseTableAPI,\n value: string,\n columnGroup: Group,\n xOrigin: number,\n yOrigin: number,\n col: number,\n row: number,\n // rowHeight: number,\n colWidth: number | 'auto',\n cellWidth: number,\n cellHeight: number,\n padding: number[],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n mayHaveIcon: boolean,\n customElementsGroup: VGroup,\n renderDefault: boolean,\n cellTheme: IThemeSpec,\n range: CellRange | undefined\n): Group {\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);\n if (isValid(functionalPadding)) {\n padding = functionalPadding;\n }\n if (cellTheme?.text?.textAlign) {\n textAlign = cellTheme?.text?.textAlign;\n }\n if (cellTheme?.text?.textBaseline) {\n textBaseline = cellTheme?.text?.textBaseline;\n }\n const autoRowHeight = table.heightMode === 'autoHeight';\n const autoColWidth = colWidth === 'auto';\n const autoWrapText = headerStyle.autoWrapText ?? table.internalProps.autoWrapText;\n const lineClamp = headerStyle.lineClamp;\n\n // cell\n const cellGroup = new Group({\n x: xOrigin,\n y: yOrigin,\n width: cellWidth,\n height: cellHeight,\n // 背景相关,cell背景由cellGroup绘制\n lineWidth: cellTheme?.group?.lineWidth ?? undefined,\n fill: cellTheme?.group?.fill ?? undefined,\n stroke: cellTheme?.group?.stroke ?? undefined,\n strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined,\n strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined,\n cursor: (cellTheme?.group as any)?.cursor ?? undefined,\n lineDash: cellTheme?.group?.lineDash ?? undefined,\n\n lineCap: 'square',\n\n clip: true,\n\n cornerRadius: cellTheme.group.cornerRadius\n } as any);\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n // columnGroup?.addChild(cellGroup); // fix promise cell row order in column\n columnGroup?.addCellGroup(cellGroup);\n if (customElementsGroup) {\n cellGroup.appendChild(customElementsGroup);\n }\n if (renderDefault) {\n const textStr: string = value;\n let icons;\n if (mayHaveIcon) {\n let iconCol = col;\n let iconRow = row;\n if (range) {\n iconCol = range.start.col;\n iconRow = range.start.row;\n }\n icons = table.getCellIcons(iconCol, iconRow);\n }\n\n createCellContent(\n cellGroup,\n icons,\n textStr,\n padding as any,\n autoColWidth,\n autoRowHeight,\n autoWrapText,\n typeof lineClamp === 'number' ? lineClamp : undefined,\n // autoColWidth ? 0 : colWidth,\n // table.getRowHeight(row),\n cellWidth,\n cellHeight,\n textAlign,\n textBaseline,\n table,\n cellTheme,\n range\n );\n\n if ((cellTheme as any)?._vtable?.marked) {\n const mark = createArc({\n x: cellGroup.attribute.width,\n y: 0,\n startAngle: Math.PI / 2,\n endAngle: Math.PI,\n outerRadius: 6,\n fill: '#3073F2',\n pickable: false\n });\n mark.name = 'mark';\n\n cellGroup.appendChild(mark);\n }\n }\n if (customElementsGroup) {\n cellGroup.setAttributes({\n width: Math.max(cellGroup.attribute.width, customElementsGroup.attribute.width ?? 0),\n height: Math.max(cellGroup.attribute.height, customElementsGroup.attribute.height ?? 0)\n });\n }\n return cellGroup;\n}\n\n// /**\n// * @description: 获取函数式赋值的样式,记录在cellTheme中\n// * @param {BaseTableAPI} table\n// * @param {number} col\n// * @param {number} row\n// * @param {IThemeSpec} cellTheme\n// * @return {IThemeSpec | undefined}\n// */\n// export function getCellTheme(\n// table: BaseTableAPI,\n// col: number,\n// row: number,\n// cellTheme?: IThemeSpec\n// ): IThemeSpec | undefined {\n// // get column header style\n// const headerStyle = table._getCellStyle(col, row);\n\n// const theme = getStyleTheme(headerStyle, table, col, row, getFunctionalProp).theme;\n\n// for (const prop in theme.group) {\n// if (isValid(theme.group[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!cellTheme.group) {\n// cellTheme.group = {};\n// }\n\n// cellTheme.group[prop] = theme.group[prop];\n// }\n// }\n\n// for (const prop in theme.text) {\n// if (isValid(theme.text[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!cellTheme.text) {\n// cellTheme.text = {};\n// }\n\n// cellTheme.text[prop] = theme.text[prop];\n// }\n// }\n\n// for (const prop in theme._vtable) {\n// if (isValid(theme._vtable[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!(cellTheme as any)._vtable) {\n// (cellTheme as any)._vtable = {};\n// }\n\n// (cellTheme as any)._vtable[prop] = theme._vtable[prop];\n// }\n// }\n// return cellTheme;\n// }\n"]}
1
+ {"version":3,"sources":["../src/scenegraph/group-creater/cell-type/text-cell.ts"],"names":[],"mappings":";;;AAEA,gDAA+C;AAC/C,6CAA2C;AAC3C,+CAA4C;AAE5C,mDAAyD;AACzD,mEAAiE;AAIjE,mFAAgF;AAkBhF,SAAgB,eAAe,CAC7B,KAAmB,EACnB,KAAa,EACb,WAAkB,EAClB,OAAe,EACf,OAAe,EACf,GAAW,EACX,GAAW,EAEX,QAAyB,EACzB,SAAiB,EACjB,UAAkB,EAClB,OAAiB,EACjB,SAA0B,EAC1B,YAAgC,EAChC,WAAoB,EACpB,mBAA2B,EAC3B,aAAsB,EACtB,SAAqB,EACrB,KAA4B;;IAE5B,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,MAAM,iBAAiB,GAAG,IAAA,4BAAiB,EAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrF,IAAI,IAAA,gBAAO,EAAC,iBAAiB,CAAC,EAAE;QAC9B,OAAO,GAAG,iBAAiB,CAAC;KAC7B;IACD,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,SAAS,EAAE;QAC9B,SAAS,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,SAAS,CAAC;KACxC;IACD,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,YAAY,EAAE;QACjC,YAAY,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,YAAY,CAAC;KAC9C;IACD,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,KAAK,YAAY,CAAC;IACxD,MAAM,YA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W,EAAE,CAAC;gBACd,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,KAAK;aAChB,CAAC,CAAC;YACH,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;YAEnB,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;SAC7B;KACF;IACD,IAAI,mBAAmB,EAAE;QACvB,SAAS,CAAC,aAAa,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAA,mBAAmB,CAAC,SAAS,CAAC,KAAK,mCAAI,CAAC,CAAC;YACpF,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAA,mBAAmB,CAAC,SAAS,CAAC,MAAM,mCAAI,CAAC,CAAC;SACxF,CAAC,CAAC;KACJ;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AA1HD,0CA0HC","file":"text-cell.js","sourcesContent":["/* eslint-disable no-undef */\nimport type { IThemeSpec, Group as VGroup } from './../../../vrender';\nimport { createArc } from './../../../vrender';\nimport { isValid } from '@visactor/vutils';\nimport { Group } from '../../graphic/group';\n// import { parseFont } from '../../utils/font';\nimport { getFunctionalProp } from '../../utils/get-prop';\nimport { createCellContent } from '../../utils/text-icon-layout';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { getStyleTheme } from '../../../core/tableHelper';\nimport type { CellRange } from '../../../ts-types';\nimport { getCellBorderStrokeWidth } from '../../utils/cell-border-stroke-width';\n\n/**\n * @description: 创建单元格场景节点\n * @param {Group} columnGroup 列Group\n * @param {number} xOrigin 起始x坐标\n * @param {number} yOrigin 起始y坐标\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @param {number | 'auto'} colWidth 配置列宽\n * @param {number} padding 单元格padding\n * @param {CanvasTextAlign} textAlign\n * @param {CanvasTextBaseline} textBaseline\n * @param {boolean} noWrap 不进行折行(default column type)\n * @param {IThemeSpec} cellTheme 单元格主题\n * @return {Group}\n */\nexport function createCellGroup(\n table: BaseTableAPI,\n value: string,\n columnGroup: Group,\n xOrigin: number,\n yOrigin: number,\n col: number,\n row: number,\n // rowHeight: number,\n colWidth: number | 'auto',\n cellWidth: number,\n cellHeight: number,\n padding: number[],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n mayHaveIcon: boolean,\n customElementsGroup: VGroup,\n renderDefault: boolean,\n cellTheme: IThemeSpec,\n range: CellRange | undefined\n): Group {\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);\n if (isValid(functionalPadding)) {\n padding = functionalPadding;\n }\n if (cellTheme?.text?.textAlign) {\n textAlign = cellTheme?.text?.textAlign;\n }\n if (cellTheme?.text?.textBaseline) {\n textBaseline = cellTheme?.text?.textBaseline;\n }\n const autoRowHeight = table.heightMode === 'autoHeight';\n const autoColWidth = colWidth === 'auto';\n const autoWrapText = headerStyle.autoWrapText ?? table.internalProps.autoWrapText;\n const lineClamp = headerStyle.lineClamp;\n\n // cell\n const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);\n const cellGroup = new Group({\n x: xOrigin,\n y: yOrigin,\n width: cellWidth,\n height: cellHeight,\n // 背景相关,cell背景由cellGroup绘制\n lineWidth: cellTheme?.group?.lineWidth ?? undefined,\n fill: cellTheme?.group?.fill ?? undefined,\n stroke: cellTheme?.group?.stroke ?? undefined,\n strokeArrayWidth: strokeArrayWidth ?? undefined,\n strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined,\n cursor: (cellTheme?.group as any)?.cursor ?? undefined,\n lineDash: cellTheme?.group?.lineDash ?? undefined,\n\n lineCap: 'square',\n\n clip: true,\n\n cornerRadius: cellTheme.group.cornerRadius\n } as any);\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n // columnGroup?.addChild(cellGroup); // fix promise cell row order in column\n columnGroup?.addCellGroup(cellGroup);\n if (customElementsGroup) {\n cellGroup.appendChild(customElementsGroup);\n }\n if (renderDefault) {\n const textStr: string = value;\n let icons;\n if (mayHaveIcon) {\n let iconCol = col;\n let iconRow = row;\n if (range) {\n iconCol = range.start.col;\n iconRow = range.start.row;\n }\n icons = table.getCellIcons(iconCol, iconRow);\n }\n\n createCellContent(\n cellGroup,\n icons,\n textStr,\n padding as any,\n autoColWidth,\n autoRowHeight,\n autoWrapText,\n typeof lineClamp === 'number' ? lineClamp : undefined,\n // autoColWidth ? 0 : colWidth,\n // table.getRowHeight(row),\n cellWidth,\n cellHeight,\n textAlign,\n textBaseline,\n table,\n cellTheme,\n range\n );\n\n if ((cellTheme as any)?._vtable?.marked) {\n const mark = createArc({\n x: cellGroup.attribute.width,\n y: 0,\n startAngle: Math.PI / 2,\n endAngle: Math.PI,\n outerRadius: 6,\n fill: '#3073F2',\n pickable: false\n });\n mark.name = 'mark';\n\n cellGroup.appendChild(mark);\n }\n }\n if (customElementsGroup) {\n cellGroup.setAttributes({\n width: Math.max(cellGroup.attribute.width, customElementsGroup.attribute.width ?? 0),\n height: Math.max(cellGroup.attribute.height, customElementsGroup.attribute.height ?? 0)\n });\n }\n return cellGroup;\n}\n\n// /**\n// * @description: 获取函数式赋值的样式,记录在cellTheme中\n// * @param {BaseTableAPI} table\n// * @param {number} col\n// * @param {number} row\n// * @param {IThemeSpec} cellTheme\n// * @return {IThemeSpec | undefined}\n// */\n// export function getCellTheme(\n// table: BaseTableAPI,\n// col: number,\n// row: number,\n// cellTheme?: IThemeSpec\n// ): IThemeSpec | undefined {\n// // get column header style\n// const headerStyle = table._getCellStyle(col, row);\n\n// const theme = getStyleTheme(headerStyle, table, col, row, getFunctionalProp).theme;\n\n// for (const prop in theme.group) {\n// if (isValid(theme.group[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!cellTheme.group) {\n// cellTheme.group = {};\n// }\n\n// cellTheme.group[prop] = theme.group[prop];\n// }\n// }\n\n// for (const prop in theme.text) {\n// if (isValid(theme.text[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!cellTheme.text) {\n// cellTheme.text = {};\n// }\n\n// cellTheme.text[prop] = theme.text[prop];\n// }\n// }\n\n// for (const prop in theme._vtable) {\n// if (isValid(theme._vtable[prop])) {\n// if (!cellTheme) {\n// cellTheme = {};\n// }\n\n// if (!(cellTheme as any)._vtable) {\n// (cellTheme as any)._vtable = {};\n// }\n\n// (cellTheme as any)._vtable[prop] = theme._vtable[prop];\n// }\n// }\n// return cellTheme;\n// }\n"]}
@@ -29,14 +29,14 @@ Object.defineProperty(exports, "__esModule", {
29
29
  value: !0
30
30
  }), exports.createVideoCellGroup = void 0;
31
31
 
32
- const vrender_1 = require("./../../../vrender"), icons = __importStar(require("../../../icons")), group_1 = require("../../graphic/group"), keep_aspect_ratio_1 = require("../../utils/keep-aspect-ratio"), icon_1 = require("../../graphic/icon"), cell_pos_1 = require("../../utils/cell-pos"), image_cell_1 = require("./image-cell"), get_prop_1 = require("../../utils/get-prop"), vutils_1 = require("@visactor/vutils"), regedIcons = icons.get();
32
+ const vrender_1 = require("./../../../vrender"), icons = __importStar(require("../../../icons")), group_1 = require("../../graphic/group"), keep_aspect_ratio_1 = require("../../utils/keep-aspect-ratio"), icon_1 = require("../../graphic/icon"), cell_pos_1 = require("../../utils/cell-pos"), image_cell_1 = require("./image-cell"), get_prop_1 = require("../../utils/get-prop"), vutils_1 = require("@visactor/vutils"), cell_border_stroke_width_1 = require("../../utils/cell-border-stroke-width"), regedIcons = icons.get();
33
33
 
34
34
  function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, table, cellTheme) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
36
36
  const headerStyle = table._getCellStyle(col, row), functionalPadding = (0, get_prop_1.getFunctionalProp)("padding", headerStyle, col, row, table);
37
37
  (0, vutils_1.isValid)(functionalPadding) && (padding = functionalPadding), (null === (_a = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _a ? void 0 : _a.textAlign) && (textAlign = null === (_b = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _b ? void 0 : _b.textAlign),
38
38
  (null === (_c = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _c ? void 0 : _c.textBaseline) && (textBaseline = null === (_d = null == cellTheme ? void 0 : cellTheme.text) || void 0 === _d ? void 0 : _d.textBaseline);
39
- const cellGroup = new group_1.Group({
39
+ const strokeArrayWidth = (0, cell_border_stroke_width_1.getCellBorderStrokeWidth)(col, row, cellTheme, table), cellGroup = new group_1.Group({
40
40
  x: xOrigin,
41
41
  y: yOrigin,
42
42
  width: width,
@@ -44,10 +44,10 @@ function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, he
44
44
  lineWidth: null !== (_f = null === (_e = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _e ? void 0 : _e.lineWidth) && void 0 !== _f ? _f : void 0,
45
45
  fill: null !== (_h = null === (_g = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _g ? void 0 : _g.fill) && void 0 !== _h ? _h : void 0,
46
46
  stroke: null !== (_k = null === (_j = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _j ? void 0 : _j.stroke) && void 0 !== _k ? _k : void 0,
47
- strokeArrayWidth: null !== (_m = null === (_l = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _l ? void 0 : _l.strokeArrayWidth) && void 0 !== _m ? _m : void 0,
48
- strokeArrayColor: null !== (_p = null === (_o = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _o ? void 0 : _o.strokeArrayColor) && void 0 !== _p ? _p : void 0,
49
- cursor: null !== (_r = null === (_q = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _q ? void 0 : _q.cursor) && void 0 !== _r ? _r : void 0,
50
- lineDash: null !== (_t = null === (_s = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _s ? void 0 : _s.lineDash) && void 0 !== _t ? _t : void 0,
47
+ strokeArrayWidth: strokeArrayWidth,
48
+ strokeArrayColor: null !== (_m = null === (_l = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _l ? void 0 : _l.strokeArrayColor) && void 0 !== _m ? _m : void 0,
49
+ cursor: null !== (_p = null === (_o = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _o ? void 0 : _o.cursor) && void 0 !== _p ? _p : void 0,
50
+ lineDash: null !== (_r = null === (_q = null == cellTheme ? void 0 : cellTheme.group) || void 0 === _q ? void 0 : _q.lineDash) && void 0 !== _r ? _r : void 0,
51
51
  lineCap: "square",
52
52
  clip: !0,
53
53
  cornerRadius: cellTheme.group.cornerRadius
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scenegraph/group-creater/cell-type/video-cell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gDAA6D;AAC7D,sDAAwC;AACxC,+CAA4C;AAC5C,qEAAwE;AACxE,6CAA0C;AAC1C,mDAAyD;AACzD,6CAAkD;AAClD,mDAAkE;AAClE,6CAA2C;AAG3C,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;AAE/B,SAAgB,oBAAoB,CAClC,WAAkB,EAClB,OAAe,EACf,OAAe,EACf,GAAW,EACX,GAAW,EACX,KAAa,EACb,MAAc,EACd,eAAwB,EACxB,eAAwB,EACxB,OAAyC,EACzC,SAA0B,EAC1B,YAAgC,EAChC,KAAmB,EACnB,SAAqB;;IAErB,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,MAAM,iBAAiB,GAAG,IAAA,4BAAiB,EAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAErF,IAAI,IAAA,gBAAO,EA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AC;IACrB,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAE7B,OAAO,SAAS,CAAC;AACnB,CAAC;AArID,oDAqIC","file":"video-cell.js","sourcesContent":["/* eslint-disable no-undef */\nimport type { Cursor, IImage, IThemeSpec } from './../../../vrender';\nimport { createRect, createImage } from './../../../vrender';\nimport * as icons from '../../../icons';\nimport { Group } from '../../graphic/group';\nimport { calcKeepAspectRatioSize } from '../../utils/keep-aspect-ratio';\nimport { Icon } from '../../graphic/icon';\nimport { calcStartPosition } from '../../utils/cell-pos';\nimport { _adjustWidthHeight } from './image-cell';\nimport { getFunctionalProp, getProp } from '../../utils/get-prop';\nimport { isValid } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\n\nconst regedIcons = icons.get();\n\nexport function createVideoCellGroup(\n columnGroup: Group,\n xOrigin: number,\n yOrigin: number,\n col: number,\n row: number,\n width: number,\n height: number,\n keepAspectRatio: boolean,\n imageAutoSizing: boolean,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n table: BaseTableAPI,\n cellTheme: IThemeSpec\n) {\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);\n // const margin = getProp('padding', headerStyle, col, row, table);\n if (isValid(functionalPadding)) {\n padding = functionalPadding;\n }\n if (cellTheme?.text?.textAlign) {\n textAlign = cellTheme?.text?.textAlign;\n }\n if (cellTheme?.text?.textBaseline) {\n textBaseline = cellTheme?.text?.textBaseline;\n }\n\n // cell\n const cellGroup = new Group({\n x: xOrigin,\n y: yOrigin,\n width,\n height,\n // childrenPickable: false,\n\n // 背景相关,cell背景由cellGroup绘制\n lineWidth: cellTheme?.group?.lineWidth ?? undefined,\n fill: cellTheme?.group?.fill ?? undefined,\n stroke: cellTheme?.group?.stroke ?? undefined,\n strokeArrayWidth: (cellTheme?.group as any)?.strokeArrayWidth ?? undefined,\n strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined,\n cursor: (cellTheme?.group as any)?.cursor ?? undefined,\n lineDash: cellTheme?.group?.lineDash ?? undefined,\n\n lineCap: 'square',\n\n clip: true,\n\n cornerRadius: cellTheme.group.cornerRadius\n } as any);\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n // columnGroup?.addChild(cellGroup);\n columnGroup?.addCellGroup(cellGroup);\n\n // video\n const value = table.getCellValue(col, row);\n const video = document.createElement('video');\n video.addEventListener('loadeddata', (): void => {\n if (imageAutoSizing) {\n _adjustWidthHeight(col, row, video.videoWidth, video.videoHeight, table.scenegraph, padding, cellGroup);\n }\n const width = cellGroup.attribute.width;\n const height = cellGroup.attribute.height;\n // 更新宽高\n if (keepAspectRatio) {\n const { width: videoWidth, height: videoHeight } = calcKeepAspectRatioSize(\n video.videoWidth,\n video.videoHeight,\n width - padding[1] - padding[3],\n height - padding[0] - padding[2]\n );\n const pos = calcStartPosition(0, 0, width, height, videoWidth, videoHeight, textAlign, textBaseline, padding);\n\n image.setAttributes({\n width: videoWidth,\n height: videoHeight,\n x: pos.x,\n y: pos.y\n });\n } else {\n image.setAttributes({\n x: padding[3],\n y: padding[0],\n width: width - padding[1] - padding[3],\n height: height - padding[2] - padding[0]\n });\n }\n\n const left = 0;\n const top = 0;\n // 播放按钮\n const iconSize = Math.floor(Math.min(width - padding[1] - padding[3], height - padding[2] - padding[0]) / 2);\n const anchorX =\n left + (width > image.attribute.width ? image.attribute.x - left + image.attribute.width / 2 : width / 2);\n const anchorY =\n top + (height > image.attribute.height ? image.attribute.y - top + image.attribute.height / 2 : height / 2);\n\n const playIcon: Icon = new Icon({\n x: anchorX - iconSize / 2,\n y: anchorY - iconSize / 2,\n width: iconSize,\n height: iconSize,\n image: (regedIcons.play as any).svg,\n cursor: (regedIcons.play as any).cursor\n });\n playIcon.name = 'play-icon';\n cellGroup.appendChild(playIcon);\n // 触发重绘\n table.scenegraph.updateNextFrame();\n });\n video.onerror = (): void => {\n // image.setAttribute('image', (regedIcons.damage_pic as any).svg);\n (image as any).image = (regedIcons.damage_pic as any).svg;\n };\n video.src = value;\n video.setAttribute('preload', 'auto');\n\n const image: IImage = createImage({\n x: padding[3],\n y: padding[0],\n width: width - padding[1] - padding[3],\n height: height - padding[2] - padding[0],\n image: video as any,\n cursor: 'pointer' as Cursor\n });\n image.name = 'image';\n cellGroup.appendChild(image);\n\n return cellGroup;\n}\n"]}
1
+ {"version":3,"sources":["../src/scenegraph/group-creater/cell-type/video-cell.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gDAA6D;AAC7D,sDAAwC;AACxC,+CAA4C;AAC5C,qEAAwE;AACxE,6CAA0C;AAC1C,mDAAyD;AACzD,6CAAkD;AAClD,mDAAkE;AAClE,6CAA2C;AAE3C,mFAAgF;AAEhF,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;AAE/B,SAAgB,oBAAoB,CAClC,WAAkB,EAClB,OAAe,EACf,OAAe,EACf,GAAW,EACX,GAAW,EACX,KAAa,EACb,MAAc,EACd,eAAwB,EACxB,eAAwB,EACxB,OAAyC,EACzC,SAA0B,EAC1B,YAAgC,EAChC,KAAmB,EACnB,SAAqB;;IAErB,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAClD,MAAM,iBAAiB,GAAG,IAAA,4BAAiB,EAAC,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAErF,IAAI,IAAA,gBAAO,EAAC,iBAAiB,CAAC,EAAE;QAC9B,OAAO,GAAG,iBAAiB,CAAC;KAC7B;IACD,IAAI,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,SAAS,EAAE;QAC9B,SAAS,GAAG,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,0CAAE,SAAS,CAAC;KACxC;I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AG,CAAC;YACzB,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,CAAC;YACzB,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAG,UAAU,CAAC,IAAY,CAAC,GAAG;YACnC,MAAM,EAAG,UAAU,CAAC,IAAY,CAAC,MAAM;SACxC,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,GAAG,WAAW,CAAC;QAC5B,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAEhC,KAAK,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;IACrC,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,OAAO,GAAG,GAAS,EAAE;QAExB,KAAa,CAAC,KAAK,GAAI,UAAU,CAAC,UAAkB,CAAC,GAAG,CAAC;IAC5D,CAAC,CAAC;IACF,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC;IAClB,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAEtC,MAAM,KAAK,GAAW,IAAA,qBAAW,EAAC;QAChC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACb,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACb,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;QACtC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;QACxC,KAAK,EAAE,KAAY;QACnB,MAAM,EAAE,SAAmB;KAC5B,CAAC,CAAC;IACH,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC;IACrB,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAE7B,OAAO,SAAS,CAAC;AACnB,CAAC;AAtID,oDAsIC","file":"video-cell.js","sourcesContent":["/* eslint-disable no-undef */\nimport type { Cursor, IImage, IThemeSpec } from './../../../vrender';\nimport { createRect, createImage } from './../../../vrender';\nimport * as icons from '../../../icons';\nimport { Group } from '../../graphic/group';\nimport { calcKeepAspectRatioSize } from '../../utils/keep-aspect-ratio';\nimport { Icon } from '../../graphic/icon';\nimport { calcStartPosition } from '../../utils/cell-pos';\nimport { _adjustWidthHeight } from './image-cell';\nimport { getFunctionalProp, getProp } from '../../utils/get-prop';\nimport { isValid } from '@visactor/vutils';\nimport type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { getCellBorderStrokeWidth } from '../../utils/cell-border-stroke-width';\n\nconst regedIcons = icons.get();\n\nexport function createVideoCellGroup(\n columnGroup: Group,\n xOrigin: number,\n yOrigin: number,\n col: number,\n row: number,\n width: number,\n height: number,\n keepAspectRatio: boolean,\n imageAutoSizing: boolean,\n padding: [number, number, number, number],\n textAlign: CanvasTextAlign,\n textBaseline: CanvasTextBaseline,\n table: BaseTableAPI,\n cellTheme: IThemeSpec\n) {\n const headerStyle = table._getCellStyle(col, row); // to be fixed\n const functionalPadding = getFunctionalProp('padding', headerStyle, col, row, table);\n // const margin = getProp('padding', headerStyle, col, row, table);\n if (isValid(functionalPadding)) {\n padding = functionalPadding;\n }\n if (cellTheme?.text?.textAlign) {\n textAlign = cellTheme?.text?.textAlign;\n }\n if (cellTheme?.text?.textBaseline) {\n textBaseline = cellTheme?.text?.textBaseline;\n }\n\n // cell\n const strokeArrayWidth = getCellBorderStrokeWidth(col, row, cellTheme, table);\n const cellGroup = new Group({\n x: xOrigin,\n y: yOrigin,\n width,\n height,\n // childrenPickable: false,\n\n // 背景相关,cell背景由cellGroup绘制\n lineWidth: cellTheme?.group?.lineWidth ?? undefined,\n fill: cellTheme?.group?.fill ?? undefined,\n stroke: cellTheme?.group?.stroke ?? undefined,\n strokeArrayWidth: strokeArrayWidth,\n strokeArrayColor: (cellTheme?.group as any)?.strokeArrayColor ?? undefined,\n cursor: (cellTheme?.group as any)?.cursor ?? undefined,\n lineDash: cellTheme?.group?.lineDash ?? undefined,\n\n lineCap: 'square',\n\n clip: true,\n\n cornerRadius: cellTheme.group.cornerRadius\n } as any);\n cellGroup.role = 'cell';\n cellGroup.col = col;\n cellGroup.row = row;\n // columnGroup?.addChild(cellGroup);\n columnGroup?.addCellGroup(cellGroup);\n\n // video\n const value = table.getCellValue(col, row);\n const video = document.createElement('video');\n video.addEventListener('loadeddata', (): void => {\n if (imageAutoSizing) {\n _adjustWidthHeight(col, row, video.videoWidth, video.videoHeight, table.scenegraph, padding, cellGroup);\n }\n const width = cellGroup.attribute.width;\n const height = cellGroup.attribute.height;\n // 更新宽高\n if (keepAspectRatio) {\n const { width: videoWidth, height: videoHeight } = calcKeepAspectRatioSize(\n video.videoWidth,\n video.videoHeight,\n width - padding[1] - padding[3],\n height - padding[0] - padding[2]\n );\n const pos = calcStartPosition(0, 0, width, height, videoWidth, videoHeight, textAlign, textBaseline, padding);\n\n image.setAttributes({\n width: videoWidth,\n height: videoHeight,\n x: pos.x,\n y: pos.y\n });\n } else {\n image.setAttributes({\n x: padding[3],\n y: padding[0],\n width: width - padding[1] - padding[3],\n height: height - padding[2] - padding[0]\n });\n }\n\n const left = 0;\n const top = 0;\n // 播放按钮\n const iconSize = Math.floor(Math.min(width - padding[1] - padding[3], height - padding[2] - padding[0]) / 2);\n const anchorX =\n left + (width > image.attribute.width ? image.attribute.x - left + image.attribute.width / 2 : width / 2);\n const anchorY =\n top + (height > image.attribute.height ? image.attribute.y - top + image.attribute.height / 2 : height / 2);\n\n const playIcon: Icon = new Icon({\n x: anchorX - iconSize / 2,\n y: anchorY - iconSize / 2,\n width: iconSize,\n height: iconSize,\n image: (regedIcons.play as any).svg,\n cursor: (regedIcons.play as any).cursor\n });\n playIcon.name = 'play-icon';\n cellGroup.appendChild(playIcon);\n // 触发重绘\n table.scenegraph.updateNextFrame();\n });\n video.onerror = (): void => {\n // image.setAttribute('image', (regedIcons.damage_pic as any).svg);\n (image as any).image = (regedIcons.damage_pic as any).svg;\n };\n video.src = value;\n video.setAttribute('preload', 'auto');\n\n const image: IImage = createImage({\n x: padding[3],\n y: padding[0],\n width: width - padding[1] - padding[3],\n height: height - padding[2] - padding[0],\n image: video as any,\n cursor: 'pointer' as Cursor\n });\n image.name = 'image';\n cellGroup.appendChild(image);\n\n return cellGroup;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ import type { BaseTableAPI } from '../../../ts-types/base-table';
2
+ export declare function getDefaultWidth(table: BaseTableAPI): number;
3
+ export declare function getDefaultHeight(table: BaseTableAPI): number;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: !0
5
+ }), exports.getDefaultHeight = exports.getDefaultWidth = void 0;
6
+
7
+ const compute_col_width_1 = require("../../layout/compute-col-width"), compute_row_height_1 = require("../../layout/compute-row-height"), colSamplingNumber = 10, rowSamplingNumber = 10;
8
+
9
+ function getDefaultWidth(table) {
10
+ const {rowCount: rowCount, colCount: colCount} = table, widths = [], deltaCol = Math.max(1, Math.ceil(rowCount / colSamplingNumber)), deltaRow = Math.max(1, Math.ceil(colCount / rowSamplingNumber));
11
+ for (let col = 0; col < colCount; col += deltaCol) for (let row = 0; row < rowCount; row += deltaRow) widths.push((0,
12
+ compute_col_width_1.computeColWidth)(col, row, row, table));
13
+ return Math.ceil(widths.reduce(((a, b) => a + b), 0) / widths.length * 1.2);
14
+ }
15
+
16
+ function getDefaultHeight(table) {
17
+ const {rowCount: rowCount, colCount: colCount} = table, heights = [], deltaCol = Math.max(1, Math.ceil(rowCount / colSamplingNumber)), deltaRow = Math.max(1, Math.ceil(colCount / rowSamplingNumber));
18
+ for (let col = 0; col < colCount; col += deltaCol) for (let row = 0; row < rowCount; row += deltaRow) heights.push((0,
19
+ compute_row_height_1.computeRowHeight)(row, col, col, table));
20
+ return Math.ceil(heights.reduce(((a, b) => a + b), 0) / heights.length * 1.2);
21
+ }
22
+
23
+ exports.getDefaultWidth = getDefaultWidth, exports.getDefaultHeight = getDefaultHeight;
24
+ //# sourceMappingURL=default-width-height.js.map
@@ -0,0 +1 @@
1
+ {"version":3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AG,EAAE,CAAC;IACnB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,CAAC,CAAC;IACtE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,CAAC,CAAC;IAEtE,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,QAAQ,EAAE,GAAG,IAAI,QAAQ,EAAE;QACjD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,QAAQ,EAAE,GAAG,IAAI,QAAQ,EAAE;YAEjD,OAAO,CAAC,IAAI,CAAC,IAAA,qCAAgB,EAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;SACtD;KACF;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;IAE1F,OAAO,UAAU,CAAC;AACpB,CAAC;AAlBD,4CAkBC","file":"default-width-height.js","sourcesContent":["import type { BaseTableAPI } from '../../../ts-types/base-table';\nimport { computeColWidth } from '../../layout/compute-col-width';\nimport { computeRowHeight } from '../../layout/compute-row-height';\n\n// defaultRowHeight & defaultColWidth 在自动宽高模式中,\n// 会被用在滚动条跳转时,作为未测量的高(宽)用于计算预估滚动位置;\n// 如果default和实际相差过大,可能导致预估位置与实际位置相差过大,\n// 在相应行(列)计算出实际位置后,显示效果与预期相差较大(向上偏移或向下偏移)。\n// 这里使用采样方式,测量计算出一个预估的defaultRowHeight & defaultColWidth,\n// 优化实际位置与预期位置的差距\n\nconst colSamplingNumber = 10;\nconst rowSamplingNumber = 10;\n// The default row height and column width for proxy\n// use sampling calculation to get closer to the actual situation\nexport function getDefaultWidth(table: BaseTableAPI) {\n const { rowCount, colCount } = table;\n\n const widths = [];\n // const heights = [];\n const deltaCol = Math.max(1, Math.ceil(rowCount / colSamplingNumber));\n const deltaRow = Math.max(1, Math.ceil(colCount / rowSamplingNumber));\n\n for (let col = 0; col < colCount; col += deltaCol) {\n for (let row = 0; row < rowCount; row += deltaRow) {\n widths.push(computeColWidth(col, row, row, table));\n // heights.push(computeRowHeight(row, col, col, table));\n }\n }\n const meanWidth = Math.ceil((widths.reduce((a, b) => a + b, 0) / widths.length) * 1.2); // 1.2为buffer值,让计算结果稍大\n // const meanHeight = heights.reduce((a, b) => a + b, 0) / heights.length;\n\n return meanWidth;\n}\n\nexport function getDefaultHeight(table: BaseTableAPI) {\n const { rowCount, colCount } = table;\n\n // const widths = [];\n const heights = [];\n const deltaCol = Math.max(1, Math.ceil(rowCount / colSamplingNumber));\n const deltaRow = Math.max(1, Math.ceil(colCount / rowSamplingNumber));\n\n for (let col = 0; col < colCount; col += deltaCol) {\n for (let row = 0; row < rowCount; row += deltaRow) {\n // widths.push(computeColWidth(col, row, row, table));\n heights.push(computeRowHeight(row, col, col, table));\n }\n }\n // const meanWidth = widths.reduce((a, b) => a + b, 0) / widths.length;\n const meanHeight = Math.ceil((heights.reduce((a, b) => a + b, 0) / heights.length) * 1.2); // 1.2为buffer值,让计算结果稍大\n\n return meanHeight;\n}\n"]}
@@ -23,6 +23,7 @@ export declare class SceneProxy {
23
23
  screenTopRow: number;
24
24
  totalActualBodyRowCount: number;
25
25
  deltaY: number;
26
+ deltaHeight: number;
26
27
  colLimit: number;
27
28
  bodyRightCol: number;
28
29
  totalCol: number;
@@ -40,6 +41,7 @@ export declare class SceneProxy {
40
41
  colUpdateDirection: 'left' | 'right';
41
42
  totalActualBodyColCount: number;
42
43
  deltaX: number;
44
+ deltaWidth: number;
43
45
  cellCache: Map<number, Group>;
44
46
  constructor(table: BaseTableAPI);
45
47
  get bodyLeftCol(): number;
@@ -52,10 +54,10 @@ export declare class SceneProxy {
52
54
  createCol(): Promise<void>;
53
55
  createRowCellGroup(onceCount: number): void;
54
56
  createColGroup(onceCount: number): void;
55
- setY(y: number): Promise<void>;
56
- setX(x: number): Promise<void>;
57
- dynamicSetY(y: number): Promise<void>;
58
- dynamicSetX(x: number): Promise<void>;
57
+ setY(y: number, isEnd?: boolean): Promise<void>;
58
+ setX(x: number, isEnd?: boolean): Promise<void>;
59
+ dynamicSetY(y: number, isEnd?: boolean): Promise<void>;
60
+ dynamicSetX(x: number, isEnd?: boolean): Promise<void>;
59
61
  updateBody(y: number): void;
60
62
  updateRowCellGroupsAsync(): Promise<void>;
61
63
  updateCellGroups(count: number): void;
@@ -68,5 +70,7 @@ export declare class SceneProxy {
68
70
  sortCellVertical(): Promise<void>;
69
71
  sortCellHorizontal(): Promise<void>;
70
72
  highPerformanceGetCell(col: number, row: number, getShadow?: boolean): Group;
73
+ updateDeltaY(y: number, screenTopY?: number, screenTopRow?: number): void;
74
+ updateDeltaX(x: number, screenLeftX?: number, screenLeftCol?: number): void;
71
75
  release(): void;
72
76
  }
@@ -36,8 +36,9 @@ class SceneProxy {
36
36
  constructor(table) {
37
37
  this.isRelease = !1, this.mode = "column", this.rowLimit = 200, this.currentRow = 0,
38
38
  this.rowStart = 0, this.rowEnd = 0, this.referenceRow = 0, this.screenTopRow = 0,
39
- this.deltaY = 0, this.colLimit = 100, this.screenLeftCol = 0, this.deltaX = 0, this.cellCache = new Map,
40
- this.table = table, this.table.isPivotChart() ? (this.rowLimit = 100, this.colLimit = 100) : "autoHeight" === this.table.heightMode ? this.rowLimit = 100 : "autoWidth" === this.table.widthMode && (this.colLimit = 100),
39
+ this.deltaY = 0, this.deltaHeight = 0, this.colLimit = 100, this.screenLeftCol = 0,
40
+ this.deltaX = 0, this.deltaWidth = 0, this.cellCache = new Map, this.table = table,
41
+ this.table.isPivotChart() ? (this.rowLimit = 100, this.colLimit = 100) : "autoHeight" === this.table.heightMode ? this.rowLimit = 100 : "autoWidth" === this.table.widthMode && (this.colLimit = 100),
41
42
  this.table.internalProps.transpose ? this.mode = "row" : this.table.isPivotTable() && (this.mode = "pivot"),
42
43
  this.table.options.maintainedDataCount && (this.rowLimit = this.table.options.maintainedDataCount);
43
44
  }
@@ -164,26 +165,29 @@ class SceneProxy {
164
165
  this.referenceCol = this.colStart + Math.floor((endCol - this.colStart) / 2), this.table.scenegraph.updateContainer(),
165
166
  this.table.scenegraph.updateBorderSizeAndPosition();
166
167
  }
167
- setY(y) {
168
+ setY(y, isEnd = !1) {
168
169
  return __awaiter(this, void 0, void 0, (function*() {
169
170
  const yLimitTop = this.table.getRowsHeight(this.bodyTopRow, this.bodyTopRow + (this.rowEnd - this.rowStart + 1)) / 2, yLimitBottom = this.table.getAllRowsHeight() - yLimitTop;
170
- y < yLimitTop && this.rowStart === this.bodyTopRow || y > yLimitBottom && this.rowEnd === this.bodyBottomRow ? this.table.scenegraph.setBodyAndRowHeaderY(-y) : this.table.scenegraph.bodyGroup.firstChild && 0 !== this.table.scenegraph.bodyGroup.firstChild.childrenCount ? this.dynamicSetY(y) : this.table.scenegraph.setBodyAndRowHeaderY(-y);
171
+ y < yLimitTop && this.rowStart === this.bodyTopRow || y > yLimitBottom && this.rowEnd === this.bodyBottomRow ? (this.updateDeltaY(y),
172
+ this.updateBody(y - this.deltaY)) : this.table.scenegraph.bodyGroup.firstChild && 0 !== this.table.scenegraph.bodyGroup.firstChild.childrenCount ? this.dynamicSetY(y, isEnd) : (this.updateDeltaY(y),
173
+ this.updateBody(y - this.deltaY));
171
174
  }));
172
175
  }
173
- setX(x) {
176
+ setX(x, isEnd = !1) {
174
177
  return __awaiter(this, void 0, void 0, (function*() {
175
178
  const xLimitLeft = this.table.getColsWidth(this.bodyLeftCol, this.bodyLeftCol + (this.colEnd - this.colStart + 1)) / 2, xLimitRight = this.table.getAllColsWidth() - xLimitLeft;
176
- x < xLimitLeft && this.colStart === this.bodyLeftCol || x > xLimitRight && this.colEnd === this.bodyRightCol || this.table.scenegraph.bodyGroup.firstChild && 0 === this.table.scenegraph.bodyGroup.firstChild.childrenCount ? this.table.scenegraph.setBodyAndColHeaderX(-x) : this.dynamicSetX(x);
179
+ x < xLimitLeft && this.colStart === this.bodyLeftCol || x > xLimitRight && this.colEnd === this.bodyRightCol || this.table.scenegraph.bodyGroup.firstChild && 0 === this.table.scenegraph.bodyGroup.firstChild.childrenCount ? (this.updateDeltaX(x),
180
+ this.table.scenegraph.setBodyAndColHeaderX(-x + this.deltaX)) : this.dynamicSetX(x, isEnd);
177
181
  }));
178
182
  }
179
- dynamicSetY(y) {
183
+ dynamicSetY(y, isEnd = !1) {
180
184
  return __awaiter(this, void 0, void 0, (function*() {
181
- (0, dynamic_set_y_1.dynamicSetY)(y, this);
185
+ (0, dynamic_set_y_1.dynamicSetY)(y, isEnd, this);
182
186
  }));
183
187
  }
184
- dynamicSetX(x) {
188
+ dynamicSetX(x, isEnd = !1) {
185
189
  return __awaiter(this, void 0, void 0, (function*() {
186
- (0, dynamic_set_x_1.dynamicSetX)(x, this);
190
+ (0, dynamic_set_x_1.dynamicSetX)(x, isEnd, this);
187
191
  }));
188
192
  }
189
193
  updateBody(y) {
@@ -265,6 +269,42 @@ class SceneProxy {
265
269
  return cellGroup.col === col && cellGroup.row && this.cellCache.set(col, cellGroup),
266
270
  cellGroup;
267
271
  }
272
+ updateDeltaY(y, screenTopY, screenTopRow) {
273
+ if (this.rowStart === this.bodyTopRow) {
274
+ const cellGroup = this.table.scenegraph.highPerformanceGetCell(this.colStart, this.rowStart, !0);
275
+ if ("cell" === cellGroup.role) {
276
+ const deltaY = cellGroup.attribute.y;
277
+ this.deltaY = -deltaY;
278
+ }
279
+ } else if (this.rowEnd === this.bodyBottomRow) {
280
+ const cellGroup = this.table.scenegraph.highPerformanceGetCell(this.colStart, this.rowEnd, !0);
281
+ if ("cell" === cellGroup.role) {
282
+ const deltaY = cellGroup.attribute.y + cellGroup.attribute.height - (this.table.getAllRowsHeight() - this.table.getFrozenRowsHeight() - this.table.getBottomFrozenRowsHeight());
283
+ this.deltaY = -deltaY;
284
+ }
285
+ } else if ((0, vutils_1.isValid)(screenTopY) && (0, vutils_1.isValid)(screenTopRow)) {
286
+ const cellGroup = this.table.scenegraph.highPerformanceGetCell(this.colStart, screenTopRow, !0), bodyY = y - this.deltaY, distRowYOffset = screenTopY - bodyY, currentRowYOffset = cellGroup.attribute.y - bodyY + this.table.getFrozenRowsHeight();
287
+ this.deltaY = distRowYOffset - currentRowYOffset;
288
+ }
289
+ }
290
+ updateDeltaX(x, screenLeftX, screenLeftCol) {
291
+ if (this.colStart === this.bodyLeftCol) {
292
+ const colGroup = this.table.scenegraph.getColGroup(this.colStart);
293
+ if (colGroup) {
294
+ const deltaX = colGroup.attribute.x;
295
+ this.deltaX = -deltaX;
296
+ }
297
+ } else if (this.colEnd === this.bodyRightCol) {
298
+ const colGroup = this.table.scenegraph.getColGroup(this.colEnd);
299
+ if (colGroup) {
300
+ const deltaX = colGroup.attribute.x + colGroup.attribute.width - (this.table.getAllColsWidth() - this.table.getFrozenColsWidth() - this.table.getRightFrozenColsWidth());
301
+ this.deltaX = -deltaX;
302
+ }
303
+ } else if ((0, vutils_1.isValid)(screenLeftX) && (0, vutils_1.isValid)(screenLeftCol)) {
304
+ const colGroup = this.table.scenegraph.getColGroup(screenLeftCol) || this.table.scenegraph.getColGroup(screenLeftCol, !0), bodyX = x - this.deltaX, distColXOffset = screenLeftX - bodyX, currentColXOffset = colGroup.attribute.x - bodyX + this.table.getFrozenColsWidth();
305
+ this.deltaX = distColXOffset - currentColXOffset;
306
+ }
307
+ }
268
308
  release() {
269
309
  this.isRelease = !0;
270
310
  }