@visactor/vtable 0.22.1 → 0.22.2-alpha.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 (89) hide show
  1. package/cjs/body-helper/style/Style.d.ts +3 -0
  2. package/cjs/body-helper/style/Style.js +22 -15
  3. package/cjs/body-helper/style/Style.js.map +1 -1
  4. package/cjs/components/legend/continue-legend/continue-legend.js +1 -1
  5. package/cjs/components/legend/continue-legend/continue-legend.js.map +1 -1
  6. package/cjs/core/BaseTable.d.ts +3 -1
  7. package/cjs/core/BaseTable.js +21 -15
  8. package/cjs/core/BaseTable.js.map +1 -1
  9. package/cjs/event/event.js +2 -1
  10. package/cjs/event/event.js.map +1 -1
  11. package/cjs/header-helper/style/Style.d.ts +3 -0
  12. package/cjs/header-helper/style/Style.js +26 -19
  13. package/cjs/header-helper/style/Style.js.map +1 -1
  14. package/cjs/index.d.ts +1 -1
  15. package/cjs/index.js +1 -1
  16. package/cjs/index.js.map +1 -1
  17. package/cjs/layout/tree-helper.js +1 -0
  18. package/cjs/plugins/themes.js +1 -2
  19. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +10 -6
  20. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  21. package/cjs/scenegraph/group-creater/cell-helper.js +3 -1
  22. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  23. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js +5 -4
  24. package/cjs/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  25. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
  26. package/cjs/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  27. package/cjs/scenegraph/layout/compute-col-width.js +12 -8
  28. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  29. package/cjs/scenegraph/layout/compute-row-height.js +70 -71
  30. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  31. package/cjs/scenegraph/layout/update-height.js +18 -11
  32. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  33. package/cjs/scenegraph/layout/update-width.js +19 -13
  34. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  35. package/cjs/scenegraph/utils/text-icon-layout.js +1 -1
  36. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  37. package/cjs/scenegraph/utils/text-measure.js +6 -6
  38. package/cjs/scenegraph/utils/text-measure.js.map +1 -1
  39. package/cjs/state/state.js +1 -1
  40. package/cjs/themes/component.js +1 -1
  41. package/cjs/ts-types/base-table.d.ts +3 -0
  42. package/cjs/ts-types/base-table.js.map +1 -1
  43. package/cjs/vrender.js.map +1 -1
  44. package/dist/vtable.js +233 -153
  45. package/dist/vtable.min.js +2 -2
  46. package/es/body-helper/style/Style.d.ts +3 -0
  47. package/es/body-helper/style/Style.js +22 -15
  48. package/es/body-helper/style/Style.js.map +1 -1
  49. package/es/components/legend/continue-legend/continue-legend.js +1 -1
  50. package/es/components/legend/continue-legend/continue-legend.js.map +1 -1
  51. package/es/core/BaseTable.d.ts +3 -1
  52. package/es/core/BaseTable.js +21 -15
  53. package/es/core/BaseTable.js.map +1 -1
  54. package/es/event/event.js +2 -1
  55. package/es/event/event.js.map +1 -1
  56. package/es/header-helper/style/Style.d.ts +3 -0
  57. package/es/header-helper/style/Style.js +26 -19
  58. package/es/header-helper/style/Style.js.map +1 -1
  59. package/es/index.d.ts +1 -1
  60. package/es/index.js +1 -1
  61. package/es/index.js.map +1 -1
  62. package/es/layout/tree-helper.js +2 -1
  63. package/es/plugins/themes.js +1 -2
  64. package/es/scenegraph/graphic/contributions/group-contribution-render.js +10 -6
  65. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  66. package/es/scenegraph/group-creater/cell-helper.js +2 -1
  67. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  68. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js +6 -3
  69. package/es/scenegraph/group-creater/cell-type/progress-bar-cell.js.map +1 -1
  70. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js +1 -1
  71. package/es/scenegraph/group-creater/progress/create-group-for-first-screen.js.map +1 -1
  72. package/es/scenegraph/layout/compute-col-width.js +11 -8
  73. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  74. package/es/scenegraph/layout/compute-row-height.js +69 -70
  75. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  76. package/es/scenegraph/layout/update-height.js +16 -9
  77. package/es/scenegraph/layout/update-height.js.map +1 -1
  78. package/es/scenegraph/layout/update-width.js +19 -10
  79. package/es/scenegraph/layout/update-width.js.map +1 -1
  80. package/es/scenegraph/utils/text-icon-layout.js +1 -1
  81. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  82. package/es/scenegraph/utils/text-measure.js +6 -6
  83. package/es/scenegraph/utils/text-measure.js.map +1 -1
  84. package/es/state/state.js +1 -1
  85. package/es/themes/component.js +1 -1
  86. package/es/ts-types/base-table.d.ts +3 -0
  87. package/es/ts-types/base-table.js.map +1 -1
  88. package/es/vrender.js.map +1 -1
  89. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -21687,6 +21687,7 @@
21687
21687
  _padding;
21688
21688
  _defaultPadding = [10, 16, 10, 16];
21689
21689
  _textStick;
21690
+ _textStickBaseOnAlign;
21690
21691
  _textOverflow;
21691
21692
  _textAlign;
21692
21693
  _textBaseline;
@@ -21725,6 +21726,7 @@
21725
21726
  this._borderColor = style?.borderColor ?? bodyStyle?.borderColor;
21726
21727
  this._textOverflow = style?.textOverflow ?? bodyStyle?.textOverflow;
21727
21728
  this._textStick = style.textStick ?? bodyStyle?.textStick ?? false;
