@visactor/vtable 0.25.7 → 0.25.8

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 (83) hide show
  1. package/cjs/ListTable.js +2 -1
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotTable.js +6 -3
  4. package/cjs/PivotTable.js.map +1 -1
  5. package/cjs/core/BaseTable.d.ts +4 -1
  6. package/cjs/core/BaseTable.js +46 -21
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/core/FouseInput.js +2 -1
  9. package/cjs/core/row-series-number-helper.js +1 -2
  10. package/cjs/event/drill.js +2 -1
  11. package/cjs/event/media-click.js +1 -2
  12. package/cjs/header-helper/header-helper.js +1 -1
  13. package/cjs/header-helper/header-helper.js.map +1 -1
  14. package/cjs/index.d.ts +1 -1
  15. package/cjs/index.js +1 -1
  16. package/cjs/index.js.map +1 -1
  17. package/cjs/layout/pivot-header-layout.d.ts +5 -1
  18. package/cjs/layout/pivot-header-layout.js +82 -57
  19. package/cjs/layout/pivot-header-layout.js.map +1 -1
  20. package/cjs/layout/tree-helper.js +1 -0
  21. package/cjs/plugins/themes.js +1 -2
  22. package/cjs/scenegraph/component/table-component.js +26 -22
  23. package/cjs/scenegraph/component/table-component.js.map +1 -1
  24. package/cjs/scenegraph/group-creater/cell-type/image-cell.js +24 -18
  25. package/cjs/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  26. package/cjs/scenegraph/group-creater/cell-type/video-cell.js +18 -16
  27. package/cjs/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  28. package/cjs/state/state.js +1 -1
  29. package/cjs/themes/component.js +1 -1
  30. package/cjs/themes/theme.js +3 -0
  31. package/cjs/themes/theme.js.map +1 -1
  32. package/cjs/tools/helper.js +2 -2
  33. package/cjs/tools/helper.js.map +1 -1
  34. package/cjs/ts-types/base-table.d.ts +7 -0
  35. package/cjs/ts-types/base-table.js.map +1 -1
  36. package/cjs/ts-types/table-engine.d.ts +1 -0
  37. package/cjs/ts-types/table-engine.js.map +1 -1
  38. package/cjs/ts-types/theme.d.ts +1 -0
  39. package/cjs/ts-types/theme.js.map +1 -1
  40. package/cjs/vrender.js.map +1 -1
  41. package/dist/vtable.js +208 -67
  42. package/dist/vtable.min.js +2 -2
  43. package/es/ListTable.js +2 -1
  44. package/es/ListTable.js.map +1 -1
  45. package/es/PivotTable.js +6 -3
  46. package/es/PivotTable.js.map +1 -1
  47. package/es/core/BaseTable.d.ts +4 -1
  48. package/es/core/BaseTable.js +47 -21
  49. package/es/core/BaseTable.js.map +1 -1
  50. package/es/core/FouseInput.js +2 -1
  51. package/es/core/row-series-number-helper.js +1 -2
  52. package/es/event/drill.js +2 -1
  53. package/es/event/media-click.js +1 -2
  54. package/es/header-helper/header-helper.js +1 -1
  55. package/es/header-helper/header-helper.js.map +1 -1
  56. package/es/index.d.ts +1 -1
  57. package/es/index.js +1 -1
  58. package/es/index.js.map +1 -1
  59. package/es/layout/pivot-header-layout.d.ts +5 -1
  60. package/es/layout/pivot-header-layout.js +83 -56
  61. package/es/layout/pivot-header-layout.js.map +1 -1
  62. package/es/layout/tree-helper.js +2 -1
  63. package/es/plugins/themes.js +1 -2
  64. package/es/scenegraph/component/table-component.js +27 -21
  65. package/es/scenegraph/component/table-component.js.map +1 -1
  66. package/es/scenegraph/group-creater/cell-type/image-cell.js +21 -17
  67. package/es/scenegraph/group-creater/cell-type/image-cell.js.map +1 -1
  68. package/es/scenegraph/group-creater/cell-type/video-cell.js +18 -15
  69. package/es/scenegraph/group-creater/cell-type/video-cell.js.map +1 -1
  70. package/es/state/state.js +1 -1
  71. package/es/themes/component.js +1 -1
  72. package/es/themes/theme.js +3 -0
  73. package/es/themes/theme.js.map +1 -1
  74. package/es/tools/helper.js +2 -2
  75. package/es/tools/helper.js.map +1 -1
  76. package/es/ts-types/base-table.d.ts +7 -0
  77. package/es/ts-types/base-table.js.map +1 -1
  78. package/es/ts-types/table-engine.d.ts +1 -0
  79. package/es/ts-types/table-engine.js.map +1 -1
  80. package/es/ts-types/theme.d.ts +1 -0
  81. package/es/ts-types/theme.js.map +1 -1
  82. package/es/vrender.js.map +1 -1
  83. package/package.json +3 -3
