@visactor/vtable 0.21.3-alpha.2 → 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 (59) hide show
  1. package/cjs/ListTable.js.map +1 -1
  2. package/cjs/core/BaseTable.js +11 -5
  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/dataset/dataset.js +1 -0
  7. package/cjs/event/scroll.js +0 -1
  8. package/cjs/index.d.ts +1 -1
  9. package/cjs/index.js +1 -1
  10. package/cjs/index.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/state/hover/update-cell.js +3 -2
  23. package/cjs/state/hover/update-cell.js.map +1 -1
  24. package/cjs/tools/merge-range.js +6 -0
  25. package/cjs/tools/merge-range.js.map +1 -1
  26. package/cjs/ts-types/new-data-set.d.ts +2 -1
  27. package/cjs/ts-types/new-data-set.js.map +1 -1
  28. package/cjs/vrender.js.map +1 -1
  29. package/dist/vtable.js +49 -54
  30. package/dist/vtable.min.js +2 -2
  31. package/es/ListTable.js.map +1 -1
  32. package/es/core/BaseTable.js +10 -5
  33. package/es/core/BaseTable.js.map +1 -1
  34. package/es/data/DataSource.js +5 -1
  35. package/es/data/DataSource.js.map +1 -1
  36. package/es/dataset/dataset.js +2 -1
  37. package/es/event/scroll.js +1 -2
  38. package/es/index.d.ts +1 -1
  39. package/es/index.js +1 -1
  40. package/es/index.js.map +1 -1
  41. package/es/scenegraph/group-creater/cell-helper.d.ts +1 -0
  42. package/es/scenegraph/group-creater/cell-helper.js +12 -24
  43. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  44. package/es/scenegraph/group-creater/cell-type/image-cell.js +1 -1
  45. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  46. package/es/scenegraph/group-creater/column-helper.js +5 -4
  47. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  48. package/es/scenegraph/group-creater/progress/proxy.js +4 -5
  49. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  50. package/es/scenegraph/icon/icon-update.js +1 -1
  51. package/es/scenegraph/icon/icon-update.js.map +1 -1
  52. package/es/state/hover/update-cell.js +1 -1
  53. package/es/state/hover/update-cell.js.map +1 -1
  54. package/es/tools/merge-range.js +6 -0
  55. package/es/tools/merge-range.js.map +1 -1
  56. package/es/ts-types/new-data-set.d.ts +2 -1
  57. package/es/ts-types/new-data-set.js.map +1 -1
  58. package/es/vrender.js.map +1 -1
  59. 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
  }
@@ -46852,7 +46832,8 @@
46852
46832
  }
46853
46833
  function updateCellRangeIcon(col, row, filter, dealer, scene) {
46854
46834
  const cellGroup = scene.getCell(col, row);
46855
- if (isValid$3(cellGroup.mergeStartCol) &&
46835
+ if (cellGroup.role === 'cell' &&
46836
+ isValid$3(cellGroup.mergeStartCol) &&
46856
46837
  isValid$3(cellGroup.mergeStartRow) &&
46857
46838
  isValid$3(cellGroup.mergeEndCol) &&
46858
46839
  isValid$3(cellGroup.mergeEndRow)) {
@@ -48502,7 +48483,8 @@
48502
48483
 
48503
48484
  function updateCell(scenegraph, col, row) {
48504
48485
  const cellGroup = scenegraph.highPerformanceGetCell(col, row);
48505
- if (isValid$3(cellGroup.mergeStartCol) &&
48486
+ if (cellGroup.role === 'cell' &&
48487
+ isValid$3(cellGroup.mergeStartCol) &&
48506
48488
  isValid$3(cellGroup.mergeStartRow) &&
48507
48489
  isValid$3(cellGroup.mergeEndCol) &&
48508
48490
  isValid$3(cellGroup.mergeEndRow)) {
@@ -55223,7 +55205,7 @@
55223
55205
  return TABLE_EVENT_TYPE;
55224
55206
  }
55225
55207
  options;
55226
- version = "0.21.3-alpha.2";
55208
+ version = "0.21.3";
55227
55209
  pagination;
55228
55210
  id = `VTable${Date.now()}`;
55229
55211
  headerStyleCache;
@@ -56986,6 +56968,16 @@
56986
56968
  }
56987
56969
  return cacheStyle;
56988
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
+ }
56989
56981
  let cacheKey;
56990
56982
  const cellType = this.getCellType(col, row);
56991
56983
  if ((this.isListTable() && !this.transpose) ||
@@ -57023,6 +57015,9 @@
57023
57015
  dataValue: this.getCellOriginValue(col, row),
57024
57016
  cellHeaderPaths: this.getCellHeaderPaths(col, row)
57025
57017
  }, styleClass, this.options.autoWrapText, this.theme);
57018
+ if (bgColorFunc) {
57019
+ cacheStyle = mergeStyle(cacheStyle, { bgColor: bgColorFunc });
57020
+ }
57026
57021
  if (!isFunction$3(style)) {
57027
57022
  if (layoutMap.isBottomFrozenRow(row)) {
57028
57023
  this.bodyBottomStyleCache.set(cacheKey, cacheStyle);
@@ -57310,7 +57305,7 @@
57310
57305
  const copyCellValue = getCopyCellValue(c, r, range);
57311
57306
  if (typeof Promise !== 'undefined' && copyCellValue instanceof Promise) ;
57312
57307
  else {
57313
- const strCellValue = `${copyCellValue}`;
57308
+ const strCellValue = isValid$3(copyCellValue) ? `${copyCellValue}` : '';
57314
57309
  if (/^\[object .*\]$/.exec(strCellValue)) ;
57315
57310
  else {
57316
57311
  copyValue += strCellValue;
@@ -66820,7 +66815,7 @@
66820
66815
  }
66821
66816
 
66822
66817
  registerForVrender();
66823
- const version = "0.21.3-alpha.2";
66818
+ const version = "0.21.3";
66824
66819
  function getIcons() {
66825
66820
  return get$2();
66826
66821
  }