@visactor/vtable 0.9.3-alpha.6 → 0.9.3-alpha.7

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 (107) hide show
  1. package/cjs/ListTable.d.ts +2 -1
  2. package/cjs/ListTable.js +3 -2
  3. package/cjs/ListTable.js.map +1 -1
  4. package/cjs/PivotChart.d.ts +1 -0
  5. package/cjs/PivotChart.js +6 -5
  6. package/cjs/PivotChart.js.map +1 -1
  7. package/cjs/PivotTable.d.ts +1 -0
  8. package/cjs/PivotTable.js +5 -3
  9. package/cjs/PivotTable.js.map +1 -1
  10. package/cjs/components/axis/get-axis-component-size.js +13 -9
  11. package/cjs/components/axis/get-axis-component-size.js.map +1 -1
  12. package/cjs/core/BaseTable.d.ts +4 -3
  13. package/cjs/core/BaseTable.js +11 -15
  14. package/cjs/core/BaseTable.js.map +1 -1
  15. package/cjs/event/listener/container-dom.js +1 -1
  16. package/cjs/event/listener/container-dom.js.map +1 -1
  17. package/cjs/event/listener/scroll-bar.js +2 -0
  18. package/cjs/event/listener/scroll-bar.js.map +1 -1
  19. package/cjs/event/scroll.js +8 -4
  20. package/cjs/event/scroll.js.map +1 -1
  21. package/cjs/index.d.ts +1 -1
  22. package/cjs/index.js +1 -1
  23. package/cjs/index.js.map +1 -1
  24. package/cjs/render/layout/text.js +1 -0
  25. package/cjs/render/layout/text.js.map +1 -1
  26. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +6 -3
  27. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  28. package/cjs/scenegraph/graphic/text.js +6 -4
  29. package/cjs/scenegraph/graphic/text.js.map +1 -1
  30. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +0 -1
  31. package/cjs/scenegraph/group-creater/progress/proxy.js +3 -16
  32. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  33. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +1 -0
  34. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  35. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +2 -2
  36. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  37. package/cjs/scenegraph/layout/compute-col-width.js +5 -3
  38. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  39. package/cjs/scenegraph/layout/compute-row-height.d.ts +1 -1
  40. package/cjs/scenegraph/layout/compute-row-height.js +26 -13
  41. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  42. package/cjs/scenegraph/layout/update-width.js +6 -2
  43. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  44. package/cjs/scenegraph/scenegraph.js +4 -5
  45. package/cjs/scenegraph/scenegraph.js.map +1 -1
  46. package/cjs/scenegraph/utils/measure-text.js +9 -8
  47. package/cjs/scenegraph/utils/measure-text.js.map +1 -1
  48. package/cjs/state/state.d.ts +1 -0
  49. package/cjs/state/state.js +4 -2
  50. package/cjs/state/state.js.map +1 -1
  51. package/cjs/ts-types/base-table.d.ts +3 -2
  52. package/cjs/ts-types/base-table.js.map +1 -1
  53. package/dist/vtable.js +159 -102
  54. package/dist/vtable.min.js +3 -3
  55. package/es/ListTable.d.ts +2 -1
  56. package/es/ListTable.js +3 -2
  57. package/es/ListTable.js.map +1 -1
  58. package/es/PivotChart.d.ts +1 -0
  59. package/es/PivotChart.js +6 -5
  60. package/es/PivotChart.js.map +1 -1
  61. package/es/PivotTable.d.ts +1 -0
  62. package/es/PivotTable.js +5 -3
  63. package/es/PivotTable.js.map +1 -1
  64. package/es/components/axis/get-axis-component-size.js +13 -9
  65. package/es/components/axis/get-axis-component-size.js.map +1 -1
  66. package/es/core/BaseTable.d.ts +4 -3
  67. package/es/core/BaseTable.js +11 -15
  68. package/es/core/BaseTable.js.map +1 -1
  69. package/es/event/listener/container-dom.js +1 -1
  70. package/es/event/listener/container-dom.js.map +1 -1
  71. package/es/event/listener/scroll-bar.js +2 -0
  72. package/es/event/listener/scroll-bar.js.map +1 -1
  73. package/es/event/scroll.js +4 -1
  74. package/es/event/scroll.js.map +1 -1
  75. package/es/index.d.ts +1 -1
  76. package/es/index.js +1 -1
  77. package/es/index.js.map +1 -1
  78. package/es/render/layout/text.js +1 -0
  79. package/es/render/layout/text.js.map +1 -1
  80. package/es/scenegraph/graphic/contributions/group-contribution-render.js +7 -2
  81. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  82. package/es/scenegraph/graphic/text.js +6 -4
  83. package/es/scenegraph/graphic/text.js.map +1 -1
  84. package/es/scenegraph/group-creater/progress/proxy.d.ts +0 -1
  85. package/es/scenegraph/group-creater/progress/proxy.js +3 -15
  86. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  87. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +1 -0
  88. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  89. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +4 -5
  90. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  91. package/es/scenegraph/layout/compute-col-width.js +4 -2
  92. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  93. package/es/scenegraph/layout/compute-row-height.d.ts +1 -1
  94. package/es/scenegraph/layout/compute-row-height.js +26 -13
  95. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  96. package/es/scenegraph/layout/update-width.js +6 -2
  97. package/es/scenegraph/layout/update-width.js.map +1 -1
  98. package/es/scenegraph/scenegraph.js +4 -4
  99. package/es/scenegraph/scenegraph.js.map +1 -1
  100. package/es/scenegraph/utils/measure-text.js +10 -9
  101. package/es/scenegraph/utils/measure-text.js.map +1 -1
  102. package/es/state/state.d.ts +1 -0
  103. package/es/state/state.js +5 -1
  104. package/es/state/state.js.map +1 -1
  105. package/es/ts-types/base-table.d.ts +3 -2
  106. package/es/ts-types/base-table.js.map +1 -1
  107. package/package.json +1 -1
