@visactor/vtable 1.19.1-alpha.1 → 1.19.1
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 +40 -7
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/animation.js +1 -1
- package/cjs/core/animation.js.map +1 -1
- package/cjs/event/listener/table-group.js +2 -2
- package/cjs/event/listener/table-group.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/layout/pivot-header-layout.js +7 -11
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/layout/row-height-map.js +10 -3
- package/cjs/layout/row-height-map.js.map +1 -1
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
- package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/cjs/scenegraph/graphic/icon.d.ts +1 -0
- package/cjs/scenegraph/graphic/icon.js +30 -2
- package/cjs/scenegraph/graphic/icon.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
- package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/cjs/tools/env.d.ts +1 -0
- package/cjs/tools/env.js +13 -2
- package/cjs/tools/env.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/vrender.js.map +1 -1
- package/dist/vtable.js +496 -384
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.d.ts +1 -0
- package/es/core/BaseTable.js +40 -7
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/animation.js +1 -1
- package/es/core/animation.js.map +1 -1
- package/es/event/listener/table-group.js +3 -1
- package/es/event/listener/table-group.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/layout/pivot-header-layout.js +7 -11
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/layout/row-height-map.js +10 -3
- package/es/layout/row-height-map.js.map +1 -1
- package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
- package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
- package/es/scenegraph/graphic/icon.d.ts +1 -0
- package/es/scenegraph/graphic/icon.js +6 -1
- package/es/scenegraph/graphic/icon.js.map +1 -1
- package/es/scenegraph/group-creater/cell-helper.js +1 -1
- package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
- package/es/tools/env.d.ts +1 -0
- package/es/tools/env.js +11 -0
- package/es/tools/env.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/vrender.js.map +1 -1
- package/package.json +7 -7
package/cjs/core/BaseTable.d.ts
CHANGED
|
@@ -171,6 +171,7 @@ export declare abstract class BaseTable extends EventTarget implements BaseTable
|
|
|
171
171
|
_setRowHeight(row: number, height: number, clearCache?: boolean): void;
|
|
172
172
|
setRowHeight(row: number, height: number): void;
|
|
173
173
|
getRowsHeight(startRow: number, endRow: number): number;
|
|
174
|
+
_getRangeSizeForContainerFit(start: number, end: number, totalSize: number, type?: 'col' | 'row'): number;
|
|
174
175
|
getColWidthDefined(col: number): string | number;
|
|
175
176
|
getColWidthDefinedNumber(col: number): number;
|
|
176
177
|
isAutoRowHeight(row?: number): boolean;
|
package/cjs/core/BaseTable.js
CHANGED
|
@@ -43,7 +43,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
43
43
|
}
|
|
44
44
|
constructor(container, options = {}) {
|
|
45
45
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
46
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.19.1
|
|
46
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.19.1", this.id = `VTable${Date.now()}`,
|
|
47
47
|
this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = (0, util_1.throttle2)(this.render.bind(this), 200),
|
|
48
48
|
"node" === env_1.Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container,
|
|
49
49
|
container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
@@ -488,13 +488,14 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
488
488
|
if (null != cachedColWidth) return cachedColWidth;
|
|
489
489
|
const cachedLowerColWidth = this._colRangeWidthsMap.get(`$${startCol}$${endCol - 1}`);
|
|
490
490
|
if (null != cachedLowerColWidth) {
|
|
491
|
-
|
|
492
|
-
return
|
|
491
|
+
let addWidth = cachedLowerColWidth + this.getColWidth(endCol);
|
|
492
|
+
return this.rightFrozenColCount > 0 && endCol === this.colCount - this.rightFrozenColCount && (addWidth = this._getRangeSizeForContainerFit(startCol, endCol, addWidth, "col")),
|
|
493
|
+
startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
|
|
493
494
|
Math.round(addWidth);
|
|
494
495
|
}
|
|
495
496
|
let w = 0;
|
|
496
497
|
for (let col = startCol; col <= endCol; col++) w += this.getColWidth(col);
|
|
497
|
-
return startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
|
|
498
|
+
return w = this._getRangeSizeForContainerFit(startCol, endCol, w, "col"), startCol >= 0 && endCol >= 0 && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(w)),
|
|
498
499
|
Math.round(w);
|
|
499
500
|
}
|
|
500
501
|
getRowHeight(row) {
|
|
@@ -543,12 +544,43 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
543
544
|
}
|
|
544
545
|
h = this.rowHeightsMap.getSumInRange(startRow, endRow);
|
|
545
546
|
} else {
|
|
547
|
+
const bottomFrozenStartRow = this.rowCount - this.bottomFrozenRowCount;
|
|
546
548
|
for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) h += this.getRowHeight(i);
|
|
547
|
-
endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow,
|
|
548
|
-
|
|
549
|
+
endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, bottomFrozenStartRow - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
|
|
550
|
+
let currentBottomFrozenRowsHeight = 0;
|
|
551
|
+
for (let i = bottomFrozenStartRow; i < endRow + 1; i++) currentBottomFrozenRowsHeight += this.getRowHeight(i);
|
|
552
|
+
h = this._getRangeSizeForContainerFit(startRow, endRow, h + currentBottomFrozenRowsHeight, "row");
|
|
549
553
|
}
|
|
550
554
|
return Math.round(h);
|
|
551
555
|
}
|
|
556
|
+
_getRangeSizeForContainerFit(start, end, totalSize, type = "col") {
|
|
557
|
+
var _a;
|
|
558
|
+
if (!isFinite(start) || !isFinite(end)) return totalSize;
|
|
559
|
+
const keyMap = "col" === type ? {
|
|
560
|
+
totalCount: "colCount",
|
|
561
|
+
frozenCount: "rightFrozenColCount",
|
|
562
|
+
fitType: "width",
|
|
563
|
+
tableSize: "tableNoFrameWidth",
|
|
564
|
+
getSize: "getColWidth"
|
|
565
|
+
} : {
|
|
566
|
+
totalCount: "rowCount",
|
|
567
|
+
frozenCount: "bottomFrozenRowCount",
|
|
568
|
+
fitType: "height",
|
|
569
|
+
tableSize: "tableNoFrameHeight",
|
|
570
|
+
getSize: "getRowHeight"
|
|
571
|
+
}, tableSize = this[keyMap.tableSize];
|
|
572
|
+
if (totalSize >= tableSize) return totalSize;
|
|
573
|
+
const frozenStart = this[keyMap.totalCount] - this[keyMap.frozenCount];
|
|
574
|
+
if (!isFinite(this[keyMap.totalCount]) || this[keyMap.frozenCount] <= 0 || frozenStart < 0) return totalSize;
|
|
575
|
+
if (start > frozenStart || end < frozenStart || start === end || !(null === (_a = this.containerFit) || void 0 === _a ? void 0 : _a[keyMap.fitType])) return totalSize;
|
|
576
|
+
const last = this[keyMap.totalCount] - 1;
|
|
577
|
+
let size = tableSize;
|
|
578
|
+
if (start > 0) for (let i = 0; i < start; i++) if (size -= this[keyMap.getSize](i),
|
|
579
|
+
size <= 0) return totalSize;
|
|
580
|
+
if (end !== last) for (let i = end + 1; i <= last; i++) if (size -= this[keyMap.getSize](i),
|
|
581
|
+
size <= 0) return totalSize;
|
|
582
|
+
return size;
|
|
583
|
+
}
|
|
552
584
|
getColWidthDefined(col) {
|
|
553
585
|
var _a;
|
|
554
586
|
const {layoutMap: layoutMap} = this.internalProps;
|
|
@@ -998,7 +1030,8 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
998
1030
|
return 0;
|
|
999
1031
|
}
|
|
1000
1032
|
getDrawRange() {
|
|
1001
|
-
|
|
1033
|
+
var _a, _b;
|
|
1034
|
+
const width = (null === (_a = this.containerFit) || void 0 === _a ? void 0 : _a.width) ? this.tableNoFrameWidth : Math.min(this.tableNoFrameWidth, this.getAllColsWidth()), height = (null === (_b = this.containerFit) || void 0 === _b ? void 0 : _b.height) ? this.tableNoFrameHeight : Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
|
|
1002
1035
|
return new Rect_1.Rect(this.tableX, this.tableY, width, height);
|
|
1003
1036
|
}
|
|
1004
1037
|
_getMouseAbstractPoint(evt) {
|