@visactor/vtable 0.25.4-alpha.2 → 0.25.5
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.js +8 -24
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/event/listener/table-group.js +10 -3
- 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.d.ts +0 -1
- package/cjs/layout/pivot-header-layout.js +3 -19
- package/cjs/layout/pivot-header-layout.js.map +1 -1
- package/cjs/scenegraph/graphic/group.d.ts +1 -1
- package/cjs/scenegraph/graphic/group.js.map +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js +1 -1
- package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js +1 -1
- package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
- package/cjs/ts-types/base-table.d.ts +1 -1
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/vrender.js.map +1 -1
- package/dist/vtable.js +22 -72
- package/dist/vtable.min.js +2 -2
- package/es/core/BaseTable.js +8 -24
- package/es/core/BaseTable.js.map +1 -1
- package/es/event/listener/table-group.js +11 -2
- 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.d.ts +0 -1
- package/es/layout/pivot-header-layout.js +3 -19
- package/es/layout/pivot-header-layout.js.map +1 -1
- package/es/scenegraph/graphic/group.d.ts +1 -1
- package/es/scenegraph/graphic/group.js.map +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.js +1 -1
- package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
- package/es/scenegraph/group-creater/column-helper.js +1 -1
- package/es/scenegraph/group-creater/column-helper.js.map +1 -1
- package/es/ts-types/base-table.d.ts +1 -1
- package/es/ts-types/base-table.js.map +1 -1
- package/es/vrender.js.map +1 -1
- package/package.json +5 -5
package/cjs/core/BaseTable.js
CHANGED
|
@@ -45,10 +45,10 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
45
45
|
}
|
|
46
46
|
constructor(container, options = {}) {
|
|
47
47
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
48
|
-
if (super(), this.showFrozenIcon = !0, this.version = "0.25.
|
|
48
|
+
if (super(), this.showFrozenIcon = !0, this.version = "0.25.5", 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
|
-
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, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", 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, limitMinHeight: limitMinHeight} = options;
|
|
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, widthAdaptiveMode: widthAdaptiveMode = "only-body", heightAdaptiveMode: heightAdaptiveMode = "only-body", keyboardOptions: keyboardOptions, eventOptions: eventOptions, rowSeriesNumber: rowSeriesNumber, columnResizeMode: columnResizeMode, rowResizeMode: rowResizeMode = "none", 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, limitMinHeight: limitMinHeight, clearDOM: clearDOM = !0} = options;
|
|
52
52
|
this.container = container, this.options = options, this._widthMode = widthMode,
|
|
53
53
|
this._heightMode = heightMode, this._widthAdaptiveMode = widthAdaptiveMode, this._heightAdaptiveMode = heightAdaptiveMode,
|
|
54
54
|
this._autoFillWidth = autoFillWidth, this._autoFillHeight = autoFillHeight, this.customRender = customRender,
|
|
@@ -89,8 +89,9 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
89
89
|
return "node" === env_1.Env.mode ? canvasWidth / (null != pixelRatio ? pixelRatio : 1) : this._.canvas.width / (null !== (_a = this._.context.pixelRatio) && void 0 !== _a ? _a : window.devicePixelRatio);
|
|
90
90
|
}
|
|
91
91
|
}, internalProps.cellTextOverflows = {}, internalProps.focusedTable = !1, internalProps.theme = themes_1.default.of(null !== (_b = options.theme) && void 0 !== _b ? _b : themes_1.default.DEFAULT),
|
|
92
|
-
internalProps.theme.isPivot = this.isPivotTable(), container ? (container.
|
|
93
|
-
|
|
92
|
+
internalProps.theme.isPivot = this.isPivotTable(), container ? (clearDOM && (container.innerHTML = ""),
|
|
93
|
+
container.appendChild(internalProps.element), this._updateSize()) : this._updateSize(),
|
|
94
|
+
this.options = options, internalProps.theme = themes_1.default.of(null !== (_c = options.theme) && void 0 !== _c ? _c : themes_1.default.DEFAULT),
|
|
94
95
|
internalProps.theme.isPivot = this.isPivotTable(), internalProps.bodyHelper = new body_helper_1.BodyHelper(this),
|
|
95
96
|
internalProps.headerHelper = new header_helper_1.HeaderHelper(this), internalProps.rowSeriesNumberHelper = new row_series_number_helper_1.RowSeriesNumberHelper(this),
|
|
96
97
|
internalProps.autoWrapText = options.autoWrapText, internalProps.enableLineBreak = options.enableLineBreak,
|
|
@@ -361,15 +362,7 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
361
362
|
Math.round(w);
|
|
362
363
|
}
|
|
363
364
|
getRowHeight(row) {
|
|
364
|
-
if ((0, vutils_1.isValid)(this.rowHeightsMap.get(row)))
|
|
365
|
-
if (this.options._disableColumnAndRowSizeRound) {
|
|
366
|
-
const height = this.rowHeightsMap.get(row);
|
|
367
|
-
let heightRange;
|
|
368
|
-
return heightRange = row < this.frozenRowCount ? this.rowHeightsMap.getSumInRange(0, row) : row >= this.rowCount - this.bottomFrozenRowCount ? this.rowHeightsMap.getSumInRange(row, this.rowCount - 1) : this.rowHeightsMap.getSumInRange(this.frozenRowCount, row),
|
|
369
|
-
heightRange = Number(heightRange.toFixed(2)), Number.isInteger(heightRange) ? Math.ceil(height) : Math.floor(height);
|
|
370
|
-
}
|
|
371
|
-
return this.rowHeightsMap.get(row);
|
|
372
|
-
}
|
|
365
|
+
if ((0, vutils_1.isValid)(this.rowHeightsMap.get(row))) return this.rowHeightsMap.get(row);
|
|
373
366
|
const defaultHeight = this.getDefaultRowHeight(row);
|
|
374
367
|
return (0, vutils_1.isNumber)(defaultHeight) ? defaultHeight : this.defaultRowHeight;
|
|
375
368
|
}
|
|
@@ -382,23 +375,14 @@ class BaseTable extends EventTarget_1.EventTarget {
|
|
|
382
375
|
return this.isColumnHeader(0, row) || this.isCornerHeader(0, row) || this.isSeriesNumberInHeader(0, row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_a = this.defaultHeaderRowHeight[row]) && void 0 !== _a ? _a : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.isBottomFrozenRow(row) ? Array.isArray(this.defaultHeaderRowHeight) ? null !== (_b = this.defaultHeaderRowHeight[this.columnHeaderLevelCount > 0 ? this.columnHeaderLevelCount - this.bottomFrozenRowCount : 0]) && void 0 !== _b ? _b : this.internalProps.defaultRowHeight : this.defaultHeaderRowHeight : this.internalProps.defaultRowHeight;
|
|
383
376
|
}
|
|
384
377
|
_setRowHeight(row, height, clearCache) {
|
|
385
|
-
this.rowHeightsMap.put(row,
|
|
386
|
-
clearCache && this._clearRowRangeHeightsMap(row);
|
|
378
|
+
this.rowHeightsMap.put(row, Math.round(height)), clearCache && this._clearRowRangeHeightsMap(row);
|
|
387
379
|
}
|
|
388
380
|
getRowsHeight(startRow, endRow) {
|
|
389
381
|
var _a;
|
|
390
382
|
if (startRow > endRow || 0 === this.rowCount) return 0;
|
|
391
383
|
startRow = Math.max(startRow, 0), endRow = Math.min(endRow, (null !== (_a = this.rowCount) && void 0 !== _a ? _a : 1 / 0) - 1);
|
|
392
384
|
let h = 0;
|
|
393
|
-
if ("standard" !== this.heightMode || this.autoFillHeight || !this.internalProps.layoutMap || this.hasAutoImageColumn() || 0 !== this.internalProps._heightResizedRowMap.size) {
|
|
394
|
-
if (this.options._disableColumnAndRowSizeRound) {
|
|
395
|
-
const tempH = this.rowHeightsMap.getSumInRange(startRow, endRow);
|
|
396
|
-
let heightRange;
|
|
397
|
-
return heightRange = endRow < this.frozenRowCount ? this.rowHeightsMap.getSumInRange(0, endRow) : endRow >= this.rowCount - this.bottomFrozenRowCount ? this.rowHeightsMap.getSumInRange(endRow, this.rowCount - 1) : this.rowHeightsMap.getSumInRange(this.frozenRowCount, endRow),
|
|
398
|
-
heightRange = Number(heightRange.toFixed(2)), Number.isInteger(heightRange) ? Math.ceil(tempH) : Math.floor(tempH);
|
|
399
|
-
}
|
|
400
|
-
h = this.rowHeightsMap.getSumInRange(startRow, endRow);
|
|
401
|
-
} else {
|
|
385
|
+
if ("standard" !== this.heightMode || this.autoFillHeight || !this.internalProps.layoutMap || this.hasAutoImageColumn() || 0 !== this.internalProps._heightResizedRowMap.size) h = this.rowHeightsMap.getSumInRange(startRow, endRow); else {
|
|
402
386
|
for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) h += this.getRowHeight(i);
|
|
403
387
|
endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, this.rowCount - this.bottomFrozenRowCount - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
|
|
404
388
|
for (let i = this.rowCount - this.bottomFrozenRowCount; i < endRow + 1; i++) h += this.getRowHeight(i);
|