@visactor/vtable 0.19.1 → 0.19.2-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/cjs/core/BaseTable.d.ts +1 -0
  2. package/cjs/core/BaseTable.js +15 -15
  3. package/cjs/core/BaseTable.js.map +1 -1
  4. package/cjs/index.d.ts +1 -1
  5. package/cjs/index.js +1 -1
  6. package/cjs/index.js.map +1 -1
  7. package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
  8. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  9. package/cjs/scenegraph/layout/compute-col-width.js +2 -2
  10. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  11. package/cjs/scenegraph/layout/compute-row-height.js +2 -2
  12. package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
  13. package/cjs/ts-types/base-table.d.ts +1 -0
  14. package/cjs/ts-types/base-table.js.map +1 -1
  15. package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
  16. package/cjs/vrender.js.map +1 -1
  17. package/dist/vtable.js +53 -24
  18. package/dist/vtable.min.js +2 -2
  19. package/es/core/BaseTable.d.ts +1 -0
  20. package/es/core/BaseTable.js +15 -15
  21. package/es/core/BaseTable.js.map +1 -1
  22. package/es/index.d.ts +1 -1
  23. package/es/index.js +1 -1
  24. package/es/index.js.map +1 -1
  25. package/es/scenegraph/group-creater/cell-helper.js +2 -2
  26. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  27. package/es/scenegraph/layout/compute-col-width.js +2 -2
  28. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  29. package/es/scenegraph/layout/compute-row-height.js +2 -2
  30. package/es/scenegraph/layout/compute-row-height.js.map +1 -1
  31. package/es/ts-types/base-table.d.ts +1 -0
  32. package/es/ts-types/base-table.js.map +1 -1
  33. package/es/ts-types/list-table/define/basic-define.js.map +1 -1
  34. package/es/vrender.js.map +1 -1
  35. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -35240,9 +35240,8 @@
35240
35240
  dx: hierarchyOffset,
35241
35241
  x
35242
35242
  };
35243
- const oldText = textMark.attribute.text;
35244
35243
  textMark.setAttributes(cellTheme.text ? Object.assign({}, cellTheme.text, attribute) : attribute);
35245
- if (!oldText && textMark.attribute.text) {
35244
+ if (textMark.attribute.text) {
35246
35245
  const textBaseline = cellTheme.text.textBaseline;
35247
35246
  const height = cellHeight - (padding[0] + padding[2]);
35248
35247
  let y = 0;
@@ -37215,7 +37214,9 @@
37215
37214
  let height = 0;
37216
37215
  let renderDefault = false;
37217
37216
  let enableCellPadding = false;
37218
- if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row)?.mergeCell) {
37217
+ if (table.isHeader(col, row) ||
37218
+ table.getBodyColumnDefine(col, row)?.mergeCell ||
37219
+ table.hasCustomMerge()) {
37219
37220
  const cellRange = table.getCellRange(col, row);
37220
37221
  spanRow = cellRange.end.row - cellRange.start.row + 1;
37221
37222
  }
@@ -37301,7 +37302,9 @@
37301
37302
  }
37302
37303
  let spanRow = 1;
37303
37304
  let endCol = col;
37304
- if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row)?.mergeCell) {
37305
+ if (table.isHeader(col, row) ||
37306
+ table.getBodyColumnDefine(col, row)?.mergeCell ||
37307
+ table.hasCustomMerge()) {
37305
37308
  const cellRange = table.getCellRange(col, row);
37306
37309
  spanRow = cellRange.end.row - cellRange.start.row + 1;
37307
37310
  col = cellRange.start.col;
@@ -40327,7 +40330,9 @@
40327
40330
  let width = 0;
40328
40331
  let renderDefault = false;
40329
40332
  let enableCellPadding = false;
40330
- if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row)?.mergeCell) {
40333
+ if (table.isHeader(col, row) ||
40334
+ table.getBodyColumnDefine(col, row)?.mergeCell ||
40335
+ table.hasCustomMerge()) {
40331
40336
  const cellRange = table.getCellRange(col, row);
40332
40337
  spanCol = cellRange.end.col - cellRange.start.col + 1;
40333
40338
  }
@@ -40396,7 +40401,9 @@
40396
40401
  });
40397
40402
  }
40398
40403
  let spanCol = 1;
40399
- if (table.isHeader(col, row) || table.getBodyColumnDefine(col, row)?.mergeCell) {
40404
+ if (table.isHeader(col, row) ||
40405
+ table.getBodyColumnDefine(col, row)?.mergeCell ||
40406
+ table.hasCustomMerge()) {
40400
40407
  const cellRange = table.getCellRange(col, row);
40401
40408
  spanCol = cellRange.end.col - cellRange.start.col + 1;
40402
40409
  }
@@ -51714,7 +51721,7 @@
51714
51721
  return TABLE_EVENT_TYPE;
51715
51722
  }
51716
51723
  options;
51717
- version = "0.19.1";
51724
+ version = "0.19.2-alpha.0";
51718
51725
  pagination;
51719
51726
  id = `VTable${Date.now()}`;
51720
51727
  headerStyleCache;
@@ -52139,6 +52146,9 @@
52139
52146
  return 'grid';
52140
52147
  }
