@visactor/vchart 2.0.19 → 2.0.20-alpha.1

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 (42) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.es.js +26 -11
  3. package/build/index.js +26 -11
  4. package/build/index.min.js +2 -2
  5. package/build/tsconfig.tsbuildinfo +1 -1
  6. package/cjs/compile/mark/interface.d.ts +1 -0
  7. package/cjs/compile/mark/interface.js.map +1 -1
  8. package/cjs/compile/mark/mark-state-manager.d.ts +1 -0
  9. package/cjs/compile/mark/mark-state-manager.js +3 -0
  10. package/cjs/compile/mark/mark-state-manager.js.map +1 -1
  11. package/cjs/core/vchart.js +3 -8
  12. package/cjs/core/vchart.js.map +1 -1
  13. package/cjs/data/transforms/circle-packing.d.ts +1 -0
  14. package/cjs/data/transforms/circle-packing.js.map +1 -1
  15. package/cjs/mark/base/base-mark.d.ts +1 -0
  16. package/cjs/mark/base/base-mark.js +9 -2
  17. package/cjs/mark/base/base-mark.js.map +1 -1
  18. package/cjs/mark/interface/common.d.ts +1 -0
  19. package/cjs/mark/interface/common.js.map +1 -1
  20. package/cjs/series/base/base-series.js +1 -1
  21. package/cjs/series/base/base-series.js.map +1 -1
  22. package/cjs/series/circle-packing/circle-packing.js +1 -0
  23. package/cjs/series/circle-packing/circle-packing.js.map +1 -1
  24. package/esm/compile/mark/interface.d.ts +1 -0
  25. package/esm/compile/mark/interface.js.map +1 -1
  26. package/esm/compile/mark/mark-state-manager.d.ts +1 -0
  27. package/esm/compile/mark/mark-state-manager.js +3 -0
  28. package/esm/compile/mark/mark-state-manager.js.map +1 -1
  29. package/esm/core/vchart.js +2 -5
  30. package/esm/core/vchart.js.map +1 -1
  31. package/esm/data/transforms/circle-packing.d.ts +1 -0
  32. package/esm/data/transforms/circle-packing.js.map +1 -1
  33. package/esm/mark/base/base-mark.d.ts +1 -0
  34. package/esm/mark/base/base-mark.js +9 -2
  35. package/esm/mark/base/base-mark.js.map +1 -1
  36. package/esm/mark/interface/common.d.ts +1 -0
  37. package/esm/mark/interface/common.js.map +1 -1
  38. package/esm/series/base/base-series.js +1 -1
  39. package/esm/series/base/base-series.js.map +1 -1
  40. package/esm/series/circle-packing/circle-packing.js +1 -0
  41. package/esm/series/circle-packing/circle-packing.js.map +1 -1
  42. package/package.json +8 -8
package/build/index.es.js CHANGED
@@ -57698,6 +57698,9 @@ class MarkStateManager extends StateManager {
57698
57698
  }
57699
57699
  });
57700
57700
  }
57701
+ clearAllStateInfo() {
57702
+ this._stateInfoList = [];
57703
+ }
57701
57704
  _isMultiMark() {
57702
57705
  return !this._mark || isMultiDatumMark(this._mark.type);
57703
57706
  }
@@ -58711,7 +58714,11 @@ class BaseMark extends GrammarItem {
58711
58714
  return;
58712
58715
  }
58713
58716
  this._product = mark.getProduct();
58717
+ this._product.clearStates();
58714
58718
  this._graphics = mark.getGraphics();
58719
+ this._graphics.forEach(g => {
58720
+ g.clearStates();
58721
+ });
58715
58722
  this._graphicMap = mark._graphicMap;
