@visactor/react-vchart 2.1.2-alpha.9 → 2.1.3-alpha.0

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.
Files changed (155) hide show
  1. package/build/index.js +57 -26
  2. package/build/index.min.js +3 -3
  3. package/cjs/charts/AreaChart.js +1 -1
  4. package/cjs/charts/Bar3dChart.js +1 -1
  5. package/cjs/charts/BarChart.js +1 -1
  6. package/cjs/charts/BaseChart.js +1 -1
  7. package/cjs/charts/BoxPlotChart.js +1 -1
  8. package/cjs/charts/CirclePackingChart.js +1 -1
  9. package/cjs/charts/CircularProgressChart.js +1 -1
  10. package/cjs/charts/CommonChart.js +1 -1
  11. package/cjs/charts/CorrelationChart.js +1 -1
  12. package/cjs/charts/Funnel3dChart.js +1 -1
  13. package/cjs/charts/FunnelChart.js +1 -1
  14. package/cjs/charts/GaugeChart.js +1 -1
  15. package/cjs/charts/HeatmapChart.js +1 -1
  16. package/cjs/charts/Histogram3dChart.js +1 -1
  17. package/cjs/charts/HistogramChart.js +2 -1
  18. package/cjs/charts/LineChart.js +1 -1
  19. package/cjs/charts/LinearProgressChart.js +1 -1
  20. package/cjs/charts/LiquidChart.js +1 -1
  21. package/cjs/charts/MapChart.js +1 -1
  22. package/cjs/charts/MosaicChart.js +1 -1
  23. package/cjs/charts/PictogramChart.js +1 -1
  24. package/cjs/charts/Pie3dChart.js +1 -1
  25. package/cjs/charts/PieChart.js +1 -1
  26. package/cjs/charts/RadarChart.js +1 -1
  27. package/cjs/charts/RangeAreaChart.js +1 -1
  28. package/cjs/charts/RangeColumn3dChart.js +1 -1
  29. package/cjs/charts/RangeColumnChart.js +1 -1
  30. package/cjs/charts/RoseChart.js +1 -1
  31. package/cjs/charts/SankeyChart.js +1 -1
  32. package/cjs/charts/ScatterChart.js +1 -1
  33. package/cjs/charts/SequenceChart.js +2 -1
  34. package/cjs/charts/SunburstChart.js +1 -1
  35. package/cjs/charts/TreemapChart.js +1 -1
  36. package/cjs/charts/VennChart.js +1 -1
  37. package/cjs/charts/WaterfallChart.js +1 -1
  38. package/cjs/charts/WordCloud3dChart.js +1 -1
  39. package/cjs/charts/WordCloudChart.js +1 -1
  40. package/cjs/components/MarkArea.js +2 -1
  41. package/cjs/components/ScrollBar.js +1 -2
  42. package/cjs/context/chart.js +1 -1
  43. package/cjs/context/stage.js +1 -1
  44. package/cjs/series/Area.js +1 -1
  45. package/cjs/series/Bar.js +1 -1
  46. package/cjs/series/Bar3d.js +1 -1
  47. package/cjs/series/BaseSeries.js +1 -1
  48. package/cjs/series/BoxPlot.js +1 -1
  49. package/cjs/series/CirclePacking.js +1 -1
  50. package/cjs/series/CircularProgress.js +1 -1
  51. package/cjs/series/Correlation.js +1 -1
  52. package/cjs/series/Dot.js +1 -1
  53. package/cjs/series/Funnel.js +1 -1
  54. package/cjs/series/Funnel3d.js +1 -1
  55. package/cjs/series/Gauge.js +1 -2
  56. package/cjs/series/GaugePointer.js +1 -1
  57. package/cjs/series/Heatmap.js +1 -1
  58. package/cjs/series/Line.js +1 -1
  59. package/cjs/series/LinearProgress.js +1 -1
  60. package/cjs/series/Link.js +1 -1
  61. package/cjs/series/Liquid.js +1 -1
  62. package/cjs/series/Map.js +1 -1
  63. package/cjs/series/Mosaic.js +1 -1
  64. package/cjs/series/Pictogram.js +1 -1
  65. package/cjs/series/Pie.js +1 -1
  66. package/cjs/series/Pie3d.js +1 -1
  67. package/cjs/series/Radar.js +1 -1
  68. package/cjs/series/RangeArea.js +1 -1
  69. package/cjs/series/RangeColumn.js +1 -1
  70. package/cjs/series/RangeColumn3d.js +1 -1
  71. package/cjs/series/Rose.js +1 -2
  72. package/cjs/series/Sankey.js +1 -1
  73. package/cjs/series/Scatter.js +1 -1
  74. package/cjs/series/Series.js +1 -1
  75. package/cjs/series/Sunburst.js +1 -1
  76. package/cjs/series/Treemap.js +1 -1
  77. package/cjs/series/Venn.js +1 -1
  78. package/cjs/series/Waterfall.js +1 -1
  79. package/esm/charts/AreaChart.js +1 -1
  80. package/esm/charts/Bar3dChart.js +1 -1
  81. package/esm/charts/BarChart.js +1 -1
  82. package/esm/charts/BaseChart.js +1 -1
  83. package/esm/charts/BoxPlotChart.js +1 -1
  84. package/esm/charts/CirclePackingChart.js +1 -1
  85. package/esm/charts/CircularProgressChart.js +1 -1
  86. package/esm/charts/CommonChart.js +1 -1
  87. package/esm/charts/CorrelationChart.js +1 -1
  88. package/esm/charts/Funnel3dChart.js +1 -1
  89. package/esm/charts/FunnelChart.js +1 -1
  90. package/esm/charts/GaugeChart.js +1 -1
  91. package/esm/charts/HeatmapChart.js +1 -1
  92. package/esm/charts/Histogram3dChart.js +1 -1
  93. package/esm/charts/HistogramChart.js +2 -1
  94. package/esm/charts/LineChart.js +1 -1
  95. package/esm/charts/LinearProgressChart.js +1 -1
  96. package/esm/charts/LiquidChart.js +1 -1
  97. package/esm/charts/MapChart.js +1 -1
  98. package/esm/charts/MosaicChart.js +1 -1
  99. package/esm/charts/PictogramChart.js +1 -1
  100. package/esm/charts/Pie3dChart.js +1 -1
  101. package/esm/charts/PieChart.js +1 -1
  102. package/esm/charts/RadarChart.js +1 -1
  103. package/esm/charts/RangeAreaChart.js +1 -1
  104. package/esm/charts/RangeColumn3dChart.js +1 -1
  105. package/esm/charts/RangeColumnChart.js +1 -1
  106. package/esm/charts/RoseChart.js +1 -1
  107. package/esm/charts/SankeyChart.js +1 -1
  108. package/esm/charts/ScatterChart.js +1 -1
  109. package/esm/charts/SequenceChart.js +2 -1
  110. package/esm/charts/SunburstChart.js +1 -1
  111. package/esm/charts/TreemapChart.js +1 -1
  112. package/esm/charts/VennChart.js +1 -1
  113. package/esm/charts/WaterfallChart.js +1 -1
  114. package/esm/charts/WordCloud3dChart.js +1 -1
  115. package/esm/charts/WordCloudChart.js +1 -1
  116. package/esm/components/MarkArea.js +2 -1
  117. package/esm/components/ScrollBar.js +1 -2
  118. package/esm/context/chart.js +1 -1
  119. package/esm/context/stage.js +1 -1
  120. package/esm/series/Area.js +1 -1
  121. package/esm/series/Bar.js +1 -1
  122. package/esm/series/Bar3d.js +1 -1
  123. package/esm/series/BaseSeries.js +1 -1
  124. package/esm/series/BoxPlot.js +1 -1
  125. package/esm/series/CirclePacking.js +1 -1
  126. package/esm/series/CircularProgress.js +1 -1
  127. package/esm/series/Correlation.js +1 -1
  128. package/esm/series/Dot.js +1 -1
  129. package/esm/series/Funnel.js +1 -1
  130. package/esm/series/Funnel3d.js +1 -1
  131. package/esm/series/Gauge.js +1 -2
  132. package/esm/series/GaugePointer.js +1 -1
  133. package/esm/series/Heatmap.js +1 -1
  134. package/esm/series/Line.js +1 -1
  135. package/esm/series/LinearProgress.js +1 -1
  136. package/esm/series/Link.js +1 -1
  137. package/esm/series/Liquid.js +1 -1
  138. package/esm/series/Map.js +1 -1
  139. package/esm/series/Mosaic.js +1 -1
  140. package/esm/series/Pictogram.js +1 -1
  141. package/esm/series/Pie.js +1 -1
  142. package/esm/series/Pie3d.js +1 -1
  143. package/esm/series/Radar.js +1 -1
  144. package/esm/series/RangeArea.js +1 -1
  145. package/esm/series/RangeColumn.js +1 -1
  146. package/esm/series/RangeColumn3d.js +1 -1
  147. package/esm/series/Rose.js +1 -2
  148. package/esm/series/Sankey.js +1 -1
  149. package/esm/series/Scatter.js +1 -1
  150. package/esm/series/Series.js +1 -1
  151. package/esm/series/Sunburst.js +1 -1
  152. package/esm/series/Treemap.js +1 -1
  153. package/esm/series/Venn.js +1 -1
  154. package/esm/series/Waterfall.js +1 -1
  155. package/package.json +7 -7
