@visactor/vchart 1.2.2-beta.2 → 1.2.2-hotfix.0

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 (41) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +76 -46
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/core/factory.js +2 -1
  6. package/cjs/core/index.d.ts +1 -1
  7. package/cjs/core/index.js +1 -1
  8. package/cjs/core/index.js.map +1 -1
  9. package/cjs/data/initialize.js +1 -2
  10. package/cjs/interaction/config.d.ts +6 -6
  11. package/cjs/interaction/config.js +6 -6
  12. package/cjs/interaction/config.js.map +1 -1
  13. package/cjs/mark/arc-3d.js +1 -1
  14. package/cjs/mark/arc.js +1 -1
  15. package/cjs/mark/area.js +1 -1
  16. package/cjs/mark/box-plot.js +1 -1
  17. package/cjs/mark/cell.js +1 -1
  18. package/cjs/model/base-model.js +1 -1
  19. package/cjs/model/interface.js +1 -1
  20. package/cjs/model/layout-item.js +1 -1
  21. package/cjs/model/model-state-manager.js +1 -1
  22. package/cjs/model/tooltip-helper.js +1 -1
  23. package/esm/core/factory.js +2 -1
  24. package/esm/core/index.d.ts +1 -1
  25. package/esm/core/index.js +1 -1
  26. package/esm/core/index.js.map +1 -1
  27. package/esm/data/initialize.js +1 -2
  28. package/esm/interaction/config.d.ts +6 -6
  29. package/esm/interaction/config.js +6 -6
  30. package/esm/interaction/config.js.map +1 -1
  31. package/esm/mark/arc-3d.js +1 -1
  32. package/esm/mark/arc.js +1 -1
  33. package/esm/mark/area.js +1 -1
  34. package/esm/mark/box-plot.js +1 -1
  35. package/esm/mark/cell.js +1 -1
  36. package/esm/model/base-model.js +1 -1
  37. package/esm/model/interface.js +1 -1
  38. package/esm/model/layout-item.js +1 -1
  39. package/esm/model/model-state-manager.js +1 -1
  40. package/esm/model/tooltip-helper.js +1 -1
  41. package/package.json +5 -5
package/build/index.js CHANGED
@@ -26008,6 +26008,7 @@
26008
26008
  if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
26009
26009
  if (maxLineWidth > 0) for (let i = 0; i < lines.length; i++) {
26010
26010
  const str = lines[i];
26011
+ let needCut = !0;
26011
26012
  if (i === lineCountLimit - 1) {
26012
26013
  const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);
26013
26014
  linesLayout.push({
@@ -26017,14 +26018,17 @@
26017
26018
  break;
26018
26019
  }
26019
26020
  const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth);
26020
- if ("" !== str && "" === clip.str) if (ellipsis) {
26021
- const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);
26022
- clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
26023
- } else clip.str = "", clip.width = 0;
26021
+ if ("" !== str && "" === clip.str) {
26022
+ if (ellipsis) {
26023
+ const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis);
26024
+ clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
26025
+ } else clip.str = "", clip.width = 0;
26026
+ needCut = !1;
26027
+ }
26024
26028
  if (linesLayout.push({
26025
26029
  str: clip.str,
26026
26030
  width: clip.width
26027
- }), clip.str.length === str.length) ;else {
26031
+ }), clip.str.length === str.length) ;else if (needCut) {
26028
26032
  const newStr = str.substring(clip.str.length);
26029
26033
  lines.splice(i + 1, 0, newStr);
26030
26034
  }
@@ -30015,7 +30019,8 @@
30015
30019
  getBoundingClientRect: () => ({
30016
30020
  height: domref.height,
30017
30021
  width: domref.width
30018
- })
30022
+ }),
30023
+ nativeCanvas: _canvas
30019
30024
  };
30020
30025
  canvasMap.set(id, canvas), i >= freeCanvasIdx && freeCanvasList.push(canvas);
30021
30026
  });
@@ -31258,7 +31263,10 @@
31258
31263
  applyPosition() {}
31259
31264
  hide() {}
31260
31265
  show() {}