package/dist/vtable.js CHANGED
@@ -39137,34 +39137,35 @@
39137
39137
  fontSize: DEFAULT_TEXT_FONT_SIZE
39138
39138
  },
39139
39139
  getTextBounds: useNaiveCanvas ? undefined : getTextBounds,
39140
- specialCharSet: `-/: .,@%'"~${TextMeasure.ALPHABET_CHAR_SET}${TextMeasure.ALPHABET_CHAR_SET.toUpperCase()}`,
39140
+ specialCharSet: `{}()//&-/: .,@%'"~${TextMeasure.ALPHABET_CHAR_SET}${TextMeasure.ALPHABET_CHAR_SET.toUpperCase()}`,
39141
39141
  ...(option ?? {})
39142
39142
  }, textSpec);
39143
39143
  };
39144
39144
  const fastTextMeasureCache = new Map();
39145
- function getFastTextMeasure(fontSize, fontFamily) {
39146
- const key = `${fontSize}-${fontFamily}`;
39145
+ function getFastTextMeasure(fontSize, fontWeight, fontFamily) {
39146
+ const key = `${fontSize}-${fontWeight}-${fontFamily}`;
39147
39147
  const cache = fastTextMeasureCache.get(key);
39148
39148
  if (cache) {
39149
39149
  return cache;
39150
39150
  }
39151
39151
  const fastTextMeasure = initTextMeasure({
39152
39152
  fontSize,
39153
- fontFamily
39153
+ fontFamily,
39154
+ fontWeight
39154
39155
  });
39155
39156
  fastTextMeasureCache.set(key, fastTextMeasure);
39156
39157
  return fastTextMeasure;
39157
39158
  }
39158
39159
  class TextMeasureTool {
39159
39160
  measureText(text, options) {
39160
- const { fontSize, fontFamily } = options;
39161
- const fastTextMeasure = getFastTextMeasure(fontSize, fontFamily);
39161
+ const { fontSize, fontFamily, fontWeight } = options;
39162
+ const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily);
39162
39163
  const textMeasure = fastTextMeasure.measure(text);
39163
39164
  return textMeasure;
39164
39165
  }
39165
39166
  measureTextWidth(text, options) {
39166
- const { fontSize, fontFamily = 'sans-serif' } = options;
39167
- const fastTextMeasure = getFastTextMeasure(fontSize, fontFamily);
39167
+ const { fontSize, fontFamily = 'sans-serif', fontWeight = 'normal' } = options;
39168
+ const fastTextMeasure = getFastTextMeasure(fontSize, fontWeight, fontFamily);
39168
39169
  const textMeasure = fastTextMeasure.measure(text);
39169
39170
  return textMeasure.width;
39170
39171
  }
@@ -39245,7 +39246,7 @@
39245
39246
  let width;
39246
39247
  let str;
39247
39248
  const attribute = this.attribute;
39248
- const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineHeight = attribute.lineHeight ?? attribute.fontSize ?? textTheme.fontSize, lineWidth = textTheme.lineWidth } = attribute;
39249
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontFamily = textTheme.fontFamily, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineHeight = attribute.lineHeight ?? attribute.fontSize ?? textTheme.fontSize, lineWidth = textTheme.lineWidth } = attribute;
39249
39250
  if (!this.shouldUpdateShape() && this.cache) {
39250
39251
  width = this.cache.clipedWidth;
39251
39252
  const dx = textDrawOffsetX(textAlign, width);
@@ -39272,7 +39273,7 @@
39272
39273
  this.cache.clipedWidth = width;
39273
39274
  }
39274
39275
  else {
39275
- width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontFamily });
39276
+ width = textMeasure.measureTextWidth(text.toString(), { fontSize, fontFamily, fontWeight });
39276
39277
  this.cache.clipedText = text.toString();
39277
39278
  this.cache.clipedWidth = width;
39278
39279
  }
@@ -39287,7 +39288,7 @@
39287
39288
  }
