@visactor/vchart 1.11.7 → 1.11.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.
package/build/index.js CHANGED
@@ -11886,7 +11886,7 @@
11886
11886
  const stage = this.target.stage;
11887
11887
  stage && stage.renderNextFrame();
11888
11888
  }
11889
- return 1 === this.subAnimates.length && this.tailAnimate.duration === customAnimate.duration && this.trySetAttribute(customAnimate.getFromProps(), customAnimate.mode), this;
11889
+ return 1 === this.subAnimates.length && this.tailAnimate.totalDuration === customAnimate.duration && this.trySetAttribute(customAnimate.getFromProps(), customAnimate.mode), this;
11890
11890
  }
11891
11891
  trySetAttribute(attr) {
11892
11892
  let mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Animate.mode;
@@ -32666,10 +32666,9 @@
32666
32666
  }, this._handleRelatedGraphicSetState = e => {
32667
32667
  var _a, _b, _c, _d, _e;
32668
32668
  if ((null === (_a = e.detail) || void 0 === _a ? void 0 : _a.type) === AttributeUpdateType.STATE || (null === (_b = e.detail) || void 0 === _b ? void 0 : _b.type) === AttributeUpdateType.ANIMATE_UPDATE && (null === (_c = e.detail.animationState) || void 0 === _c ? void 0 : _c.isFirstFrameOfStep)) {
32669
- const currentStates = null !== (_e = null === (_d = e.target) || void 0 === _d ? void 0 : _d.currentStates) && void 0 !== _e ? _e : [];
32670
- (this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)]).forEach(label => {
32671
- label && (label.text && label.text.useStates(currentStates), label.labelLine && label.labelLine.useStates(currentStates));
32672
- });
32669
+ const currentStates = null !== (_e = null === (_d = e.target) || void 0 === _d ? void 0 : _d.currentStates) && void 0 !== _e ? _e : [],
32670
+ labels = this._isCollectionBase ? [...this._graphicToText.values()] : [this._graphicToText.get(e.target)];
32671
+ this.updateStatesOfLabels(labels, currentStates);
32673
32672
  }
32674
32673
  };
32675
32674
  }
@@ -32695,7 +32694,7 @@
32695
32694
  let data = this.attribute.data;
32696
32695
  isFunction$1(dataFilter) && (data = dataFilter(data));
32697
32696
  let labels = this._initText(data);
32698
- labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : this._layout(labels), isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : !1 !== overlap && (labels = this._overlapping(labels)), labels && labels.length && labels.forEach(label => {
32697
+ labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : this._layout(labels), isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null) : !1 !== overlap && (labels = this._overlapping(labels)), isFunction$1(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null), labels && labels.length && labels.forEach(label => {
32699
32698
  this._bindEvent(label), this._setStatesOfText(label);
32700
32699
  }), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels);
32701
32700
  }
@@ -32887,7 +32886,7 @@
32887
32886
  }
32888
32887
  !hasPlace && !hideOnHit && result.push(text);
32889
32888
  }
32890
- return isFunction$1(this.onAfterLabelOverlap) && this.onAfterLabelOverlap(bitmap), result;
32889
+ return result;
32891
32890
  }