31261
- resize(width, height) {}
31266
+ resize(width, height) {
31267
+ this._pixelWidth = width * this._dpr, this._pixelHeight = height * this._dpr, this._displayWidth = width, this._displayHeight = height, this._nativeCanvas.width = this._pixelWidth, this._nativeCanvas.height = this._pixelHeight, this._nativeCanvas.nativeCanvas && (this._nativeCanvas.nativeCanvas.width = this._pixelWidth, this._nativeCanvas.nativeCanvas.height = this._pixelHeight);
31268
+ this._context.dpr = this._dpr;
31269
+ }
31262
31270
  toDataURL(mimeType, quality) {
31263
31271
  return "";
31264
31272
  }
@@ -31370,7 +31378,9 @@
31370
31378
  });
31371
31379
  }
31372
31380
  releaseWindow() {}
31373
- resizeWindow(width, height) {}
31381
+ resizeWindow(width, height) {
31382
+ this.canvas.resize(width, height);
31383
+ }
31374
31384
  setDpr(dpr) {
31375
31385
  this.canvas.dpr = dpr;
31376
31386
  }
@@ -40716,29 +40726,34 @@
40716
40726
  }
40717
40727
  return t;
40718
40728
  };
40729
+ const _tBounds = new AABBBounds();
40719
40730
  class PopTip extends AbstractComponent {
40720
40731
  constructor(attributes) {
40721
40732
  super(merge$2({}, PopTip.defaultAttributes, attributes)), this.name = "poptip", this.positionList = ["top", "tl", "tr", "bottom", "bl", "br", "left", "lt", "lb", "right", "rt", "rb"];
40722
40733
  }
40723
40734
  render() {
40724
- var _a, _b, _c, _d, _e;
40735
+ var _a, _b, _c, _d, _e, _f, _g, _h;
40725
40736
  const {
40726
- title = "",
40727
- titleStyle = {},
40728
- position: position,
40729
- content = "",
40730
- contentStyle = {},
40731
- panel = {},
40732
- space = 4,
40733
- minWidth = 0,
40734
- maxWidth = 1 / 0,
40735
- padding = 4,
40736
- visible: visible,
40737
- state: state,
40738
- dx = 0,
40739
- dy = 0
40740
- } = this.attribute,
40741
- parsedPadding = normalizePadding$1(padding),
40737
+ titleStyle = {},
40738
+ position: position,
40739
+ contentStyle = {},
40740
+ panel = {},
40741
+ space = 4,
40742
+ minWidth = 0,
40743
+ maxWidth = 1 / 0,
40744
+ padding = 4,
40745
+ maxWidthPercent: maxWidthPercent,
40746
+ visible: visible,
40747
+ state: state,
40748
+ dx = 0,
40749
+ dy = 0
40750
+ } = this.attribute;
40751
+ let {
40752
+ title = "",
40753
+ content = ""
40754
+ } = this.attribute;
40755
+ title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
40756
+ const parsedPadding = normalizePadding$1(padding),
40742
40757
  group = this.createOrUpdateChild("poptip-content", {
40743
40758
  x: 0,
40744
40759
  y: 0,
@@ -40747,7 +40762,7 @@
40747
40762
  maxLineWidth = maxWidth - parsedPadding[1] - parsedPadding[3],
40748
40763
  titleVisible = isValid(title) && !1 !== visible,
40749
40764
  titleAttrs = Object.assign(Object.assign({
40750
- text: title,
40765
+ text: isArray$3(title) ? title : [title],
40751
40766
  visible: titleVisible
40752
40767
  }, titleStyle), {
40753
40768
  x: parsedPadding[3],
@@ -40756,7 +40771,7 @@
40756
40771
  textAlign: "left",
40757
40772
  textBaseline: "top"
40758
40773
  }),
40759
- titleShape = group.createOrUpdateChild("poptip-title", titleAttrs, "text");
40774
+ titleShape = group.createOrUpdateChild("poptip-title", titleAttrs, "wrapText");
40760
40775
  isEmpty(null == state ? void 0 : state.title) || (titleShape.states = state.title);
40761
40776
  const titleBounds = titleShape.AABBBounds,
40762
40777
  titleHeight = titleBounds.height(),
@@ -40765,7 +40780,7 @@
40765
40780
  titleVisible || (height = 0);
40766
40781
  const contentVisible = isValid(content) && !1 !== visible,
40767
40782
  contentAttrs = Object.assign(Object.assign({
40768
- text: content,
40783
+ text: isArray$3(content) ? content : [content],
40769
40784
  visible: contentVisible
40770
40785
  }, contentStyle), {
40771
40786
  x: parsedPadding[3],
@@ -40774,7 +40789,7 @@
40774
40789
  textAlign: "left",
40775
40790
  textBaseline: "top"
40776
40791
  }),
40777
- contentShape = group.createOrUpdateChild("poptip-content", contentAttrs, "text");
40792
+ contentShape = group.createOrUpdateChild("poptip-content", contentAttrs, "wrapText");
40778
40793
  isEmpty(null == state ? void 0 : state.content) || (contentShape.states = state.content);
40779
40794
  const contentBounds = contentShape.AABBBounds,
40780
40795
  contentHeight = contentBounds.height(),
@@ -40782,20 +40797,32 @@
40782
40797
  contentVisible && (height += contentHeight);
40783
40798
  let popTipWidth = max$3(titleWidth + parsedPadding[1] + parsedPadding[3], contentWidth + parsedPadding[1] + parsedPadding[3]);
40784
40799
  popTipWidth > maxWidth ? popTipWidth = maxWidth : popTipWidth < minWidth && (popTipWidth = minWidth);
40785
- const poptipHeight = parsedPadding[0] + parsedPadding[2] + height,
40786
- {
40800
+ let poptipHeight = parsedPadding[0] + parsedPadding[2] + height;
40801
+ const {
40787
40802
  visible: bgVisible
40788
40803
  } = panel,
40789
40804
  backgroundStyle = __rest$5(panel, ["visible"]),
40790
40805
  symbolSize = null !== (_a = backgroundStyle.size) && void 0 !== _a ? _a : 12,
40791
40806
  spaceSize = isArray$3(symbolSize) ? [symbolSize[0] + (null !== (_b = backgroundStyle.space) && void 0 !== _b ? _b : 0), symbolSize[1] + (null !== (_c = backgroundStyle.space) && void 0 !== _c ? _c : 0)] : symbolSize + (null !== (_d = backgroundStyle.space) && void 0 !== _d ? _d : 0),
40792
40807
  lineWidth = null !== (_e = backgroundStyle.lineWidth) && void 0 !== _e ? _e : 1,
40793
- range = this.stage ? [this.stage.width, this.stage.height] : void 0,
40794
- layout = "auto" === position;
40795
- let minifyBBoxI,
40796
- minifyBBoxSize = 1 / 0;
40808
+ range = this.stage ? [null !== (_f = this.stage.viewWidth) && void 0 !== _f ? _f : this.stage.width, null !== (_g = this.stage.viewHeight) && void 0 !== _g ? _g : this.stage.height] : void 0;
40809
+ if (range) {
40810
+ const b = this.AABBBounds,
40811
+ leftWidth = null !== (_h = this.attribute.x) && void 0 !== _h ? _h : b.x1,
40812
+ rightWidth = range[0] - b.x1;
40813
+ let maxSpace = Math.max(leftWidth, rightWidth);
40814
+ const buf = (isArray$3(symbolSize) ? symbolSize[0] : 12) + 3;
40815
+ if (maxSpace = Math.min(maxSpace - buf, maxSpace * maxWidthPercent), maxSpace < popTipWidth) {
40816
+ popTipWidth = maxSpace;
40817
+ const buf = parsedPadding[1] + parsedPadding[3];
40818
+ titleShape.setAttribute("maxLineWidth", maxSpace - buf), contentShape.setAttribute("maxLineWidth", maxSpace - buf), poptipHeight = parsedPadding[0] + parsedPadding[2], titleVisible && (poptipHeight += titleShape.AABBBounds.height() + space), poptipHeight += contentShape.AABBBounds.height();
40819
+ }
40820
+ }
40821
+ const layout = "auto" === position;
40822
+ let maxBBoxI,
40823
+ maxBBoxSize = -1 / 0;
40797
40824
  for (let i = 0; i < this.positionList.length + 1; i++) {
40798
- const p = layout ? this.positionList[i === this.positionList.length ? minifyBBoxI : i] : position,
40825
+ const p = layout ? this.positionList[i === this.positionList.length ? maxBBoxI : i] : position,
40799
40826
  {
40800
40827
  angle: angle,
40801
40828
  offset: offset,
@@ -40833,13 +40860,14 @@
40833
40860
  y: -offset[1] + dy
40834
40861
  }), !layout || !range) break;
40835
40862
  {
40836
- const b = this.AABBBounds,
40863
+ _tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
40864
+ const b = _tBounds,
40837
40865
  stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);
40838
40866
  if (rectInsideAnotherRect(b, stageBounds, !1)) break;
40839
40867
  {
40840
40868
  const bbox = getRectIntersect(b, stageBounds, !1),
40841
40869
  size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
40842
- size < minifyBBoxSize && (minifyBBoxSize = size, minifyBBoxI = i);
40870
+ size > maxBBoxSize && (maxBBoxSize = size, maxBBoxI = i);
40843
40871
  }
40844
40872
  }
40845
40873
  }
@@ -40939,6 +40967,7 @@
40939
40967
  textAlign: "left",
40940
40968
  textBaseline: "top"
40941
40969
  },
