@visactor/react-vchart 2.1.0-alpha.3 → 2.1.0-alpha.4

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 +67 -16
  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/MarkPoint.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/MarkPoint.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 +5 -5
package/build/index.js CHANGED
@@ -64017,17 +64017,15 @@
64017
64017
  }
64018
64018
  }
64019
64019
  _compareSpec(spec, prevSpec) {
64020
+ var _a, _b;
64020
64021
  const result = super._compareSpec(spec, prevSpec);
64021
64022
  if (result.reMake) return result;
64022
64023
  const specChanged = !isEqual(prevSpec, spec);
64023
- return result.reRender = !0, (null == prevSpec ? void 0 : prevSpec.type) !== (null == spec ? void 0 : spec.type) || (null == prevSpec ? void 0 : prevSpec.visible) !== (null == spec ? void 0 : spec.visible) ? (result.reMake = !0, result) : (result.reMake = ["grid", "subGrid", "tick", "subTick", "label", "domainLine", "title"].some(k => {
64024
- var _a, _b;
64025
- return (null === (_a = null == prevSpec ? void 0 : prevSpec[k]) || void 0 === _a ? void 0 : _a.visible) !== (null === (_b = null == spec ? void 0 : spec[k]) || void 0 === _b ? void 0 : _b.visible);
64026
- }), specChanged && !result.reMake && this._isComponentOnlySpecChange(spec, prevSpec) && (result.effects = Object.assign(Object.assign({}, result.effects), {
64024
+ return result.reRender = !0, (null == prevSpec ? void 0 : prevSpec.type) !== (null == spec ? void 0 : spec.type) || (null == prevSpec ? void 0 : prevSpec.visible) !== (null == spec ? void 0 : spec.visible) ? (result.reMake = !0, result) : !0 !== (null === (_a = null == spec ? void 0 : spec.grid) || void 0 === _a ? void 0 : _a.visible) || !0 === (null === (_b = null == prevSpec ? void 0 : prevSpec.grid) || void 0 === _b ? void 0 : _b.visible) || this._gridMark ? (specChanged && !result.reMake && this._isComponentOnlySpecChange(spec, prevSpec) && (result.effects = Object.assign(Object.assign({}, result.effects), {
64027
64025
  component: !0,
64028
64026
  layout: !0,
64029
64027
  render: !0
64030
- })), result);
64028
+ })), result) : (result.reMake = !0, result);
64031
64029
  }
64032
64030
  _isComponentOnlySpecChange(spec, prevSpec) {
64033
64031
  return Object.keys(Object.assign(Object.assign({}, prevSpec), spec)).every(key => isEqual(null == prevSpec ? void 0 : prevSpec[key], null == spec ? void 0 : spec[key]) || AXIS_COMPONENT_ONLY_CHANGE_KEYS[key]);
@@ -66320,10 +66318,25 @@
66320
66318
  return t;
66321
66319
  };
