@visactor/vtable 0.21.3-alpha.1 → 0.21.3

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 (69) hide show
  1. package/cjs/ListTable.js.map +1 -1
  2. package/cjs/core/BaseTable.js +21 -7
  3. package/cjs/core/BaseTable.js.map +1 -1
  4. package/cjs/data/DataSource.js +5 -1
  5. package/cjs/data/DataSource.js.map +1 -1
  6. package/cjs/index.d.ts +1 -1
  7. package/cjs/index.js +1 -1
  8. package/cjs/index.js.map +1 -1
  9. package/cjs/layout/pivot-header-layout.js +1 -1
  10. package/cjs/layout/pivot-header-layout.js.map +1 -1
  11. package/cjs/scenegraph/group-creater/cell-helper.d.ts +1 -0
  12. package/cjs/scenegraph/group-creater/cell-helper.js +16 -26
  13. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  14. package/cjs/scenegraph/group-creater/cell-type/image-cell.js +3 -2
  15. package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  16. package/cjs/scenegraph/group-creater/column-helper.js +3 -2
  17. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  18. package/cjs/scenegraph/group-creater/progress/proxy.js +4 -5
  19. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  20. package/cjs/scenegraph/icon/icon-update.js +3 -2
  21. package/cjs/scenegraph/icon/icon-update.js.map +1 -1
  22. package/cjs/scenegraph/select/update-select-border.d.ts +2 -0
  23. package/cjs/scenegraph/select/update-select-border.js +19 -2
  24. package/cjs/scenegraph/select/update-select-border.js.map +1 -1
  25. package/cjs/state/hover/update-cell.js +3 -2
  26. package/cjs/state/hover/update-cell.js.map +1 -1
  27. package/cjs/state/state.js +1 -1
  28. package/cjs/themes/theme.js +1 -1
  29. package/cjs/tools/merge-range.js +6 -0
  30. package/cjs/tools/merge-range.js.map +1 -1
  31. package/cjs/ts-types/new-data-set.d.ts +2 -1
  32. package/cjs/ts-types/new-data-set.js.map +1 -1
  33. package/cjs/vrender.js.map +1 -1
  34. package/dist/vtable.js +75 -55
  35. package/dist/vtable.min.js +2 -2
  36. package/es/ListTable.js.map +1 -1
  37. package/es/core/BaseTable.js +20 -7
  38. package/es/core/BaseTable.js.map +1 -1
  39. package/es/data/DataSource.js +5 -1
  40. package/es/data/DataSource.js.map +1 -1
  41. package/es/index.d.ts +1 -1
  42. package/es/index.js +1 -1
  43. package/es/index.js.map +1 -1
  44. package/es/layout/pivot-header-layout.js +1 -1
  45. package/es/layout/pivot-header-layout.js.map +1 -1
  46. package/es/scenegraph/group-creater/cell-helper.d.ts +1 -0
  47. package/es/scenegraph/group-creater/cell-helper.js +12 -24
  48. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  49. package/es/scenegraph/group-creater/cell-type/image-cell.js +1 -1
  50. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  51. package/es/scenegraph/group-creater/column-helper.js +5 -4
  52. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  53. package/es/scenegraph/group-creater/progress/proxy.js +4 -5
  54. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  55. package/es/scenegraph/icon/icon-update.js +1 -1
  56. package/es/scenegraph/icon/icon-update.js.map +1 -1
  57. package/es/scenegraph/select/update-select-border.d.ts +2 -0
  58. package/es/scenegraph/select/update-select-border.js +16 -0
  59. package/es/scenegraph/select/update-select-border.js.map +1 -1
  60. package/es/state/hover/update-cell.js +1 -1
  61. package/es/state/hover/update-cell.js.map +1 -1
  62. package/es/state/state.js +1 -1
  63. package/es/themes/theme.js +1 -1
  64. package/es/tools/merge-range.js +6 -0
  65. package/es/tools/merge-range.js.map +1 -1
  66. package/es/ts-types/new-data-set.d.ts +2 -1
  67. package/es/ts-types/new-data-set.js.map +1 -1
  68. package/es/vrender.js.map +1 -1
  69. package/package.json +6 -6