40970
+ maxWidthPercent: .8,
40942
40971
  space: 8,
40943
40972
  padding: 10
40944
40973
  };
@@ -40987,7 +41016,8 @@
40987
41016
  visibleCb: visibleCb
40988
41017
  } = graphic.attribute.poptip || {};
40989
41018
  if (!1 === visible || visibleCb && !1 === visibleCb(graphic)) return;
40990
- this.poptipComponent || (this.poptipComponent = new PopTip(graphic.attribute.poptip));
41019
+ const attribute = {};
41020
+ graphic.attribute.poptip && merge$2(attribute, PopTip.defaultAttributes, graphic.attribute.poptip), this.poptipComponent ? this.poptipComponent.initAttributes(attribute) : this.poptipComponent = new PopTip(attribute);
40991
41021
  let poptip = graphic.attribute.poptip || {};
40992
41022
  if ("text" === graphic.type && null == poptip.title && null == poptip.content) {
40993
41023
  const out = {};
@@ -58418,7 +58448,7 @@
58418
58448
  VChart.useMark([ComponentMark, GroupMark, ImageMark]);
58419
58449
  Factory.registerRegion('region', Region);
58420
58450
  Factory.registerLayout('base', Layout);
58421
- const version = "1.2.2-beta.2";
58451
+ const version = "1.2.2-hotfix.0";
58422
58452
  Logger.getInstance(LoggerLevel.Error);
58423
58453
 
58424
58454
  var SeriesMarkNameEnum;
@@ -60304,8 +60334,8 @@
60304
60334
  [exports.RenderModeEnum['mobile-browser']]: {
60305
60335
  hover: {
60306
60336
  enable: true,
60307
- trigger: 'pointerover',
60308
- triggerOff: 'pointerout'
60337
+ trigger: ['pointerdown', 'pointermove'],
60338
+ triggerOff: ['pointermove', 'pointerleave']
60309
60339
  },
60310
60340
  select: {
60311
60341
  enable: true,
@@ -60315,8 +60345,8 @@
60315
60345
  [exports.RenderModeEnum.miniApp]: {
60316
60346
  hover: {
60317
60347
  enable: true,
60318
- trigger: 'pointerover',
60319
- triggerOff: 'pointerout'
60348
+ trigger: ['pointerdown', 'pointermove'],
60349
+ triggerOff: ['pointermove', 'pointerleave']
60320
60350
  },
60321
60351
  select: {
60322
60352
  enable: true,
@@ -60326,8 +60356,8 @@
60326
60356
  [exports.RenderModeEnum.lynx]: {
60327
60357
  hover: {
60328
60358
  enable: true,
60329
- trigger: 'pointerover',
60330
- triggerOff: 'pointerout'
60359
+ trigger: ['pointerdown', 'pointermove'],
60360
+ triggerOff: ['pointermove', 'pointerleave']
60331
60361
  },
60332
60362
  select: {
60333
60363
  enable: true,