21729
+ this._textStickBaseOnAlign = style.textStickBaseOnAlign ?? bodyStyle?.textStickBaseOnAlign ?? false;
21728
21730
  this._bgColor = style?.bgColor ?? bodyStyle?.bgColor;
21729
21731
  this._lineHeight = style?.lineHeight ?? bodyStyle?.lineHeight;
21730
21732
  this._underline = style?.underline ?? bodyStyle?.underline;
@@ -21806,6 +21808,12 @@
21806
21808
  set textStick(textStick) {
21807
21809
  this._textStick = textStick;
21808
21810
  }
21811
+ get textStickBaseOnAlign() {
21812
+ return this._textStickBaseOnAlign;
21813
+ }
21814
+ set textStickBaseOnAlign(textStickBaseOnAlign) {
21815
+ this._textStickBaseOnAlign = textStickBaseOnAlign;
21816
+ }
21809
21817
  get textAlign() {
21810
21818
  return this._textAlign;
21811
21819
  }
@@ -22089,6 +22097,7 @@
22089
22097
  _padding;
22090
22098
  _defaultPadding = [10, 16, 10, 16];
22091
22099
  _textStick;
22100
+ _textStickBaseOnAlign;
22092
22101
  _marked;
22093
22102
  _textAlign;
22094
22103
  _textBaseline;
@@ -22122,6 +22131,7 @@
22122
22131
  this._fontStyle = style.fontStyle ?? headerStyle?.fontStyle;
22123
22132
  this._textOverflow = (style.textOverflow ?? headerStyle?.textOverflow) || 'ellipsis';
22124
22133
  this._textStick = style.textStick ?? headerStyle?.textStick ?? false;
22134
+ this._textStickBaseOnAlign = style.textStickBaseOnAlign ?? headerStyle?.textStickBaseOnAlign ?? false;
22125
22135
  this._marked = style.marked ?? headerStyle?.marked ?? false;
22126
22136
  this._textAlign = (style.textAlign ?? headerStyle?.textAlign) || 'left';
22127
22137
  this._textBaseline = (style.textBaseline ?? headerStyle?.textBaseline) || 'middle';
@@ -22207,6 +22217,12 @@
22207
22217
  set textStick(textStick) {
22208
22218
  this._textStick = textStick;
22209
22219
  }
22220
+ get textStickBaseOnAlign() {
22221
+ return this._textStickBaseOnAlign;
22222
+ }
22223
+ set textStickBaseOnAlign(textStickBaseOnAlign) {
22224
+ this._textStickBaseOnAlign = textStickBaseOnAlign;
22225
+ }
22210
22226
  get marked() {
22211
22227
  return this._marked;
22212
22228
  }
@@ -36459,9 +36475,13 @@
36459
36475
  const height = table.getRowHeight(row);
36460
36476
  let contentWidth = width;
36461
36477
  let contentHeight = height;
36478
+ let _contentOffset = 0;
36479
+ if (isNumber$4(table.theme._contentOffset)) {
36480
+ _contentOffset = table.theme._contentOffset;
36481
+ }
36462
36482
  const percentCompleteBarGroup = new Group$1({
36463
- x: 0,
36464
- y: 0,
36483
+ x: -_contentOffset,
36484
+ y: -_contentOffset,
36465
36485
  width: contentWidth,
36466
36486
  height: contentHeight
36467
36487
  });
@@ -37790,7 +37810,7 @@
37790
37810
  }
37791
37811
  iconAttribute.marginLeft = (icon.marginLeft ?? 0) + hierarchyOffset;
37792
37812
  iconAttribute.marginRight = icon.marginRight ?? 0;
37793
- if (icon.interactive) {
37813
+ if (icon.interactive === false) {
37794
37814
  iconAttribute.pickable = false;
37795
37815
  }
37796
37816
  if (icon.hover) {
@@ -38693,7 +38713,7 @@
38693
38713
  });
38694
38714
  }
38695
38715
  });
38696
- const lineWidth = cellGroup.attribute.lineWidth;
38716
+ const lineWidth = cellGroup.attribute.strokeArrayWidth ?? cellGroup.attribute.lineWidth;
38697
38717
  const isLineWidthArray = isArray$3(lineWidth);
38698
38718
  const newLineWidth = [0, 0, 0, 0];
38699
38719
  if (col === range.start.col) {
@@ -39912,7 +39932,7 @@
39912
39932
  }
39913
39933
  }
