@visactor/react-vchart 2.0.22-alpha.3 → 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;
@@ -52151,7 +52151,8 @@
52151
52151
  }]);
52152
52152
  }
52153
52153
  _reSetRenderState() {
52154
- this._renderState = RenderStateEnum.render, this.getStage().eventSystem.resumeTriggerEvent();
52154
+ var _a, _b;
52155
+ this._renderState = RenderStateEnum.render, null === (_b = null === (_a = this.getStage()) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b || _b.resumeTriggerEvent();
52155
52156
  }
52156
52157
  };
52157
52158
  VChart$1.InstanceManager = InstanceManager, VChart$1.ThemeManager = ThemeManager, VChart$1.globalConfig = {
@@ -60127,14 +60128,19 @@
60127
60128
  var _a, _b, _c, _d;
60128
60129
  if (!this._spec.stackCornerRadius) return;
60129
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),
60130
- 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;
60131
60133
  this._barMark.setMarkConfig({
60132
60134
  clip: !0,
60133
60135
  clipPath: () => {
60136
+ const usePreCalculatedRect = !!this._shouldDoPreCalculate();
60137
+ usePreCalculatedRect && this._calculateStackRectPosition(isVertical);
60134
60138
  const rectPaths = [];
60135
60139
  return this._forEachStackGroup(node => {
60136
60140
  let min = 1 / 0,
60137
60141
  max = -1 / 0,
60142
+ rectMin = 1 / 0,
60143
+ rectMax = -1 / 0,
60138
60144
  hasPercent = !1,
60139
60145
  minPercent = 1 / 0,
60140
60146
  maxPercent = -1 / 0;
@@ -60143,7 +60149,12 @@
60143
60149
  end = datum[STACK_FIELD_END],
60144
60150
  startPercent = datum[STACK_FIELD_START_PERCENT],
60145
60151
  endPercent = datum[STACK_FIELD_END_PERCENT];
60146
- 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));
60147
60158
  });
60148
60159
  const mockDatum = Object.assign(Object.assign(Object.assign({}, node.values[0]), {
60149
60160
  [STACK_FIELD_START]: min,
@@ -60153,13 +60164,13 @@
60153
60164
  [STACK_FIELD_END_PERCENT]: maxPercent
60154
60165
  } : void 0),
60155
60166
  rectAttr = "horizontal" === this.direction ? {
60156
- x: this._getBarXStart(mockDatum, xScale),
60157
- x1: this._getBarXEnd(mockDatum, xScale),
60167
+ x: usePreCalculatedRect ? rectMin : this._getBarXStart(mockDatum, xScale),
60168
+ x1: usePreCalculatedRect ? rectMax : this._getBarXEnd(mockDatum, xScale),
60158
60169
  y: this._getPosition(this.direction, mockDatum),
60159
60170
  height: this._getBarWidth(this._yAxisHelper)
60160
60171
  } : {
60161
- y: this._getBarYStart(mockDatum, yScale),
60162
- y1: this._getBarYEnd(mockDatum, yScale),
60172
+ y: usePreCalculatedRect ? rectMin : this._getBarYStart(mockDatum, yScale),
60173
+ y1: usePreCalculatedRect ? rectMax : this._getBarYEnd(mockDatum, yScale),
60163
60174
  x: this._getPosition(this.direction, mockDatum),
60164
60175
  width: this._getBarWidth(this._xAxisHelper)
60165
60176
  };
@@ -60569,7 +60580,7 @@
60569
60580
  }, STATE_VALUE_ENUM.STATE_NORMAL, AttributeLevel.Series));
60570
60581
  }
60571
60582
  handleZoom(e) {
60572
- var _a, _b;
60583
+ var _a, _b, _c, _d;
60573
60584
  this.getMarksWithoutRoot().forEach(mark => {
60574
60585
  if (!mark) return;
60575
60586
  const graphics = mark.getGraphics();
@@ -60580,8 +60591,14 @@
60580
60591
  newPosition && graphicItem && graphicItem.translateTo(newPosition.x, newPosition.y);
60581
60592
  });
60582
60593
  });