52141
52148
  getColsWidth(startCol, endCol) {
52149
+ if (startCol > endCol) {
52150
+ return 0;
52151
+ }
52142
52152
  startCol = Math.max(startCol, 0);
52143
52153
  endCol = Math.min(endCol, (this.colCount ?? Infinity) - 1);
52144
52154
  const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`);
@@ -52193,6 +52203,9 @@
52193
52203
  }
52194
52204
  }
52195
52205
  getRowsHeight(startRow, endRow) {
52206
+ if (startRow > endRow) {
52207
+ return 0;
52208
+ }
52196
52209
  startRow = Math.max(startRow, 0);
52197
52210
  endRow = Math.min(endRow, (this.rowCount ?? Infinity) - 1);
52198
52211
  let h = 0;
@@ -52445,27 +52458,40 @@
52445
52458
  return rect;
52446
52459
  }
52447
52460
  getCellsRect(startCol, startRow, endCol, endRow) {
52448
- const isFrozenStartCell = this.isFrozenCell(startCol, startRow);
52449
- const isFrozenEndCell = this.isFrozenCell(endCol, endRow);
52450
52461
  let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0;
52451
52462
  let width = this.getColsWidth(startCol, endCol);
52452
- if (isFrozenStartCell?.col) {
52453
- const scrollLeft = this.scrollLeft;
52454
- absoluteLeft += scrollLeft;
52455
- if (!isFrozenEndCell?.col) {
52456
- width -= scrollLeft;
52457
- width = Math.max(width, this.getColsWidth(startCol, this.frozenColCount - 1));
52458
- }
52463
+ const scrollLeft = this.scrollLeft;
52464
+ if (this.isLeftFrozenColumn(startCol) && this.isRightFrozenColumn(endCol)) {
52465
+ width = this.tableNoFrameWidth - (this.getColsWidth(startCol + 1, this.colCount - 1) ?? 0) - absoluteLeft;
52459
52466
  }
52460
- const absoluteTop = this.getRowsHeight(0, startRow - 1);
52467
+ else if (this.isLeftFrozenColumn(startCol) && !this.isLeftFrozenColumn(endCol)) {
52468
+ width = Math.max(width - scrollLeft, this.getColsWidth(startCol, this.frozenColCount - 1));
52469
+ }
52470
+ else if (!this.isRightFrozenColumn(startCol) && this.isRightFrozenColumn(endCol)) {
52471
+ absoluteLeft = Math.min(absoluteLeft - scrollLeft, this.tableNoFrameWidth - this.getRightFrozenColsWidth());
52472
+ width = this.tableNoFrameWidth - (this.getColsWidth(startCol + 1, this.colCount - 1) ?? 0) - absoluteLeft;
52473
+ }
52474
+ else if (this.isRightFrozenColumn(startCol)) {
52475
+ absoluteLeft = this.tableNoFrameWidth - (this.getColsWidth(startCol, this.colCount - 1) ?? 0);
52476
+ }
52477
+ else ;
52478
+ let absoluteTop = this.getRowsHeight(0, startRow - 1);
52461
52479
  let height = this.getRowsHeight(startRow, endRow);
52462
- if (isFrozenStartCell?.row) {
52463
- const scrollTop = this.scrollTop;
52464
- if (!isFrozenEndCell?.row) {
52465
- height -= scrollTop;
52466
- height = Math.max(height, this.getRowsHeight(startRow, this.frozenRowCount - 1));
52467
- }
52480
+ const scrollTop = this.scrollTop;
52481
+ if (this.isTopFrozenRow(startRow) && this.isBottomFrozenRow(endRow)) {
52482
+ height = this.tableNoFrameHeight - (this.getRowsHeight(startRow + 1, this.rowCount - 1) ?? 0) - absoluteTop;
52468
52483
  }
52484
+ else if (this.isTopFrozenRow(startRow) && !this.isTopFrozenRow(endRow)) {
52485
+ height = Math.max(height - scrollTop, this.getRowsHeight(startRow, this.frozenRowCount - 1));
52486
+ }
52487
+ else if (!this.isBottomFrozenRow(startRow) && this.isBottomFrozenRow(endRow)) {
52488
+ absoluteTop = Math.min(absoluteTop - scrollTop, this.tableNoFrameHeight - this.getBottomFrozenRowsHeight());
52489
+ height = this.tableNoFrameHeight - (this.getRowsHeight(startRow + 1, this.rowCount - 1) ?? 0) - absoluteTop;
52490
+ }
52491
+ else if (this.isBottomFrozenRow(startRow)) {
52492
+ absoluteTop = this.tableNoFrameHeight - (this.getRowsHeight(startRow, this.rowCount - 1) ?? 0);
52493
+ }
52494
+ else ;
52469
52495
  return new Rect$1(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
52470
52496
  }
52471
52497
  getCellsRectWidth(startCol, startRow, endCol, endRow) {
@@ -53244,6 +53270,9 @@
53244
53270
  }
53245
53271
  return this.internalProps.layoutMap.getCellRange(col, row);
53246
53272
  }
53273
+ hasCustomMerge() {
53274
+ return !!this.internalProps.customMergeCell;
53275
+ }
53247
53276
  getCustomMerge(col, row) {
53248
53277
  if (this.internalProps.customMergeCell) {
53249
53278
  const customMerge = this.internalProps.customMergeCell(col, row, this);
@@ -63114,7 +63143,7 @@
63114
63143
  }
63115
63144
 
63116
63145
  registerForVrender();
63117
- const version = "0.19.1";
63146
+ const version = "0.19.2-alpha.0";
63118
63147
  function getIcons() {
63119
63148
  return get$1();
63120
63149
  }