@visactor/react-vchart 2.0.23-alpha.5 → 2.0.23-alpha.6

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
@@ -57833,7 +57833,7 @@
57833
57833
  this._interaction = new Interaction();
57834
57834
  const series = this.getAllSeries(),
57835
57835
  mergedTriggers = [],
57836
- mergedTriggersMarks = {};
57836
+ groupedTriggers = [];
57837
57837
  series.forEach(s => {
57838
57838
  const triggers = s.getInteractionTriggers();
57839
57839
  if (triggers && triggers.length) {
@@ -57842,12 +57842,17 @@
57842
57842
  trigger: trigger,
57843
57843
  marks: marks
57844
57844
  }) => {
57845
- const interactionId = `${regionId}-${trigger.type}`;
57846
- mergedTriggersMarks[interactionId] ? marks.forEach(m => {
57847
- mergedTriggersMarks[interactionId].marks.push(m);
57848
- }) : (mergedTriggersMarks[interactionId] = Object.assign(Object.assign({}, trigger), {
57849
- marks: marks
57850
- }), mergedTriggers.push(mergedTriggersMarks[interactionId]));
57845
+ const sameTrigger = groupedTriggers.find(item => item.regionId === regionId && isEqual(item.config, trigger));
57846
+ if (sameTrigger) sameTrigger.trigger.marks.push(...marks);else {
57847
+ const mergedTrigger = Object.assign(Object.assign({}, trigger), {
57848
+ marks: [...marks]
57849
+ });
57850
+ groupedTriggers.push({
57851
+ regionId: regionId,
57852
+ config: Object.assign({}, trigger),
57853
+ trigger: mergedTrigger
57854
+ }), mergedTriggers.push(mergedTrigger);
57855
+ }
57851
57856
  });
57852
57857
  }
57853
57858
  }), mergedTriggers.forEach(trigger => {
@@ -60567,7 +60572,7 @@
60567
60572
  visible: !0
60568
60573
  }, "normal", AttributeLevel.Series) : this.setMarkStyle(this._symbolMark, {
60569
60574
  visible: this._getInvalidDefined.bind(this)
60570
- }, "normal", AttributeLevel.Series), this._symbolMark.getProduct() && this._symbolMark.compileEncode(), this._isGeoCoordinateSeries() && (this._updateSymbolGraphicPosition(), this._refreshLabelComponent(!0, !0));
60575
+ }, "normal", AttributeLevel.Series), this._symbolMark.getProduct() && this._symbolMark.compileEncode();
60571
60576
  }
60572
60577
  initLabelMarkStyle(labelMark) {
60573
60578
  labelMark && (this._labelMark = labelMark, this.setMarkStyle(labelMark, {
@@ -60598,22 +60603,6 @@
60598
60603
  postMatrix: new Matrix()
60599
60604
  }), labelGraphic;
60600
60605
  }
60601
- _isGeoCoordinateSeries() {
60602
- var _a, _b;
60603
- return (null === (_b = null === (_a = this.getXAxisHelper()) || void 0 === _a ? void 0 : _a.getAxisType) || void 0 === _b ? void 0 : _b.call(_a)) === ComponentTypeEnum.geoCoordinate;
60604
- }
60605
- _refreshLabelComponent(resetPostMatrix = !1, disableAnimation = !1) {
60606
- var _a, _b;
60607
- const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent(),
60608
- labelGraphic = null === (_b = null == vgrammarLabel ? void 0 : vgrammarLabel.getComponent) || void 0 === _b ? void 0 : _b.call(vgrammarLabel);
60609
- resetPostMatrix && (null == labelGraphic ? void 0 : labelGraphic.attribute.postMatrix) && labelGraphic.setAttributes({
60610
- postMatrix: new Matrix()
60611
- }), disableAnimation && (null == labelGraphic ? void 0 : labelGraphic.disableAnimation) && (labelGraphic.disableAnimation(), this._enableLabelAnimationHook || (this._enableLabelAnimationHook = () => {
60612
- var _a, _b, _c, _d;
60613
- const currentLabelGraphic = null === (_c = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent) || void 0 === _c ? void 0 : _c.call(_b);
60614
- null === (_d = null == currentLabelGraphic ? void 0 : currentLabelGraphic.enableAnimation) || void 0 === _d || _d.call(currentLabelGraphic), this.event.off(HOOK_EVENT.AFTER_MARK_RENDER_END, this._enableLabelAnimationHook), this._enableLabelAnimationHook = void 0;
60615
- }, this.event.on(HOOK_EVENT.AFTER_MARK_RENDER_END, this._enableLabelAnimationHook))), (null == vgrammarLabel ? void 0 : vgrammarLabel.getProduct()) && vgrammarLabel.renderInner();
60616
- }
60617
60606
  handleZoom(e) {
60618
60607
  const {
60619
60608
  scale: scale,
@@ -60634,12 +60623,14 @@
60634
60623
  labelGraphic && labelGraphic.translate(delta[0], delta[1]);
60635
60624
  }
60636
60625
  onLayoutEnd() {
60637
- var _a, _b;
60626
+ var _a, _b, _c;
60638
60627
  super.onLayoutEnd(), this._updateSymbolGraphicPosition();
60639
60628
  const labelGraphic = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent();
60640
60629
  (null == labelGraphic ? void 0 : labelGraphic.attribute.postMatrix) && labelGraphic.setAttributes({
60641
60630
  postMatrix: new Matrix()
60642
- }), this._refreshLabelComponent();
60631
+ });
60632
+ const vgrammarLabel = null === (_c = this._labelMark) || void 0 === _c ? void 0 : _c.getComponent();
60633
+ vgrammarLabel && vgrammarLabel.renderInner();
60643
60634
  }
