@visactor/react-vchart 2.0.23-alpha.7 → 2.0.23-alpha.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
@@ -47559,11 +47559,24 @@
47559
47559
  updateLayoutTag() {
47560
47560
  this._layoutState = LayoutState.before;
47561
47561
  }
47562
+ _isGeoRegionRoamDragEnabled() {
47563
+ var _a, _b;
47564
+ const chartSpec = null === (_b = null === (_a = this._compileChart) || void 0 === _a ? void 0 : _a.getSpec) || void 0 === _b ? void 0 : _b.call(_a),
47565
+ regions = null == chartSpec ? void 0 : chartSpec.region;
47566
+ return !!isArray$1(regions) && regions.some(region => {
47567
+ var _a;
47568
+ return !("geo" !== (null == region ? void 0 : region.coordinate) || !region.roam) && (!0 === region.roam || null === (_a = region.roam.drag) || void 0 === _a || _a);
47569
+ });
47570
+ }
47571
+ _shouldDisableCanvasTouchAction() {
47572
+ if (!isTrueBrowser(this._option.mode)) return !1;
47573
+ return !1 === (isValid$1(this._option.supportsTouchEvents) ? this._option.supportsTouchEvents : vglobal.supportsTouchEvents) && this._isGeoRegionRoamDragEnabled();
47574
+ }
47562
47575
  _setCanvasStyle() {
47563
47576
  if (this._stage && this._container.dom && !isString$1(this._container.dom)) {
47564
47577
  this._container.dom.style.display = "block", this._container.dom.style.position = "relative";
47565
47578
  const canvas = this.getCanvas();
47566
- canvas && (canvas.style.display = "block");
47579
+ canvas && (canvas.style.display = "block", canvas.style.touchAction = this._shouldDisableCanvasTouchAction() ? "none" : "");
47567
47580
  }
47568
47581
  }
47569
47582
  compile(ctx, option) {
@@ -47571,7 +47584,7 @@
47571
47584
  const {
47572
47585
  chart: chart
47573
47586
  } = ctx;
47574
- this._compileChart = chart, this.initView(), this._stage && ("render" !== (null == option ? void 0 : option.actionSource) && this._cachedMarks && (this.reuseOrMorphing(option.morphConfig), this._cachedMarks = null), chart.compile(), chart.afterCompile());
47587
+ this._compileChart = chart, this.initView(), this._stage && ("render" !== (null == option ? void 0 : option.actionSource) && this._cachedMarks && (this.reuseOrMorphing(option.morphConfig), this._cachedMarks = null), chart.compile(), this._setCanvasStyle(), chart.afterCompile());
47575
47588
  }
47576
47589
  clearNextRender() {
47577
47590
  return !!this._nextRafId && (vglobal.getSpecifiedCancelAnimationFrame(10)(this._nextRafId), this._nextRafId = null, !0);
@@ -54397,7 +54410,7 @@
54397
54410
  }), res), []) : null;
54398
54411
  }
54399
54412
  _runPointsEncoder(newStyles, g, attrs = {}) {
54400
- var _a, _b, _c;
54413
+ var _a, _b;
54401
54414
  const data = g.context.data,
54402
54415
  lineAttrs = [],
54403
54416
  points = [],
@@ -54410,7 +54423,7 @@
54410
54423
  this._isValidPointChannel(attrName) ? points[index][attrName] = newStyles[attrName](datum) : this._segmentStyleKeys.includes(attrName) && !progressive ? lineAttrs[index][attrName] = newStyles[attrName](datum) : 0 !== index || progressive && !isFirstFrame || (commonAttrs[attrName] = newStyles[attrName](datum));
54411
54424
  }), points[index].context = null !== (_a = this._keyGetter(datum)) && void 0 !== _a ? _a : index;