package/dist/vtable.js CHANGED
@@ -33840,11 +33840,20 @@
33840
33840
  if (typeof field === 'string' || typeof field === 'number') {
33841
33841
  const beforeChangedValue = this.beforeChangedRecordsMap[dataIndex][field];
33842
33842
  const record = this.getOriginalRecord(dataIndex);
33843
+ let formatValue = value;
33843
33844
  if (typeof beforeChangedValue === 'number' && isAllDigits(value)) {
33844
- record[field] = parseFloat(value);
33845
+ formatValue = parseFloat(value);
33846
+ }
33847
+ if (isPromise(record)) {
33848
+ record
33849
+ .then(record => {
33850
+ record[field] = formatValue;
33851
+ })
33852
+ .catch((err) => {
33853
+ });
33845
33854
  }
33846
33855
  else {
33847
- record[field] = value;
33856
+ record[field] = formatValue;
33848
33857
  }
33849
33858
  }
33850
33859
  }
@@ -36197,7 +36206,8 @@
36197
36206
  }
36198
36207
  }
36199
36208
  function getCellRange(cellGroup, table) {
36200
- if (isValid$3(cellGroup.mergeStartCol) &&
36209
+ if (cellGroup.role === 'cell' &&
36210
+ isValid$3(cellGroup.mergeStartCol) &&
36201
36211
  isValid$3(cellGroup.mergeEndCol) &&
36202
36212
  isValid$3(cellGroup.mergeStartRow) &&
36203
36213
  isValid$3(cellGroup.mergeEndRow)) {
@@ -38171,16 +38181,6 @@
38171
38181
  if (isPromise(value)) {
38172
38182
  value = table.getCellValue(col, row);
38173
38183
  }
38174
- let bgColorFunc;
38175
- if (table.internalProps?.dataConfig?.mappingRules && !table.isHeader(col, row)) {
38176
- table.internalProps?.dataConfig?.mappingRules?.forEach((mappingRule, i) => {
38177
- if (mappingRule.bgColor &&
38178
- table.internalProps.layoutMap.getIndicatorKey(col, row) ===
38179
- mappingRule.bgColor.indicatorKey) {
38180
- bgColorFunc = mappingRule.bgColor.mapping;
38181
- }
38182
- });
38183
- }
38184
38184
  let cellGroup;
38185
38185
  if (type === 'text' || type === 'link') {
38186
38186
  if (type === 'link') {
@@ -38206,22 +38206,6 @@
38206
38206
  }
38207
38207
  }
38208
38208
  }
38209
- if (bgColorFunc) {
38210
- const cellValue = table.getCellOriginValue(col, row);
38211
- const bgColor = bgColorFunc(table, cellValue);
38212
- if (bgColor) {
38213
- if (cellTheme) {
38214
- cellTheme.group.fill = bgColor;
38215
- }
38216
- else {
38217
- cellTheme = {
38218
- group: {
38219
- fill: bgColor
38220
- }
38221
- };
38222
- }
38223
- }
38224
- }
38225
38209
  let customElementsGroup;
38226
38210
  let renderDefault = true;
38227
38211
  if (customResult) {
@@ -38423,16 +38407,6 @@
38423
38407
  const textAlign = cellTheme.text.textAlign;
38424
38408
  const textBaseline = cellTheme.text.textBaseline;
38425
38409
  let newCellGroup;
38426
- let bgColorFunc;
38427
- if (table.internalProps?.dataConfig?.mappingRules && !table.isHeader(col, row)) {
38428
- table.internalProps?.dataConfig?.mappingRules?.forEach((mappingRule, i) => {
38429
- if (mappingRule.bgColor &&
38430
- table.internalProps.layoutMap.getIndicatorKey(col, row) ===
38431
- mappingRule.bgColor.indicatorKey) {
38432
- bgColorFunc = mappingRule.bgColor.mapping;
38433
- }
38434
- });
38435
- }
38436
38410
  let cellWidth;
38437
38411
  let cellHeight;
38438
38412
  if (range) {
@@ -38445,10 +38419,10 @@
38445
38419
  }
38446
38420
  if (isPromise(value)) {
38447
38421
  oldCellGroup.removeAllChild();
38448
- dealPromiseData(value, table, updateCellContent.bind(null, type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult));
38422
+ dealPromiseData(value, table, updateCellContent.bind(null, type, value, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult));
38449
38423
  }
38450
38424
  else {
38451
- newCellGroup = updateCellContent(type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult);
38425
+ newCellGroup = updateCellContent(type, value, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult);
38452
38426
  }
38453
38427
  if (isMerge) {
38454
38428
  const { width: contentWidth } = newCellGroup.attribute;
@@ -38459,7 +38433,7 @@
38459
38433
  }
38460
38434
  return newCellGroup;
38461
38435
  }
38462
- function updateCellContent(type, value, define, table, col, row, bgColorFunc, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult) {
38436
+ function updateCellContent(type, value, define, table, col, row, cellWidth, cellHeight, oldCellGroup, padding, textAlign, textBaseline, mayHaveIcon, addNew, cellTheme, range, customResult) {
38463
38437
  if (isPromise(value)) {
38464
38438
  value = table.getCellValue(col, row);
38465
38439
  }
@@ -38498,10 +38472,10 @@
38498
38472
  for (let col = range.start.col; col <= range.end.col; col++) {
38499
38473
  for (let row = range.start.row; row <= range.end.row; row++) {
38500
38474
  const cellGroup = table.scenegraph.getCell(col, row, true);
38501
- if (range.start.row !== range.end.row) {
38475
+ if (cellGroup.role === 'cell' && range.start.row !== range.end.row && cellGroup.contentWidth !== cellWidth) {
38502
38476
  updateCellContentHeight(cellGroup, cellHeight, cellHeight, table.heightMode === 'autoHeight', padding, textAlign, textBaseline);
38503
38477
  }
38504
- if (range.start.col !== range.end.col) {
38478
+ if (cellGroup.role === 'cell' && range.start.col !== range.end.col && cellGroup.contentHeight !== cellHeight) {
38505
38479
  updateCellContentWidth(cellGroup, cellWidth, cellHeight, 0, table.heightMode === 'autoHeight', padding, textAlign, textBaseline, table.scenegraph);
38506
38480
  }
38507
38481
  cellGroup.contentWidth = cellWidth;
@@ -40102,6 +40076,14 @@
40102
40076
  }
40103
40077
 
40104
40078
  function getCellMergeRange(cellGroup, scene) {
40079
+ if (!scene || !scene.proxy) {
40080
+ return {
40081
+ colStart: 0,
40082
+ colEnd: 0,
40083
+ rowStart: 0,
40084
+ rowEnd: 0
40085
+ };
40086
+ }
40105
40087
  const { mergeStartCol, mergeEndCol, mergeStartRow, mergeEndRow, col, row } = cellGroup;
40106
40088
  const { colStart, colEnd, rowStart, rowEnd, bodyLeftCol, bodyRightCol, bodyTopRow, bodyBottomRow } = scene.proxy;
40107
40089
  let cellRangeColStart = mergeStartCol;
@@ -43637,12 +43619,12 @@
43637
43619
  columnGroup.updateColumnRowNumber(row);
43638
43620
  if (isMerge) {
43639
43621
  const rangeHeight = table.getRowHeight(row);
43640
- const rangeWidth = table.getColWidth(col);
43622
+ table.getColWidth(col);
43641
43623
  const { width: contentWidth } = cellGroup.attribute;
43642
43624
  const { height: contentHeight } = cellGroup.attribute;
43643
43625
  cellGroup.contentWidth = contentWidth;
43644
43626
  cellGroup.contentHeight = contentHeight;
43645
- resizeCellGroup(cellGroup, rangeWidth, rangeHeight, range, table);
43627
+ dealWithMergeCellSize(range, contentWidth, contentHeight, padding, textAlign, textBaseline, table);
43646
43628
  columnGroup.updateColumnHeight(rangeHeight);
43647
43629
  y += rangeHeight;
43648
43630
  }
@@ -44650,7 +44632,6 @@
44650
44632
  this.currentRow = endRow;
44651
44633
  this.rowEnd = endRow;
44652
44634
  this.rowUpdatePos = this.rowEnd;
44653
- this.referenceRow = this.rowStart + Math.floor((endRow - this.rowStart) / 2);
44654
44635
  this.table.scenegraph.updateContainer();
44655
44636
  this.table.scenegraph.updateBorderSizeAndPosition();
44656
44637
  }
@@ -44659,7 +44640,7 @@
44659
44640
  computeColsWidth(this.table, this.currentCol + 1, endCol);
44660
44641
  for (let row = 0; row < this.table.rowCount; row++) {
44661
44642
  const cellGroup = this.highPerformanceGetCell(this.currentCol, row);
44662
- if (isNumber$4(cellGroup.mergeStartCol) && cellGroup.mergeStartCol > this.currentCol) {
44643
+ if (cellGroup.role === 'cell' && isNumber$4(cellGroup.mergeStartCol) && cellGroup.mergeStartCol > this.currentCol) {
44663
44644
  this.table.scenegraph.updateCellContent(cellGroup.col, cellGroup.row);
44664
44645
  }
44665
44646
  }
@@ -44696,7 +44677,6 @@
44696
44677
  this.currentCol = endCol;
44697
44678
  this.colEnd = endCol;
44698
44679
  this.colUpdatePos = this.colEnd;
44699
- this.referenceCol = this.colStart + Math.floor((endCol - this.colStart) / 2);
44700
44680
  this.table.scenegraph.updateContainer();
44701
44681
  this.table.scenegraph.updateBorderSizeAndPosition();
44702
44682
  }
@@ -45398,6 +45378,22 @@
45398
45378
  scene.createCellSelectBorder(columnHeaderStartCol, columnHeaderStartRow, columnHeaderEndCol, columnHeaderEndRow, 'body', `${startCol}${startRow}${endCol}${endRow}`, strokeArray);
45399
45379
  }
45400
45380
  }
45381
+ function hideCellSelectBorder(scene) {
45382
+ scene.selectingRangeComponents.forEach((selectComp, key) => {
45383
+ selectComp.rect.setAttribute('visible', false);
45384
+ });
45385
+ scene.selectedRangeComponents.forEach((selectComp, key) => {
45386
+ selectComp.rect.setAttribute('visible', false);
45387
+ });
45388
+ }
45389
+ function restoreCellSelectBorder(scene) {
45390
+ scene.selectingRangeComponents.forEach((selectComp, key) => {
45391
+ selectComp.rect.setAttribute('visible', false);
45392
+ });
45393
+ scene.selectedRangeComponents.forEach((selectComp, key) => {
45394
+ selectComp.rect.setAttribute('visible', false);
45395
+ });
45396
+ }
45401
45397
 
45402
45398
  function createCellSelectBorder(scene, start_Col, start_Row, end_Col, end_Row, selectRangeType, selectId, strokes) {
45403
45399
  const startCol = Math.min(start_Col, end_Col);
@@ -46836,7 +46832,8 @@
46836
46832
  }
46837
46833
  function updateCellRangeIcon(col, row, filter, dealer, scene) {
46838
46834
  const cellGroup = scene.getCell(col, row);
46839
- if (isValid$3(cellGroup.mergeStartCol) &&
46835
+ if (cellGroup.role === 'cell' &&
46836
+ isValid$3(cellGroup.mergeStartCol) &&
46840
46837
  isValid$3(cellGroup.mergeStartRow) &&
46841
46838
  isValid$3(cellGroup.mergeEndCol) &&
46842
46839
  isValid$3(cellGroup.mergeEndRow)) {
@@ -48486,7 +48483,8 @@
48486
48483
 
48487
48484
  function updateCell(scenegraph, col, row) {
48488
48485
  const cellGroup = scenegraph.highPerformanceGetCell(col, row);
48489
- if (isValid$3(cellGroup.mergeStartCol) &&
48486
+ if (cellGroup.role === 'cell' &&
48487
+ isValid$3(cellGroup.mergeStartCol) &&
48490
48488
  isValid$3(cellGroup.mergeStartRow) &&
48491
48489
  isValid$3(cellGroup.mergeEndCol) &&
48492
48490
  isValid$3(cellGroup.mergeEndRow)) {
@@ -55207,7 +55205,7 @@
55207
55205
  return TABLE_EVENT_TYPE;
55208
55206
  }
55209
55207
  options;
55210
- version = "0.21.3-alpha.1";
55208
+ version = "0.21.3";
55211
55209
  pagination;
55212
55210
  id = `VTable${Date.now()}`;
55213
55211
  headerStyleCache;
@@ -56970,6 +56968,16 @@
56970
56968
  }
56971
56969
  return cacheStyle;
56972
56970
  }
56971
+ let bgColorFunc;
56972
+ if (this.internalProps?.dataConfig?.mappingRules && !this.isHeader(col, row)) {
56973
+ this.internalProps?.dataConfig?.mappingRules?.forEach((mappingRule, i) => {
56974
+ if (mappingRule.bgColor &&
56975
+ this.internalProps.layoutMap.getIndicatorKey(col, row) ===
56976
+ mappingRule.bgColor.indicatorKey) {
56977
+ bgColorFunc = mappingRule.bgColor.mapping;
56978
+ }
56979
+ });
56980
+ }
56973
56981
  let cacheKey;
56974
56982
  const cellType = this.getCellType(col, row);
56975
56983
  if ((this.isListTable() && !this.transpose) ||
@@ -57007,6 +57015,9 @@
57007
57015
  dataValue: this.getCellOriginValue(col, row),
57008
57016
  cellHeaderPaths: this.getCellHeaderPaths(col, row)
57009
57017
  }, styleClass, this.options.autoWrapText, this.theme);
57018
+ if (bgColorFunc) {
57019
+ cacheStyle = mergeStyle(cacheStyle, { bgColor: bgColorFunc });
57020
+ }
57010
57021
  if (!isFunction$3(style)) {
57011
57022
  if (layoutMap.isBottomFrozenRow(row)) {
57012
57023
  this.bodyBottomStyleCache.set(cacheKey, cacheStyle);
@@ -57294,7 +57305,7 @@
57294
57305
  const copyCellValue = getCopyCellValue(c, r, range);
57295
57306
  if (typeof Promise !== 'undefined' && copyCellValue instanceof Promise) ;
57296
57307
  else {
57297
- const strCellValue = `${copyCellValue}`;
57308
+ const strCellValue = isValid$3(copyCellValue) ? `${copyCellValue}` : '';
57298
57309
  if (/^\[object .*\]$/.exec(strCellValue)) ;
57299
57310
  else {
57300
57311
  copyValue += strCellValue;
@@ -57468,11 +57479,20 @@
57468
57479
  this.scrollToCell({ col, row });
57469
57480
  }
57470
57481
  const cellRect = this.getCellRelativeRect(col, row);
57482
+ if (this.stateManager.select?.ranges?.length > 0) {
57483
+ hideCellSelectBorder(this.scenegraph);
57484
+ }
57485
+ const { col: hoverCol, row: hoverRow } = this.stateManager.hover.cellPos;
57486
+ this.stateManager.updateHoverPos(-1, -1);
57471
57487
  const c = this.scenegraph.stage.toCanvas(false, new AABBBounds$1().set(cellRect.left + this.tableX + 1, cellRect.top + this.tableY + 1, cellRect.right + this.tableX, cellRect.bottom + this.tableY));
57472
57488
  if (!isInView) {
57473
57489
  this.setScrollTop(scrollTop);
57474
57490
  this.setScrollLeft(scrollLeft);
57475
57491
  }
57492
+ if (this.stateManager.select?.ranges?.length > 0) {
57493
+ restoreCellSelectBorder(this.scenegraph);
57494
+ }
57495
+ this.stateManager.updateHoverPos(hoverCol, hoverRow);
57476
57496
  return c.toDataURL();
57477
57497
  }
57478
57498
  exportCellRangeImg(cellRange) {
@@ -62675,7 +62695,7 @@
62675
62695
  dimension.indicatorKey === rowDimension.indicatorKey &&
62676
62696
  (!rowDimension.value || dimension.value === rowDimension.value))) {
62677
62697
  rowArr = dimension.children;
62678
- if (needLowestLevel && !rowArr) {
62698
+ if (needLowestLevel && (!rowArr || rowArr.some(row => row.dimensionKey === 'axis'))) {
62679
62699
  rowDimensionFinded = dimension;
62680
62700
  }
62681
62701
  else if (!needLowestLevel) {
@@ -66795,7 +66815,7 @@
66795
66815
  }
66796
66816
 
66797
66817
  registerForVrender();
66798
- const version = "0.21.3-alpha.1";
66818
+ const version = "0.21.3";
66799
66819
  function getIcons() {
66800
66820
  return get$2();
66801
66821
  }