@visactor/vtable 0.25.4-alpha.0 → 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.
Files changed (33) hide show
  1. package/cjs/core/BaseTable.js +20 -4
  2. package/cjs/core/BaseTable.js.map +1 -1
  3. package/cjs/index.d.ts +1 -1
  4. package/cjs/index.js +1 -1
  5. package/cjs/index.js.map +1 -1
  6. package/cjs/layout/pivot-header-layout.d.ts +1 -0
  7. package/cjs/layout/pivot-header-layout.js +19 -3
  8. package/cjs/layout/pivot-header-layout.js.map +1 -1
  9. package/cjs/scenegraph/graphic/group.d.ts +1 -1
  10. package/cjs/scenegraph/graphic/group.js.map +1 -1
  11. package/cjs/scenegraph/group-creater/cell-type/text-cell.js +1 -1
  12. package/cjs/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  13. package/cjs/scenegraph/group-creater/column-helper.js +1 -1
  14. package/cjs/scenegraph/group-creater/column-helper.js.map +1 -1
  15. package/cjs/vrender.js.map +1 -1
  16. package/dist/vtable.js +71 -7
  17. package/dist/vtable.min.js +2 -2
  18. package/es/core/BaseTable.js +20 -4
  19. package/es/core/BaseTable.js.map +1 -1
  20. package/es/index.d.ts +1 -1
  21. package/es/index.js +1 -1
  22. package/es/index.js.map +1 -1
  23. package/es/layout/pivot-header-layout.d.ts +1 -0
  24. package/es/layout/pivot-header-layout.js +19 -3
  25. package/es/layout/pivot-header-layout.js.map +1 -1
  26. package/es/scenegraph/graphic/group.d.ts +1 -1
  27. package/es/scenegraph/graphic/group.js.map +1 -1
  28. package/es/scenegraph/group-creater/cell-type/text-cell.js +1 -1
  29. package/es/scenegraph/group-creater/cell-type/text-cell.js.map +1 -1
  30. package/es/scenegraph/group-creater/column-helper.js +1 -1
  31. package/es/scenegraph/group-creater/column-helper.js.map +1 -1
  32. package/es/vrender.js.map +1 -1
  33. package/package.json +4 -4
@@ -82,7 +82,7 @@ export class BaseTable extends EventTarget {
82
82
  }
83
83
  constructor(container, options = {}) {
84
84
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
85
- if (super(), this.showFrozenIcon = !0, this.version = "0.25.4-alpha.0", this.id = `VTable${Date.now()}`,
85
+ if (super(), this.showFrozenIcon = !0, this.version = "0.25.4-alpha.2", this.id = `VTable${Date.now()}`,
86
86
  this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200),
87
87
  !container && "node" !== options.mode) throw new Error("vtable's container is undefined");
88
88
  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 = defaultPixelRatio, renderChartAsync: renderChartAsync, renderChartAsyncBatchCount: renderChartAsyncBatchCount, mode: mode, modeParams: modeParams, canvasWidth: canvasWidth, canvasHeight: canvasHeight, overscrollBehavior: overscrollBehavior, limitMinWidth: limitMinWidth, limitMinHeight: limitMinHeight} = options;
@@ -395,7 +395,15 @@ export class BaseTable extends EventTarget {
395
395
  Math.round(w);
396
396
  }
397
397
  getRowHeight(row) {
398
- if (isValid(this.rowHeightsMap.get(row))) return this.rowHeightsMap.get(row);
398
+ if (isValid(this.rowHeightsMap.get(row))) {
399
+ if (this.options._disableColumnAndRowSizeRound) {
400
+ const height = this.rowHeightsMap.get(row);
401
+ let heightRange;
402
+ 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),
403
+ heightRange = Number(heightRange.toFixed(2)), Number.isInteger(heightRange) ? Math.ceil(height) : Math.floor(height);
404
+ }
405
+ return this.rowHeightsMap.get(row);
406
+ }
399
407
  const defaultHeight = this.getDefaultRowHeight(row);
400
408
  return isNumber(defaultHeight) ? defaultHeight : this.defaultRowHeight;
401
409
  }
@@ -416,7 +424,15 @@ export class BaseTable extends EventTarget {
416
424
  if (startRow > endRow || 0 === this.rowCount) return 0;
417
425
  startRow = Math.max(startRow, 0), endRow = Math.min(endRow, (null !== (_a = this.rowCount) && void 0 !== _a ? _a : 1 / 0) - 1);
418
426
  let h = 0;
419
- if ("standard" !== this.heightMode || this.autoFillHeight || !this.internalProps.layoutMap || this.hasAutoImageColumn() || 0 !== this.internalProps._heightResizedRowMap.size) h = this.rowHeightsMap.getSumInRange(startRow, endRow); else {
427
+ if ("standard" !== this.heightMode || this.autoFillHeight || !this.internalProps.layoutMap || this.hasAutoImageColumn() || 0 !== this.internalProps._heightResizedRowMap.size) {
428
+ if (this.options._disableColumnAndRowSizeRound) {
429
+ const tempH = this.rowHeightsMap.getSumInRange(startRow, endRow);
430
+ let heightRange;
431
+ 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),
432
+ heightRange = Number(heightRange.toFixed(2)), Number.isInteger(heightRange) ? Math.ceil(tempH) : Math.floor(tempH);
433
+ }
434
+ h = this.rowHeightsMap.getSumInRange(startRow, endRow);
435
+ } else {
420
436
  for (let i = startRow; i < Math.min(endRow + 1, this.columnHeaderLevelCount); i++) h += this.getRowHeight(i);
421
437
  endRow >= this.columnHeaderLevelCount && (h += this.defaultRowHeight * (Math.min(endRow, this.rowCount - this.bottomFrozenRowCount - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
422
438
  for (let i = this.rowCount - this.bottomFrozenRowCount; i < endRow + 1; i++) h += this.getRowHeight(i);
@@ -443,7 +459,7 @@ export class BaseTable extends EventTarget {
443
459
  return "adaptive" === this.widthMode && "number" == typeof width || this.transpose && "number" == typeof width ? this._colWidthDefineToPxWidth(width) : this._adjustColWidth(col, this._colWidthDefineToPxWidth(width));
444
460
  }
445
461
  _setColWidth(col, width, clearCache, skipCheckFrozen) {
446
- this.colWidthsMap.put(col, "number" == typeof width ? this.options._disableColumnAndRowSizeRound ? width : Math.round(width) : width),
462
+ this.colWidthsMap.put(col, "number" == typeof width ? Math.round(width) : width),
447
463
  clearCache && this._clearColRangeWidthsMap(col), skipCheckFrozen || this.stateManager.checkFrozen();
448
464
  }
449
465
  _clearColRangeWidthsMap(col) {