54412
54425
  }), progressive) {
54413
- const segments = null !== (_c = null === (_b = g.attribute) || void 0 === _b ? void 0 : _b.segments) && void 0 !== _c ? _c : [];
54426
+ const segments = (null === (_b = g.attribute) || void 0 === _b ? void 0 : _b.segments) ? [...g.attribute.segments] : [];
54414
54427
  return segments.push({
54415
54428
  points: points
54416
54429
  }), isFirstFrame ? Object.assign(Object.assign({}, commonAttrs), {
@@ -57833,7 +57846,7 @@
57833
57846
  this._interaction = new Interaction();
57834
57847
  const series = this.getAllSeries(),
57835
57848
  mergedTriggers = [],
57836
- mergedTriggersMarks = {};
57849
+ groupedTriggers = [];
57837
57850
  series.forEach(s => {
57838
57851
  const triggers = s.getInteractionTriggers();
57839
57852
  if (triggers && triggers.length) {
@@ -57842,12 +57855,17 @@
57842
57855
  trigger: trigger,
57843
57856
  marks: marks
57844
57857
  }) => {
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]));
57858
+ const sameTrigger = groupedTriggers.find(item => item.regionId === regionId && isEqual(item.config, trigger));
57859
+ if (sameTrigger) sameTrigger.trigger.marks.push(...marks);else {
57860
+ const mergedTrigger = Object.assign(Object.assign({}, trigger), {
57861
+ marks: [...marks]
57862
+ });
57863
+ groupedTriggers.push({
57864
+ regionId: regionId,
57865
+ config: Object.assign({}, trigger),
57866
+ trigger: mergedTrigger
57867
+ }), mergedTriggers.push(mergedTrigger);
57868
+ }
57851
57869
  });
57852
57870
  }
57853
57871
  }), mergedTriggers.forEach(trigger => {
@@ -60322,7 +60340,7 @@
60322
60340
  fieldsY = this._fieldY,
60323
60341
  fieldsX = this._fieldX;
60324
60342
  this._data.setTransform([{
60325
- type: "dataSampling",
60343
+ type: "sampling",
60326
60344
  size: "horizontal" === this._direction ? height : width,
60327
60345
  factor: this._spec.samplingFactor,
60328
60346
  yfield: "horizontal" === this._direction ? fieldsX[0] : fieldsY[0],
@@ -60567,7 +60585,7 @@
60567
60585
  visible: !0
60568
60586
  }, "normal", AttributeLevel.Series) : this.setMarkStyle(this._symbolMark, {
60569
60587
  visible: this._getInvalidDefined.bind(this)
60570
- }, "normal", AttributeLevel.Series), this._symbolMark.getProduct() && this._symbolMark.compileEncode(), this._isGeoCoordinateSeries() && (this._updateSymbolGraphicPosition(), this._refreshLabelComponent(!0, !0));
60588
+ }, "normal", AttributeLevel.Series), this._symbolMark.getProduct() && this._symbolMark.compileEncode();
60571
60589
  }
60572
60590
  initLabelMarkStyle(labelMark) {
60573
60591
  labelMark && (this._labelMark = labelMark, this.setMarkStyle(labelMark, {
@@ -60598,22 +60616,6 @@
60598
60616
  postMatrix: new Matrix()
60599
60617
  }), labelGraphic;
60600
60618
  }
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
60619
  handleZoom(e) {
60618
60620
  const {
60619
60621
  scale: scale,
@@ -60634,12 +60636,14 @@
60634
60636
  labelGraphic && labelGraphic.translate(delta[0], delta[1]);
60635
60637
  }
60636
60638
  onLayoutEnd() {
60637
- var _a, _b;
60639
+ var _a, _b, _c;
60638
60640
  super.onLayoutEnd(), this._updateSymbolGraphicPosition();
60639
60641
  const labelGraphic = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getComponent();
60640
60642
  (null == labelGraphic ? void 0 : labelGraphic.attribute.postMatrix) && labelGraphic.setAttributes({
60641
60643
  postMatrix: new Matrix()
60642
- }), this._refreshLabelComponent();
60644
+ });
60645
+ const vgrammarLabel = null === (_c = this._labelMark) || void 0 === _c ? void 0 : _c.getComponent();
60646
+ vgrammarLabel && vgrammarLabel.renderInner();
60643
60647
  }
