@visactor/react-vchart 2.1.0-alpha.10 → 2.1.0-alpha.12

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
@@ -63109,7 +63109,7 @@
63109
63109
  }), res), []) : null;
63110
63110
  }
63111
63111
  _runPointsEncoder(newStyles, g, attrs = {}) {
63112
- var _a, _b, _c;
63112
+ var _a, _b;
63113
63113
  const data = g.context.data,
63114
63114
  lineAttrs = [],
63115
63115
  points = [],
@@ -63122,7 +63122,7 @@
63122
63122
  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));
63123
63123
  }), points[index].context = null !== (_a = this._keyGetter(datum)) && void 0 !== _a ? _a : index;
63124
63124
  }), progressive) {
63125
- const segments = null !== (_c = null === (_b = g.attribute) || void 0 === _b ? void 0 : _b.segments) && void 0 !== _c ? _c : [];
63125
+ const segments = (null === (_b = g.attribute) || void 0 === _b ? void 0 : _b.segments) ? [...g.attribute.segments] : [];
63126
63126
  return segments.push({
63127
63127
  points: points
63128
63128
  }), isFirstFrame ? Object.assign(Object.assign({}, commonAttrs), {
@@ -71570,6 +71570,14 @@
71570
71570
  bandPosition: this._bandPosition
71571
71571
  }));
71572
71572
  }
71573
+ _isCategoryAxisInverse() {
71574
+ var _a, _b, _c, _e;
71575
+ 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);
71576
+ }
71577
+ _getLeaderLineCategoryPos(isStart, isDecrease) {
71578
+ const normalPos = isStart ? isDecrease ? 0 : 1 : isDecrease ? 1 : 0;
71579
+ return !!this._isCategoryAxisInverse() ? 1 - normalPos : normalPos;
71580
+ }
71573
71581
  initMarkStyle() {
71574
71582
  super.initMarkStyle();
71575
71583
  const isDecrease = "decrease" === this._spec.calculationMode;
@@ -71577,12 +71585,12 @@
71577
71585
  visible: datum => this.isVisibleLeaderLine(datum),
71578
71586
  x: datum => this.totalPositionX(datum, "lastEnd", 0),
71579
71587
  x1: datum => this.totalPositionX(datum, datum.isTotal ? "end" : "start", 0),
71580
- y: datum => datum.lastIndex ? this.totalPositionY(datum, "lastIndex", isDecrease ? 0 : 1) : 0,
71581
- y1: datum => this.totalPositionY(datum, "index", isDecrease ? 1 : 0)
71588
+ y: datum => datum.lastIndex ? this.totalPositionY(datum, "lastIndex", this._getLeaderLineCategoryPos(!0, isDecrease)) : 0,
71589
+ y1: datum => this.totalPositionY(datum, "index", this._getLeaderLineCategoryPos(!1, isDecrease))
71582
71590
  }, "normal", AttributeLevel.Series) : this.setMarkStyle(this._leaderLineMark, {
71583
71591
  visible: datum => this.isVisibleLeaderLine(datum),
71584
- x: datum => datum.lastIndex ? this.totalPositionX(datum, "lastIndex", isDecrease ? 0 : 1) : 0,
71585
- x1: datum => this.totalPositionX(datum, "index", isDecrease ? 1 : 0),
71592
+ x: datum => datum.lastIndex ? this.totalPositionX(datum, "lastIndex", this._getLeaderLineCategoryPos(!0, isDecrease)) : 0,
71593
+ x1: datum => this.totalPositionX(datum, "index", this._getLeaderLineCategoryPos(!1, isDecrease)),
71586
71594
  y: datum => this.totalPositionY(datum, "lastEnd", 0),
71587
71595
  y1: datum => this.totalPositionY(datum, datum.isTotal ? "end" : "start", 0)
71588
71596
  }, "normal", AttributeLevel.Series));
@@ -86406,7 +86414,7 @@
86406
86414
  return [this._legendComponent];
86407
86415
  }
86408
86416
  clear() {
86409
- super.clear(), this._cacheAttrs = null, this._preSelectedData = null;
86417
+ super.clear(), this._legendComponent = null, this._cacheAttrs = null, this._preSelectedData = null;
86410
86418
  }
86411
86419
  }
86412
86420
  BaseLegend.specKey = "legends";
@@ -91081,6 +91089,7 @@
91081
91089
  MARKER_STYLE_PLACEHOLDER = "__vchart_marker_style__",
91082
91090
  MARKER_DOMAIN_POSITION_SPEC_KEYS = ["coordinate", "coordinates", "x", "y", "x1", "y1", "angle", "angle1", "radius", "radius1"],
91083
91091
  MARKER_LAYOUT_POSITION_SPEC_KEYS = ["position", "positions", "coordinatesOffset", "regionRelative"],
91092
+ MARKER_ITEM_CONTENT_LAYOUT_SPEC_KEYS = ["offsetX", "offsetY", "confine"],
91084
91093
  normalizeMarkerLabelFormatMethod = label => Array.isArray(label) ? label.map(normalizeMarkerLabelFormatMethod) : label && "object" == typeof label ? "function" != typeof label.formatMethod ? label : Object.assign(Object.assign({}, label), {
91085
91094
  formatMethod: MARKER_FORMAT_METHOD_PLACEHOLDER
91086
91095
  }) : label,
@@ -91093,7 +91102,6 @@
91093
91102
  }), normalized;