39914
39934
  function computeRowHeight(row, startCol, endCol, table) {
39915
- let maxHeight = 0;
39935
+ let maxHeight;
39916
39936
  if (table.isPivotChart() &&
39917
39937
  row >= table.columnHeaderLevelCount &&
39918
39938
  row < table.rowCount - table.bottomFrozenRowCount) {
@@ -39932,7 +39952,7 @@
39932
39952
  for (let col = startCol; col <= endCol; col++) {
39933
39953
  const customHeight = computeCustomRenderHeight(col, row, table);
39934
39954
  if (customHeight) {
39935
- maxHeight = Math.max(customHeight.height, maxHeight);
39955
+ maxHeight = isValid$3(maxHeight) ? Math.max(customHeight.height, maxHeight) : customHeight.height;
39936
39956
  if (!customHeight.renderDefault) {
39937
39957
  continue;
39938
39958
  }
@@ -39943,7 +39963,7 @@
39943
39963
  if (axisConfig) {
39944
39964
  const axisWidth = computeAxisComponentHeight(axisConfig, table);
39945
39965
  if (typeof axisWidth === 'number') {
39946
- maxHeight = Math.max(axisWidth, maxHeight);
39966
+ maxHeight = isValid$3(maxHeight) ? Math.max(axisWidth, maxHeight) : axisWidth;
39947
39967
  continue;
39948
39968
  }
39949
39969
  }
@@ -39956,19 +39976,14 @@
39956
39976
  const cellType = table.isHeader(col, row)
39957
39977
  ? table._getHeaderLayoutMap(col, row)?.headerType
39958
39978
  : table.getBodyColumnType(col, row);
39959
- if (isValid$3(cellType) &&
39960
- cellType !== 'text' &&
39961
- cellType !== 'link' &&
39962
- cellType !== 'progressbar' &&
39963
- cellType !== 'checkbox') {
39964
- const defaultHeight = table.getDefaultRowHeight(row);
39965
- maxHeight = Math.max(maxHeight, isNumber$4(defaultHeight) ? defaultHeight : table.defaultRowHeight);
39966
- continue;
39967
- }
39968
39979
  const textHeight = computeTextHeight(col, row, cellType, table);
39969
- maxHeight = Math.max(textHeight, maxHeight);
39980
+ maxHeight = isValid$3(maxHeight) ? Math.max(textHeight, maxHeight) : textHeight;
39981
+ }
39982
+ if (isValid$3(maxHeight)) {
39983
+ return maxHeight;
39970
39984
  }
39971
- return maxHeight;
39985
+ const defaultHeight = table.getDefaultRowHeight(row);
39986
+ return isNumber$4(defaultHeight) ? defaultHeight : table.defaultRowHeight;
39972
39987
  }
39973
39988
  function checkFixedStyleAndNoWrap(table) {
39974
39989
  const { layoutMap } = table.internalProps;
@@ -40164,87 +40179,92 @@
40164
40179
  const fontFamily = getProp('fontFamily', actStyle, col, row, table);
40165
40180
  const autoWrapText = getProp('autoWrapText', actStyle, col, row, table);
40166
40181
  let text;
40167
- if (cellType === 'checkbox') {
40168
- text = isObject$4(cellValue) ? cellValue.text : cellValue;
40182
+ if (cellType !== 'text' && cellType !== 'link' && cellType !== 'progressbar' && cellType !== 'checkbox') {
40183
+ maxHeight = lineHeight;
40169
40184
  }
40170
40185
  else {
40171
- text = cellValue;
40172
- }
40173
- const lines = validToString(text).split('\n') || [];
40174
- const cellWidth = table.getColsWidth(col, endCol);
40175
- if (cellType === 'checkbox') {
40176
- const size = getProp('size', actStyle, col, row, table);
40177
- if (autoWrapText) {
40178
- const spaceBetweenTextAndIcon = getProp('spaceBetweenTextAndIcon', actStyle, col, row, table);
40179
- const maxLineWidth = cellWidth - (padding[1] + padding[3]) - iconWidth - size - spaceBetweenTextAndIcon;
40180
- utilCheckBoxMark.setAttributes({
40181
- text: {
40182
- maxLineWidth,
40183
- text: lines,
40184
- fontSize,
40185
- fontStyle,
40186
- fontWeight,
40187
- fontFamily,
40188
- lineHeight,
40189
- wordBreak: 'break-word'
40190
- },
40191
- icon: {
40192
- width: Math.floor(size / 1.4),
40193
- height: Math.floor(size / 1.4)
40194
- },
40195
- box: {
40196
- width: size,
40197
- height: size
40198
- },
40199
- spaceBetweenTextAndIcon
40186
+ if (cellType === 'checkbox') {
40187
+ text = isObject$4(cellValue) ? cellValue.text : cellValue;
40188
+ }
40189
+ else {
40190
+ text = cellValue;
40191
+ }
40192
+ const lines = validToString(text).split('\n') || [];
40193
+ const cellWidth = table.getColsWidth(col, endCol);
40194
+ if (cellType === 'checkbox') {
40195
+ const size = getProp('size', actStyle, col, row, table);
40196
+ if (autoWrapText) {
40197
+ const spaceBetweenTextAndIcon = getProp('spaceBetweenTextAndIcon', actStyle, col, row, table);
40198
+ const maxLineWidth = cellWidth - (padding[1] + padding[3]) - iconWidth - size - spaceBetweenTextAndIcon;
40199
+ utilCheckBoxMark.setAttributes({
40200
+ text: {
40201
+ maxLineWidth,
40202
+ text: lines,
40203
+ fontSize,
40204
+ fontStyle,
40205
+ fontWeight,
40206
+ fontFamily,
40207
+ lineHeight,
40208
+ wordBreak: 'break-word'
40209
+ },
40210
+ icon: {
40211
+ width: Math.floor(size / 1.4),
40212
+ height: Math.floor(size / 1.4)
40213
+ },
40214
+ box: {
40215
+ width: size,
40216
+ height: size
40217
+ },
40218
+ spaceBetweenTextAndIcon
40219
+ });
40220
+ utilCheckBoxMark.render();
40221
+ maxHeight = utilTextMark.AABBBounds.height();
40222
+ }
40223
+ else {
40224
+ maxHeight = Math.max(size, lines.length * lineHeight);
40225
+ }
40226
+ }
40227
+ else if (iconInlineFront.length || iconInlineEnd.length) {
40228
+ const textOption = Object.assign({
40229
+ text: cellValue?.toString(),
40230
+ fontFamily,
40231
+ fontSize,
40232
+ fontStyle,
40233
+ fontWeight,
40234
+ lineHeight
40235
+ });
40236
+ textOption.textBaseline = 'middle';
40237
+ const textConfig = [
40238
+ ...iconInlineFront.map(icon => dealWithRichTextIcon(icon)),
40239
+ textOption,
40240
+ ...iconInlineEnd.map(icon => dealWithRichTextIcon(icon))
40241
+ ];
40242
+ utilRichTextMark.setAttributes({
40243
+ width: cellWidth - (padding[1] + padding[3]) - iconWidth,
40244
+ height: 0,
40245
+ textConfig
40246
+ });
40247
+ maxHeight = utilRichTextMark.AABBBounds.height();
40248
+ }
40249
+ else if (autoWrapText) {
40250
+ const maxLineWidth = cellWidth - (padding[1] + padding[3]) - iconWidth;
40251
+ utilTextMark.setAttributes({
40252
+ maxLineWidth,
40253
+ text: lines,
40254
+ fontSize,
40255
+ fontStyle,
40256
+ fontWeight,
40257
+ fontFamily,
40258
+ lineHeight,
40259
+ wordBreak: 'break-word',
40260
+ whiteSpace: lines.length === 1 && !autoWrapText ? 'no-wrap' : 'normal'
40200
40261
  });
40201
- utilCheckBoxMark.render();
40202
- maxHeight = utilTextMark.AABBBounds.height();
40262
+ maxHeight = utilTextMark.AABBBounds.height() || (typeof lineHeight === 'number' ? lineHeight : fontSize);
40203
40263
  }
40204
40264
  else {
40205
- maxHeight = Math.max(size, lines.length * lineHeight);
40265
+ maxHeight = lines.length * lineHeight;
40206
40266
  }
40207
40267
  }
40208
- else if (iconInlineFront.length || iconInlineEnd.length) {
40209
- const textOption = Object.assign({
40210
- text: cellValue?.toString(),
40211
- fontFamily,
40212
- fontSize,
40213
- fontStyle,
40214
- fontWeight,
40215
- lineHeight
40216
- });
40217
- textOption.textBaseline = 'middle';
40218
- const textConfig = [
40219
- ...iconInlineFront.map(icon => dealWithRichTextIcon(icon)),
40220
- textOption,
40221
- ...iconInlineEnd.map(icon => dealWithRichTextIcon(icon))
40222
- ];
40223
- utilRichTextMark.setAttributes({
40224
- width: cellWidth - (padding[1] + padding[3]) - iconWidth,
40225
- height: 0,
40226
- textConfig
40227
- });
40228
- maxHeight = utilRichTextMark.AABBBounds.height();
40229
- }
40230
- else if (autoWrapText) {
40231
- const maxLineWidth = cellWidth - (padding[1] + padding[3]) - iconWidth;
40232
- utilTextMark.setAttributes({
40233
- maxLineWidth,
40234
- text: lines,
40235
- fontSize,
40236
- fontStyle,
40237
- fontWeight,
40238
- fontFamily,
40239
- lineHeight,
40240
- wordBreak: 'break-word',
40241
- whiteSpace: lines.length === 1 && !autoWrapText ? 'no-wrap' : 'normal'
40242
- });
40243
- maxHeight = utilTextMark.AABBBounds.height() || (typeof lineHeight === 'number' ? lineHeight : fontSize);
40244
- }
40245
- else {
40246
- maxHeight = lines.length * lineHeight;
40247
- }
40248
40268
  return (Math.max(maxHeight, iconHeight) + padding[0] + padding[2]) / spanRow;
40249
40269
  }
40250
40270
  function getCellRect$1(col, row, table) {
@@ -40395,7 +40415,13 @@
40395
40415
  if (customLayout || customRender) {
40396
40416
  const style = scene.table._getCellStyle(col, row);
40397
40417
  const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
40398
- const customResult = dealWithCustom(customLayout, customRender, col, row, cell.attribute.width, cell.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
40418
+ let width = cell.attribute.width;
40419
+ let height = cell.attribute.height;
40420
+ if (isMergeCellGroup(cell)) {
40421
+ width = scene.table.getColsWidth(cell.mergeStartCol, cell.mergeEndCol);
40422
+ height = scene.table.getRowsHeight(cell.mergeStartRow, cell.mergeEndRow);
40423
+ }
40424
+ const customResult = dealWithCustom(customLayout, customRender, col, row, width, height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
40399
40425
  customElementsGroup = customResult.elementsGroup;
40400
40426
  renderDefault = customResult.renderDefault;
40401
40427
  }
@@ -40407,13 +40433,10 @@
40407
40433
  }
40408
40434
  }
40409
40435
  }
40410
- if (renderDefault) {
40411
- const style = scene.table._getCellStyle(col, row);
40412
- updateMergeCellContentHeight(cell, distHeight, detaY, scene.table.heightMode === 'autoHeight', getQuadProps(style.padding), style.textAlign, style.textBaseline, scene.table);
40413
- }
40436
+ updateMergeCellContentHeight(cell, distHeight, detaY, scene.table.heightMode === 'autoHeight', renderDefault, scene.table);
40414
40437
  }
40415
40438
  }
40416
- function updateMergeCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline, table) {
40439
+ function updateMergeCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, renderDefault, table) {
40417
40440
  if (isMergeCellGroup(cellGroup)) {
40418
40441
  distHeight = 0;
40419
40442
  for (let row = cellGroup.mergeStartRow; row <= cellGroup.mergeEndRow; row++) {
@@ -40429,7 +40452,10 @@
40429
40452
  dy: 0
40430
40453
  });
40431
40454
  });
40432
- updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline);
40455
+ if (renderDefault) {
40456
+ const style = table._getCellStyle(col, row);
40457
+ updateCellContentHeight(singleCellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline);
40458
+ }
40433
40459
  const rangeHeight = table.getRowHeight(row);
40434
40460
  const rangeWidth = table.getColWidth(col);
40435
40461
  singleCellGroup.contentHeight = distHeight;
@@ -40450,7 +40476,8 @@
40450
40476
  }