32892
32891
  getBaseMarkGroup() {
32893
32892
  const {
@@ -32926,7 +32925,10 @@
32926
32925
  }
32927
32926
  _renderWithAnimation(labels) {
32928
32927
  var _a;
32929
- const currentTextMap = new Map(),
32928
+ const {
32929
+ syncState: syncState
32930
+ } = this.attribute,
32931
+ currentTextMap = new Map(),
32930
32932
  prevTextMap = this._graphicToText || new Map(),
32931
32933
  texts = [],
32932
32934
  labelLines = [],
@@ -32934,12 +32936,18 @@
32934
32936
  visible: showLabelLine
32935
32937
  } = null !== (_a = this.attribute.line) && void 0 !== _a ? _a : {};
32936
32938
  labels && labels.forEach((text, index) => {
32939
+ var _a;
32937
32940
  const relatedGraphic = this.getRelatedGraphic(text.attribute),
32938
32941
  textId = text.attribute.id,
32939
32942
  textKey = this._isCollectionBase ? textId : relatedGraphic,
32940
32943
  state = (null == prevTextMap ? void 0 : prevTextMap.get(textKey)) ? "update" : "enter";
32941
32944
  let labelLine;
32942
- if (showLabelLine && (labelLine = this._createLabelLine(text, relatedGraphic)), "enter" === state) {
32945
+ if (showLabelLine && (labelLine = this._createLabelLine(text, relatedGraphic)), syncState && this.updateStatesOfLabels([labelLine ? {
32946
+ text: text,
32947
+ labelLine: labelLine
32948
+ } : {
32949
+ text: text
32950
+ }], null !== (_a = relatedGraphic.currentStates) && void 0 !== _a ? _a : []), "enter" === state) {
32943
32951
  if (texts.push(text), currentTextMap.set(textKey, labelLine ? {
32944
32952
  text: text,
32945
32953
  labelLine: labelLine
@@ -32975,17 +32983,26 @@
32975
32983
  }
32976
32984
  _renderWithOutAnimation(labels) {
32977
32985
  var _a;
32978
- const currentTextMap = new Map(),
32986
+ const {
32987
+ syncState: syncState
32988
+ } = this.attribute,
32989
+ currentTextMap = new Map(),
32979
32990
  prevTextMap = this._graphicToText || new Map(),
32980
32991
  {
32981
32992
  visible: showLabelLine
32982
32993
  } = null !== (_a = this.attribute.line) && void 0 !== _a ? _a : {};
32983
32994
  labels && labels.forEach(text => {
32995
+ var _a;
32984
32996
  const relatedGraphic = this.getRelatedGraphic(text.attribute),
32985
32997
  state = (null == prevTextMap ? void 0 : prevTextMap.get(relatedGraphic)) ? "update" : "enter",
32986
32998
  textKey = this._isCollectionBase ? text.attribute.id : relatedGraphic;
32987
32999
  let labelLine;
32988
- if (showLabelLine && (labelLine = this._createLabelLine(text, relatedGraphic)), "enter" === state) currentTextMap.set(textKey, labelLine ? {
33000
+ if (showLabelLine && (labelLine = this._createLabelLine(text, relatedGraphic)), syncState && this.updateStatesOfLabels([labelLine ? {
33001
+ text: text,
33002
+ labelLine: labelLine
33003
+ } : {
33004
+ text: text
33005
+ }], null !== (_a = relatedGraphic.currentStates) && void 0 !== _a ? _a : []), "enter" === state) currentTextMap.set(textKey, labelLine ? {
32989
33006
  text: text,
32990
33007
  labelLine: labelLine
32991
33008
  } : {
@@ -32998,6 +33015,11 @@
32998
33015
  this.removeChild(label.text), label.labelLine && this.removeChild(label.labelLine);
32999
33016
  }), this._graphicToText = currentTextMap;
33000
33017
  }
33018
+ updateStatesOfLabels(labels, currentStates) {
33019
+ labels.forEach(label => {
33020
+ label && (label.text && label.text.useStates(currentStates), label.labelLine && label.labelLine.useStates(currentStates));
33021
+ });
33022
+ }
33001
33023
  _syncStateWithRelatedGraphic(relatedGraphic) {
33002
33024
  this.attribute.syncState && relatedGraphic.on("afterAttributeUpdate", this._handleRelatedGraphicSetState);
33003
33025
  }
@@ -33266,11 +33288,14 @@
33266
33288
  textBoundsArray = labels.map(label => this.getGraphicBounds(label)),
33267
33289
  ellipsisLabelAttribute = Object.assign(Object.assign({}, this.attribute.textStyle), {
33268
33290
  text: "…"
33269
- }),
33270
- ellipsisText = this._createLabelText(ellipsisLabelAttribute),
33271
- ellipsisTextBounds = this.getGraphicBounds(ellipsisText),
33272
- ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1,
33273
- data = labels.map(label => label.attribute),
33291
+ });
33292
+ let ellipsisWidth = 1 / 0;
33293
+ if (!1 !== ellipsisLabelAttribute.ellipsis) {
33294
+ const ellipsisText = this._createLabelText(ellipsisLabelAttribute),
33295
+ ellipsisTextBounds = this.getGraphicBounds(ellipsisText);
33296
+ ellipsisWidth = ellipsisTextBounds.x2 - ellipsisTextBounds.x1;
33297
+ }
33298
+ const data = labels.map(label => label.attribute),
33274
33299
  arcs = this.layoutArcLabels(this.attribute.position, this.attribute, Array.from(this._idToGraphic.values()), data, textBoundsArray, ellipsisWidth);
33275
33300
  for (let i = 0; i < data.length; i++) {
33276
33301
  const textData = data[i],
@@ -66479,7 +66504,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
66479
66504
  registerComponentPlugin(CanvasTooltipHandler);
66480
66505
  };
66481
66506
 
66482
- const version = "1.11.7";
66507
+ const version = "1.11.8";
66483
66508
 
66484
66509
  const addVChartProperty = (data, op) => {
66485
66510
  const context = op.beforeCall();
@@ -93696,6 +93721,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
93696
93721
  })) {
93697
93722
  return false;
93698
93723
  }
93724
+ if (this._timer) {
93725
+ clearTimeout(this._timer);
93726
+ }
93699
93727
  let success;
93700
93728
  if (useCache) {
93701
93729
  success = !processor.showTooltip(this._cacheInfo, params, true);
@@ -93716,9 +93744,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
93716
93744
  this._clickLock = true;
93717
93745
  }
93718
93746
  else if (Number.isFinite(this._spec.hideTimer)) {
93719
- if (this._timer) {
93720
- clearTimeout(this._timer);
93721
- }
93722
93747
  this._timer = setTimeout(() => {
93723
93748
  this._handleChartMouseOut();
93724
93749
  }, this._spec.hideTimer);