@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.
- package/cjs/core/BaseTable.d.ts +1 -0
- package/cjs/core/BaseTable.js +15 -15
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +2 -2
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/scenegraph/layout/compute-col-width.js +2 -2
- package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
- package/cjs/scenegraph/layout/compute-row-height.js +2 -2
- package/cjs/scenegraph/layout/compute-row-height.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -0
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/list-table/define/basic-define.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +53 -24
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.d.ts +1 -0
- package/es/core/BaseTable.js +15 -15
- package/es/core/BaseTable.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +2 -2
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/scenegraph/layout/compute-col-width.js +2 -2
- package/es/scenegraph/layout/compute-col-width.js.map +1 -1
- package/es/scenegraph/layout/compute-row-height.js +2 -2
- package/es/scenegraph/layout/compute-row-height.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -0
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/list-table/define/basic-define.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/cjs/core/BaseTable.d.ts
CHANGED
|
@@ -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;
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
483
|
+
var _a, _b, _c, _d, _e, _f;
|
|
482
484
|
let absoluteLeft = this.getColsWidth(0, startCol - 1) || 0, width = this.getColsWidth(startCol, endCol);
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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);
|