39288
39289
  updateMultilineAABBBounds(text) {
39289
39290
  const textTheme = getTheme(this).text;
39290
- const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, lineHeight = this.attribute.lineHeight ?? this.attribute.fontSize ?? textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, heightLimit = -1, lineClamp = textTheme.lineClamp, autoWrapText = textTheme.autoWrapText } = this.attribute;
39291
+ const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, fontWeight = textTheme.fontWeight, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, lineHeight = this.attribute.lineHeight ?? this.attribute.fontSize ?? textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, heightLimit = -1, lineClamp = textTheme.lineClamp, autoWrapText = textTheme.autoWrapText } = this.attribute;
39291
39292
  if (!this.shouldUpdateShape() && this.cache?.layoutData) {
39292
39293
  const bbox = this.cache.layoutData.bbox;
39293
39294
  this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
@@ -39336,7 +39337,7 @@
39336
39337
  const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth);
39337
39338
  if (str !== '' && clip.str === '') {
39338
39339
  clip.str = str.substring(0, 1);
39339
- clip.width = textMeasure.measureTextWidth(clip.str, { fontSize, fontFamily });
39340
+ clip.width = textMeasure.measureTextWidth(clip.str, { fontSize, fontFamily, fontWeight });
39340
39341
  }
39341
39342
  linesLayout.push({
39342
39343
  str: clip.str,
@@ -40664,6 +40665,9 @@
40664
40665
  let maxHeight = 0;
40665
40666
  for (let col = 0; col < scene.table.colCount; col++) {
40666
40667
  const cell = scene.highPerformanceGetCell(col, row);
40668
+ if (cell.role === 'empty') {
40669
+ return;
40670
+ }
40667
40671
  let cellHeight = getCleanCellHeight(cell, scene);
40668
40672
  const mergeInfo = getCellMergeInfo(scene.table, col, row);
40669
40673
  if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {
@@ -40674,6 +40678,9 @@
40674
40678
  for (let col = 0; col < scene.table.colCount; col++) {
40675
40679
  let distHeight = maxHeight;
40676
40680
  const cell = scene.highPerformanceGetCell(col, row);
40681
+ if (cell.role === 'empty') {
40682
+ return;
40683
+ }
40677
40684
  const mergeInfo = getCellMergeInfo(scene.table, col, row);
40678
40685
  if (mergeInfo && mergeInfo.end.row - mergeInfo.start.row) {
40679
40686
  for (let rowIndex = mergeInfo.start.row; rowIndex <= mergeInfo.end.row; rowIndex++) {
@@ -42337,10 +42344,12 @@
42337
42344
  drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
42338
42345
  if (group.role === 'cell') {
42339
42346
  const table = group.stage.table;
42340
- const hoverColor = getCellHoverColor(group, table);
42341
- if (hoverColor) {
42342
- group.oldColor = group.attribute.fill;
42343
- group.attribute.fill = hoverColor;
42347
+ if (table.stateManeger.interactionState !== InteractionState.scrolling) {
42348
+ const hoverColor = getCellHoverColor(group, table);
42349
+ if (hoverColor) {
42350
+ group.oldColor = group.attribute.fill;
42351
+ group.attribute.fill = hoverColor;
42352
+ }
42344
42353
  }
42345
42354
  }
42346
42355
  }
@@ -42743,6 +42752,7 @@
42743
42752
  }
42744
42753
  labelWidth = Math.max(labelWidth, table.measureText(text, {
42745
42754
  fontSize: attribute.label?.style?.fontSize,
42755
+ fontWeight: attribute.label?.style?.fontWeight,
42746
42756
  fontFamily: attribute.label?.style?.fontFamily
42747
42757
  }).width);
42748
42758
  });
@@ -42759,6 +42769,7 @@
42759
42769
  }
42760
42770
  labelWidth = Math.max(labelWidth, table.measureText(text, {
42761
42771
  fontSize: attribute.label?.style?.fontSize,
42772
+ fontWeight: attribute.label?.style?.fontWeight,
42762
42773
  fontFamily: attribute.label?.style?.fontFamily
42763
42774
  }).width + 2);
42764
42775
  });
@@ -42771,6 +42782,7 @@
42771
42782
  titleWidth =
42772
42783
  table.measureText(attribute.title.text, {
42773
42784
  fontSize: attribute.title?.style?.fontSize,
42785
+ fontWeight: attribute.title?.style?.fontWeight,
42774
42786
  fontFamily: attribute.title?.style?.fontFamily
42775
42787
  }).height + 2;
42776
42788
  }
@@ -42778,6 +42790,7 @@
42778
42790
  titleWidth =
42779
42791
  table.measureText(attribute.title.text, {
42780
42792
  fontSize: attribute.title?.style?.fontSize,
42793
+ fontWeight: attribute.title?.style?.fontWeight,
42781
42794
  fontFamily: attribute.title?.style?.fontFamily
42782
42795
  }).width + 2;
42783
42796
  }
@@ -42848,6 +42861,7 @@
42848
42861
  }
42849
42862
 