@@ -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.7", this.id = `VTable${Date.now()}`,
48
+ if (super(), this.showFrozenIcon = !0, this.version = "0.25.8", 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, clearDOM: clearDOM = !0} = options;
@@ -316,29 +316,36 @@ class BaseTable extends EventTarget_1.EventTarget {
316
316
  this.internalProps.pixelRatio = pixelRatio, this.scenegraph.setPixelRatio(pixelRatio);
317
317
  }
318
318
  _updateSize() {
319
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
319
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
320
320
  const {padding: padding} = this;
321
321
  let widthP = 0, heightP = 0;
322
322
  if ("browser" === env_1.Env.mode) {
323
- const element = this.getElement(), width1 = null !== (_b = null === (_a = element.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 0, height1 = null !== (_d = null === (_c = element.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0;
323
+ const element = this.getElement();
324
+ let widthWithoutPadding = 0, heightWithoutPadding = 0;
325
+ if (element.parentElement) {
326
+ const computedStyle = element.parentElement.style || window.getComputedStyle(element.parentElement);
327
+ widthWithoutPadding = element.parentElement.offsetWidth - parseInt(computedStyle.paddingLeft || "0px", 10) - parseInt(computedStyle.paddingRight || "0px", 10),
328
+ heightWithoutPadding = element.parentElement.offsetHeight - parseInt(computedStyle.paddingTop || "0px", 10) - parseInt(computedStyle.paddingBottom || "0px", 20);
329
+ }
330
+ const width1 = null != widthWithoutPadding ? widthWithoutPadding : 0, height1 = null != heightWithoutPadding ? heightWithoutPadding : 0;
324
331
  element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
325
332
  element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
326
333
  const {canvas: canvas} = this.internalProps;
327
- widthP = null !== (_f = null === (_e = canvas.parentElement) || void 0 === _e ? void 0 : _e.offsetWidth) && void 0 !== _f ? _f : 0,
328
- heightP = null !== (_h = null === (_g = canvas.parentElement) || void 0 === _g ? void 0 : _g.offsetHeight) && void 0 !== _h ? _h : 0,
329
- (null === (_j = null == this ? void 0 : this.scenegraph) || void 0 === _j ? void 0 : _j.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
334
+ widthP = null !== (_b = null === (_a = canvas.parentElement) || void 0 === _a ? void 0 : _a.offsetWidth) && void 0 !== _b ? _b : 0,
335
+ heightP = null !== (_d = null === (_c = canvas.parentElement) || void 0 === _c ? void 0 : _c.offsetHeight) && void 0 !== _d ? _d : 0,
336
+ (null === (_e = null == this ? void 0 : this.scenegraph) || void 0 === _e ? void 0 : _e.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
330
337
  canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
331
338
  canvas.style.height = `${heightP}px`);
332
339
  } else "node" === env_1.Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
333
340
  const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
334
- if (null === (_k = this.internalProps.theme) || void 0 === _k ? void 0 : _k.frameStyle) {
335
- const lineWidths = toBoxArray(null !== (_m = null === (_l = this.internalProps.theme.frameStyle) || void 0 === _l ? void 0 : _l.borderLineWidth) && void 0 !== _m ? _m : [ null ]), shadowWidths = toBoxArray(null !== (_p = null === (_o = this.internalProps.theme.frameStyle) || void 0 === _o ? void 0 : _o.shadowBlur) && void 0 !== _p ? _p : [ 0 ]);
336
- (null === (_q = this.theme.frameStyle) || void 0 === _q ? void 0 : _q.innerBorder) ? (this.tableX = 0,
337
- this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_r = shadowWidths[1]) && void 0 !== _r ? _r : 0),
338
- this.tableNoFrameHeight = height - (null !== (_s = shadowWidths[2]) && void 0 !== _s ? _s : 0)) : (this.tableX = (null !== (_t = lineWidths[3]) && void 0 !== _t ? _t : 0) + (null !== (_u = shadowWidths[3]) && void 0 !== _u ? _u : 0),
339
- this.tableY = (null !== (_v = lineWidths[0]) && void 0 !== _v ? _v : 0) + (null !== (_w = shadowWidths[0]) && void 0 !== _w ? _w : 0),
340
- this.tableNoFrameWidth = width - ((null !== (_x = lineWidths[1]) && void 0 !== _x ? _x : 0) + (null !== (_y = shadowWidths[1]) && void 0 !== _y ? _y : 0)) - ((null !== (_z = lineWidths[3]) && void 0 !== _z ? _z : 0) + (null !== (_0 = shadowWidths[3]) && void 0 !== _0 ? _0 : 0)),
341
- this.tableNoFrameHeight = height - ((null !== (_1 = lineWidths[0]) && void 0 !== _1 ? _1 : 0) + (null !== (_2 = shadowWidths[0]) && void 0 !== _2 ? _2 : 0)) - ((null !== (_3 = lineWidths[2]) && void 0 !== _3 ? _3 : 0) + (null !== (_4 = shadowWidths[2]) && void 0 !== _4 ? _4 : 0)));
341
+ if (null === (_f = this.internalProps.theme) || void 0 === _f ? void 0 : _f.frameStyle) {
342
+ const lineWidths = toBoxArray(null !== (_h = null === (_g = this.internalProps.theme.frameStyle) || void 0 === _g ? void 0 : _g.borderLineWidth) && void 0 !== _h ? _h : [ null ]), shadowWidths = toBoxArray(null !== (_k = null === (_j = this.internalProps.theme.frameStyle) || void 0 === _j ? void 0 : _j.shadowBlur) && void 0 !== _k ? _k : [ 0 ]);
343
+ (null === (_l = this.theme.frameStyle) || void 0 === _l ? void 0 : _l.innerBorder) ? (this.tableX = 0,
344
+ this.tableY = 0, this.tableNoFrameWidth = width - (null !== (_m = shadowWidths[1]) && void 0 !== _m ? _m : 0),
345
+ this.tableNoFrameHeight = height - (null !== (_o = shadowWidths[2]) && void 0 !== _o ? _o : 0)) : (this.tableX = (null !== (_p = lineWidths[3]) && void 0 !== _p ? _p : 0) + (null !== (_q = shadowWidths[3]) && void 0 !== _q ? _q : 0),
346
+ this.tableY = (null !== (_r = lineWidths[0]) && void 0 !== _r ? _r : 0) + (null !== (_s = shadowWidths[0]) && void 0 !== _s ? _s : 0),
347
+ this.tableNoFrameWidth = width - ((null !== (_t = lineWidths[1]) && void 0 !== _t ? _t : 0) + (null !== (_u = shadowWidths[1]) && void 0 !== _u ? _u : 0)) - ((null !== (_v = lineWidths[3]) && void 0 !== _v ? _v : 0) + (null !== (_w = shadowWidths[3]) && void 0 !== _w ? _w : 0)),
348
+ this.tableNoFrameHeight = height - ((null !== (_x = lineWidths[0]) && void 0 !== _x ? _x : 0) + (null !== (_y = shadowWidths[0]) && void 0 !== _y ? _y : 0)) - ((null !== (_z = lineWidths[2]) && void 0 !== _z ? _z : 0) + (null !== (_0 = shadowWidths[2]) && void 0 !== _0 ? _0 : 0)));
342
349
  }
343
350
  }
344
351
  get rowHierarchyType() {
@@ -1632,7 +1639,7 @@ class BaseTable extends EventTarget_1.EventTarget {
1632
1639
  exportImg() {
1633
1640
  return this.scenegraph.stage.toCanvas().toDataURL();
1634
1641
  }
1635
- exportCellImg(col, row) {
1642
+ exportCellImg(col, row, options) {
1636
1643
  var _a, _b, _c, _d;
1637
1644
  const isInView = this.cellIsInVisualView(col, row), {scrollTop: scrollTop, scrollLeft: scrollLeft} = this;
1638
1645
  isInView || this.scrollToCell({
@@ -1643,13 +1650,31 @@ class BaseTable extends EventTarget_1.EventTarget {
1643
1650
  (null === (_b = null === (_a = this.stateManager.select) || void 0 === _a ? void 0 : _a.ranges) || void 0 === _b ? void 0 : _b.length) > 0 && (0,
1644
1651
  update_select_border_1.hideCellSelectBorder)(this.scenegraph);
1645
1652
  const {col: hoverCol, row: hoverRow} = this.stateManager.hover.cellPos;
1646
- this.stateManager.updateHoverPos(-1, -1), this.scenegraph.component.hideVerticalScrollBar(),
1647
- this.scenegraph.component.hideHorizontalScrollBar(), this.scenegraph.renderSceneGraph();
1648
- const c = this.scenegraph.stage.toCanvas(!1, (new vutils_1.AABBBounds).set(cellRect.left + this.tableX + 1, cellRect.top + this.tableY + 1, cellRect.right + this.tableX, cellRect.bottom + this.tableY));
1649
- return isInView || (this.setScrollTop(scrollTop), this.setScrollLeft(scrollLeft)),
1650
- (null === (_d = null === (_c = this.stateManager.select) || void 0 === _c ? void 0 : _c.ranges) || void 0 === _d ? void 0 : _d.length) > 0 && (0,
1653
+ let oldFill, oldStroke;
1654
+ if (this.stateManager.updateHoverPos(-1, -1), this.scenegraph.component.hideVerticalScrollBar(),
1655
+ this.scenegraph.component.hideHorizontalScrollBar(), this.scenegraph.tableGroup.border.setAttribute("visible", !1),
1656
+ null == options ? void 0 : options.disableBackground) {
1657
+ const cellGroup = this.scenegraph.getCell(col, row);
1658
+ oldFill = cellGroup.attribute.fill, cellGroup.setAttribute("fill", "transparent");
1659
+ }
1660
+ if (null == options ? void 0 : options.disableBorder) {
1661
+ const cellGroup = this.scenegraph.getCell(col, row);
1662
+ oldStroke = cellGroup.attribute.stroke, cellGroup.setAttribute("stroke", !1);
1663
+ }
1664
+ this.scenegraph.renderSceneGraph();
1665
+ let sizeOffset = 0;
1666
+ "bottom-right" === this.theme.cellBorderClipDirection && (sizeOffset = 1);
1667
+ const c = this.scenegraph.stage.toCanvas(!1, (new vutils_1.AABBBounds).set(cellRect.left + this.tableX + 1, cellRect.top + this.tableY + 1, cellRect.right + this.tableX - sizeOffset, cellRect.bottom + this.tableY - sizeOffset));
1668
+ if (isInView || (this.setScrollTop(scrollTop), this.setScrollLeft(scrollLeft)),
1669
+ this.scenegraph.tableGroup.border.setAttribute("visible", !0), oldFill) {
1670
+ this.scenegraph.getCell(col, row).setAttribute("fill", oldFill);
1671
+ }
1672
+ if (oldStroke) {
1673
+ this.scenegraph.getCell(col, row).setAttribute("stroke", oldStroke);
1674
+ }
1675
+ return (null === (_d = null === (_c = this.stateManager.select) || void 0 === _c ? void 0 : _c.ranges) || void 0 === _d ? void 0 : _d.length) > 0 && (0,
1651
1676
  update_select_border_1.restoreCellSelectBorder)(this.scenegraph), this.stateManager.updateHoverPos(hoverCol, hoverRow),
1652
- c.toDataURL();
1677
+ this.scenegraph.updateNextFrame(), c.toDataURL();
1653
1678
  }
1654
1679
  exportCellRangeImg(cellRange) {
1655
1680
  var _a, _b, _c, _d;