60644
60635
  getDefaultShapeType() {
60645
60636
  return "circle";
@@ -76156,11 +76147,12 @@
76156
76147
 
76157
76148
  class RadarChartSpecTransformer extends RoseLikeChartSpecTransformer {
76158
76149
  _getDefaultSeriesSpec(spec) {
76159
- var _a;
76160
- const series = super._getDefaultSeriesSpec(spec);
76150
+ var _a, _b, _c, _d;
76151
+ const series = super._getDefaultSeriesSpec(spec),
76152
+ areaTheme = null === (_b = (_a = this._option).getTheme) || void 0 === _b ? void 0 : _b.call(_a, "series", "radar", "area");
76161
76153
  return series.line = spec.line, series.point = spec.point, series.stack = spec.stack, series.percent = spec.percent, series.area = mergeSpec({
76162
- visible: !1
76163
- }, spec.area), series.seriesMark = null !== (_a = spec.seriesMark) && void 0 !== _a ? _a : "area", series.activePoint = spec.activePoint, series.pointDis = spec.pointDis, series.pointDisMul = spec.pointDisMul, series.markOverlap = spec.markOverlap, series;
76154
+ visible: null !== (_c = null == areaTheme ? void 0 : areaTheme.visible) && void 0 !== _c && _c
76155
+ }, spec.area), series.seriesMark = null !== (_d = spec.seriesMark) && void 0 !== _d ? _d : "area", series.activePoint = spec.activePoint, series.pointDis = spec.pointDis, series.pointDisMul = spec.pointDisMul, series.markOverlap = spec.markOverlap, series;
76164
76156
  }
76165
76157
  transformSpec(spec) {
76166
76158
  var _a;
@@ -82131,7 +82123,7 @@
82131
82123
  };
82132
82124
  }
82133
82125
  _markerLayout() {
82134
- var _a, _b, _c, _d, _e;
82126
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
82135
82127
  const updateAttrs = this._getUpdateMarkerAttrs();
82136
82128
  if ("type-step" === this._spec.type) {
82137
82129
  const startRelativeSeries = this._startRelativeSeries,
@@ -82141,9 +82133,26 @@
82141
82133
  mainSegmentIndex: mainSegmentIndex
82142
82134
  } = this._spec.line || {},
82143
82135
  {
82144
- connectDirection: connectDirection,
82145
- expandDistance = 0
82136
+ connectDirection: connectDirection
82146
82137
  } = this._spec;
82138
+ let {
82139
+ expandDistance = 0
82140
+ } = this._spec;
82141
+ const {
82142
+ points: points,
82143
+ limitRect: limitRect
82144
+ } = updateAttrs,
82145
+ coordinatePoints = array(points).filter(Boolean);
82146
+ if (isFunction$1(expandDistance)) {
82147
+ const startRegion = null === (_a = null == startRelativeSeries ? void 0 : startRelativeSeries.getRegion) || void 0 === _a ? void 0 : _a.call(startRelativeSeries),
82148
+ endRegion = null === (_b = null == endRelativeSeries ? void 0 : endRelativeSeries.getRegion) || void 0 === _b ? void 0 : _b.call(endRelativeSeries);
82149
+ expandDistance = expandDistance(this._markerData, Object.assign(Object.assign({}, this.getMarkAttributeContext()), {
82150
+ region: null === (_d = null === (_c = this._relativeSeries) || void 0 === _c ? void 0 : _c.getRegion) || void 0 === _d ? void 0 : _d.call(_c),
82151
+ startRegion: startRegion,
82152
+ endRegion: endRegion,
82153
+ coordinatePoints: coordinatePoints
82154
+ }));
82155
+ }
82147
82156
  let expandDistanceValue;
82148
82157
  if (isPercent(expandDistance)) {
82149
82158
  const regionStart = startRelativeSeries.getRegion(),
@@ -82158,11 +82167,7 @@
82158
82167
  expandDistanceValue = Number(expandDistance.substring(0, expandDistance.length - 1)) * regionWidth / 100;
82159
82168
  }
82160
82169
  } else expandDistanceValue = expandDistance;
