@visactor/vtable 0.15.0-alpha.3 → 0.15.0

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 (217) hide show
  1. package/cjs/ListTable.d.ts +12 -0
  2. package/cjs/ListTable.js +127 -13
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +1 -0
  5. package/cjs/PivotChart.js +36 -26
  6. package/cjs/PivotChart.js.map +1 -1
  7. package/cjs/PivotTable.d.ts +5 -1
  8. package/cjs/PivotTable.js +109 -63
  9. package/cjs/PivotTable.js.map +1 -1
  10. package/cjs/core/BaseTable.d.ts +1 -2
  11. package/cjs/core/BaseTable.js +72 -92
  12. package/cjs/core/BaseTable.js.map +1 -1
  13. package/cjs/core/TABLE_EVENT_TYPE.d.ts +2 -0
  14. package/cjs/core/TABLE_EVENT_TYPE.js +3 -1
  15. package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
  16. package/cjs/data/DataSource.d.ts +7 -1
  17. package/cjs/data/DataSource.js +43 -8
  18. package/cjs/data/DataSource.js.map +1 -1
  19. package/cjs/dataset/dataset.d.ts +3 -1
  20. package/cjs/dataset/dataset.js +20 -15
  21. package/cjs/dataset/dataset.js.map +1 -1
  22. package/cjs/edit/edit-manager.d.ts +14 -0
  23. package/cjs/edit/edit-manager.js +72 -0
  24. package/cjs/edit/edit-manager.js.map +1 -0
  25. package/cjs/edit/editors.d.ts +5 -0
  26. package/cjs/edit/editors.js +10 -0
  27. package/cjs/edit/editors.js.map +1 -0
  28. package/cjs/event/event.d.ts +3 -1
  29. package/cjs/event/event.js +5 -1
  30. package/cjs/event/event.js.map +1 -1
  31. package/cjs/event/listener/container-dom.js +5 -1
  32. package/cjs/event/listener/container-dom.js.map +1 -1
  33. package/cjs/event/listener/table-group.d.ts +1 -0
  34. package/cjs/event/listener/table-group.js +41 -27
  35. package/cjs/event/listener/table-group.js.map +1 -1
  36. package/cjs/event/media-click.js +1 -2
  37. package/cjs/event/sparkline-event.js +2 -1
  38. package/cjs/index.d.ts +1 -1
  39. package/cjs/index.js +1 -1
  40. package/cjs/index.js.map +1 -1
  41. package/cjs/layout/pivot-header-layout.d.ts +8 -1
  42. package/cjs/layout/pivot-header-layout.js +47 -22
  43. package/cjs/layout/pivot-header-layout.js.map +1 -1
  44. package/cjs/layout/pivot-layout-helper.d.ts +11 -0
  45. package/cjs/layout/pivot-layout-helper.js +24 -2
  46. package/cjs/layout/pivot-layout-helper.js.map +1 -1
  47. package/cjs/layout/simple-header-layout.d.ts +3 -1
  48. package/cjs/layout/simple-header-layout.js +11 -9
  49. package/cjs/layout/simple-header-layout.js.map +1 -1
  50. package/cjs/register.d.ts +2 -0
  51. package/cjs/register.js +8 -3
  52. package/cjs/register.js.map +1 -1
  53. package/cjs/scenegraph/component/menu.d.ts +41 -0
  54. package/cjs/scenegraph/graphic/icon.js +5 -5
  55. package/cjs/scenegraph/graphic/icon.js.map +1 -1
  56. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.d.ts +1 -1
  57. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +30 -58
  58. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  59. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +1 -1
  60. package/cjs/scenegraph/group-creater/progress/proxy.js +1 -3
  61. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  62. package/cjs/scenegraph/icon/icon-update.js +4 -4
  63. package/cjs/scenegraph/icon/icon-update.js.map +1 -1
  64. package/cjs/scenegraph/layout/compute-col-width.d.ts +1 -1
  65. package/cjs/scenegraph/layout/compute-col-width.js +10 -8
  66. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  67. package/cjs/scenegraph/scenegraph.d.ts +1 -0
  68. package/cjs/scenegraph/scenegraph.js +19 -12
  69. package/cjs/scenegraph/scenegraph.js.map +1 -1
  70. package/cjs/scenegraph/select/update-select-border.js +5 -5
  71. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  72. package/cjs/state/resize/update-resize-column.js +15 -6
  73. package/cjs/state/resize/update-resize-column.js.map +1 -1
  74. package/cjs/state/state.js +5 -4
  75. package/cjs/state/state.js.map +1 -1
  76. package/cjs/themes/ARCO.js +1 -1
  77. package/cjs/themes/BRIGHT.js +1 -2
  78. package/cjs/themes/DARK.js +1 -1
  79. package/cjs/themes/DEFAULT.js +1 -1
  80. package/cjs/themes/SIMPLIFY.js +1 -1
  81. package/cjs/themes/theme.js +1 -1
  82. package/cjs/tools/LimitPromiseQueue.js +1 -1
  83. package/cjs/tools/NumberMap.js +1 -1
  84. package/cjs/tools/Rect.js +2 -1
  85. package/cjs/tools/calc.js +1 -1
  86. package/cjs/tools/debounce.js +1 -1
  87. package/cjs/tools/diff-cell.js +2 -2
  88. package/cjs/tools/dom.js +1 -1
  89. package/cjs/tools/env.js +1 -1
  90. package/cjs/tools/global.js +1 -1
  91. package/cjs/tools/helper.js +1 -1
  92. package/cjs/ts-types/base-table.d.ts +2 -2
  93. package/cjs/ts-types/base-table.js +1 -1
  94. package/cjs/ts-types/base-table.js.map +1 -1
  95. package/cjs/ts-types/common.d.ts +6 -0
  96. package/cjs/ts-types/common.js +1 -1
  97. package/cjs/ts-types/common.js.map +1 -1
  98. package/cjs/ts-types/component/title.d.ts +3 -3
  99. package/cjs/ts-types/component/title.js.map +1 -1
  100. package/cjs/ts-types/events.d.ts +12 -2
  101. package/cjs/ts-types/events.js.map +1 -1
  102. package/cjs/ts-types/list-table/define/basic-define.d.ts +5 -1
  103. package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
  104. package/cjs/ts-types/list-table/layout-map/api.d.ts +1 -1
  105. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  106. package/cjs/ts-types/table-engine.d.ts +13 -1
  107. package/cjs/ts-types/table-engine.js.map +1 -1
  108. package/dist/vtable.js +9136 -25006
  109. package/dist/vtable.min.js +2 -2
  110. package/es/ListTable.d.ts +12 -0
  111. package/es/ListTable.js +111 -12
  112. package/es/ListTable.js.map +1 -1
  113. package/es/PivotChart.d.ts +1 -0
  114. package/es/PivotChart.js +36 -27
  115. package/es/PivotChart.js.map +1 -1
  116. package/es/PivotTable.d.ts +5 -1
  117. package/es/PivotTable.js +104 -61
  118. package/es/PivotTable.js.map +1 -1
  119. package/es/core/BaseTable.d.ts +1 -2
  120. package/es/core/BaseTable.js +74 -94
  121. package/es/core/BaseTable.js.map +1 -1
  122. package/es/core/TABLE_EVENT_TYPE.d.ts +2 -0
  123. package/es/core/TABLE_EVENT_TYPE.js +3 -1
  124. package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
  125. package/es/data/DataSource.d.ts +7 -1
  126. package/es/data/DataSource.js +44 -9
  127. package/es/data/DataSource.js.map +1 -1
  128. package/es/dataset/dataset.d.ts +3 -1
  129. package/es/dataset/dataset.js +20 -15
  130. package/es/dataset/dataset.js.map +1 -1
  131. package/es/edit/edit-manager.d.ts +14 -0
  132. package/es/edit/edit-manager.js +66 -0
  133. package/es/edit/edit-manager.js.map +1 -0
  134. package/es/edit/editors.d.ts +5 -0
  135. package/es/edit/editors.js +6 -0
  136. package/es/edit/editors.js.map +1 -0
  137. package/es/event/event.d.ts +3 -1
  138. package/es/event/event.js +5 -2
  139. package/es/event/event.js.map +1 -1
  140. package/es/event/listener/container-dom.js +5 -1
  141. package/es/event/listener/container-dom.js.map +1 -1
  142. package/es/event/listener/table-group.d.ts +1 -0
  143. package/es/event/listener/table-group.js +40 -24
  144. package/es/event/listener/table-group.js.map +1 -1
  145. package/es/event/media-click.js +1 -2
  146. package/es/event/sparkline-event.js +2 -1
  147. package/es/index.d.ts +1 -1
  148. package/es/index.js +1 -1
  149. package/es/index.js.map +1 -1
  150. package/es/layout/pivot-header-layout.d.ts +8 -1
  151. package/es/layout/pivot-header-layout.js +48 -23
  152. package/es/layout/pivot-header-layout.js.map +1 -1
  153. package/es/layout/pivot-layout-helper.d.ts +11 -0
  154. package/es/layout/pivot-layout-helper.js +21 -0
  155. package/es/layout/pivot-layout-helper.js.map +1 -1
  156. package/es/layout/simple-header-layout.d.ts +3 -1
  157. package/es/layout/simple-header-layout.js +11 -9
  158. package/es/layout/simple-header-layout.js.map +1 -1
  159. package/es/register.d.ts +2 -0
  160. package/es/register.js +6 -0
  161. package/es/register.js.map +1 -1
  162. package/es/scenegraph/component/menu.d.ts +41 -0
  163. package/es/scenegraph/graphic/icon.js +5 -5
  164. package/es/scenegraph/graphic/icon.js.map +1 -1
  165. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.d.ts +1 -1
  166. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +29 -57
  167. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  168. package/es/scenegraph/group-creater/progress/proxy.d.ts +1 -1
  169. package/es/scenegraph/group-creater/progress/proxy.js +1 -3
  170. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  171. package/es/scenegraph/icon/icon-update.js +4 -4
  172. package/es/scenegraph/icon/icon-update.js.map +1 -1
  173. package/es/scenegraph/layout/compute-col-width.d.ts +1 -1
  174. package/es/scenegraph/layout/compute-col-width.js +10 -8
  175. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  176. package/es/scenegraph/scenegraph.d.ts +1 -0
  177. package/es/scenegraph/scenegraph.js +19 -12
  178. package/es/scenegraph/scenegraph.js.map +1 -1
  179. package/es/scenegraph/select/update-select-border.js +5 -5
  180. package/es/scenegraph/select/update-select-border.js.map +1 -1
  181. package/es/state/resize/update-resize-column.js +15 -6
  182. package/es/state/resize/update-resize-column.js.map +1 -1
  183. package/es/state/state.js +5 -4
  184. package/es/state/state.js.map +1 -1
  185. package/es/themes/ARCO.js +1 -1
  186. package/es/themes/BRIGHT.js +1 -2
  187. package/es/themes/DARK.js +1 -1
  188. package/es/themes/DEFAULT.js +1 -1
  189. package/es/themes/SIMPLIFY.js +1 -1
  190. package/es/themes/theme.js +1 -1
  191. package/es/tools/LimitPromiseQueue.js +1 -1
  192. package/es/tools/NumberMap.js +1 -1
  193. package/es/tools/Rect.js +2 -1
  194. package/es/tools/calc.js +1 -1
  195. package/es/tools/debounce.js +1 -1
  196. package/es/tools/diff-cell.js +1 -1
  197. package/es/tools/dom.js +1 -1
  198. package/es/tools/env.js +1 -1
  199. package/es/tools/global.js +1 -1
  200. package/es/tools/helper.js +1 -1
  201. package/es/ts-types/base-table.d.ts +2 -2
  202. package/es/ts-types/base-table.js +1 -1
  203. package/es/ts-types/base-table.js.map +1 -1
  204. package/es/ts-types/common.d.ts +6 -0
  205. package/es/ts-types/common.js +1 -1
  206. package/es/ts-types/common.js.map +1 -1
  207. package/es/ts-types/component/title.d.ts +3 -3
  208. package/es/ts-types/component/title.js.map +1 -1
  209. package/es/ts-types/events.d.ts +12 -2
  210. package/es/ts-types/events.js.map +1 -1
  211. package/es/ts-types/list-table/define/basic-define.d.ts +5 -1
  212. package/es/ts-types/list-table/define/basic-define.js.map +1 -1
  213. package/es/ts-types/list-table/layout-map/api.d.ts +1 -1
  214. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  215. package/es/ts-types/table-engine.d.ts +13 -1
  216. package/es/ts-types/table-engine.js.map +1 -1
  217. package/package.json +11 -7