40451
40477
  }
40452
40478
  else {
40453
- updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline);
40479
+ const style = table._getCellStyle(cellGroup.col, cellGroup.row);
40480
+ updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline);
40454
40481
  }
40455
40482
  }
40456
40483
 
@@ -40695,7 +40722,13 @@
40695
40722
  if (customLayout || customRender) {
40696
40723
  const style = scene.table._getCellStyle(col, row);
40697
40724
  const padding = getQuadProps(getProp('padding', style, col, row, scene.table));
40698
- const customResult = dealWithCustom(customLayout, customRender, col, row, cellGroup.attribute.width, cellGroup.attribute.height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
40725
+ let width = cellGroup.attribute.width;
40726
+ let height = cellGroup.attribute.height;
40727
+ if (isMergeCellGroup(cellGroup)) {
40728
+ width = scene.table.getColsWidth(cellGroup.mergeStartCol, cellGroup.mergeEndCol);
40729
+ height = scene.table.getRowsHeight(cellGroup.mergeStartRow, cellGroup.mergeEndRow);
40730
+ }
40731
+ const customResult = dealWithCustom(customLayout, customRender, col, row, width, height, false, scene.table.heightMode === 'autoHeight', padding, scene.table);
40699
40732
  customElementsGroup = customResult.elementsGroup;
40700
40733
  renderDefault = customResult.renderDefault;
40701
40734
  isHeightChange = true;
@@ -40708,14 +40741,12 @@
40708
40741
  }
40709
40742
  }