66322
66320
  const MARKER_COMPONENT_SPEC_KEYS = {
66323
- [ComponentTypeEnum.markPoint]: !0,
66324
- [ComponentTypeEnum.markLine]: !0,
66325
- [ComponentTypeEnum.markArea]: !0
66326
- };
66321
+ [ComponentTypeEnum.markPoint]: !0,
66322
+ [ComponentTypeEnum.markLine]: !0,
66323
+ [ComponentTypeEnum.markArea]: !0
66324
+ },
66325
+ MARKER_ADDITION_REMAKE_SPEC_KEYS = {
66326
+ autoRange: !0,
66327
+ regionId: !0,
66328
+ regionIndex: !0,
66329
+ seriesId: !0,
66330
+ seriesIndex: !0,
66331
+ relativeSeriesId: !0,
66332
+ relativeSeriesIndex: !0,
66333
+ startRelativeSeriesId: !0,
66334
+ startRelativeSeriesIndex: !0,
66335
+ endRelativeSeriesId: !0,
66336
+ endRelativeSeriesIndex: !0,
66337
+ specifiedDataSeriesId: !0,
66338
+ specifiedDataSeriesIndex: !0
66339
+ };
66327
66340
  let BaseChart$1 = class BaseChart extends CompilableBase {
66328
66341
  getSpec() {
66329
66342
  return this._spec;
@@ -66399,7 +66412,7 @@
66399
66412
  }, this.getComponentsByKey = key => this._components.filter(c => (c.specKey || c.type) === key), this.getComponentByUserId = userId => {
66400
66413
  const component = this._components.find(s => s.userId === userId);
66401
66414
  if (component) return component;
66402
- }, this.getComponentsByType = type => this._components.filter(c => c.type === type), this._paddingSpec = normalizeLayoutPaddingSpec(null !== (_a = spec.padding) && void 0 !== _a ? _a : option.getTheme("padding")), this._event = new Event$1(option.eventDispatcher, option.mode), this._dataSet = option.dataSet, this._chartData = new ChartData(this._dataSet), this._modelOption = Object.assign(Object.assign({}, option), {
66415
+ }, this.getComponentsByType = type => this._components.filter(c => c.type === type), this._isMarkerAdditionSpecSafeWithoutRemake = spec => !(!spec || "object" != typeof spec || !1 === spec.visible) && !Object.keys(MARKER_ADDITION_REMAKE_SPEC_KEYS).some(key => !isNil$1(spec[key])), this._paddingSpec = normalizeLayoutPaddingSpec(null !== (_a = spec.padding) && void 0 !== _a ? _a : option.getTheme("padding")), this._event = new Event$1(option.eventDispatcher, option.mode), this._dataSet = option.dataSet, this._chartData = new ChartData(this._dataSet), this._modelOption = Object.assign(Object.assign({}, option), {
66403
66416
  mode: this._option.mode,
66404
66417
  map: this._idMap,
66405
66418
  getChartLayoutRect: () => this._layoutRect,
@@ -66713,7 +66726,7 @@
66713
66726
  return Object.keys(spec).filter(key => !ignoreKeys[key]).sort();
66714
66727
  }
66715
66728
  updateSpec(spec) {
66716
- var _a;
66729
+ var _a, _b;
66717
66730
  const result = {
66718
66731
  change: !1,
66719
66732
  reMake: !1,
@@ -66729,7 +66742,7 @@
66729
66742
  const key = currentKeys[i],
66730
66743
  currentSpec = this._spec[key],
66731
66744
  nextSpec = spec[key];
66732
- if (isArray$1(currentSpec) && currentSpec.length !== array(nextSpec).length && !this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec)) return result.reMake = !0, this.setLayoutTag(!0, null, !1), result;
66745
+ if (isArray$1(currentSpec) && currentSpec.length !== array(nextSpec).length && !this._canChangeMarkerComponentsWithoutRemake(key, currentSpec, nextSpec)) return result.reMake = !0, this.setLayoutTag(!0, null, !1), result;
66733
66746
  }
66734
66747
  const oldSpec = this._spec,
66735
66748
  onlyMarkerComponentsRemoved = this._isOnlyMarkerComponentsRemoved(this._spec, spec, currentKeys),
@@ -66740,9 +66753,9 @@
66740
66753
  if (this.updateGlobalScale(result), result.reMake) return this.setLayoutTag(!0, null, !1), result;
66741
66754
  if (this.updateRegionSpec(result), result.reMake) return this.setLayoutTag(!0, null, !1), result;
66742
66755
  const componentUpdateResult = this.updateComponentSpec(result);
66743
- return result.reMake ? (this.setLayoutTag(!0, null, !1), result) : isUpdateSpecResultLocalOnly(result) ? result : onlyComponentSpecsChanged && !componentUpdateResult.hasNonComponentOnlyUpdate && (isUpdateSpecResultComponentOnly(result) || this._isComponentScaleDomainOnlyUpdate(result)) ? (componentUpdateResult.componentOnlyUpdatedComponents.forEach(component => {
66756
+ return result.reMake ? (this.setLayoutTag(!0, null, !1), result) : (!onlyComponentSpecsChanged && (null === (_a = result.effects) || void 0 === _a ? void 0 : _a.localOnly) && delete result.effects.localOnly, isUpdateSpecResultLocalOnly(result) ? result : onlyComponentSpecsChanged && !componentUpdateResult.hasNonComponentOnlyUpdate && (isUpdateSpecResultComponentOnly(result) || this._isComponentScaleDomainOnlyUpdate(result)) ? (componentUpdateResult.componentOnlyUpdatedComponents.forEach(component => {
66744
66757
  component.reInit(component.getSpec());
66745
- }), (null === (_a = result.effects) || void 0 === _a ? void 0 : _a.layout) && this.setLayoutTag(!0, null, !1), result) : (this.setLayoutTag(!0, null, !1), this.updateSeriesSpec(result), result.reMake || (this.reInit(), onlySeriesSpecsChanged && this._canSkipChartDataStages(result) || (this.updateDataSpec(), this.updateGlobalScaleDomain())), result);
66758
+ }), (null === (_b = result.effects) || void 0 === _b ? void 0 : _b.layout) && this.setLayoutTag(!0, null, !1), result) : (this.setLayoutTag(!0, null, !1), this.updateSeriesSpec(result), result.reMake || (this.reInit(), onlySeriesSpecsChanged && this._canSkipChartDataStages(result) || (this.updateDataSpec(), this.reDataFlow(), this._reRunStackDataFlow(), this.getAllModels().forEach(model => model.onDataUpdate()))), result));
66746
66759
  }
66747
66760
  updateChartConfig(result, oldSpec) {
66748
66761
  var _a, _b;
@@ -66788,7 +66801,7 @@
66788
66801
  componentResult = c.updateSpec(cmpSpec);
66789
66802
  isUpdateSpecResultComponentOnly(componentResult) || this._isComponentScaleDomainOnlyUpdate(componentResult) ? componentOnlyUpdatedComponents.push(c) : isEqual(previousComponentSpec, cmpSpec) || (hasNonComponentOnlyUpdate = !0), mergeUpdateResult(result, componentResult);
66790
66803
  }
66791
- });
66804
+ }), result.reMake || this._createMissingMarkerComponentsForSpecs(result, componentCache);
66792
66805
  for (const key in componentCache) if (Object.prototype.hasOwnProperty.call(componentCache, key)) {
66793
66806
  const element = componentCache[key];
66794
66807
  element.componentCount !== element.specCount && (result.reMake = !0);
@@ -66810,6 +66823,12 @@
66810
66823
  hasNonComponentOnlyUpdate: hasNonComponentOnlyUpdate
66811
66824
  };