60644
60648
  getDefaultShapeType() {
60645
60649
  return "circle";
@@ -62513,6 +62517,14 @@
62513
62517
  bandPosition: this._bandPosition
62514
62518
  }));
62515
62519
  }
62520
+ _isCategoryAxisInverse() {
62521
+ var _a, _b, _c, _e;
62522
+ return "horizontal" === this._direction ? null === (_b = null === (_a = this._yAxisHelper) || void 0 === _a ? void 0 : _a.isInverse) || void 0 === _b ? void 0 : _b.call(_a) : null === (_e = null === (_c = this._xAxisHelper) || void 0 === _c ? void 0 : _c.isInverse) || void 0 === _e ? void 0 : _e.call(_c);
62523
+ }
62524
+ _getLeaderLineCategoryPos(isStart, isDecrease) {
62525
+ const normalPos = isStart ? isDecrease ? 0 : 1 : isDecrease ? 1 : 0;
62526
+ return !!this._isCategoryAxisInverse() ? 1 - normalPos : normalPos;
62527
+ }
62516
62528
  initMarkStyle() {
62517
62529
  super.initMarkStyle();
62518
62530
  const isDecrease = "decrease" === this._spec.calculationMode;
@@ -62520,12 +62532,12 @@
62520
62532
  visible: datum => this.isVisibleLeaderLine(datum),
62521
62533
  x: datum => this.totalPositionX(datum, "lastEnd", 0),
62522
62534
  x1: datum => this.totalPositionX(datum, datum.isTotal ? "end" : "start", 0),
62523
- y: datum => datum.lastIndex ? this.totalPositionY(datum, "lastIndex", isDecrease ? 0 : 1) : 0,
62524
- y1: datum => this.totalPositionY(datum, "index", isDecrease ? 1 : 0)
62535
+ y: datum => datum.lastIndex ? this.totalPositionY(datum, "lastIndex", this._getLeaderLineCategoryPos(!0, isDecrease)) : 0,
62536
+ y1: datum => this.totalPositionY(datum, "index", this._getLeaderLineCategoryPos(!1, isDecrease))
62525
62537
  }, "normal", AttributeLevel.Series) : this.setMarkStyle(this._leaderLineMark, {
62526
62538
  visible: datum => this.isVisibleLeaderLine(datum),
62527
- x: datum => datum.lastIndex ? this.totalPositionX(datum, "lastIndex", isDecrease ? 0 : 1) : 0,
62528
- x1: datum => this.totalPositionX(datum, "index", isDecrease ? 1 : 0),
62539
+ x: datum => datum.lastIndex ? this.totalPositionX(datum, "lastIndex", this._getLeaderLineCategoryPos(!0, isDecrease)) : 0,
62540
+ x1: datum => this.totalPositionX(datum, "index", this._getLeaderLineCategoryPos(!1, isDecrease)),
62529
62541
  y: datum => this.totalPositionY(datum, "lastEnd", 0),
62530
62542
  y1: datum => this.totalPositionY(datum, datum.isTotal ? "end" : "start", 0)
62531
62543
  }, "normal", AttributeLevel.Series));
@@ -65090,10 +65102,9 @@
65090
65102
  fill: this.getColorAttribute(),
65091
65103
  outerRadius: datum => valueInScaleRange(this.radiusAxisHelper.dataToPosition([datum[this._radiusField[0]]]), this.radiusAxisHelper.getScale(0)),