40710
40743
  }
40711
- if (renderDefault) {
40712
- const style = scene.table._getCellStyle(col, row);
40713
- isHeightChange = updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, getQuadProps(style.padding), style.textAlign, style.textBaseline, scene.table);
40714
- }
40744
+ const cellChange = updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, renderDefault, scene.table);
40745
+ isHeightChange = isHeightChange || cellChange;
40715
40746
  }
40716
40747
  return autoRowHeight && autoWrapText ? isHeightChange : false;
40717
40748
  }
40718
- function updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, padding, textAlign, textBaseline, table) {
40749
+ function updateMergeCellContentWidth(cellGroup, distWidth, detaX, autoRowHeight, renderDefault, table) {
40719
40750
  if (isMergeCellGroup(cellGroup)) {
40720
40751
  distWidth = 0;
40721
40752
  let isHeightChange = false;
@@ -40729,6 +40760,9 @@
40729
40760
  const { colStart, colEnd, rowStart, rowEnd } = getCellMergeRange(cellGroup, table.scenegraph);
40730
40761
  for (let col = colStart; col <= colEnd; col++) {
40731
40762
  for (let row = rowStart; row <= rowEnd; row++) {
40763
+ if (col === cellGroup.col && row !== cellGroup.row) {
40764
+ continue;
40765
+ }
40732
40766
  const singleCellGroup = table.scenegraph.getCell(col, row);
40733
40767
  singleCellGroup.forEachChildren((child) => {
40734
40768
  child.setAttributes({
@@ -40736,13 +40770,20 @@
40736
40770
  dy: 0
40737
40771
  });
40738
40772
  });
40739
- const changed = updateCellContentWidth(singleCellGroup, distWidth, cellHeight, detaX, autoRowHeight, padding, textAlign, textBaseline, table.scenegraph);
40740
- const hierarchyOffset = getHierarchyOffset(singleCellGroup.col, singleCellGroup.row, table);
40741
- if (hierarchyOffset) {
40742
- const text = singleCellGroup.getChildByName('text');
40743
- const icon = singleCellGroup.getChildByName('expand') || singleCellGroup.getChildByName('collapse');
40744
- if (icon?.role !== 'icon-left' && text) {
40745
- text.setAttribute('dx', hierarchyOffset);
40773
+ let changed = false;
40774
+ if (renderDefault) {
40775
+ const style = table._getCellStyle(col, row);
40776
+ const padding = getQuadProps(style.padding);
40777
+ const textAlign = style.textAlign;
40778
+ const textBaseline = style.textBaseline;
40779
+ changed = updateCellContentWidth(singleCellGroup, distWidth, cellHeight, detaX, autoRowHeight, padding, textAlign, textBaseline, table.scenegraph);
40780
+ const hierarchyOffset = getHierarchyOffset(singleCellGroup.col, singleCellGroup.row, table);
40781
+ if (hierarchyOffset) {
40782
+ const text = singleCellGroup.getChildByName('text');
40783
+ const icon = singleCellGroup.getChildByName('expand') || singleCellGroup.getChildByName('collapse');
40784
+ if (icon?.role !== 'icon-left' && text) {
40785
+ text.setAttribute('dx', hierarchyOffset);
40786
+ }
40746
40787
  }
40747
40788
  }
40748
40789
  const rangeHeight = table.getRowHeight(row);
@@ -40766,6 +40807,10 @@
40766
40807
  }
40767
40808
  return isHeightChange;
40768
40809
  }
40810
+ const style = table._getCellStyle(cellGroup.col, cellGroup.row);
40811
+ const padding = getQuadProps(style.padding);
40812
+ const textAlign = style.textAlign;
40813
+ const textBaseline = style.textBaseline;
40769
40814
  return updateCellContentWidth(cellGroup, distWidth, table.getRowHeight(cellGroup.row), detaX, autoRowHeight, padding, textAlign, textBaseline, table.scenegraph);
40770
40815
  }
40771
40816
  function resetRowHeight(scene, row) {
@@ -42374,7 +42419,10 @@
42374
42419
  if ((typeof lineWidth === 'number' && lineWidth & 1) ||
42375
42420
  (Array.isArray(strokeArrayWidth) && strokeArrayWidth.some(width => width & 1))) {
42376
42421
  const table = group.stage.table;
42377
- const bottomRight = table.theme.cellBorderClipDirection === 'bottom-right';
42422
+ if (!table) {
42423
+ return;
42424
+ }
42425
+ const bottomRight = table?.theme.cellBorderClipDirection === 'bottom-right';
42378
42426
  let deltaWidth = 0;
42379
42427
  let deltaHeight = 0;
42380
42428
  if (bottomRight) {
@@ -42611,7 +42659,10 @@
42611
42659
  let heightForStroke;
42612
42660
  if (lineWidth & 1) {
42613
42661
  const table = group.stage.table;
42614
- const bottomRight = table.theme.cellBorderClipDirection === 'bottom-right';
42662
+ if (!table) {
42663
+ return;
42664
+ }
42665
+ const bottomRight = table?.theme.cellBorderClipDirection === 'bottom-right';
42615
42666
  let deltaWidth = 0;
42616
42667
  let deltaHeight = 0;
42617
42668
  if (bottomRight) {
@@ -42703,7 +42754,10 @@
42703
42754
  const { width: widthFroDraw, height: heightFroDraw } = getCellSizeForDraw(group, Math.ceil(width), Math.ceil(height));
42704
42755
  context.beginPath();
42705
42756
  const table = group.stage.table;
42706
- const bottomRight = table.theme.cellBorderClipDirection === 'bottom-right';
42757
+ if (!table) {
42758
+ return;
42759
+ }
42760
+ const bottomRight = table?.theme.cellBorderClipDirection === 'bottom-right';
42707
42761
  let deltaWidth = 0;
42708
42762
  let deltaHeight = 0;
42709
42763
  if (bottomRight) {
@@ -42745,7 +42799,7 @@
42745
42799
  drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
42746
42800
  if (group.role === 'cell') {
42747
42801
  const table = group.stage.table;
42748
- if (table.stateManager.interactionState !== InteractionState.scrolling) {
42802
+ if (table && table.stateManager.interactionState !== InteractionState.scrolling) {
42749
42803
  const hoverColor = getCellHoverColor(group, table);
42750
42804
  if (hoverColor) {
42751
42805
  group.attribute._vtableHoverFill = hoverColor;
@@ -42784,6 +42838,9 @@
42784
42838
  order = 0;
42785
42839
  drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
42786
42840
  const table = group.stage.table;
42841
+ if (!table) {
42842
+ return;
42843
+ }
42787
42844
  if (group.role === 'body') {
42788
42845
  const x = -(group.attribute.x ?? 0) + table.getFrozenColsWidth();
42789
42846
  const y = -(group.attribute.y ?? 0) + table.getFrozenRowsHeight();
@@ -42896,10 +42953,10 @@
42896
42953
  }
42897
42954
  }
42898
42955
  else if (group.role === 'corner-frozen') {
42899
- if (table.scrollLeft) {
42956
+ if (table && table.scrollLeft) {
42900
42957
  width -= 1;
42901
42958
  }
42902
- if (table.scrollTop) {
42959
+ if (table && table.scrollTop) {
42903
42960
  height -= 1;
42904
42961
  }
42905
42962
  }
@@ -43032,6 +43089,7 @@
43032
43089
  }
43033
43090
 
43034
43091
  let customAlphabetCharSet = '';
43092
+ let textMeasureMode = 'quick';
43035
43093
  const textMeasureModule = new ContainerModule((bind, unbind, isBound, rebind) => {
43036
43094
  if (isBound(TextMeasureContribution)) {
43037
43095
  rebind(TextMeasureContribution).to(FastTextMeasureContribution).inSingletonScope();
@@ -43079,13 +43137,13 @@
43079
43137
  measureTextWidth(text, options) {
43080
43138
  const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
43081
43139
  const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
43082
- const textMeasure = fastTextMeasure.measure(text);
43140
+ const textMeasure = fastTextMeasure.measure(text, textMeasureMode);
43083
43141
  return textMeasure.width;
43084
43142
  }
43085
43143
  measureText(text, options) {
43086
43144
  const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
43087
43145
  const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
43088
- const textMeasure = fastTextMeasure.measure(text);
43146
+ const textMeasure = fastTextMeasure.measure(text, textMeasureMode);
43089
43147
  return textMeasure;
43090
43148
  }
43091
43149
  }
@@ -43093,13 +43151,13 @@
43093
43151
  measureText(text, options) {
43094
43152
  const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
43095
43153
  const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
43096
- const textMeasure = fastTextMeasure.measure(text);
43154
+ const textMeasure = fastTextMeasure.measure(text, textMeasureMode);
43097
43155
  return textMeasure;
43098
43156
  }
43099
43157
  measureTextWidth(text, options) {
43100
43158
  const { fontSize, fontFamily = 'Arial,sans-serif', fontWeight = 'normal', fontStyle = 'normal' } = options;
43101
43159
  const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily, fontStyle);
43102
- const textMeasure = fastTextMeasure.measure(text);
43160
+ const textMeasure = fastTextMeasure.measure(text, textMeasureMode);
43103
43161
  return textMeasure.width;
43104
43162
  }
43105
43163
  clipText(text, options, width) {
@@ -43173,6 +43231,7 @@
43173
43231
  fastTextMeasureCache.clear();
43174
43232
  }
43175
43233
  function restoreMeasureText() {
43234
+ textMeasureMode = 'canvas';
43176
43235
  container.load(restoreTextMeasureModule);
43177
43236
  }
43178
43237
 
@@ -43338,7 +43397,8 @@
43338
43397
  for (let col = colStart; col <= colEnd; col++) {
43339
43398
  let maxWidth;
43340
43399
  if (!table.internalProps.transpose &&
43341
- table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-header' &&
43400
+ (table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-header' ||
43401
+ table.columnWidthComputeMode === 'only-header') &&
43342
43402
  'showHeader' in table.internalProps.layoutMap) {
43343
43403
  const temp = table.internalProps.layoutMap.showHeader;
43344
43404
  table.internalProps.layoutMap.showHeader = true;
@@ -43346,7 +43406,8 @@
43346
43406
  table.internalProps.layoutMap.showHeader = temp;
43347
43407
  }
43348
43408
  else if (!table.internalProps.transpose &&
43349
- table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-body') {
43409
+ (table.internalProps.layoutMap.columnWidths?.[col]?.columnWidthComputeMode === 'only-body' ||
43410
+ table.columnWidthComputeMode === 'only-body')) {
43350
43411
  maxWidth = computeColWidth(col, table.internalProps.layoutMap.getBodyRange().start.row, table.internalProps.layoutMap.getBodyRange().end.row, table);
43351
43412
  }
43352
43413
  else {
@@ -43416,7 +43477,13 @@
43416
43477
  }
43417
43478
  }
43418
43479
  function computeColWidth(col, startRow, endRow, table, forceCompute = false) {
43419
- const width = getColWidthDefinedWidthResizedWidth(col, table);
43480
+ let width = getColWidthDefinedWidthResizedWidth(col, table);
43481
+ if (table.internalProps.transpose &&
43482
+ width === 'auto' &&
43483
+ ((table.columnWidthComputeMode === 'only-header' && col >= table.rowHeaderLevelCount) ||
43484
+ (table.columnWidthComputeMode === 'only-body' && col < table.rowHeaderLevelCount))) {
43485
+ width = table.getDefaultColumnWidth(col);
43486
+ }
43420
43487
  if (forceCompute && !table.internalProps.transpose) {
43421
43488
  return computeAutoColWidth(width, col, startRow, endRow, forceCompute, table);
43422
43489
  }
@@ -43557,8 +43624,9 @@
43557
43624
  if (customLayoutObj.rootContainer instanceof Group$2) {
43558
43625
  customLayoutObj.rootContainer = decodeReactDom(customLayoutObj.rootContainer);
43559
43626
  dealPercentCalc(customLayoutObj.rootContainer, 0, table.getRowHeight(row));
43627
+ const setedWidth = customLayoutObj.rootContainer.attribute.width;
43560
43628
  customLayoutObj.rootContainer.setStage(table.scenegraph.stage);
43561
- width = customLayoutObj.rootContainer.AABBBounds.width() ?? 0;
43629
+ width = setedWidth > 0 ? setedWidth : customLayoutObj.rootContainer.AABBBounds.width() ?? 0;
43562
43630
  renderDefault = customLayoutObj.renderDefault;
43563
43631
  enableCellPadding = customLayoutObj.enableCellPadding;
43564
43632
  }
@@ -43897,7 +43965,8 @@
43897
43965
  proxy.setParamsForColumn();
43898
43966
  let distCol;
43899
43967
  let distRow;
43900
- if (table.widthMode === 'adaptive') {
43968
+ if (table.widthMode === 'adaptive' ||
43969
+ (table.options.autoWrapText && (table.heightMode === 'adaptive' || table.heightMode === 'autoHeight'))) {
43901
43970
  distCol = table.colCount - 1;
43902
43971
  }
43903
43972
  else {
@@ -52112,6 +52181,7 @@
52112
52181
  const resizeCol = this.table.scenegraph.getResizeColAt(eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, eventArgsSet.eventArgs?.targetCell);
52113
52182
  if (this.table._canResizeColumn(resizeCol.col, resizeCol.row) && resizeCol.col >= 0) {
52114
52183
  this.table.scenegraph.updateAutoColWidth(resizeCol.col);
52184
+ this.table.internalProps._widthResizedColMap.add(resizeCol.col);
52115
52185
  this.table.scenegraph.updateChartSize(resizeCol.col);
52116
52186
  const state = this.table.stateManager;
52117
52187
  if (state.columnResize.col < state.table.frozenColCount &&
@@ -54888,7 +54958,7 @@
54888
54958
  this.orient = option.orient ?? 'left';
54889
54959
  this.visible = option.visible ?? true;
54890
54960
  this.position = option.position ?? 'middle';
54891
- this.selectedData = option.defaultSelected ?? [];
54961
+ this.selectedData = option.defaultSelected ?? null;
54892
54962
  this.createComponent();
54893
54963
  this.initEvent();
54894
54964
  }
@@ -55495,7 +55565,7 @@
55495
55565
  return TABLE_EVENT_TYPE;
55496
55566
  }
55497
55567
  options;
55498
- version = "0.22.1";
55568
+ version = "0.22.2-alpha.1";
55499
55569
  pagination;
55500
55570
  id = `VTable${Date.now()}`;
55501
55571
  headerStyleCache;
@@ -55505,6 +55575,7 @@
55505
55575
  isReleased = false;
55506
55576
  _chartEventMap = {};
55507
55577
  customCellStylePlugin;
55578
+ columnWidthComputeMode;
55508
55579
  constructor(container, options = {}) {
55509
55580
  super();
55510
55581
  if (!container && options.mode !== 'node') {
@@ -55538,6 +55609,7 @@
55538
55609
  this.tableNoFrameHeight = 0;
55539
55610
  this.canvasWidth = canvasWidth;
55540
55611
  this.canvasHeight = canvasHeight;
55612
+ this.columnWidthComputeMode = options.columnWidthComputeMode ?? 'normal';
55541
55613
  const internalProps = (this.internalProps = {});
55542
55614
  showFrozenIcon !== undefined && (this.showFrozenIcon = showFrozenIcon);
55543
55615
  if (typeof allowFrozenColCount === 'number' && allowFrozenColCount <= 0) {
@@ -55971,6 +56043,22 @@
55971
56043
  }
55972
56044
  return this.defaultRowHeight;
55973
56045
  }
56046
+ getDefaultColumnWidth(col) {
56047
+ if (this.isRowHeader(col, 0) || this.isCornerHeader(col, 0)) {
56048
+ return Array.isArray(this.defaultHeaderColWidth)
56049
+ ? this.defaultHeaderColWidth[col] ?? this.defaultColWidth
56050
+ : this.defaultHeaderColWidth;
56051
+ }
56052
+ else if (this.isRightFrozenColumn(col, this.columnHeaderLevelCount)) {
56053
+ if (this.isPivotTable()) {
56054
+ return Array.isArray(this.defaultHeaderColWidth)
56055
+ ? this.defaultHeaderColWidth[this.rowHeaderLevelCount - this.rightFrozenColCount] ?? this.defaultColWidth
56056
+ : this.defaultHeaderColWidth;
56057
+ }
56058
+ return this.defaultColWidth;
56059
+ }
56060
+ return this.defaultColWidth;
56061
+ }
55974
56062
  getDefaultRowHeight(row) {
55975
56063
  if (this.isColumnHeader(0, row) || this.isCornerHeader(0, row)) {
55976
56064
  return Array.isArray(this.defaultHeaderRowHeight)
@@ -56025,32 +56113,14 @@
56025
56113
  else if (width) {
56026
56114
  return width;
56027
56115
  }
56028
- else if (this.isRowHeader(col, 0) || this.isCornerHeader(col, 0)) {
56029
- return Array.isArray(this.defaultHeaderColWidth)
56030
- ? this.defaultHeaderColWidth[col] ?? this.defaultColWidth
56031
- : this.defaultHeaderColWidth;
56032
- }
56033
- else if (this.isRightFrozenColumn(col, this.columnHeaderLevelCount)) {
56034
- if (this.isPivotTable()) {
56035
- return Array.isArray(this.defaultHeaderColWidth)
56036
- ? this.defaultHeaderColWidth[this.rowHeaderLevelCount - this.rightFrozenColCount] ?? this.defaultColWidth
56037
- : this.defaultHeaderColWidth;
56038
- }
56039
- return this.defaultColWidth;
56040
- }
56041
- return this.defaultColWidth;
56116
+ return this.getDefaultColumnWidth(col);
56042
56117
  }
56043
56118
  getColWidthDefinedNumber(col) {
56044
56119
  const width = this.getColWidthDefined(col);
56045
56120
  return this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
56046
56121
  }
56047
56122
  getColWidth(col) {
56048
- const width = this.colWidthsMap.get(col) ??
56049
- (col < this.rowHeaderLevelCount
56050
- ? Array.isArray(this.defaultHeaderColWidth)
56051
- ? this.defaultHeaderColWidth[col] ?? this.defaultColWidth
56052
- : this.defaultHeaderColWidth
56053
- : this.defaultColWidth);
56123
+ const width = this.colWidthsMap.get(col) ?? this.getDefaultColumnWidth(col);
56054
56124
  if ((this.widthMode === 'adaptive' && typeof width === 'number') ||
56055
56125
  (this.transpose && typeof width === 'number')) {
56056
56126
  return this._colWidthDefineToPxWidth(width);
@@ -57754,13 +57824,23 @@
57754
57824
  return customLayout;
57755
57825
  }
57756
57826
  hasAutoImageColumn() {
57757
- return this.internalProps.layoutMap.columnObjects.find((column) => {
57758
- if ((column.cellType === 'image' || typeof column.cellType === 'function') &&
57827
+ const bodyColumn = this.internalProps.layoutMap.columnObjects.find((column) => {
57828
+ if ((column.cellType === 'image' || column.cellType === 'video' || typeof column.cellType === 'function') &&
57759
57829
  column.define.imageAutoSizing) {
57760
57830
  return true;
57761
57831
  }
57762
57832
  return false;
57763
57833
  });
57834
+ const headerObj = this.internalProps.layoutMap.headerObjects.find((column) => {
57835
+ if (column) {
57836
+ if ((column.headerType === 'image' || column.headerType === 'video' || typeof column.headerType === 'function') &&
57837
+ column.define.imageAutoSizing) {
57838
+ return true;
57839
+ }
57840
+ }
57841
+ return false;
57842
+ });
57843
+ return bodyColumn || headerObj;
57764
57844
  }
57765
57845
  _getActiveChartInstance() {
57766
57846
  const cellGroup = this.scenegraph.getCell(this.stateManager.hover?.cellPos?.col, this.stateManager.hover?.cellPos?.row);
@@ -67576,7 +67656,7 @@
67576
67656
  }
67577
67657
 
67578
67658
  registerForVrender();
67579
- const version = "0.22.1";
67659
+ const version = "0.22.2-alpha.1";
67580
67660
  function getIcons() {
67581
67661
  return get$2();
67582
67662
  }