91094
91103
  },
91095
91104
  normalizeMarkerSpecForComponentOnlyUpdate = (spec, options) => {
91096
- var _a;
91097
91105
  if (!spec || "object" != typeof spec) return spec;
91098
91106
  const normalized = Object.assign({}, spec);
91099
91107
  options.normalizeDomainPosition && MARKER_DOMAIN_POSITION_SPEC_KEYS.forEach(key => {
@@ -91103,12 +91111,17 @@
91103
91111
  }), "label" in normalized && (normalized.label = normalizeMarkerLabelFormatMethod(normalized.label)), Object.keys(normalized).forEach(key => {
91104
91112
  normalized[key] = normalizeMarkerStyles(normalized[key]);
91105
91113
  });
91106
- const text = null === (_a = normalized.itemContent) || void 0 === _a ? void 0 : _a.text;
91107
- return text && "object" == typeof text && (normalized.itemContent = Object.assign(Object.assign({}, normalized.itemContent), {
91108
- text: Object.assign(Object.assign({}, normalizeMarkerLabelFormatMethod(text)), {
91114
+ const itemContent = normalized.itemContent;
91115
+ if (itemContent && "object" == typeof itemContent) {
91116
+ normalized.itemContent = Object.assign({}, itemContent), MARKER_ITEM_CONTENT_LAYOUT_SPEC_KEYS.forEach(key => {
91117
+ key in normalized.itemContent && (normalized.itemContent[key] = MARKER_COORDINATE_PLACEHOLDER);
91118
+ });
91119
+ const text = normalized.itemContent.text;
91120
+ text && "object" == typeof text && (normalized.itemContent.text = Object.assign(Object.assign({}, normalizeMarkerLabelFormatMethod(text)), {
91109
91121
  text: MARKER_TEXT_PLACEHOLDER
91110
- })
91111
- })), normalized;
91122
+ }));
91123
+ }
91124
+ return normalized;
91112
91125
  };
91113
91126
  class BaseMarker extends BaseComponent {
91114
91127
  constructor() {
@@ -93251,6 +93264,7 @@
93251
93264
  itemLine = {},
93252
93265
  targetSymbol = {}
93253
93266
  } = this._spec,
93267
+ region = this._relativeSeries.getRegion(),
93254
93268
  _10 = itemContent,
93255
93269
  {
93256
93270
  type = "text",
@@ -93300,8 +93314,8 @@
93300
93314
  clipInRange: null !== (_v = this._spec.clip) && void 0 !== _v && _v,
93301
93315
  itemContent: Object.assign(Object.assign({
93302
93316
  type: type,
93303
- offsetX: transformOffset(itemContent.offsetX, this._relativeSeries.getRegion()),
93304
- offsetY: transformOffset(itemContent.offsetX, this._relativeSeries.getRegion())
93317
+ offsetX: transformOffset(itemContent.offsetX, region),
93318
+ offsetY: transformOffset(itemContent.offsetY, region)
93305
93319
  }, restItemContent), {
93306
93320
  style: transformStyle(itemContentStyle, this._markerData, this._markAttributeContext)
93307
93321
  }),
@@ -93351,6 +93365,7 @@
93351
93365
  itemLine = {},
93352
93366
  itemContent = {}
93353
93367
  } = this._spec,
93368
+ region = this._relativeSeries.getRegion(),
93354
93369
  {
93355
93370
  visible: itemLineVisible,
93356
93371
  line = {}
@@ -93386,7 +93401,9 @@
93386
93401
  if (this._markerComponent) {
93387
93402
  const attribute = null !== (_d = this._markerComponent.attribute) && void 0 !== _d ? _d : {},
93388
93403
  textStyle = null !== (_f = null === (_e = attribute.itemContent) || void 0 === _e ? void 0 : _e.textStyle) && void 0 !== _f ? _f : {},
93389
- specText = null === (_g = this._spec.itemContent.text) || void 0 === _g ? void 0 : _g.text;
93404
+ specText = null === (_g = this._spec.itemContent.text) || void 0 === _g ? void 0 : _g.text,
93405
+ offsetX = transformOffset(itemContent.offsetX, region),
93406
+ offsetY = transformOffset(itemContent.offsetY, region);
93390
93407
  this._markerComponent.setAttributes({
93391
93408
  position: void 0 === point ? {
93392
93409
  x: null,
@@ -93398,8 +93415,8 @@
93398
93415
  textStyle: Object.assign(Object.assign(Object.assign({}, textStyle), null !== (_m = labelAttrs.textStyle) && void 0 !== _m ? _m : {}), {
93399
93416
  text: (null === (_o = this._spec.itemContent.text) || void 0 === _o ? void 0 : _o.formatMethod) ? this._spec.itemContent.text.formatMethod(dataPoints, seriesData) : isValid$1(specText) ? specText : textStyle.text
93400
93417
  }),
93401
- offsetX: computeOffsetFromRegion(point, attribute.itemContent.offsetX, this._relativeSeries.getRegion()),
93402
- offsetY: computeOffsetFromRegion(point, attribute.itemContent.offsetY, this._relativeSeries.getRegion())
93418
+ offsetX: computeOffsetFromRegion(point, offsetX, region),
93419
+ offsetY: computeOffsetFromRegion(point, offsetY, region)
93403
93420
  }),
93404
93421
  itemLine: itemLineAttrs,
93405
93422
  limitRect: limitRect,