@visactor/vtable 0.19.2-alpha.1 → 0.19.2-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 (77) hide show
  1. package/cjs/PivotChart.d.ts +0 -1
  2. package/cjs/PivotChart.js +0 -4
  3. package/cjs/PivotChart.js.map +1 -1
  4. package/cjs/core/BaseTable.d.ts +0 -3
  5. package/cjs/core/BaseTable.js +23 -37
  6. package/cjs/core/BaseTable.js.map +1 -1
  7. package/cjs/event/event.js +1 -2
  8. package/cjs/event/event.js.map +1 -1
  9. package/cjs/event/listener/container-dom.js +1 -1
  10. package/cjs/event/listener/container-dom.js.map +1 -1
  11. package/cjs/event/util.js +2 -2
  12. package/cjs/event/util.js.map +1 -1
  13. package/cjs/index.d.ts +1 -1
  14. package/cjs/index.js +1 -1
  15. package/cjs/index.js.map +1 -1
  16. package/cjs/scenegraph/debug-tool/debug-tool.js +1 -4
  17. package/cjs/scenegraph/debug-tool/debug-tool.js.map +1 -1
  18. package/cjs/scenegraph/graphic/chart.d.ts +0 -1
  19. package/cjs/scenegraph/graphic/chart.js +19 -33
  20. package/cjs/scenegraph/graphic/chart.js.map +1 -1
  21. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
  22. package/cjs/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  23. package/cjs/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
  24. package/cjs/scenegraph/graphic/contributions/chart-render.js +24 -40
  25. package/cjs/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  26. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
  27. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  28. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js +1 -2
  29. package/cjs/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  30. package/cjs/scenegraph/refresh-node/update-chart.d.ts +0 -1
  31. package/cjs/scenegraph/refresh-node/update-chart.js +2 -9
  32. package/cjs/scenegraph/refresh-node/update-chart.js.map +1 -1
  33. package/cjs/scenegraph/scenegraph.js +5 -11
  34. package/cjs/scenegraph/scenegraph.js.map +1 -1
  35. package/cjs/ts-types/base-table.d.ts +1 -11
  36. package/cjs/ts-types/base-table.js.map +1 -1
  37. package/cjs/vrender.js.map +1 -1
  38. package/dist/vtable.js +370 -488
  39. package/dist/vtable.min.js +2 -2
  40. package/es/PivotChart.d.ts +0 -1
  41. package/es/PivotChart.js +2 -5
  42. package/es/PivotChart.js.map +1 -1
  43. package/es/core/BaseTable.d.ts +0 -3
  44. package/es/core/BaseTable.js +22 -36
  45. package/es/core/BaseTable.js.map +1 -1
  46. package/es/event/event.js +1 -2
  47. package/es/event/event.js.map +1 -1
  48. package/es/event/listener/container-dom.js +1 -1
  49. package/es/event/listener/container-dom.js.map +1 -1
  50. package/es/event/util.js +2 -2
  51. package/es/event/util.js.map +1 -1
  52. package/es/index.d.ts +1 -1
  53. package/es/index.js +1 -1
  54. package/es/index.js.map +1 -1
  55. package/es/scenegraph/debug-tool/debug-tool.js +1 -4
  56. package/es/scenegraph/debug-tool/debug-tool.js.map +1 -1
  57. package/es/scenegraph/graphic/chart.d.ts +0 -1
  58. package/es/scenegraph/graphic/chart.js +20 -32
  59. package/es/scenegraph/graphic/chart.js.map +1 -1
  60. package/es/scenegraph/graphic/contributions/chart-render-helper.js +8 -20
  61. package/es/scenegraph/graphic/contributions/chart-render-helper.js.map +1 -1
  62. package/es/scenegraph/graphic/contributions/chart-render.d.ts +1 -2
  63. package/es/scenegraph/graphic/contributions/chart-render.js +25 -41
  64. package/es/scenegraph/graphic/contributions/chart-render.js.map +1 -1
  65. package/es/scenegraph/graphic/contributions/group-contribution-render.js +4 -4
  66. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  67. package/es/scenegraph/group-creater/cell-type/chart-cell.js +1 -2
  68. package/es/scenegraph/group-creater/cell-type/chart-cell.js.map +1 -1
  69. package/es/scenegraph/refresh-node/update-chart.d.ts +0 -1
  70. package/es/scenegraph/refresh-node/update-chart.js +0 -6
  71. package/es/scenegraph/refresh-node/update-chart.js.map +1 -1
  72. package/es/scenegraph/scenegraph.js +5 -11
  73. package/es/scenegraph/scenegraph.js.map +1 -1
  74. package/es/ts-types/base-table.d.ts +1 -11
  75. package/es/ts-types/base-table.js.map +1 -1
  76. package/es/vrender.js.map +1 -1
  77. package/package.json +5 -5