66812
66825
  }
66826
+ _canChangeMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
66827
+ return this._canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) || this._canAddMarkerComponentsWithoutRemake(key, currentSpec, nextSpec);
66828
+ }
66829
+ _canAddMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
66830
+ return !!(MARKER_COMPONENT_SPEC_KEYS[key] && isArray$1(currentSpec) && isArray$1(nextSpec)) && !(nextSpec.length <= currentSpec.length) && nextSpec.slice(currentSpec.length).every(this._isMarkerAdditionSpecSafeWithoutRemake);
66831
+ }
66813
66832
  _canRemoveMarkerComponentsWithoutRemake(key, currentSpec, nextSpec) {
66814
66833
  return MARKER_COMPONENT_SPEC_KEYS[key] && isArray$1(currentSpec) && currentSpec.length > 0 && isArray$1(nextSpec) && 0 === nextSpec.length;
66815
66834
  }
@@ -66819,7 +66838,7 @@
66819
66838
  return hasMarkerRemoval && onlyMarkerRemoval;
66820
66839
  }
66821
66840
  _isComponentSpecKey(key) {
66822
- return this._components.some(component => (component.specKey || component.type) === key);
66841
+ return !!MARKER_COMPONENT_SPEC_KEYS[key] || this._components.some(component => (component.specKey || component.type) === key);
66823
66842
  }
66824
66843
  _isOnlyComponentSpecsChanged(currentSpec, nextSpec, specKeys) {
66825
66844
  let hasComponentSpecChange = !1;
@@ -66845,6 +66864,38 @@
66845
66864
  const effects = result.effects;
66846
66865
  return !(!(null == effects ? void 0 : effects.component) || !effects.scaleDomain || result.reMake || result.reCompile || result.reSize || effects.remake || effects.compile || effects.data || effects.series || effects.animation || result.reTransformSpec || result.reAnimate || result.changeTheme || result.changeBackground);
66847
66866
  }
66867
+ _reRunStackDataFlow() {
66868
+ var _a, _b;
66869
+ this._series.some(series => {
66870
+ var _a;
66871
+ return null === (_a = series.getStack) || void 0 === _a ? void 0 : _a.call(series);
66872
+ }) && (null === (_b = null === (_a = this._stack) || void 0 === _a ? void 0 : _a.stackAll) || void 0 === _b || _b.call(_a), this._series.forEach(series => {
66873
+ series.getViewDataFilter() && series.reTransformViewData();
66874
+ }));
66875
+ }
66876
+ _getModelSpecIndex(specInfo) {
66877
+ var _a;
66878
+ const specPath = null !== (_a = specInfo.specPath) && void 0 !== _a ? _a : [],
66879
+ specIndex = specPath[specPath.length - 1];
66880
+ return "number" == typeof specIndex ? specIndex : 0;
66881
+ }
66882
+ _hasComponentForSpecInfo(key, specInfo) {
66883
+ const specIndex = this._getModelSpecIndex(specInfo);
66884
+ return this._components.some(component => (component.specKey || component.type) === key && component.getSpecIndex() === specIndex);
66885
+ }
66886
+ _createMissingMarkerComponentsForSpecs(result, componentCache) {
66887
+ var _a;
66888
+ let createdCount = 0;
66889
+ null === (_a = this._specTransformer) || void 0 === _a || _a.forEachComponentInSpec(this._spec, (constructor, specInfo) => {
66890
+ if (result.reMake) return;
66891
+ const compSpecKey = constructor.specKey || constructor.type;
66892
+ MARKER_COMPONENT_SPEC_KEYS[compSpecKey] && !this._hasComponentForSpecInfo(compSpecKey, specInfo) && (this._isMarkerAdditionSpecSafeWithoutRemake(specInfo.spec) ? (this._createComponent(constructor, specInfo), componentCache[compSpecKey] && componentCache[compSpecKey].componentCount++, createdCount++) : result.reMake = !0);
66893
+ }, this._option.getSpecInfo()), createdCount && (result.change = !0, result.effects = Object.assign(Object.assign({}, result.effects), {
66894
+ component: !0,
66895
+ layout: !0,
66896
+ render: !0
66897
+ }));
66898
+ }
66848
66899
  _removeMarkerComponentsForEmptySpecs(result) {
66849
66900
  const removedComponents = this._components.filter(component => {
66850
66901
  var _a;