@visactor/vtable 0.25.4-alpha.1 → 0.25.4-alpha.2

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.
@@ -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, _h, _j, _k;
48
- if (super(), this.showFrozenIcon = !0, this.version = "0.25.4-alpha.1", this.id = `VTable${Date.now()}`,
48
+ if (super(), this.showFrozenIcon = !0, this.version = "0.25.4-alpha.2", 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, 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;
@@ -361,7 +361,15 @@ class BaseTable extends EventTarget_1.EventTarget {
361
361
  Math.round(w);
362
362
  }
363
363
  getRowHeight(row) {
364
- if ((0, vutils_1.isValid)(this.rowHeightsMap.get(row))) return this.rowHeightsMap.get(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
373
  const defaultHeight = this.getDefaultRowHeight(row);
366
374
  return (0, vutils_1.isNumber)(defaultHeight) ? defaultHeight : this.defaultRowHeight;
367
375
  }
@@ -382,7 +390,15 @@ class BaseTable extends EventTarget_1.EventTarget {
382
390
  if (startRow > endRow || 0 === this.rowCount) return 0;
383
391
  startRow = Math.max(startRow, 0), endRow = Math.min(endRow, (null !== (_a = this.rowCount) && void 0 !== _a ? _a : 1 / 0) - 1);
384
392
  let h = 0;
385
- if ("standard" !== this.heightMode || this.autoFillHeight || !this.internalProps.layoutMap || this.hasAutoImageColumn() || 0 !== this.internalProps._heightResizedRowMap.size) h = this.rowHeightsMap.getSumInRange(startRow, endRow); else {
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 {
386
402
  for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) h += this.getRowHeight(i);
387
403
  endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, this.rowCount - this.bottomFrozenRowCount - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
388
404
  for (let i = this.rowCount - this.bottomFrozenRowCount; i < endRow + 1; i++) h += this.getRowHeight(i);
@@ -409,7 +425,7 @@ class BaseTable extends EventTarget_1.EventTarget {
409
425
  return "adaptive" === this.widthMode && "number" == typeof width || this.transpose && "number" == typeof width ? this._colWidthDefineToPxWidth(width) : this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
410
426
  }
411
427
  _setColWidth(col, width, clearCache, skipCheckFrozen) {
412
- this.colWidthsMap.put(col, "number" == typeof width ? this.options._disableColumnAndRowSizeRound ? width : Math.round(width) : width),
428
+ this.colWidthsMap.put(col, "number" == typeof width ? Math.round(width) : width),
413
429
  clearCache && this._clearColRangeWidthsMap(col), skipCheckFrozen || this.stateManager.checkFrozen();
414
430
  }
415
431
  _clearColRangeWidthsMap(col) {