@visactor/vtable 1.19.1-alpha.0 → 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.
Files changed (57) hide show
  1. package/cjs/core/BaseTable.d.ts +1 -0
  2. package/cjs/core/BaseTable.js +40 -7
  3. package/cjs/core/BaseTable.js.map +1 -1
  4. package/cjs/core/animation.js +1 -1
  5. package/cjs/core/animation.js.map +1 -1
  6. package/cjs/event/listener/table-group.js +2 -2
  7. package/cjs/event/listener/table-group.js.map +1 -1
  8. package/cjs/index.d.ts +1 -1
  9. package/cjs/index.js +1 -1
  10. package/cjs/index.js.map +1 -1
  11. package/cjs/layout/index.js +1 -2
  12. package/cjs/layout/pivot-header-layout.js +1 -0
  13. package/cjs/layout/row-height-map.js +10 -3
  14. package/cjs/layout/row-height-map.js.map +1 -1
  15. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
  16. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  17. package/cjs/scenegraph/graphic/icon.d.ts +1 -0
  18. package/cjs/scenegraph/graphic/icon.js +30 -2
  19. package/cjs/scenegraph/graphic/icon.js.map +1 -1
  20. package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
  21. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  22. package/cjs/tools/env.d.ts +1 -0
  23. package/cjs/tools/env.js +13 -2
  24. package/cjs/tools/env.js.map +1 -1
  25. package/cjs/ts-types/base-table.d.ts +1 -0
  26. package/cjs/ts-types/base-table.js.map +1 -1
  27. package/cjs/vrender.js.map +1 -1
  28. package/dist/vtable.js +496 -379
  29. package/dist/vtable.min.js +2 -2
  30. package/es/core/BaseTable.d.ts +1 -0
  31. package/es/core/BaseTable.js +40 -7
  32. package/es/core/BaseTable.js.map +1 -1
  33. package/es/core/animation.js +1 -1
  34. package/es/core/animation.js.map +1 -1
  35. package/es/event/listener/table-group.js +3 -1
  36. package/es/event/listener/table-group.js.map +1 -1
  37. package/es/index.d.ts +1 -1
  38. package/es/index.js +1 -1
  39. package/es/index.js.map +1 -1
  40. package/es/layout/index.js +1 -2
  41. package/es/layout/pivot-header-layout.js +2 -1
  42. package/es/layout/row-height-map.js +10 -3
  43. package/es/layout/row-height-map.js.map +1 -1
  44. package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -2
  45. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  46. package/es/scenegraph/graphic/icon.d.ts +1 -0
  47. package/es/scenegraph/graphic/icon.js +6 -1
  48. package/es/scenegraph/graphic/icon.js.map +1 -1
  49. package/es/scenegraph/group-creater/cell-helper.js +1 -1
  50. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  51. package/es/tools/env.d.ts +1 -0
  52. package/es/tools/env.js +11 -0
  53. package/es/tools/env.js.map +1 -1
  54. package/es/ts-types/base-table.d.ts +1 -0
  55. package/es/ts-types/base-table.js.map +1 -1
  56. package/es/vrender.js.map +1 -1
  57. package/package.json +9 -9
@@ -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;
@@ -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-alpha.0", this.id = `VTable${Date.now()}`,
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
- const addWidth = cachedLowerColWidth + this.getColWidth(endCol);
492
- return startCol >= 0 && endCol >= 0 && !Number.isNaN(addWidth) && this._colRangeWidthsMap.set(`$${startCol}$${endCol}`, Math.round(addWidth)),
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, this.rowCount - this.bottomFrozenRowCount - 1) - Math.max(this.columnHeaderLevelCount, startRow) + 1));
548
- for (let i = this.rowCount - this.bottomFrozenRowCount; i < endRow + 1; i++) h += this.getRowHeight(i);
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
- const width = Math.min(this.tableNoFrameWidth, this.getAllColsWidth()), height = Math.min(this.tableNoFrameHeight, this.getAllRowsHeight());
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) {