package/build/index.js CHANGED
@@ -18646,14 +18646,14 @@
18646
18646
  get dpr() {
18647
18647
  return this._handler.getDpr();
18648
18648
  }
18649
- constructor(global = application.global, handlerFactory = defaultWindowHandlerFactory) {
18649
+ constructor(vRenderGlobal = application.global, handlerFactory = defaultWindowHandlerFactory) {
18650
18650
  super(), this.handlerFactory = handlerFactory, this.hooks = {
18651
18651
  onChange: new SyncHook(["x", "y", "width", "height"])
18652
18652
  }, this.active = () => {
18653
- const global = this.global;
18654
- if (!global.env || this.actived) return;
18655
- this.handlerFactory(global.env).configure(this, global), this.actived = !0;
18656
- }, this._uid = Generator.GenAutoIncrementId(), this.global = global, this.postInit();
18653
+ const vRenderGlobal = this.global;
18654
+ if (!vRenderGlobal.env || this.actived) return;
18655
+ this.handlerFactory(vRenderGlobal.env).configure(this, vRenderGlobal), this.actived = !0;
18656
+ }, this._uid = Generator.GenAutoIncrementId(), this.global = vRenderGlobal, this.postInit();
18657
18657
  }
18658
18658
  _nativeAddEventListener(type, listener, options) {
18659
18659
  return this._handler.addEventListener(type, listener, options);
@@ -30806,6 +30806,37 @@
30806
30806
  });