42850
42863
  function computeColsWidth(table, colStart, colEnd, update) {
42864
+ typeof window !== 'undefined' ? window.performance.now() : 0;
42851
42865
  colStart = colStart ?? 0;
42852
42866
  colEnd = colEnd ?? table.colCount - 1;
42853
42867
  if (colStart === 0 && colEnd === table.colCount - 1) {
@@ -43127,12 +43141,14 @@
43127
43141
  const paddingWidth = padding[1] + padding[3];
43128
43142
  const fontSize = getProp('fontSize', actStyle, col, row, table);
43129
43143
  const fontFamily = getProp('fontFamily', actStyle, col, row, table);
43144
+ const fontWeight = getProp('fontWeight', actStyle, col, row, table);
43130
43145
  const lines = validToString(cellValue).split('\n') || [];
43131
43146
  if (lines.length >= 1) {
43132
43147
  lines.forEach((line) => {
43133
43148
  const width = table.measureText(line.slice(0, table.options.maxCharactersNumber || 200), {
43134
43149
  fontSize,
43135
- fontFamily
43150
+ fontFamily,
43151
+ fontWeight
43136
43152
  }).width;
43137
43153
  maxWidth = Math.max((width + paddingWidth + 4 + iconWidth) / spanCol, maxWidth);
43138
43154
  });
@@ -43164,19 +43180,14 @@
43164
43180
  height: 0,
43165
43181
  textConfig: []
43166
43182
  });
43167
- function computeRowsHeight(table, rowStart, rowEnd) {
43168
- const time = typeof window !== 'undefined' ? window.performance.now() : 0;
43183
+ function computeRowsHeight(table, rowStart, rowEnd, isClearRowRangeHeightsMap = true) {
43184
+ typeof window !== 'undefined' ? window.performance.now() : 0;
43169
43185
  if (table.heightMode === 'autoHeight' || table.heightMode === 'adaptive') {
43170
43186
  rowStart = rowStart ?? 0;
43171
43187
  rowEnd = rowEnd ?? table.rowCount - 1;
43172
- if (rowStart === 0 && rowEnd === table.rowCount - 1) {
43188
+ if ((rowStart === 0 && rowEnd === table.rowCount - 1) || isClearRowRangeHeightsMap) {
43173
43189
  table._clearRowRangeHeightsMap();
43174
43190
  }
43175
- else {
43176
- for (let row = rowStart; row <= rowEnd; row++) {
43177
- table._clearRowRangeHeightsMap(row);
43178
- }
43179
- }
43180
43191
  for (let row = rowStart; row < table.columnHeaderLevelCount; row++) {
43181
43192
  const height = computeRowHeight(row, 0, table.colCount - 1, table);
43182
43193
  table.setRowHeight(row, height);
@@ -43184,24 +43195,31 @@
43184
43195
  if (rowEnd < table.columnHeaderLevelCount) {
43185
43196
  return;
43186
43197
  }
43187
- if (!table.internalProps.transpose &&
43188
- !(table.isPivotTable() && table.internalProps.layoutMap.indicatorsAsCol) &&
43198
+ if (!(table.internalProps.transpose ||
43199
+ (table.isPivotTable() && !table.internalProps.layoutMap.indicatorsAsCol)) &&
43189
43200
  checkFixedStyleAndNoWrap(table)) {
43190
43201
  const height = computeRowHeight(table.columnHeaderLevelCount, 0, table.colCount - 1, table);
43191
- fillRowsHeight(height, table.columnHeaderLevelCount, table.rowCount - 1, table);
43202
+ fillRowsHeight(height, table.columnHeaderLevelCount, table.rowCount - 1 - table.bottomFrozenRowCount, table);
43203
+ for (let row = table.rowCount - table.bottomFrozenRowCount; row <= rowEnd; row++) {
43204
+ const height = computeRowHeight(row, 0, table.colCount - 1, table);
43205
+ table.setRowHeight(row, height);
43206
+ }
43192
43207
  }
43193
- else if ((table.internalProps.transpose ||
43194
- (table.isPivotTable() && !table.internalProps.layoutMap.indicatorsAsCol)) &&
43195
- checkFixedStyleAndNoWrap(table)) {
43208
+ else if (table.internalProps.transpose ||
43209
+ (table.isPivotTable() && !table.internalProps.layoutMap.indicatorsAsCol)) {
43196
43210
  for (let row = Math.max(rowStart, table.columnHeaderLevelCount); row <= rowEnd; row++) {
43197
- table._clearRowRangeHeightsMap(row);
43198
- const height = computeRowHeight(row, 0, table.rowHeaderLevelCount, table);
43211
+ let height;
43212
+ if (checkFixedStyleAndNoWrapForTranspose(table, row)) {
43213
+ height = computeRowHeight(row, 0, table.rowHeaderLevelCount, table);
43214
+ }
43215
+ else {
43216
+ height = computeRowHeight(row, 0, table.colCount - 1, table);
43217
+ }
43199
43218
  table.setRowHeight(row, height);
43200
43219
  }
43201
43220
  }
43202
43221
  else {
43203
43222
  for (let row = Math.max(rowStart, table.columnHeaderLevelCount); row <= rowEnd; row++) {
43204
- table._clearRowRangeHeightsMap(row);
43205
43223
  const height = computeRowHeight(row, 0, table.colCount - 1, table);
43206
43224
  table.setRowHeight(row, height);
43207
43225
  }
@@ -43227,7 +43245,6 @@
43227
43245
  table.setRowHeight(row, rowHeight, false);
43228
43246
  }
43229
43247
  }
43230
- console.log('computeRowsHeight time:', (typeof window !== 'undefined' ? window.performance.now() : 0) - time);
43231
43248
  }
43232
43249
  function computeRowHeight(row, startCol, endCol, table) {
43233
43250
  let maxHeight = 0;
@@ -43269,14 +43286,16 @@
43269
43286
  function checkFixedStyleAndNoWrap(table) {
43270
43287
  const { layoutMap } = table.internalProps;
43271
43288
  const row = table.columnHeaderLevelCount;
43289
+ if (table.internalProps.autoWrapText &&
43290
+ (table.options.heightMode === 'autoHeight' || table.options.heightMode === 'adaptive')) {
43291
+ return false;
43292
+ }
43272
43293
  for (let col = 0; col < table.colCount; col++) {
43273
- const isHeader = layoutMap.isHeader(col, row);
43274
- const cellDefine = isHeader ? layoutMap.getHeader(col, row) : layoutMap.getBody(col, row);
43294
+ const cellDefine = layoutMap.getBody(col, row);
43275
43295
  if (typeof cellDefine.style === 'function' ||
43276
43296
  typeof cellDefine.icon === 'function' ||
43277
- typeof cellDefine.headerIcon === 'function' ||
43278
- (isHeader ? cellDefine.define?.headerCustomRender : cellDefine.define?.customRender) ||
43279
- (isHeader ? typeof cellDefine.define?.headerIcon === 'function' : typeof cellDefine.define?.icon === 'function')) {
43297
+ cellDefine.define?.customRender ||
43298
+ typeof cellDefine.define?.icon === 'function') {
43280
43299
  return false;
43281
43300
  }
43282
43301
  const cellStyle = table._getCellStyle(col, row);
@@ -43289,6 +43308,28 @@
43289
43308
  }
43290
43309
  return true;
43291
43310
  }
43311
+ function checkFixedStyleAndNoWrapForTranspose(table, row) {
43312
+ const { layoutMap } = table.internalProps;
43313
+ if (table.internalProps.autoWrapText &&
43314
+ (table.options.heightMode === 'autoHeight' || table.options.heightMode === 'adaptive')) {
43315
+ return false;
43316
+ }
43317
+ const cellDefine = layoutMap.getBody(table.rowHeaderLevelCount, row);
43318
+ if (typeof cellDefine.style === 'function' ||
43319
+ typeof cellDefine.icon === 'function' ||
43320
+ cellDefine.define?.customRender ||
43321
+ typeof cellDefine.define?.icon === 'function') {
43322
+ return false;
43323
+ }
43324
+ const cellStyle = table._getCellStyle(table.rowHeaderLevelCount, row);
43325
+ if (typeof cellStyle.padding === 'function' ||
43326
+ typeof cellStyle.fontSize === 'function' ||
43327
+ typeof cellStyle.lineHeight === 'function' ||
43328
+ cellStyle.autoWrapText === true) {
43329
+ return false;
43330
+ }
43331
+ return true;
43332
+ }
43292
43333
  function fillRowsHeight(height, startRow, endRow, table) {
43293
43334
  for (let row = startRow; row <= endRow; row++) {
43294
43335
  table.setRowHeight(row, height);
@@ -44127,6 +44168,9 @@
44127
44168
  colGroup.needUpdate = true;
44128
44169
  }
44129
44170
  function updateColGroupContent(colGroup, proxy) {
44171
+ if (!colGroup) {
44172
+ return;
44173
+ }
44130
44174
  let cellGroup = colGroup.firstChild;
44131
44175
  while (cellGroup) {
44132
44176
  const newCellGroup = proxy.updateCellGroupContent(cellGroup);
@@ -44308,9 +44352,7 @@
44308
44352
  syncTopRow = Math.max(distStartRow, topRow);
44309
44353
  syncBottomRow = Math.min(distEndRow, BottomRow);
44310
44354
  }
44311
- if (proxy.table.heightMode === 'autoHeight') {
44312
- computeRowsHeight(proxy.table, syncTopRow, syncBottomRow);
44313
- }
44355
+ computeRowsHeight(proxy.table, syncTopRow, syncBottomRow);
44314
44356
  proxy.rowStart = direction === 'up' ? proxy.rowStart + count : proxy.rowStart - count;
44315
44357
  proxy.rowEnd = direction === 'up' ? proxy.rowEnd + count : proxy.rowEnd - count;
44316
44358
  checkFirstRowMerge(syncTopRow, proxy);
@@ -44346,9 +44388,7 @@
44346
44388
  syncTopRow = Math.max(proxy.bodyTopRow, screenTopRow - proxy.screenRowCount * 1);
44347
44389
  syncBottomRow = Math.min(proxy.bodyBottomRow, screenTopRow + proxy.screenRowCount * 2);
44348
44390
  }
44349
- if (proxy.table.heightMode === 'autoHeight') {
44350
- computeRowsHeight(proxy.table, syncTopRow, syncBottomRow);
44351
- }
44391
+ computeRowsHeight(proxy.table, syncTopRow, syncBottomRow);
44352
44392
  proxy.rowStart = distStartRow;
44353
44393
  proxy.rowEnd = distEndRow;
44354
44394
  checkFirstRowMerge(syncTopRow, proxy);
@@ -44566,26 +44606,6 @@
44566
44606
  async createGroupForFirstScreen(cornerHeaderGroup, colHeaderGroup, rowHeaderGroup, rightFrozenGroup, bottomFrozenGroup, bodyGroup, xOrigin, yOrigin) {
44567
44607
  await createGroupForFirstScreen(cornerHeaderGroup, colHeaderGroup, rowHeaderGroup, rightFrozenGroup, bottomFrozenGroup, bodyGroup, xOrigin, yOrigin, this);
44568
44608
  }
44569
- async createColGroupForFirstScreen(rowHeaderGroup, bodyGroup, xOrigin, yOrigin, table) {
44570
- this.setParamsForRow();
44571
- this.setParamsForColumn();
44572
- computeRowsHeight(table, this.table.columnHeaderLevelCount, Math.min(this.firstScreenRowLimit, table.rowCount - 1));
44573
- createColGroup(rowHeaderGroup, xOrigin, yOrigin, 0, table.rowHeaderLevelCount - 1, table.columnHeaderLevelCount, table.rowCount - 1, 'rowHeader', table, this.firstScreenRowLimit);
44574
- createColGroup(bodyGroup, xOrigin, yOrigin, table.rowHeaderLevelCount, table.colCount - 1, table.columnHeaderLevelCount, table.rowCount - 1, 'body', table, this.firstScreenRowLimit);
44575
- if (!bodyGroup.firstChild) {
44576
- this.currentRow = this.totalRow;
44577
- this.rowEnd = this.currentRow;
44578
- this.rowUpdatePos = this.rowEnd;
44579
- this.referenceRow = Math.floor((this.rowEnd - this.rowStart) / 2);
44580
- }
44581
- else {
44582
- this.currentRow = bodyGroup.firstChild?.rowNumber ?? this.totalRow;
44583
- this.rowEnd = this.currentRow;
44584
- this.rowUpdatePos = this.rowEnd;
44585
- this.referenceRow = Math.floor((this.rowEnd - this.rowStart) / 2);
44586
- await this.progress();
44587
- }
44588
- }
44589
44609
  async progress() {
44590
44610
  return new Promise((resolve, reject) => {
44591
44611
  setTimeout(async () => {
@@ -44625,7 +44645,7 @@
44625
44645
  }
44626
44646
  createRowCellGroup(onceCount) {
44627
44647
  const endRow = Math.min(this.totalRow, this.currentRow + onceCount);
44628
- computeRowsHeight(this.table, this.currentRow + 1, endRow);
44648
+ computeRowsHeight(this.table, this.currentRow + 1, endRow, false);
44629
44649
  if (this.table.rowHeaderLevelCount) {
44630
44650
  let maxHeight = 0;
44631
44651
  for (let col = 0; col < this.table.rowHeaderLevelCount; col++) {
@@ -44731,7 +44751,7 @@
44731
44751
  updateCellGroups(count) {
44732
44752
  const distRow = Math.min(this.bodyBottomRow, this.rowUpdatePos + count);
44733
44753
  if (this.table.heightMode === 'autoHeight') {
44734
- computeRowsHeight(this.table, this.rowUpdatePos, distRow);
44754
+ computeRowsHeight(this.table, this.rowUpdatePos, distRow, false);
44735
44755
  }
44736
44756
  updateRowContent(this.rowUpdatePos, distRow, this);
44737
44757
  if (this.table.heightMode === 'autoHeight') {
@@ -44780,9 +44800,7 @@
44780
44800
  syncBottomRow = Math.min(this.bodyBottomRow, this.screenTopRow + this.screenRowCount * 3);
44781
44801
  }
44782
44802
  console.log('sort更新同步范围', syncTopRow, syncBottomRow);
44783
- if (this.table.heightMode === 'autoHeight') {
44784
- computeRowsHeight(this.table, syncTopRow, syncBottomRow);
44785
- }
44803
+ computeRowsHeight(this.table, syncTopRow, syncBottomRow);
44786
44804
  for (let col = this.bodyLeftCol; col <= this.bodyRightCol; col++) {
44787
44805
  for (let row = syncTopRow; row <= syncBottomRow; row++) {
44788
44806
  const cellGroup = this.highPerformanceGetCell(col, row);
@@ -46217,9 +46235,7 @@
46217
46235
  }
46218
46236
  resize() {
46219
46237
  this.recalculateColWidths();
46220
- if (this.table.heightMode === 'autoHeight') {
46221
- this.recalculateRowHeights();
46222
- }
46238
+ this.recalculateRowHeights();
46223
46239
  this.dealWidthMode();
46224
46240
  this.dealHeightMode();
46225
46241
  this.dealFrozen();
@@ -46735,9 +46751,7 @@
46735
46751
  updateRow(removeCells, addCells) {
46736
46752
  updateRow(removeCells, addCells, this.table);
46737
46753
  this.recalculateColWidths();
46738
- if (this.table.heightMode === 'autoHeight') {
46739
- this.recalculateRowHeights();
46740
- }
46754
+ this.recalculateRowHeights();
46741
46755
  this.table.stateManeger.checkFrozen();
46742
46756
  this.updateNextFrame();
46743
46757
  }
@@ -47474,6 +47488,9 @@
47474
47488
  sparkLine;
47475
47489
  _clearVerticalScrollBar;
47476
47490
  _clearHorizontalScrollBar;
47491
+ resetInteractionState = debounce(() => {
47492
+ this.updateInteractionState(InteractionState.default);
47493
+ }, 100);
47477
47494
  constructor(table) {
47478
47495
  this.table = table;
47479
47496
  this.initState();
@@ -48763,10 +48780,16 @@
48763
48780
  const throttleVerticalWheel = throttle(stateManeger.updateVerticalScrollBar, 20);
48764
48781
  const throttleHorizontalWheel = throttle(stateManeger.updateHorizontalScrollBar, 20);
48765
48782
  scenegraph.component.vScrollBar.addEventListener('scroll', (e) => {
48783
+ if (stateManeger.interactionState !== InteractionState.scrolling) {
48784
+ stateManeger.updateInteractionState(InteractionState.scrolling);
48785
+ }
48766
48786
  const ratio = e.detail.value[0] / (1 - e.detail.value[1] + e.detail.value[0]);
48767
48787
  throttleVerticalWheel(ratio, e);
48768
48788
  });
48769
48789
  scenegraph.component.hScrollBar.addEventListener('scroll', (e) => {
48790
+ if (stateManeger.interactionState !== InteractionState.scrolling) {
48791
+ stateManeger.updateInteractionState(InteractionState.scrolling);
48792
+ }
48770
48793
  const ratio = e.detail.value[0] / (1 - e.detail.value[1] + e.detail.value[0]);
48771
48794
  throttleHorizontalWheel(ratio);
48772
48795
  });
@@ -48779,6 +48802,11 @@
48779
48802
  deltaY = 0;
48780
48803
  }
48781
48804
  const [optimizedDeltaX, optimizedDeltaY] = optimizeScrollXY(deltaX, deltaY, { horizontal: 1, vertical: 1 });
48805
+ if (optimizedDeltaX || optimizedDeltaY) {
48806
+ if (state.interactionState !== InteractionState.scrolling) {
48807
+ state.updateInteractionState(InteractionState.scrolling);
48808
+ }
48809
+ }
48782
48810
  if (optimizedDeltaX) {
48783
48811
  state.setScrollLeft(state.scroll.horizontalBarPos + optimizedDeltaX);
48784
48812
  state.showHorizontalScrollBar(true);
@@ -48787,6 +48815,7 @@
48787
48815
  state.setScrollTop(state.scroll.verticalBarPos + optimizedDeltaY);
48788
48816
  state.showVerticalScrollBar(true);
48789
48817
  }
48818
+ state.resetInteractionState();
48790
48819
  if (event.cancelable &&
48791
48820
  ((deltaY !== 0 && isVerticalScrollable(deltaY, state)) || (deltaX !== 0 && isHorizontalScrollable(deltaX, state)))) {
48792
48821
  event.preventDefault();
@@ -48876,7 +48905,7 @@
48876
48905
  handler.on(table.getElement(), 'contextmenu', (e) => {
48877
48906
  e.preventDefault();
48878
48907
  });
48879
- handler.on(table.getParentElement(), 'resize', () => {
48908
+ handler.on(table.getContainer(), 'resize', () => {
48880
48909
  table.resize();
48881
48910
  });
48882
48911
  }
@@ -51936,15 +51965,21 @@
51936
51965
  return TABLE_EVENT_TYPE;
51937
51966
  }
51938
51967
  options;
51939
- version = "0.9.3-alpha.6";
51968
+ version = "0.9.3-alpha.7";
51940
51969
  pagerConf;
51941
51970
  id = `VTable${Date.now()}`;
51942
51971
  headerStyleCache;
51943
51972
  bodyStyleCache;
51944
- constructor(options = {}) {
51973
+ container;
51974
+ constructor(container, options = {}) {
51945
51975
  super();
51946
- const { frozenColCount = 0, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, keyboardOptions, parentElement, columnResizeMode, dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio } = options;
51976
+ if (!container) {
51977
+ throw new Error("vtable's container is undefined");
51978
+ }
51979
+ const { frozenColCount = 0, defaultRowHeight = 40, defaultHeaderRowHeight, defaultColWidth = 80, defaultHeaderColWidth, widthMode = 'standard', heightMode = 'standard', autoFillWidth = false, keyboardOptions, columnResizeMode, dragHeaderMode, showFrozenIcon, allowFrozenColCount, padding, hover, menu, select: click, customRender, pixelRatio = defaultPixelRatio } = options;
51980
+ this.container = container;
51947
51981
  this.options = options;
51982
+ this.options.container = container;
51948
51983
  this._widthMode = widthMode;
51949
51984
  this._heightMode = heightMode;
51950
51985
  this._autoFillWidth = autoFillWidth;
@@ -52001,9 +52036,9 @@
52001
52036
  internalProps.cellTextOverflows = {};
52002
52037
  internalProps.focusedTable = false;
52003
52038
  internalProps.theme = themes.of(options.theme ?? themes.DEFAULT);
52004
- if (parentElement) {
52005
- parentElement.innerHTML = '';
52006
- parentElement.appendChild(internalProps.element);
52039
+ if (container) {
52040
+ container.innerHTML = '';
52041
+ container.appendChild(internalProps.element);
52007
52042
  this._updateSize();
52008
52043
  }
52009
52044
  else {
@@ -52056,8 +52091,8 @@
52056
52091
  this.bodyStyleCache = new Map();
52057
52092
  }
52058
52093
  throttleInvalidate = throttle2(this.render.bind(this), 200);
52059
- getParentElement() {
52060
- return this.options.parentElement;
52094
+ getContainer() {
52095
+ return this.container;
52061
52096
  }
52062
52097
  getElement() {
52063
52098
  return this.internalProps.element;
@@ -52378,12 +52413,6 @@
52378
52413
  this._clearRowRangeHeightsMap(row);
52379
52414
  }
52380
52415
  }
52381
- fillRowsHeight(rowStart, rowEnd, rowHeight) {
52382
- for (let row = rowStart; row <= rowEnd; row++) {
52383
- this.rowHeightsMap.put(row, Math.round(rowHeight));
52384
- this._rowRangeHeightsMap.set(`$0$${row}`, Math.round((this._rowRangeHeightsMap.get(`$0$${row - 1}`) ?? 0) + rowHeight));
52385
- }
52386
- }
52387
52416
  getRowsHeight(startRow, endRow) {
52388
52417
  const cachedRowHeight = this._rowRangeHeightsMap.get(`$${startRow}$${endRow}`);
52389
52418
  if (cachedRowHeight !== null && cachedRowHeight !== undefined) {
@@ -54830,8 +54859,17 @@
54830
54859
 
54831
54860
  class ListTable extends BaseTable {
54832
54861
  showHeader = true;
54833
- constructor(options = {}) {
54834
- super(options);
54862
+ constructor(container, options) {
54863
+ if (!(container instanceof HTMLElement)) {
54864
+ options = container;
54865
+ if (container.container) {
54866
+ container = container.container;
54867
+ }
54868
+ else {
54869
+ container = null;
54870
+ }
54871
+ }
54872
+ super(container, options);
54835
54873
  const internalProps = this.internalProps;
54836
54874
  this.pagerConf = options.pagerConf;
54837
54875
  internalProps.sortState = options.sortState;
@@ -59397,8 +59435,17 @@
59397
59435
  pivotSortState;
59398
59436
  dataset;
59399
59437
  flatDataToObjects;
59400
- constructor(options) {
59401
- super(options);
59438
+ constructor(container, options) {
59439
+ if (!(container instanceof HTMLElement)) {
59440
+ options = container;
59441
+ if (container.container) {
59442
+ container = container.container;
59443
+ }
59444
+ else {
59445
+ container = null;
59446
+ }
59447
+ }
59448
+ super(container, options);
59402
59449
  if (options.layout) {
59403
59450
  Object.assign(options, options.layout);
59404
59451
  }
@@ -59838,8 +59885,17 @@
59838
59885
  _selectedDimensionInChart = [];
59839
59886
  _chartEventMap = {};
59840
59887
  _axes;
59841
- constructor(options) {
59842
- super(options);
59888
+ constructor(container, options) {
59889
+ if (!(container instanceof HTMLElement)) {
59890
+ options = container;
59891
+ if (container.container) {
59892
+ container = container.container;
59893
+ }
59894
+ else {
59895
+ container = null;
59896
+ }
59897
+ }
59898
+ super(container, options);
59843
59899
  if (options.layout) {
59844
59900
  Object.assign(options, options.layout);
59845
59901
  }
@@ -60412,11 +60468,11 @@
60412
60468
  });
60413
60469
  }
60414
60470
  onVChartEvent(type, query, callback) {
60415
- if (query) {
60416
- this._chartEventMap[type] = { callback, query };
60471
+ if (typeof query === 'function') {
60472
+ this._chartEventMap[type] = { callback: query };
60417
60473
  }
60418
60474
  else {
60419
- this._chartEventMap[type] = { callback };
60475
+ this._chartEventMap[type] = { callback, query };
60420
60476
  }
60421
60477
  }
60422
60478
  offVChartEvent(type) {
@@ -61053,6 +61109,7 @@
61053
61109
  getSize(table) {
61054
61110
  const { width, height } = table.measureText(this.text, {
61055
61111
  fontSize: this.fontSize,
61112
+ fontWeight: this.fontWeight,
61056
61113
  fontFamily: this.fontFamily
61057
61114
  });
61058
61115
  this.width = width;
@@ -61111,7 +61168,7 @@
61111
61168
  percentCalc: percentCalc
61112
61169
  });
61113
61170
 
61114
- const version = "0.9.3-alpha.6";
61171
+ const version = "0.9.3-alpha.7";
61115
61172
  function getIcons() {
61116
61173
  return get$1();
61117
61174
  }