58716
58723
  this._graphicMap.forEach(g => {
58717
58724
  g.context = Object.assign(Object.assign({}, g.context), this._getCommonContext());
@@ -59420,6 +59427,14 @@ class BaseMark extends GrammarItem {
59420
59427
  runAnimation() {
59421
59428
  this._runStateAnimation(this.getGraphics());
59422
59429
  }
59430
+ clearBeforeReInit() {
59431
+ this.state.clearAllStateInfo();
59432
+ this.uncommit();
59433
+ this.stateStyle = {};
59434
+ this.getGraphics().forEach(g => {
59435
+ g.clearStates();
59436
+ });
59437
+ }
59423
59438
  }
59424
59439
 
59425
59440
  var MarkTypeEnum;
@@ -61230,15 +61245,12 @@ class VChart {
61230
61245
  };
61231
61246
  let currentTheme;
61232
61247
  if (!isEmpty(optionTheme) || !isEmpty(specTheme)) {
61233
- if ((isString$1(optionTheme) && (!specTheme || isString$1(specTheme))) ||
61234
- (isString$1(specTheme) && (!optionTheme || isString$1(optionTheme)))) {
61235
- const finalTheme = mergeTheme({}, getThemeObject(this._currentThemeName), getThemeObject(optionTheme), getThemeObject(specTheme));
61236
- this._currentTheme = processThemeByChartType(chartType, finalTheme);
61237
- }
61238
- else {
61239
- const finalTheme = mergeTheme({}, getThemeObject(this._currentThemeName), getThemeObject(optionTheme), getThemeObject(specTheme));
61240
- this._currentTheme = processThemeByChartType(chartType, finalTheme);
61241
- }
61248
+ const finalTheme = mergeTheme({}, getThemeObject(isObject$2(specTheme) && specTheme.type
61249
+ ? specTheme.type
61250
+ : isObject$2(optionTheme) && optionTheme.type
61251
+ ? optionTheme.type
61252
+ : this._currentThemeName), getThemeObject(optionTheme), getThemeObject(specTheme));
61253
+ this._currentTheme = processThemeByChartType(chartType, finalTheme);
61242
61254
  }
61243
61255
  else {
61244
61256
  currentTheme = getThemeObject(this._currentThemeName);
@@ -63522,6 +63534,7 @@ class BaseSeries extends BaseModel {
63522
63534
  super.reInit(spec);
63523
63535
  const marks = this.getMarksWithoutRoot();
63524
63536
  marks.forEach(mark => {
63537
+ mark.clearBeforeReInit();
63525
63538
  this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
63526
63539
  });
63527
63540
  this.initMarkStyle();
@@ -82110,13 +82123,14 @@ function translateChild(k, maxDepth) {
82110
82123
  }
82111
82124
  class CirclePackingLayout {
82112
82125
  constructor(options) {
82126
+ var _a;
82113
82127
  this.options = options;
82114
82128
  const keyOption = null == options ? void 0 : options.nodeKey,
82115
82129
  keyFunc = isFunction$1(keyOption) ? keyOption : keyOption ? field$2(keyOption) : null;
82116
82130
  this._getNodeKey = keyFunc, this._getPadding = isNumber$1(null == options ? void 0 : options.padding) ? node => options.padding : isArray$1(null == options ? void 0 : options.padding) ? node => {
82117
82131
  var _a;
82118
82132
  return null !== (_a = options.padding[node.depth + 1]) && void 0 !== _a ? _a : 0;
82119
- } : () => 0, this._maxDepth = -1;
82133
+ } : () => 0, this._maxDepth = -1, this._valueField = null !== (_a = null == options ? void 0 : options.valueField) && void 0 !== _a ? _a : "value";
82120
82134
  }
82121
82135
  layout(data, config) {
82122
82136
  var _a;
@@ -82137,7 +82151,7 @@ class CirclePackingLayout {
82137
82151
  };
82138
82152
  if (!data || !data.length) return [];
82139
82153
  const nodes = [],
82140
- res = calculateNodeValue$1(data, nodes, 0, -1, null, this._getNodeKey);
82154
+ res = calculateNodeValue$1(data, nodes, 0, -1, null, this._getNodeKey, this._valueField);
82141
82155
  this._maxDepth = res.maxDepth;
82142
82156
  const random = randomLCG(),
82143
82157
  root = {
@@ -88752,6 +88766,7 @@ class CirclePackingSeries extends CartesianSeries {
88752
88766
  options: () => {
88753
88767
  return {
88754
88768
  nodeKey: this._categoryField,
88769
+ valueField: this._valueField,
88755
88770
  padding: this._layoutPadding,
88756
88771
  includeRoot: false,
88757
88772
  width: this.getLayoutRect().width || 1,
package/build/index.js CHANGED
@@ -57704,6 +57704,9 @@
57704
57704
  }
57705
57705
  });
57706
57706
  }
57707
+ clearAllStateInfo() {
57708
+ this._stateInfoList = [];
57709
+ }
57707
57710
  _isMultiMark() {
57708
57711
  return !this._mark || isMultiDatumMark(this._mark.type);
57709
57712
  }
@@ -58717,7 +58720,11 @@
58717
58720
  return;
58718
58721
  }
58719
58722
  this._product = mark.getProduct();
58723
+ this._product.clearStates();
58720
58724
  this._graphics = mark.getGraphics();
58725
+ this._graphics.forEach(g => {
58726
+ g.clearStates();
58727
+ });
58721
58728
  this._graphicMap = mark._graphicMap;
58722
58729
  this._graphicMap.forEach(g => {
58723
58730
  g.context = Object.assign(Object.assign({}, g.context), this._getCommonContext());
@@ -59426,6 +59433,14 @@
59426
59433
  runAnimation() {
59427
59434
  this._runStateAnimation(this.getGraphics());
59428
59435
  }
59436
+ clearBeforeReInit() {
59437
+ this.state.clearAllStateInfo();
59438
+ this.uncommit();
59439
+ this.stateStyle = {};
59440
+ this.getGraphics().forEach(g => {
59441
+ g.clearStates();
59442
+ });
59443
+ }
59429
59444
  }
59430
59445
 
59431
59446
  exports.MarkTypeEnum = void 0;
@@ -61236,15 +61251,12 @@
61236
61251
  };
61237
61252
  let currentTheme;
61238
61253
  if (!isEmpty(optionTheme) || !isEmpty(specTheme)) {
61239
- if ((isString$1(optionTheme) && (!specTheme || isString$1(specTheme))) ||
61240
- (isString$1(specTheme) && (!optionTheme || isString$1(optionTheme)))) {
61241
- const finalTheme = mergeTheme({}, getThemeObject(this._currentThemeName), getThemeObject(optionTheme), getThemeObject(specTheme));
61242
- this._currentTheme = processThemeByChartType(chartType, finalTheme);
61243
- }
61244
- else {
61245
- const finalTheme = mergeTheme({}, getThemeObject(this._currentThemeName), getThemeObject(optionTheme), getThemeObject(specTheme));
61246
- this._currentTheme = processThemeByChartType(chartType, finalTheme);
61247
- }
61254
+ const finalTheme = mergeTheme({}, getThemeObject(isObject$2(specTheme) && specTheme.type
61255
+ ? specTheme.type
61256
+ : isObject$2(optionTheme) && optionTheme.type
61257
+ ? optionTheme.type
61258
+ : this._currentThemeName), getThemeObject(optionTheme), getThemeObject(specTheme));
61259
+ this._currentTheme = processThemeByChartType(chartType, finalTheme);
61248
61260
  }
61249
61261
  else {
61250
61262
  currentTheme = getThemeObject(this._currentThemeName);
@@ -63528,6 +63540,7 @@
63528
63540
  super.reInit(spec);
63529
63541
  const marks = this.getMarksWithoutRoot();
63530
63542
  marks.forEach(mark => {
63543
+ mark.clearBeforeReInit();
63531
63544
  this._spec[mark.name] && this.initMarkStyleWithSpec(mark, this._spec[mark.name]);
63532
63545
  });
63533
63546
  this.initMarkStyle();
@@ -82116,13 +82129,14 @@
82116
82129
  }
82117
82130
  class CirclePackingLayout {
82118
82131
  constructor(options) {
82132
+ var _a;
82119
82133
  this.options = options;
82120
82134
  const keyOption = null == options ? void 0 : options.nodeKey,
82121
82135
  keyFunc = isFunction$1(keyOption) ? keyOption : keyOption ? field$2(keyOption) : null;
82122
82136
  this._getNodeKey = keyFunc, this._getPadding = isNumber$1(null == options ? void 0 : options.padding) ? node => options.padding : isArray$1(null == options ? void 0 : options.padding) ? node => {
82123
82137
  var _a;
82124
82138
  return null !== (_a = options.padding[node.depth + 1]) && void 0 !== _a ? _a : 0;
82125
- } : () => 0, this._maxDepth = -1;
82139
+ } : () => 0, this._maxDepth = -1, this._valueField = null !== (_a = null == options ? void 0 : options.valueField) && void 0 !== _a ? _a : "value";
82126
82140
  }
82127
82141
  layout(data, config) {
82128
82142
  var _a;
@@ -82143,7 +82157,7 @@
82143
82157
  };
82144
82158
  if (!data || !data.length) return [];
82145
82159
  const nodes = [],
82146
- res = calculateNodeValue$1(data, nodes, 0, -1, null, this._getNodeKey);
82160
+ res = calculateNodeValue$1(data, nodes, 0, -1, null, this._getNodeKey, this._valueField);
82147
82161
  this._maxDepth = res.maxDepth;
82148
82162
  const random = randomLCG(),
82149
82163
  root = {
@@ -88758,6 +88772,7 @@
88758
88772
  options: () => {
88759
88773
  return {
88760
88774
  nodeKey: this._categoryField,
88775
+ valueField: this._valueField,
88761
88776
  padding: this._layoutPadding,
88762
88777
  includeRoot: false,
88763
88778
  width: this.getLayoutRect().width || 1,