@@ -29,9 +29,9 @@ export function computeColsWidth(table, colStart, colEnd, update) {
29
29
  let maxWidth;
30
30
  if (!table.internalProps.transpose && "only-header" === (null === (_b = null === (_a = table.internalProps.layoutMap.columnWidths) || void 0 === _a ? void 0 : _a[col]) || void 0 === _b ? void 0 : _b.columnWidthComputeMode) && "showHeader" in table.internalProps.layoutMap) {
31
31
  const temp = table.internalProps.layoutMap.showHeader;
32
- table.internalProps.layoutMap.showHeader = !0, maxWidth = computeColWidth(col, 0, table.internalProps.layoutMap.headerLevelCount, table, update),
32
+ table.internalProps.layoutMap.showHeader = !0, maxWidth = computeColWidth(col, 0, table.internalProps.layoutMap.headerLevelCount, table),
33
33
  table.internalProps.layoutMap.showHeader = temp;
34
- } else maxWidth = table.internalProps.transpose || "only-body" !== (null === (_d = null === (_c = table.internalProps.layoutMap.columnWidths) || void 0 === _c ? void 0 : _c[col]) || void 0 === _d ? void 0 : _d.columnWidthComputeMode) ? computeColWidth(col, 0, table.rowCount - 1, table, update) : computeColWidth(col, table.internalProps.layoutMap.getBodyRange().start.row, table.internalProps.layoutMap.getBodyRange().end.row, table, update);
34
+ } else maxWidth = table.internalProps.transpose || "only-body" !== (null === (_d = null === (_c = table.internalProps.layoutMap.columnWidths) || void 0 === _c ? void 0 : _c[col]) || void 0 === _d ? void 0 : _d.columnWidthComputeMode) ? computeColWidth(col, 0, table.rowCount - 1, table) : computeColWidth(col, table.internalProps.layoutMap.getBodyRange().start.row, table.internalProps.layoutMap.getBodyRange().end.row, table);
35
35
  table._setColContentWidth(col, maxWidth);
36
36
  table.getColWidth(col) !== maxWidth && table._clearColRangeWidthsMap(col), update ? newWidths[col] = maxWidth : table.setColWidth(col, maxWidth, !1, !0);
37
37
  }
@@ -69,15 +69,15 @@ export function computeColsWidth(table, colStart, colEnd, update) {
69
69
  }
70
70
  }
71
71
 
