@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;
@@ -76,7 +76,7 @@ export class BaseTable extends EventTarget {
76
76
  }
77
77
  constructor(container, options = {}) {
78
78
  var _a, _b, _c, _d, _e, _f, _g;
79
- if (super(), this.showFrozenIcon = !0, this.version = "0.19.1", this.id = `VTable${Date.now()}`,
79
+ if (super(), this.showFrozenIcon = !0, this.version = "0.19.2-alpha.0", this.id = `VTable${Date.now()}`,
80
80
  this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
81
81
  !container && "node" !== options.mode) throw new Error("vtable's container is undefined");
82
82
  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 = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth} = options;
@@ -353,6 +353,7 @@ export class BaseTable extends EventTarget {
353
353
  }
354
354
  getColsWidth(startCol, endCol) {
355
355
  var _a;
356
+ if (startCol > endCol) return 0;
356
357
  startCol = Math.max(startCol, 0), endCol = Math.min(endCol, (null !== (_a = this.colCount) && void 0 !== _a ? _a : 1 / 0) - 1);
357
358
  const cachedColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol}`);
358
359
  if (null != cachedColWidth) return cachedColWidth;
@@ -381,6 +382,7 @@ export class BaseTable extends EventTarget {
381
382
  }
382
383
  getRowsHeight(startRow, endRow) {
383
384
  var _a;
385
+ if (startRow > endRow) return 0;
384
386
  startRow = Math.max(startRow, 0), endRow = Math.min(endRow, (null !== (_a = this.rowCount) && void 0 !== _a ? _a : 1 / 0) - 1);
385
387
  let h = 0;
386
388
  if ("standard" === this.heightMode && !this.autoFillHeight && this.internalProps.layoutMap && endRow >= this.columnHeaderLevelCount && !this.bottomFrozenRowCount && !this.hasAutoImageColumn()) {
@@ -505,21 +507,16 @@ export class BaseTable extends EventTarget {
505
507
  return rect.top = targetTop, rect.bottom = targetBottom, rect;
506
508
  }
507
509
  getCellsRect(startCol, startRow, endCol, endRow) {
508
- const isFrozenStartCell = this.isFrozenCell(startCol, startRow), isFrozenEndCell = this.isFrozenCell(endCol, endRow);
510
+ var _a, _b, _c, _d, _e, _f;
509
511
  let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0, width = this.getColsWidth(startCol, endCol);
510
- if (null == isFrozenStartCell ? void 0 : isFrozenStartCell.col) {
511
- const scrollLeft = this.scrollLeft;
512
- absoluteLeft += scrollLeft, (null == isFrozenEndCell ? void 0 : isFrozenEndCell.col) || (width -= scrollLeft,
513
- width = Math.max(width, this.getColsWidth(startCol, this.frozenColCount - 1)));
514
- }
515
- const absoluteTop = this.getRowsHeight(0, startRow - 1);
516
- let height = this.getRowsHeight(startRow, endRow);
517
- if (null == isFrozenStartCell ? void 0 : isFrozenStartCell.row) {
518
- const scrollTop = this.scrollTop;
519
- (null == isFrozenEndCell ? void 0 : isFrozenEndCell.row) || (height -= scrollTop,
520
- height = Math.max(height, this.getRowsHeight(startRow, this.frozenRowCount - 1)));
521
- }
522
- return new Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
512
+ const scrollLeft = this.scrollLeft;
513
+ 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()),
514
+ 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));
515
+ let absoluteTop = this.getRowsHeight(0, startRow - 1), height = this.getRowsHeight(startRow, endRow);
516
+ const scrollTop = this.scrollTop;
517
+ 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()),
518
+ 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)),
519
+ new Rect(Math.round(absoluteLeft), Math.round(absoluteTop), Math.round(width), Math.round(height));
523
520
  }
524
521
  getCellsRectWidth(startCol, startRow, endCol, endRow) {
525
522
  const isFrozenStartCell = this.isFrozenCell(startCol, startRow), isFrozenEndCell = this.isFrozenCell(endCol, endRow);
@@ -1050,6 +1047,9 @@ export class BaseTable extends EventTarget {
1050
1047
  }
1051
1048
  return this.internalProps.layoutMap.getCellRange(col, row);
1052
1049
  }
1050
+ hasCustomMerge() {
1051
+ return !!this.internalProps.customMergeCell;
1052
+ }
1053
1053
  getCustomMerge(col, row) {
1054
1054
  if (this.internalProps.customMergeCell) {
1055
1055
  const customMerge = this.internalProps.customMergeCell(col, row, this);