82161
- const {
82162
- points: points,
82163
- limitRect: limitRect
82164
- } = updateAttrs;
82165
- if (!points || points.length < 2) return void (null === (_a = this._markerComponent) || void 0 === _a || _a.setAttributes(updateAttrs));
82170
+ if (!points || points.length < 2) return void (null === (_e = this._markerComponent) || void 0 === _e || _e.setAttributes(updateAttrs));
82166
82171
  const joinPoints = getInsertPoints(points[0], points[1], connectDirection, expandDistanceValue);
82167
82172
  let labelPositionAttrs;
82168
82173
  labelPositionAttrs = multiSegment && isValid$1(mainSegmentIndex) ? {
@@ -82172,11 +82177,11 @@
82172
82177
  position: "start",
82173
82178
  autoRotate: !1
82174
82179
  }, getTextOffset(points[0], points[1], connectDirection, expandDistanceValue));
82175
- const markerComponentAttr = null !== (_c = null === (_b = this._markerComponent) || void 0 === _b ? void 0 : _b.attribute) && void 0 !== _c ? _c : {},
82180
+ const markerComponentAttr = null !== (_g = null === (_f = this._markerComponent) || void 0 === _f ? void 0 : _f.attribute) && void 0 !== _g ? _g : {},
82176
82181
  prevLabelAttrs = array(markerComponentAttr.label),
82177
82182
  updateLabels = array(updateAttrs.label),
82178
82183
  labelsInSpec = array(this._spec.label);
82179
- null === (_d = this._markerComponent) || void 0 === _d || _d.setAttributes({
82184
+ null === (_h = this._markerComponent) || void 0 === _h || _h.setAttributes({
82180
82185
  points: multiSegment ? [[joinPoints[0], joinPoints[1]], [joinPoints[1], joinPoints[2]], [joinPoints[2], joinPoints[3]]] : joinPoints,
82181
82186
  label: updateLabels.map((labelItem, index) => {
82182
82187
  var _a, _b, _c, _d;
@@ -82202,7 +82207,7 @@
82202
82207
  dx: this._layoutOffsetX,
82203
82208
  dy: this._layoutOffsetY
82204
82209
  });
82205
- } else null === (_e = this._markerComponent) || void 0 === _e || _e.setAttributes(updateAttrs);
82210
+ } else null === (_j = this._markerComponent) || void 0 === _j || _j.setAttributes(updateAttrs);
82206
82211
  }
82207
82212
  _computeOptions() {
82208
82213
  let options,
@@ -85838,7 +85843,7 @@
85838
85843
  } = this.options,
85839
85844
  statedGraphics = interaction.getStatedGraphics(this),
85840
85845
  g = null != graphic ? graphic : null == statedGraphics ? void 0 : statedGraphics[0];
85841
- g && statedGraphics.includes(g) && (g.removeState(state), interaction.setStatedGraphics(this, statedGraphics.filter(sg => sg !== g)));
85846
+ g && (null == statedGraphics ? void 0 : statedGraphics.includes(g)) && (g.removeState(state), interaction.setStatedGraphics(this, statedGraphics.filter(sg => sg !== g)));
85842
85847
  }
85843
85848
  }
85844
85849
  ElementActive.type = "element-active", ElementActive.defaultOptions = defaultOptions$3;