72
- export function computeColWidth(col, startRow, endRow, table, forceCompute) {
72
+ export function computeColWidth(col, startRow, endRow, table, forceCompute = !1) {
73
73
  const width = getColWidthDefinedWidthResizedWidth(col, table);
74
- return "number" == typeof width ? width : "auto" !== width && "string" == typeof width ? table._adjustColWidth(col, table._colWidthDefineToPxWidth(width)) : computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
74
+ return forceCompute && !table.internalProps.transpose ? computeAutoColWidth(width, col, startRow, endRow, forceCompute, table) : "number" == typeof width ? width : "auto" !== width && "string" == typeof width ? table._adjustColWidth(col, table._colWidthDefineToPxWidth(width)) : computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
75
75
  }
76
76
 
77
77
  function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, table) {
78
78
  var _a, _b, _c, _d, _e;
79
- let maxWidth = 0, deltaRow = 1;
80
- if (endRow - startRow > 5e3 && (deltaRow = Math.ceil((endRow - startRow) / 5e3)),
79
+ let maxWidth = 0, deltaRow = 1, prepareDeltaRow = 1;
80
+ if (endRow - startRow > 5e3 && (prepareDeltaRow = Math.ceil((endRow - startRow) / 5e3)),
81
81
  table.isPivotChart() && col >= table.rowHeaderLevelCount && col < table.colCount - table.rightFrozenColCount) {
82
82
  if (table.internalProps.layoutMap.indicatorsAsCol) return table.defaultColWidth;
83
83
  {
@@ -102,7 +102,7 @@ function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, t
102
102
  continue;
103
103
  }
104
104
  const indicatorWidth = widthDeifne;
105
- if ("number" == typeof indicatorWidth && "standard" === table.widthMode) {
105
+ if ("number" == typeof indicatorWidth && "standard" === table.widthMode && !forceCompute) {
106
106
  maxWidth = Math.max(indicatorWidth, maxWidth);
107
107
  continue;
108
108
  }
@@ -118,6 +118,7 @@ function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, t
118
118
  if ("only-body" === (null === (_b = null == hd ? void 0 : hd.define) || void 0 === _b ? void 0 : _b.columnWidthComputeMode)) continue;
119
119
  (null == hd ? void 0 : hd.hierarchyLevel) && (cellHierarchyIndent = (null !== (_c = hd.hierarchyLevel) && void 0 !== _c ? _c : 0) * (null !== (_d = layoutMap.rowHierarchyIndent) && void 0 !== _d ? _d : 0));
120
120
  } else {
121
+ deltaRow = prepareDeltaRow;
121
122
  const define = table.getBodyColumnDefine(col, row);
122
123
  if (null == define ? void 0 : define.tree) {
123
124
  const indexArr = table.dataSource.getIndexKey(table.getRecordIndexByCell(col, row));
@@ -125,7 +126,8 @@ function computeAutoColWidth(widthDeifne, col, startRow, endRow, forceCompute, t
125
126
  }
126
127
  }
127
128
  const textWidth = computeTextWidth(col, row, cellType, table);
128
- maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth);
129
+ maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth), deltaRow > 1 && table.bottomFrozenRowCount > 0 && row < table.rowCount - table.bottomFrozenRowCount && row + deltaRow >= table.rowCount - table.bottomFrozenRowCount && (row = table.rowCount - table.bottomFrozenRowCount - deltaRow,
130
+ deltaRow = 1, prepareDeltaRow = 1);
129
131
  }
130
132
  const colMinWidth = table.getMinColWidth(col), colMaxWidth = table.getMaxColWidth(col);
131
133
  return maxWidth < colMinWidth ? colMinWidth : maxWidth > colMaxWidth ? colMaxWidth : maxWidth;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scenegraph/layout/compute-col-width.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,UAAU,gBAAgB,CAAC,KAAmB,EAAE,QAAiB,EAAE,MAAe,EAAE,MAAgB;;IACxG,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,QAAQ,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CAAC,CAAC;IACzB,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC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AAG,OAAO,CAAC,yBAAyB,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9F,QAAQ,IAAI,uBAAuB,CAAC;SACrC;KACF;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,KAAmB;IAChE,OAAO;QACL,IAAI,EAAE,CAAC;QACP,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC;QAC7B,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;QAC/B,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;KACV,CAAC;AACJ,CAAC;AAED,SAAS,mCAAmC,CAAC,GAAW,EAAE,KAAmB;IAC3E,MAAM,YAAY,GAAG,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACnD,IAAI,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACpD,OAAO,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;KAC/B;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","file":"compute-col-width.js","sourcesContent":["import type { SimpleHeaderLayoutMap } from '../../layout';\nimport type { ColumnTypeOption, TextColumnDefine } from '../../ts-types';\nimport { HierarchyState, IconPosition } from '../../ts-types';\nimport * as calc from '../../tools/calc';\nimport { validToString } from '../../tools/util';\nimport { getQuadProps } from '../utils/padding';\nimport { getProp } from '../utils/get-prop';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { getAxisConfigInPivotChart } from '../../layout/chart-helper/get-axis-config';\nimport { computeAxisComponentWidth } from '../../components/axis/get-axis-component-size';\nimport { Group as VGroup } from '@visactor/vrender';\nimport { isObject } from '@visactor/vutils';\nimport { decodeReactDom, dealPercentCalc } from '../component/custom';\n\nexport function computeColsWidth(table: BaseTableAPI, colStart?: number, colEnd?: number, update?: boolean): void {\n const time = typeof window !== 'undefined' ? window.performance.now() : 0;\n colStart = colStart ?? 0;\n colEnd = colEnd ?? table.colCount - 1;\n // table._clearColRangeWidthsMap();\n // clear colRangeWidthsMap\n if (colStart === 0 && colEnd === table.colCount - 1) {\n table._clearColRangeWidthsMap();\n // } else {\n // for (let col = colStart; col <= colEnd; col++) {\n // table._clearColRangeWidthsMap(col);\n // }\n }\n\n const oldColWidths: number[] = [];\n const newWidths: number[] = [];\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n oldColWidths[col] = table.getColWidth(col);\n }\n }\n for (let col = colStart; col <= colEnd; col++) {\n let maxWidth;\n if (\n !table.internalProps.transpose &&\n table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-header' &&\n 'showHeader' in table.internalProps.layoutMap\n ) {\n const temp = table.internalProps.layoutMap.showHeader;\n table.internalProps.layoutMap.showHeader = true;\n maxWidth = computeColWidth(col, 0, table.internalProps.layoutMap.headerLevelCount, table, update);\n table.internalProps.layoutMap.showHeader = temp;\n } else if (\n !table.internalProps.transpose &&\n table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-body'\n ) {\n maxWidth = computeColWidth(\n col,\n table.internalProps.layoutMap.getBodyRange().start.row,\n table.internalProps.layoutMap.getBodyRange().end.row,\n table,\n update\n );\n } else {\n maxWidth = computeColWidth(col, 0, table.rowCount - 1, table, update);\n }\n\n table._setColContentWidth(col, maxWidth);\n\n const oldWidth = table.getColWidth(col);\n if (oldWidth !== maxWidth) {\n table._clearColRangeWidthsMap(col);\n }\n if (update) {\n newWidths[col] = maxWidth;\n } else {\n table.setColWidth(col, maxWidth, false, true);\n }\n }\n\n // 处理adaptive宽度\n if (table.widthMode === 'adaptive') {\n table._clearColRangeWidthsMap();\n // const canvasWidth = table.internalProps.canvas.width;\n const rowHeaderWidth = table.getColsWidth(0, table.rowHeaderLevelCount - 1);\n const rightHeaderWidth = table.isPivotChart() ? table.getRightFrozenColsWidth() : 0;\n const totalDrawWidth = table.tableNoFrameWidth - rowHeaderWidth - rightHeaderWidth;\n const startCol = table.rowHeaderLevelCount;\n const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;\n let actualWidth = 0;\n for (let col = startCol; col < endCol; col++) {\n actualWidth += update ? newWidths[col] : table.getColWidth(col);\n }\n const factor = totalDrawWidth / actualWidth;\n for (let col = startCol; col < endCol; col++) {\n let colWidth;\n if (col === endCol - 1) {\n colWidth =\n totalDrawWidth -\n (update\n ? newWidths.reduce((acr, cur, index) => {\n if (index >= startCol && index <= endCol - 2) {\n return acr + cur;\n }\n return acr;\n }, 0)\n : table.getColsWidth(startCol, endCol - 2));\n } else {\n colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor);\n }\n if (update) {\n newWidths[col] = colWidth;\n } else {\n table.setColWidth(col, colWidth, false, true);\n }\n }\n } else if (table.autoFillWidth) {\n // 处理风神列宽特殊逻辑\n table._clearColRangeWidthsMap();\n const canvasWidth = table.tableNoFrameWidth;\n let actualWidth = 0;\n let actualHeaderWidth = 0;\n for (let col = 0; col < table.colCount; col++) {\n const colWidth = update ? newWidths[col] : table.getColWidth(col);\n if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) {\n actualHeaderWidth += colWidth;\n }\n\n actualWidth += colWidth;\n }\n\n // 如果内容宽度小于canvas宽度,执行adaptive放大\n if (actualWidth < canvasWidth && actualWidth - actualHeaderWidth > 0) {\n const factor = (canvasWidth - actualHeaderWidth) / (actualWidth - actualHeaderWidth);\n for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {\n if (update) {\n newWidths[col] = newWidths[col] * factor;\n } else {\n table.setColWidth(col, table.getColWidth(col) * factor, false, true);\n }\n }\n }\n }\n // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time);\n\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n // newColWidth could not be in column min max range possibly\n // const newColWidth = table._adjustColWidth(col, newWidths[col]) ?? table.getColWidth(col);\n const newColWidth = newWidths[col] ?? table.getColWidth(col);\n if (newColWidth !== oldColWidths[col]) {\n // update the column width in scenegraph\n table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true);\n }\n }\n table.scenegraph.updateContainer();\n }\n // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time, colStart, colEnd);\n}\n\n/**\n * @description: 计算列宽\n * @param {number} col\n * @param {number} startRow\n * @param {number} endRow\n * @param {BaseTableAPI} table\n * @param {boolean} forceCompute\n * @return {*}\n */\nexport function computeColWidth(\n col: number,\n startRow: number,\n endRow: number,\n table: BaseTableAPI,\n forceCompute: boolean\n): number {\n // const { layoutMap, transpose } = table.internalProps;\n // let { width } = layoutMap?.getColumnWidthDefined(col) ?? {};\n\n // if (transpose) {\n // // 转置模式\n // if (table.widthMode === 'standard') {\n // // return table.getColWidth(col);\n // // standard模式使用默认值\n // if (table.isRowHeader(col, 0) || table.isCornerHeader(col, 0)) {\n // const defaultWidth = Array.isArray(table.defaultHeaderColWidth)\n // ? table.defaultHeaderColWidth[col] ?? table.defaultColWidth\n // : table.defaultHeaderColWidth;\n // if (defaultWidth === 'auto') {\n // widthfffff = 'auto';\n // } else {\n // return defaultWidth;\n // }\n // }\n\n // if (widthfffff !== 'auto') {\n // // if (width && (typeof width === 'string' || width > 0)) return width;\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // return table.defaultColWidth;\n // }\n // } else if (\n // table.widthMode === 'adaptive' &&\n // col === 0 &&\n // widthfffff !== 'auto' &&\n // (layoutMap as SimpleHeaderLayoutMap)?.showHeader\n // ) {\n // // ToBeFixed hack逻辑,转置第一列列宽为header[0]\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // }\n // // autoWidth adaptive 需要计算内容宽度\n // // do nothing\n // } else if (widthfffff !== 'auto' && table.widthMode !== 'autoWidth' && !forceCompute) {\n // // if (width && (typeof width === 'string' || width > 0)) return width;\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // //是透视表的行表头部分 则宽度按defaultHeaderColWidth设置\n // const defaultWidth = table.getColWidthDefine(col);\n // if (defaultWidth !== 'auto') {\n // return table.getColWidth(col);\n // }\n // }\n const width = getColWidthDefinedWidthResizedWidth(col, table);\n if (typeof width === 'number') {\n return width;\n } else if (width !== 'auto' && typeof width === 'string') {\n // return calc.toPx(width, table.internalProps.calcWidthContext);\n return table._adjustColWidth(col, table._colWidthDefineToPxWidth(width));\n }\n return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);\n}\n\n/**\n * @description: 计算width: auto情况下的列宽\n * @param {number} col\n * @param {number} startRow\n * @param {number} endRow\n * @param {boolean} forceCompute\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeAutoColWidth(\n widthDeifne: string | number,\n col: number,\n startRow: number,\n endRow: number,\n forceCompute: boolean,\n table: BaseTableAPI\n): number {\n // 处理 auto width\n let maxWidth = 0;\n let deltaRow = 1;\n if (endRow - startRow > 5000) {\n // 超过5000行启动列宽自动计算采样\n deltaRow = Math.ceil((endRow - startRow) / 5000);\n }\n // 如果是透视图\n if (table.isPivotChart() && col >= table.rowHeaderLevelCount && col < table.colCount - table.rightFrozenColCount) {\n if (!(table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol) {\n //并且指标是以行展示 计算列宽需要根据x轴的值域范围\n const optimunWidth = (table.internalProps.layoutMap as PivotHeaderLayoutMap).getOptimunWidthForChart(col);\n if (optimunWidth > 0) {\n return optimunWidth;\n }\n } else {\n //直接拿表头的默认列宽\n return table.defaultColWidth;\n }\n }\n\n for (let row = startRow; row <= endRow; row += deltaRow) {\n // 判断透视图轴组件\n if (table.isPivotChart()) {\n const layout = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n const axisConfig = getAxisConfigInPivotChart(col, row, layout);\n if (axisConfig) {\n const axisWidth = computeAxisComponentWidth(axisConfig, table);\n if (typeof axisWidth === 'number') {\n maxWidth = Math.max(axisWidth, maxWidth);\n continue;\n }\n } else if (\n layout.isLeftBottomCorner(col, row) ||\n layout.isRightTopCorner(col, row) ||\n layout.isRightBottomCorner(col, row)\n ) {\n // 透视图三角为无效单元格,不参与宽度计算\n continue;\n }\n }\n\n // 判断CustomRender\n const customWidth = computeCustomRenderWidth(col, row, table);\n if (typeof customWidth === 'number') {\n maxWidth = Math.max(customWidth, maxWidth);\n continue;\n }\n\n // 判断透视表如果在指标\n // const indicatorWidth = computeIndicatorWidth(col, row, forceCompute, table);\n // const indicatorWidth = table.internalProps.layoutMap.getColumnWidthDefined(col);\n const indicatorWidth = widthDeifne;\n if (typeof indicatorWidth === 'number' && table.widthMode === 'standard') {\n maxWidth = Math.max(indicatorWidth, maxWidth);\n continue;\n }\n\n const cellType = table.isHeader(col, row)\n ? table._getHeaderLayoutMap(col, row)?.headerType\n : table.getBodyColumnType(col, row);\n if (cellType !== 'text' && cellType !== 'link' && cellType !== 'progressbar' && cellType !== 'checkbox') {\n // text&link&progressbar测量文字宽度\n // image&video&sparkline使用默认宽度\n maxWidth = Math.max(maxWidth, table.getColWidthDefinedNumber(col) || 0);\n continue;\n }\n\n // 处理树形展开\n let cellHierarchyIndent = 0;\n const layoutMap = table.internalProps.layoutMap;\n //判断是否为表头\n if (layoutMap.isHeader(col, row)) {\n const hd = layoutMap.getHeader(col, row);\n // 如果某级表头设置了only-body,在计算表头内容宽度时跳过改级表头\n if (hd?.define?.columnWidthComputeMode === 'only-body') {\n continue;\n }\n if (hd?.hierarchyLevel) {\n cellHierarchyIndent = (hd.hierarchyLevel ?? 0) * ((layoutMap as PivotHeaderLayoutMap).rowHierarchyIndent ?? 0);\n }\n } else {\n // 基本表格表身body单元格 如果是树形展开 需要考虑缩进值\n // const cellHierarchyState = table.getHierarchyState(col, row);\n // if (cellHierarchyState === HierarchyState.expand || cellHierarchyState === HierarchyState.collapse) {\n const define = table.getBodyColumnDefine(col, row);\n if (define?.tree) {\n const indexArr = table.dataSource.getIndexKey(table.getRecordIndexByCell(col, row));\n cellHierarchyIndent =\n Array.isArray(indexArr) && table.getHierarchyState(col, row) !== HierarchyState.none\n ? (indexArr.length - 1) * ((layoutMap as SimpleHeaderLayoutMap).hierarchyIndent ?? 0)\n : 0;\n }\n }\n\n // 测量文字宽度\n const textWidth = computeTextWidth(col, row, cellType, table);\n maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth);\n }\n\n // 处理宽度限制\n const colMinWidth = table.getMinColWidth(col);\n const colMaxWidth = table.getMaxColWidth(col);\n if (maxWidth < colMinWidth) {\n return colMinWidth;\n } else if (maxWidth > colMaxWidth) {\n return colMaxWidth;\n }\n return maxWidth;\n}\n\n/**\n * @description: 计算customRender相关列宽\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeCustomRenderWidth(col: number, row: number, table: BaseTableAPI): number | undefined {\n const customRender = table.getCustomRender(col, row);\n const customLayout = table.getCustomLayout(col, row);\n if (customRender || customLayout) {\n let spanCol = 1;\n let width = 0;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanCol = cellRange.end.col - cellRange.start.col + 1;\n }\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: getCellRect(col, row, table),\n table\n };\n if (customLayout) {\n // 处理customLayout\n const customLayoutObj = customLayout(arg);\n if (customLayoutObj.rootContainer instanceof VGroup) {\n customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);\n dealPercentCalc(customLayoutObj.rootContainer, 0, table.getRowHeight(row));\n customLayoutObj.rootContainer.setStage(table.scenegraph.stage);\n width = (customLayoutObj.rootContainer as VGroup).AABBBounds.width() ?? 0;\n // width = (customLayoutObj.rootContainer as VGroup).attribute.width ?? 0;\n // } else if (customLayoutObj.rootContainer) {\n // customLayoutObj.rootContainer.isRoot = true;\n // const size = customLayoutObj.rootContainer.getContentSize();\n // width = size.width ?? 0;\n } else {\n width = 0;\n }\n } else if (typeof customRender === 'function') {\n // 处理customRender\n const customRenderObj = customRender(arg);\n width = customRenderObj?.expectedWidth ?? 0;\n } else {\n width = customRender?.expectedWidth ?? 0;\n }\n return width / spanCol;\n }\n return undefined;\n}\n\n/**\n * @description: 计算指标相关列宽\n * @param {number} col\n * @param {number} row\n * @param {boolean} forceCompute\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeIndicatorWidth(\n col: number,\n row: number,\n forceCompute: boolean,\n table: BaseTableAPI\n): number | undefined {\n const { layoutMap } = table.internalProps;\n if (table.isPivotTable() && (layoutMap as PivotHeaderLayoutMap).isColumnIndicatorHeader(col, row)) {\n // 透视表如果在指标中配置了宽度,使用该宽度作为指标单元格及下面内容单元格的列宽\n const body = layoutMap.getBody(col, row);\n if (body && body.width && body.width !== 'auto' && !forceCompute) {\n const width = Math.round(calc.toPx(body.width, table.internalProps.calcWidthContext));\n return width;\n }\n }\n return undefined;\n}\n\n/**\n * @description: 计算文字宽度\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeTextWidth(col: number, row: number, cellType: ColumnTypeOption, table: BaseTableAPI): number {\n let maxWidth = 0;\n const cellValue = table.getCellValue(col, row);\n // const dataValue = table.getCellOriginValue(col, row);\n const actStyle = table._getCellStyle(col, row);\n let iconWidth = 0;\n const define = table.getBodyColumnDefine(col, row);\n const mayHaveIcon = table.getCellLocation(col, row) !== 'body' ? true : !!define?.icon || !!define?.tree;\n if (mayHaveIcon) {\n const icons = table.getCellIcons(col, row);\n icons?.forEach(icon => {\n if (icon.positionType !== IconPosition.absoluteRight) {\n iconWidth += (icon.width ?? 0) + (icon.marginLeft ?? 0) + (icon.marginRight ?? 0);\n }\n });\n }\n let spanCol = 1;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanCol = cellRange.end.col - cellRange.start.col + 1;\n }\n\n const padding = getQuadProps(getProp('padding', actStyle, col, row, table));\n const paddingWidth = padding[1] + padding[3]; // + cellHierarchyIndent\n\n const fontSize = getProp('fontSize', actStyle, col, row, table);\n const fontFamily = getProp('fontFamily', actStyle, col, row, table);\n const fontWeight = getProp('fontWeight', actStyle, col, row, table);\n let text;\n if (cellType === 'checkbox') {\n text = isObject(cellValue) ? (cellValue as any).text : cellValue;\n } else {\n text = cellValue;\n }\n const lines = validToString(text).split('\\n') || [];\n if (lines.length >= 1) {\n // eslint-disable-next-line no-loop-func\n lines.forEach((line: string) => {\n const width = table.measureText(line.slice(0, table.options.maxCharactersNumber || 200), {\n fontSize,\n fontFamily,\n fontWeight\n }).width;\n maxWidth = Math.max(\n // 最大字符上限控制测量的字符\n (width + paddingWidth + 4 + iconWidth) / spanCol, // 这里+4为列宽测量结果的buffer\n maxWidth\n );\n });\n } else {\n maxWidth = Math.max(\n // 最大字符上限控制测量的字符\n (paddingWidth + 4 + iconWidth) / spanCol,\n maxWidth\n );\n }\n // 判断是否需要限制最大宽度 之前写死的450 需要使用配置来判断\n if (table.internalProps.limitMaxAutoWidth !== false) {\n maxWidth = Math.min(\n typeof table.internalProps.limitMaxAutoWidth === 'number' ? table.internalProps.limitMaxAutoWidth : 450,\n maxWidth\n );\n }\n\n if (cellType === 'checkbox') {\n const size = getProp('size', actStyle, col, row, table);\n maxWidth += size;\n\n if (text) {\n const spaceBetweenTextAndIcon = getProp('spaceBetweenTextAndIcon', actStyle, col, row, table);\n maxWidth += spaceBetweenTextAndIcon;\n }\n }\n\n return maxWidth;\n}\n\nfunction getCellRect(col: number, row: number, table: BaseTableAPI) {\n return {\n left: 0,\n top: 0,\n right: table.getColWidth(col),\n bottom: table.getRowHeight(row),\n width: 0,\n height: 0\n };\n}\n\nfunction getColWidthDefinedWidthResizedWidth(col: number, table: BaseTableAPI) {\n const widthDefined = table.getColWidthDefined(col);\n if (table.internalProps._widthResizedColMap.has(col)) {\n return table.getColWidth(col);\n }\n return widthDefined;\n}\n"]}
1
+ {"version":3,"sources":["../src/scenegraph/layout/compute-col-width.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,UAAU,gBAAgB,CAAC,KAAmB,EAAE,QAAiB,EAAE,MAAe,EAAE,MAAgB;;IACxG,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,QAAQ,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CAAC,CAAC;IACzB,MAAM,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;IA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AC,GAAG,CAAC,EAAE;QACpD,OAAO,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;KAC/B;IACD,OAAO,YAAY,CAAC;AACtB,CAAC","file":"compute-col-width.js","sourcesContent":["import type { SimpleHeaderLayoutMap } from '../../layout';\nimport type { ColumnTypeOption, TextColumnDefine } from '../../ts-types';\nimport { HierarchyState, IconPosition } from '../../ts-types';\nimport * as calc from '../../tools/calc';\nimport { validToString } from '../../tools/util';\nimport { getQuadProps } from '../utils/padding';\nimport { getProp } from '../utils/get-prop';\nimport type { BaseTableAPI } from '../../ts-types/base-table';\nimport type { PivotHeaderLayoutMap } from '../../layout/pivot-header-layout';\nimport { getAxisConfigInPivotChart } from '../../layout/chart-helper/get-axis-config';\nimport { computeAxisComponentWidth } from '../../components/axis/get-axis-component-size';\nimport { Group as VGroup } from '@visactor/vrender';\nimport { isObject } from '@visactor/vutils';\nimport { decodeReactDom, dealPercentCalc } from '../component/custom';\n\nexport function computeColsWidth(table: BaseTableAPI, colStart?: number, colEnd?: number, update?: boolean): void {\n const time = typeof window !== 'undefined' ? window.performance.now() : 0;\n colStart = colStart ?? 0;\n colEnd = colEnd ?? table.colCount - 1;\n // table._clearColRangeWidthsMap();\n // clear colRangeWidthsMap\n if (colStart === 0 && colEnd === table.colCount - 1) {\n table._clearColRangeWidthsMap();\n // } else {\n // for (let col = colStart; col <= colEnd; col++) {\n // table._clearColRangeWidthsMap(col);\n // }\n }\n\n const oldColWidths: number[] = [];\n const newWidths: number[] = [];\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n oldColWidths[col] = table.getColWidth(col);\n }\n }\n for (let col = colStart; col <= colEnd; col++) {\n let maxWidth;\n if (\n !table.internalProps.transpose &&\n table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-header' &&\n 'showHeader' in table.internalProps.layoutMap\n ) {\n const temp = table.internalProps.layoutMap.showHeader;\n table.internalProps.layoutMap.showHeader = true;\n maxWidth = computeColWidth(col, 0, table.internalProps.layoutMap.headerLevelCount, table);\n table.internalProps.layoutMap.showHeader = temp;\n } else if (\n !table.internalProps.transpose &&\n table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-body'\n ) {\n maxWidth = computeColWidth(\n col,\n table.internalProps.layoutMap.getBodyRange().start.row,\n table.internalProps.layoutMap.getBodyRange().end.row,\n table\n );\n } else {\n maxWidth = computeColWidth(col, 0, table.rowCount - 1, table);\n }\n\n table._setColContentWidth(col, maxWidth);\n\n const oldWidth = table.getColWidth(col);\n if (oldWidth !== maxWidth) {\n table._clearColRangeWidthsMap(col);\n }\n if (update) {\n newWidths[col] = maxWidth;\n } else {\n table.setColWidth(col, maxWidth, false, true);\n }\n }\n\n // 处理adaptive宽度\n if (table.widthMode === 'adaptive') {\n table._clearColRangeWidthsMap();\n // const canvasWidth = table.internalProps.canvas.width;\n const rowHeaderWidth = table.getColsWidth(0, table.rowHeaderLevelCount - 1);\n const rightHeaderWidth = table.isPivotChart() ? table.getRightFrozenColsWidth() : 0;\n const totalDrawWidth = table.tableNoFrameWidth - rowHeaderWidth - rightHeaderWidth;\n const startCol = table.rowHeaderLevelCount;\n const endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount;\n let actualWidth = 0;\n for (let col = startCol; col < endCol; col++) {\n actualWidth += update ? newWidths[col] : table.getColWidth(col);\n }\n const factor = totalDrawWidth / actualWidth;\n for (let col = startCol; col < endCol; col++) {\n let colWidth;\n if (col === endCol - 1) {\n colWidth =\n totalDrawWidth -\n (update\n ? newWidths.reduce((acr, cur, index) => {\n if (index >= startCol && index <= endCol - 2) {\n return acr + cur;\n }\n return acr;\n }, 0)\n : table.getColsWidth(startCol, endCol - 2));\n } else {\n colWidth = Math.round((update ? newWidths[col] : table.getColWidth(col)) * factor);\n }\n if (update) {\n newWidths[col] = colWidth;\n } else {\n table.setColWidth(col, colWidth, false, true);\n }\n }\n } else if (table.autoFillWidth) {\n // 处理风神列宽特殊逻辑\n table._clearColRangeWidthsMap();\n const canvasWidth = table.tableNoFrameWidth;\n let actualWidth = 0;\n let actualHeaderWidth = 0;\n for (let col = 0; col < table.colCount; col++) {\n const colWidth = update ? newWidths[col] : table.getColWidth(col);\n if (col < table.frozenColCount || col >= table.colCount - table.rightFrozenColCount) {\n actualHeaderWidth += colWidth;\n }\n\n actualWidth += colWidth;\n }\n\n // 如果内容宽度小于canvas宽度,执行adaptive放大\n if (actualWidth < canvasWidth && actualWidth - actualHeaderWidth > 0) {\n const factor = (canvasWidth - actualHeaderWidth) / (actualWidth - actualHeaderWidth);\n for (let col = table.frozenColCount; col < table.colCount - table.rightFrozenColCount; col++) {\n if (update) {\n newWidths[col] = newWidths[col] * factor;\n } else {\n table.setColWidth(col, table.getColWidth(col) * factor, false, true);\n }\n }\n }\n }\n // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time);\n\n if (update) {\n for (let col = 0; col < table.colCount; col++) {\n // newColWidth could not be in column min max range possibly\n // const newColWidth = table._adjustColWidth(col, newWidths[col]) ?? table.getColWidth(col);\n const newColWidth = newWidths[col] ?? table.getColWidth(col);\n if (newColWidth !== oldColWidths[col]) {\n // update the column width in scenegraph\n table.scenegraph.updateColWidth(col, newColWidth - oldColWidths[col], true);\n }\n }\n table.scenegraph.updateContainer();\n }\n // console.log('computeColsWidth time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time, colStart, colEnd);\n}\n\n/**\n * @description: 计算列宽\n * @param {number} col\n * @param {number} startRow\n * @param {number} endRow\n * @param {BaseTableAPI} table\n * @param {boolean} forceCompute\n * @return {*}\n */\nexport function computeColWidth(\n col: number,\n startRow: number,\n endRow: number,\n table: BaseTableAPI,\n forceCompute: boolean = false //forceCompute如果设置为true 即便不是自动列宽的列也会按内容计算列宽\n): number {\n // const { layoutMap, transpose } = table.internalProps;\n // let { width } = layoutMap?.getColumnWidthDefined(col) ?? {};\n\n // if (transpose) {\n // // 转置模式\n // if (table.widthMode === 'standard') {\n // // return table.getColWidth(col);\n // // standard模式使用默认值\n // if (table.isRowHeader(col, 0) || table.isCornerHeader(col, 0)) {\n // const defaultWidth = Array.isArray(table.defaultHeaderColWidth)\n // ? table.defaultHeaderColWidth[col] ?? table.defaultColWidth\n // : table.defaultHeaderColWidth;\n // if (defaultWidth === 'auto') {\n // widthfffff = 'auto';\n // } else {\n // return defaultWidth;\n // }\n // }\n\n // if (widthfffff !== 'auto') {\n // // if (width && (typeof width === 'string' || width > 0)) return width;\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // return table.defaultColWidth;\n // }\n // } else if (\n // table.widthMode === 'adaptive' &&\n // col === 0 &&\n // widthfffff !== 'auto' &&\n // (layoutMap as SimpleHeaderLayoutMap)?.showHeader\n // ) {\n // // ToBeFixed hack逻辑,转置第一列列宽为header[0]\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // }\n // // autoWidth adaptive 需要计算内容宽度\n // // do nothing\n // } else if (widthfffff !== 'auto' && table.widthMode !== 'autoWidth' && !forceCompute) {\n // // if (width && (typeof width === 'string' || width > 0)) return width;\n // if (typeof widthfffff === 'string') {\n // return calc.toPx(widthfffff, table.internalProps.calcWidthContext);\n // } else if (widthfffff) {\n // return widthfffff;\n // }\n // //是透视表的行表头部分 则宽度按defaultHeaderColWidth设置\n // const defaultWidth = table.getColWidthDefine(col);\n // if (defaultWidth !== 'auto') {\n // return table.getColWidth(col);\n // }\n // }\n const width = getColWidthDefinedWidthResizedWidth(col, table);\n if (forceCompute && !table.internalProps.transpose) {\n return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);\n } else if (typeof width === 'number') {\n return width;\n } else if (width !== 'auto' && typeof width === 'string') {\n // return calc.toPx(width, table.internalProps.calcWidthContext);\n return table._adjustColWidth(col, table._colWidthDefineToPxWidth(width));\n }\n return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);\n}\n\n/**\n * @description: 计算width: auto情况下的列宽\n * @param {number} col\n * @param {number} startRow\n * @param {number} endRow\n * @param {boolean} forceCompute\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeAutoColWidth(\n widthDeifne: string | number,\n col: number,\n startRow: number,\n endRow: number,\n forceCompute: boolean,\n table: BaseTableAPI\n): number {\n // 处理 auto width\n let maxWidth = 0;\n let deltaRow = 1;\n let prepareDeltaRow = 1; // 当计算完表头单元格的宽度后再采用采用逻辑,prepareDeltaRow这个值为期body部分做准备\n if (endRow - startRow > 5000) {\n // 超过5000行启动列宽自动计算采样\n prepareDeltaRow = Math.ceil((endRow - startRow) / 5000);\n }\n // 如果是透视图\n if (table.isPivotChart() && col >= table.rowHeaderLevelCount && col < table.colCount - table.rightFrozenColCount) {\n if (!(table.internalProps.layoutMap as PivotHeaderLayoutMap).indicatorsAsCol) {\n //并且指标是以行展示 计算列宽需要根据x轴的值域范围\n const optimunWidth = (table.internalProps.layoutMap as PivotHeaderLayoutMap).getOptimunWidthForChart(col);\n if (optimunWidth > 0) {\n return optimunWidth;\n }\n } else {\n //直接拿表头的默认列宽\n return table.defaultColWidth;\n }\n }\n\n for (let row = startRow; row <= endRow; row += deltaRow) {\n // 判断透视图轴组件\n if (table.isPivotChart()) {\n const layout = table.internalProps.layoutMap as PivotHeaderLayoutMap;\n const axisConfig = getAxisConfigInPivotChart(col, row, layout);\n if (axisConfig) {\n const axisWidth = computeAxisComponentWidth(axisConfig, table);\n if (typeof axisWidth === 'number') {\n maxWidth = Math.max(axisWidth, maxWidth);\n continue;\n }\n } else if (\n layout.isLeftBottomCorner(col, row) ||\n layout.isRightTopCorner(col, row) ||\n layout.isRightBottomCorner(col, row)\n ) {\n // 透视图三角为无效单元格,不参与宽度计算\n continue;\n }\n }\n\n // 判断CustomRender\n const customWidth = computeCustomRenderWidth(col, row, table);\n if (typeof customWidth === 'number') {\n maxWidth = Math.max(customWidth, maxWidth);\n continue;\n }\n\n // 判断透视表如果在指标\n // const indicatorWidth = computeIndicatorWidth(col, row, forceCompute, table);\n // const indicatorWidth = table.internalProps.layoutMap.getColumnWidthDefined(col);\n const indicatorWidth = widthDeifne;\n if (typeof indicatorWidth === 'number' && table.widthMode === 'standard' && !forceCompute) {\n maxWidth = Math.max(indicatorWidth, maxWidth);\n continue;\n }\n\n const cellType = table.isHeader(col, row)\n ? table._getHeaderLayoutMap(col, row)?.headerType\n : table.getBodyColumnType(col, row);\n if (cellType !== 'text' && cellType !== 'link' && cellType !== 'progressbar' && cellType !== 'checkbox') {\n // text&link&progressbar测量文字宽度\n // image&video&sparkline使用默认宽度\n maxWidth = Math.max(maxWidth, table.getColWidthDefinedNumber(col) || 0);\n continue;\n }\n\n // 处理树形展开\n let cellHierarchyIndent = 0;\n const layoutMap = table.internalProps.layoutMap;\n //判断是否为表头\n if (layoutMap.isHeader(col, row)) {\n const hd = layoutMap.getHeader(col, row);\n // 如果某级表头设置了only-body,在计算表头内容宽度时跳过改级表头\n if (hd?.define?.columnWidthComputeMode === 'only-body') {\n continue;\n }\n if (hd?.hierarchyLevel) {\n cellHierarchyIndent = (hd.hierarchyLevel ?? 0) * ((layoutMap as PivotHeaderLayoutMap).rowHierarchyIndent ?? 0);\n }\n } else {\n deltaRow = prepareDeltaRow;\n // 基本表格表身body单元格 如果是树形展开 需要考虑缩进值\n // const cellHierarchyState = table.getHierarchyState(col, row);\n // if (cellHierarchyState === HierarchyState.expand || cellHierarchyState === HierarchyState.collapse) {\n const define = table.getBodyColumnDefine(col, row);\n if (define?.tree) {\n const indexArr = table.dataSource.getIndexKey(table.getRecordIndexByCell(col, row));\n cellHierarchyIndent =\n Array.isArray(indexArr) && table.getHierarchyState(col, row) !== HierarchyState.none\n ? (indexArr.length - 1) * ((layoutMap as SimpleHeaderLayoutMap).hierarchyIndent ?? 0)\n : 0;\n }\n }\n\n // 测量文字宽度\n const textWidth = computeTextWidth(col, row, cellType, table);\n maxWidth = Math.max(textWidth + cellHierarchyIndent, maxWidth);\n //在前面设置了采用规则的情况下,为了确保底部冻结的每一行都测到\n if (\n deltaRow > 1 &&\n table.bottomFrozenRowCount > 0 &&\n row < table.rowCount - table.bottomFrozenRowCount &&\n row + deltaRow >= table.rowCount - table.bottomFrozenRowCount\n ) {\n row = table.rowCount - table.bottomFrozenRowCount - deltaRow;\n deltaRow = 1;\n prepareDeltaRow = 1;\n }\n }\n\n // 处理宽度限制\n const colMinWidth = table.getMinColWidth(col);\n const colMaxWidth = table.getMaxColWidth(col);\n if (maxWidth < colMinWidth) {\n return colMinWidth;\n } else if (maxWidth > colMaxWidth) {\n return colMaxWidth;\n }\n return maxWidth;\n}\n\n/**\n * @description: 计算customRender相关列宽\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeCustomRenderWidth(col: number, row: number, table: BaseTableAPI): number | undefined {\n const customRender = table.getCustomRender(col, row);\n const customLayout = table.getCustomLayout(col, row);\n if (customRender || customLayout) {\n let spanCol = 1;\n let width = 0;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanCol = cellRange.end.col - cellRange.start.col + 1;\n }\n const arg = {\n col,\n row,\n dataValue: table.getCellOriginValue(col, row),\n value: table.getCellValue(col, row) || '',\n rect: getCellRect(col, row, table),\n table\n };\n if (customLayout) {\n // 处理customLayout\n const customLayoutObj = customLayout(arg);\n if (customLayoutObj.rootContainer instanceof VGroup) {\n customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);\n dealPercentCalc(customLayoutObj.rootContainer, 0, table.getRowHeight(row));\n customLayoutObj.rootContainer.setStage(table.scenegraph.stage);\n width = (customLayoutObj.rootContainer as VGroup).AABBBounds.width() ?? 0;\n // width = (customLayoutObj.rootContainer as VGroup).attribute.width ?? 0;\n // } else if (customLayoutObj.rootContainer) {\n // customLayoutObj.rootContainer.isRoot = true;\n // const size = customLayoutObj.rootContainer.getContentSize();\n // width = size.width ?? 0;\n } else {\n width = 0;\n }\n } else if (typeof customRender === 'function') {\n // 处理customRender\n const customRenderObj = customRender(arg);\n width = customRenderObj?.expectedWidth ?? 0;\n } else {\n width = customRender?.expectedWidth ?? 0;\n }\n return width / spanCol;\n }\n return undefined;\n}\n\n/**\n * @description: 计算指标相关列宽\n * @param {number} col\n * @param {number} row\n * @param {boolean} forceCompute\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeIndicatorWidth(\n col: number,\n row: number,\n forceCompute: boolean,\n table: BaseTableAPI\n): number | undefined {\n const { layoutMap } = table.internalProps;\n if (table.isPivotTable() && (layoutMap as PivotHeaderLayoutMap).isColumnIndicatorHeader(col, row)) {\n // 透视表如果在指标中配置了宽度,使用该宽度作为指标单元格及下面内容单元格的列宽\n const body = layoutMap.getBody(col, row);\n if (body && body.width && body.width !== 'auto' && !forceCompute) {\n const width = Math.round(calc.toPx(body.width, table.internalProps.calcWidthContext));\n return width;\n }\n }\n return undefined;\n}\n\n/**\n * @description: 计算文字宽度\n * @param {number} col\n * @param {number} row\n * @param {BaseTableAPI} table\n * @return {*}\n */\nfunction computeTextWidth(col: number, row: number, cellType: ColumnTypeOption, table: BaseTableAPI): number {\n let maxWidth = 0;\n const cellValue = table.getCellValue(col, row);\n // const dataValue = table.getCellOriginValue(col, row);\n const actStyle = table._getCellStyle(col, row);\n let iconWidth = 0;\n const define = table.getBodyColumnDefine(col, row);\n const mayHaveIcon = table.getCellLocation(col, row) !== 'body' ? true : !!define?.icon || !!define?.tree;\n if (mayHaveIcon) {\n const icons = table.getCellIcons(col, row);\n icons?.forEach(icon => {\n if (icon.positionType !== IconPosition.absoluteRight) {\n iconWidth += (icon.width ?? 0) + (icon.marginLeft ?? 0) + (icon.marginRight ?? 0);\n }\n });\n }\n let spanCol = 1;\n if (table.isHeader(col, row) || (table.getBodyColumnDefine(col, row) as TextColumnDefine)?.mergeCell) {\n const cellRange = table.getCellRange(col, row);\n spanCol = cellRange.end.col - cellRange.start.col + 1;\n }\n\n const padding = getQuadProps(getProp('padding', actStyle, col, row, table));\n const paddingWidth = padding[1] + padding[3]; // + cellHierarchyIndent\n\n const fontSize = getProp('fontSize', actStyle, col, row, table);\n const fontFamily = getProp('fontFamily', actStyle, col, row, table);\n const fontWeight = getProp('fontWeight', actStyle, col, row, table);\n let text;\n if (cellType === 'checkbox') {\n text = isObject(cellValue) ? (cellValue as any).text : cellValue;\n } else {\n text = cellValue;\n }\n const lines = validToString(text).split('\\n') || [];\n if (lines.length >= 1) {\n // eslint-disable-next-line no-loop-func\n lines.forEach((line: string) => {\n const width = table.measureText(line.slice(0, table.options.maxCharactersNumber || 200), {\n fontSize,\n fontFamily,\n fontWeight\n }).width;\n maxWidth = Math.max(\n // 最大字符上限控制测量的字符\n (width + paddingWidth + 4 + iconWidth) / spanCol, // 这里+4为列宽测量结果的buffer\n maxWidth\n );\n });\n } else {\n maxWidth = Math.max(\n // 最大字符上限控制测量的字符\n (paddingWidth + 4 + iconWidth) / spanCol,\n maxWidth\n );\n }\n // 判断是否需要限制最大宽度 之前写死的450 需要使用配置来判断\n if (table.internalProps.limitMaxAutoWidth !== false) {\n maxWidth = Math.min(\n typeof table.internalProps.limitMaxAutoWidth === 'number' ? table.internalProps.limitMaxAutoWidth : 450,\n maxWidth\n );\n }\n\n if (cellType === 'checkbox') {\n const size = getProp('size', actStyle, col, row, table);\n maxWidth += size;\n\n if (text) {\n const spaceBetweenTextAndIcon = getProp('spaceBetweenTextAndIcon', actStyle, col, row, table);\n maxWidth += spaceBetweenTextAndIcon;\n }\n }\n\n return maxWidth;\n}\n\nfunction getCellRect(col: number, row: number, table: BaseTableAPI) {\n return {\n left: 0,\n top: 0,\n right: table.getColWidth(col),\n bottom: table.getRowHeight(row),\n width: 0,\n height: 0\n };\n}\n\nfunction getColWidthDefinedWidthResizedWidth(col: number, table: BaseTableAPI) {\n const widthDefined = table.getColWidthDefined(col);\n if (table.internalProps._widthResizedColMap.has(col)) {\n return table.getColWidth(col);\n }\n return widthDefined;\n}\n"]}
@@ -133,4 +133,5 @@ export declare class Scenegraph {
133
133
  updateRow(removeCells: CellAddress[], addCells: CellAddress[], updateCells?: CellAddress[]): void;
134
134
  getColumnGroupX(col: number): number;
135
135
  getCellGroupY(row: number): number;
136
+ updateCellValue(col: number, row: number, value: string | number): void;
136
137
  }
@@ -413,16 +413,16 @@ export class Scenegraph {
413
413
  visible: !0,
414
414
  y: this.tableGroup.attribute.height - this.bottomFrozenGroup.attribute.height,
415
415
  height: this.bottomFrozenGroup.attribute.height
416
- })), this.table.rightFrozenColCount > 0 && (this.rightFrozenGroup.setAttribute("x", this.tableGroup.attribute.width - this.rightFrozenGroup.attribute.width),
416
+ })), this.table.rightFrozenColCount > 0 && (this.rightFrozenGroup.setAttribute("x", this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth()),
417
417
  this.rightTopCornerGroup.setAttributes({
418
418
  visible: !0,
419
- x: this.tableGroup.attribute.width - this.rightFrozenGroup.attribute.width,
420
- width: this.rightFrozenGroup.attribute.width,
419
+ x: this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth(),
420
+ width: this.table.getRightFrozenColsWidth(),
421
421
  height: this.table.getFrozenRowsHeight()
422
422
  }), this.rightBottomCornerGroup.setAttributes({
423
423
  visible: !0,
424
- x: this.tableGroup.attribute.width - this.rightFrozenGroup.attribute.width,
425
- width: this.rightFrozenGroup.attribute.width
424
+ x: this.tableGroup.attribute.width - this.table.getRightFrozenColsWidth(),
425
+ width: this.table.getRightFrozenColsWidth()
426
426
  }));
