@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
@@ -290,6 +290,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
290
290
  getRecordStartRowByRecordIndex(index: number): number;
291
291
  _getHeaderCellBySortState(sortState: SortState): CellAddress | undefined;
292
292
  getCellRange(col: number, row: number): CellRange;
293
+ hasCustomMerge(): boolean;
293
294
  getCustomMerge(col: number, row: number): import("../ts-types").CustomMerge;
294
295
  isCellRangeEqual(col: number, row: number, targetCol: number, targetRow: number): boolean;
295
296
  _getLayoutCellId(col: number, row: number): LayoutObjectId;
@@ -45,7 +45,7 @@ class BaseTable extends EventTarget_1.EventTarget {
45
45
  }
46
46
  constructor(container, options = {}) {
47
47
  var _a, _b, _c, _d, _e, _f, _g;
48
- if (super(), this.showFrozenIcon = !0, this.version = "0.19.1", this.id = `VTable${Date.now()}`,
48
+ if (super(), this.showFrozenIcon = !0, this.version = "0.19.2-alpha.0", this.id = `VTable${Date.now()}`,
49
49
  this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
50
50
  !container && "node" !== options.mode) throw new Error("vtable's container is undefined");
51
51
  const {frozenColCount: frozenColCount = 0, defaultRowHeight: defaultRowHeight = 40, defaultHeaderRowHeight: defaultHeaderRowHeight, defaultColWidth: defaultColWidth = 80, defaultHeaderColWidth: defaultHeaderColWidth, widthMode: widthMode = "standard", heightMode: heightMode = "standard", autoFillWidth: autoFillWidth = !1, autoFillHeight: autoFillHeight = !1, keyboardOptions: keyboardOptions, eventOptions: eventOptions, columnResizeMode: columnResizeMode, dragHeaderMode: dragHeaderMode, showFrozenIcon: showFrozenIcon, allowFrozenColCount: allowFrozenColCount, padding: padding, hover: hover, menu: menu, select: click, customRender: customRender, pixelRatio: pixelRatio = pixel_ratio_1.defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth} = options;
@@ -324,6 +324,7 @@ class BaseTable extends EventTarget_1.EventTarget {
324
324
  }
325
325
  getColsWidth(startCol, endCol) {
326
326
  var _a;
327
+ if (startCol > endCol) return 0;
327
328
  startCol = Math.max(startCol, 0), endCol = Math.min(endCol, (null !== (_a = this.colCount) && void 0 !== _a ? _a : 1 / 0) - 1);
328
329
  const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`);
329
330
  if (null != cachedColWidth) return cachedColWidth;
@@ -352,6 +353,7 @@ class BaseTable extends EventTarget_1.EventTarget {
352
353
  }
353
354
  getRowsHeight(startRow, endRow) {
354
355
  var _a;
356
+ if (startRow > endRow) return 0;
355
357
  startRow = Math.max(startRow, 0), endRow = Math.min(endRow, (null !== (_a = this.rowCount) && void 0 !== _a ? _a : 1 / 0) - 1);
356
358
  let h = 0;
357
359
  if ("standard" === this.heightMode && !this.autoFillHeight && this.internalProps.layoutMap && endRow >= this.columnHeaderLevelCount && !this.bottomFrozenRowCount && !this.hasAutoImageColumn()) {
@@ -478,21 +480,16 @@ class BaseTable extends EventTarget_1.EventTarget {
478
480
  return rect.top = targetTop, rect.bottom = targetBottom, rect;
479
481
  }
480
482
  getCellsRect(startCol, startRow, endCol, endRow) {
481
- const isFrozenStartCell = this.isFrozenCell(startCol, startRow), isFrozenEndCell = this.isFrozenCell(endCol, endRow);
483
+ var _a, _b, _c, _d, _e, _f;
482
484
  let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0, width = this.getColsWidth(startCol, endCol);
483
- if (null == isFrozenStartCell ? void 0 : isFrozenStartCell.col) {
484
- const scrollLeft = this.scrollLeft;
485
- absoluteLeft += scrollLeft, (null == isFrozenEndCell ? void 0 : isFrozenEndCell.col) || (width -= scrollLeft,
486
- width = Math.max(width, this.getColsWidth(startCol, this.frozenColCount - 1)));
487
- }
488
- const absoluteTop = this.getRowsHeight(0, startRow - 1);
489
- let height = this.getRowsHeight(startRow, endRow);
490
- if (null == isFrozenStartCell ? void 0 : isFrozenStartCell.row) {
491
- const scrollTop = this.scrollTop;
492
- (null == isFrozenEndCell ? void 0 : isFrozenEndCell.row) || (height -= scrollTop,
493
- height = Math.max(height, this.getRowsHeight(startRow, this.frozenRowCount - 1)));
494
- }
495
- return new Rect_1.Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
485
+ const scrollLeft = this.scrollLeft;
486
+ this.isLeftFrozenColumn(startCol) && this.isRightFrozenColumn(endCol) ? width = this.tableNoFrameWidth - (null !== (_a = this.getColsWidth(startCol + 1, this.colCount - 1)) && void 0 !== _a ? _a : 0) - absoluteLeft : this.isLeftFrozenColumn(startCol) && !this.isLeftFrozenColumn(endCol) ? width = Math.max(width - scrollLeft, this.getColsWidth(startCol, this.frozenColCount - 1)) : !this.isRightFrozenColumn(startCol) && this.isRightFrozenColumn(endCol) ? (absoluteLeft = Math.min(absoluteLeft - scrollLeft, this.tableNoFrameWidth - this.getRightFrozenColsWidth()),
487
+ width = this.tableNoFrameWidth - (null !== (_b = this.getColsWidth(startCol + 1, this.colCount - 1)) && void 0 !== _b ? _b : 0) - absoluteLeft) : this.isRightFrozenColumn(startCol) && (absoluteLeft = this.tableNoFrameWidth - (null !== (_c = this.getColsWidth(startCol, this.colCount - 1)) && void 0 !== _c ? _c : 0));
488
+ let absoluteTop = this.getRowsHeight(0, startRow - 1), height = this.getRowsHeight(startRow, endRow);
489
+ const scrollTop = this.scrollTop;
490
+ return this.isTopFrozenRow(startRow) && this.isBottomFrozenRow(endRow) ? height = this.tableNoFrameHeight - (null !== (_d = this.getRowsHeight(startRow + 1, this.rowCount - 1)) && void 0 !== _d ? _d : 0) - absoluteTop : this.isTopFrozenRow(startRow) && !this.isTopFrozenRow(endRow) ? height = Math.max(height - scrollTop, this.getRowsHeight(startRow, this.frozenRowCount - 1)) : !this.isBottomFrozenRow(startRow) && this.isBottomFrozenRow(endRow) ? (absoluteTop = Math.min(absoluteTop - scrollTop, this.tableNoFrameHeight - this.getBottomFrozenRowsHeight()),
491
+ height = this.tableNoFrameHeight - (null !== (_e = this.getRowsHeight(startRow + 1, this.rowCount - 1)) && void 0 !== _e ? _e : 0) - absoluteTop) : this.isBottomFrozenRow(startRow) && (absoluteTop = this.tableNoFrameHeight - (null !== (_f = this.getRowsHeight(startRow, this.rowCount - 1)) && void 0 !== _f ? _f : 0)),
492
+ new Rect_1.Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
496
493
  }
497
494
  getCellsRectWidth(startCol, startRow, endCol, endRow) {
498
495
  const isFrozenStartCell = this.isFrozenCell(startCol, startRow), isFrozenEndCell = this.isFrozenCell(endCol, endRow);
@@ -1024,6 +1021,9 @@ class BaseTable extends EventTarget_1.EventTarget {
1024
1021
  }
1025
1022
  return this.internalProps.layoutMap.getCellRange(col, row);
1026
1023
  }
1024
+ hasCustomMerge() {
1025
+ return !!this.internalProps.customMergeCell;
1026
+ }
1027
1027
  getCustomMerge(col, row) {
1028
1028
  if (this.internalProps.customMergeCell) {
1029
1029
  const customMerge = this.internalProps.customMergeCell(col, row, this);