@visactor/react-vchart 2.0.22-alpha.4 → 2.0.22

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
@@ -51546,7 +51546,7 @@
51546
51546
  }
51547
51547
  _reCompile(updateResult, morphConfig) {
51548
51548
  var _a, _b, _c, _d, _e, _f, _g;
51549
- if (updateResult.reMake && (this._releaseData(), this._initDataSet(), null === (_a = this._chart) || void 0 === _a || _a.release(), this._chart = null), updateResult.reTransformSpec && (this._chartSpecTransformer = null), updateResult.changeTheme ? (this._setCurrentTheme(), this._setFontFamilyTheme(this.getTheme("fontFamily"))) : updateResult.changeBackground && (null === (_b = this._compiler) || void 0 === _b || _b.setBackground(this._getBackground())), updateResult.reMake ? (null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(), this._userEvents.forEach(e => {
51549
+ if (updateResult.reMake && (this._releaseData(), this._initDataSet(), null === (_a = this._chart) || void 0 === _a || _a.release(), this._chart = null), updateResult.reTransformSpec && (this._chartSpecTransformer = null), updateResult.changeTheme ? (this._setCurrentTheme(), this._setFontFamilyTheme(this.getTheme("fontFamily"))) : updateResult.changeBackground && (null === (_b = this._compiler) || void 0 === _b || _b.setBackground(this._getBackground())), updateResult.reMake ? (null === (_c = this._compiler) || void 0 === _c || _c.releaseGrammar(!0), this._userEvents.forEach(e => {
51550
51550
  var _a;
51551
51551
  return null === (_a = this._event) || void 0 === _a ? void 0 : _a.on(e.eType, e.query, e.handler);
51552
51552
  })) : updateResult.reCompile && (null === (_d = this._compiler) || void 0 === _d || _d.clear({
@@ -51954,8 +51954,8 @@
51954
51954
  this._option.layout = layout, null === (_a = this._chart) || void 0 === _a || _a.setLayout(layout);
51955
51955
  }
51956
51956
  reLayout() {
51957
- var _a;
51958
- this._chart.resetLayoutItemTag(), null === (_a = this._chart) || void 0 === _a || _a.setLayoutTag(!0);
51957
+ var _a, _b, _c;
51958
+ null === (_a = this._chart) || void 0 === _a || _a.resetLayoutItemTag(), null === (_b = this._chart) || void 0 === _b || _b.setLayoutTag(!0, null, !1), null === (_c = this._compiler) || void 0 === _c || _c.render();
51959
51959
  }
51960
51960
  getCompiler() {
51961
51961
  return this._compiler;
@@ -60128,14 +60128,19 @@
60128
60128
  var _a, _b, _c, _d;
60129
60129
  if (!this._spec.stackCornerRadius) return;
60130
60130
  const xScale = null === (_b = null === (_a = this._xAxisHelper) || void 0 === _a ? void 0 : _a.getScale) || void 0 === _b ? void 0 : _b.call(_a, 0),
60131
- yScale = null === (_d = null === (_c = this._yAxisHelper) || void 0 === _c ? void 0 : _c.getScale) || void 0 === _d ? void 0 : _d.call(_c, 0);
60131
+ yScale = null === (_d = null === (_c = this._yAxisHelper) || void 0 === _c ? void 0 : _c.getScale) || void 0 === _d ? void 0 : _d.call(_c, 0),
60132
+ isVertical = "vertical" === this.direction;
60132
60133
  this._barMark.setMarkConfig({
60133
60134
  clip: !0,
60134
60135
  clipPath: () => {
60136
+ const usePreCalculatedRect = !!this._shouldDoPreCalculate();
60137
+ usePreCalculatedRect && this._calculateStackRectPosition(isVertical);
60135
60138
  const rectPaths = [];
60136
60139
  return this._forEachStackGroup(node => {
60137
60140
  let min = 1 / 0,
60138
60141
  max = -1 / 0,
60142
+ rectMin = 1 / 0,
60143
+ rectMax = -1 / 0,
60139
60144
  hasPercent = !1,
60140
60145
  minPercent = 1 / 0,
60141
60146
  maxPercent = -1 / 0;
@@ -60144,7 +60149,12 @@
60144
60149
  end = datum[STACK_FIELD_END],
60145
60150
  startPercent = datum[STACK_FIELD_START_PERCENT],
60146
60151
  endPercent = datum[STACK_FIELD_END_PERCENT];
60147
- min = Math.min(min, start, end), max = Math.max(max, start, end), isValid$1(startPercent) && isValid$1(endPercent) && (hasPercent = !0, minPercent = Math.min(minPercent, startPercent, endPercent), maxPercent = Math.max(maxPercent, startPercent, endPercent));
60152
+ if (min = Math.min(min, start, end), max = Math.max(max, start, end), usePreCalculatedRect) {
60153
+ const rectStart = datum[isVertical ? RECT_Y : RECT_X],
60154
+ rectEnd = datum[isVertical ? RECT_Y1 : RECT_X1];
60155
+ rectMin = Math.min(rectMin, rectStart, rectEnd), rectMax = Math.max(rectMax, rectStart, rectEnd);
60156
+ }
60157
+ isValid$1(startPercent) && isValid$1(endPercent) && (hasPercent = !0, minPercent = Math.min(minPercent, startPercent, endPercent), maxPercent = Math.max(maxPercent, startPercent, endPercent));
60148
60158
  });
60149
60159
  const mockDatum = Object.assign(Object.assign(Object.assign({}, node.values[0]), {
60150
60160
  [STACK_FIELD_START]: min,
@@ -60154,13 +60164,13 @@
60154
60164
  [STACK_FIELD_END_PERCENT]: maxPercent
60155
60165
  } : void 0),
60156
60166
  rectAttr = "horizontal" === this.direction ? {
60157
- x: this._getBarXStart(mockDatum, xScale),
60158
- x1: this._getBarXEnd(mockDatum, xScale),
60167
+ x: usePreCalculatedRect ? rectMin : this._getBarXStart(mockDatum, xScale),
60168
+ x1: usePreCalculatedRect ? rectMax : this._getBarXEnd(mockDatum, xScale),
60159
60169
  y: this._getPosition(this.direction, mockDatum),
60160
60170
  height: this._getBarWidth(this._yAxisHelper)
60161
60171
  } : {
60162
- y: this._getBarYStart(mockDatum, yScale),
60163
- y1: this._getBarYEnd(mockDatum, yScale),
60172
+ y: usePreCalculatedRect ? rectMin : this._getBarYStart(mockDatum, yScale),
60173
+ y1: usePreCalculatedRect ? rectMax : this._getBarYEnd(mockDatum, yScale),
60164
60174
  x: this._getPosition(this.direction, mockDatum),
60165
60175
  width: this._getBarWidth(this._xAxisHelper)
60166
60176
  };
@@ -60570,7 +60580,7 @@
60570
60580
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series));
60571
60581
  }
60572
60582
  handleZoom(e) {
60573
- var _a, _b;
60583
+ var _a, _b, _c, _d;
60574
60584
  this.getMarksWithoutRoot().forEach(mark => {
60575
60585
  if (!mark) return;
60576
60586
  const graphics = mark.getGraphics();
@@ -60581,8 +60591,14 @@
60581
60591
  newPosition && graphicItem && graphicItem.translateTo(newPosition.x, newPosition.y);
60582
60592
  });
60583
60593
  });
60584
- const vgrammarLabel = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getProduct();
60585
- vgrammarLabel && vgrammarLabel.evaluate(null, null);
60594
+ const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
60595
+ (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
60596
+ const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
60597
+ (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
60598
+ const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
60599
+ labelGroup && (null == e ? void 0 : e.scale) && (null == e ? void 0 : e.scaleCenter) && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
60600
+ postMatrix: new Matrix()
60601
+ }), labelGroup.scale(e.scale, e.scale, e.scaleCenter));
60586
60602
  }
60587
60603
  handlePan(e) {
60588
60604
  this.handleZoom(e);
@@ -61609,7 +61625,7 @@
61609
61625
  super.release(), this._areaCache.clear(), this._nameMap = {}, this._mapViewData = null;
61610
61626
  }
61611
61627
  handleZoom(e) {
61612
- var _a;
61628
+ var _a, _b, _c, _d;
61613
61629
  const {
61614
61630
  scale: scale,
61615
61631
  scaleCenter: scaleCenter
@@ -61619,11 +61635,17 @@
61619
61635
  pathGroup && (pathGroup.attribute.postMatrix || pathGroup.setAttributes({
61620
61636
  postMatrix: new Matrix()
61621
61637
  }), pathGroup.scale(scale, scale, scaleCenter));
61622
- const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61623
- vgrammarLabel && vgrammarLabel.renderInner();
61638
+ const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61639
+ (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
61640
+ const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
61641
+ (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
61642
+ const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
61643
+ labelGroup && scale && scaleCenter && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
61644
+ postMatrix: new Matrix()
61645
+ }), labelGroup.scale(scale, scale, scaleCenter));
61624
61646
  }
61625
61647
  handlePan(e) {
61626
- var _a;
61648
+ var _a, _b, _c, _d;
61627
61649
  const {
61628
61650
  delta: delta
61629
61651
  } = e;
@@ -61632,8 +61654,14 @@
61632
61654
  pathGroup && (pathGroup.attribute.postMatrix || pathGroup.setAttributes({
61633
61655
  postMatrix: new Matrix()
61634
61656
  }), pathGroup.translate(delta[0], delta[1]));
61635
- const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61636
- vgrammarLabel && vgrammarLabel.renderInner();
61657
+ const labelComponent = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61658
+ (null == labelComponent ? void 0 : labelComponent.renderInner) && labelComponent.renderInner();
61659
+ const vgrammarLabel = null === (_b = null == labelComponent ? void 0 : labelComponent.getComponent) || void 0 === _b ? void 0 : _b.call(labelComponent);
61660
+ (null == vgrammarLabel ? void 0 : vgrammarLabel.evaluate) && vgrammarLabel.evaluate(null, null);
61661
+ const labelGroup = null === (_c = null == labelComponent ? void 0 : labelComponent.getProduct) || void 0 === _c ? void 0 : _c.call(labelComponent);
61662
+ labelGroup && delta && ((null === (_d = labelGroup.attribute) || void 0 === _d ? void 0 : _d.postMatrix) || labelGroup.setAttributes({
61663
+ postMatrix: new Matrix()
61664
+ }), labelGroup.translate(delta[0], delta[1]));
61637
61665
  }
61638
61666
  getDatumCenter(datum) {
61639
61667
  var _a, _b, _c, _d;
@@ -72730,7 +72758,7 @@
72730
72758
  class SankeySeriesTooltipHelper extends BaseSeriesTooltipHelper {
72731
72759
  constructor() {
72732
72760
  super(...arguments), this._getDimensionData = datum => {
72733
- if (datum.source) {
72761
+ if (!isNil$1(null == datum ? void 0 : datum.source) && !isNil$1(null == datum ? void 0 : datum.target)) {
72734
72762
  if (isNumber$1(datum.source)) {
72735
72763
  const seriesKeys = this.series.getSeriesKeys();
72736
72764
  return seriesKeys[datum.source] + " => " + seriesKeys[datum.target];
@@ -78108,18 +78136,26 @@
78108
78136
  const isMarkInfo = info => isValid$1(info) && !isArray$1(info);
78109
78137
  const isDimensionInfo = info => isValid$1(info) && isArray$1(info);
78110
78138
 
78139
+ const TOOLTIP_STYLE_THEME_KEYS = ["panel", "shape", "titleLabel", "keyLabel", "valueLabel", "spaceRow", "maxContentHeight", "align"];
78111
78140
  class TooltipSpecTransformer extends BaseComponentSpecTransformer {
78112
78141
  _shouldMergeThemeToSpec() {
78113
78142
  return !1;
78114
78143
  }
78115
78144
  _initTheme(spec, chartSpec) {
78116
- var _a, _b, _c;
78117
78145
  const {
78118
- spec: newSpec,
78119
- theme: theme
78120
- } = super._initTheme(spec, chartSpec);
78121
- return newSpec.style = mergeSpec({}, this._theme, newSpec.style), newSpec.offset = mergeSpec({}, theme.offset, spec.offset), newSpec.transitionDuration = null !== (_a = spec.transitionDuration) && void 0 !== _a ? _a : theme.transitionDuration, newSpec.trigger = null !== (_b = spec.trigger) && void 0 !== _b ? _b : theme.trigger, newSpec.triggerOff = null !== (_c = spec.triggerOff) && void 0 !== _c ? _c : theme.triggerOff, {
78122
- spec: newSpec,
78146
+ spec: newSpec,
78147
+ theme: theme
78148
+ } = super._initTheme(spec, chartSpec),
78149
+ themeStyle = mergeSpec({}, ...TOOLTIP_STYLE_THEME_KEYS.map(key => void 0 !== (null == theme ? void 0 : theme[key]) ? {
78150
+ [key]: theme[key]
78151
+ } : void 0), null == theme ? void 0 : theme.style),
78152
+ themeSpec = mergeSpec({}, theme);
78153
+ TOOLTIP_STYLE_THEME_KEYS.forEach(key => {
78154
+ delete themeSpec[key];
78155
+ }), delete themeSpec.style;
78156
+ const mergedSpec = mergeSpec({}, themeSpec, newSpec);
78157
+ return mergedSpec.style = mergeSpec({}, themeStyle, mergedSpec.style), {
78158
+ spec: mergedSpec,
78123
78159
  theme: theme
78124
78160
  };
78125
78161
  }
@@ -89219,7 +89255,7 @@
89219
89255
 
89220
89256
  const VChartSimple = createChart('VChartSimple');
89221
89257
 
89222
- const version = "2.0.21";
89258
+ const version = "2.0.22";
89223
89259
 
89224
89260
  exports.Area = Area;
89225
89261
  exports.AreaChart = AreaChart;