427
427
  }
428
428
  updateRowHeight(row, detaY) {
@@ -462,9 +462,8 @@ export class Scenegraph {
462
462
  this.updateNextFrame());
463
463
  }
464
464
  setBodyAndColHeaderX(x) {
465
- this.rowHeaderGroup.attribute.width + x !== this.bodyGroup.attribute.x && (this.bodyGroup.setAttribute("x", this.rowHeaderGroup.attribute.width + x),
466
- this.colHeaderGroup.setAttribute("x", this.rowHeaderGroup.attribute.width + x),
467
- this.table.bottomFrozenRowCount > 0 && this.bottomFrozenGroup.setAttribute("x", this.rowHeaderGroup.attribute.width + x),
465
+ this.table.getFrozenColsWidth() + x !== this.bodyGroup.attribute.x && (this.bodyGroup.setAttribute("x", this.table.getFrozenColsWidth() + x),
466
+ this.colHeaderGroup.setAttribute("x", this.table.getFrozenColsWidth() + x), this.table.bottomFrozenRowCount > 0 && this.bottomFrozenGroup.setAttribute("x", this.table.getFrozenColsWidth() + x),
468
467
  this.updateNextFrame());
469
468
  }
470
469
  afterScenegraphCreated() {
@@ -583,14 +582,14 @@ export class Scenegraph {
583
582
  updateContainerChildrenX(this.rightBottomCornerGroup, 0), this.cornerHeaderGroup.setDeltaWidth(cornerX - this.cornerHeaderGroup.attribute.width),
584
583
  this.leftBottomCornerGroup.setDeltaWidth(cornerX - this.leftBottomCornerGroup.attribute.width),
585
584
  this.colHeaderGroup.setDeltaWidth(colHeaderX - this.colHeaderGroup.attribute.width),
586
- this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.rightFrozenGroup.attribute.width),
585
+ this.rightFrozenGroup.setDeltaWidth(colHeaderX - this.table.getRightFrozenColsWidth()),
587
586
  this.rowHeaderGroup.setDeltaWidth(rowHeaderX - this.rowHeaderGroup.attribute.width),
588
587
  this.bottomFrozenGroup.setDeltaWidth(rowHeaderX - this.bottomFrozenGroup.attribute.width),
589
- this.rightFrozenGroup.setDeltaWidth(rightX - this.rightFrozenGroup.attribute.width),
588
+ this.rightFrozenGroup.setDeltaWidth(rightX - this.table.getRightFrozenColsWidth()),
590
589
  this.rightTopCornerGroup.setDeltaWidth(rightX - this.rightTopCornerGroup.attribute.width),
591
590
  this.rightBottomCornerGroup.setDeltaWidth(rightX - this.rightBottomCornerGroup.attribute.width),
592
591
  this.bodyGroup.setDeltaWidth(bodyX - this.bodyGroup.attribute.width), this.colHeaderGroup.setAttribute("x", this.cornerHeaderGroup.attribute.width),
593
- this.bottomFrozenGroup.setAttribute("x", this.rowHeaderGroup.attribute.width), this.bodyGroup.setAttribute("x", this.rowHeaderGroup.attribute.width);
592
+ this.bottomFrozenGroup.setAttribute("x", this.table.getFrozenColsWidth()), this.bodyGroup.setAttribute("x", this.rowHeaderGroup.attribute.width);
594
593
  }
595
594
  updateContainer() {
596
595
  this.updateContainerAttrWidthAndX(), this.updateTableSize();
@@ -652,11 +651,12 @@ export class Scenegraph {
652
651
  this.isPivot || (this.transpose ? this.proxy.sortCellHorizontal() : this.proxy.sortCellVertical());
653
652
  }
654
653
  getCellOverflowText(col, row) {
654
+ var _a, _b;
655
655
  const text = this.getCell(col, row).getChildByName("text", !0);
656
656
  if (text) {
657
657
  const textAttributeStr = isArray(text.attribute.text) ? text.attribute.text.join("") : text.attribute.text;
658
658
  let cacheStr = "";
659
- if (isString(text.cache.clipedText) ? cacheStr = text.cache.clipedText : text.cache.layoutData.lines.forEach((line => {
659
+ if (isString(text.cache.clipedText) ? cacheStr = text.cache.clipedText : null === (_b = null === (_a = text.cache.layoutData) || void 0 === _a ? void 0 : _a.lines) || void 0 === _b || _b.forEach((line => {
660
660
  cacheStr += line.str;
661
661
  })), cacheStr !== textAttributeStr) return textAttributeStr;
662
662
  }
@@ -683,5 +683,12 @@ export class Scenegraph {
683
683
  getCellGroupY(row) {
684
684
  return row < this.table.columnHeaderLevelCount ? this.table.getRowsHeight(0, row - 1) : row < this.table.rowCount - this.table.bottomFrozenRowCount ? this.table.getRowsHeight(this.table.columnHeaderLevelCount, row - 1) : row < this.table.rowCount ? this.table.getRowsHeight(this.table.rowCount - this.table.bottomFrozenRowCount, row - 1) : 0;
685
685
  }
686
+ updateCellValue(col, row, value) {
687
+ const text = this.getCell(col, row).getChildByName("text", !0);
688
+ if (text) {
689
+ const textAttributeStr = isArray(text.attribute.text) ? [ value ] : value;
690
+ text.setAttribute("text", textAttributeStr);
691
+ }
692
+ }
686
693
  }
687
694
  //# sourceMappingURL=scenegraph.js.map