65092
65104
  innerRadius: datum => {
65093
- var _a;
65094
- if (!this.getStack()) return 0;
65105
+ if (!this.getStack()) return this._computeLayoutRadius() * this._innerRadius;
65095
65106
  const stackStart = valueInScaleRange(this.radiusAxisHelper.dataToPosition([datum[this._innerRadiusField[0]]]), this.radiusAxisHelper.getScale(0));
65096
- return stackStart <= Number.MIN_VALUE ? this._computeLayoutRadius() * (null !== (_a = this._spec.innerRadius) && void 0 !== _a ? _a : 0) : stackStart;
65107
+ return stackStart <= Number.MIN_VALUE ? this._computeLayoutRadius() * this._innerRadius : stackStart;
65097
65108
  }
65098
65109
  });
65099
65110
  }
@@ -65112,10 +65123,7 @@
65112
65123
  const appearPreset = null === (_b = null === (_a = this._spec) || void 0 === _a ? void 0 : _a.animationAppear) || void 0 === _b ? void 0 : _b.preset;
65113
65124
  if (this._roseMark) {
65114
65125
  const animationParams = {
65115
- innerRadius: () => {
65116
- var _a;
65117
- return this._computeLayoutRadius() * (null !== (_a = this._spec.innerRadius) && void 0 !== _a ? _a : 0);
65118
- }
65126
+ innerRadius: () => this._computeLayoutRadius() * this._innerRadius
65119
65127
  };
65120
65128
  this._roseMark.setAnimationConfig(animationConfig(null === (_c = Factory.getAnimationInKey("rose")) || void 0 === _c ? void 0 : _c(animationParams, appearPreset), userAnimationConfig("rose", this._spec, this._markAttributeContext)));
65121
65129
  }
@@ -76156,11 +76164,12 @@
76156
76164
 
76157
76165
  class RadarChartSpecTransformer extends RoseLikeChartSpecTransformer {
76158
76166
  _getDefaultSeriesSpec(spec) {
76159
- var _a;
76160
- const series = super._getDefaultSeriesSpec(spec);
76167
+ var _a, _b, _c, _d;
76168
+ const series = super._getDefaultSeriesSpec(spec),
76169
+ areaTheme = null === (_b = (_a = this._option).getTheme) || void 0 === _b ? void 0 : _b.call(_a, "series", "radar", "area");
76161
76170
  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;
76171
+ visible: null !== (_c = null == areaTheme ? void 0 : areaTheme.visible) && void 0 !== _c && _c
76172
+ }, 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
76173
  }
76165
76174
  transformSpec(spec) {
76166
76175
  var _a;
@@ -77183,7 +77192,7 @@
77183
77192
  return [this._legendComponent];
77184
77193
  }
77185
77194
  clear() {
77186
- super.clear(), this._cacheAttrs = null, this._preSelectedData = null;
77195
+ super.clear(), this._legendComponent = null, this._cacheAttrs = null, this._preSelectedData = null;
77187
77196
  }
77188
77197
  }
77189
77198
  BaseLegend.specKey = "legends";
@@ -85838,7 +85847,7 @@
85838
85847
  } = this.options,
85839
85848
  statedGraphics = interaction.getStatedGraphics(this),
85840
85849
  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)));
85850
+ g && (null == statedGraphics ? void 0 : statedGraphics.includes(g)) && (g.removeState(state), interaction.setStatedGraphics(this, statedGraphics.filter(sg => sg !== g)));
85842
85851
  }
85843
85852
  }
85844
85853
  ElementActive.type = "element-active", ElementActive.defaultOptions = defaultOptions$3;
@@ -89281,7 +89290,7 @@
89281
89290
 
89282
89291
  const VChartSimple = createChart('VChartSimple');
89283
89292
 
89284
- const version = "2.0.23-alpha.5";
89293
+ const version = "2.0.22";
89285
89294
 
89286
89295
  exports.Area = Area;
89287
89296
  exports.AreaChart = AreaChart;