30807
30807
  }
30808
30808
 
30809
+ const factoryRegistry = {
30810
+ charts: {},
30811
+ series: {},
30812
+ components: {},
30813
+ graphicComponents: {},
30814
+ marks: {},
30815
+ regions: {},
30816
+ animations: {},
30817
+ implements: {},
30818
+ chartPlugin: {},
30819
+ vChartPlugin: {},
30820
+ componentPlugin: {},
30821
+ transforms: {
30822
+ fields: fields,
30823
+ filter: filter,
30824
+ fold: fold
30825
+ },
30826
+ dataParser: {
30827
+ csv: csvParser,
30828
+ dsv: dsvParser,
30829
+ tsv: tsvParser
30830
+ },
30831
+ layout: {},
30832
+ grammarTransforms: {},
30833
+ stageEventPlugins: {},
30834
+ interactionTriggers: {},
30835
+ composedEventMap: {},
30836
+ tooltipProcessors: {},
30837
+ formatter: void 0
30838
+ };
30839
+
30809
30840
  class Factory {
30810
30841
  static registerChart(key, chart) {
30811
30842
  Factory._charts[key] = chart;
@@ -30954,10 +30985,11 @@
30954
30985
  return Factory._componentPlugin[type];
30955
30986
  }
30956
30987
  static registerFormatter(func) {
30957
- this._formatter = func;
30988
+ this._formatter = func, factoryRegistry.formatter = func;
30958
30989
  }
30959
30990
  static getFormatter() {
30960
- return this._formatter;
30991
+ var _a;
30992
+ return null !== (_a = factoryRegistry.formatter) && void 0 !== _a ? _a : this._formatter;
30961
30993
  }
30962
30994
  static createInteractionTrigger(interactionType, options) {
30963
30995
  const Ctor = Factory._interactionTriggers[interactionType];
@@ -30970,21 +31002,13 @@
30970
31002
  return Factory._composedEventMap[eType];
30971
31003
  }
30972
31004
  }