60583
- const vgrammarLabel = null === (_b = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent()) || void 0 === _b ? void 0 : _b.getProduct();
60584
- 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));
60585
60602
  }
60586
60603
  handlePan(e) {
60587
60604
  this.handleZoom(e);
@@ -61608,7 +61625,7 @@
61608
61625
  super.release(), this._areaCache.clear(), this._nameMap = {}, this._mapViewData = null;
61609
61626
  }
61610
61627
  handleZoom(e) {
61611
- var _a;
61628
+ var _a, _b, _c, _d;
61612
61629
  const {
61613
61630
  scale: scale,
61614
61631
  scaleCenter: scaleCenter
@@ -61618,11 +61635,17 @@
61618
61635
  pathGroup && (pathGroup.attribute.postMatrix || pathGroup.setAttributes({
61619
61636
  postMatrix: new Matrix()
61620
61637
  }), pathGroup.scale(scale, scale, scaleCenter));
61621
- const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61622
- 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));
61623
61646
  }
61624
61647
  handlePan(e) {
61625
- var _a;
61648
+ var _a, _b, _c, _d;
61626
61649
  const {
61627
61650
  delta: delta
61628
61651
  } = e;
@@ -61631,8 +61654,14 @@
61631
61654
  pathGroup && (pathGroup.attribute.postMatrix || pathGroup.setAttributes({
61632
61655
  postMatrix: new Matrix()
61633
61656
  }), pathGroup.translate(delta[0], delta[1]));
61634
- const vgrammarLabel = null === (_a = this._labelMark) || void 0 === _a ? void 0 : _a.getComponent();
61635
- 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]));
61636
61665
  }
61637
61666
  getDatumCenter(datum) {
61638
61667
  var _a, _b, _c, _d;
@@ -72729,7 +72758,7 @@
72729
72758
  class SankeySeriesTooltipHelper extends BaseSeriesTooltipHelper {
72730
72759
  constructor() {
72731
72760
  super(...arguments), this._getDimensionData = datum => {
72732
- if (datum.source) {
72761
+ if (!isNil$1(null == datum ? void 0 : datum.source) && !isNil$1(null == datum ? void 0 : datum.target)) {
72733
72762
  if (isNumber$1(datum.source)) {
72734
72763
  const seriesKeys = this.series.getSeriesKeys();
72735
72764
  return seriesKeys[datum.source] + " => " + seriesKeys[datum.target];
@@ -78107,18 +78136,26 @@
78107
78136
  const isMarkInfo = info => isValid$1(info) && !isArray$1(info);
78108
78137
  const isDimensionInfo = info => isValid$1(info) && isArray$1(info);
78109
78138
 
78139
+ const TOOLTIP_STYLE_THEME_KEYS = ["panel", "shape", "titleLabel", "keyLabel", "valueLabel", "spaceRow", "maxContentHeight", "align"];
78110
78140
  class TooltipSpecTransformer extends BaseComponentSpecTransformer {
78111
78141
  _shouldMergeThemeToSpec() {
78112
78142
  return !1;
78113
78143
  }
78114
78144
  _initTheme(spec, chartSpec) {
78115
- var _a, _b, _c;
78116
78145
  const {
78117
- spec: newSpec,
78118
- theme: theme
78119
- } = super._initTheme(spec, chartSpec);
78120
- 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, {
78121
- 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,
78122
78159
  theme: theme
78123
78160
  };
78124
78161
  }
@@ -89218,7 +89255,7 @@
89218
89255
 
89219
89256
  const VChartSimple = createChart('VChartSimple');
89220
89257
 
89221
- const version = "2.0.21";
89258
+ const version = "2.0.22";
89222
89259
 
89223
89260
  exports.Area = Area;
89224
89261
  exports.AreaChart = AreaChart;