@@ -45,9 +45,9 @@ class BaseTable extends EventTarget_1.EventTarget {
45
45
  }
46
46
  constructor(container, options = {}) {
47
47
  var _a, _b, _c, _d, _e, _f, _g;
48
- if (super(), this.showFrozenIcon = !0, this.version = "0.19.2-alpha.1", this.id = `VTable${Date.now()}`,
48
+ if (super(), this.showFrozenIcon = !0, this.version = "0.19.2-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
- !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
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, keyboardOptions: keyboardOptions, eventOptions: eventOptions, columnResizeMode: columnResizeMode, 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} = options;
52
52
  this.container = container, this.options = options, this.options.container = container,
53
53
  this._widthMode = widthMode, this._heightMode = heightMode, this._autoFillWidth = autoFillWidth,
@@ -63,10 +63,8 @@ class BaseTable extends EventTarget_1.EventTarget {
63
63
  this.tableNoFrameHeight = 0, this.canvasWidth = canvasWidth, this.canvasHeight = canvasHeight;
64
64
  const internalProps = this.internalProps = {};
65
65
  void 0 !== showFrozenIcon && (this.showFrozenIcon = showFrozenIcon), "number" == typeof allowFrozenColCount && allowFrozenColCount <= 0 && (this.showFrozenIcon = !1),
66
- this.options.canvas ? (internalProps.element = this.options.canvas.parentElement,
67
- internalProps.element.style.position = "relative", internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
68
- internalProps.canvas = this.options.canvas, internalProps.context = internalProps.canvas.getContext("2d")) : "node" !== env_1.Env.mode && (internalProps.element = (0,
69
- tableHelper_1.createRootElement)(this.padding), internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
66
+ "node" !== env_1.Env.mode && (internalProps.element = (0, tableHelper_1.createRootElement)(this.padding),
67
+ internalProps.focusControl = new FouseInput_1.FocusInput(this, internalProps.element),
70
68
  internalProps.canvas = document.createElement("canvas"), internalProps.element.appendChild(internalProps.canvas),
71
69
  internalProps.context = internalProps.canvas.getContext("2d")), internalProps.handler = new EventHandler_1.EventHandler,
72
70
  (0, vutils_1.isNumber)(this.options.resizeTime) && (internalProps.handler.resizeTime = this.options.resizeTime),
@@ -298,37 +296,28 @@ class BaseTable extends EventTarget_1.EventTarget {
298
296
  this.internalProps.pixelRatio = pixelRatio, this.scenegraph.setPixelRatio(pixelRatio);
299
297
  }
300
298
  _updateSize() {
301
- 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;
299
+ 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;
302
300
  const {padding: padding} = this;
303
301
  let widthP = 0, heightP = 0;
304
- if (this.tableX = 0, this.tableY = 0, this.options.canvas && this.options.viewBox) widthP = this.options.viewBox.x2 - this.options.viewBox.x1,
305
- heightP = this.options.viewBox.y2 - this.options.viewBox.y1, (null === (_a = null == this ? void 0 : this.scenegraph) || void 0 === _a ? void 0 : _a.stage) && (this.options.viewBox ? this.scenegraph.stage.setViewBox(this.options.viewBox, !1) : this.scenegraph.stage.resize(widthP, heightP)); else if ("browser" === env_1.Env.mode) {
306
- const element = this.getElement(), width1 = null !== (_c = null === (_b = element.parentElement) || void 0 === _b ? void 0 : _b.offsetWidth) && void 0 !== _c ? _c : 0, height1 = null !== (_e = null === (_d = element.parentElement) || void 0 === _d ? void 0 : _d.offsetHeight) && void 0 !== _e ? _e : 0;
302
+ if ("browser" === env_1.Env.mode) {
303
+ 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;
307
304
  element.style.width = width1 && width1 - padding.left - padding.right + "px" || "0px",
308
305
  element.style.height = height1 && height1 - padding.top - padding.bottom + "px" || "0px";
309
306
  const {canvas: canvas} = this.internalProps;
310
- widthP = null !== (_g = null === (_f = canvas.parentElement) || void 0 === _f ? void 0 : _f.offsetWidth) && void 0 !== _g ? _g : 0,
311
- heightP = null !== (_j = null === (_h = canvas.parentElement) || void 0 === _h ? void 0 : _h.offsetHeight) && void 0 !== _j ? _j : 0,
312
- (null === (_k = null == this ? void 0 : this.scenegraph) || void 0 === _k ? void 0 : _k.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
307
+ widthP = null !== (_f = null === (_e = canvas.parentElement) || void 0 === _e ? void 0 : _e.offsetWidth) && void 0 !== _f ? _f : 0,
308
+ heightP = null !== (_h = null === (_g = canvas.parentElement) || void 0 === _g ? void 0 : _g.offsetHeight) && void 0 !== _h ? _h : 0,
309
+ (null === (_j = null == this ? void 0 : this.scenegraph) || void 0 === _j ? void 0 : _j.stage) ? this.scenegraph.stage.resize(widthP, heightP) : (canvas.style.width = "",
313
310
  canvas.style.height = "", canvas.width = widthP, canvas.height = heightP, canvas.style.width = `${widthP}px`,
314
311
  canvas.style.height = `${heightP}px`);
315
312
  } else "node" === env_1.Env.mode && (widthP = this.canvasWidth - 1, heightP = this.canvasHeight - 1);
316
313
  const width = Math.floor(widthP - style.getScrollBarSize(this.getTheme().scrollStyle)), height = Math.floor(heightP - style.getScrollBarSize(this.getTheme().scrollStyle));
317
- if (null === (_l = this.internalProps.theme) || void 0 === _l ? void 0 : _l.frameStyle) {
318
- const lineWidths = toBoxArray(null !== (_o = null === (_m = this.internalProps.theme.frameStyle) || void 0 === _m ? void 0 : _m.borderLineWidth) && void 0 !== _o ? _o : [ null ]), shadowWidths = toBoxArray(null !== (_q = null === (_p = this.internalProps.theme.frameStyle) || void 0 === _p ? void 0 : _p.shadowBlur) && void 0 !== _q ? _q : [ 0 ]);
319
- this.tableX += (null !== (_r = lineWidths[3]) && void 0 !== _r ? _r : 0) + (null !== (_s = shadowWidths[3]) && void 0 !== _s ? _s : 0),
320
- this.tableY += (null !== (_t = lineWidths[0]) && void 0 !== _t ? _t : 0) + (null !== (_u = shadowWidths[0]) && void 0 !== _u ? _u : 0),
321
- this.tableNoFrameWidth = width - ((null !== (_v = lineWidths[1]) && void 0 !== _v ? _v : 0) + (null !== (_w = shadowWidths[1]) && void 0 !== _w ? _w : 0)) - ((null !== (_x = lineWidths[3]) && void 0 !== _x ? _x : 0) + (null !== (_y = shadowWidths[3]) && void 0 !== _y ? _y : 0)),
322
- this.tableNoFrameHeight = height - ((null !== (_z = lineWidths[0]) && void 0 !== _z ? _z : 0) + (null !== (_0 = shadowWidths[0]) && void 0 !== _0 ? _0 : 0)) - ((null !== (_1 = lineWidths[2]) && void 0 !== _1 ? _1 : 0) + (null !== (_2 = shadowWidths[2]) && void 0 !== _2 ? _2 : 0));
323
- } else this.tableX += 0, this.tableY += 0, this.tableNoFrameWidth = width, this.tableNoFrameHeight = height;
324
- }
325
- updateViewBox(newViewBox) {
326
- var _a, _b, _c, _d, _e, _f, _g, _h;
327
- const oldWidth = null !== (_d = null !== (_b = null === (_a = this.options) || void 0 === _a ? void 0 : _a.viewBox.x2) && void 0 !== _b ? _b : 0 - (null === (_c = this.options) || void 0 === _c ? void 0 : _c.viewBox.x1)) && void 0 !== _d ? _d : 0, oldHeight = null !== (_h = null !== (_f = null === (_e = this.options) || void 0 === _e ? void 0 : _e.viewBox.y2) && void 0 !== _f ? _f : 0 - (null === (_g = this.options) || void 0 === _g ? void 0 : _g.viewBox.y1)) && void 0 !== _h ? _h : 0, newWidth = newViewBox.x2 - newViewBox.x1, newHeight = newViewBox.y2 - newViewBox.y1;
328
- this.options.viewBox = newViewBox, oldWidth !== newWidth || oldHeight !== newHeight ? this.resize() : this.scenegraph.stage.setViewBox(this.options.viewBox, !0);
329
- }
330
- setViewBoxTransform(a, b, c, d, e, f) {
331
- this.scenegraph.stage.window.setViewBoxTransform(a, b, c, d, e, f);
314
+ if (null === (_k = this.internalProps.theme) || void 0 === _k ? void 0 : _k.frameStyle) {
315
+ 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 ]);
316
+ this.tableX = (null !== (_q = lineWidths[3]) && void 0 !== _q ? _q : 0) + (null !== (_r = shadowWidths[3]) && void 0 !== _r ? _r : 0),
317
+ this.tableY = (null !== (_s = lineWidths[0]) && void 0 !== _s ? _s : 0) + (null !== (_t = shadowWidths[0]) && void 0 !== _t ? _t : 0),
318
+ this.tableNoFrameWidth = width - ((null !== (_u = lineWidths[1]) && void 0 !== _u ? _u : 0) + (null !== (_v = shadowWidths[1]) && void 0 !== _v ? _v : 0)) - ((null !== (_w = lineWidths[3]) && void 0 !== _w ? _w : 0) + (null !== (_x = shadowWidths[3]) && void 0 !== _x ? _x : 0)),
319
+ this.tableNoFrameHeight = height - ((null !== (_y = lineWidths[0]) && void 0 !== _y ? _y : 0) + (null !== (_z = shadowWidths[0]) && void 0 !== _z ? _z : 0)) - ((null !== (_0 = lineWidths[2]) && void 0 !== _0 ? _0 : 0) + (null !== (_1 = shadowWidths[2]) && void 0 !== _1 ? _1 : 0));
320
+ }
332
321
  }
333
322
  get rowHierarchyType() {
334
323
  return "grid";
@@ -589,11 +578,8 @@ class BaseTable extends EventTarget_1.EventTarget {
589
578
  }));
590
579
  }
591
580
  _toRelativeRect(absoluteRect, relativeX = !0, relativeY = !0) {
592
- var _a, _b, _c, _d;
593
581
  const rect = absoluteRect.copy(), visibleRect = this.getVisibleRect();
594
582
  return rect.offsetLeft(this.tableX - (relativeX ? visibleRect.left : 0)), rect.offsetTop(this.tableY - (relativeY ? visibleRect.top : 0)),
595
- rect.offsetLeft(null !== (_b = null === (_a = this.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0),
596
- rect.offsetTop(null !== (_d = null === (_c = this.options.viewBox) || void 0 === _c ? void 0 : _c.y1) && void 0 !== _d ? _d : 0),
597
583
  rect;
598
584
  }
599
585
  getVisibleRect() {
@@ -697,8 +683,7 @@ class BaseTable extends EventTarget_1.EventTarget {
697
683
  return null === (_a = null == releaseObj ? void 0 : releaseObj.release) || void 0 === _a ? void 0 : _a.call(releaseObj);
698
684
  })), internalProps.releaseList = null), this.scenegraph.stage.release(), this.scenegraph.proxy.release();
699
685
  const {parentElement: parentElement} = internalProps.element;
700
- parentElement && !this.options.canvas && parentElement.removeChild(internalProps.element),
701
- this.isReleased = !0;
686
+ parentElement && parentElement.removeChild(internalProps.element), this.isReleased = !0;
702
687
  }
703
688
  fireListeners(type, event) {
704
689
  return super.fireListeners(type, event);
@@ -783,7 +768,6 @@ class BaseTable extends EventTarget_1.EventTarget {
783
768
  return new Rect_1.Rect(this.tableX, this.tableY, width, height);
784
769
  }
785
770
  _getMouseAbstractPoint(evt, isAddScroll = !0) {
786
- var _a, _b, _c, _d;
787
771
  let e;
788
772
  if (!evt) return {
789
773
  inTable: !1,
@@ -796,8 +780,8 @@ class BaseTable extends EventTarget_1.EventTarget {
796
780
  rect.right <= clientX && (inTable = !1), rect.bottom <= clientY && (inTable = !1);
797
781
  const currentWidth = rect.width, widthRatio = currentWidth / (this.canvas.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (this.canvas.offsetHeight || currentHeight);
798
782
  return {
799
- x: (clientX - rect.left) / widthRatio + (isAddScroll ? this.scrollLeft : 0) - (null !== (_b = null === (_a = this.options.viewBox) || void 0 === _a ? void 0 : _a.x1) && void 0 !== _b ? _b : 0),
800
- y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0) - (null !== (_d = null === (_c = this.options.viewBox) || void 0 === _c ? void 0 : _c.y1) && void 0 !== _d ? _d : 0),
783
+ x: (clientX - rect.left) / widthRatio + (isAddScroll ? this.scrollLeft : 0),
784
+ y: (clientY - rect.top) / heightRatio + (isAddScroll ? this.scrollTop : 0),
801
785
  inTable: inTable
802
786
  };
803
787
  }
@@ -1191,8 +1175,10 @@ class BaseTable extends EventTarget_1.EventTarget {
1191
1175
  dataValue: this.getCellOriginValue(col, row),
1192
1176
  cellHeaderPaths: this.getCellHeaderPaths(col, row)
1193
1177
  }, styleClass, this.options.autoWrapText); else {
1178
+ let defaultStyle;
1179
+ defaultStyle = layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row) || this.internalProps.transpose && layoutMap.isRowHeader(col, row) ? this.theme.headerStyle : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row) ? this.theme.rowHeaderStyle : this.theme.cornerHeaderStyle;
1194
1180
  const style = (null == hd ? void 0 : hd.style) || {};
1195
- paddingForAxis && (style.padding = paddingForAxis), cacheStyle = headerStyleContents.of(style, layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row) ? this.theme.headerStyle : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row) ? this.theme.rowHeaderStyle : this.theme.cornerHeaderStyle, {
1181
+ paddingForAxis && (style.padding = paddingForAxis), cacheStyle = headerStyleContents.of(style, defaultStyle, {
1196
1182
  col: col,
1197
1183
  row: row,
1198
1184
  table: this,