30973
- Factory._charts = {}, Factory._series = {}, Factory._components = {}, Factory._graphicComponents = {}, Factory._marks = {}, Factory._regions = {}, Factory._animations = {}, Factory._implements = {}, Factory._chartPlugin = {}, Factory._vChartPlugin = {}, Factory._componentPlugin = {}, Factory.transforms = {
30974
- fields: fields,
30975
- filter: filter,
30976
- fold: fold
30977
- }, Factory.dataParser = {
30978
- csv: csvParser,
30979
- dsv: dsvParser,
30980
- tsv: tsvParser
30981
- }, Factory._layout = {}, Factory._grammarTransforms = {}, Factory._stageEventPlugins = {}, Factory.registerStageEventPlugin = (type, Plugin) => {
31005
+ Factory._charts = factoryRegistry.charts, Factory._series = factoryRegistry.series, Factory._components = factoryRegistry.components, Factory._graphicComponents = factoryRegistry.graphicComponents, Factory._marks = factoryRegistry.marks, Factory._regions = factoryRegistry.regions, Factory._animations = factoryRegistry.animations, Factory._implements = factoryRegistry.implements, Factory._chartPlugin = factoryRegistry.chartPlugin, Factory._vChartPlugin = factoryRegistry.vChartPlugin, Factory._componentPlugin = factoryRegistry.componentPlugin, Factory.transforms = factoryRegistry.transforms, Factory.dataParser = factoryRegistry.dataParser, Factory._layout = factoryRegistry.layout, Factory._grammarTransforms = factoryRegistry.grammarTransforms, Factory._stageEventPlugins = factoryRegistry.stageEventPlugins, Factory.registerStageEventPlugin = (type, Plugin) => {
30982
31006
  Factory._stageEventPlugins[type] = Plugin;
30983
- }, Factory.getStageEventPlugin = type => Factory._stageEventPlugins[type], Factory._interactionTriggers = {}, Factory.registerInteractionTrigger = (interactionType, interaction) => {
31007
+ }, Factory.getStageEventPlugin = type => Factory._stageEventPlugins[type], Factory._interactionTriggers = factoryRegistry.interactionTriggers, Factory.registerInteractionTrigger = (interactionType, interaction) => {
30984
31008
  Factory._interactionTriggers[interactionType] = interaction;
30985
- }, Factory._composedEventMap = {}, Factory.registerComposedEvent = (eType, composedEvent) => {
31009
+ }, Factory._composedEventMap = factoryRegistry.composedEventMap, Factory.registerComposedEvent = (eType, composedEvent) => {
30986
31010
  Factory._composedEventMap[eType] = composedEvent;
30987
- }, Factory._tooltipProcessors = {}, Factory.registerTooltipProcessor = (type, processor) => {
31011
+ }, Factory._tooltipProcessors = factoryRegistry.tooltipProcessors, Factory.registerTooltipProcessor = (type, processor) => {
30988
31012
  Factory._tooltipProcessors[type] = processor;
30989
31013
  }, Factory.createTooltipProcessor = (type, tooltip) => {
30990
31014
  const Cror = Factory._tooltipProcessors[type];
@@ -33731,7 +33755,8 @@
33731
33755
  params.canvas ? this.createWindowByCanvas(params) : this.createWindowByConfig(params), this.postInit();
33732
33756
  }
33733
33757
  postInit() {
33734
- if (this.global.optimizeVisible) try {
33758
+ var _a;
33759
+ if (null === (_a = this.global) || void 0 === _a ? void 0 : _a.optimizeVisible) try {
33735
33760
  this.observerCanvas();
33736
33761
  } catch (err) {
33737
33762
  console.error("发生错误,该环境不存在IntersectionObserver");
@@ -33772,10 +33797,10 @@
33772
33797
  this.canvas = new BrowserCanvas(options);
33773
33798
  }
33774
33799
  createWindowByCanvas(params) {
33775
- var _a, _b;
33800
+ var _a, _b, _c;
33776
33801
  let canvas;
33777
33802
  if ("string" == typeof params.canvas) {
33778
- if (canvas = this.global.getElementById(params.canvas), canvas || "undefined" == typeof document || (canvas = document.getElementById(params.canvas)), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
33803
+ if (canvas = null === (_a = this.global) || void 0 === _a ? void 0 : _a.getElementById(params.canvas), canvas || "undefined" == typeof document || (canvas = document.getElementById(params.canvas)), !canvas) throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom");
33779
33804
  } else canvas = params.canvas;
33780
33805
  if (!canvas) throw new Error("发生错误,传入的canvas不正确");
33781
33806
  let width = params.width,
@@ -33786,14 +33811,14 @@
33786
33811
  }
33787
33812
  let dpr = params.dpr;
33788
33813
  if (null == dpr) {
33789
- dpr = null !== (_a = canvas.getContext("2d").pixelRatio) && void 0 !== _a ? _a : canvas.width / width;
33814
+ dpr = null !== (_b = canvas.getContext("2d").pixelRatio) && void 0 !== _b ? _b : canvas.width / width;
33790
33815
  }
33791
33816
  this.canvas = new BrowserCanvas({
33792
33817
  width: width,
33793
33818
  height: height,
33794
33819
  dpr: dpr,
33795
33820
  nativeCanvas: canvas,
33796
- canvasControled: null !== (_b = params.canvasControled) && void 0 !== _b && _b
33821
+ canvasControled: null !== (_c = params.canvasControled) && void 0 !== _c && _c
33797
33822
  });
33798
33823
  }
33799
33824
  releaseWindow() {
@@ -47244,6 +47269,12 @@
47244
47269
  _hasDiffAttrs(g) {
47245
47270
  return !!g.context.diffAttrs && Object.keys(g.context.diffAttrs).length > 0;
47246
47271
  }
47272
+ _commitPreventedAnimationStaticAttrs(g, attrs) {
47273
+ var _a, _b;
47274
+ if (!attrs || !Object.keys(attrs).length) return;
47275
+ const graphic = g;
47276
+ null === (_a = graphic.setFinalAttributes) || void 0 === _a || _a.call(graphic, attrs), graphic._commitAnimationStaticAttributes ? graphic._commitAnimationStaticAttributes(attrs) : null === (_b = graphic.commitInternalBaseAttributes) || void 0 === _b || _b.call(graphic, attrs);
47277
+ }
47247
47278
  _runApplyGraphic(graphics) {
47248
47279
  const hasAnimation = this.hasAnimation();
47249
47280
  graphics.forEach((g, index) => {
@@ -47252,7 +47283,7 @@
47252
47283
  hasStateAnimation = this.hasAnimationByState(g.context.animationState);
47253
47284
  if (g.setAttributes) {
47254
47285
  const diffAttrs = this._excludeStateControlledDiffAttrs(g, getDiffAttributesOfGraphic(g, finalAttrs));
47255
- g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute, g.initAttributes(finalAttrs), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? g.setAttributesAndPreventAnimate(diffAttrs) : g.setAttributes(diffAttrs)), !(null === (_b = this.renderContext) || void 0 === _b ? void 0 : _b.progressive) && this._product && g.parent !== this._product && this._product.appendChild(g);
47286
+ g.context.diffAttrs = diffAttrs, g.context.reusing ? (g.context.lastAttrs = g.attribute, g.initAttributes(finalAttrs), g.context.reusing = !1) : hasStateAnimation || (hasAnimation ? (g.setAttributesAndPreventAnimate(diffAttrs), this._commitPreventedAnimationStaticAttrs(g, diffAttrs)) : g.setAttributes(diffAttrs)), !(null === (_b = this.renderContext) || void 0 === _b ? void 0 : _b.progressive) && this._product && g.parent !== this._product && this._product.appendChild(g);
47256
47287
  } else {
47257
47288
  const mockGraphic = g;
47258
47289
  (g = this._createGraphic(finalAttrs)).context = mockGraphic.context, g.context.diffAttrs = finalAttrs, g.stateSort = this._stateSort;
@@ -47555,7 +47586,7 @@
47555
47586
  if (this._product.context.finalAttrs = newAttrs, this._product.context.diffState === DiffState.update) {
47556
47587
  const hasAnimation = this.hasAnimation(),
47557
47588
  diffAttrs = getDiffAttributesOfGraphic(this._product, newAttrs);
47558
- this._product.context.diffAttrs = diffAttrs, this.hasAnimationByState(this._product.context.animationState) || (hasAnimation ? this._product.setAttributesAndPreventAnimate(diffAttrs) : this._product.setAttributes(diffAttrs));
47589
+ this._product.context.diffAttrs = diffAttrs, this.hasAnimationByState(this._product.context.animationState) || (hasAnimation ? (this._product.setAttributesAndPreventAnimate(diffAttrs), this._commitPreventedAnimationStaticAttrs(this._product, diffAttrs)) : this._product.setAttributes(diffAttrs));
47559
47590
  } else this._product.setAttributes(newAttrs);
47560
47591
  this.needClear = !0;
47561
47592
  }